diff --git a/.github/workflows/bare.yaml b/.github/workflows/bare.yaml index fe8ecb728..14ad5458b 100644 --- a/.github/workflows/bare.yaml +++ b/.github/workflows/bare.yaml @@ -30,7 +30,7 @@ jobs: fail-fast: false matrix: # The ARM64 build actually runs on an Amazon Docker container on Laja. - runs-on: [ ubuntu-20.04, ubuntu-18.04, amzn-2-arm64 ] + runs-on: [ ubuntu-20.04, amzn-2-arm64 ] timeout-minutes: 120 steps: - name: Prepare OS @@ -66,11 +66,6 @@ jobs: cd $CHEVAH_REPO ./chevah_build test - - name: Compat tests - run: | - cd $CHEVAH_REPO - ./chevah_build compat - # Upload using a (per-OS selected) sftp command, then show final links. - name: Upload testing package run: | @@ -96,7 +91,7 @@ jobs: strategy: fail-fast: false matrix: - runs-on: [ macos-11 ] + runs-on: [ macos-13 ] timeout-minutes: 60 steps: # Avoid linking to Homebrew's libintl during build. @@ -138,11 +133,6 @@ jobs: cd $CHEVAH_REPO ./chevah_build test - - name: Compat tests - run: | - cd $CHEVAH_REPO - ./chevah_build compat - - name: Upload testing package run: | mkdir -pv ~/.ssh/ @@ -206,12 +196,6 @@ jobs: cd $CHEVAH_REPO ./chevah_build test - - name: Compat tests - shell: bash - run: | - cd $CHEVAH_REPO - ./chevah_build compat - # To use an RSA key with SFTPPlus, install upstream OpenSSH package, # which is more finicky in regards to file permissions. # Beware the commands in this step run under PowerShell. diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index aa3d51ad9..32dff4d1e 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -20,10 +20,9 @@ env: USER: chevah CHEVAH_CONTAINER: yes -# Using a job name that doesn't contain the OS name, to minimize the risk of -# confusion with the OS names of the containers, which are the relevant ones. jobs: - latest: + + x64: runs-on: ubuntu-latest container: ${{ matrix.container }} strategy: @@ -31,7 +30,7 @@ jobs: matrix: # CentOS 5.11 setup was saved as an image pushed to Docker Hub. See the # Overview section at https://hub.docker.com/r/proatria/centos for details. - container: [ 'alpine:3.12', 'centos:8.2.2004', 'proatria/centos:5.11-chevah1' ] + container: [ 'alpine:3.12', 'centos:8.2.2004', 'proatria/centos:5.11-chevah1', 'ubuntu:18.04' ] timeout-minutes: 30 steps: @@ -53,6 +52,13 @@ jobs: yum -y upgrade yum -y install git curl gcc make m4 automake libtool patch openssl-devel zlib-devel libffi-devel ncurses-devel sudo which openssh-clients + - name: Ubuntu setup + if: startsWith(matrix.container, 'ubuntu') + run: | + apt update + apt --yes dist-upgrade + apt --yes install curl bash gcc make m4 automake libtool patch git libffi-dev zlib1g-dev libncurses5-dev libssl-dev + # On a Docker container, everything runs as root by default. - name: Chevah user setup run: | @@ -90,13 +96,6 @@ jobs: cd /home/chevah/$CHEVAH_REPO ./chevah_build test - # Compat tests must run as regular user with sudo rights. - - name: Compat tests - run: | - chown -R chevah /home/chevah/$CHEVAH_REPO - cd /home/chevah/$CHEVAH_REPO - su chevah -c "./chevah_build compat" - # Using `~/` is problematic under Docker, use `/root/`. - name: Upload testing package run: | diff --git a/chevah_build b/chevah_build index 777bc93fa..89f8508d2 100755 --- a/chevah_build +++ b/chevah_build @@ -13,51 +13,58 @@ set -o errtrace # trap errors in functions as well set -o pipefail # don't ignore exit codes when piping output PYTHON_BUILD_VERSION="2.7.18" -LIBFFI_VERSION="3.4.4" -ZLIB_VERSION="1.3" +LIBFFI_VERSION="3.4.6" +ZLIB_VERSION="1.3.1" BZIP2_VERSION="1.0.8" # We statically build the BSD libedit on selected platforms to get the # readline module available without linking to the GPL-only readline libs. LIBEDIT_VERSION="20170329-3.1" -OPENSSL_VERSION="1.1.1w" -SQLITE_VERSION="3.43.1" +# As of November 2023, security patches for OpenSSL 1.1.1 are private. +# More at https://openssl-library.org/news/vulnerabilities-1.1.1/index.html. +# See src/openssl/README for details on where to get them anyway. +OPENSSL_VERSION="1.1.1w-chevah2" +SQLITE_VERSION="3.46.0" # Python modules versions to be used everywhere possible. PYSQLITE_VERSION="2.8.3" -CFFI_VERSION="1.15.1" SCANDIR_VERSION="1.10.0" -PSUTIL_VERSION="5.9.5" +# An older version is used on generic Linux to have it built on CentOS 5. +PSUTIL_VERSION="6.0.0" SUBPROCESS32_VERSION="3.5.4" # Versions no longer upgradable because of Python 2 deprecation. +CFFI_VERSION="1.15.1" # pyOpenSSL 19.1.0 is used with OpenSSL 1.0.2 libs. PYOPENSSL_VERSION="21.0.0" # Backported fix for https://github.com/pypa/pip/issues/9827 # at https://github.com/chevah/pip/tree/20.3.4chevah. PIP_VERSION="20.3.4chevah1" # For safety alerts, we need to ignore some vulnerabilities which are either: -# * not present in the final tarball, e.g. for wheel, safety, etc., +# * not present in the final tarball, e.g. for wheel, safety, requests, etc., # * not at all relevant, e.g. those for cryptography's bundled openssl, -# * not actually relevant for these old versions, e.g. 53048 for cryptography, -# * patched by us, e.g. 40291 for pip, 53048 for cryptography, -# * not patched: 52495 for setuptools. +# * not actually relevant for these old versions, e.g. 65647 for cryptography, +# * patched by us, e.g. 40291 for pip, 53048/62556 for cryptography, +# * not patched: 52495/72236 for setuptools, 59473 for cryptography. # pip <21.1, click <8, dparse <0.5.2, wheel <0.38, safety <2.2, pywin32 <301. SAFETY_IGNORED_OPTS="-i 40291 -i 47833 -i 50571 -i 51499 -i 51358 -i 54687" # setuptools <65.5.1, requests <2.31.0, certifi <2023.07.22. SAFETY_IGNORED_OPTS="$SAFETY_IGNORED_OPTS -i 52495 -i 58755 -i 52365 -i 59956" +# requests <2.32.2, idna <3.7, setuptools <70.0.0, certifi <2024.07.04. +SAFETY_IGNORED_OPTS="$SAFETY_IGNORED_OPTS -i 71064 -i 67895 -i 72236 -i 72083" # These are related to cryptography's bundled OpenSSL libs. We don't use those. SAFETY_IGNORED_OPTS="$SAFETY_IGNORED_OPTS -i 53306 -i 53298 -i 53305 -i 53301" SAFETY_IGNORED_OPTS="$SAFETY_IGNORED_OPTS -i 53307 -i 53304 -i 53302 -i 53299" SAFETY_IGNORED_OPTS="$SAFETY_IGNORED_OPTS -i 53303 -i 59062 -i 60225 -i 60223" -SAFETY_IGNORED_OPTS="$SAFETY_IGNORED_OPTS -i 60224" -# Other cryptography vulnerabilities, see a few lines above for more details. -SAFETY_IGNORED_OPTS="$SAFETY_IGNORED_OPTS -i 53048 -i 59473" +SAFETY_IGNORED_OPTS="$SAFETY_IGNORED_OPTS -i 60224 -i 62451 -i 62452 -i 65278" +SAFETY_IGNORED_OPTS="$SAFETY_IGNORED_OPTS -i 65510 -i 71680 -i 71681" +# Other cryptography vulnerabilities, see above multi-line comment for more details. +SAFETY_IGNORED_OPTS="$SAFETY_IGNORED_OPTS -i 53048 -i 59473 -i 62556 -i 65647" # setuptools 44.x is the last series to support Python 2.7. # More at https://github.com/pypa/setuptools/pull/1955. SETUPTOOLS_VERSION="44.1.1" # Version 3.2.1 (with patches) from python-modules/ is used with OpenSSL 1.0.2. -# Our patched versions fix CVE-2023-23931. -CRYPTOGRAPHY_VERSION="3.3.2chevah" +# Our patched versions are not affected by CVE-2023-23931 and CVE-2023-49083. +CRYPTOGRAPHY_VERSION="3.3.2chevah2" # bcrypt 3.2.0 requires at least Python 3.6. BCRYPT_VERSION="3.1.7" # setproctitle 1.2.x requires at least Python 3.6. @@ -325,6 +332,16 @@ case $OS in export PATH="/usr/local/bin:$PATH" # In particular, Perl's Test::Simple and its deps are required. execute perl -MTest::Simple -e 1 + # Version 5.9.8 and newer of psutil can't build on RHEL 5 and clones. + PIP_LIBRARIES="\ + cryptography==${CRYPTOGRAPHY_VERSION} \ + pyOpenSSL==${PYOPENSSL_VERSION} \ + scandir==${SCANDIR_VERSION} \ + subprocess32==${SUBPROCESS32_VERSION} \ + bcrypt==${BCRYPT_VERSION} \ + psutil==5.9.6 \ + setproctitle==${SETPROCTITLE_VERSION} + " ;; *) # Only supported Linux distributions should be left. @@ -786,7 +803,7 @@ command_compat() { execute pushd build echo '##### Running chevah.compat tests... #####' execute rm -rf compat - execute git clone https://github.com/chevah/compat.git --depth=1 -b py2-support + execute git clone https://github.com/chevah/compat.git --depth 1 -b py2-support execute pushd compat # Copy over current brink stuff, as some changes might require it. execute cp ../../brink.{conf,sh} ./ diff --git a/external_deps.csv b/external_deps.csv index 415065297..e195f7101 100644 --- a/external_deps.csv +++ b/external_deps.csv @@ -1,35 +1,35 @@ OS,AIX,,,Amazon,Alpine,Debian,FreeBSD,,HP-UX,macOS,OS X,RHEL,,,SLES,Solaris,,,,Ubuntu Server,,,,Windows, -OS Version,5.3³,6.1³,7.1+¹,2+¹,3.12+¹,5.0+²,11.4³,12.2+³,11.31³,10.13+¹,10.8³,5.11-7.x¹,8.x¹,9.x¹,11SP4+²,10u8+³,11.0/11.1³,11.2³,11.4³,14.04/16.04¹,18.04¹,20.04¹,22.04¹,"XP, 2003, 2008³","2012r2, 2016, 2019, 2022¹" +OS Version,5.3³,6.1³,7.1+²,2+¹,3.12+¹,6.0+²,11.4³,12.2+³,11.31³,10.13+¹,10.8³,5.11-7.x¹,8.x¹,9.x+¹,11SP4+²,10u8+³,11.0/11.1³,11.2³,11.4³,16.04²,18.04¹,20.04¹,22.04+¹,"XP, 2003, 2008³","2012r2, 2016, 2019, 2022¹" OpenSSL⁶,"1.0.2v-chevah2 (statically linked with stdlib “ssl”) 1.0.2v-chevah2 (statically linked with cryptography)",1.0.2k (from AIX Web Download Pack Programs),"1.0.2v-chevah5¹⁵ (statically linked with stdlib “ssl”) -1.0.2v-chevah5¹⁵ (statically linked with cryptography)","1.1.1w (statically linked with stdlib “ssl”) -1.1.1w (statically linked with cryptography)","1.1.1w (statically linked with stdlib “ssl”) -1.1.1w (statically linked with cryptography)","1.1.1w (statically linked with stdlib “ssl”) -1.1.1w (statically linked with cryptography)",1.0.1u,1.0.2s,1.0.2h,"1.1.1w (statically linked with stdlib “ssl”) -1.1.1w (statically linked with cryptography)","1.1.1g (statically built for stdlib “ssl”) -1.1.1g (bundled with upstream cryptography 2.9.1)","1.1.1w (statically linked with stdlib “ssl”) -1.1.1w (statically linked with cryptography)","1.1.1cFIPS / -1.1.1k FIPS","1.1.1w (statically linked with stdlib “ssl”) -1.1.1w (statically linked with cryptography)","1.1.1w (statically linked with stdlib “ssl”) -1.1.1w (statically linked with cryptography)",1.0.2n (from upstream Oracle patches),1.0.0x,1.0.1h," -1.0.2o","1.1.1w (statically linked with stdlib “ssl”) -1.1.1w (statically linked with cryptography)",1.1.0g,1.1.1f,"1.1.1w (statically linked with stdlib “ssl”) -1.1.1w (statically linked with cryptography)","1.0.2t (bundled with upstream Python 2.7.18) +1.0.2v-chevah5¹⁵ (statically linked with cryptography)","1.1.1w-chevah2 (statically linked with stdlib “ssl”) +1.1.1w-chevah2 (statically linked with cryptography)","1.1.1w-chevah2 (statically linked with stdlib “ssl”) +1.1.1w-chevah2 (statically linked with cryptography)","1.1.1w-chevah2 (statically linked with stdlib “ssl”) +1.1.1w-chevah2 (statically linked with cryptography)",1.0.1u,1.0.2s,1.0.2h,"1.1.1w-chevah2 (statically linked with stdlib “ssl”) +1.1.1w-chevah2 (statically linked with cryptography)","1.1.1g (statically built for stdlib “ssl”) +1.1.1g (bundled with upstream cryptography 2.9.1)","1.1.1w-chevah2 (statically linked with stdlib “ssl”) +1.1.1w-chevah2 (statically linked with cryptography)","1.1.1cFIPS / +1.1.1k FIPS","1.1.1w-chevah2 (statically linked with stdlib “ssl”) +1.1.1w-chevah2 (statically linked with cryptography)","1.1.1w-chevah2 (statically linked with stdlib “ssl”) +1.1.1w-chevah2 (statically linked with cryptography)",1.0.2n (from upstream Oracle patches),1.0.0x,1.0.1h," +1.0.2o","1.1.1w-chevah2 (statically linked with stdlib “ssl”) +1.1.1w-chevah2 (statically linked with cryptography)",1.1.0g,1.1.1f,"1.1.1w-chevah2 (statically linked with stdlib “ssl”) +1.1.1w-chevah2 (statically linked with cryptography)","1.0.2t (bundled with upstream Python 2.7.18) 1.1.1g (bundled with upstream cryptography 2.9.1)","1.0.2t⁹ (bundled with upstream Python 2.7.18) -1.1.1w (built from upstream sources for cryptography)" +1.1.1w-chevah2 (built from upstream sources for cryptography)" Python,2.7.18+patches,2.7.18¹¹,2.7.18+patches,2.7.18+patches,2.7.18+patches,2.7.18+patches,2.7.18¹¹,2.7.18+patches,2.7.18+patches,2.7.18+patches,2.7.18¹¹,2.7.18+patches,2.7.18+patches,2.7.18+patches,2.7.18+patches,2.7.8⁴,2.7.18¹¹,2.7.18+patches,2.7.18+patches,2.7.18+patches,2.7.18+patches,2.7.18+patches,2.7.18+patches,2.7.18¹¹,2.7.18¹³ -SQLite,3.34.1,3.34.1,3.43.1,3.43.1,3.43.1,3.43.1,3.30.1,3.34.1,3.34.1,3.43.1,3.30.1,3.43.1,3.43.1,3.43.1,3.43.1,3.34.1,3.30.1,3.34.1,3.34.1,3.43.1,3.43.1,3.43.1,3.43.1,3.30.1 (we overwrite version from upstream Python at build time),3.43.1 (we overwrite version from upstream Python at build time) +SQLite,3.46.0,3.34.1,3.46.0,3.46.0,3.46.0,3.46.0,3.30.1,3.46.0,3.46.0,3.46.0,3.30.1,3.46.0,3.46.0,3.46.0,3.46.0,3.46.0,3.30.1,3.46.0,3.46.0,3.46.0,3.46.0,3.46.0,3.46.0,3.30.1 (we overwrite version from upstream Python at build time),3.46.0 (we overwrite version from upstream Python at build time) Expat,2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.1.0⁵ (bundled with Python 2.7.8),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python),2.2.8 (bundled with Python) -zlib,1.2.12,p/o,1.3,1.3,p/o,1.3,p/o,p/o,1.2.12,1.3,p/o,1.3,p/o,1.3,1.3,p/o,p/o,p/o,p/o,1.3,p/o,p/o,1.3,1.2.11⁸ (bundled with Python),1.2.11⁸ (bundled with Python) +zlib,1.2.12,p/o,1.3.1,1.3.1,1.3.1,1.3.1,p/o,p/o,1.2.12,1.3.1,p/o,1.3.1,p/o,1.3.1,1.3.1,p/o,p/o,p/o,p/o,1.3.1,p/o,p/o,1.3.1,1.2.11⁸ (bundled with Python),1.2.11⁸ (bundled with Python) bzip2,1.0.8,1.0.8,1.0.8,1.0.8,1.0.8,1.0.8,p/o,p/o,1.0.8,p/o,p/o,1.0.8,1.0.8,1.0.8,1.0.8,p/o,p/o,p/o,p/o,1.0.8,1.0.8,1.0.8,1.0.8,1.0.6 (bundled with Python),1.0.6 (bundled with Python) -libffi,3.4.4,3.4.2,3.4.4,p/o,3.4.4,3.4.4,3.4.2,3.4.2,3.4.2,p/o,p/o,3.4.4,p/o,3.4.4,3.4.4,n/a,n/a,3.4.2,3.4.2,p/o,p/o,p/o,p/o,n/a,n/a +libffi,3.4.6,3.4.2,3.4.6,3.4.6,3.4.6,3.4.6,3.4.2,3.4.2,3.4.2,p/o,p/o,3.4.6,p/o,3.4.6,3.4.6,n/a,n/a,3.4.2,3.4.2,3.4.6,p/o,p/o,3.4.6,n/a,n/a libedit,n/a,n/a,n/a,n/a,20170329-3.1,n/a,20170329-3.1,20170329-3.1,n/a,n/a,20170329-3.1,n/a,20170329-3.1,n/a,n/a,n/a,20170329-3.1,20170329-3.1,20170329-3.1,n/a,20170329-3.1,20170329-3.1,n/a,n/a,n/a pysqlite,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,2.8.3,"n/a, upstream sqlite3 is used","n/a, upstream sqlite3 is used" pip,20.3.4¹⁴,9.0.3¹⁴,20.3.4chevah1,20.3.4chevah1,20.3.4chevah1,20.3.4chevah1,9.0.3¹⁴,20.3.4chevah1,20.3.4¹⁴,20.3.4chevah1,9.0.3¹⁴,20.3.4chevah1,20.3.4chevah1,20.3.4chevah1,20.3.4chevah1,20.3.4¹⁴,9.0.3¹⁴,20.3.4¹⁴,20.3.4chevah1,20.3.4chevah1,20.3.4chevah1,20.3.4chevah1,20.3.4chevah1,20.3.4¹⁴,20.3.4chevah1 setuptools,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷,41.6.0¹⁷,41.6.0¹⁷,41.6.0¹⁷,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷,44.1.1¹⁷ pycparser,2.20,2.20,2.21,2.21,2.21,2.21,2.20,2.21,2.20,2.21,2.20,2.21,2.21,2.21,2.21,2.20,2.20,2.20,2.21,2.21,2.21,2.21,2.21,2.20,2.21 setproctitle,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10,1.1.10 -cryptography,3.2.1¹²,2.9.2¹²,3.2.1¹⁶,3.3.2¹⁶,3.3.2¹⁶,3.3.2¹⁶,2.9.2¹²,3.3.2¹⁶,n/a,3.3.2¹⁶,2.9.2¹² (wheel includes OpenSSL),3.3.2¹⁶,3.3.2¹⁶,3.3.2¹⁶,3.3.2¹⁶,n/a,n/a,n/a,3.2.1¹²,3.3.2¹⁶,3.3.2¹⁶,3.3.2¹⁶,3.3.2¹⁶,2.9.2¹² (wheel includes OpenSSL),3.3.2¹⁶ +cryptography,3.2.1¹²,2.9.2¹²,3.2.1+patches,3.3.2+patches¹⁶,3.3.2+patches¹⁶,3.3.2+patches¹⁶,2.9.2¹²,3.3.2+patches¹⁶,n/a,3.3.2+patches¹⁶,2.9.2¹² (wheel includes OpenSSL),3.3.2+patches¹⁶,3.3.2+patches¹⁶,3.3.2+patches¹⁶,3.3.2+patches¹⁶,n/a,n/a,n/a,3.2.1¹²,3.3.2+patches¹⁶,3.3.2+patches¹⁶,3.3.2+patches¹⁶,3.3.2+patches¹⁶,2.9.2¹² (wheel includes OpenSSL),3.3.2+patches¹⁶ six,1.15.0,1.13.0,1.15.0,1.15.0,1.15.0,1.15.0,1.11.0,1.15.0,1.15.0,1.15.0,1.11.0,1.15.0,1.15.0,1.15.0,1.15.0,1.15.0,1.11.0,1.15.0,1.15.0,1.11.0,1.11.0,1.11.0,1.11.0,1.11.0,1.11.0 ipaddress,1.0.23,1.0.23,1.0.23,1.0.23,1.0.23,1.0.23,1.0.23,1.0.23,n/a,1.0.23,1.0.23,1.0.23,1.0.23,1.0.23,1.0.23,n/a,n/a,n/a,1.0.23,1.0.23,1.0.23,1.0.23,1.0.23,1.0.23,1.0.23 cffi,1.14.5,1.14.0,1.15.1,1.15.1,1.15.1,1.15.1,1.14.0,1.15.1,n/a,1.15.1,1.14.0,1.15.1,1.15.1,1.15.1,1.15.1,n/a,1.14.0,1.14.5,1.15.1,1.15.1,1.15.1,1.15.1,1.15.1,1.14.0,1.15.1 @@ -38,10 +38,10 @@ enum34,1.1.10,1.1.6,1.1.10,1.1.10,1.1.10,1.1.10,1.1.6,1.1.10,n/a,1.1.10,1.1.6,1. idna,n/a,2.6,n/a,n/a,n/a,n/a,2.6,n/a,n/a,n/a,2.6,n/a,n/a,n/a,n/a,n/a,2.6,n/a,n/a,n/a,n/a,n/a,n/a,2.6,n/a pyOpenSSL,19.1.0,19.1.0,19.1.0,21.0.0,21.0.0,21.0.0,19.1.0,21.0.0,0.13.1⁷,21.0.0,19.1.0,21.0.0,21.0.0,21.0.0,21.0.0,0.13.1⁷,0.13.1⁷,0.13.1⁷,19.1.0,21.0.0,21.0.0,21.0.0,21.0.0,19.1.0,21.0.0 scandir,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0,1.10.0 -psutil,n/a,5.6.5,5.9.5,5.9.5,5.9.5,5.9.5,n/a,5.9.2,n/a,5.9.5,5.6.5,5.9.5,5.9.5,5.9.5,5.9.5,n/a,n/a,n/a,5.9.2,5.9.5,5.9.5,5.9.5,5.9.5,n/a,5.9.5 +psutil,n/a,5.6.5,6.0.0,5.9.6,6.0.0,5.9.6,n/a,5.9.2,n/a,6.0.0,5.6.5,5.9.6,6.0.0,5.9.6,5.9.6,n/a,n/a,n/a,6.0.0,5.9.6,6.0.0,6.0.0,5.9.6,n/a,6.0.0 subprocess32,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4,3.5.4 bcrypt,3.1.7,3.1.7,3.1.7,3.1.7,3.1.7,3.1.7,3.1.7,3.1.7,n/a,3.1.7,3.1.7,3.1.7,3.1.7,3.1.7,3.1.7,3.1.7,3.1.7,3.1.7,3.1.7,3.1.7,3.1.7,3.1.7,3.1.7,3.1.7,3.1.7 -pywin32,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,,n/a,227,228 +pywin32,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,n/a,227,228 ,,,,,,,,,,,,,,,,,,,,,,,,, Abbreviations:,n/a: not applicable,,,,,,,,,,Notes:,"0. Dependencies above are listed as per the current build process, not necessarily for the latest released versions of python-package.",,,,,,,,,,,,, ,p/o: provided with OS,,,,,,,,,,,"1. Tier 1 platforms, fully supported and tested",,,,,,,,,,,,, @@ -56,8 +56,8 @@ Colour codes:,DARKGREY: Tier 2 platforms and their problematic dependencies,,,,, ,,,,,,,,,,,,10. https://www.openssl.org/news/openssl-1.1.1-notes.html,,,,,,,,,,,,, ,,,,,,,,,,,,11. https://github.com/ActiveState/cpython/tags,,,,,,,,,,,,, ,,,,,,,,,,,,12. https://cryptography.io/en/latest/changelog.html,,,,,,,,,,,,, -,,,,,,,,,,,,"13. On Windows, the upstream Python 2.7.18 packages are hot patched for all known issues except CVE-2021-3177 and CVE-2020-10735",,,,,,,,,,,,, +,,,,,,,,,,,,"13. On Windows, the upstream Python 2.7.18 packages are not patched for CVE-2020-10735, CVE-2021-3177, CVE-2022-48560, CVE-2022-48566, CVE-2023-40217, CVE-2024-0397.",,,,,,,,,,,,, ,,,,,,,,,,,,14. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3572,,,,,,,,,,,,, ,,,,,,,,,,,,15. Corresponds to upstream OpenSSL version 1.0.2zg from 07 Feb 2023.,,,,,,,,,,,,, -,,,,,,,,,,,,"16. Both cryptography 3.2.1 and version 3.3.2 have been patched for CVE-2023-23931, but not for CVE-2023-38325.",,,,,,,,,,,,, -,,,,,,,,,,,,17. Versions older than 65.5.1 are vulnerable to CVE-2022-40897.,,,,,,,,,,,,, +,,,,,,,,,,,,"16. Both cryptography 3.2.1 and version 3.3.2+patches have been patched for CVE-2023-23931 and CVE-2023-49083, but not for CVE-2023-38325. Other issues might be present.",,,,,,,,,,,,, +,,,,,,,,,,,,"17. Vulnerable to CVE-2022-40897, CVE-2024-6345.",,,,,,,,,,,,, diff --git a/external_deps.fods b/external_deps.fods index 3752d24ba..a83054cd7 100644 --- a/external_deps.fods +++ b/external_deps.fods @@ -1,20 +1,20 @@ - LibreOffice/7.6.2.1$Linux_X86_64 LibreOffice_project/56f7684011345957bbf33a7ee678afaf4d2ba333151PT9H17M48Spython-package - external dependencies and associated vulnerabilities2023-10-10T11:39:47.776983843 + LibreOffice/24.2.5.2$Linux_X86_64 LibreOffice_project/bffef4ea93e59bebbeaf7f431bb02b1a39ee8a59172PT10H25M55Spython-package - external dependencies and associated vulnerabilities2024-08-20T11:02:45.442494389 0 0 - 49331 - 24070 + 41189 + 23574 view1 - 3 - 2 + 18 + 20 2 2 1 @@ -103,7 +103,7 @@ false Generic Printer false - 1gH+/0dlbmVyaWMgUHJpbnRlcgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU0dFTlBSVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWAAMAwgAAAAAAAAAEAAhSAAAEdAAASm9iRGF0YSAxCnByaW50ZXI9R2VuZXJpYyBQcmludGVyCm9yaWVudGF0aW9uPVBvcnRyYWl0CmNvcGllcz0xCmNvbGxhdGU9ZmFsc2UKbWFyZ2luYWRqdXN0bWVudD0wLDAsJzAsMApjb2xvcmRlcHRoPTI0CnBzbGV2ZWw9MApwZGZkZXZpY2U9MQpjb2xvcmRldmljZT0wClBQRENvbnRleHREYXRhClBhZ2VTaXplOkE0AER1cGxleDpOb25lAAASAENPTVBBVF9EVVBMRVhfTU9ERQ8ARHVwbGV4TW9kZTo6T2ZmDABQUklOVEVSX05BTUUPAEdlbmVyaWMgUHJpbnRlcgsARFJJVkVSX05BTUUHAFNHRU5QUlQ= + wAH+/0dlbmVyaWMgUHJpbnRlcgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU0dFTlBSVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWAAMArAAAAAAAAAAEAAhSAAAEdAAASm9iRGF0YSAxCnByaW50ZXI9R2VuZXJpYyBQcmludGVyCm9yaWVudGF0aW9uPVBvcnRyYWl0CmNvcGllcz0xCmNvbGxhdGU9ZmFsc2UKbWFyZ2luYWRqdXN0bWVudD0wLDAsJzAsMApjb2xvcmRlcHRoPTI0CmNvbG9yZGV2aWNlPTAKUFBEQ29udGV4dERhdGEKUGFnZVNpemU6QTQARHVwbGV4Ok5vbmUAABIAQ09NUEFUX0RVUExFWF9NT0RFDwBEdXBsZXhNb2RlOjpPZmYMAFBSSU5URVJfTkFNRQ8AR2VuZXJpYyBQcmludGVyCwBEUklWRVJfTkFNRQcAU0dFTlBSVA== false 1000 1000 @@ -133,63 +133,64 @@ - - + + - + + - + - - + + - - + + - + $ - + - $ - + - + : - + : : - + : - + @@ -403,7 +404,7 @@ - + @@ -462,93 +463,112 @@ - + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + @@ -556,40 +576,47 @@ + + + . + + . + + - - + + - - - - - - - + + - - + + - - + + + + + + + - + - + @@ -597,434 +624,567 @@ - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - - - + + + + + + + + + - - + + - - + + - + + + + + + - - + + - + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - + - + - - + + - + + + + + + - - + + - - + + - - + + - + - - + + - - + + + + + + + - - + + + + + + + - - + + - + - - + + - + + + + + + - - + + - - + + - - - - - - - + + - + - - + + - - + + - - + + + + + + + - - + + - + + + + + + + + + + + + + + + + - - + + - - + + - - + + + + + + + - - + + - + - - + + - - - - + + + + - - + + + + + + + + + + + + - - + + - - + + - - + + - + + + + + + - - + + + + + + + + + + + + - - + + - - + + - - + + - + - - + + - - + + - - + + - + - - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + - + - - - - - - - + + - - + + + + + + + - - + + - - + + + + + - + - - + + - - - - + + + + - - + + - - + + - - + + + + + + + - - + + - - + + - - + + - + + + + + + - - + + - - + + - - - - + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - - - + + + + - - - - + + + + - - + + - + @@ -1032,65 +1192,65 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1099,7 +1259,7 @@ - + @@ -1126,112 +1286,112 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1253,7 +1413,7 @@ ???(???) - 00/00/0000, 00:00:00 + 00.00.0000, 00:00:00 @@ -1287,23 +1447,23 @@ - - + + - - + + - + @@ -1369,8 +1529,7 @@ 6.1³ - - 7.1+¹ + 7.1+² 2+¹ @@ -1378,7 +1537,7 @@ 3.12+¹ - 5.0+² + 6.0+² 11.4³ @@ -1398,11 +1557,11 @@ 8.x¹ - 9.x¹ + 9.x+¹ - 11SP4+² + 11SP4+² - 10u8+³ + 10u8+³ 11.0/11.1³ @@ -1410,17 +1569,16 @@ 11.4³ - - 14.04/16.04¹ + 16.04² - + 18.04¹ - + 20.04¹ - - 22.04¹ + + 22.04+¹ XP, 2003, 2008³ @@ -1431,19 +1589,19 @@ - OpenSSL + OpenSSL 1.0.2v-chevah2 (statically linked with stdlib “ssl”)1.0.2v-chevah2 (statically linked with cryptography) 1.0.2k (from AIX Web Download Pack Programs) - 1.0.2v-chevah5¹⁵ (statically linked with stdlib “ssl”)1.0.2v-chevah5¹⁵ (statically linked with cryptography) + 1.0.2v-chevah5¹⁵ (statically linked with stdlib “ssl”)1.0.2v-chevah5¹⁵ (statically linked with cryptography) - 1.1.1w (statically linked with stdlib “ssl”)1.1.1w (statically linked with cryptography) + 1.1.1w-chevah2 (statically linked with stdlib “ssl”)1.1.1w-chevah2 (statically linked with cryptography) - 1.1.1w (statically linked with stdlib “ssl”)1.1.1w (statically linked with cryptography) + 1.1.1w-chevah2 (statically linked with stdlib “ssl”)1.1.1w-chevah2 (statically linked with cryptography) - 1.1.1w (statically linked with stdlib “ssl”)1.1.1w (statically linked with cryptography) + 1.1.1w-chevah2 (statically linked with stdlib “ssl”)1.1.1w-chevah2 (statically linked with cryptography) 1.0.1u @@ -1454,17 +1612,17 @@ 1.0.2h - 1.1.1w (statically linked with stdlib “ssl”)1.1.1w (statically linked with cryptography) + 1.1.1w-chevah2 (statically linked with stdlib “ssl”)1.1.1w-chevah2 (statically linked with cryptography) - 1.1.1g (statically built for stdlib “ssl”)1.1.1g (bundled with upstream cryptography 2.9.1) + 1.1.1g (statically built for stdlib “ssl”)1.1.1g (bundled with upstream cryptography 2.9.1) - 1.1.1w (statically linked with stdlib “ssl”)1.1.1w (statically linked with cryptography) + 1.1.1w-chevah2 (statically linked with stdlib “ssl”)1.1.1w-chevah2 (statically linked with cryptography) - 1.1.1cFIPS /1.1.1k FIPS + 1.1.1cFIPS /1.1.1k FIPS - 1.1.1w (statically linked with stdlib “ssl”)1.1.1w (statically linked with cryptography) + 1.1.1w-chevah2 (statically linked with stdlib “ssl”)1.1.1w-chevah2 (statically linked with cryptography) - 1.1.1w (statically linked with stdlib “ssl”)1.1.1w (statically linked with cryptography) + 1.1.1w-chevah2 (statically linked with stdlib “ssl”)1.1.1w-chevah2 (statically linked with cryptography) 1.0.2n (from upstream Oracle patches) @@ -1476,7 +1634,7 @@ 1.0.2o - 1.1.1w (statically linked with stdlib “ssl”)1.1.1w (statically linked with cryptography) + 1.1.1w-chevah2 (statically linked with stdlib “ssl”)1.1.1w-chevah2 (statically linked with cryptography) 1.1.0g @@ -1484,73 +1642,73 @@ 1.1.1f - 1.1.1w (statically linked with stdlib “ssl”)1.1.1w (statically linked with cryptography) + 1.1.1w-chevah2 (statically linked with stdlib “ssl”)1.1.1w-chevah2 (statically linked with cryptography) 1.0.2t (bundled with upstream Python 2.7.18)1.1.1g (bundled with upstream cryptography 2.9.1) - 1.0.2t⁹ (bundled with upstream Python 2.7.18)1.1.1w (built from upstream sources for cryptography) + 1.0.2t⁹ (bundled with upstream Python 2.7.18)1.1.1w-chevah2 (built from upstream sources for cryptography) - + Python - + 2.7.18+patches 2.7.18¹¹ - + 2.7.18+patches - + 2.7.18+patches 2.7.18¹¹ - + 2.7.18+patches - + 2.7.18+patches 2.7.18¹¹ - + 2.7.18+patches - + 2.7.18+patches - + 2.7.18+patches - + 2.7.18+patches - 2.7.8 + 2.7.8 2.7.18¹¹ - + 2.7.18+patches - + 2.7.18+patches - + 2.7.18+patches - + 2.7.18+patches - + 2.7.18+patches 2.7.18¹¹ - 2.7.18¹³ + 2.7.18¹³ @@ -1559,56 +1717,53 @@ SQLite - 3.34.1 + 3.46.0 3.34.1 - 3.43.1 + 3.46.0 - 3.43.1 + 3.46.0 3.30.1 - - 3.34.1 + + 3.46.0 - - 3.43.1 + + 3.46.0 3.30.1 - 3.43.1 + 3.46.0 - 3.43.1 + 3.46.0 - - 3.43.1 - - - 3.34.1 + + 3.46.0 3.30.1 - 3.34.1 + 3.46.0 - 3.43.1 + 3.46.0 - 3.43.1 + 3.46.0 - 3.30.1 (we overwrite version from upstream Python at build time) + 3.30.1 (we overwrite version from upstream Python at build time) - 3.43.1 (we overwrite version from upstream Python at build time) + 3.46.0 (we overwrite version from upstream Python at build time) @@ -1624,7 +1779,7 @@ 2.2.8 (bundled with Python) - 2.2.8 (bundled with Python) + 2.2.8 (bundled with Python) 2.2.8 (bundled with Python) @@ -1678,14 +1833,14 @@ p/o - - 1.3 + + 1.3.1 - - p/o + + 1.3.1 - - 1.3 + + 1.3.1 p/o @@ -1696,20 +1851,20 @@ 1.2.12 - - 1.3 + + 1.3.1 p/o - - 1.3 + + 1.3.1 p/o - - 1.3 + + 1.3.1 p/o @@ -1720,18 +1875,18 @@ p/o - - 1.3 + + 1.3.1 p/o - - 1.3 + + 1.3.1 - 1.2.11 (bundled with Python) + 1.2.11 (bundled with Python) - 1.2.11 (bundled with Python) + 1.2.11 (bundled with Python) @@ -1812,23 +1967,23 @@ libffi - - 3.4.4 + + 3.4.6 3.4.2 - - 3.4.4 + + 3.4.6 - - p/o + + 3.4.6 - - 3.4.4 + + 3.4.6 - - 3.4.4 + + 3.4.6 3.4.2 @@ -1845,17 +2000,17 @@ p/o - - 3.4.4 + + 3.4.6 p/o - - 3.4.4 + + 3.4.6 - - 3.4.4 + + 3.4.6 n/a @@ -1869,14 +2024,14 @@ 3.4.2 - - p/o + + 3.4.6 p/o - - p/o + + 3.4.6 n/a @@ -1899,7 +2054,7 @@ n/a - + n/a @@ -1914,22 +2069,25 @@ 20170329-3.1 - + + n/a + + n/a 20170329-3.1 - + n/a 20170329-3.1 - + n/a - + n/a @@ -1947,13 +2105,13 @@ 20170329-3.1 - + n/a - + n/a - + n/a @@ -2019,7 +2177,10 @@ 2.8.3 - + + n/a, upstream sqlite3 is used + + n/a, upstream sqlite3 is used @@ -2049,7 +2210,7 @@ 20.3.4chevah1 - 20.3.4¹⁴ + 20.3.4¹⁴ 20.3.4chevah1 @@ -2097,55 +2258,55 @@ setuptools - 44.1.1¹⁷ + 44.1.1¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ 44.1.1¹⁷ 44.1.1¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ 44.1.1¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ - 41.6.0¹⁷ + 41.6.0¹⁷ - 41.6.0¹⁷ + 41.6.0¹⁷ - 41.6.0¹⁷ + 41.6.0¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ - 44.1.1¹⁷ + 44.1.1¹⁷ @@ -2159,7 +2320,7 @@ 2.21 - + 2.21 @@ -2183,7 +2344,7 @@ 2.21 - + 2.21 @@ -2198,7 +2359,7 @@ 2.21 - + 2.20 @@ -2283,32 +2444,30 @@ 2.9.2¹² - 3.2.1¹⁶ - - 3.3.2¹⁶ - - 3.3.2¹⁶ + + 3.2.1+patches - 3.3.2¹⁶ + + 3.3.2+patches¹⁶ 2.9.2¹² - 3.3.2¹⁶ + + 3.3.2+patches¹⁶ n/a - 3.3.2¹⁶ + + 3.3.2+patches¹⁶ - 2.9.2¹² (wheel includes OpenSSL) + 2.9.2¹² (wheel includes OpenSSL) - 3.3.2¹⁶ + + 3.3.2+patches¹⁶ - 3.3.2¹⁶ - - 3.3.2¹⁶ - - 3.3.2¹⁶ + + 3.3.2+patches¹⁶ n/a @@ -2318,17 +2477,16 @@ 3.2.1¹² - 3.3.2¹⁶ - - 3.3.2¹⁶ - - 3.3.2¹⁶ + + 3.3.2+patches¹⁶ - 3.3.2¹⁶ + + 3.3.2+patches¹⁶ - 2.9.2¹² (wheel includes OpenSSL) + 2.9.2¹² (wheel includes OpenSSL) - 3.3.2¹⁶ + + 3.3.2+patches¹⁶ @@ -2420,7 +2578,7 @@ 1.0.23 - + 1.0.23 @@ -2492,7 +2650,7 @@ 1.15.1 - + 1.15.1 @@ -2585,7 +2743,7 @@ n/a - + n/a @@ -2597,7 +2755,7 @@ 1.2.0 - + n/a @@ -2606,7 +2764,7 @@ n/a - + n/a @@ -2648,7 +2806,7 @@ 1.1.10 - + n/a @@ -2701,13 +2859,13 @@ n/a - + 2.6 n/a - + 2.6 @@ -2716,13 +2874,13 @@ n/a - + 2.6 n/a - + n/a @@ -2731,10 +2889,10 @@ n/a - + 2.6 - + n/a @@ -2743,13 +2901,13 @@ n/a - + n/a n/a - + 2.6 @@ -2785,7 +2943,7 @@ 21.0.0 - 0.13.1 + 0.13.1 21.0.0 @@ -2805,11 +2963,11 @@ 21.0.0 - 0.13.1 + 0.13.1 - 0.13.1 + 0.13.1 - 0.13.1 + 0.13.1 19.1.0 @@ -2904,74 +3062,74 @@ psutil - + n/a 5.6.5 - 5.9.5 + 6.0.0 - - 5.9.5 + + 5.9.6 - 5.9.5 + 6.0.0 - 5.9.5 + 5.9.6 - + n/a 5.9.2 - + n/a - 5.9.5 + 6.0.0 5.6.5 - 5.9.5 + 5.9.6 - 5.9.5 + 6.0.0 - 5.9.5 + 5.9.6 - 5.9.5 + 5.9.6 - + n/a - + n/a - 5.9.2 + 6.0.0 - 5.9.5 + 5.9.6 - 5.9.5 + 6.0.0 - 5.9.5 + 5.9.6 n/a - 5.9.5 + 6.0.0 @@ -2988,7 +3146,7 @@ 3.5.4 - + 3.5.4 @@ -3066,7 +3224,7 @@ 3.1.7 - + n/a @@ -3114,62 +3272,61 @@ pywin32 - + n/a - + n/a - + n/a - + n/a - + n/a - + n/a - + n/a - + n/a - + n/a - + n/a - + n/a - + n/a - + n/a - + n/a - + n/a - + n/a - + n/a - + n/a - - + n/a @@ -3200,7 +3357,8 @@ 0. Dependencies above are listed as per the current build process, not necessarily for the latest released versions of python-package. - + + @@ -3214,7 +3372,8 @@ 1. Tier 1 platforms, fully supported and tested - + + @@ -3229,7 +3388,8 @@ 2. Tier 2 platforms, partially supported, still built - + + @@ -3242,7 +3402,8 @@ 3. Tier 3 platforms, supported at some point, not built any more - + + @@ -3255,7 +3416,8 @@ 4. https://www.cvedetails.com/vulnerability-list/vendor_id-10210/product_id-18230/version_id-92056/Python-Python-2.7.html - + + @@ -3268,7 +3430,8 @@ 5. https://github.com/libexpat/libexpat/blob/master/expat/Changes - + + @@ -3278,10 +3441,11 @@ - + 6. Unless specified otherwise, OpenSSL libs are linked against dynamically - + + @@ -3294,7 +3458,8 @@ 7. pyOpenSSL 0.14 and newer is a major rewrite, so it's not clear to what extent their vulnerabilities do apply - + + @@ -3306,105 +3471,115 @@ 8. https://cve.report/CVE-2018-25032 and https://cve.report/CVE-2022-37434 - + + - + DEFAULT COLOUR: maintained upstream or not applicable - 9. https://www.openssl.org/news/openssl-1.0.2-notes.html + 9. https://www.openssl.org/news/openssl-1.0.2-notes.html - + + - + - 10. https://www.openssl.org/news/openssl-1.1.1-notes.html + 10. https://www.openssl.org/news/openssl-1.1.1-notes.html - + + - + - 11. https://github.com/ActiveState/cpython/tags + 11. https://github.com/ActiveState/cpython/tags - + + - + 12. https://cryptography.io/en/latest/changelog.html - + + - 13. On Windows, the upstream Python 2.7.18 packages are hot patched for all known issues except CVE-2021-3177 and CVE-2020-10735 + 13. On Windows, the upstream Python 2.7.18 packages are not patched for CVE-2020-10735, CVE-2021-3177, CVE-2022-48560, CVE-2022-48566, CVE-2023-40217, CVE-2024-0397. - + + - + 14. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3572 - + + - + 15. Corresponds to upstream OpenSSL version 1.0.2zg from 07 Feb 2023. - + + - - 16. Both cryptography 3.2.1 and version 3.3.2 have been patched for CVE-2023-23931, but not for CVE-2023-38325. + + 16. Both cryptography 3.2.1 and version 3.3.2+patches have been patched for CVE-2023-23931 and CVE-2023-49083, but not for CVE-2023-38325. Other issues might be present. - + + - - 17. Versions older than 65.5.1 are vulnerable to CVE-2022-40897. + + 17. Vulnerable to CVE-2022-40897, CVE-2024-6345. - + + - + - + - + diff --git a/python-modules/chevah-python-test/test_python_binary_dist.py b/python-modules/chevah-python-test/test_python_binary_dist.py index ebcc64795..a01fd7c46 100644 --- a/python-modules/chevah-python-test/test_python_binary_dist.py +++ b/python-modules/chevah-python-test/test_python_binary_dist.py @@ -433,7 +433,7 @@ def main(): openssl_version = backend.openssl_version_text() if CHEVAH_OS.startswith(("win", "lnx", "macos", "aix")): # On some OS'es we build against our own OpenSSL. - expecting = u'OpenSSL 1.1.1w 11 Sep 2023' + expecting = u'OpenSSL 1.1.1w-chevah2 15 Aug 2024' if CHEVAH_OS.startswith("aix"): # On AIX we are stuck with a patched 1.0.2. expecting = u'OpenSSL 1.0.2v-chevah5 21 Sep 2023' diff --git a/python-modules/cryptography-3.2.1-patches/CVE-2023-49083.patch b/python-modules/cryptography-3.2.1-patches/CVE-2023-49083.patch new file mode 100644 index 000000000..0611cb56d --- /dev/null +++ b/python-modules/cryptography-3.2.1-patches/CVE-2023-49083.patch @@ -0,0 +1,35 @@ +diff --git a/python-modules/cryptography-3.2.1/src/cryptography/hazmat/backends/openssl/backend.py b/python-modules/cryptography-3.2.1/src/cryptography/hazmat/backends/openssl/backend.py +index b7757e33..235414b8 100644 +--- a/python-modules/cryptography-3.2.1/src/cryptography/hazmat/backends/openssl/backend.py ++++ b/python-modules/cryptography-3.2.1/src/cryptography/hazmat/backends/openssl/backend.py +@@ -2673,9 +2673,12 @@ class Backend(object): + _Reasons.UNSUPPORTED_SERIALIZATION, + ) + ++ certs = [] # type: list of x509.Certificate ++ if p7.d.sign == self._ffi.NULL: ++ return certs ++ + sk_x509 = p7.d.sign.cert + num = self._lib.sk_X509_num(sk_x509) +- certs = [] + for i in range(num): + x509 = self._lib.sk_X509_value(sk_x509, i) + self.openssl_assert(x509 != self._ffi.NULL) +diff --git a/python-modules/cryptography-3.2.1/tests/hazmat/primitives/test_pkcs7.py b/python-modules/cryptography-3.2.1/tests/hazmat/primitives/test_pkcs7.py +index 8b93cb63..148a1e1e 100644 +--- a/python-modules/cryptography-3.2.1/tests/hazmat/primitives/test_pkcs7.py ++++ b/python-modules/cryptography-3.2.1/tests/hazmat/primitives/test_pkcs7.py +@@ -80,6 +80,12 @@ class TestPKCS7Loading(object): + mode="rb", + ) + ++ def test_load_pkcs7_empty_certificates(self): ++ der = b"\x30\x0B\x06\x09\x2A\x86\x48\x86\xF7\x0D\x01\x07\x02" ++ ++ certificates = pkcs7.load_der_pkcs7_certificates(der) ++ assert certificates == [] ++ + + # We have no public verification API and won't be adding one until we get + # some requirements from users so this function exists to give us basic diff --git a/src/libffi/libffi-3.4.4/doc/stamp-vti b/src/libffi/libffi-3.4.4/doc/stamp-vti deleted file mode 100644 index 6056fad8d..000000000 --- a/src/libffi/libffi-3.4.4/doc/stamp-vti +++ /dev/null @@ -1,4 +0,0 @@ -@set UPDATED 23 October 2022 -@set UPDATED-MONTH October 2022 -@set EDITION 3.4.4 -@set VERSION 3.4.4 diff --git a/src/libffi/libffi-3.4.4/doc/version.texi b/src/libffi/libffi-3.4.4/doc/version.texi deleted file mode 100644 index 6056fad8d..000000000 --- a/src/libffi/libffi-3.4.4/doc/version.texi +++ /dev/null @@ -1,4 +0,0 @@ -@set UPDATED 23 October 2022 -@set UPDATED-MONTH October 2022 -@set EDITION 3.4.4 -@set VERSION 3.4.4 diff --git a/src/libffi/libffi-3.4.4/src/arc/arcompact.S b/src/libffi/libffi-3.4.4/src/arc/arcompact.S deleted file mode 100644 index 03715fde4..000000000 --- a/src/libffi/libffi-3.4.4/src/arc/arcompact.S +++ /dev/null @@ -1,135 +0,0 @@ -/* ----------------------------------------------------------------------- - arcompact.S - Copyright (c) 2013 Synposys, Inc. (www.synopsys.com) - - ARCompact Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#define LIBFFI_ASM -#include -#include -#ifdef HAVE_MACHINE_ASM_H -#include -#else -#define CNAME(x) x -#define ENTRY(x) .globl CNAME(x)` .type CNAME(x),%function` CNAME(x): -#endif - -.text - - /* R0: ffi_prep_args */ - /* R1: &ecif */ - /* R2: cif->bytes */ - /* R3: fig->flags */ - /* R4: ecif.rvalue */ - /* R5: fn */ -ENTRY(ffi_call_ARCompact) - /* Save registers. */ - st.a fp, [sp, -4] /* fp + 20, fp */ - push_s blink /* fp + 16, blink */ - st.a r4, [sp, -4] /* fp + 12, ecif.rvalue */ - push_s r3 /* fp + 8, fig->flags */ - st.a r5, [sp, -4] /* fp + 4, fn */ - push_s r2 /* fp + 0, cif->bytes */ - mov fp, sp - - /* Make room for all of the new args. */ - sub sp, sp, r2 - - /* Place all of the ffi_prep_args in position. */ - /* ffi_prep_args(char *stack, extended_cif *ecif) */ - /* R1 already set. */ - - /* And call. */ - jl_s.d [r0] - mov_s r0, sp - - ld.ab r12, [fp, 4] /* cif->bytes */ - ld.ab r11, [fp, 4] /* fn */ - - /* Move first 8 parameters in registers... */ - ld_s r0, [sp] - ld_s r1, [sp, 4] - ld_s r2, [sp, 8] - ld_s r3, [sp, 12] - ld r4, [sp, 16] - ld r5, [sp, 20] - ld r6, [sp, 24] - ld r7, [sp, 28] - - /* ...and adjust the stack. */ - min r12, r12, 32 - - /* Call the function. */ - jl.d [r11] - add sp, sp, r12 - - mov sp, fp - pop_s r3 /* fig->flags, return type */ - pop_s r2 /* ecif.rvalue, pointer for return value */ - - /* If the return value pointer is NULL, assume no return value. */ - breq.d r2, 0, epilogue - pop_s blink - - /* Return INT. */ - brne r3, FFI_TYPE_INT, return_double - b.d epilogue - st_s r0, [r2] - -return_double: - brne r3, FFI_TYPE_DOUBLE, epilogue - st_s r0, [r2] - st_s r1, [r2,4] - -epilogue: - j_s.d [blink] - ld.ab fp, [sp, 4] - -ENTRY(ffi_closure_ARCompact) - st.a r0, [sp, -32] - st_s r1, [sp, 4] - st_s r2, [sp, 8] - st_s r3, [sp, 12] - st r4, [sp, 16] - st r5, [sp, 20] - st r6, [sp, 24] - st r7, [sp, 28] - - /* pointer to arguments */ - mov_s r2, sp - - /* return value goes here */ - sub sp, sp, 8 - mov_s r1, sp - - push_s blink - - bl.d ffi_closure_inner_ARCompact - mov_s r0, r8 /* codeloc, set by trampoline */ - - pop_s blink - - /* set return value to r1:r0 */ - pop_s r0 - pop_s r1 - j_s.d [blink] - add_s sp, sp, 32 diff --git a/src/libffi/libffi-3.4.4/src/arc/ffi.c b/src/libffi/libffi-3.4.4/src/arc/ffi.c deleted file mode 100644 index 4d10b21a5..000000000 --- a/src/libffi/libffi-3.4.4/src/arc/ffi.c +++ /dev/null @@ -1,266 +0,0 @@ -/* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 2013 Synopsys, Inc. (www.synopsys.com) - - ARC Foreign Function Interface - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - ``Software''), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR - OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. - ----------------------------------------------------------------------- */ - -#include -#include - -#include -#include - -#include - -/* for little endian ARC, the code is in fact stored as mixed endian for - performance reasons */ -#if __BIG_ENDIAN__ -#define CODE_ENDIAN(x) (x) -#else -#define CODE_ENDIAN(x) ( (((uint32_t) (x)) << 16) | (((uint32_t) (x)) >> 16)) -#endif - -/* ffi_prep_args is called by the assembly routine once stack - space has been allocated for the function's arguments. */ - -void -ffi_prep_args (char *stack, extended_cif * ecif) -{ - unsigned int i; - void **p_argv; - char *argp; - ffi_type **p_arg; - - argp = stack; - - if (ecif->cif->rtype->type == FFI_TYPE_STRUCT) - { - *(void **) argp = ecif->rvalue; - argp += 4; - } - - p_argv = ecif->avalue; - - for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; - (i != 0); i--, p_arg++) - { - size_t z; - int alignment; - - /* align alignment to 4 */ - alignment = (((*p_arg)->alignment - 1) | 3) + 1; - - /* Align if necessary. */ - if ((alignment - 1) & (unsigned) argp) - argp = (char *) FFI_ALIGN (argp, alignment); - - z = (*p_arg)->size; - if (z < sizeof (int)) - { - z = sizeof (int); - - switch ((*p_arg)->type) - { - case FFI_TYPE_SINT8: - *(signed int *) argp = (signed int) *(SINT8 *) (*p_argv); - break; - - case FFI_TYPE_UINT8: - *(unsigned int *) argp = (unsigned int) *(UINT8 *) (*p_argv); - break; - - case FFI_TYPE_SINT16: - *(signed int *) argp = (signed int) *(SINT16 *) (*p_argv); - break; - - case FFI_TYPE_UINT16: - *(unsigned int *) argp = (unsigned int) *(UINT16 *) (*p_argv); - break; - - case FFI_TYPE_STRUCT: - memcpy (argp, *p_argv, (*p_arg)->size); - break; - - default: - FFI_ASSERT (0); - } - } - else if (z == sizeof (int)) - { - *(unsigned int *) argp = (unsigned int) *(UINT32 *) (*p_argv); - } - else - { - if ((*p_arg)->type == FFI_TYPE_STRUCT) - { - memcpy (argp, *p_argv, z); - } - else - { - /* Double or long long 64bit. */ - memcpy (argp, *p_argv, z); - } - } - p_argv++; - argp += z; - } - - return; -} - -/* Perform machine dependent cif processing. */ -ffi_status -ffi_prep_cif_machdep (ffi_cif * cif) -{ - /* Set the return type flag. */ - switch (cif->rtype->type) - { - case FFI_TYPE_VOID: - cif->flags = (unsigned) cif->rtype->type; - break; - - case FFI_TYPE_STRUCT: - cif->flags = (unsigned) cif->rtype->type; - break; - - case FFI_TYPE_SINT64: - case FFI_TYPE_UINT64: - case FFI_TYPE_DOUBLE: - cif->flags = FFI_TYPE_DOUBLE; - break; - - case FFI_TYPE_FLOAT: - default: - cif->flags = FFI_TYPE_INT; - break; - } - - return FFI_OK; -} - -extern void ffi_call_ARCompact (void (*)(char *, extended_cif *), - extended_cif *, unsigned, unsigned, - unsigned *, void (*fn) (void)); - -void -ffi_call (ffi_cif * cif, void (*fn) (void), void *rvalue, void **avalue) -{ - extended_cif ecif; - - ecif.cif = cif; - ecif.avalue = avalue; - - /* If the return value is a struct and we don't have - a return value address then we need to make one. */ - if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) - { - ecif.rvalue = alloca (cif->rtype->size); - } - else - ecif.rvalue = rvalue; - - switch (cif->abi) - { - case FFI_ARCOMPACT: - ffi_call_ARCompact (ffi_prep_args, &ecif, cif->bytes, - cif->flags, ecif.rvalue, fn); - break; - - default: - FFI_ASSERT (0); - break; - } -} - -int -ffi_closure_inner_ARCompact (ffi_closure * closure, void *rvalue, - ffi_arg * args) -{ - void **arg_area, **p_argv; - ffi_cif *cif = closure->cif; - char *argp = (char *) args; - ffi_type **p_argt; - int i; - - arg_area = (void **) alloca (cif->nargs * sizeof (void *)); - - /* handle hidden argument */ - if (cif->flags == FFI_TYPE_STRUCT) - { - rvalue = *(void **) argp; - argp += 4; - } - - p_argv = arg_area; - - for (i = 0, p_argt = cif->arg_types; i < cif->nargs; - i++, p_argt++, p_argv++) - { - size_t z; - int alignment; - - /* align alignment to 4 */ - alignment = (((*p_argt)->alignment - 1) | 3) + 1; - - /* Align if necessary. */ - if ((alignment - 1) & (unsigned) argp) - argp = (char *) FFI_ALIGN (argp, alignment); - - z = (*p_argt)->size; - *p_argv = (void *) argp; - argp += z; - } - - (closure->fun) (cif, rvalue, arg_area, closure->user_data); - - return cif->flags; -} - -extern void ffi_closure_ARCompact (void); - -ffi_status -ffi_prep_closure_loc (ffi_closure * closure, ffi_cif * cif, - void (*fun) (ffi_cif *, void *, void **, void *), - void *user_data, void *codeloc) -{ - uint32_t *tramp = (uint32_t *) & (closure->tramp[0]); - - switch (cif->abi) - { - case FFI_ARCOMPACT: - FFI_ASSERT (tramp == codeloc); - tramp[0] = CODE_ENDIAN (0x200a1fc0); /* mov r8, pcl */ - tramp[1] = CODE_ENDIAN (0x20200f80); /* j [long imm] */ - tramp[2] = CODE_ENDIAN (ffi_closure_ARCompact); - break; - - default: - return FFI_BAD_ABI; - } - - closure->cif = cif; - closure->fun = fun; - closure->user_data = user_data; - cacheflush (codeloc, FFI_TRAMPOLINE_SIZE, BCACHE); - - return FFI_OK; -} diff --git a/src/libffi/libffi-3.4.4/testsuite/Makefile.am b/src/libffi/libffi-3.4.4/testsuite/Makefile.am deleted file mode 100644 index c4331b1d3..000000000 --- a/src/libffi/libffi-3.4.4/testsuite/Makefile.am +++ /dev/null @@ -1,133 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -AUTOMAKE_OPTIONS = foreign dejagnu - -EXTRA_DEJAGNU_SITE_CONFIG=../local.exp - -CLEANFILES = *.exe core* *.log *.sum - -EXTRA_DIST = config/default.exp lib/libffi.exp lib/target-libpath.exp \ -lib/wrapper.exp libffi.bhaible/Makefile libffi.bhaible/README \ -libffi.bhaible/alignof.h libffi.bhaible/bhaible.exp \ -libffi.bhaible/test-call.c libffi.bhaible/test-callback.c \ -libffi.bhaible/testcases.c libffi.call/align_mixed.c \ -libffi.call/align_stdcall.c libffi.call/call.exp \ -libffi.call/err_bad_typedef.c libffi.call/ffitest.h \ -libffi.call/float.c libffi.call/float1.c libffi.call/float2.c \ -libffi.call/float3.c libffi.call/float4.c libffi.call/float_va.c \ -libffi.call/many.c libffi.call/many2.c libffi.call/many_double.c \ -libffi.call/many_mixed.c libffi.call/negint.c libffi.call/offsets.c \ -libffi.call/pr1172638.c libffi.call/promotion.c \ -libffi.call/pyobjc_tc.c libffi.call/return_dbl.c \ -libffi.call/return_dbl1.c libffi.call/return_dbl2.c \ -libffi.call/return_fl.c libffi.call/return_fl1.c \ -libffi.call/return_fl2.c libffi.call/return_fl3.c \ -libffi.call/return_ldl.c libffi.call/return_ll.c \ -libffi.call/return_ll1.c libffi.call/return_sc.c \ -libffi.call/return_sl.c libffi.call/return_uc.c \ -libffi.call/return_ul.c libffi.call/struct1.c libffi.call/struct10.c \ -libffi.call/struct2.c libffi.call/struct3.c libffi.call/struct4.c \ -libffi.call/struct5.c libffi.call/struct6.c libffi.call/struct7.c \ -libffi.call/struct8.c libffi.call/struct9.c \ -libffi.call/uninitialized.c libffi.call/va_1.c libffi.call/va_2.c \ -libffi.call/va_3.c libffi.call/va_struct1.c libffi.call/va_struct2.c \ -libffi.call/va_struct3.c libffi.call/struct_by_value_big.c \ -libffi.call/struct_by_value_2.c libffi.call/struct_by_value_3.c \ -libffi.call/struct_by_value_4.c libffi.call/struct_by_value_small.c \ -libffi.call/strlen2.c libffi.call/strlen3.c libffi.call/strlen4.c \ -libffi.call/strlen.c libffi.call/va_3.c \ -libffi.call/struct_by_value_2.c libffi.call/struct_by_value_3.c \ -libffi.call/struct_by_value_4.c libffi.closures/closure.exp \ -libffi.call/s55.c libffi.call/bpo-38748.c \ -libffi.closures/closure_fn0.c libffi.closures/closure_fn1.c \ -libffi.closures/closure_fn2.c libffi.closures/closure_fn3.c \ -libffi.closures/closure_fn4.c libffi.closures/closure_fn5.c \ -libffi.closures/closure_fn6.c libffi.closures/closure_loc_fn0.c \ -libffi.closures/closure_simple.c libffi.closures/cls_12byte.c \ -libffi.closures/cls_16byte.c libffi.closures/cls_18byte.c \ -libffi.closures/cls_19byte.c libffi.closures/cls_1_1byte.c \ -libffi.closures/cls_20byte.c libffi.closures/cls_20byte1.c \ -libffi.closures/cls_24byte.c libffi.closures/cls_2byte.c \ -libffi.closures/cls_3_1byte.c libffi.closures/cls_3byte1.c \ -libffi.closures/cls_3byte2.c libffi.closures/cls_3float.c \ -libffi.closures/cls_4_1byte.c libffi.closures/cls_4byte.c \ -libffi.closures/cls_5_1_byte.c libffi.closures/cls_5byte.c \ -libffi.closures/cls_64byte.c libffi.closures/cls_6_1_byte.c \ -libffi.closures/cls_6byte.c libffi.closures/cls_7_1_byte.c \ -libffi.closures/cls_7byte.c libffi.closures/cls_8byte.c \ -libffi.closures/cls_9byte1.c libffi.closures/cls_9byte2.c \ -libffi.closures/cls_align_double.c libffi.closures/cls_align_float.c \ -libffi.closures/cls_align_longdouble.c \ -libffi.closures/cls_align_pointer.c \ -libffi.closures/cls_align_sint16.c libffi.closures/cls_align_sint32.c \ -libffi.closures/cls_align_sint64.c libffi.closures/cls_align_uint16.c \ -libffi.closures/cls_align_uint32.c libffi.closures/cls_align_uint64.c \ -libffi.closures/cls_dbls_struct.c libffi.closures/cls_double.c \ -libffi.closures/cls_double_va.c libffi.closures/cls_float.c \ -libffi.closures/cls_longdouble_va.c \ -libffi.closures/cls_many_mixed_args.c \ -libffi.closures/cls_many_mixed_float_double.c \ -libffi.closures/cls_multi_schar.c libffi.closures/cls_multi_sshort.c \ -libffi.closures/cls_multi_sshortchar.c \ -libffi.closures/cls_multi_uchar.c libffi.closures/cls_multi_ushort.c \ -libffi.closures/cls_multi_ushortchar.c libffi.closures/cls_pointer.c \ -libffi.closures/cls_pointer_stack.c libffi.closures/cls_schar.c \ -libffi.closures/cls_sint.c libffi.closures/cls_sshort.c \ -libffi.closures/cls_struct_va1.c libffi.closures/cls_uchar.c \ -libffi.closures/cls_uint.c libffi.closures/cls_uint_va.c \ -libffi.closures/cls_ulong_va.c libffi.closures/cls_ulonglong.c \ -libffi.closures/cls_ushort.c libffi.closures/err_bad_abi.c \ -libffi.closures/ffitest.h libffi.closures/nested_struct.c \ -libffi.closures/nested_struct1.c libffi.closures/nested_struct10.c \ -libffi.closures/nested_struct11.c libffi.closures/nested_struct12.c \ -libffi.closures/nested_struct13.c libffi.closures/nested_struct2.c \ -libffi.closures/nested_struct3.c libffi.closures/nested_struct4.c \ -libffi.closures/nested_struct5.c libffi.closures/nested_struct6.c \ -libffi.closures/nested_struct7.c libffi.closures/nested_struct8.c \ -libffi.closures/nested_struct9.c libffi.closures/problem1.c \ -libffi.closures/single_entry_structs1.c \ -libffi.closures/single_entry_structs2.c \ -libffi.closures/single_entry_structs3.c libffi.closures/stret_large.c \ -libffi.closures/stret_large2.c libffi.closures/stret_medium.c \ -libffi.closures/stret_medium2.c libffi.closures/testclosure.c \ -libffi.closures/unwindtest.cc libffi.closures/unwindtest_ffi_call.cc \ -libffi.closures/cls_align_longdouble_split.c \ -libffi.closures/cls_align_longdouble_split2.c \ -libffi.closures/cls_longdouble.c libffi.closures/huge_struct.c \ -libffi.complex/cls_align_complex.inc \ -libffi.complex/cls_align_complex_double.c \ -libffi.complex/cls_align_complex_float.c \ -libffi.complex/cls_align_complex_longdouble.c \ -libffi.complex/cls_complex.inc libffi.complex/cls_complex_double.c \ -libffi.complex/cls_complex_float.c \ -libffi.complex/cls_complex_longdouble.c \ -libffi.complex/cls_complex_struct.inc \ -libffi.complex/cls_complex_struct_double.c \ -libffi.complex/cls_complex_struct_float.c \ -libffi.complex/cls_complex_struct_longdouble.c \ -libffi.complex/cls_complex_va.inc \ -libffi.complex/cls_complex_va_double.c \ -libffi.complex/cls_complex_va_float.c \ -libffi.complex/cls_complex_va_longdouble.c libffi.complex/complex.exp \ -libffi.complex/complex.inc libffi.complex/complex_defs_double.inc \ -libffi.complex/complex_defs_float.inc \ -libffi.complex/complex_defs_longdouble.inc \ -libffi.complex/complex_double.c libffi.complex/complex_float.c \ -libffi.complex/complex_int.c libffi.complex/complex_longdouble.c \ -libffi.complex/ffitest.h libffi.complex/many_complex.inc \ -libffi.complex/many_complex_double.c \ -libffi.complex/many_complex_float.c \ -libffi.complex/many_complex_longdouble.c \ -libffi.complex/return_complex.inc libffi.complex/return_complex1.inc \ -libffi.complex/return_complex1_double.c \ -libffi.complex/return_complex1_float.c \ -libffi.complex/return_complex1_longdouble.c \ -libffi.complex/return_complex2.inc \ -libffi.complex/return_complex2_double.c \ -libffi.complex/return_complex2_float.c \ -libffi.complex/return_complex2_longdouble.c \ -libffi.complex/return_complex_double.c \ -libffi.complex/return_complex_float.c \ -libffi.complex/return_complex_longdouble.c libffi.go/aa-direct.c \ -libffi.go/closure1.c libffi.go/ffitest.h libffi.go/go.exp \ -libffi.go/static-chain.h diff --git a/src/libffi/libffi-3.4.4/ChangeLog b/src/libffi/libffi-3.4.6/ChangeLog similarity index 92% rename from src/libffi/libffi-3.4.4/ChangeLog rename to src/libffi/libffi-3.4.6/ChangeLog index 1ca669ec4..490af5805 100644 --- a/src/libffi/libffi-3.4.4/ChangeLog +++ b/src/libffi/libffi-3.4.6/ChangeLog @@ -1,3 +1,1088 @@ +commit 3d0ce1e6fcf19f853894862abcbac0ae78a7be60 +Author: Anthony Green +Date: Sun Feb 18 09:22:51 2024 -0500 + + chore: update version to 3.4.6 and fix long double regression on mips64 and alpha + +commit 94eaedb40e67e26d2fa35d1c22d8818f4d9f4c2d +Author: Anthony Green +Date: Sun Feb 18 08:41:04 2024 -0500 + + Update sparc64 host + +commit e1dcf03b4642e75a1058799a3023e0ebd0024258 +Author: Anthony Green +Date: Sun Feb 18 08:02:45 2024 -0500 + + Update cfarm hostnames + +commit cd78b539125ae615d76df5a57039fe70ebd56c27 +Author: Anthony Green +Date: Sun Feb 18 07:48:51 2024 -0500 + + Always define long double types. + +commit 012fcaf96c87ab617ba34babce9b6b259188fcf0 +Author: Anthony Green +Date: Thu Feb 15 08:35:02 2024 -0500 + + Update + +commit d1597239af492240770692b8e453f0dca70fc551 +Author: Anthony Green +Date: Thu Feb 15 08:32:42 2024 -0500 + + update copyright year in libffi.texi + +commit 91739a1a912476adbf1e0e4dcb091b9a2c5007d9 +Author: Anthony Green +Date: Thu Feb 15 08:30:09 2024 -0500 + + Update version, copyright and testsuite info. + +commit 9752a622d12e696eaf9a4c46d4f09b58bca6bb83 +Author: Anthony Green +Date: Thu Feb 15 08:03:21 2024 -0500 + + Fix test filename reference + +commit 404355317b3314da14a9ead0c0a50c040212e1fc +Author: Anthony Green +Date: Thu Feb 15 08:01:43 2024 -0500 + + docs(README): update release details for libffi-3.4.5 + +commit 04f6fa310ddec494cfcf32fd3685cefe35a8d2a2 +Author: Xi Ruoyao +Date: Thu Feb 15 20:52:13 2024 +0800 + + mips: Fix N32 ABI return value handling (#813) + + In N32 ABI, 8-bit or 16-bit integers should be extended following the + signedness of the integer, but 32-bit integers should always be + sign-extended to 64-bit (note that N32 ABI only works on 64-bit CPUs). + + So handling this in everything using libffi would be nasty. And the + libffi code for architectures with a similar rule (LoongArch & RISC-V) + also properly handle this. Let's do this work in libffi for MIPS N32 + too. + + This fixes two failures in Python 3.12.1 ctypes test. + +commit 00c0c87773910a320d82f026bb481eea31b50206 +Author: 杨屿杰 <30362409+scylaac@users.noreply.github.com> +Date: Thu Feb 15 20:51:40 2024 +0800 + + Fix loongarch64 soft-float build (#816) (#817) + +commit b3091029ed85339c856224c243826022ae93c041 +Author: Hood Chatham +Date: Thu Feb 15 04:51:12 2024 -0800 + + Emscripten: Don't unbox single element structs if they are larger than 16 bytes (#818) + + This arguably is a compensation for a Python ctypes bug / strange behavior + described here: + https://github.com/python/cpython/blob/a16a9f978f42b8a09297c1efbf33877f6388c403/Modules/_ctypes/stgdict.c#L718-L779 + + If a struct is larger than 16 bytes, Python does not bother to accurately report + its contents figuring that we don't need to know. + +commit 98881ecb8eec6d5f2beaaced96d9f625b0dee499 +Author: Bill Roberts <152999275+billatarm@users.noreply.github.com> +Date: Thu Feb 15 06:50:40 2024 -0600 + + aarch64: add BTI flag to ELF notes (#822) + + When a program is loaded and linked, the first ELF file that doesn't + declare that BTI is supported in the GNU NOTES section disables BTI + support. + + Example: + readelf -n ./aarch64-unknown-linux-gnu/.libs/libffi.so + Displaying notes found in: .note.gnu.property + Owner Data size Description + GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 + Properties: AArch64 feature: BTI + + Fixes: #823 + + Signed-off-by: Bill Roberts + +commit f9da12e944c947e797e5f3a98f3860c2a0ed055e +Author: Dan Horák +Date: Thu Feb 15 13:50:13 2024 +0100 + + don't skip ffi_type_longdouble symbols (#814) (#824) + + Seems there are configurations (ppc64 or ppc64le) that define + HAVE_LONG_DOUBLE_VARIANT in fficonfig.h, but do not define + HAVE_LONG_DOUBLE, and still want ffi_type_{,complex_}longdouble + symbols. Update the condition in libffi.map.in accordingly. + +commit f8ed78f1b2e65f2741455612d38477424e321850 +Author: Xi Ruoyao +Date: Thu Feb 15 20:49:27 2024 +0800 + + LoongArch: Fix a build error with GCC 14 (#825) + + Fix the build error with GCC 14: + + ../src/loongarch64/ffi.c: In function 'ffi_prep_closure_loc': + ../src/loongarch64/ffi.c:525:7: error: implicit declaration of + function 'ffi_tramp_set_parms' [-Wimplicit-function-declaration] + +commit 0b1dd62bef4192b61153182f7687edf7e885611c +Author: bartoli +Date: Thu Feb 1 04:54:57 2024 +0100 + + Update README.md (#820) + + For cygwin/MSVC build, CXXCPP is also needed to pass configure checks + +commit c07c40ee9444e029bc595860a669de32b7af282a +Author: Anthony Green +Date: Wed Jan 31 22:43:38 2024 -0500 + + `feat(github-actions): add new build workflow for warp` + +commit 622caabcd25f4e11f752241417d06c9062acdf1f +Author: Chongyun Lee <45286352+licy183@users.noreply.github.com> +Date: Sun Dec 24 23:38:32 2023 +0800 + + Put more optional symbols behind ifdefs (#812) + +commit a1c391bd8e604c611c7e9c8f6705dc723d403eb5 +Author: Виктор Чернякин <56512186+LocalSpook@users.noreply.github.com> +Date: Fri Dec 22 03:30:50 2023 -0700 + + Fix a variety of warnings (#811) + +commit 3a62a08af7bd0b5d540a087590dc54cdc312416b +Author: Anthony Green +Date: Thu Dec 21 15:19:44 2023 -0500 + + Remove warnings + +commit d96fa2117cc6ca2923de9a2f34311ef0219b7590 +Author: Anthony Green +Date: Thu Dec 21 14:04:19 2023 -0500 + + Eliminate warning + +commit 5b1944b4ce4b03e28a5843d36812756168d66b08 +Author: Martin Storsjö +Date: Wed Nov 29 00:38:13 2023 +0200 + + aarch64: Write the BTI instructions as "hint" instructions (#810) + + GNU binutils refuses to assemble the direct BTI instructions unless + the target architecture explicitly supports BTI, ending up with errors + such as + + ../src/aarch64/sysv.S: Assembler messages: + ../src/aarch64/sysv.S:87: Error: selected processor does not support `bti c' + ../src/aarch64/sysv.S:156: Error: selected processor does not support `bti j' + + Building with -march=armv8.5-a fixes building this. + + However, the BTI instructions assemble into hint instructions, that + are ignored by processors that don't implement them. Therefore it is + possible to assemble them for the baseline armv8.0-a target as well, + by replacing "bti j" with "hint #36", "bti c" with "hint #34" and + "bti jc" with "hint #38"; this assembles into the same instruction + bits. + +commit 11af2196d5f4e8c756758cf86e4ab79dda89f405 +Author: Anthony Green +Date: Thu Nov 23 09:22:20 2023 -0500 + + Reference recent changes + +commit d7f5e98b437a242ac712cda8df3e47b205339711 +Author: David Tenty +Date: Thu Nov 23 09:16:56 2023 -0500 + + Fix visibility check for AIX (#804) + +commit 7f960d9a062fab0624302e9f63ef8b025f51dd10 +Author: David Tenty +Date: Thu Nov 23 09:16:35 2023 -0500 + + [powerpc][AIX] fix layout issues for nested struct types (#805) + + * [powerpc][AIX] fix layout issues for nested struct types + + On AIX under the default power alignment rules, the layout + of struct types which are nested inside other structs may + be different than the layout of those types on their own. + + Specifically the first member double rules which would + apply an eight byte alignment if that type appears in the + first position of a struct: + + 1) apply recursively if the struct appear in the first member + of another struct + 2) do not apply if that struct is itself a member of another struct + and not the first member. + + The current implementation of the rules in libffi doesn't handle these + cases, causing a mismatch with the compiler and causing some crashes + we see when OpenJ9 is used with libffi on AIX. + + This PR corrects this and adds some representative test cases. + + * Fix code style + + * Add a size check + + * Add additional test + + * Fix padding in internal structs + + * Flip condition back to original form + + * Add a comment + +commit d93c0be8a0f11f207e8232770c5f0590406efad1 +Author: Tobias Heider +Date: Thu Nov 23 15:15:29 2023 +0100 + + Add bti intructions to aarch64 assembly to work with strict (#808) + + BTI enforcement on OpenBSD. + +commit adbcf2b247696dde2667ab552cb93e0c79455c84 +Author: Daily Price Depot Droid +Date: Sat Oct 21 09:58:28 2023 -0400 + + Disable firefox testing + +commit 357755eef44735676de1cec458192c7784fb3aa8 +Author: Daily Price Depot Droid +Date: Sat Oct 21 09:05:48 2023 -0400 + + Try logging + +commit c23e9a1c81a84ea4804d001865845b25ff8d4c8a +Author: Nobuyoshi Nakada +Date: Sat Oct 21 20:44:24 2023 +0900 + + Check if FFI_GO_CLOSURES is defined (#796) + + This macro is always defined to 1 if defined, or undefined. + With `-Wundef` option, checking the value without checking if it is defined causes warnings: + + ``` + /opt/local/include/ffi.h:477:5: warning: 'FFI_GO_CLOSURES' is not defined, evaluates to 0 [-Wundef] + #if FFI_GO_CLOSURES + ^ + ``` + +commit a4be0b7210b5a7fd67770d2f4d63105900bc459a +Author: Yn0ga +Date: Sat Oct 21 13:43:43 2023 +0200 + + Add support for Haikuos on PowerPC (#799) + +commit dd90749505559d38abb339f1a1cd03791a9dc484 +Author: Petr Sumbera +Date: Sat Oct 21 13:42:11 2023 +0200 + + Fix passing floating point arguments on 64bits SPARC (libffi#778) (#802) + +commit 44f6fa3e526c920c61c8ac10661f447ccfe30872 +Author: Alfred Wingate +Date: Fri Oct 20 15:02:37 2023 +0300 + + Put optional symbols behind ifdefs (#800) + + Signed-off-by: Alfred Wingate + +commit 5c6e53db873767cd2266745cebc62551958f5bee +Author: Michael Osipov <1983-01-06@gmx.net> +Date: Mon Sep 4 13:27:01 2023 +0200 + + Fix build failures on HP-UX (#792) + + This fixes #328 + + Co-authored-by: Chris Hunt + +commit 1b3e7569fe114fc7d7779e35704b8519fe65fd4d +Author: Russell Keith-Magee +Date: Mon Sep 4 19:26:11 2023 +0800 + + Replace use of triple with target, and explicitly specify build host to force cross-compilation (#794) + +commit 22b50e896a80171648439497041afe3b6dba1c08 +Author: Anthony Green +Date: Thu Aug 31 16:31:42 2023 -0400 + + Fix python and pyodide version + +commit 4467a3bc350bca106aee2c55cbb19ffffb144d1b +Author: Anthony Green +Date: Thu Aug 31 08:48:50 2023 -0400 + + Upgrade pyodide version to match newer selenium API + +commit 1d0a28ab5a2ee2e12b0650d69184d561cd1fd83c +Author: Ivan Tadeu Ferreira Antunes Filho +Date: Sat Aug 12 09:02:39 2023 -0400 + + Make label private on apple (#788) + + Private labels on apple must start with L prefix, while on ELF they start with .L prefix. + This makes the label start with L on apple instead of .L. + +commit 9e8f1bd8de39ee90a73c6927e2df18a418f6da55 +Author: Hood Chatham +Date: Tue Jun 20 21:17:04 2023 -0700 + + Emscripten build: Remove -sSTRICT_JS (#781) + + This rasies errors on newer versions of the emscripten compiler. + +commit ac598b7f5272d536b75f4b3833a4610cf4cd9404 +Merge: 2d63cee 8bdd471 +Author: Anthony Green +Date: Mon Apr 3 08:20:32 2023 -0400 + + Merge branch 'master' of github.com:/libffi/libffi + +commit 2d63cee0e2154bb9027cff71f780cfaa2f543567 +Author: Anthony Green +Date: Mon Apr 3 08:18:23 2023 -0400 + + Add tests with homogeneous aggregate types + +commit 8bdd4716e5974ee0b28b3c09db1eaa9e8833481e +Author: Hood Chatham +Date: Sun Apr 2 19:54:22 2023 -0700 + + More accurate explanation of wasm32 state in readme (#776) + + There are three main wasm32 target triples: + * wasm32-unknown-unknown + * wasm32-unknown-emscripten + * wasm32-unknown-wasi + + The wasm32 port is only for the wasm32-unknown-emscripten target triple. + (The other triples have no dynamic linking support so libffi would be both + hard to port and of limited utility.) + +commit f08493d249d2067c8b3207ba46693dd858f95db3 +Author: Anthony Green +Date: Fri Feb 17 20:35:44 2023 -0500 + + Mention ARCv3 work + +commit c4df19c99f8d8841942e3edaadbf331d30e298c8 +Author: Claudiu Zissulescu +Date: Sat Feb 18 03:33:47 2023 +0200 + + Update ARC's libffi port (#771) + + * Add support for ARC and ARC64 + + Add support for ARC/ARC32/ARC64 + + * Implementation of GO Closure for ARC/ARC32/ARC64 Architectures + + --------- + + Co-authored-by: Nuno Cardoso + Co-authored-by: Luis Silva + +commit 237520649730cb21daf4ebff1cf9a0a64f8507f8 +Author: Anthony Green +Date: Thu Feb 9 12:23:35 2023 -0500 + + Normalize libffi labels + +commit ca26801567e9ce19c83f132c6a116d3d25d3b8a1 +Author: Anthony Green +Date: Thu Feb 9 10:31:22 2023 -0500 + + Use rlgl + +commit 7d23c2d28e884ad5978e0974ad2443570940d393 +Author: Hood Chatham +Date: Thu Feb 9 06:01:37 2023 -0800 + + Add emscripten gha workflow (#768) + + Resolves issue #767 + +commit 883f5ae665bf96008a7a56bf4d6c64cb05c68272 +Author: Anthony Green +Date: Sun Feb 5 09:51:37 2023 -0500 + + Rename label + +commit 678dad5abe6c95ffa087b799922c2114b18c8541 +Author: Hood Chatham +Date: Thu Feb 2 14:48:07 2023 -0800 + + Use libffi-dg-prune to handle Emscripten INFO messages rather than patching emcc.py (#766) + +commit 7d03d3a3150c5c1ff70753edaa880bb5d57ae566 +Author: Anthony Green +Date: Thu Feb 2 16:09:14 2023 -0500 + + Mention wasm32 + +commit c267c72fa803316e95462f16bf1e3d6d5d55612c +Author: Anthony Green +Date: Thu Feb 2 16:04:34 2023 -0500 + + Modernize + +commit 2687cfc5329d08d6bd4d397c1ca8eb0d171e22fd +Author: Hood Chatham +Date: Thu Feb 2 09:10:00 2023 -0800 + + Add wasm32 emscripten support (#763) + + * added build script + + * Apply libffi-emscripten patch + + * Some changes to wasm32/ffi.c + + * Remove exit(0); from test suites + + * Fix LONGDOUBLE argument type + + * Use more macros in ffi.c + + * Use switch statements instead of if chains + + * Implemented struct args + + * Finish struct implementation + + * Partially working closures + + * Got closures working (most of closures test suite passes) + + * Revert changes to test suite + + * Update .gitignore + + * Apply code formatter + + * Use stackSave and stackRestore rather than directly adjusting stack pointer + + * Add missing break + + * Fix visibility of ffi_closure_alloc and ffi_closure_free + + * Fix FFI_TYPE_STRUCT and FFI_TYPE_LONGDOUBLE when WASM_BIGINT is not used + sig needs to be vi here for FFI_TYPE_STRUCT and FFI_TYPE_LONGDOUBLE, noticed this while running the test suite without WASM_BIGINT support. + + * Always use dynCall rather than direct wasmTable lookup (function pointer cast emulation changes dynCall) + + * Prevent closures.c from duplicating symbols + + * Try to set up CI + + * Add test with bigint + + * Make test methods static + + * Remove BigInt shorthand because it messes up terser + + * Add selenium tests + + * Update tests a bit to try to make CI work + + * WASM_BIGINT is a linker flag not a compile flag + + * Finish getting CI working (#1) + + * update gitignore + + * Avoid adding "use strict;" to generated JS + + This should be controlled by -s STRICT_JS in Emscripten. + + * Make JavaScript ES5 compliant + + * Remove redundant EXPORTED_RUNTIME_METHODS settings + + * Fix definition of DEREF_I16 + + * Avoid marshalling FFI_TYPE_LONGDOUBLE when WASM_BIGINT is not used + + * Add missing FFI_TYPE_STRUCT signature + + * Improve test scripts + + * Remove redundant EXPORTED_RUNTIME_METHODS settings + + * Add missing EOL + + * Add struct unpacking tests + + * Update ci config to try to actually use WASM_BIGINT + + * Revert "Avoid marshalling FFI_TYPE_LONGDOUBLE when WASM_BIGINT is not used" + + This reverts commit 61bd5a3e20891623715604581b6e872ab3dfab80. + + * Fix single_entry_structs tests + + * Fix return from closure call + + * Fix 64 bit return from closures + + * only allocate as much space on stack for return pointer as needed + + * Revert "only allocate as much space on stack for return pointer as needed" + + This reverts commit e54a30faea3803e7ac33eed191bde9e573850fc1. + + * xfail two tests + + * Fix err_bad_abi test + + * Remove test logging junk + + * Try to set up long double marshalling for closures + + * xfail err_bad_abi + + * Fix reference errors in previous commit + + * Add missing argument pointer assignment + + * Fix signature of function pointer in cls_dbls_struct + + * Fix longdouble argument + + * Try some changes to bigint handling + + * Fix BigInt handling + + * Fix cls_longdouble test + + * Fix long double closure arg with no WASM_BIGINT + + * Use EM_JS to factor out js helpers + + * Support for varargs closure calls + + * Fix varargs calls + + * Fix err_bad_abi test + + * Fix typo in previous commit + + * Add more assertions to closures test suite + + * Fix some asserts + + * Add assertions to a few more tests + + * Fix some tests + + * Fix more floating point assertions + + * Update more tests + + * Var args for ffi_call + + * Don't do node tests + + * Macro for allocating on stack + + * Add some comments, simplify struct handling + + * Try again to fix varargs calls, add comments + + * Consolidate WASM_BIGINT conditionals into LOAD_U64 and STORE_U64 macros + + * A bit of cleanup + + * Fix another typo + + * Some fixes to the testsuite + + * Another testsuite fix + + * Fix varags with closures? + + * Another attempt at getting closure varargs to work + + * sig is initialized later + + * Allow libffi.closures tests to be run + + * Improve build script + + * Remove redundant semicolons + + * Fix a few libffi.closures test failures + + * Cleanup + + * Legacy dynCall API is no longer used + + * Fix FFI_TYPE_LONGDOUBLE offset + + * xfail 2 tests for WASM + + - closure_loc_fn0; not applicable -- codeloc doesn't point to closure. + - huge_struct; function signature too long. + + * Revert some redundant dg-output/printf statements + + Helps Node. + + * Revert "Don't do node tests" + + This reverts commit a341ef4b. + + * Fix assertions in cls_24byte + + * More tiny formating fixes to test suite + + * Revert "Revert "Don't do node tests"" + + This reverts commit 7722e685ea04e2420e042886816d8c4dd31f5dcb. + + * Fix 64 bit returns when WASM_BIGINT is absent + + * Fix print statement in cls_24byte + + * Add CALL_FUNC_PTR macro to allow pyodide to define custom calling behavior to handle fpcast + + * Update single_entry_structs tests + + * More explanations + + * Fix compile error in last commit + + * Add more support for pyodide fpcast emulation, update CI to try to test it + + * Clone via https + + * Fix path to pyodide emsdk_env + + * Add asserts to the rest of the test suite + + * Fix test compile errors + + * Fix some tests + + * Fix cls_ulonglong + + * Fix alignment of <4 byte args + + * fix cls_ulonglong again + + * Use snprintf instead of sprintf + + * Should assert than strncmp returned 0 + + * Fix va_struct1 and va_struct3 + + * Change double and long double tests + + These tests are failing because of a strange bug with prinft and doubles, but I am not convinced + it necessarily has anything to do with libffi. This version casts the double to int before printing it and avoids the issue + + * Enable node tests + + * Revert "Change double and long double tests" + + This reverts commit 8f3ff89c6577dc99564181cd9974f2f1ba21f1e9. + + * Fix PYODIDE_FPCAST flag + + * add conftest.py back in + + * Fix emcc error: setting `EXPORTED_FUNCTIONS` expects `` but got `` + + See discussion on https://github.com/pyodide/pyodide/pull/1596 + + * Remove test.html + + * Remove duplicate test file + + * More changes from upstream + + * Fix some whitespace + + * Add some basic debug logging statements + + * Reapply libffi.exp changes + + * Don't build docs (#7) + + Works around build issue makeinfo: command not found. + + * Update long double alignment + + Emscripten 2.0.26 reduces the aligmnet of long double to 8. Quoting + from `ChangeLog.md`: + + > The alignment of `long double`, which is a 128-bit floating-point + > value implemented in software, is reduced from 16 to 8. The lower + > alignment allows `max_align_t` to properly match the alignment we + > use for malloc, which is 8 (raising malloc's alignment to achieve + > correctness the other way would come with a performance regression). + > (#10072) + + * Update long double alignment + + Emscripten 2.0.26 reduces the aligmnet of long double to 8. Quoting + from `ChangeLog.md`: + + > The alignment of `long double`, which is a 128-bit floating-point + > value implemented in software, is reduced from 16 to 8. The lower + > alignment allows `max_align_t` to properly match the alignment we + > use for malloc, which is 8 (raising malloc's alignment to achieve + > correctness the other way would come with a performance regression). + > (#10072) + + * Improve error handling a bit (#8) + + * Fix handling of signed arguments to ffi_call (#11) + + * Fix struct argument handling in ffi_call (#10) + + * Remove fpcast emulation tests + + * Align the stack to MAX_ALIGN before making call (#12) + + * Increase MAX_ARGS + + * Cleanup (#14) + + * Fix Closure compiler error with -sASSERTIONS=1 (#15) + + * Remove function pointer cast emulation (#13) + + This reverts commit 593b402 and cbc54da, as it's no longer needed + after PR pyodide/pyodide#2019. + + * Prefer the `__EMSCRIPTEN__` definition over `EMSCRIPTEN` (#18) + + "The preprocessor define EMSCRIPTEN is deprecated. Don't pass it to code + in strict mode. Code should use the define __EMSCRIPTEN__ instead." + https://github.com/emscripten-core/emscripten/blob/84a634167a1cd9e8c47d37a559688153a4ceace6/emcc.py#L887-L890 + + * Install autoconf 2.71 + + * Try again with installing autoconf 2.71 + + * Fix compatibility with Emscripten 3.1.28 + + * CI: remove use of `EM_CONFIG` env + + See commit: + https://github.com/emscripten-core/emsdk/commit/3d87d5ea8143b3636f872fb05b896eb4a19a070b + + * Fix cls_multi_schar: cast rest_call to signed char + + * Remove test xfails (#17) + + * Fix long double when used as a varargs argument + + * Enable unwindtest and fix it + + * Add EM_JS_DEPS + + * Also require convertJsFunctionToWasm + + * Run tests very very verbose + + * Echo the .emscripten file + + * Remove --experimental-wasm-bigint insertion + + * Build with assertions + + * Move verbosity flags back out of LDFLAGS + + * Remove debug print statement + + * Use up to date pyodide docker image + + * Explicitly cast res_call to fix test failure + + * Put back name of main function in cls_longdouble_va.c + + * Fix alignment + + The stack pointer apparently needs to be aligned to 16. There were + some terrible subtle bugs caused by not respecting this. stackAlloc + knows that the stack should be 16 aligned, so we can use stackAlloc(0) + to enforce this. This way if alignment requirements change, as long + as Emscripten updates stackAlloc to continue to enforce them we should + be okay. + + * Fix handling of systems with no Js bigint integration + + When we run the node tests we use node v14 tests (since node v14 is + vendored with Emscripten). Node v14 has no Js bigint integration + unless the --experimental-wasm-bigint flag is passed. So only the + node tests really notice if we get this right. Turns out, it didn't + work. We can't call a JavaScript function with 64 bit integer arguments + without bigint integration. + + In ffi_call, we are trying to call a wasm function that takes 64 bit + integer arguments. dynCall is designed to do this. We need to go back + to tracking the signature when we don't have WASM_BIGINT, and then use + dynCall. This works better now that emscripten can dynamically fill in + extra dynCall wrappers: + https://github.com/emscripten-core/emscripten/pull/17328 + + On the other hand, for the closures we are not getting a function pointer + as a first argument. We need to make our own wasm legalizer adaptor that + splits 64 bit integer arguments and then calls the JavaScript trampoline, + then the JavaScript trampoline reassembles them, calls the closure, then + splits the result (if it's a 64 bit integer) and the adaptor puts it back + together. + + * Improvements to emscripten test shell scripts (#21) + + This fixes the C++ unwinding tests and makes other minor improvements + to the Emscripten test shell scripts. + + * Rename the test folder and move test files into emscripten test folder + + * Use docker image that has autoconf-2.71 + + * Cleanup + + * Pin emscripten 3.1.30 + + * Fix build.sh path + + * Rearrange ci pipeline + + * Fix bpo_38748 test + + * Cleanup + + * Improvements to comments, add static asserts, and update copyright + + * Use `*_js` instead of `*_helper` for EM_JS functions (#22) + + * Minor code simplification + + * Xfail first dejagnu test to work around emscripten cache messages + + See https://github.com/emscripten-core/emscripten/issues/18607 + + * Remove unneeded xfails + + * Shorten conftest.py by using pytest-pyodide + + * Apply formatters and linters to emscripten directory + + * Fix Emscripten xfail hack + + * Fix build-tests script + + * Patch emscripten to quiet info messages + + * Clean up compiler flags in scripts and remove some settings from circleci config + + * Rename emscripten quiet script + + * Add missing export + + * Don't remove go.exp + + * Add reference to emscripten logging issue + + --------- + + Co-authored-by: Kleis Auke Wolthuizen + Co-authored-by: Kleis Auke Wolthuizen + Co-authored-by: Christian Heimes + +commit ce077e5565366171aa1b4438749b0922fce887a4 +Author: serge-sans-paille +Date: Thu Feb 2 14:46:29 2023 +0000 + + Forward declare open_temp_exec_file (#764) + + It's defined in closures.c and used in tramp.c. + Also declare it as an hidden symbol, as it should be. + + Co-authored-by: serge-sans-paille + +commit abf211d1603da9d687455169646e0e9667be17c1 +Author: Anthony Green +Date: Thu Feb 2 07:06:02 2023 -0500 + + Mention HPPA fixes + +commit 222abd0c65babe2174b21753217145f5031a8b91 +Author: Anthony Green +Date: Thu Feb 2 07:04:55 2023 -0500 + + From Dave Anglin: + + This patch is derived from the work done in implementing libffi for 64-bit hppa64-hpux target. Currently, the 32-bit hppa targets do a linear search for the return type of an ffi_call. This is slow and inefficient. A jump table can used to jump directly to the code used to process the return value. In most common cases, the return value can be processed in the jump table itself. + + The patch also fixes return handling for FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16 and FFI_TYPE_SINT16. + +commit e58e22b22386ed0e0a95e97eb8eed016e3f01b02 +Author: Anthony Green +Date: Thu Feb 2 07:02:53 2023 -0500 + + From Dave Anglin: + + A couple of years ago the 32-bit hppa targets were converted from using a trampoline executed on the stack to the function descriptor technique used by ia64. This is more efficient and avoids having to have an executable stack. However, function pointers on 32-bit need the PLABEL bit set in the pointer. It distinguishes between pointers that point directly to the executable code and pointer that point to a function descriptor. We need the later for libffi. But as a result, it is not possible to convert using casts data pointers to function pointers. + + The solution at the time was to set the PLABEL bit in hppa closure pointers using FFI_CLOSURE_PTR. However, I realized recently that this was a bad choice. Packages like python-cffi allocate their own closure pointers, so this isn't going to work well there. + + A better solution is to leave closure pointers unchanged and only set the PLABEL bit in pointers used to point to executable code. + + The attached patch drops the FFI_CLOSURE_PTR and FFI_RESTORE_PTR defines. This allows some cleanup in the hppa closure routines. The FFI_FN define is now used to set the PLABEL bit on hppa. ffi_closure_alloc is modified to set the PLABEL bit in the value set in *code. + + I also added a FFI_CL define to convert a function pointer to a closure pointer. It is only used in one test case. + +commit baa6bbbc176b3c572eaf05b3fae0311df7e5f7b7 +Author: Anthony Green +Date: Thu Feb 2 06:59:46 2023 -0500 + + Add HPPA64 support + +commit e70dd1aa240159bd2050cb1eafffb49cdc1d8b22 +Author: Iain Sandoe +Date: Thu Feb 2 11:44:13 2023 +0000 + + libffi: Fix X86 32b Darwin build and EH frames. (#757) + + This addresses a number of issues in the X86 Darwin 32b port for libffi. + + 1. The pic symbol stubs are weak definitions; the correct section placement + for these depends on the linker version in use. We do not have access + to that information, but we can use the target OS version (assumes that + the user has installed the latest version of xcode available). + When a coalesced section is in use (OS versions earlier than Darwin12 / + OSX 10.8), its name must differ from __TEXT,__text since otherwise that + would correspond to altering the attributes of the .text section (which + produces a diagnostic from the assembler). + Here we use __TEXT, __textcoal_nt for this which is what GCC emits for + these stubs. + For later versions than Darwin 12 (OS X 10.8) we can place the stubs in + the .text section (if we do not we get a diagnostic from clang -cc1as + saying that the use of coalesced sections for this is deprecated). + + 2. The EH frame is specified manually, since there is no support for .cfi_ + directives in 'cctools' assemblers. The implementation needs to provide + offsets for CFA advance, code size and to the CIE as signed values + rather than relocations. However the cctools assembler will produce a + relocation for expressions like ' .long Lxx-Lyy' which then leads to a + link-time error. We correct this by forming the offset values using + ' .set' directives and then assigning the results of them. + + 3. The register numbering used by m32 X86 Darwin EH frames is not the same + as the DWARF debug numbering (the Frame and Stack pointer numbers are + swapped). + + 4. The FDE address encoding used by the system tools is '0x10' (PCrel + abs) + where the value provided was PCrel + sdata4. + + 5. GCC does not use compact unwind at present, and it was not implemented + until Darwin10 / OSX 10.6. There were some issues with function location + in 10.6 so that the solution here suppresses emitting the compact unwind + section until Darwin11 / OSX 10.7. + +commit 7effe99955b228ae828d06fa8d07dc546ef67b1a +Author: Iain Sandoe +Date: Thu Feb 2 11:42:46 2023 +0000 + + Darwin: Search for both shared and convenience libraries in each path. (#761) + + For several Darwin linker versions, the default behaviour is to first traverse + the set of library paths, looking for shared libraries, and then a second time + looking for archives. + + This means that if the library is configured --disable-shared the installed + system version /usr/lib/libffi.dylib will be found before the archive under + test. + + Using the linker option '-search-paths-first' alters the strategy to search each + path for dylib and then archive before moving on to the next. + +commit ebbc5e14cdbfcc24bf3c9bb7b41ee10cd979c535 +Author: serge-sans-paille +Date: Thu Feb 2 11:40:17 2023 +0000 + + Fix signed vs unsigned comparison (#765) + + As reported by -Wsign-compare. In the case of getting the result of + comparing the result of sysconf (_SC_PAGESIZE) to other value, this also + correctly handles edge cases where the above fails and returns -1. + + Co-authored-by: serge-sans-paille + +commit 7611bb4cfe90884b55ad225e0166136a1d2cf22b +Author: Anthony Green +Date: Sun Jan 8 09:01:00 2023 -0500 + + Use checkout@v3, with nodejs 16 + +commit 3a8bb6bb7f51844b890ce6ae44fc6d7c4547fbd0 +Author: YongKang Zhou +Date: Sun Jan 8 21:56:34 2023 +0800 + + fix typo (#758) + + `mingW` -> `MinGW` + +commit 00116b6d0171ba69ffe23d6b5c21c0fdb5907a48 +Author: Alexander Kanavin +Date: Mon Dec 5 03:20:09 2022 +0100 + + arm/sysv: reverted clang VFP mitigation (#747) + + Since commit e3d2812ce43940aacae5bab2d0e965278cb1e7ea, + seperate instructions were used when compiling under clang, + as clang didn't allow the directives at the time. This mitigation + now causes compilation to fail under clang 10, as described by + https://github.com/libffi/libffi/issues/607. Now that + clang supports the LDC and SDC instructions, this mitigation + has been reverted. + + Co-authored-by: Brett Warren + +commit c50c16d0bcb58952840184aa83e62c6d912bf779 +Author: Anthony Green +Date: Sun Nov 20 12:20:40 2022 -0500 + + Fix large struct passing on PA-RISC + +commit c6dc125afba294b9b9613392c492ae18df3ede84 +Author: Anthony Green +Date: Tue Oct 25 10:28:19 2022 -0400 + + Add missing test cases + +commit 2b2f61f6e6a79d46fa277965745a8cd8bb5f04bc +Author: Xavier Claessens +Date: Mon Oct 24 20:39:04 2022 +0200 + + Small build cleanup (#743) + + * configure.ac: Remove some unused checks + + * Fix FFI_API definition + + When doing a static build dllimport/dllexport should be disabled. It was + also using 2 different macros FFI_BUILDING_DLL and FFI_BUILDING for no + reason. + commit f24180be1367f942824365b131ae894b9c769c7d Author: Anthony Green Date: Sun Oct 23 20:17:29 2022 -0400 diff --git a/src/libffi/libffi-3.4.4/ChangeLog.old b/src/libffi/libffi-3.4.6/ChangeLog.old similarity index 100% rename from src/libffi/libffi-3.4.4/ChangeLog.old rename to src/libffi/libffi-3.4.6/ChangeLog.old diff --git a/src/libffi/libffi-3.4.4/LICENSE b/src/libffi/libffi-3.4.6/LICENSE similarity index 94% rename from src/libffi/libffi-3.4.4/LICENSE rename to src/libffi/libffi-3.4.6/LICENSE index 75d1bce11..7282e798c 100644 --- a/src/libffi/libffi-3.4.4/LICENSE +++ b/src/libffi/libffi-3.4.6/LICENSE @@ -1,4 +1,4 @@ -libffi - Copyright (c) 1996-2022 Anthony Green, Red Hat, Inc and others. +libffi - Copyright (c) 1996-2024 Anthony Green, Red Hat, Inc and others. See source files for details. Permission is hereby granted, free of charge, to any person obtaining diff --git a/src/libffi/libffi-3.4.4/LICENSE-BUILDTOOLS b/src/libffi/libffi-3.4.6/LICENSE-BUILDTOOLS similarity index 100% rename from src/libffi/libffi-3.4.4/LICENSE-BUILDTOOLS rename to src/libffi/libffi-3.4.6/LICENSE-BUILDTOOLS diff --git a/src/libffi/libffi-3.4.4/Makefile.am b/src/libffi/libffi-3.4.6/Makefile.am similarity index 98% rename from src/libffi/libffi-3.4.4/Makefile.am rename to src/libffi/libffi-3.4.6/Makefile.am index a4a4887cb..3de0bea47 100644 --- a/src/libffi/libffi-3.4.4/Makefile.am +++ b/src/libffi/libffi-3.4.6/Makefile.am @@ -62,6 +62,7 @@ noinst_HEADERS = src/aarch64/ffitarget.h src/aarch64/internal.h \ src/s390/ffitarget.h src/s390/internal.h src/sh/ffitarget.h \ src/sh64/ffitarget.h src/sparc/ffitarget.h \ src/sparc/internal.h src/tile/ffitarget.h src/vax/ffitarget.h \ + src/wasm32/ffitarget.h \ src/x86/ffitarget.h src/x86/internal.h src/x86/internal64.h \ src/x86/asmnames.h src/xtensa/ffitarget.h src/dlmalloc.c \ src/kvx/ffitarget.h src/kvx/asm.h \ @@ -81,7 +82,7 @@ EXTRA_libffi_la_SOURCES = src/aarch64/ffi.c src/aarch64/sysv.S \ src/mips/n32.S src/moxie/ffi.c src/moxie/eabi.S \ src/nios2/ffi.c src/nios2/sysv.S src/or1k/ffi.c \ src/or1k/sysv.S src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \ - src/powerpc/ffi.c src/powerpc/ffi_sysv.c \ + src/pa/hpux64.S src/powerpc/ffi.c src/powerpc/ffi_sysv.c \ src/powerpc/ffi_linux64.c src/powerpc/sysv.S \ src/powerpc/linux64.S src/powerpc/linux64_closure.S \ src/powerpc/ppc_closure.S src/powerpc/aix.S \ @@ -92,6 +93,7 @@ EXTRA_libffi_la_SOURCES = src/aarch64/ffi.c src/aarch64/sysv.S \ src/sh64/sysv.S src/sparc/ffi.c src/sparc/ffi64.c \ src/sparc/v8.S src/sparc/v9.S src/tile/ffi.c src/tile/tile.S \ src/vax/ffi.c src/vax/elfbsd.S src/x86/ffi.c src/x86/sysv.S \ + src/wasm32/ffi.c \ src/x86/ffiw64.c src/x86/win64.S src/x86/ffi64.c \ src/x86/unix64.S src/x86/sysv_intel.S src/x86/win64_intel.S \ src/xtensa/ffi.c src/xtensa/sysv.S src/kvx/ffi.c \ diff --git a/src/libffi/libffi-3.4.4/Makefile.in b/src/libffi/libffi-3.4.6/Makefile.in similarity index 98% rename from src/libffi/libffi-3.4.4/Makefile.in rename to src/libffi/libffi-3.4.6/Makefile.in index 86eb4a549..66308b78b 100644 --- a/src/libffi/libffi-3.4.4/Makefile.in +++ b/src/libffi/libffi-3.4.6/Makefile.in @@ -224,7 +224,8 @@ am__depfiles_remade = src/$(DEPDIR)/closures.Plo \ src/nios2/$(DEPDIR)/ffi.Plo src/nios2/$(DEPDIR)/sysv.Plo \ src/or1k/$(DEPDIR)/ffi.Plo src/or1k/$(DEPDIR)/sysv.Plo \ src/pa/$(DEPDIR)/ffi.Plo src/pa/$(DEPDIR)/hpux32.Plo \ - src/pa/$(DEPDIR)/linux.Plo src/powerpc/$(DEPDIR)/aix.Plo \ + src/pa/$(DEPDIR)/hpux64.Plo src/pa/$(DEPDIR)/linux.Plo \ + src/powerpc/$(DEPDIR)/aix.Plo \ src/powerpc/$(DEPDIR)/aix_closure.Plo \ src/powerpc/$(DEPDIR)/darwin.Plo \ src/powerpc/$(DEPDIR)/darwin_closure.Plo \ @@ -243,12 +244,12 @@ am__depfiles_remade = src/$(DEPDIR)/closures.Plo \ src/sparc/$(DEPDIR)/ffi64.Plo src/sparc/$(DEPDIR)/v8.Plo \ src/sparc/$(DEPDIR)/v9.Plo src/tile/$(DEPDIR)/ffi.Plo \ src/tile/$(DEPDIR)/tile.Plo src/vax/$(DEPDIR)/elfbsd.Plo \ - src/vax/$(DEPDIR)/ffi.Plo src/x86/$(DEPDIR)/ffi.Plo \ - src/x86/$(DEPDIR)/ffi64.Plo src/x86/$(DEPDIR)/ffiw64.Plo \ - src/x86/$(DEPDIR)/sysv.Plo src/x86/$(DEPDIR)/sysv_intel.Plo \ - src/x86/$(DEPDIR)/unix64.Plo src/x86/$(DEPDIR)/win64.Plo \ - src/x86/$(DEPDIR)/win64_intel.Plo src/xtensa/$(DEPDIR)/ffi.Plo \ - src/xtensa/$(DEPDIR)/sysv.Plo + src/vax/$(DEPDIR)/ffi.Plo src/wasm32/$(DEPDIR)/ffi.Plo \ + src/x86/$(DEPDIR)/ffi.Plo src/x86/$(DEPDIR)/ffi64.Plo \ + src/x86/$(DEPDIR)/ffiw64.Plo src/x86/$(DEPDIR)/sysv.Plo \ + src/x86/$(DEPDIR)/sysv_intel.Plo src/x86/$(DEPDIR)/unix64.Plo \ + src/x86/$(DEPDIR)/win64.Plo src/x86/$(DEPDIR)/win64_intel.Plo \ + src/xtensa/$(DEPDIR)/ffi.Plo src/xtensa/$(DEPDIR)/sysv.Plo am__mv = mv -f CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) @@ -376,7 +377,6 @@ am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LTLDFLAGS = @AM_LTLDFLAGS@ @@ -567,6 +567,7 @@ noinst_HEADERS = src/aarch64/ffitarget.h src/aarch64/internal.h \ src/s390/ffitarget.h src/s390/internal.h src/sh/ffitarget.h \ src/sh64/ffitarget.h src/sparc/ffitarget.h \ src/sparc/internal.h src/tile/ffitarget.h src/vax/ffitarget.h \ + src/wasm32/ffitarget.h \ src/x86/ffitarget.h src/x86/internal.h src/x86/internal64.h \ src/x86/asmnames.h src/xtensa/ffitarget.h src/dlmalloc.c \ src/kvx/ffitarget.h src/kvx/asm.h \ @@ -586,7 +587,7 @@ EXTRA_libffi_la_SOURCES = src/aarch64/ffi.c src/aarch64/sysv.S \ src/mips/n32.S src/moxie/ffi.c src/moxie/eabi.S \ src/nios2/ffi.c src/nios2/sysv.S src/or1k/ffi.c \ src/or1k/sysv.S src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \ - src/powerpc/ffi.c src/powerpc/ffi_sysv.c \ + src/pa/hpux64.S src/powerpc/ffi.c src/powerpc/ffi_sysv.c \ src/powerpc/ffi_linux64.c src/powerpc/sysv.S \ src/powerpc/linux64.S src/powerpc/linux64_closure.S \ src/powerpc/ppc_closure.S src/powerpc/aix.S \ @@ -597,6 +598,7 @@ EXTRA_libffi_la_SOURCES = src/aarch64/ffi.c src/aarch64/sysv.S \ src/sh64/sysv.S src/sparc/ffi.c src/sparc/ffi64.c \ src/sparc/v8.S src/sparc/v9.S src/tile/ffi.c src/tile/tile.S \ src/vax/ffi.c src/vax/elfbsd.S src/x86/ffi.c src/x86/sysv.S \ + src/wasm32/ffi.c \ src/x86/ffiw64.c src/x86/win64.S src/x86/ffi64.c \ src/x86/unix64.S src/x86/sysv_intel.S src/x86/win64_intel.S \ src/xtensa/ffi.c src/xtensa/sysv.S src/kvx/ffi.c \ @@ -942,6 +944,8 @@ src/pa/linux.lo: src/pa/$(am__dirstamp) \ src/pa/$(DEPDIR)/$(am__dirstamp) src/pa/hpux32.lo: src/pa/$(am__dirstamp) \ src/pa/$(DEPDIR)/$(am__dirstamp) +src/pa/hpux64.lo: src/pa/$(am__dirstamp) \ + src/pa/$(DEPDIR)/$(am__dirstamp) src/powerpc/$(am__dirstamp): @$(MKDIR_P) src/powerpc @: > src/powerpc/$(am__dirstamp) @@ -1055,6 +1059,14 @@ src/x86/ffi.lo: src/x86/$(am__dirstamp) \ src/x86/$(DEPDIR)/$(am__dirstamp) src/x86/sysv.lo: src/x86/$(am__dirstamp) \ src/x86/$(DEPDIR)/$(am__dirstamp) +src/wasm32/$(am__dirstamp): + @$(MKDIR_P) src/wasm32 + @: > src/wasm32/$(am__dirstamp) +src/wasm32/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/wasm32/$(DEPDIR) + @: > src/wasm32/$(DEPDIR)/$(am__dirstamp) +src/wasm32/ffi.lo: src/wasm32/$(am__dirstamp) \ + src/wasm32/$(DEPDIR)/$(am__dirstamp) src/x86/ffiw64.lo: src/x86/$(am__dirstamp) \ src/x86/$(DEPDIR)/$(am__dirstamp) src/x86/win64.lo: src/x86/$(am__dirstamp) \ @@ -1168,6 +1180,8 @@ mostlyclean-compile: -rm -f src/tile/*.lo -rm -f src/vax/*.$(OBJEXT) -rm -f src/vax/*.lo + -rm -f src/wasm32/*.$(OBJEXT) + -rm -f src/wasm32/*.lo -rm -f src/x86/*.$(OBJEXT) -rm -f src/x86/*.lo -rm -f src/xtensa/*.$(OBJEXT) @@ -1230,6 +1244,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@src/or1k/$(DEPDIR)/sysv.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/pa/$(DEPDIR)/ffi.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/pa/$(DEPDIR)/hpux32.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/pa/$(DEPDIR)/hpux64.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/pa/$(DEPDIR)/linux.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/aix.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/aix_closure.Plo@am__quote@ # am--include-marker @@ -1259,6 +1274,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@src/tile/$(DEPDIR)/tile.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/vax/$(DEPDIR)/elfbsd.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/vax/$(DEPDIR)/ffi.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@src/wasm32/$(DEPDIR)/ffi.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/ffi.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/ffi64.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/ffiw64.Plo@am__quote@ # am--include-marker @@ -1360,6 +1376,7 @@ clean-libtool: -rm -rf src/sparc/.libs src/sparc/_libs -rm -rf src/tile/.libs src/tile/_libs -rm -rf src/vax/.libs src/vax/_libs + -rm -rf src/wasm32/.libs src/wasm32/_libs -rm -rf src/x86/.libs src/x86/_libs -rm -rf src/xtensa/.libs src/xtensa/_libs @@ -1788,6 +1805,8 @@ distclean-generic: -rm -f src/tile/$(am__dirstamp) -rm -f src/vax/$(DEPDIR)/$(am__dirstamp) -rm -f src/vax/$(am__dirstamp) + -rm -f src/wasm32/$(DEPDIR)/$(am__dirstamp) + -rm -f src/wasm32/$(am__dirstamp) -rm -f src/x86/$(DEPDIR)/$(am__dirstamp) -rm -f src/x86/$(am__dirstamp) -rm -f src/xtensa/$(DEPDIR)/$(am__dirstamp) @@ -1858,6 +1877,7 @@ distclean: distclean-recursive -rm -f src/or1k/$(DEPDIR)/sysv.Plo -rm -f src/pa/$(DEPDIR)/ffi.Plo -rm -f src/pa/$(DEPDIR)/hpux32.Plo + -rm -f src/pa/$(DEPDIR)/hpux64.Plo -rm -f src/pa/$(DEPDIR)/linux.Plo -rm -f src/powerpc/$(DEPDIR)/aix.Plo -rm -f src/powerpc/$(DEPDIR)/aix_closure.Plo @@ -1887,6 +1907,7 @@ distclean: distclean-recursive -rm -f src/tile/$(DEPDIR)/tile.Plo -rm -f src/vax/$(DEPDIR)/elfbsd.Plo -rm -f src/vax/$(DEPDIR)/ffi.Plo + -rm -f src/wasm32/$(DEPDIR)/ffi.Plo -rm -f src/x86/$(DEPDIR)/ffi.Plo -rm -f src/x86/$(DEPDIR)/ffi64.Plo -rm -f src/x86/$(DEPDIR)/ffiw64.Plo @@ -1998,6 +2019,7 @@ maintainer-clean: maintainer-clean-recursive -rm -f src/or1k/$(DEPDIR)/sysv.Plo -rm -f src/pa/$(DEPDIR)/ffi.Plo -rm -f src/pa/$(DEPDIR)/hpux32.Plo + -rm -f src/pa/$(DEPDIR)/hpux64.Plo -rm -f src/pa/$(DEPDIR)/linux.Plo -rm -f src/powerpc/$(DEPDIR)/aix.Plo -rm -f src/powerpc/$(DEPDIR)/aix_closure.Plo @@ -2027,6 +2049,7 @@ maintainer-clean: maintainer-clean-recursive -rm -f src/tile/$(DEPDIR)/tile.Plo -rm -f src/vax/$(DEPDIR)/elfbsd.Plo -rm -f src/vax/$(DEPDIR)/ffi.Plo + -rm -f src/wasm32/$(DEPDIR)/ffi.Plo -rm -f src/x86/$(DEPDIR)/ffi.Plo -rm -f src/x86/$(DEPDIR)/ffi64.Plo -rm -f src/x86/$(DEPDIR)/ffiw64.Plo diff --git a/src/libffi/libffi-3.4.4/README.md b/src/libffi/libffi-3.4.6/README.md similarity index 95% rename from src/libffi/libffi-3.4.4/README.md rename to src/libffi/libffi-3.4.6/README.md index f24a0f7b8..23199b9ed 100644 --- a/src/libffi/libffi-3.4.4/README.md +++ b/src/libffi/libffi-3.4.6/README.md @@ -1,5 +1,5 @@ -libffi-3.4.4 was released on October 23, 2022. Check the libffi web +libffi-3.4.6 was released on February 18, 2024. Check the libffi web page for updates: . @@ -50,6 +50,8 @@ tested: | Alpha | Linux | GCC | | Alpha | Tru64 | GCC | | ARC | Linux | GCC | +| ARC32 | Linux | GCC | +| ARC64 | Linux | GCC | | ARM | Linux | GCC | | ARM | iOS | GCC | | ARM | Windows | MSVC | @@ -57,6 +59,7 @@ tested: | Blackfin | uClinux | GCC | | CSKY | Linux | GCC | | HPPA | HPUX | GCC | +| HPPA64 | HPUX | GCC | | KVX | Linux | GCC | | IA-64 | Linux | GCC | | LoongArch64 | Linux | GCC | @@ -95,6 +98,7 @@ tested: | SPARC64 | Solaris | Oracle Solaris Studio C | | TILE-Gx/TILEPro | Linux | GCC | | VAX | OpenBSD/vax | GCC | +| WASM32 | Emscripten | EMCC | | X86 | FreeBSD | GCC | | X86 | GNU HURD | GCC | | X86 | Interix | GCC | @@ -105,14 +109,14 @@ tested: | X86 | Solaris | GCC | | X86 | Solaris | Oracle Solaris Studio C | | X86 | Windows/Cygwin | GCC | -| X86 | Windows/MingW | GCC | +| X86 | Windows/MinGW | GCC | | X86-64 | FreeBSD | GCC | | X86-64 | Linux | GCC | | X86-64 | Linux/x32 | GCC | | X86-64 | OpenBSD | GCC | | X86-64 | Solaris | Oracle Solaris Studio C | | X86-64 | Windows/Cygwin | GCC | -| X86-64 | Windows/MingW | GCC | +| X86-64 | Windows/MinGW | GCC | | X86-64 | Mac OSX | GCC | | Xtensa | Linux | GCC | @@ -152,7 +156,7 @@ It's also possible to build libffi on Windows platforms with Microsoft's Visual C++ compiler. In this case, use the msvcc.sh wrapper script during configuration like so: - path/to/configure CC=path/to/msvcc.sh CXX=path/to/msvcc.sh LD=link CPP="cl -nologo -EP" CPPFLAGS="-DFFI_BUILDING_DLL" + path/to/configure CC=path/to/msvcc.sh CXX=path/to/msvcc.sh LD=link CPP="cl -nologo -EP" CXXCPP="cl -nologo -EP" CPPFLAGS="-DFFI_BUILDING_DLL" For 64-bit Windows builds, use ``CC="path/to/msvcc.sh -m64"`` and ``CXX="path/to/msvcc.sh -m64"``. You may also need to specify @@ -195,6 +199,17 @@ History See the git log for details at http://github.com/libffi/libffi. + 3.4.6 Feb-18-2024 + Fix long double regression on mips64 and alpha. + + 3.4.5 Feb-15-2024 + Add support for wasm32. + Add support for aarch64 branch target identification (bti). + Add support for ARCv3: ARC32 & ARC64. + Add support for HPPA64, and many HPPA fixes. + Add support for Haikuos on PowerPC. + Fixes for AIX, loongson, MIPS, power, sparc64, and x86 Darwin. + 3.4.4 Oct-23-2022 Important aarch64 fixes, including support for linux builds with Link Time Optimization (-flto). @@ -472,6 +487,7 @@ developers: nios ii Sandra Loosemore openrisc Sebastian Macke pa Randolph Chung, Dave Anglin, Andreas Tobler + pa64 Dave Anglin powerpc Geoffrey Keating, Andreas Tobler, David Edelsohn, John Hornkvist powerpc64 Jakub Jelinek @@ -482,6 +498,7 @@ developers: sparc Anthony Green, Gordon Irlam tile-gx/tilepro Walter Lee vax Miod Vallat + wasm32 Hood Chatham, Brion Vibber, Kleis Auke Wolthuizen x86 Anthony Green, Jon Beniston x86-64 Bo Thorsen xtensa Chris Zankel diff --git a/src/libffi/libffi-3.4.4/acinclude.m4 b/src/libffi/libffi-3.4.6/acinclude.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/acinclude.m4 rename to src/libffi/libffi-3.4.6/acinclude.m4 diff --git a/src/libffi/libffi-3.4.4/aclocal.m4 b/src/libffi/libffi-3.4.6/aclocal.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/aclocal.m4 rename to src/libffi/libffi-3.4.6/aclocal.m4 diff --git a/src/libffi/libffi-3.4.4/compile b/src/libffi/libffi-3.4.6/compile similarity index 100% rename from src/libffi/libffi-3.4.4/compile rename to src/libffi/libffi-3.4.6/compile diff --git a/src/libffi/libffi-3.4.4/config.guess b/src/libffi/libffi-3.4.6/config.guess similarity index 100% rename from src/libffi/libffi-3.4.4/config.guess rename to src/libffi/libffi-3.4.6/config.guess diff --git a/src/sqlite/SQLite-3.43.1/config.sub b/src/libffi/libffi-3.4.6/config.sub similarity index 99% rename from src/sqlite/SQLite-3.43.1/config.sub rename to src/libffi/libffi-3.4.6/config.sub index dba16e84c..630b5d9c4 100755 --- a/src/sqlite/SQLite-3.43.1/config.sub +++ b/src/libffi/libffi-3.4.6/config.sub @@ -1126,7 +1126,7 @@ case $cpu-$vendor in xscale-* | xscalee[bl]-*) cpu=`echo "$cpu" | sed 's/^xscale/arm/'` ;; - arm64-* | aarch64le-*) + arm64-* | arm64_32-* | aarch64le-*) cpu=aarch64 ;; @@ -1728,7 +1728,7 @@ case $os in | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ | hiux* | abug | nacl* | netware* | windows* \ - | os9* | macos* | osx* | ios* \ + | os9* | macos* | osx* | ios* | watchos* | tvos* \ | mpw* | magic* | mmixware* | mon960* | lnews* \ | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ | aos* | aros* | cloudabi* | sortix* | twizzler* \ @@ -1790,6 +1790,8 @@ case $kernel-$os in ;; os2-emx) ;; + ios*-simulator | tvos*-simulator | watchos*-simulator) + ;; *-eabi* | *-gnueabi*) ;; -*) diff --git a/src/libffi/libffi-3.4.4/configure b/src/libffi/libffi-3.4.6/configure similarity index 98% rename from src/libffi/libffi-3.4.4/configure rename to src/libffi/libffi-3.4.6/configure index a43e342a9..bcbbd4448 100755 --- a/src/libffi/libffi-3.4.4/configure +++ b/src/libffi/libffi-3.4.6/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for libffi 3.4.4. +# Generated by GNU Autoconf 2.71 for libffi 3.4.6. # # Report bugs to . # @@ -621,8 +621,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libffi' PACKAGE_TARNAME='libffi' -PACKAGE_VERSION='3.4.4' -PACKAGE_STRING='libffi 3.4.4' +PACKAGE_VERSION='3.4.6' +PACKAGE_STRING='libffi 3.4.6' PACKAGE_BUGREPORT='http://github.com/libffi/libffi/issues' PACKAGE_URL='' @@ -686,7 +686,6 @@ FFI_EXEC_TRAMPOLINE_TABLE_TRUE sys_symbol_underscore HAVE_LONG_DOUBLE_VARIANT HAVE_LONG_DOUBLE -ALLOCA AM_LTLDFLAGS AM_RUNTESTFLAGS TESTSUBDIR_FALSE @@ -1413,7 +1412,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libffi 3.4.4 to adapt to many kinds of systems. +\`configure' configures libffi 3.4.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1485,7 +1484,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libffi 3.4.4:";; + short | recursive ) echo "Configuration of libffi 3.4.6:";; esac cat <<\_ACEOF @@ -1621,7 +1620,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libffi configure 3.4.4 +libffi configure 3.4.6 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2171,63 +2170,6 @@ rm -f conftest.val as_fn_set_status $ac_retval } # ac_fn_c_compute_int - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -printf %s "checking for $2... " >&6; } -if eval test \${$3+y} -then : - printf %s "(cached) " >&6 -else $as_nop - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main (void) -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main (void) -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - -else $as_nop - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -eval ac_res=\$$3 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -printf "%s\n" "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_type ac_configure_args_raw= for ac_arg do @@ -2252,7 +2194,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libffi $as_me 3.4.4, which was +It was created by libffi $as_me 3.4.6, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3971,7 +3913,7 @@ fi # Define the identity of the package. PACKAGE='libffi' - VERSION='3.4.4' + VERSION='3.4.6' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -5614,11 +5556,11 @@ if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 printf %s "checking for $CXX option to enable C++11 features... " >&6; } -if test ${ac_cv_prog_cxx_11+y} +if test ${ac_cv_prog_cxx_cxx11+y} then : printf %s "(cached) " >&6 else $as_nop - ac_cv_prog_cxx_11=no + ac_cv_prog_cxx_cxx11=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5660,11 +5602,11 @@ if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 printf %s "checking for $CXX option to enable C++98 features... " >&6; } -if test ${ac_cv_prog_cxx_98+y} +if test ${ac_cv_prog_cxx_cxx98+y} then : printf %s "(cached) " >&6 else $as_nop - ac_cv_prog_cxx_98=no + ac_cv_prog_cxx_cxx98=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -18677,180 +18619,6 @@ then : fi -ac_fn_c_check_header_compile "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mman_h" = xyes -then : - printf "%s\n" "#define HAVE_SYS_MMAN_H 1" >>confdefs.h - -fi - -ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" -if test "x$ac_cv_func_mmap" = xyes -then : - printf "%s\n" "#define HAVE_MMAP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "mkostemp" "ac_cv_func_mkostemp" -if test "x$ac_cv_func_mkostemp" = xyes -then : - printf "%s\n" "#define HAVE_MKOSTEMP 1" >>confdefs.h - -fi -ac_fn_c_check_func "$LINENO" "mkstemp" "ac_cv_func_mkstemp" -if test "x$ac_cv_func_mkstemp" = xyes -then : - printf "%s\n" "#define HAVE_MKSTEMP 1" >>confdefs.h - -fi - - -ac_fn_c_check_header_compile "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_mman_h" = xyes -then : - libffi_header_sys_mman_h=yes -else $as_nop - libffi_header_sys_mman_h=no -fi - -ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" -if test "x$ac_cv_func_mmap" = xyes -then : - libffi_func_mmap=yes -else $as_nop - libffi_func_mmap=no -fi - -if test "$libffi_header_sys_mman_h" != yes \ - || test "$libffi_func_mmap" != yes; then - ac_cv_func_mmap_file=no - ac_cv_func_mmap_dev_zero=no - ac_cv_func_mmap_anon=no -else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether read-only mmap of a plain file works" >&5 -printf %s "checking whether read-only mmap of a plain file works... " >&6; } -if test ${ac_cv_func_mmap_file+y} -then : - printf %s "(cached) " >&6 -else $as_nop - # Add a system to this blacklist if - # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a - # memory area containing the same data that you'd get if you applied - # read() to the same fd. The only system known to have a problem here - # is VMS, where text files have record structure. - case "$host_os" in - vms* | ultrix*) - ac_cv_func_mmap_file=no ;; - *) - ac_cv_func_mmap_file=yes;; - esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_file" >&5 -printf "%s\n" "$ac_cv_func_mmap_file" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mmap from /dev/zero works" >&5 -printf %s "checking whether mmap from /dev/zero works... " >&6; } -if test ${ac_cv_func_mmap_dev_zero+y} -then : - printf %s "(cached) " >&6 -else $as_nop - # Add a system to this blacklist if it has mmap() but /dev/zero - # does not exist, or if mmapping /dev/zero does not give anonymous - # zeroed pages with both the following properties: - # 1. If you map N consecutive pages in with one call, and then - # unmap any subset of those pages, the pages that were not - # explicitly unmapped remain accessible. - # 2. If you map two adjacent blocks of memory and then unmap them - # both at once, they must both go away. - # Systems known to be in this category are Windows (all variants), - # VMS, and Darwin. - case "$host_os" in - vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00) - ac_cv_func_mmap_dev_zero=no ;; - *) - ac_cv_func_mmap_dev_zero=yes;; - esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_dev_zero" >&5 -printf "%s\n" "$ac_cv_func_mmap_dev_zero" >&6; } - - # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for. - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MAP_ANON(YMOUS)" >&5 -printf %s "checking for MAP_ANON(YMOUS)... " >&6; } -if test ${ac_cv_decl_map_anon+y} -then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include - -#ifndef MAP_ANONYMOUS -#define MAP_ANONYMOUS MAP_ANON -#endif - -int -main (void) -{ -int n = MAP_ANONYMOUS; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - ac_cv_decl_map_anon=yes -else $as_nop - ac_cv_decl_map_anon=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_decl_map_anon" >&5 -printf "%s\n" "$ac_cv_decl_map_anon" >&6; } - - if test $ac_cv_decl_map_anon = no; then - ac_cv_func_mmap_anon=no - else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mmap with MAP_ANON(YMOUS) works" >&5 -printf %s "checking whether mmap with MAP_ANON(YMOUS) works... " >&6; } -if test ${ac_cv_func_mmap_anon+y} -then : - printf %s "(cached) " >&6 -else $as_nop - # Add a system to this blacklist if it has mmap() and MAP_ANON or - # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) - # doesn't give anonymous zeroed pages with the same properties listed - # above for use of /dev/zero. - # Systems known to be in this category are Windows, VMS, and SCO Unix. - case "$host_os" in - vms* | cygwin* | pe | mingw* | sco* | udk* ) - ac_cv_func_mmap_anon=no ;; - *) - ac_cv_func_mmap_anon=yes;; - esac -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_anon" >&5 -printf "%s\n" "$ac_cv_func_mmap_anon" >&6; } - fi -fi - -if test $ac_cv_func_mmap_file = yes; then - -printf "%s\n" "#define HAVE_MMAP_FILE 1" >>confdefs.h - -fi -if test $ac_cv_func_mmap_dev_zero = yes; then - -printf "%s\n" "#define HAVE_MMAP_DEV_ZERO 1" >>confdefs.h - -fi -if test $ac_cv_func_mmap_anon = yes; then - -printf "%s\n" "#define HAVE_MMAP_ANON 1" >>confdefs.h - -fi - - if test -d $srcdir/testsuite; then TESTSUBDIR_TRUE= TESTSUBDIR_FALSE='#' @@ -18956,162 +18724,10 @@ then : fi -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes -then : - -else $as_nop - -printf "%s\n" "#define size_t unsigned int" >>confdefs.h - -fi - -# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works -# for constant arguments. Useless! -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 -printf %s "checking for working alloca.h... " >&6; } -if test ${ac_cv_working_alloca_h+y} +ac_fn_c_check_header_compile "$LINENO" "alloca.h" "ac_cv_header_alloca_h" "$ac_includes_default" +if test "x$ac_cv_header_alloca_h" = xyes then : - printf %s "(cached) " >&6 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ -char *p = (char *) alloca (2 * sizeof (int)); - if (p) return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_working_alloca_h=yes -else $as_nop - ac_cv_working_alloca_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 -printf "%s\n" "$ac_cv_working_alloca_h" >&6; } -if test $ac_cv_working_alloca_h = yes; then - -printf "%s\n" "#define HAVE_ALLOCA_H 1" >>confdefs.h - -fi - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 -printf %s "checking for alloca... " >&6; } -if test ${ac_cv_func_alloca_works+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test $ac_cv_working_alloca_h = yes; then - ac_cv_func_alloca_works=yes -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#ifndef alloca -# ifdef __GNUC__ -# define alloca __builtin_alloca -# elif defined _MSC_VER -# include -# define alloca _alloca -# else -# ifdef __cplusplus -extern "C" -# endif -void *alloca (size_t); -# endif -#endif - -int -main (void) -{ -char *p = (char *) alloca (1); - if (p) return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - ac_cv_func_alloca_works=yes -else $as_nop - ac_cv_func_alloca_works=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam \ - conftest$ac_exeext conftest.$ac_ext -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 -printf "%s\n" "$ac_cv_func_alloca_works" >&6; } -fi - -if test $ac_cv_func_alloca_works = yes; then - -printf "%s\n" "#define HAVE_ALLOCA 1" >>confdefs.h - -else - # The SVR3 libPW and SVR4 libucb both contain incompatible functions -# that cause trouble. Some versions do not even contain alloca or -# contain a buggy version. If you still want to use their alloca, -# use ar to extract alloca.o from them instead of compiling alloca.c. - -ALLOCA=\${LIBOBJDIR}alloca.$ac_objext - -printf "%s\n" "#define C_ALLOCA 1" >>confdefs.h - - -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 -printf %s "checking stack direction for C alloca... " >&6; } -if test ${ac_cv_c_stack_direction+y} -then : - printf %s "(cached) " >&6 -else $as_nop - if test "$cross_compiling" = yes -then : - ac_cv_c_stack_direction=0 -else $as_nop - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -find_stack_direction (int *addr, int depth) -{ - int dir, dummy = 0; - if (! addr) - addr = &dummy; - *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; - dir = depth ? find_stack_direction (addr, depth - 1) : 0; - return dir + dummy; -} - -int -main (int argc, char **argv) -{ - return find_stack_direction (0, argc + !argv + 20) < 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO" -then : - ac_cv_c_stack_direction=1 -else $as_nop - ac_cv_c_stack_direction=-1 -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 -printf "%s\n" "$ac_cv_c_stack_direction" >&6; } -printf "%s\n" "#define STACK_DIRECTION $ac_cv_c_stack_direction" >>confdefs.h - + printf "%s\n" "#define HAVE_ALLOCA_H 1" >>confdefs.h fi @@ -19877,7 +19493,7 @@ else $as_nop ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then - if $EGREP '(\.hidden|\.private_extern).*foo' conftest.s >/dev/null; then + if $EGREP '(\.hidden|\.private_extern).*foo|foo.*,hidden' conftest.s >/dev/null; then libffi_cv_hidden_visibility_attribute=yes fi fi @@ -20942,7 +20558,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libffi $as_me 3.4.4, which was +This file was extended by libffi $as_me 3.4.6, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21010,7 +20626,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -libffi config.status 3.4.4 +libffi config.status 3.4.6 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/src/libffi/libffi-3.4.4/configure.ac b/src/libffi/libffi-3.4.6/configure.ac similarity index 98% rename from src/libffi/libffi-3.4.4/configure.ac rename to src/libffi/libffi-3.4.6/configure.ac index 7e8cd98a4..816bfd666 100644 --- a/src/libffi/libffi-3.4.4/configure.ac +++ b/src/libffi/libffi-3.4.6/configure.ac @@ -2,7 +2,7 @@ dnl Process this with autoconf to create configure AC_PREREQ([2.71]) -AC_INIT([libffi],[3.4.4],[http://github.com/libffi/libffi/issues]) +AC_INIT([libffi],[3.4.6],[http://github.com/libffi/libffi/issues]) AC_CONFIG_HEADERS([fficonfig.h]) AC_CANONICAL_TARGET @@ -70,10 +70,6 @@ AM_MAINTAINER_MODE AC_CHECK_HEADERS(sys/memfd.h) AC_CHECK_FUNCS([memfd_create]) -AC_CHECK_HEADERS(sys/mman.h) -AC_CHECK_FUNCS([mmap mkostemp mkstemp]) -AC_FUNC_MMAP_BLACKLIST - dnl The -no-testsuite modules omit the test subdir. AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite) @@ -99,7 +95,7 @@ AC_CHECK_INCLUDES_DEFAULT AC_PROG_EGREP AC_CHECK_FUNCS(memcpy) -AC_FUNC_ALLOCA +AC_CHECK_HEADERS(alloca.h) AC_CHECK_SIZEOF(double) AC_CHECK_SIZEOF(long double) @@ -302,7 +298,7 @@ if test "x$GCC" = "xyes"; then echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1 ; }' > conftest.c libffi_cv_hidden_visibility_attribute=no if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then - if $EGREP '(\.hidden|\.private_extern).*foo' conftest.s >/dev/null; then + if $EGREP '(\.hidden|\.private_extern).*foo|foo.*,hidden' conftest.s >/dev/null; then libffi_cv_hidden_visibility_attribute=yes fi fi diff --git a/src/libffi/libffi-3.4.4/configure.host b/src/libffi/libffi-3.4.6/configure.host similarity index 98% rename from src/libffi/libffi-3.4.4/configure.host rename to src/libffi/libffi-3.4.6/configure.host index f23716f75..4cc69be4f 100644 --- a/src/libffi/libffi-3.4.4/configure.host +++ b/src/libffi/libffi-3.4.6/configure.host @@ -73,6 +73,7 @@ case "${host}" in ;; hppa*64-*-hpux*) TARGET=PA64_HPUX; TARGETDIR=pa + SOURCES="ffi64.c hpux64.S" ;; hppa*-*-hpux*) TARGET=PA_HPUX; TARGETDIR=pa @@ -204,7 +205,7 @@ case "${host}" in powerpc-*-eabi*) TARGET=POWERPC; TARGETDIR=powerpc ;; - powerpc-*-beos*) + powerpc-*-beos* | powerpc-*-haiku*) TARGET=POWERPC; TARGETDIR=powerpc ;; powerpc-*-darwin* | powerpc64-*-darwin*) @@ -264,6 +265,11 @@ case "${host}" in SOURCES="ffi.c elfbsd.S" ;; + wasm32-*-*) + TARGET=wasm32; TARGETDIR=wasm32 + SOURCES="ffi.c" + ;; + xtensa*-*) TARGET=XTENSA; TARGETDIR=xtensa SOURCES="ffi.c sysv.S" diff --git a/src/libffi/libffi-3.4.4/depcomp b/src/libffi/libffi-3.4.6/depcomp similarity index 100% rename from src/libffi/libffi-3.4.4/depcomp rename to src/libffi/libffi-3.4.6/depcomp diff --git a/src/libffi/libffi-3.4.4/doc/Makefile.am b/src/libffi/libffi-3.4.6/doc/Makefile.am similarity index 100% rename from src/libffi/libffi-3.4.4/doc/Makefile.am rename to src/libffi/libffi-3.4.6/doc/Makefile.am diff --git a/src/libffi/libffi-3.4.4/doc/Makefile.in b/src/libffi/libffi-3.4.6/doc/Makefile.in similarity index 99% rename from src/libffi/libffi-3.4.4/doc/Makefile.in rename to src/libffi/libffi-3.4.6/doc/Makefile.in index bccd187bb..95baf7668 100644 --- a/src/libffi/libffi-3.4.4/doc/Makefile.in +++ b/src/libffi/libffi-3.4.6/doc/Makefile.in @@ -204,7 +204,6 @@ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in mdate-sh texinfo.tex DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LTLDFLAGS = @AM_LTLDFLAGS@ diff --git a/src/libffi/libffi-3.4.4/doc/libffi.info b/src/libffi/libffi-3.4.6/doc/libffi.info similarity index 67% rename from src/libffi/libffi-3.4.4/doc/libffi.info rename to src/libffi/libffi-3.4.6/doc/libffi.info index 6b9580ad6..2afb9c7fa 100644 --- a/src/libffi/libffi-3.4.4/doc/libffi.info +++ b/src/libffi/libffi-3.4.6/doc/libffi.info @@ -1,13 +1,14 @@ -This is libffi.info, produced by makeinfo version 6.8 from libffi.texi. +This is libffi.info, produced by makeinfo version 7.0.3 from +libffi.texi. This manual is for libffi, a portable foreign function interface library. - Copyright (C) 2008-2019, 2021, 2022 Anthony Green and Red Hat, Inc. + Copyright © 2008–2024 Anthony Green and Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including +“Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to @@ -16,7 +17,7 @@ the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY @@ -38,11 +39,11 @@ libffi This manual is for libffi, a portable foreign function interface library. - Copyright (C) 2008-2019, 2021, 2022 Anthony Green and Red Hat, Inc. + Copyright © 2008–2024 Anthony Green and Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including +“Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to @@ -51,7 +52,7 @@ the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY @@ -64,7 +65,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Introduction:: What is libffi? * Using libffi:: How to use libffi. * Memory Usage:: Where memory for closures comes from. -* Missing Features:: Things libffi can't do. +* Missing Features:: Things libffi can’t do. * Index:: Index.  @@ -75,29 +76,29 @@ File: libffi.info, Node: Introduction, Next: Using libffi, Prev: Top, Up: To Compilers for high level languages generate code that follow certain conventions. These conventions are necessary, in part, for separate -compilation to work. One such convention is the "calling convention". +compilation to work. One such convention is the “calling convention”. The calling convention is a set of assumptions made by the compiler about where function arguments will be found on entry to a function. A calling convention also specifies where the return value for a function -is found. The calling convention is also sometimes called the "ABI" or -"Application Binary Interface". +is found. The calling convention is also sometimes called the “ABI” or +“Application Binary Interface”. Some programs may not know at the time of compilation what arguments are to be passed to a function. For instance, an interpreter may be told at run-time about the number and types of arguments used to call a -given function. 'libffi' can be used in such programs to provide a +given function. ‘libffi’ can be used in such programs to provide a bridge from the interpreter program to compiled code. - The 'libffi' library provides a portable, high level programming + The ‘libffi’ library provides a portable, high level programming interface to various calling conventions. This allows a programmer to call any function specified by a call interface description at run time. FFI stands for Foreign Function Interface. A foreign function interface is the popular name for the interface that allows code written -in one language to call code written in another language. The 'libffi' +in one language to call code written in another language. The ‘libffi’ library really only provides the lowest, machine dependent layer of a fully featured foreign function interface. A layer must exist above -'libffi' that handles type conversions for values passed between the two +‘libffi’ that handles type conversions for values passed between the two languages.  @@ -122,45 +123,45 @@ File: libffi.info, Node: The Basics, Next: Simple Example, Up: Using libffi 2.1 The Basics ============== -'libffi' assumes that you have a pointer to the function you wish to +‘libffi’ assumes that you have a pointer to the function you wish to call and that you know the number and types of arguments to pass it, as well as the return type of the function. - The first thing you must do is create an 'ffi_cif' object that + The first thing you must do is create an ‘ffi_cif’ object that matches the signature of the function you wish to call. This is a separate step because it is common to make multiple calls using a single -'ffi_cif'. The "cif" in 'ffi_cif' stands for Call InterFace. To -prepare a call interface object, use the function 'ffi_prep_cif'. +‘ffi_cif’. The “cif” in ‘ffi_cif’ stands for Call InterFace. To +prepare a call interface object, use the function ‘ffi_prep_cif’. -- Function: ffi_status ffi_prep_cif (ffi_cif *CIF, ffi_abi ABI, unsigned int NARGS, ffi_type *RTYPE, ffi_type **ARGTYPES) This initializes CIF according to the given parameters. - ABI is the ABI to use; normally 'FFI_DEFAULT_ABI' is what you want. + ABI is the ABI to use; normally ‘FFI_DEFAULT_ABI’ is what you want. *note Multiple ABIs:: for more information. NARGS is the number of arguments that this function accepts. - RTYPE is a pointer to an 'ffi_type' structure that describes the + RTYPE is a pointer to an ‘ffi_type’ structure that describes the return type of the function. *Note Types::. - ARGTYPES is a vector of 'ffi_type' pointers. ARGTYPES must have + ARGTYPES is a vector of ‘ffi_type’ pointers. ARGTYPES must have NARGS elements. If NARGS is 0, this argument is ignored. - 'ffi_prep_cif' returns a 'libffi' status code, of type - 'ffi_status'. This will be either 'FFI_OK' if everything worked - properly; 'FFI_BAD_TYPEDEF' if one of the 'ffi_type' objects is - incorrect; or 'FFI_BAD_ABI' if the ABI parameter is invalid. + ‘ffi_prep_cif’ returns a ‘libffi’ status code, of type + ‘ffi_status’. This will be either ‘FFI_OK’ if everything worked + properly; ‘FFI_BAD_TYPEDEF’ if one of the ‘ffi_type’ objects is + incorrect; or ‘FFI_BAD_ABI’ if the ABI parameter is invalid. If the function being called is variadic (varargs) then -'ffi_prep_cif_var' must be used instead of 'ffi_prep_cif'. +‘ffi_prep_cif_var’ must be used instead of ‘ffi_prep_cif’. -- Function: ffi_status ffi_prep_cif_var (ffi_cif *CIF, ffi_abi ABI, unsigned int NFIXEDARGS, unsigned int NTOTALARGS, ffi_type *RTYPE, ffi_type **ARGTYPES) This initializes CIF according to the given parameters for a call to a variadic function. In general its operation is the same as - for 'ffi_prep_cif' except that: + for ‘ffi_prep_cif’ except that: NFIXEDARGS is the number of fixed arguments, prior to any variadic arguments. It must be greater than zero. @@ -168,59 +169,59 @@ prepare a call interface object, use the function 'ffi_prep_cif'. NTOTALARGS the total number of arguments, including variadic and fixed arguments. ARGTYPES must have this many elements. - 'ffi_prep_cif_var' will return 'FFI_BAD_ARGTYPE' if any of the - variable argument types are 'ffi_type_float' (promote to - 'ffi_type_double' first), or any integer type small than an int + ‘ffi_prep_cif_var’ will return ‘FFI_BAD_ARGTYPE’ if any of the + variable argument types are ‘ffi_type_float’ (promote to + ‘ffi_type_double’ first), or any integer type small than an int (promote to an int-sized type first). - Note that, different cif's must be prepped for calls to the same + Note that, different cif’s must be prepped for calls to the same function when different numbers of arguments are passed. - Also note that a call to 'ffi_prep_cif_var' with + Also note that a call to ‘ffi_prep_cif_var’ with NFIXEDARGS=NOTOTALARGS is NOT equivalent to a call to - 'ffi_prep_cif'. + ‘ffi_prep_cif’. - Note that the resulting 'ffi_cif' holds pointers to all the -'ffi_type' objects that were used during initialization. You must + Note that the resulting ‘ffi_cif’ holds pointers to all the +‘ffi_type’ objects that were used during initialization. You must ensure that these type objects have a lifetime at least as long as that -of the 'ffi_cif'. +of the ‘ffi_cif’. - To call a function using an initialized 'ffi_cif', use the 'ffi_call' + To call a function using an initialized ‘ffi_cif’, use the ‘ffi_call’ function: -- Function: void ffi_call (ffi_cif *CIF, void *FN, void *RVALUE, void **AVALUES) This calls the function FN according to the description given in - CIF. CIF must have already been prepared using 'ffi_prep_cif'. + CIF. CIF must have already been prepared using ‘ffi_prep_cif’. RVALUE is a pointer to a chunk of memory that will hold the result of the function call. This must be large enough to hold the result, no smaller than the system register size (generally 32 or - 64 bits), and must be suitably aligned; it is the caller's + 64 bits), and must be suitably aligned; it is the caller’s responsibility to ensure this. If CIF declares that the function - returns 'void' (using 'ffi_type_void'), then RVALUE is ignored. + returns ‘void’ (using ‘ffi_type_void’), then RVALUE is ignored. - In most situations, 'libffi' will handle promotion according to the + In most situations, ‘libffi’ will handle promotion according to the ABI. However, for historical reasons, there is a special case with return values that must be handled by your code. In particular, - for integral (not 'struct') types that are narrower than the system - register size, the return value will be widened by 'libffi'. - 'libffi' provides a type, 'ffi_arg', that can be used as the return + for integral (not ‘struct’) types that are narrower than the system + register size, the return value will be widened by ‘libffi’. + ‘libffi’ provides a type, ‘ffi_arg’, that can be used as the return type. For example, if the CIF was defined with a return type of - 'char', 'libffi' will try to store a full 'ffi_arg' into the return + ‘char’, ‘libffi’ will try to store a full ‘ffi_arg’ into the return value. - AVALUES is a vector of 'void *' pointers that point to the memory + AVALUES is a vector of ‘void *’ pointers that point to the memory locations holding the argument values for a call. If CIF declares that the function has no arguments (i.e., NARGS was 0), then AVALUES is ignored. Note that while the return value must be register-sized, arguments should exactly match their declared type. For example, if an - argument is a 'short', then the entry in AVALUES should point to an - object declared as 'short'; but if the return type is 'short', then - RVALUE should point to an object declared as a larger type - - usually 'ffi_arg'. + argument is a ‘short’, then the entry in AVALUES should point to an + object declared as ‘short’; but if the return type is ‘short’, then + RVALUE should point to an object declared as a larger type – + usually ‘ffi_arg’.  File: libffi.info, Node: Simple Example, Next: Types, Prev: The Basics, Up: Using libffi @@ -228,7 +229,7 @@ File: libffi.info, Node: Simple Example, Next: Types, Prev: The Basics, Up: 2.2 Simple Example ================== -Here is a trivial example that calls 'puts' a few times. +Here is a trivial example that calls ‘puts’ a few times. #include #include @@ -285,91 +286,91 @@ File: libffi.info, Node: Primitive Types, Next: Structures, Up: Types 2.3.1 Primitive Types --------------------- -'Libffi' provides a number of built-in type descriptors that can be used +‘Libffi’ provides a number of built-in type descriptors that can be used to describe argument and return types: -'ffi_type_void' - The type 'void'. This cannot be used for argument types, only for +‘ffi_type_void’ + The type ‘void’. This cannot be used for argument types, only for return values. -'ffi_type_uint8' +‘ffi_type_uint8’ An unsigned, 8-bit integer type. -'ffi_type_sint8' +‘ffi_type_sint8’ A signed, 8-bit integer type. -'ffi_type_uint16' +‘ffi_type_uint16’ An unsigned, 16-bit integer type. -'ffi_type_sint16' +‘ffi_type_sint16’ A signed, 16-bit integer type. -'ffi_type_uint32' +‘ffi_type_uint32’ An unsigned, 32-bit integer type. -'ffi_type_sint32' +‘ffi_type_sint32’ A signed, 32-bit integer type. -'ffi_type_uint64' +‘ffi_type_uint64’ An unsigned, 64-bit integer type. -'ffi_type_sint64' +‘ffi_type_sint64’ A signed, 64-bit integer type. -'ffi_type_float' - The C 'float' type. +‘ffi_type_float’ + The C ‘float’ type. -'ffi_type_double' - The C 'double' type. +‘ffi_type_double’ + The C ‘double’ type. -'ffi_type_uchar' - The C 'unsigned char' type. +‘ffi_type_uchar’ + The C ‘unsigned char’ type. -'ffi_type_schar' - The C 'signed char' type. (Note that there is not an exact - equivalent to the C 'char' type in 'libffi'; ordinarily you should - either use 'ffi_type_schar' or 'ffi_type_uchar' depending on - whether 'char' is signed.) +‘ffi_type_schar’ + The C ‘signed char’ type. (Note that there is not an exact + equivalent to the C ‘char’ type in ‘libffi’; ordinarily you should + either use ‘ffi_type_schar’ or ‘ffi_type_uchar’ depending on + whether ‘char’ is signed.) -'ffi_type_ushort' - The C 'unsigned short' type. +‘ffi_type_ushort’ + The C ‘unsigned short’ type. -'ffi_type_sshort' - The C 'short' type. +‘ffi_type_sshort’ + The C ‘short’ type. -'ffi_type_uint' - The C 'unsigned int' type. +‘ffi_type_uint’ + The C ‘unsigned int’ type. -'ffi_type_sint' - The C 'int' type. +‘ffi_type_sint’ + The C ‘int’ type. -'ffi_type_ulong' - The C 'unsigned long' type. +‘ffi_type_ulong’ + The C ‘unsigned long’ type. -'ffi_type_slong' - The C 'long' type. +‘ffi_type_slong’ + The C ‘long’ type. -'ffi_type_longdouble' - On platforms that have a C 'long double' type, this is defined. On +‘ffi_type_longdouble’ + On platforms that have a C ‘long double’ type, this is defined. On other platforms, it is not. -'ffi_type_pointer' - A generic 'void *' pointer. You should use this for all pointers, +‘ffi_type_pointer’ + A generic ‘void *’ pointer. You should use this for all pointers, regardless of their real type. -'ffi_type_complex_float' - The C '_Complex float' type. +‘ffi_type_complex_float’ + The C ‘_Complex float’ type. -'ffi_type_complex_double' - The C '_Complex double' type. +‘ffi_type_complex_double’ + The C ‘_Complex double’ type. -'ffi_type_complex_longdouble' - The C '_Complex long double' type. On platforms that have a C - 'long double' type, this is defined. On other platforms, it is +‘ffi_type_complex_longdouble’ + The C ‘_Complex long double’ type. On platforms that have a C + ‘long double’ type, this is defined. On other platforms, it is not. - Each of these is of type 'ffi_type', so you must take the address -when passing to 'ffi_prep_cif'. + Each of these is of type ‘ffi_type’, so you must take the address +when passing to ‘ffi_prep_cif’.  File: libffi.info, Node: Structures, Next: Size and Alignment, Prev: Primitive Types, Up: Types @@ -377,30 +378,30 @@ File: libffi.info, Node: Structures, Next: Size and Alignment, Prev: Primitiv 2.3.2 Structures ---------------- -'libffi' is perfectly happy passing structures back and forth. You must -first describe the structure to 'libffi' by creating a new 'ffi_type' +‘libffi’ is perfectly happy passing structures back and forth. You must +first describe the structure to ‘libffi’ by creating a new ‘ffi_type’ object for it. -- Data type: ffi_type - The 'ffi_type' has the following members: - 'size_t size' - This is set by 'libffi'; you should initialize it to zero. + The ‘ffi_type’ has the following members: + ‘size_t size’ + This is set by ‘libffi’; you should initialize it to zero. - 'unsigned short alignment' - This is set by 'libffi'; you should initialize it to zero. + ‘unsigned short alignment’ + This is set by ‘libffi’; you should initialize it to zero. - 'unsigned short type' - For a structure, this should be set to 'FFI_TYPE_STRUCT'. + ‘unsigned short type’ + For a structure, this should be set to ‘FFI_TYPE_STRUCT’. - 'ffi_type **elements' - This is a 'NULL'-terminated array of pointers to 'ffi_type' + ‘ffi_type **elements’ + This is a ‘NULL’-terminated array of pointers to ‘ffi_type’ objects. There is one element per field of the struct. - Note that 'libffi' has no special support for bit-fields. You + Note that ‘libffi’ has no special support for bit-fields. You must manage these manually. - The 'size' and 'alignment' fields will be filled in by 'ffi_prep_cif' -or 'ffi_prep_cif_var', as needed. + The ‘size’ and ‘alignment’ fields will be filled in by ‘ffi_prep_cif’ +or ‘ffi_prep_cif_var’, as needed.  File: libffi.info, Node: Size and Alignment, Next: Arrays Unions Enums, Prev: Structures, Up: Types @@ -408,24 +409,24 @@ File: libffi.info, Node: Size and Alignment, Next: Arrays Unions Enums, Prev: 2.3.3 Size and Alignment ------------------------ -'libffi' will set the 'size' and 'alignment' fields of an 'ffi_type' +‘libffi’ will set the ‘size’ and ‘alignment’ fields of an ‘ffi_type’ object for you. It does so using its knowledge of the ABI. You might expect that you can simply read these fields for a type -that has been laid out by 'libffi'. However, there are some caveats. +that has been laid out by ‘libffi’. However, there are some caveats. - * The size or alignment of some of the built-in types may vary + • The size or alignment of some of the built-in types may vary depending on the chosen ABI. - * The size and alignment of a new structure type will not be set by - 'libffi' until it has been passed to 'ffi_prep_cif' or - 'ffi_get_struct_offsets'. + • The size and alignment of a new structure type will not be set by + ‘libffi’ until it has been passed to ‘ffi_prep_cif’ or + ‘ffi_get_struct_offsets’. - * A structure type cannot be shared across ABIs. Instead each ABI + • A structure type cannot be shared across ABIs. Instead each ABI needs its own copy of the structure type. So, before examining these fields, it is safest to pass the -'ffi_type' object to 'ffi_prep_cif' or 'ffi_get_struct_offsets' first. +‘ffi_type’ object to ‘ffi_prep_cif’ or ‘ffi_get_struct_offsets’ first. This function will do all the needed setup. ffi_type *desired_type; @@ -438,7 +439,7 @@ This function will do all the needed setup. unsigned short alignment = desired_type->alignment; } - 'libffi' also provides a way to get the offsets of the members of a + ‘libffi’ also provides a way to get the offsets of the members of a structure. -- Function: ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type @@ -448,15 +449,15 @@ structure. layout depends on the ABI. OFFSETS is an out parameter. The caller is responsible for - providing enough space for all the results to be written - one - element per element type in STRUCT_TYPE. If OFFSETS is 'NULL', + providing enough space for all the results to be written – one + element per element type in STRUCT_TYPE. If OFFSETS is ‘NULL’, then the type will be laid out but not otherwise modified. This - can be useful for accessing the type's size or layout, as mentioned + can be useful for accessing the type’s size or layout, as mentioned above. - This function returns 'FFI_OK' on success; 'FFI_BAD_ABI' if ABI is - invalid; or 'FFI_BAD_TYPEDEF' if STRUCT_TYPE is invalid in some - way. Note that only 'FFI_STRUCT' types are valid here. + This function returns ‘FFI_OK’ on success; ‘FFI_BAD_ABI’ if ABI is + invalid; or ‘FFI_BAD_TYPEDEF’ if STRUCT_TYPE is invalid in some + way. Note that only ‘FFI_STRUCT’ types are valid here.  File: libffi.info, Node: Arrays Unions Enums, Next: Type Example, Prev: Size and Alignment, Up: Types @@ -467,11 +468,11 @@ File: libffi.info, Node: Arrays Unions Enums, Next: Type Example, Prev: Size 2.3.4.1 Arrays .............. -'libffi' does not have direct support for arrays or unions. However, +‘libffi’ does not have direct support for arrays or unions. However, they can be emulated using structures. - To emulate an array, simply create an 'ffi_type' using -'FFI_TYPE_STRUCT' with as many members as there are elements in the + To emulate an array, simply create an ‘ffi_type’ using +‘FFI_TYPE_STRUCT’ with as many members as there are elements in the array. ffi_type array_type; @@ -487,18 +488,18 @@ array. array_type.type = FFI_TYPE_STRUCT; array_type.elements = elements; - Note that arrays cannot be passed or returned by value in C - + Note that arrays cannot be passed or returned by value in C – structure types created like this should only be used to refer to -members of real 'FFI_TYPE_STRUCT' objects. +members of real ‘FFI_TYPE_STRUCT’ objects. However, a phony array type like this will not cause any errors from -'libffi' if you use it as an argument or return type. This may be +‘libffi’ if you use it as an argument or return type. This may be confusing. 2.3.4.2 Unions .............. -A union can also be emulated using 'FFI_TYPE_STRUCT'. In this case, +A union can also be emulated using ‘FFI_TYPE_STRUCT’. In this case, however, you must make sure that the size and alignment match the real requirements of the union. @@ -506,7 +507,7 @@ requirements of the union. out. Then, give the new structure type a single element; the size of the largest element; and the largest alignment seen as well. - This example uses the 'ffi_prep_cif' trick to ensure that each + This example uses the ‘ffi_prep_cif’ trick to ensure that each element type is laid out. ffi_abi desired_abi; @@ -540,11 +541,11 @@ element type is laid out. 2.3.4.3 Enumerations .................... -'libffi' does not have any special support for C 'enum's. Although any -given 'enum' is implemented using a specific underlying integral type, -exactly which type will be used cannot be determined by 'libffi' - it +‘libffi’ does not have any special support for C ‘enum’s. Although any +given ‘enum’ is implemented using a specific underlying integral type, +exactly which type will be used cannot be determined by ‘libffi’ – it may depend on the values in the enumeration or on compiler flags such as -'-fshort-enums'. *Note (gcc)Structures unions enumerations and +‘-fshort-enums’. *Note (gcc)Structures unions enumerations and bit-fields implementation::, for more information about how GCC handles enumerations. @@ -554,8 +555,8 @@ File: libffi.info, Node: Type Example, Next: Complex, Prev: Arrays Unions Enu 2.3.5 Type Example ------------------ -The following example initializes a 'ffi_type' object representing the -'tm' struct from Linux's 'time.h'. +The following example initializes a ‘ffi_type’ object representing the +‘tm’ struct from Linux’s ‘time.h’. Here is how the struct is defined: @@ -574,7 +575,7 @@ The following example initializes a 'ffi_type' object representing the __const char *__tm_zone__; }; - Here is the corresponding code to describe this struct to 'libffi': + Here is the corresponding code to describe this struct to ‘libffi’: { ffi_type tm_type; @@ -602,38 +603,38 @@ File: libffi.info, Node: Complex, Next: Complex Type Example, Prev: Type Exam 2.3.6 Complex Types ------------------- -'libffi' supports the complex types defined by the C99 standard -('_Complex float', '_Complex double' and '_Complex long double' with the -built-in type descriptors 'ffi_type_complex_float', -'ffi_type_complex_double' and 'ffi_type_complex_longdouble'. +‘libffi’ supports the complex types defined by the C99 standard +(‘_Complex float’, ‘_Complex double’ and ‘_Complex long double’ with the +built-in type descriptors ‘ffi_type_complex_float’, +‘ffi_type_complex_double’ and ‘ffi_type_complex_longdouble’. - Custom complex types like '_Complex int' can also be used. An -'ffi_type' object has to be defined to describe the complex type to -'libffi'. + Custom complex types like ‘_Complex int’ can also be used. An +‘ffi_type’ object has to be defined to describe the complex type to +‘libffi’. -- Data type: ffi_type - 'size_t size' + ‘size_t size’ This must be manually set to the size of the complex type. - 'unsigned short alignment' + ‘unsigned short alignment’ This must be manually set to the alignment of the complex type. - 'unsigned short type' - For a complex type, this must be set to 'FFI_TYPE_COMPLEX'. + ‘unsigned short type’ + For a complex type, this must be set to ‘FFI_TYPE_COMPLEX’. - 'ffi_type **elements' + ‘ffi_type **elements’ - This is a 'NULL'-terminated array of pointers to 'ffi_type' - objects. The first element is set to the 'ffi_type' of the - complex's base type. The second element must be set to - 'NULL'. + This is a ‘NULL’-terminated array of pointers to ‘ffi_type’ + objects. The first element is set to the ‘ffi_type’ of the + complex’s base type. The second element must be set to + ‘NULL’. The section *note Complex Type Example:: shows a way to determine the -'size' and 'alignment' members in a platform independent way. +‘size’ and ‘alignment’ members in a platform independent way. - For platforms that have no complex support in 'libffi' yet, the -functions 'ffi_prep_cif' and 'ffi_prep_args' abort the program if they + For platforms that have no complex support in ‘libffi’ yet, the +functions ‘ffi_prep_cif’ and ‘ffi_prep_args’ abort the program if they encounter a complex type.  @@ -730,9 +731,9 @@ File: libffi.info, Node: Multiple ABIs, Next: The Closure API, Prev: Types, ================= A given platform may provide multiple different ABIs at once. For -instance, the x86 platform has both 'stdcall' and 'fastcall' functions. +instance, the x86 platform has both ‘stdcall’ and ‘fastcall’ functions. - 'libffi' provides some support for this. However, this is + ‘libffi’ provides some support for this. However, this is necessarily platform-specific.  @@ -741,13 +742,13 @@ File: libffi.info, Node: The Closure API, Next: Closure Example, Prev: Multip 2.5 The Closure API =================== -'libffi' also provides a way to write a generic function - a function +‘libffi’ also provides a way to write a generic function – a function that can accept and decode any combination of arguments. This can be useful when writing an interpreter, or to provide wrappers for arbitrary functions. - This facility is called the "closure API". Closures are not supported -on all platforms; you can check the 'FFI_CLOSURES' define to determine + This facility is called the “closure API”. Closures are not supported +on all platforms; you can check the ‘FFI_CLOSURES’ define to determine whether they are supported on the current platform. Because closures work by assembling a tiny function at runtime, they @@ -759,28 +760,28 @@ Memory management for closures is handled by a pair of functions: pointer to the writable address, and sets *CODE to the corresponding executable address. - SIZE should be sufficient to hold a 'ffi_closure' object. + SIZE should be sufficient to hold a ‘ffi_closure’ object. -- Function: void ffi_closure_free (void *WRITABLE) - Free memory allocated using 'ffi_closure_alloc'. The argument is + Free memory allocated using ‘ffi_closure_alloc’. The argument is the writable address that was returned. Once you have allocated the memory for a closure, you must construct -a 'ffi_cif' describing the function call. Finally you can prepare the +a ‘ffi_cif’ describing the function call. Finally you can prepare the closure function: -- Function: ffi_status ffi_prep_closure_loc (ffi_closure *CLOSURE, ffi_cif *CIF, void (*FUN) (ffi_cif *CIF, void *RET, void **ARGS, void *USER_DATA), void *USER_DATA, void *CODELOC) Prepare a closure function. The arguments to - 'ffi_prep_closure_loc' are: + ‘ffi_prep_closure_loc’ are: CLOSURE - The address of a 'ffi_closure' object; this is the writable - address returned by 'ffi_closure_alloc'. + The address of a ‘ffi_closure’ object; this is the writable + address returned by ‘ffi_closure_alloc’. CIF - The 'ffi_cif' describing the function parameters. Note that + The ‘ffi_cif’ describing the function parameters. Note that this object, and the types to which it refers, must be kept alive until the closure itself is freed. @@ -789,29 +790,29 @@ closure function: closure function. CODELOC - The executable address returned by 'ffi_closure_alloc'. + The executable address returned by ‘ffi_closure_alloc’. FUN The function which will be called when the closure is invoked. It is called with the arguments: CIF - The 'ffi_cif' passed to 'ffi_prep_closure_loc'. + The ‘ffi_cif’ passed to ‘ffi_prep_closure_loc’. RET - A pointer to the memory used for the function's return + A pointer to the memory used for the function’s return value. - If the function is declared as returning 'void', then + If the function is declared as returning ‘void’, then this value is garbage and should not be used. Otherwise, FUN must fill the object to which this points, following the same special promotion behavior as - 'ffi_call'. That is, in most cases, RET points to an + ‘ffi_call’. That is, in most cases, RET points to an object of exactly the size of the type specified when CIF was constructed. However, integral types narrower than the system register size are widened. In these cases - your program may assume that RET points to an 'ffi_arg' + your program may assume that RET points to an ‘ffi_arg’ object. ARGS @@ -820,15 +821,15 @@ closure function: USER_DATA The same USER_DATA that was passed to - 'ffi_prep_closure_loc'. + ‘ffi_prep_closure_loc’. - 'ffi_prep_closure_loc' will return 'FFI_OK' if everything went ok, - and one of the other 'ffi_status' values on error. + ‘ffi_prep_closure_loc’ will return ‘FFI_OK’ if everything went ok, + and one of the other ‘ffi_status’ values on error. - After calling 'ffi_prep_closure_loc', you can cast CODELOC to the + After calling ‘ffi_prep_closure_loc’, you can cast CODELOC to the appropriate pointer-to-function type. - You may see old code referring to 'ffi_prep_closure'. This function + You may see old code referring to ‘ffi_prep_closure’. This function is deprecated, as it cannot handle the need for separate writable and executable addresses. @@ -838,8 +839,8 @@ File: libffi.info, Node: Closure Example, Next: Thread Safety, Prev: The Clos 2.6 Closure Example =================== -A trivial example that creates a new 'puts' by binding 'fputs' with -'stdout'. +A trivial example that creates a new ‘puts’ by binding ‘fputs’ with +‘stdout’. #include #include @@ -897,21 +898,21 @@ File: libffi.info, Node: Thread Safety, Prev: Closure Example, Up: Using libf 2.7 Thread Safety ================= -'libffi' is not completely thread-safe. However, many parts are, and if +‘libffi’ is not completely thread-safe. However, many parts are, and if you follow some simple rules, you can use it safely in a multi-threaded program. - * 'ffi_prep_cif' may modify the 'ffi_type' objects passed to it. It + • ‘ffi_prep_cif’ may modify the ‘ffi_type’ objects passed to it. It is best to ensure that only a single thread prepares a given - 'ffi_cif' at a time. + ‘ffi_cif’ at a time. - * On some platforms, 'ffi_prep_cif' may modify the size and alignment + • On some platforms, ‘ffi_prep_cif’ may modify the size and alignment of some types, depending on the chosen ABI. On these platforms, if you switch between ABIs, you must ensure that there is only one - call to 'ffi_prep_cif' at a time. + call to ‘ffi_prep_cif’ at a time. Currently the only affected platform is PowerPC and the only - affected type is 'long double'. + affected type is ‘long double’.  File: libffi.info, Node: Memory Usage, Next: Missing Features, Prev: Using libffi, Up: Top @@ -919,36 +920,36 @@ File: libffi.info, Node: Memory Usage, Next: Missing Features, Prev: Using li 3 Memory Usage ************** -Note that memory allocated by 'ffi_closure_alloc' and freed by -'ffi_closure_free' does not come from the same general pool of memory -that 'malloc' and 'free' use. To accomodate security settings, 'libffi' +Note that memory allocated by ‘ffi_closure_alloc’ and freed by +‘ffi_closure_free’ does not come from the same general pool of memory +that ‘malloc’ and ‘free’ use. To accomodate security settings, ‘libffi’ may aquire memory, for example, by mapping temporary files into multiple places in the address space (once to write out the closure, a second to execute it). The search follows this list, using the first that works: - * A anonymous mapping (i.e. not file-backed) + • A anonymous mapping (i.e. not file-backed) - * 'memfd_create()', if the kernel supports it. + • ‘memfd_create()’, if the kernel supports it. - * A file created in the directory referenced by the environment - variable 'LIBFFI_TMPDIR'. + • A file created in the directory referenced by the environment + variable ‘LIBFFI_TMPDIR’. - * Likewise for the environment variable 'TMPDIR'. + • Likewise for the environment variable ‘TMPDIR’. - * A file created in '/tmp'. + • A file created in ‘/tmp’. - * A file created in '/var/tmp'. + • A file created in ‘/var/tmp’. - * A file created in '/dev/shm'. + • A file created in ‘/dev/shm’. - * A file created in the user's home directory ('$HOME'). + • A file created in the user’s home directory (‘$HOME’). - * A file created in any directory listed in '/etc/mtab'. + • A file created in any directory listed in ‘/etc/mtab’. - * A file created in any directory listed in '/proc/mounts'. + • A file created in any directory listed in ‘/proc/mounts’. If security settings prohibit using any of these for closures, -'ffi_closure_alloc' will fail. +‘ffi_closure_alloc’ will fail.  File: libffi.info, Node: Missing Features, Next: Index, Prev: Memory Usage, Up: Top @@ -956,16 +957,16 @@ File: libffi.info, Node: Missing Features, Next: Index, Prev: Memory Usage, 4 Missing Features ****************** -'libffi' is missing a few features. We welcome patches to add support +‘libffi’ is missing a few features. We welcome patches to add support for these. - * Variadic closures. + • Variadic closures. - * There is no support for bit fields in structures. + • There is no support for bit fields in structures. - * The "raw" API is undocumented. + • The “raw” API is undocumented. - * The Go API is undocumented. + • The Go API is undocumented.  File: libffi.info, Node: Index, Prev: Missing Features, Up: Top @@ -1031,26 +1032,26 @@ Index  Tag Table: -Node: Top1400 -Node: Introduction2935 -Node: Using libffi4567 -Node: The Basics5096 -Node: Simple Example10024 -Node: Types11055 -Node: Primitive Types11566 -Node: Structures13687 -Node: Size and Alignment14726 -Node: Arrays Unions Enums16923 -Node: Type Example19852 -Node: Complex21143 -Node: Complex Type Example22561 -Node: Multiple ABIs25613 -Node: The Closure API25984 -Node: Closure Example29810 -Node: Thread Safety31442 -Node: Memory Usage32243 -Node: Missing Features33438 -Node: Index33803 +Node: Top1399 +Node: Introduction2933 +Node: Using libffi4593 +Node: The Basics5122 +Node: Simple Example10240 +Node: Types11275 +Node: Primitive Types11786 +Node: Structures14103 +Node: Size and Alignment15214 +Node: Arrays Unions Enums17489 +Node: Type Example20470 +Node: Complex21779 +Node: Complex Type Example23295 +Node: Multiple ABIs26347 +Node: The Closure API26730 +Node: Closure Example30648 +Node: Thread Safety32292 +Node: Memory Usage33125 +Node: Missing Features34402 +Node: Index34783  End Tag Table diff --git a/src/libffi/libffi-3.4.4/doc/libffi.pdf b/src/libffi/libffi-3.4.6/doc/libffi.pdf similarity index 98% rename from src/libffi/libffi-3.4.4/doc/libffi.pdf rename to src/libffi/libffi-3.4.6/doc/libffi.pdf index 0831f17a7..bab169868 100644 Binary files a/src/libffi/libffi-3.4.4/doc/libffi.pdf and b/src/libffi/libffi-3.4.6/doc/libffi.pdf differ diff --git a/src/libffi/libffi-3.4.4/doc/libffi.texi b/src/libffi/libffi-3.4.6/doc/libffi.texi similarity index 99% rename from src/libffi/libffi-3.4.4/doc/libffi.texi rename to src/libffi/libffi-3.4.6/doc/libffi.texi index 88daab58d..d072a213f 100644 --- a/src/libffi/libffi-3.4.4/doc/libffi.texi +++ b/src/libffi/libffi-3.4.6/doc/libffi.texi @@ -18,7 +18,7 @@ This manual is for libffi, a portable foreign function interface library. -Copyright @copyright{} 2008--2019, 2021, 2022 Anthony Green and Red Hat, Inc. +Copyright @copyright{} 2008--2024 Anthony Green and Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/src/libffi/libffi-3.4.4/doc/mdate-sh b/src/libffi/libffi-3.4.6/doc/mdate-sh similarity index 100% rename from src/libffi/libffi-3.4.4/doc/mdate-sh rename to src/libffi/libffi-3.4.6/doc/mdate-sh diff --git a/src/libffi/libffi-3.4.6/doc/stamp-vti b/src/libffi/libffi-3.4.6/doc/stamp-vti new file mode 100644 index 000000000..88b26f949 --- /dev/null +++ b/src/libffi/libffi-3.4.6/doc/stamp-vti @@ -0,0 +1,4 @@ +@set UPDATED 15 February 2024 +@set UPDATED-MONTH February 2024 +@set EDITION 3.4.6 +@set VERSION 3.4.6 diff --git a/src/libffi/libffi-3.4.4/doc/texinfo.tex b/src/libffi/libffi-3.4.6/doc/texinfo.tex similarity index 100% rename from src/libffi/libffi-3.4.4/doc/texinfo.tex rename to src/libffi/libffi-3.4.6/doc/texinfo.tex diff --git a/src/libffi/libffi-3.4.6/doc/version.texi b/src/libffi/libffi-3.4.6/doc/version.texi new file mode 100644 index 000000000..88b26f949 --- /dev/null +++ b/src/libffi/libffi-3.4.6/doc/version.texi @@ -0,0 +1,4 @@ +@set UPDATED 15 February 2024 +@set UPDATED-MONTH February 2024 +@set EDITION 3.4.6 +@set VERSION 3.4.6 diff --git a/src/libffi/libffi-3.4.4/fficonfig.h.in b/src/libffi/libffi-3.4.6/fficonfig.h.in similarity index 81% rename from src/libffi/libffi-3.4.4/fficonfig.h.in rename to src/libffi/libffi-3.4.6/fficonfig.h.in index d38b781ea..2e4aac662 100644 --- a/src/libffi/libffi-3.4.4/fficonfig.h.in +++ b/src/libffi/libffi-3.4.6/fficonfig.h.in @@ -3,9 +3,6 @@ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD -/* Define to 1 if using 'alloca.c'. */ -#undef C_ALLOCA - /* Define to the flags needed for the .section .eh_frame directive. */ #undef EH_FRAME_FLAGS @@ -31,10 +28,7 @@ /* Define this if you do not want support for aggregate types. */ #undef FFI_NO_STRUCTS -/* Define to 1 if you have 'alloca', as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define to 1 if works. */ +/* Define to 1 if you have the header file. */ #undef HAVE_ALLOCA_H /* Define if your assembler supports .cfi_* directives. */ @@ -77,24 +71,6 @@ /* Define to 1 if you have the `memfd_create' function. */ #undef HAVE_MEMFD_CREATE -/* Define to 1 if you have the `mkostemp' function. */ -#undef HAVE_MKOSTEMP - -/* Define to 1 if you have the `mkstemp' function. */ -#undef HAVE_MKSTEMP - -/* Define to 1 if you have the `mmap' function. */ -#undef HAVE_MMAP - -/* Define if mmap with MAP_ANON(YMOUS) works. */ -#undef HAVE_MMAP_ANON - -/* Define if mmap of /dev/zero works. */ -#undef HAVE_MMAP_DEV_ZERO - -/* Define if read-only mmap of a plain file works. */ -#undef HAVE_MMAP_FILE - /* Define if your compiler supports pointer authentication. */ #undef HAVE_PTRAUTH @@ -119,9 +95,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MEMFD_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MMAN_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H @@ -167,14 +140,6 @@ /* The size of `size_t', as computed by sizeof. */ #undef SIZEOF_SIZE_T -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at runtime. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -#undef STACK_DIRECTION - /* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for backward compatibility; new code need not use it. */ @@ -202,9 +167,6 @@ # endif #endif -/* Define to `unsigned int' if does not define. */ -#undef size_t - #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE #ifdef LIBFFI_ASM diff --git a/src/libffi/libffi-3.4.4/generate-darwin-source-and-headers.py b/src/libffi/libffi-3.4.6/generate-darwin-source-and-headers.py similarity index 94% rename from src/libffi/libffi-3.4.4/generate-darwin-source-and-headers.py rename to src/libffi/libffi-3.4.6/generate-darwin-source-and-headers.py index 5b60ccc67..c801dc065 100755 --- a/src/libffi/libffi-3.4.4/generate-darwin-source-and-headers.py +++ b/src/libffi/libffi-3.4.6/generate-darwin-source-and-headers.py @@ -48,7 +48,6 @@ class armv7_platform(Platform): class ios_simulator_i386_platform(i386_platform): - triple = 'i386-apple-darwin11' target = 'i386-apple-ios-simulator' directory = 'darwin_ios' sdk = 'iphonesimulator' @@ -56,7 +55,6 @@ class ios_simulator_i386_platform(i386_platform): class ios_simulator_x86_64_platform(x86_64_platform): - triple = 'x86_64-apple-darwin13' target = 'x86_64-apple-ios-simulator' directory = 'darwin_ios' sdk = 'iphonesimulator' @@ -64,7 +62,6 @@ class ios_simulator_x86_64_platform(x86_64_platform): class ios_simulator_arm64_platform(arm64_platform): - triple = 'aarch64-apple-darwin20' target = 'arm64-apple-ios-simulator' directory = 'darwin_ios' sdk = 'iphonesimulator' @@ -72,7 +69,6 @@ class ios_simulator_arm64_platform(arm64_platform): class ios_device_armv7_platform(armv7_platform): - triple = 'arm-apple-darwin11' target = 'armv7-apple-ios' directory = 'darwin_ios' sdk = 'iphoneos' @@ -80,7 +76,6 @@ class ios_device_armv7_platform(armv7_platform): class ios_device_arm64_platform(arm64_platform): - triple = 'aarch64-apple-darwin13' target = 'arm64-apple-ios' directory = 'darwin_ios' sdk = 'iphoneos' @@ -88,7 +83,6 @@ class ios_device_arm64_platform(arm64_platform): class desktop_x86_64_platform(x86_64_platform): - triple = 'x86_64-apple-darwin10' target = 'x86_64-apple-macos' directory = 'darwin_osx' sdk = 'macosx' @@ -96,7 +90,6 @@ class desktop_x86_64_platform(x86_64_platform): class desktop_arm64_platform(arm64_platform): - triple = 'aarch64-apple-darwin20' target = 'arm64-apple-macos' directory = 'darwin_osx' sdk = 'macosx' @@ -104,7 +97,6 @@ class desktop_arm64_platform(arm64_platform): class tvos_simulator_x86_64_platform(x86_64_platform): - triple = 'x86_64-apple-darwin13' target = 'x86_64-apple-tvos-simulator' directory = 'darwin_tvos' sdk = 'appletvsimulator' @@ -112,7 +104,6 @@ class tvos_simulator_x86_64_platform(x86_64_platform): class tvos_simulator_arm64_platform(arm64_platform): - triple = 'aarch64-apple-darwin20' target = 'arm64-apple-tvos-simulator' directory = 'darwin_tvos' sdk = 'appletvsimulator' @@ -120,7 +111,6 @@ class tvos_simulator_arm64_platform(arm64_platform): class tvos_device_arm64_platform(arm64_platform): - triple = 'aarch64-apple-darwin13' target = 'arm64-apple-tvos' directory = 'darwin_tvos' sdk = 'appletvos' @@ -128,7 +118,6 @@ class tvos_device_arm64_platform(arm64_platform): class watchos_simulator_i386_platform(i386_platform): - triple = 'i386-apple-darwin11' target = 'i386-apple-watchos-simulator' directory = 'darwin_watchos' sdk = 'watchsimulator' @@ -136,7 +125,6 @@ class watchos_simulator_i386_platform(i386_platform): class watchos_simulator_x86_64_platform(x86_64_platform): - triple = 'x86_64-apple-darwin13' target = 'x86_64-apple-watchos-simulator' directory = 'darwin_watchos' sdk = 'watchsimulator' @@ -144,7 +132,6 @@ class watchos_simulator_x86_64_platform(x86_64_platform): class watchos_simulator_arm64_platform(arm64_platform): - triple = 'aarch64-apple-darwin20' target = 'arm64-apple-watchos-simulator' directory = 'darwin_watchos' sdk = 'watchsimulator' @@ -152,7 +139,6 @@ class watchos_simulator_arm64_platform(arm64_platform): class watchos_device_armv7k_platform(armv7_platform): - triple = 'arm-apple-darwin11' target = 'armv7k-apple-watchos' directory = 'darwin_watchos' sdk = 'watchos' @@ -161,7 +147,6 @@ class watchos_device_armv7k_platform(armv7_platform): class watchos_device_arm64_32_platform(arm64_platform): - triple = 'aarch64-apple-darwin13' target = 'arm64_32-apple-watchos' directory = 'darwin_watchos' sdk = 'watchos' @@ -229,7 +214,15 @@ def xcrun_cmd(cmd): working_dir = os.getcwd() try: os.chdir(build_dir) - subprocess.check_call(['../configure', '-host', platform.triple], env=env) + subprocess.check_call( + [ + "../configure", + f"--host={platform.target}", + ] + ( + [] if platform.sdk == "macosx" else [f"--build={os.uname().machine}-apple-darwin"] + ), + env=env + ) finally: os.chdir(working_dir) diff --git a/src/libffi/libffi-3.4.4/include/Makefile.am b/src/libffi/libffi-3.4.6/include/Makefile.am similarity index 100% rename from src/libffi/libffi-3.4.4/include/Makefile.am rename to src/libffi/libffi-3.4.6/include/Makefile.am diff --git a/src/libffi/libffi-3.4.4/include/Makefile.in b/src/libffi/libffi-3.4.6/include/Makefile.in similarity index 99% rename from src/libffi/libffi-3.4.4/include/Makefile.in rename to src/libffi/libffi-3.4.6/include/Makefile.in index 7e3bbf0c4..ae3ad016c 100644 --- a/src/libffi/libffi-3.4.4/include/Makefile.in +++ b/src/libffi/libffi-3.4.6/include/Makefile.in @@ -182,7 +182,6 @@ am__define_uniq_tagged_files = \ am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/ffi.h.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LTLDFLAGS = @AM_LTLDFLAGS@ diff --git a/src/libffi/libffi-3.4.4/include/ffi.h.in b/src/libffi/libffi-3.4.6/include/ffi.h.in similarity index 95% rename from src/libffi/libffi-3.4.4/include/ffi.h.in rename to src/libffi/libffi-3.4.6/include/ffi.h.in index 227ac79ca..e5c1daef3 100644 --- a/src/libffi/libffi-3.4.4/include/ffi.h.in +++ b/src/libffi/libffi-3.4.6/include/ffi.h.in @@ -1,6 +1,6 @@ /* -----------------------------------------------------------------*-C-*- libffi @VERSION@ - - Copyright (c) 2011, 2014, 2019, 2021, 2022 Anthony Green + - Copyright (c) 2011, 2014, 2019, 2021, 2022, 2024 Anthony Green - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. Permission is hereby granted, free of charge, to any person @@ -140,13 +140,11 @@ typedef struct _ffi_type when using the static version of the library. Besides, as a workaround, they can define FFI_BUILDING if they *know* they are going to link with the static library. */ -#if defined _MSC_VER +#if defined _MSC_VER && !defined(FFI_STATIC_BUILD) # if defined FFI_BUILDING_DLL /* Building libffi.DLL with msvcc.sh */ # define FFI_API __declspec(dllexport) -# elif !defined FFI_BUILDING /* Importing libffi.DLL */ +# else /* Importing libffi.DLL */ # define FFI_API __declspec(dllimport) -# else /* Building/linking static library */ -# define FFI_API # endif #else # define FFI_API @@ -222,21 +220,12 @@ FFI_EXTERN ffi_type ffi_type_sint64; FFI_EXTERN ffi_type ffi_type_float; FFI_EXTERN ffi_type ffi_type_double; FFI_EXTERN ffi_type ffi_type_pointer; - -#if @HAVE_LONG_DOUBLE@ FFI_EXTERN ffi_type ffi_type_longdouble; -#else -#define ffi_type_longdouble ffi_type_double -#endif #ifdef FFI_TARGET_HAS_COMPLEX_TYPE FFI_EXTERN ffi_type ffi_type_complex_float; FFI_EXTERN ffi_type ffi_type_complex_double; -#if @HAVE_LONG_DOUBLE@ FFI_EXTERN ffi_type ffi_type_complex_longdouble; -#else -#define ffi_type_complex_longdouble ffi_type_complex_double -#endif #endif #endif /* LIBFFI_HIDE_BASIC_TYPES */ @@ -363,14 +352,6 @@ typedef struct { FFI_API void *ffi_closure_alloc (size_t size, void **code); FFI_API void ffi_closure_free (void *); -#if defined(PA_LINUX) || defined(PA_HPUX) -#define FFI_CLOSURE_PTR(X) ((void *)((unsigned int)(X) | 2)) -#define FFI_RESTORE_PTR(X) ((void *)((unsigned int)(X) & ~3)) -#else -#define FFI_CLOSURE_PTR(X) (X) -#define FFI_RESTORE_PTR(X) (X) -#endif - FFI_API ffi_status ffi_prep_closure (ffi_closure*, ffi_cif *, @@ -474,7 +455,7 @@ ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, #endif /* FFI_CLOSURES */ -#if FFI_GO_CLOSURES +#ifdef FFI_GO_CLOSURES typedef struct { void *tramp; @@ -517,8 +498,14 @@ FFI_API ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type, size_t *offsets); -/* Useful for eliminating compiler warnings. */ +/* Convert between closure and function pointers. */ +#if defined(PA_LINUX) || defined(PA_HPUX) +#define FFI_FN(f) ((void (*)(void))((unsigned int)(f) | 2)) +#define FFI_CL(f) ((void *)((unsigned int)(f) & ~3)) +#else #define FFI_FN(f) ((void (*)(void))f) +#define FFI_CL(f) ((void *)(f)) +#endif /* ---- Definitions shared with assembly code ---------------------------- */ diff --git a/src/libffi/libffi-3.4.4/include/ffi_cfi.h b/src/libffi/libffi-3.4.6/include/ffi_cfi.h similarity index 100% rename from src/libffi/libffi-3.4.4/include/ffi_cfi.h rename to src/libffi/libffi-3.4.6/include/ffi_cfi.h diff --git a/src/libffi/libffi-3.4.4/include/ffi_common.h b/src/libffi/libffi-3.4.6/include/ffi_common.h similarity index 93% rename from src/libffi/libffi-3.4.4/include/ffi_common.h rename to src/libffi/libffi-3.4.6/include/ffi_common.h index 2bd31b03d..a9839b344 100644 --- a/src/libffi/libffi-3.4.4/include/ffi_common.h +++ b/src/libffi/libffi-3.4.6/include/ffi_common.h @@ -49,8 +49,10 @@ extern "C" { # endif # endif # define MAYBE_UNUSED __attribute__((__unused__)) +# define NORETURN __attribute__((__noreturn__)) #else # define MAYBE_UNUSED +# define NORETURN # if HAVE_ALLOCA_H # include # else @@ -82,9 +84,9 @@ char *alloca (); #endif #ifdef FFI_DEBUG -void ffi_assert(char *expr, char *file, int line); +NORETURN void ffi_assert(const char *expr, const char *file, int line); void ffi_stop_here(void); -void ffi_type_test(ffi_type *a, char *file, int line); +void ffi_type_test(ffi_type *a, const char *file, int line); #define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__)) #define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l))) @@ -128,6 +130,10 @@ void *ffi_data_to_code_pointer (void *data) FFI_HIDDEN; static trampoline. */ int ffi_tramp_is_present (void *closure) FFI_HIDDEN; +/* Return a file descriptor of a temporary zero-sized file in a + writable and executable filesystem. */ +int open_temp_exec_file(void) FFI_HIDDEN; + /* Extended cif, used in callback from assembly routine */ typedef struct { diff --git a/src/libffi/libffi-3.4.4/include/tramp.h b/src/libffi/libffi-3.4.6/include/tramp.h similarity index 100% rename from src/libffi/libffi-3.4.4/include/tramp.h rename to src/libffi/libffi-3.4.6/include/tramp.h diff --git a/src/libffi/libffi-3.4.4/install-sh b/src/libffi/libffi-3.4.6/install-sh similarity index 100% rename from src/libffi/libffi-3.4.4/install-sh rename to src/libffi/libffi-3.4.6/install-sh diff --git a/src/libffi/libffi-3.4.4/libffi.map.in b/src/libffi/libffi-3.4.6/libffi.map.in similarity index 95% rename from src/libffi/libffi-3.4.4/libffi.map.in rename to src/libffi/libffi-3.4.6/libffi.map.in index de8778ae4..08c50b22d 100644 --- a/src/libffi/libffi-3.4.4/libffi.map.in +++ b/src/libffi/libffi-3.4.6/libffi.map.in @@ -33,7 +33,10 @@ LIBFFI_BASE_8.0 { ffi_raw_to_ptrarray; ffi_raw_size; +#if !FFI_NATIVE_RAW_API ffi_java_raw_call; +#endif + ffi_java_ptrarray_to_raw; ffi_java_raw_to_ptrarray; ffi_java_raw_size; @@ -62,8 +65,10 @@ LIBFFI_CLOSURE_8.0 { ffi_prep_closure_loc; ffi_prep_raw_closure; ffi_prep_raw_closure_loc; +#if !FFI_NATIVE_RAW_API ffi_prep_java_raw_closure; ffi_prep_java_raw_closure_loc; +#endif } LIBFFI_BASE_8.0; #endif diff --git a/src/libffi/libffi-3.4.4/libffi.pc.in b/src/libffi/libffi-3.4.6/libffi.pc.in similarity index 100% rename from src/libffi/libffi-3.4.4/libffi.pc.in rename to src/libffi/libffi-3.4.6/libffi.pc.in diff --git a/src/libffi/libffi-3.4.4/libffi.xcodeproj/project.pbxproj b/src/libffi/libffi-3.4.6/libffi.xcodeproj/project.pbxproj similarity index 100% rename from src/libffi/libffi-3.4.4/libffi.xcodeproj/project.pbxproj rename to src/libffi/libffi-3.4.6/libffi.xcodeproj/project.pbxproj diff --git a/src/libffi/libffi-3.4.4/libtool-ldflags b/src/libffi/libffi-3.4.6/libtool-ldflags similarity index 100% rename from src/libffi/libffi-3.4.4/libtool-ldflags rename to src/libffi/libffi-3.4.6/libtool-ldflags diff --git a/src/libffi/libffi-3.4.4/libtool-version b/src/libffi/libffi-3.4.6/libtool-version similarity index 99% rename from src/libffi/libffi-3.4.4/libtool-version rename to src/libffi/libffi-3.4.6/libtool-version index 03f54024b..3b32cb76a 100644 --- a/src/libffi/libffi-3.4.4/libtool-version +++ b/src/libffi/libffi-3.4.6/libtool-version @@ -26,4 +26,4 @@ # release, then set age to 0. # # CURRENT:REVISION:AGE -9:2:1 +9:4:1 diff --git a/src/libffi/libffi-3.4.4/ltmain.sh b/src/libffi/libffi-3.4.6/ltmain.sh similarity index 100% rename from src/libffi/libffi-3.4.4/ltmain.sh rename to src/libffi/libffi-3.4.6/ltmain.sh diff --git a/src/libffi/libffi-3.4.4/m4/asmcfi.m4 b/src/libffi/libffi-3.4.6/m4/asmcfi.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/m4/asmcfi.m4 rename to src/libffi/libffi-3.4.6/m4/asmcfi.m4 diff --git a/src/libffi/libffi-3.4.4/m4/ax_cc_maxopt.m4 b/src/libffi/libffi-3.4.6/m4/ax_cc_maxopt.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/m4/ax_cc_maxopt.m4 rename to src/libffi/libffi-3.4.6/m4/ax_cc_maxopt.m4 diff --git a/src/libffi/libffi-3.4.4/m4/ax_cflags_warn_all.m4 b/src/libffi/libffi-3.4.6/m4/ax_cflags_warn_all.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/m4/ax_cflags_warn_all.m4 rename to src/libffi/libffi-3.4.6/m4/ax_cflags_warn_all.m4 diff --git a/src/libffi/libffi-3.4.4/m4/ax_check_compile_flag.m4 b/src/libffi/libffi-3.4.6/m4/ax_check_compile_flag.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/m4/ax_check_compile_flag.m4 rename to src/libffi/libffi-3.4.6/m4/ax_check_compile_flag.m4 diff --git a/src/libffi/libffi-3.4.4/m4/ax_compiler_vendor.m4 b/src/libffi/libffi-3.4.6/m4/ax_compiler_vendor.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/m4/ax_compiler_vendor.m4 rename to src/libffi/libffi-3.4.6/m4/ax_compiler_vendor.m4 diff --git a/src/libffi/libffi-3.4.4/m4/ax_configure_args.m4 b/src/libffi/libffi-3.4.6/m4/ax_configure_args.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/m4/ax_configure_args.m4 rename to src/libffi/libffi-3.4.6/m4/ax_configure_args.m4 diff --git a/src/libffi/libffi-3.4.4/m4/ax_enable_builddir.m4 b/src/libffi/libffi-3.4.6/m4/ax_enable_builddir.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/m4/ax_enable_builddir.m4 rename to src/libffi/libffi-3.4.6/m4/ax_enable_builddir.m4 diff --git a/src/libffi/libffi-3.4.4/m4/ax_gcc_archflag.m4 b/src/libffi/libffi-3.4.6/m4/ax_gcc_archflag.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/m4/ax_gcc_archflag.m4 rename to src/libffi/libffi-3.4.6/m4/ax_gcc_archflag.m4 diff --git a/src/libffi/libffi-3.4.4/m4/ax_gcc_x86_cpuid.m4 b/src/libffi/libffi-3.4.6/m4/ax_gcc_x86_cpuid.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/m4/ax_gcc_x86_cpuid.m4 rename to src/libffi/libffi-3.4.6/m4/ax_gcc_x86_cpuid.m4 diff --git a/src/libffi/libffi-3.4.4/m4/ax_prepend_flag.m4 b/src/libffi/libffi-3.4.6/m4/ax_prepend_flag.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/m4/ax_prepend_flag.m4 rename to src/libffi/libffi-3.4.6/m4/ax_prepend_flag.m4 diff --git a/src/libffi/libffi-3.4.4/m4/ax_require_defined.m4 b/src/libffi/libffi-3.4.6/m4/ax_require_defined.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/m4/ax_require_defined.m4 rename to src/libffi/libffi-3.4.6/m4/ax_require_defined.m4 diff --git a/src/libffi/libffi-3.4.4/m4/libtool.m4 b/src/libffi/libffi-3.4.6/m4/libtool.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/m4/libtool.m4 rename to src/libffi/libffi-3.4.6/m4/libtool.m4 diff --git a/src/libffi/libffi-3.4.4/m4/ltoptions.m4 b/src/libffi/libffi-3.4.6/m4/ltoptions.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/m4/ltoptions.m4 rename to src/libffi/libffi-3.4.6/m4/ltoptions.m4 diff --git a/src/libffi/libffi-3.4.4/m4/ltsugar.m4 b/src/libffi/libffi-3.4.6/m4/ltsugar.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/m4/ltsugar.m4 rename to src/libffi/libffi-3.4.6/m4/ltsugar.m4 diff --git a/src/libffi/libffi-3.4.4/m4/ltversion.m4 b/src/libffi/libffi-3.4.6/m4/ltversion.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/m4/ltversion.m4 rename to src/libffi/libffi-3.4.6/m4/ltversion.m4 diff --git a/src/libffi/libffi-3.4.4/m4/lt~obsolete.m4 b/src/libffi/libffi-3.4.6/m4/lt~obsolete.m4 similarity index 100% rename from src/libffi/libffi-3.4.4/m4/lt~obsolete.m4 rename to src/libffi/libffi-3.4.6/m4/lt~obsolete.m4 diff --git a/src/libffi/libffi-3.4.4/make_sunver.pl b/src/libffi/libffi-3.4.6/make_sunver.pl similarity index 100% rename from src/libffi/libffi-3.4.4/make_sunver.pl rename to src/libffi/libffi-3.4.6/make_sunver.pl diff --git a/src/libffi/libffi-3.4.4/man/Makefile.am b/src/libffi/libffi-3.4.6/man/Makefile.am similarity index 100% rename from src/libffi/libffi-3.4.4/man/Makefile.am rename to src/libffi/libffi-3.4.6/man/Makefile.am diff --git a/src/libffi/libffi-3.4.4/man/Makefile.in b/src/libffi/libffi-3.4.6/man/Makefile.in similarity index 99% rename from src/libffi/libffi-3.4.4/man/Makefile.in rename to src/libffi/libffi-3.4.6/man/Makefile.in index 830c84280..8f0678325 100644 --- a/src/libffi/libffi-3.4.4/man/Makefile.in +++ b/src/libffi/libffi-3.4.6/man/Makefile.in @@ -166,7 +166,6 @@ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LTLDFLAGS = @AM_LTLDFLAGS@ diff --git a/src/libffi/libffi-3.4.4/man/ffi.3 b/src/libffi/libffi-3.4.6/man/ffi.3 similarity index 100% rename from src/libffi/libffi-3.4.4/man/ffi.3 rename to src/libffi/libffi-3.4.6/man/ffi.3 diff --git a/src/libffi/libffi-3.4.4/man/ffi_call.3 b/src/libffi/libffi-3.4.6/man/ffi_call.3 similarity index 100% rename from src/libffi/libffi-3.4.4/man/ffi_call.3 rename to src/libffi/libffi-3.4.6/man/ffi_call.3 diff --git a/src/libffi/libffi-3.4.4/man/ffi_prep_cif.3 b/src/libffi/libffi-3.4.6/man/ffi_prep_cif.3 similarity index 100% rename from src/libffi/libffi-3.4.4/man/ffi_prep_cif.3 rename to src/libffi/libffi-3.4.6/man/ffi_prep_cif.3 diff --git a/src/libffi/libffi-3.4.4/man/ffi_prep_cif_var.3 b/src/libffi/libffi-3.4.6/man/ffi_prep_cif_var.3 similarity index 100% rename from src/libffi/libffi-3.4.4/man/ffi_prep_cif_var.3 rename to src/libffi/libffi-3.4.6/man/ffi_prep_cif_var.3 diff --git a/src/libffi/libffi-3.4.4/missing b/src/libffi/libffi-3.4.6/missing similarity index 100% rename from src/libffi/libffi-3.4.4/missing rename to src/libffi/libffi-3.4.6/missing diff --git a/src/libffi/libffi-3.4.4/msvc_build/aarch64/Ffi_staticLib.sln b/src/libffi/libffi-3.4.6/msvc_build/aarch64/Ffi_staticLib.sln similarity index 100% rename from src/libffi/libffi-3.4.4/msvc_build/aarch64/Ffi_staticLib.sln rename to src/libffi/libffi-3.4.6/msvc_build/aarch64/Ffi_staticLib.sln diff --git a/src/libffi/libffi-3.4.4/msvc_build/aarch64/Ffi_staticLib.vcxproj b/src/libffi/libffi-3.4.6/msvc_build/aarch64/Ffi_staticLib.vcxproj similarity index 100% rename from src/libffi/libffi-3.4.4/msvc_build/aarch64/Ffi_staticLib.vcxproj rename to src/libffi/libffi-3.4.6/msvc_build/aarch64/Ffi_staticLib.vcxproj diff --git a/src/libffi/libffi-3.4.4/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters b/src/libffi/libffi-3.4.6/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters similarity index 100% rename from src/libffi/libffi-3.4.4/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters rename to src/libffi/libffi-3.4.6/msvc_build/aarch64/Ffi_staticLib.vcxproj.filters diff --git a/src/libffi/libffi-3.4.4/msvc_build/aarch64/Ffi_staticLib.vcxproj.user b/src/libffi/libffi-3.4.6/msvc_build/aarch64/Ffi_staticLib.vcxproj.user similarity index 100% rename from src/libffi/libffi-3.4.4/msvc_build/aarch64/Ffi_staticLib.vcxproj.user rename to src/libffi/libffi-3.4.6/msvc_build/aarch64/Ffi_staticLib.vcxproj.user diff --git a/src/libffi/libffi-3.4.4/msvc_build/aarch64/aarch64_include/ffi.h b/src/libffi/libffi-3.4.6/msvc_build/aarch64/aarch64_include/ffi.h similarity index 99% rename from src/libffi/libffi-3.4.4/msvc_build/aarch64/aarch64_include/ffi.h rename to src/libffi/libffi-3.4.6/msvc_build/aarch64/aarch64_include/ffi.h index 8aed52555..2b0b69399 100644 --- a/src/libffi/libffi-3.4.4/msvc_build/aarch64/aarch64_include/ffi.h +++ b/src/libffi/libffi-3.4.6/msvc_build/aarch64/aarch64_include/ffi.h @@ -429,7 +429,7 @@ ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, #endif /* FFI_CLOSURES */ -#if FFI_GO_CLOSURES +#ifdef FFI_GO_CLOSURES typedef struct { void *tramp; diff --git a/src/libffi/libffi-3.4.4/msvc_build/aarch64/aarch64_include/fficonfig.h b/src/libffi/libffi-3.4.6/msvc_build/aarch64/aarch64_include/fficonfig.h similarity index 100% rename from src/libffi/libffi-3.4.4/msvc_build/aarch64/aarch64_include/fficonfig.h rename to src/libffi/libffi-3.4.6/msvc_build/aarch64/aarch64_include/fficonfig.h diff --git a/src/libffi/libffi-3.4.4/msvcc.sh b/src/libffi/libffi-3.4.6/msvcc.sh similarity index 100% rename from src/libffi/libffi-3.4.4/msvcc.sh rename to src/libffi/libffi-3.4.6/msvcc.sh diff --git a/src/libffi/libffi-3.4.4/src/aarch64/ffi.c b/src/libffi/libffi-3.4.6/src/aarch64/ffi.c similarity index 97% rename from src/libffi/libffi-3.4.4/src/aarch64/ffi.c rename to src/libffi/libffi-3.4.6/src/aarch64/ffi.c index 6544ac0fe..8661a352b 100644 --- a/src/libffi/libffi-3.4.4/src/aarch64/ffi.c +++ b/src/libffi/libffi-3.4.6/src/aarch64/ffi.c @@ -386,51 +386,64 @@ extend_hfa_type (void *dest, void *src, int h) ssize_t f = h - AARCH64_RET_S4; void *x0; +#define BTI_J "hint #36" asm volatile ( "adr %0, 0f\n" " add %0, %0, %1\n" " br %0\n" -"0: ldp s16, s17, [%3]\n" /* S4 */ +"0: "BTI_J"\n" /* S4 */ +" ldp s16, s17, [%3]\n" " ldp s18, s19, [%3, #8]\n" " b 4f\n" -" ldp s16, s17, [%3]\n" /* S3 */ +" "BTI_J"\n" /* S3 */ +" ldp s16, s17, [%3]\n" " ldr s18, [%3, #8]\n" " b 3f\n" -" ldp s16, s17, [%3]\n" /* S2 */ +" "BTI_J"\n" /* S2 */ +" ldp s16, s17, [%3]\n" " b 2f\n" " nop\n" -" ldr s16, [%3]\n" /* S1 */ +" "BTI_J"\n" /* S1 */ +" ldr s16, [%3]\n" " b 1f\n" " nop\n" -" ldp d16, d17, [%3]\n" /* D4 */ +" "BTI_J"\n" /* D4 */ +" ldp d16, d17, [%3]\n" " ldp d18, d19, [%3, #16]\n" " b 4f\n" -" ldp d16, d17, [%3]\n" /* D3 */ +" "BTI_J"\n" /* D3 */ +" ldp d16, d17, [%3]\n" " ldr d18, [%3, #16]\n" " b 3f\n" -" ldp d16, d17, [%3]\n" /* D2 */ +" "BTI_J"\n" /* D2 */ +" ldp d16, d17, [%3]\n" " b 2f\n" " nop\n" -" ldr d16, [%3]\n" /* D1 */ +" "BTI_J"\n" /* D1 */ +" ldr d16, [%3]\n" " b 1f\n" " nop\n" -" ldp q16, q17, [%3]\n" /* Q4 */ +" "BTI_J"\n" /* Q4 */ +" ldp q16, q17, [%3]\n" " ldp q18, q19, [%3, #32]\n" " b 4f\n" -" ldp q16, q17, [%3]\n" /* Q3 */ +" "BTI_J"\n" /* Q3 */ +" ldp q16, q17, [%3]\n" " ldr q18, [%3, #32]\n" " b 3f\n" -" ldp q16, q17, [%3]\n" /* Q2 */ +" "BTI_J"\n" /* Q2 */ +" ldp q16, q17, [%3]\n" " b 2f\n" " nop\n" -" ldr q16, [%3]\n" /* Q1 */ +" "BTI_J"\n" /* Q1 */ +" ldr q16, [%3]\n" " b 1f\n" "4: str q19, [%2, #48]\n" "3: str q18, [%2, #32]\n" "2: str q17, [%2, #16]\n" "1: str q16, [%2]" : "=&r"(x0) - : "r"(f * 12), "r"(dest), "r"(src) + : "r"(f * 16), "r"(dest), "r"(src) : "memory", "v16", "v17", "v18", "v19"); } #endif diff --git a/src/libffi/libffi-3.4.4/src/aarch64/ffitarget.h b/src/libffi/libffi-3.4.6/src/aarch64/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/aarch64/ffitarget.h rename to src/libffi/libffi-3.4.6/src/aarch64/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/aarch64/internal.h b/src/libffi/libffi-3.4.6/src/aarch64/internal.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/aarch64/internal.h rename to src/libffi/libffi-3.4.6/src/aarch64/internal.h diff --git a/src/libffi/libffi-3.4.4/src/aarch64/sysv.S b/src/libffi/libffi-3.4.6/src/aarch64/sysv.S similarity index 80% rename from src/libffi/libffi-3.4.4/src/aarch64/sysv.S rename to src/libffi/libffi-3.4.6/src/aarch64/sysv.S index eeaf3f851..fdd0e8b7b 100644 --- a/src/libffi/libffi-3.4.4/src/aarch64/sysv.S +++ b/src/libffi/libffi-3.4.6/src/aarch64/sysv.S @@ -40,6 +40,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #endif #endif +#ifdef __APPLE__ +# define L(X) CONCAT1(L, X) +#else +# define L(X) CONCAT1(.L, X) +#endif + #ifdef __AARCH64EB__ # define BE(X) X #else @@ -58,6 +64,13 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define PTR_SIZE 8 #endif +#define BTI_C hint #34 +#define BTI_J hint #36 +/* + * The ELF Notes section needs to indicate if BTI is supported, as the first ELF loaded that doesn't + * declare this support disables it for the whole process. + */ +# define GNU_PROPERTY_AARCH64_BTI (1 << 0) /* Has Branch Target Identification */ .text .align 4 @@ -78,6 +91,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ cfi_startproc CNAME(ffi_call_SYSV): + BTI_C /* Sign the lr with x1 since that is where it will be stored */ SIGN_LR_WITH_REG(x1) @@ -138,78 +152,142 @@ CNAME(ffi_call_SYSV): /* Save the return value as directed. */ adr x5, 0f and w4, w4, #AARCH64_RET_MASK - add x5, x5, x4, lsl #3 + add x5, x5, x4, lsl #4 br x5 - /* Note that each table entry is 2 insns, and thus 8 bytes. + /* Note that each table entry is 4 insns, and thus 16 bytes. For integer data, note that we're storing into ffi_arg and therefore we want to extend to 64 bits; these types have two consecutive entries allocated for them. */ .align 4 -0: b 99f /* VOID */ +0: BTI_J /* VOID */ + b 99f + nop nop -1: str x0, [x3] /* INT64 */ +1: BTI_J /* INT64 */ + str x0, [x3] b 99f -2: stp x0, x1, [x3] /* INT128 */ + nop +2: BTI_J /* INT128 */ + stp x0, x1, [x3] b 99f + nop 3: brk #1000 /* UNUSED */ b 99f + nop + nop 4: brk #1000 /* UNUSED */ b 99f + nop + nop 5: brk #1000 /* UNUSED */ b 99f + nop + nop 6: brk #1000 /* UNUSED */ b 99f + nop + nop 7: brk #1000 /* UNUSED */ b 99f -8: st4 { v0.s, v1.s, v2.s, v3.s }[0], [x3] /* S4 */ + nop + nop +8: BTI_J /* S4 */ + st4 { v0.s, v1.s, v2.s, v3.s }[0], [x3] b 99f -9: st3 { v0.s, v1.s, v2.s }[0], [x3] /* S3 */ + nop +9: BTI_J /* S3 */ + st3 { v0.s, v1.s, v2.s }[0], [x3] b 99f -10: stp s0, s1, [x3] /* S2 */ + nop +10: BTI_J /* S2 */ + stp s0, s1, [x3] b 99f -11: str s0, [x3] /* S1 */ + nop +11: BTI_J + str s0, [x3] /* S1 */ b 99f -12: st4 { v0.d, v1.d, v2.d, v3.d }[0], [x3] /* D4 */ + nop +12: BTI_J /* D4 */ + st4 { v0.d, v1.d, v2.d, v3.d }[0], [x3] b 99f -13: st3 { v0.d, v1.d, v2.d }[0], [x3] /* D3 */ + nop +13: BTI_J /* D3 */ + st3 { v0.d, v1.d, v2.d }[0], [x3] b 99f -14: stp d0, d1, [x3] /* D2 */ + nop +14: BTI_J /* D2 */ + stp d0, d1, [x3] b 99f -15: str d0, [x3] /* D1 */ + nop +15: BTI_J /* D1 */ + str d0, [x3] b 99f -16: str q3, [x3, #48] /* Q4 */ nop -17: str q2, [x3, #32] /* Q3 */ +16: BTI_J /* Q4 */ + str q3, [x3, #48] + nop + nop +17: BTI_J /* Q3 */ + str q2, [x3, #32] + nop nop -18: stp q0, q1, [x3] /* Q2 */ +18: BTI_J /* Q2 */ + stp q0, q1, [x3] b 99f -19: str q0, [x3] /* Q1 */ + nop +19: BTI_J /* Q1 */ + str q0, [x3] b 99f -20: uxtb w0, w0 /* UINT8 */ + nop +20: BTI_J /* UINT8 */ + uxtb w0, w0 str x0, [x3] + nop 21: b 99f /* reserved */ nop -22: uxth w0, w0 /* UINT16 */ + nop + nop +22: BTI_J /* UINT16 */ + uxth w0, w0 str x0, [x3] + nop 23: b 99f /* reserved */ nop -24: mov w0, w0 /* UINT32 */ + nop + nop +24: BTI_J /* UINT32 */ + mov w0, w0 str x0, [x3] + nop 25: b 99f /* reserved */ nop -26: sxtb x0, w0 /* SINT8 */ + nop + nop +26: BTI_J /* SINT8 */ + sxtb x0, w0 str x0, [x3] + nop 27: b 99f /* reserved */ nop -28: sxth x0, w0 /* SINT16 */ + nop + nop +28: BTI_J /* SINT16 */ + sxth x0, w0 str x0, [x3] + nop 29: b 99f /* reserved */ nop -30: sxtw x0, w0 /* SINT32 */ + nop + nop +30: BTI_J /* SINT32 */ + sxtw x0, w0 str x0, [x3] + nop 31: b 99f /* reserved */ nop + nop + nop /* Return now that result has been populated. */ 99: @@ -246,6 +324,7 @@ CNAME(ffi_call_SYSV): .align 4 CNAME(ffi_closure_SYSV_V): cfi_startproc + BTI_C SIGN_LR stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) @@ -270,6 +349,7 @@ CNAME(ffi_closure_SYSV_V): .align 4 cfi_startproc CNAME(ffi_closure_SYSV): + BTI_C SIGN_LR stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) @@ -288,7 +368,7 @@ CNAME(ffi_closure_SYSV): ldp PTR_REG(0), PTR_REG(1), [x17, #FFI_TRAMPOLINE_CLOSURE_OFFSET] /* load cif, fn */ ldr PTR_REG(2), [x17, #FFI_TRAMPOLINE_CLOSURE_OFFSET+PTR_SIZE*2] /* load user_data */ #ifdef FFI_GO_CLOSURES -.Ldo_closure: +L(do_closure): #endif add x3, sp, #16 /* load context */ add x4, sp, #ffi_closure_SYSV_FS /* load stack */ @@ -299,73 +379,135 @@ CNAME(ffi_closure_SYSV): /* Load the return value as directed. */ adr x1, 0f and w0, w0, #AARCH64_RET_MASK - add x1, x1, x0, lsl #3 + add x1, x1, x0, lsl #4 add x3, sp, #16+CALL_CONTEXT_SIZE br x1 - /* Note that each table entry is 2 insns, and thus 8 bytes. */ + /* Note that each table entry is 4 insns, and thus 16 bytes. */ .align 4 -0: b 99f /* VOID */ +0: BTI_J /* VOID */ + b 99f + nop nop -1: ldr x0, [x3] /* INT64 */ +1: BTI_J /* INT64 */ + ldr x0, [x3] b 99f -2: ldp x0, x1, [x3] /* INT128 */ + nop +2: BTI_J /* INT128 */ + ldp x0, x1, [x3] b 99f + nop 3: brk #1000 /* UNUSED */ nop + nop + nop 4: brk #1000 /* UNUSED */ nop + nop + nop 5: brk #1000 /* UNUSED */ nop + nop + nop 6: brk #1000 /* UNUSED */ nop + nop + nop 7: brk #1000 /* UNUSED */ nop -8: ldr s3, [x3, #12] /* S4 */ nop -9: ldr s2, [x3, #8] /* S3 */ nop -10: ldp s0, s1, [x3] /* S2 */ +8: BTI_J /* S4 */ + ldr s3, [x3, #12] + nop + nop +9: BTI_J /* S3 */ + ldr s2, [x3, #8] + nop + nop +10: BTI_J /* S2 */ + ldp s0, s1, [x3] b 99f -11: ldr s0, [x3] /* S1 */ + nop +11: BTI_J /* S1 */ + ldr s0, [x3] b 99f -12: ldr d3, [x3, #24] /* D4 */ nop -13: ldr d2, [x3, #16] /* D3 */ +12: BTI_J /* D4 */ + ldr d3, [x3, #24] + nop + nop +13: BTI_J /* D3 */ + ldr d2, [x3, #16] + nop nop -14: ldp d0, d1, [x3] /* D2 */ +14: BTI_J /* D2 */ + ldp d0, d1, [x3] b 99f -15: ldr d0, [x3] /* D1 */ + nop +15: BTI_J /* D1 */ + ldr d0, [x3] b 99f -16: ldr q3, [x3, #48] /* Q4 */ nop -17: ldr q2, [x3, #32] /* Q3 */ +16: BTI_J /* Q4 */ + ldr q3, [x3, #48] + nop + nop +17: BTI_J /* Q3 */ + ldr q2, [x3, #32] nop -18: ldp q0, q1, [x3] /* Q2 */ + nop +18: BTI_J /* Q2 */ + ldp q0, q1, [x3] b 99f -19: ldr q0, [x3] /* Q1 */ + nop +19: BTI_J /* Q1 */ + ldr q0, [x3] b 99f -20: ldrb w0, [x3, #BE(7)] /* UINT8 */ + nop +20: BTI_J /* UINT8 */ + ldrb w0, [x3, #BE(7)] b 99f + nop 21: brk #1000 /* reserved */ nop -22: ldrh w0, [x3, #BE(6)] /* UINT16 */ + nop + nop +22: BTI_J /* UINT16 */ + ldrh w0, [x3, #BE(6)] b 99f + nop 23: brk #1000 /* reserved */ nop -24: ldr w0, [x3, #BE(4)] /* UINT32 */ + nop + nop +24: BTI_J /* UINT32 */ + ldr w0, [x3, #BE(4)] b 99f + nop 25: brk #1000 /* reserved */ nop -26: ldrsb x0, [x3, #BE(7)] /* SINT8 */ + nop + nop +26: BTI_J /* SINT8 */ + ldrsb x0, [x3, #BE(7)] b 99f + nop 27: brk #1000 /* reserved */ nop -28: ldrsh x0, [x3, #BE(6)] /* SINT16 */ + nop + nop +28: BTI_J /* SINT16 */ + ldrsh x0, [x3, #BE(6)] b 99f + nop 29: brk #1000 /* reserved */ nop -30: ldrsw x0, [x3, #BE(4)] /* SINT32 */ + nop + nop +30: BTI_J /* SINT32 */ + ldrsw x0, [x3, #BE(4)] + nop nop 31: /* reserved */ 99: ldp x29, x30, [sp], #ffi_closure_SYSV_FS @@ -479,6 +621,7 @@ CNAME(ffi_closure_trampoline_table_page): .align 4 CNAME(ffi_go_closure_SYSV_V): cfi_startproc + BTI_C stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) cfi_rel_offset (x29, 0) @@ -502,6 +645,7 @@ CNAME(ffi_go_closure_SYSV_V): .align 4 cfi_startproc CNAME(ffi_go_closure_SYSV): + BTI_C stp x29, x30, [sp, #-ffi_closure_SYSV_FS]! cfi_adjust_cfa_offset (ffi_closure_SYSV_FS) cfi_rel_offset (x29, 0) @@ -518,7 +662,7 @@ CNAME(ffi_go_closure_SYSV): /* Load ffi_closure_inner arguments. */ ldp PTR_REG(0), PTR_REG(1), [x18, #PTR_SIZE]/* load cif, fn */ mov x2, x18 /* load user_data */ - b .Ldo_closure + b L(do_closure) cfi_endproc .globl CNAME(ffi_go_closure_SYSV) @@ -533,5 +677,17 @@ CNAME(ffi_go_closure_SYSV): #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",%progbits + + .pushsection .note.gnu.property, "a"; + .balign 8; + .long 4; + .long 0x10; + .long 0x5; + .asciz "GNU"; + .long 0xc0000000; /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */ + .long 4; + .long GNU_PROPERTY_AARCH64_BTI; + .long 0; + .popsection; #endif diff --git a/src/libffi/libffi-3.4.4/src/aarch64/win64_armasm.S b/src/libffi/libffi-3.4.6/src/aarch64/win64_armasm.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/aarch64/win64_armasm.S rename to src/libffi/libffi-3.4.6/src/aarch64/win64_armasm.S diff --git a/src/libffi/libffi-3.4.4/src/alpha/ffi.c b/src/libffi/libffi-3.4.6/src/alpha/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/alpha/ffi.c rename to src/libffi/libffi-3.4.6/src/alpha/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/alpha/ffitarget.h b/src/libffi/libffi-3.4.6/src/alpha/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/alpha/ffitarget.h rename to src/libffi/libffi-3.4.6/src/alpha/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/alpha/internal.h b/src/libffi/libffi-3.4.6/src/alpha/internal.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/alpha/internal.h rename to src/libffi/libffi-3.4.6/src/alpha/internal.h diff --git a/src/libffi/libffi-3.4.4/src/alpha/osf.S b/src/libffi/libffi-3.4.6/src/alpha/osf.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/alpha/osf.S rename to src/libffi/libffi-3.4.6/src/alpha/osf.S diff --git a/src/libffi/libffi-3.4.6/src/arc/arcompact.S b/src/libffi/libffi-3.4.6/src/arc/arcompact.S new file mode 100644 index 000000000..1d7f1a1fc --- /dev/null +++ b/src/libffi/libffi-3.4.6/src/arc/arcompact.S @@ -0,0 +1,210 @@ +/* ----------------------------------------------------------------------- + arcompact.S - Copyright (c) 2013 Synposys, Inc. (www.synopsys.com) + + ARCompact Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include +#ifdef HAVE_MACHINE_ASM_H +#include +#else +#define CNAME(x) x +#define ENTRY(x) .globl CNAME(x)` .type CNAME(x),%function` CNAME(x): +#endif + +#if __SIZEOF_POINTER__ == 8 +#define PTRS 8 +#define FLTS 8 +#define LARG ldl +#define SARG stl +#define ADDPTR addl +#define MOVPTR movl_s +#else +#define PTRS 4 +#define FLTS 4 +#define LARG ld +#define SARG st +#define ADDPTR add +#define MOVPTR mov_s +#endif + +#define FRAME_LEN (8 * PTRS + 16) + +.text + +ENTRY(ffi_call_asm) + .cfi_startproc + + /* Save registers. */ + .cfi_def_cfa r1, FRAME_LEN + SARG fp, [r1, FRAME_LEN - 2*PTRS] + .cfi_offset fp, -2*PTRS + SARG blink, [r1, FRAME_LEN - 1*PTRS] + .cfi_offset blink, -1*PTRS + ADDPTR fp, r1, FRAME_LEN + MOVPTR sp, r0 + .cfi_def_cfa fp, 0 + + /* Load arguments. */ + MOVPTR r11, r2 /* fn */ + MOVPTR r12, r3 /* closure */ + + /* Save arguments. */ + LARG r0, [fp, -FRAME_LEN+0*PTRS] + LARG r1, [fp, -FRAME_LEN+1*PTRS] + LARG r2, [fp, -FRAME_LEN+2*PTRS] + LARG r3, [fp, -FRAME_LEN+3*PTRS] + LARG r4, [fp, -FRAME_LEN+4*PTRS] + LARG r5, [fp, -FRAME_LEN+5*PTRS] + LARG r6, [fp, -FRAME_LEN+6*PTRS] + LARG r7, [fp, -FRAME_LEN+7*PTRS] + + /* Call the function. */ + jl [r11] + + /* Save return value (r0/r1) */ + SARG r0, [fp, -FRAME_LEN+0*PTRS] + SARG r1, [fp, -FRAME_LEN+1*PTRS] + + /* Restore and return. */ + add sp, fp, -FRAME_LEN + .cfi_def_cfa sp, FRAME_LEN + LARG blink, [fp, -1*PTRS] + .cfi_restore blink + LARG fp, [fp, -2*PTRS] + .cfi_restore fp + j_s [blink] + .cfi_endproc + .size ffi_call_asm, .-ffi_call_asm + +/* + ffi_closure_asm. Expects address of the passed-in ffi_closure in r8. + void ffi_closure_inner (ffi_cif *cif, + void (*fun) (ffi_cif *, void *, void **, void *), + void *user_data, + size_t *stackargs, struct call_context *regargs) +*/ + +ENTRY(ffi_closure_asm) + .cfi_startproc + + ADDPTR sp, sp, -FRAME_LEN + .cfi_def_cfa_offset FRAME_LEN + + /* Make a frame. */ + SARG fp, [sp, FRAME_LEN-2*PTRS] + .cfi_offset fp, -2*PTRS + SARG blink, [sp, FRAME_LEN-1*PTRS] + .cfi_offset blink, -1*PTRS + ADDPTR fp, sp, FRAME_LEN + + /* Save arguments. */ + SARG r0, [sp, 0*PTRS] + SARG r1, [sp, 1*PTRS] + SARG r2, [sp, 2*PTRS] + SARG r3, [sp, 3*PTRS] + SARG r4, [sp, 4*PTRS] + SARG r5, [sp, 5*PTRS] + SARG r6, [sp, 6*PTRS] + SARG r7, [sp, 7*PTRS] + + /* Enter C. */ + LARG r0, [r8, FFI_TRAMPOLINE_SIZE+0*PTRS] + LARG r1, [r8, FFI_TRAMPOLINE_SIZE+1*PTRS] + LARG r2, [r8, FFI_TRAMPOLINE_SIZE+2*PTRS] + ADDPTR r3, sp, FRAME_LEN + MOVPTR r4, sp + + /* Call the C code. */ + bl ffi_closure_inner + + /* Return values. */ + LARG r0, [sp, 0*PTRS] + LARG r1, [sp, 1*PTRS] + + /* Restore and return. */ + LARG blink, [sp, FRAME_LEN-1*PTRS] + .cfi_restore blink + LARG fp, [sp, FRAME_LEN-2*PTRS] + .cfi_restore fp + ADDPTR sp, sp, FRAME_LEN + .cfi_def_cfa_offset 0 + j_s [blink] + .cfi_endproc + .size ffi_closure_asm, .-ffi_closure_asm + +/* + ffi_go_closure_asm. Expects address of the passed-in ffi_go_closure in r12. + void ffi_closure_inner (ffi_cif *cif, + void (*fun) (ffi_cif *, void *, void **, void *), + void *user_data, + size_t *stackargs, struct call_context *regargs) +*/ + +ENTRY(ffi_go_closure_asm) + .cfi_startproc + + ADDPTR sp, sp, -FRAME_LEN + .cfi_def_cfa_offset FRAME_LEN + + /* make a frame */ + SARG fp, [sp, FRAME_LEN-2*PTRS] + .cfi_offset fp, -2*PTRS + SARG blink, [sp, FRAME_LEN-1*PTRS] + .cfi_offset blink, -1*PTRS + ADDPTR fp, sp, FRAME_LEN + + /* save arguments */ + SARG r0, [sp, 0*PTRS] + SARG r1, [sp, 1*PTRS] + SARG r2, [sp, 2*PTRS] + SARG r3, [sp, 3*PTRS] + SARG r4, [sp, 4*PTRS] + SARG r5, [sp, 5*PTRS] + SARG r6, [sp, 6*PTRS] + SARG r7, [sp, 7*PTRS] + + /* enter C */ + LARG r0, [r12, 1*PTRS] + LARG r1, [r12, 2*PTRS] + MOVPTR r2, r12 + ADDPTR r3, sp, FRAME_LEN + MOVPTR r4, sp + + bl ffi_closure_inner + + /* Return values. */ + LARG r0, [sp, 0*PTRS] + LARG r1, [sp, 1*PTRS] + + + LARG blink, [sp, FRAME_LEN-1*PTRS] + .cfi_restore blink + LARG fp, [sp, FRAME_LEN-2*PTRS] + .cfi_restore fp + ADDPTR sp, sp, FRAME_LEN + .cfi_def_cfa_offset 0 + j_s [blink] + .cfi_endproc + .size ffi_go_closure_asm, .-ffi_go_closure_asm diff --git a/src/libffi/libffi-3.4.6/src/arc/ffi.c b/src/libffi/libffi-3.4.6/src/arc/ffi.c new file mode 100644 index 000000000..d72927487 --- /dev/null +++ b/src/libffi/libffi-3.4.6/src/arc/ffi.c @@ -0,0 +1,443 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2013 Synopsys, Inc. (www.synopsys.com) + + ARC Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +#include +#include + +#include + +#define NARGREG 8 +#define STKALIGN 4 +#define MAXCOPYARG (2 * sizeof(double)) + +typedef struct call_context +{ + size_t r[8]; + /* used by the assembly code to in-place construct its own stack frame */ + char frame[16]; +} call_context; + +typedef struct call_builder +{ + call_context *aregs; + int used_integer; + //int used_float; + size_t *used_stack; + void *struct_stack; +} call_builder; + +/* integer (not pointer) less than ABI XLEN */ +/* FFI_TYPE_INT does not appear to be used */ +#if defined(__ARC64_ARCH64__) +#define IS_INT(type) ((type) >= FFI_TYPE_UINT8 && (type) <= FFI_TYPE_SINT64) +#else +#define IS_INT(type) ((type) >= FFI_TYPE_UINT8 && (type) <= FFI_TYPE_SINT32) +#endif + +/* for little endian ARC, the code is in fact stored as mixed endian for + performance reasons */ +#if __BIG_ENDIAN__ +#define CODE_ENDIAN(x) (x) +#else +#define CODE_ENDIAN(x) ( (((uint32_t) (x)) << 16) | (((uint32_t) (x)) >> 16)) +#endif + +/* Perform machine dependent cif processing. */ +ffi_status +ffi_prep_cif_machdep (ffi_cif * cif) +{ + /* Set the return type flag. */ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + cif->flags = (unsigned) cif->rtype->type; + break; + + case FFI_TYPE_STRUCT: + cif->flags = (unsigned) cif->rtype->type; + break; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_DOUBLE: + cif->flags = FFI_TYPE_DOUBLE; + break; + + case FFI_TYPE_FLOAT: + default: + cif->flags = FFI_TYPE_INT; + break; + } + + return FFI_OK; +} + +/* allocates a single register, float register, or XLEN-sized stack slot to a datum */ +static void marshal_atom(call_builder *cb, int type, void *data) { + size_t value = 0; + switch (type) { + case FFI_TYPE_UINT8: value = *(uint8_t *)data; break; + case FFI_TYPE_SINT8: value = *(int8_t *)data; break; + case FFI_TYPE_UINT16: value = *(uint16_t *)data; break; + case FFI_TYPE_SINT16: value = *(int16_t *)data; break; + /* 32-bit quantities are always sign-extended in the ABI */ + case FFI_TYPE_UINT32: value = *(int32_t *)data; break; + case FFI_TYPE_SINT32: value = *(int32_t *)data; break; +#if defined(__ARC64_ARCH64__) + case FFI_TYPE_UINT64: value = *(uint64_t *)data; break; + case FFI_TYPE_SINT64: value = *(int64_t *)data; break; +#endif + case FFI_TYPE_POINTER: value = *(size_t *)data; break; + default: FFI_ASSERT(0); break; + } + + if (cb->used_integer == NARGREG) { + *cb->used_stack++ = value; + } else { + cb->aregs->r[cb->used_integer++] = value; + } +} + +/* adds an argument to a call, or a not by reference return value */ +static void marshal(call_builder *cb, ffi_type *type, int var, void *data) { + size_t realign[2]; + +#if (defined(__ARC64_ARCH64__) || defined(__ARC64_ARCH32__)) + if (type->size > 2 * __SIZEOF_POINTER__) { + if (var) { + marshal_atom(cb, FFI_TYPE_POINTER, &data); + } else { + /* copy to stack and pass by reference */ + data = memcpy (cb->struct_stack, data, type->size); + cb->struct_stack = (size_t *) FFI_ALIGN ((char *) cb->struct_stack + type->size, __SIZEOF_POINTER__); + marshal_atom(cb, FFI_TYPE_POINTER, &data); + } + } +#else + if (type->type == FFI_TYPE_STRUCT) { + if (var) { + if (type->size > 0) + marshal_atom(cb, FFI_TYPE_POINTER, data); + } else { + int i; + + for (i = 0; i < type->size; i += sizeof(size_t)) { + marshal_atom(cb, FFI_TYPE_POINTER, data); + data += sizeof(size_t); + } + } + } +#endif + else if (IS_INT(type->type) || type->type == FFI_TYPE_POINTER) { + marshal_atom(cb, type->type, data); + } else { + memcpy(realign, data, type->size); + if (type->size > 0) + marshal_atom(cb, FFI_TYPE_POINTER, realign); + if (type->size > __SIZEOF_POINTER__) + marshal_atom(cb, FFI_TYPE_POINTER, realign + 1); + } +} + +static void unmarshal_atom(call_builder *cb, int type, void *data) { + size_t value; + + if (cb->used_integer == NARGREG) { + value = *cb->used_stack++; + } else { + value = cb->aregs->r[cb->used_integer++]; + } + + switch (type) { + case FFI_TYPE_UINT8: *(uint8_t *)data = value; break; + case FFI_TYPE_SINT8: *(uint8_t *)data = value; break; + case FFI_TYPE_UINT16: *(uint16_t *)data = value; break; + case FFI_TYPE_SINT16: *(uint16_t *)data = value; break; + case FFI_TYPE_UINT32: *(uint32_t *)data = value; break; + case FFI_TYPE_SINT32: *(uint32_t *)data = value; break; +#if defined(__ARC64_ARCH64__) + case FFI_TYPE_UINT64: *(uint64_t *)data = value; break; + case FFI_TYPE_SINT64: *(uint64_t *)data = value; break; +#endif + case FFI_TYPE_POINTER: *(size_t *)data = value; break; + default: FFI_ASSERT(0); break; + } +} + +/* for arguments passed by reference returns the pointer, otherwise the arg is copied (up to MAXCOPYARG bytes) */ +static void *unmarshal(call_builder *cb, ffi_type *type, int var, void *data) { + size_t realign[2]; + void *pointer; + +#if defined(__ARC64_ARCH64__) + if (type->size > 2 * __SIZEOF_POINTER__) { + /* pass by reference */ + unmarshal_atom(cb, FFI_TYPE_POINTER, (char*)&pointer); + return pointer; + } +#elif defined(__ARC64_ARCH32__) + if (type->type == FFI_TYPE_STRUCT) { + if (type->size > 2 * __SIZEOF_POINTER__) { + unmarshal_atom(cb, FFI_TYPE_POINTER, &realign[0]); + memcpy(data, (const void*)realign[0], type->size); + return data; + } else { + int i; + void *pdata = data; + + for (i = 0; i < type->size; i += sizeof(size_t)) { + unmarshal_atom(cb, FFI_TYPE_POINTER, pdata); + pdata += sizeof(size_t); + } + return data; + } + } +#else + if (type->type == FFI_TYPE_STRUCT) { + + if (var) { + int i; + void *pdata = data; + + for (i = 0; i < type->size; i += sizeof(size_t)) { + unmarshal_atom(cb, FFI_TYPE_POINTER, pdata); + pdata += sizeof(size_t); + } + return data; + } else { + if (type->size > 0) + unmarshal_atom(cb, FFI_TYPE_POINTER, &realign[0]); + memcpy(data, (const void*)realign[0], type->size); + return data; + } + } +#endif + else if (IS_INT(type->type) || type->type == FFI_TYPE_POINTER) { + unmarshal_atom(cb, type->type, data); + return data; + } else { + if (type->size > 0) + unmarshal_atom(cb, FFI_TYPE_POINTER, realign); + if (type->size > __SIZEOF_POINTER__) + unmarshal_atom(cb, FFI_TYPE_POINTER, realign + 1); + memcpy(data, realign, type->size); + return data; + } +} + +static int passed_by_ref(ffi_type *type, int var) { + if (type->type == FFI_TYPE_STRUCT) + return 1; + + return type->size > 2 * __SIZEOF_POINTER__; +} + +/* Low level routine for calling functions */ +extern void ffi_call_asm (void *stack, struct call_context *regs, + void (*fn) (void), void *closure) FFI_HIDDEN; + +static void +ffi_call_int (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue, + void *closure) +{ + int return_by_ref = passed_by_ref(cif->rtype, 0); + + /* Allocate space for stack arg parameters. */ + size_t arg_bytes = FFI_ALIGN(2 * sizeof(size_t) * cif->nargs, STKALIGN); + /* Allocate space for copies of big structures. */ + size_t struct_bytes = FFI_ALIGN(cif->bytes, STKALIGN); + // size_t rval_bytes = 0; + // if (rvalue == NULL && cif->rtype->size > 2*__SIZEOF_POINTER__) + // rval_bytes = FFI_ALIGN(cif->rtype->size, STKALIGN); + size_t alloc_size = arg_bytes + /*rval_bytes +*/ struct_bytes + sizeof(call_context); + size_t alloc_base = (size_t)alloca(alloc_size); + + // if (rval_bytes) + // rvalue = (void*)(alloc_base + arg_bytes); + + call_builder cb; + cb.used_integer = 0; + cb.aregs = (call_context*)(alloc_base + arg_bytes /*+ rval_bytes*/ + struct_bytes); + cb.used_stack = (void*)alloc_base; + cb.struct_stack = (void *)(alloc_base + arg_bytes /*+ rval_bytes*/); + + // if (cif->rtype->type == FFI_TYPE_STRUCT) + // marshal(&cb, &ffi_type_pointer, 0, &rvalue); + + if (return_by_ref) + marshal(&cb, &ffi_type_pointer, 0, &rvalue); + + int i; + for (i = 0; i < cif->nargs; i++) + marshal(&cb, cif->arg_types[i], 0, avalue[i]); + + ffi_call_asm ((void *) alloc_base, cb.aregs, fn, closure); + + cb.used_integer = 0; + if (!return_by_ref && rvalue) + { + if (IS_INT(cif->rtype->type) + && cif->rtype->size < sizeof (ffi_arg)) + { + /* Integer types smaller than ffi_arg need to be extended. */ + switch (cif->rtype->type) { + case FFI_TYPE_SINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_SINT32: + unmarshal_atom (&cb, (sizeof (ffi_arg) > 4 + ? FFI_TYPE_SINT64 : FFI_TYPE_SINT32), + rvalue); + break; + case FFI_TYPE_UINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_UINT32: + unmarshal_atom (&cb, (sizeof (ffi_arg) > 4 + ? FFI_TYPE_UINT64 : FFI_TYPE_UINT32), + rvalue); + break; + } + } + else + unmarshal(&cb, cif->rtype, 0, rvalue); + } +} + +void +ffi_call (ffi_cif *cif, void (*fn) (void), void *rvalue, void **avalue) +{ + ffi_call_int(cif, fn, rvalue, avalue, NULL); +} + +void +ffi_call_go (ffi_cif *cif, void (*fn) (void), void *rvalue, + void **avalue, void *closure) +{ + ffi_call_int(cif, fn, rvalue, avalue, closure); +} + +extern void ffi_closure_asm(void) FFI_HIDDEN; + +ffi_status +ffi_prep_closure_loc (ffi_closure * closure, ffi_cif * cif, + void (*fun) (ffi_cif *, void *, void **, void *), + void *user_data, void *codeloc) +{ + uint32_t *tramp = (uint32_t *) & (closure->tramp[0]); + size_t address_ffi_closure = (size_t) ffi_closure_asm; + + switch (cif->abi) + { +#if defined(__ARC64_ARCH64__) + case FFI_ARC64: + FFI_ASSERT (tramp == codeloc); + tramp[0] = CODE_ENDIAN (0x580a1fc0); /* movl r8, pcl */ + tramp[1] = CODE_ENDIAN (0x5c0b1f80); /* movhl r12, limm */ + tramp[2] = CODE_ENDIAN ((uint32_t)(address_ffi_closure >> 32)); + tramp[3] = CODE_ENDIAN (0x5c051f8c); /* orl r12, r12, limm */ + tramp[4] = CODE_ENDIAN ((uint32_t)(address_ffi_closure & 0xffffffff)); + tramp[5] = CODE_ENDIAN (0x20200300); /* j [r12] */ + break; +#else + case FFI_ARCOMPACT: + FFI_ASSERT (tramp == codeloc); + tramp[0] = CODE_ENDIAN (0x200a1fc0); /* mov r8, pcl */ + tramp[1] = CODE_ENDIAN (0x20200f80); /* j [long imm] */ + tramp[2] = CODE_ENDIAN (ffi_closure_asm); + break; +#endif + + default: + return FFI_BAD_ABI; + } + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + cacheflush (codeloc, FFI_TRAMPOLINE_SIZE, BCACHE); + + return FFI_OK; +} + +extern void ffi_go_closure_asm (void) FFI_HIDDEN; + +ffi_status +ffi_prep_go_closure (ffi_go_closure *closure, ffi_cif *cif, + void (*fun) (ffi_cif *, void *, void **, void *)) +{ + if (cif->abi <= FFI_FIRST_ABI || cif->abi >= FFI_LAST_ABI) + return FFI_BAD_ABI; + + closure->tramp = (void *) ffi_go_closure_asm; + closure->cif = cif; + closure->fun = fun; + + return FFI_OK; +} + +/* Called by the assembly code with aregs pointing to saved argument registers + and stack pointing to the stacked arguments. Return values passed in + registers will be reloaded from aregs. */ +void FFI_HIDDEN +ffi_closure_inner (ffi_cif *cif, + void (*fun) (ffi_cif *, void *, void **, void *), + void *user_data, + size_t *stack, call_context *aregs) +{ + void **avalue = alloca(cif->nargs * sizeof(void*)); + /* storage for arguments which will be copied by unmarshal(). We could + theoretically avoid the copies in many cases and use at most 128 bytes + of memory, but allocating disjoint storage for each argument is + simpler. */ + char *astorage = alloca(cif->bytes); + char *ptr = astorage; + void *rvalue; + call_builder cb; + int i; + + cb.aregs = aregs; + cb.used_integer = 0; + cb.used_stack = stack; + + /* handle hidden argument */ + if (cif->flags == FFI_TYPE_STRUCT) + unmarshal(&cb, &ffi_type_pointer, 0, &rvalue); + else + rvalue = alloca(cif->rtype->size); + + for (i = 0; i < cif->nargs; i++) { + avalue[i] = unmarshal(&cb, cif->arg_types[i], 1, ptr); + ptr += cif->arg_types[i]->size; + } + + fun (cif, rvalue, avalue, user_data); + + if (cif->rtype->type != FFI_TYPE_VOID) { + cb.used_integer = 0; + marshal(&cb, cif->rtype, 1, rvalue); + } +} diff --git a/src/libffi/libffi-3.4.4/src/arc/ffitarget.h b/src/libffi/libffi-3.4.6/src/arc/ffitarget.h similarity index 89% rename from src/libffi/libffi-3.4.4/src/arc/ffitarget.h rename to src/libffi/libffi-3.4.6/src/arc/ffitarget.h index bf8311bc8..5b36902e7 100644 --- a/src/libffi/libffi-3.4.4/src/arc/ffitarget.h +++ b/src/libffi/libffi-3.4.6/src/arc/ffitarget.h @@ -40,14 +40,28 @@ typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, +#if __SIZEOF_POINTER__ == 8 + FFI_ARC64, +#else FFI_ARCOMPACT, +#endif FFI_LAST_ABI, +#if __SIZEOF_POINTER__ == 8 + FFI_DEFAULT_ABI = FFI_ARC64 +#else FFI_DEFAULT_ABI = FFI_ARCOMPACT +#endif } ffi_abi; #endif #define FFI_CLOSURES 1 +#define FFI_GO_CLOSURES 1 +#if __SIZEOF_POINTER__ == 8 +#define FFI_TRAMPOLINE_SIZE 24 +#else #define FFI_TRAMPOLINE_SIZE 12 +#endif + #define FFI_NATIVE_RAW_API 0 #endif diff --git a/src/libffi/libffi-3.4.4/src/arm/ffi.c b/src/libffi/libffi-3.4.6/src/arm/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/arm/ffi.c rename to src/libffi/libffi-3.4.6/src/arm/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/arm/ffitarget.h b/src/libffi/libffi-3.4.6/src/arm/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/arm/ffitarget.h rename to src/libffi/libffi-3.4.6/src/arm/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/arm/internal.h b/src/libffi/libffi-3.4.6/src/arm/internal.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/arm/internal.h rename to src/libffi/libffi-3.4.6/src/arm/internal.h diff --git a/src/libffi/libffi-3.4.4/src/arm/sysv.S b/src/libffi/libffi-3.4.6/src/arm/sysv.S similarity index 96% rename from src/libffi/libffi-3.4.4/src/arm/sysv.S rename to src/libffi/libffi-3.4.6/src/arm/sysv.S index fb36213c6..e4272a103 100644 --- a/src/libffi/libffi-3.4.4/src/arm/sysv.S +++ b/src/libffi/libffi-3.4.6/src/arm/sysv.S @@ -142,13 +142,8 @@ ARM_FUNC_START(ffi_call_VFP) cmp r3, #3 @ load only d0 if possible ite le -#ifdef __clang__ - vldrle d0, [r0] - vldmgt r0, {d0-d7} -#else ldcle p11, cr0, [r0] @ vldrle d0, [r0] ldcgt p11, cr0, [r0], {16} @ vldmgt r0, {d0-d7} -#endif add r0, r0, #64 @ discard the vfp register args /* FALLTHRU */ ARM_FUNC_END(ffi_call_VFP) @@ -193,25 +188,13 @@ ARM_FUNC_START(ffi_call_SYSV) #endif 0: E(ARM_TYPE_VFP_S) -#ifdef __clang__ - vstr s0, [r2] -#else stc p10, cr0, [r2] @ vstr s0, [r2] -#endif pop {fp,pc} E(ARM_TYPE_VFP_D) -#ifdef __clang__ - vstr d0, [r2] -#else stc p11, cr0, [r2] @ vstr d0, [r2] -#endif pop {fp,pc} E(ARM_TYPE_VFP_N) -#ifdef __clang__ - vstm r2, {d0-d3} -#else stc p11, cr0, [r2], {8} @ vstm r2, {d0-d3} -#endif pop {fp,pc} E(ARM_TYPE_INT64) str r1, [r2, #4] @@ -320,11 +303,7 @@ ARM_FUNC_START(ffi_closure_VFP) add ip, sp, #16 sub sp, sp, #64+32 @ allocate frame cfi_adjust_cfa_offset(64+32) -#ifdef __clang__ - vstm sp, {d0-d7} -#else stc p11, cr0, [sp], {16} @ vstm sp, {d0-d7} -#endif stmdb sp!, {ip,lr} /* See above. */ @@ -358,25 +337,13 @@ ARM_FUNC_START_LOCAL(ffi_closure_ret) cfi_rel_offset(lr, 4) 0: E(ARM_TYPE_VFP_S) -#ifdef __clang__ - vldr s0, [r2] -#else ldc p10, cr0, [r2] @ vldr s0, [r2] -#endif b call_epilogue E(ARM_TYPE_VFP_D) -#ifdef __clang__ - vldr d0, [r2] -#else ldc p11, cr0, [r2] @ vldr d0, [r2] -#endif b call_epilogue E(ARM_TYPE_VFP_N) -#ifdef __clang__ - vldm r2, {d0-d3} -#else ldc p11, cr0, [r2], {8} @ vldm r2, {d0-d3} -#endif b call_epilogue E(ARM_TYPE_INT64) ldr r1, [r2, #4] diff --git a/src/libffi/libffi-3.4.4/src/arm/sysv_msvc_arm32.S b/src/libffi/libffi-3.4.6/src/arm/sysv_msvc_arm32.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/arm/sysv_msvc_arm32.S rename to src/libffi/libffi-3.4.6/src/arm/sysv_msvc_arm32.S diff --git a/src/libffi/libffi-3.4.4/src/avr32/ffi.c b/src/libffi/libffi-3.4.6/src/avr32/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/avr32/ffi.c rename to src/libffi/libffi-3.4.6/src/avr32/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/avr32/ffitarget.h b/src/libffi/libffi-3.4.6/src/avr32/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/avr32/ffitarget.h rename to src/libffi/libffi-3.4.6/src/avr32/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/avr32/sysv.S b/src/libffi/libffi-3.4.6/src/avr32/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/avr32/sysv.S rename to src/libffi/libffi-3.4.6/src/avr32/sysv.S diff --git a/src/libffi/libffi-3.4.4/src/bfin/ffi.c b/src/libffi/libffi-3.4.6/src/bfin/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/bfin/ffi.c rename to src/libffi/libffi-3.4.6/src/bfin/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/bfin/ffitarget.h b/src/libffi/libffi-3.4.6/src/bfin/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/bfin/ffitarget.h rename to src/libffi/libffi-3.4.6/src/bfin/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/bfin/sysv.S b/src/libffi/libffi-3.4.6/src/bfin/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/bfin/sysv.S rename to src/libffi/libffi-3.4.6/src/bfin/sysv.S diff --git a/src/libffi/libffi-3.4.4/src/closures.c b/src/libffi/libffi-3.4.6/src/closures.c similarity index 98% rename from src/libffi/libffi-3.4.4/src/closures.c rename to src/libffi/libffi-3.4.6/src/closures.c index 9aafbec4b..67a94a822 100644 --- a/src/libffi/libffi-3.4.4/src/closures.c +++ b/src/libffi/libffi-3.4.6/src/closures.c @@ -31,6 +31,8 @@ #define _GNU_SOURCE 1 #endif +#ifndef __EMSCRIPTEN__ + #include #include #include @@ -597,7 +599,7 @@ open_temp_exec_file_memfd (const char *name) /* Open a temporary file name, and immediately unlink it. */ static int -open_temp_exec_file_name (char *name, int flags) +open_temp_exec_file_name (char *name, int flags MAYBE_UNUSED) { int fd; @@ -793,9 +795,9 @@ open_temp_exec_file (void) Failure to allocate the space will cause SIGBUS to be thrown when the mapping is subsequently written to. */ static int -allocate_space (int fd, off_t offset, off_t len) +allocate_space (int fd, off_t len) { - static size_t page_size; + static long page_size; /* Obtain system page size. */ if (!page_size) @@ -836,7 +838,7 @@ dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset) offset = execsize; - if (allocate_space (execfd, offset, length)) + if (allocate_space (execfd, length)) return MFAIL; flags &= ~(MAP_PRIVATE | MAP_ANONYMOUS); @@ -993,23 +995,23 @@ ffi_closure_alloc (size_t size, void **code) if (!code) return NULL; - ptr = FFI_CLOSURE_PTR (dlmalloc (size)); + ptr = dlmalloc (size); if (ptr) { msegmentptr seg = segment_holding (gm, ptr); - *code = add_segment_exec_offset (ptr, seg); + *code = FFI_FN (add_segment_exec_offset (ptr, seg)); if (!ffi_tramp_is_supported ()) return ptr; ftramp = ffi_tramp_alloc (0); if (ftramp == NULL) { - dlfree (FFI_RESTORE_PTR (ptr)); + dlfree (ptr); return NULL; } - *code = ffi_tramp_get_addr (ftramp); + *code = FFI_FN (ffi_tramp_get_addr (ftramp)); ((ffi_closure *) ptr)->ftramp = ftramp; } @@ -1050,7 +1052,7 @@ ffi_closure_free (void *ptr) if (ffi_tramp_is_supported ()) ffi_tramp_free (((ffi_closure *) ptr)->ftramp); - dlfree (FFI_RESTORE_PTR (ptr)); + dlfree (ptr); } int @@ -1070,16 +1072,20 @@ ffi_tramp_is_present (void *ptr) void * ffi_closure_alloc (size_t size, void **code) { + void *c; + if (!code) return NULL; - return *code = FFI_CLOSURE_PTR (malloc (size)); + c = malloc (size); + *code = FFI_FN (c); + return c; } void ffi_closure_free (void *ptr) { - free (FFI_RESTORE_PTR (ptr)); + free (ptr); } void * @@ -1098,3 +1104,4 @@ ffi_tramp_is_present (__attribute__((unused)) void *ptr) #endif /* FFI_CLOSURES */ #endif /* NetBSD with PROT_MPROTECT */ +#endif /* __EMSCRIPTEN__ */ diff --git a/src/libffi/libffi-3.4.4/src/cris/ffi.c b/src/libffi/libffi-3.4.6/src/cris/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/cris/ffi.c rename to src/libffi/libffi-3.4.6/src/cris/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/cris/ffitarget.h b/src/libffi/libffi-3.4.6/src/cris/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/cris/ffitarget.h rename to src/libffi/libffi-3.4.6/src/cris/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/cris/sysv.S b/src/libffi/libffi-3.4.6/src/cris/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/cris/sysv.S rename to src/libffi/libffi-3.4.6/src/cris/sysv.S diff --git a/src/libffi/libffi-3.4.4/src/csky/ffi.c b/src/libffi/libffi-3.4.6/src/csky/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/csky/ffi.c rename to src/libffi/libffi-3.4.6/src/csky/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/csky/ffitarget.h b/src/libffi/libffi-3.4.6/src/csky/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/csky/ffitarget.h rename to src/libffi/libffi-3.4.6/src/csky/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/csky/sysv.S b/src/libffi/libffi-3.4.6/src/csky/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/csky/sysv.S rename to src/libffi/libffi-3.4.6/src/csky/sysv.S diff --git a/src/libffi/libffi-3.4.4/src/debug.c b/src/libffi/libffi-3.4.6/src/debug.c similarity index 94% rename from src/libffi/libffi-3.4.4/src/debug.c rename to src/libffi/libffi-3.4.6/src/debug.c index f3172b1ef..63321dc01 100644 --- a/src/libffi/libffi-3.4.4/src/debug.c +++ b/src/libffi/libffi-3.4.6/src/debug.c @@ -38,7 +38,7 @@ void ffi_stop_here(void) /* This function should only be called via the FFI_ASSERT() macro */ -void ffi_assert(char *expr, char *file, int line) +NORETURN void ffi_assert(const char *expr, const char *file, int line) { fprintf(stderr, "ASSERTION FAILURE: %s at %s:%d\n", expr, file, line); ffi_stop_here(); @@ -47,7 +47,7 @@ void ffi_assert(char *expr, char *file, int line) /* Perform a sanity check on an ffi_type structure */ -void ffi_type_test(ffi_type *a, char *file, int line) +void ffi_type_test(ffi_type *a, const char *file, int line) { FFI_ASSERT_AT(a != NULL, file, line); diff --git a/src/libffi/libffi-3.4.4/src/dlmalloc.c b/src/libffi/libffi-3.4.6/src/dlmalloc.c similarity index 99% rename from src/libffi/libffi-3.4.4/src/dlmalloc.c rename to src/libffi/libffi-3.4.6/src/dlmalloc.c index 6f4a5f6c4..c61ef9240 100644 --- a/src/libffi/libffi-3.4.4/src/dlmalloc.c +++ b/src/libffi/libffi-3.4.6/src/dlmalloc.c @@ -4452,7 +4452,7 @@ struct mallinfo dlmallinfo(void) { } #endif /* NO_MALLINFO */ -void dlmalloc_stats() { +void dlmalloc_stats(void) { internal_malloc_stats(gm); } diff --git a/src/libffi/libffi-3.4.4/src/frv/eabi.S b/src/libffi/libffi-3.4.6/src/frv/eabi.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/frv/eabi.S rename to src/libffi/libffi-3.4.6/src/frv/eabi.S diff --git a/src/libffi/libffi-3.4.4/src/frv/ffi.c b/src/libffi/libffi-3.4.6/src/frv/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/frv/ffi.c rename to src/libffi/libffi-3.4.6/src/frv/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/frv/ffitarget.h b/src/libffi/libffi-3.4.6/src/frv/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/frv/ffitarget.h rename to src/libffi/libffi-3.4.6/src/frv/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/ia64/ffi.c b/src/libffi/libffi-3.4.6/src/ia64/ffi.c similarity index 98% rename from src/libffi/libffi-3.4.4/src/ia64/ffi.c rename to src/libffi/libffi-3.4.6/src/ia64/ffi.c index b1d04c3e7..1395f26a8 100644 --- a/src/libffi/libffi-3.4.4/src/ia64/ffi.c +++ b/src/libffi/libffi-3.4.6/src/ia64/ffi.c @@ -38,7 +38,11 @@ /* A 64-bit pointer value. In LP64 mode, this is effectively a plain pointer. In ILP32 mode, it's a pointer that's been extended to 64 bits by "addp4". */ +#ifdef __hpux +typedef void *PTR64; +#else // some other unix typedef void *PTR64 __attribute__((mode(DI))); +#endif /* Memory image of fp register contents. This is the implementation specific format used by ldf.fill/stf.spill. All we care about is @@ -76,14 +80,22 @@ endian_adjust (void *addr, size_t len) point types without type conversions. Type conversion to long double breaks the denorm support. */ +#ifdef __hpux +#define stf_spill(addr, value) +#else #define stf_spill(addr, value) \ asm ("stf.spill %0 = %1%P0" : "=m" (*addr) : "f"(value)); +#endif /* Load a value from ADDR, which is in the current cpu implementation's fp spill format. As above, this must also be a macro. */ +#ifdef __hpux +#define ldf_fill(result, addr) +#else #define ldf_fill(result, addr) \ asm ("ldf.fill %0 = %1%P1" : "=f"(result) : "m"(*addr)); +#endif /* Return the size of the C type associated with with TYPE. Which will be one of the FFI_IA64_TYPE_HFA_* values. */ diff --git a/src/libffi/libffi-3.4.4/src/ia64/ffitarget.h b/src/libffi/libffi-3.4.6/src/ia64/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/ia64/ffitarget.h rename to src/libffi/libffi-3.4.6/src/ia64/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/ia64/ia64_flags.h b/src/libffi/libffi-3.4.6/src/ia64/ia64_flags.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/ia64/ia64_flags.h rename to src/libffi/libffi-3.4.6/src/ia64/ia64_flags.h diff --git a/src/libffi/libffi-3.4.4/src/ia64/unix.S b/src/libffi/libffi-3.4.6/src/ia64/unix.S similarity index 96% rename from src/libffi/libffi-3.4.4/src/ia64/unix.S rename to src/libffi/libffi-3.4.6/src/ia64/unix.S index e2547e02b..04908368c 100644 --- a/src/libffi/libffi-3.4.4/src/ia64/unix.S +++ b/src/libffi/libffi-3.4.6/src/ia64/unix.S @@ -36,6 +36,12 @@ .pred.safe_across_calls p1-p5,p16-p63 .text +/* HPUX assembler needs to see these symbols, otherwise compilation + fails */ +#ifdef __hpux + .global memcpy + .global ffi_closure_unix_inner +#endif /* int ffi_call_unix (struct ia64_args *stack, PTR64 rvalue, void (*fn)(void), int flags); @@ -104,7 +110,12 @@ ffi_call_unix: mov ar.pfs = loc0 addl r18 = @ltoffx(.Lst_table), gp ;; + /* default assembler on HP-UX does not support LDXMOV */ +#ifdef __hpux + ld8 r18 = [r18] +#else ld8.mov r18 = [r18], .Lst_table +#endif mov b0 = loc1 ;; shladd r18 = r16, 3, r18 @@ -357,7 +368,11 @@ ffi_closure_unix: addl r18 = @ltoffx(.Lld_table), gp mov ar.pfs = loc0 ;; - ld8.mov r18 = [r18], .Lld_table +#ifdef __hpux + ld8 r18 = [r18] +#else + ld8.mov r18 = [r18], .Lst_table +#endif mov b0 = loc1 ;; shladd r18 = r16, 3, r18 @@ -515,8 +530,11 @@ ffi_closure_unix: ;; .endp ffi_closure_unix - +#ifdef __hpux + .rodata +#else .section .rodata +#endif .align 8 .Lst_table: data8 @pcrel(.Lst_void) // FFI_TYPE_VOID diff --git a/src/libffi/libffi-3.4.4/src/java_raw_api.c b/src/libffi/libffi-3.4.6/src/java_raw_api.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/java_raw_api.c rename to src/libffi/libffi-3.4.6/src/java_raw_api.c diff --git a/src/libffi/libffi-3.4.4/src/kvx/asm.h b/src/libffi/libffi-3.4.6/src/kvx/asm.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/kvx/asm.h rename to src/libffi/libffi-3.4.6/src/kvx/asm.h diff --git a/src/libffi/libffi-3.4.4/src/kvx/ffi.c b/src/libffi/libffi-3.4.6/src/kvx/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/kvx/ffi.c rename to src/libffi/libffi-3.4.6/src/kvx/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/kvx/ffitarget.h b/src/libffi/libffi-3.4.6/src/kvx/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/kvx/ffitarget.h rename to src/libffi/libffi-3.4.6/src/kvx/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/kvx/sysv.S b/src/libffi/libffi-3.4.6/src/kvx/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/kvx/sysv.S rename to src/libffi/libffi-3.4.6/src/kvx/sysv.S diff --git a/src/libffi/libffi-3.4.4/src/loongarch64/ffi.c b/src/libffi/libffi-3.4.6/src/loongarch64/ffi.c similarity index 99% rename from src/libffi/libffi-3.4.4/src/loongarch64/ffi.c rename to src/libffi/libffi-3.4.6/src/loongarch64/ffi.c index 140be3bc3..93c337749 100644 --- a/src/libffi/libffi-3.4.4/src/loongarch64/ffi.c +++ b/src/libffi/libffi-3.4.6/src/loongarch64/ffi.c @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -58,7 +59,9 @@ */ typedef struct call_context { +#if !defined(__loongarch_soft_float) ABI_FLOAT fa[8]; +#endif size_t a[10]; } call_context; diff --git a/src/libffi/libffi-3.4.4/src/loongarch64/ffitarget.h b/src/libffi/libffi-3.4.6/src/loongarch64/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/loongarch64/ffitarget.h rename to src/libffi/libffi-3.4.6/src/loongarch64/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/loongarch64/sysv.S b/src/libffi/libffi-3.4.6/src/loongarch64/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/loongarch64/sysv.S rename to src/libffi/libffi-3.4.6/src/loongarch64/sysv.S diff --git a/src/libffi/libffi-3.4.4/src/m32r/ffi.c b/src/libffi/libffi-3.4.6/src/m32r/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/m32r/ffi.c rename to src/libffi/libffi-3.4.6/src/m32r/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/m32r/ffitarget.h b/src/libffi/libffi-3.4.6/src/m32r/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/m32r/ffitarget.h rename to src/libffi/libffi-3.4.6/src/m32r/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/m32r/sysv.S b/src/libffi/libffi-3.4.6/src/m32r/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/m32r/sysv.S rename to src/libffi/libffi-3.4.6/src/m32r/sysv.S diff --git a/src/libffi/libffi-3.4.4/src/m68k/ffi.c b/src/libffi/libffi-3.4.6/src/m68k/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/m68k/ffi.c rename to src/libffi/libffi-3.4.6/src/m68k/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/m68k/ffitarget.h b/src/libffi/libffi-3.4.6/src/m68k/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/m68k/ffitarget.h rename to src/libffi/libffi-3.4.6/src/m68k/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/m68k/sysv.S b/src/libffi/libffi-3.4.6/src/m68k/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/m68k/sysv.S rename to src/libffi/libffi-3.4.6/src/m68k/sysv.S diff --git a/src/libffi/libffi-3.4.4/src/m88k/ffi.c b/src/libffi/libffi-3.4.6/src/m88k/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/m88k/ffi.c rename to src/libffi/libffi-3.4.6/src/m88k/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/m88k/ffitarget.h b/src/libffi/libffi-3.4.6/src/m88k/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/m88k/ffitarget.h rename to src/libffi/libffi-3.4.6/src/m88k/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/m88k/obsd.S b/src/libffi/libffi-3.4.6/src/m88k/obsd.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/m88k/obsd.S rename to src/libffi/libffi-3.4.6/src/m88k/obsd.S diff --git a/src/libffi/libffi-3.4.4/src/metag/ffi.c b/src/libffi/libffi-3.4.6/src/metag/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/metag/ffi.c rename to src/libffi/libffi-3.4.6/src/metag/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/metag/ffitarget.h b/src/libffi/libffi-3.4.6/src/metag/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/metag/ffitarget.h rename to src/libffi/libffi-3.4.6/src/metag/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/metag/sysv.S b/src/libffi/libffi-3.4.6/src/metag/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/metag/sysv.S rename to src/libffi/libffi-3.4.6/src/metag/sysv.S diff --git a/src/libffi/libffi-3.4.4/src/microblaze/ffi.c b/src/libffi/libffi-3.4.6/src/microblaze/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/microblaze/ffi.c rename to src/libffi/libffi-3.4.6/src/microblaze/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/microblaze/ffitarget.h b/src/libffi/libffi-3.4.6/src/microblaze/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/microblaze/ffitarget.h rename to src/libffi/libffi-3.4.6/src/microblaze/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/microblaze/sysv.S b/src/libffi/libffi-3.4.6/src/microblaze/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/microblaze/sysv.S rename to src/libffi/libffi-3.4.6/src/microblaze/sysv.S diff --git a/src/libffi/libffi-3.4.4/src/mips/ffi.c b/src/libffi/libffi-3.4.6/src/mips/ffi.c similarity index 98% rename from src/libffi/libffi-3.4.4/src/mips/ffi.c rename to src/libffi/libffi-3.4.6/src/mips/ffi.c index e7043258f..5c8c6bc5d 100644 --- a/src/libffi/libffi-3.4.4/src/mips/ffi.c +++ b/src/libffi/libffi-3.4.6/src/mips/ffi.c @@ -647,9 +647,9 @@ static ffi_status ffi_prep_cif_machdep_int(ffi_cif *cif, unsigned nfixedargs) case FFI_TYPE_POINTER: if (cif->abi == FFI_N32_SOFT_FLOAT || cif->abi == FFI_N32) - cif->flags += FFI_TYPE_UINT32 << (FFI_FLAG_BITS * 8); + cif->flags += FFI_TYPE_SINT32 << (FFI_FLAG_BITS * 8); else - cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8); + cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 8); break; case FFI_TYPE_FLOAT: @@ -661,7 +661,7 @@ static ffi_status ffi_prep_cif_machdep_int(ffi_cif *cif, unsigned nfixedargs) /* else fall through */ case FFI_TYPE_DOUBLE: if (soft_float) - cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8); + cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 8); else cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 8); break; @@ -715,8 +715,16 @@ static ffi_status ffi_prep_cif_machdep_int(ffi_cif *cif, unsigned nfixedargs) } break; } + case FFI_TYPE_UINT32: + /* In the N32 or N64 ABI unsigned 32-bit integer should be + *sign*-extended. */ + cif->flags += FFI_TYPE_SINT32 << (FFI_FLAG_BITS * 8); + break; + case FFI_TYPE_SINT64: + cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 8); + break; default: - cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8); + cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 8); break; } } diff --git a/src/libffi/libffi-3.4.4/src/mips/ffitarget.h b/src/libffi/libffi-3.4.6/src/mips/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/mips/ffitarget.h rename to src/libffi/libffi-3.4.6/src/mips/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/mips/n32.S b/src/libffi/libffi-3.4.6/src/mips/n32.S similarity index 93% rename from src/libffi/libffi-3.4.4/src/mips/n32.S rename to src/libffi/libffi-3.4.6/src/mips/n32.S index e1938d114..df58e800a 100644 --- a/src/libffi/libffi-3.4.4/src/mips/n32.S +++ b/src/libffi/libffi-3.4.6/src/mips/n32.S @@ -236,19 +236,54 @@ callit: # Shift the return type flag over SRL t6, 8*FFI_FLAG_BITS - beq t6, FFI_TYPE_SINT32, retint - bne t6, FFI_TYPE_INT, retuint32 -retint: + bne t6, FFI_TYPE_UINT64, retsint32 + +retuint64: jal t9 REG_L t4, 4*FFI_SIZEOF_ARG($fp) - REG_S v0, 0(t4) + sd v0, 0(t4) b epilogue -retuint32: - bne t6, FFI_TYPE_UINT32, retfloat +retsint32: + bne t6, FFI_TYPE_SINT32, retuint16 jal t9 REG_L t4, 4*FFI_SIZEOF_ARG($fp) - sw v0, 0(t4) + sll v0, v0, 0 + sd v0, 0(t4) + b epilogue + +retuint16: + bne t6, FFI_TYPE_UINT16, retsint16 + jal t9 + REG_L t4, 4*FFI_SIZEOF_ARG($fp) + andi v0, v0, 0xffff + sd v0, 0(t4) + b epilogue + +retsint16: + bne t6, FFI_TYPE_SINT16, retuint8 + jal t9 + REG_L t4, 4*FFI_SIZEOF_ARG($fp) + dsll v0, v0, 48 + dsra v0, v0, 48 + sd v0, 0(t4) + b epilogue + +retuint8: + bne t6, FFI_TYPE_UINT8, retsint8 + jal t9 + REG_L t4, 4*FFI_SIZEOF_ARG($fp) + andi v0, v0, 0xff + sd v0, 0(t4) + b epilogue + +retsint8: + bne t6, FFI_TYPE_SINT8, retfloat + jal t9 + REG_L t4, 4*FFI_SIZEOF_ARG($fp) + sd v0, 0(t4) + dsll v0, v0, 56 + dsra v0, v0, 56 b epilogue retfloat: @@ -585,19 +620,35 @@ $do_closure: jalr t9 +cls_retuint64: # Return flags are in v0 - bne v0, FFI_TYPE_SINT32, cls_retuint32 + bne v0, FFI_TYPE_UINT64, cls_retsint32 + ld v0, V0_OFF2($sp) + b cls_epilogue + +cls_retsint32: + bne v0, FFI_TYPE_SINT32, cls_retsint16 lw v0, V0_OFF2($sp) b cls_epilogue -cls_retuint32: - bne v0, FFI_TYPE_UINT32, cls_retint - lwu v0, V0_OFF2($sp) +cls_retsint16: + bne v0, FFI_TYPE_SINT16, cls_retuint16 + lh v0, V0_OFF2($sp) b cls_epilogue -cls_retint: - bne v0, FFI_TYPE_INT, cls_retfloat - REG_L v0, V0_OFF2($sp) +cls_retuint16: + bne v0, FFI_TYPE_UINT16, cls_retsint8 + lhu v0, V0_OFF2($sp) + b cls_epilogue + +cls_retsint8: + bne v0, FFI_TYPE_SINT8, cls_retuint8 + lb v0, V0_OFF2($sp) + b cls_epilogue + +cls_retuint8: + bne v0, FFI_TYPE_UINT8, cls_retfloat + lbu v0, V0_OFF2($sp) b cls_epilogue cls_retfloat: diff --git a/src/libffi/libffi-3.4.4/src/mips/o32.S b/src/libffi/libffi-3.4.6/src/mips/o32.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/mips/o32.S rename to src/libffi/libffi-3.4.6/src/mips/o32.S diff --git a/src/libffi/libffi-3.4.4/src/moxie/eabi.S b/src/libffi/libffi-3.4.6/src/moxie/eabi.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/moxie/eabi.S rename to src/libffi/libffi-3.4.6/src/moxie/eabi.S diff --git a/src/libffi/libffi-3.4.4/src/moxie/ffi.c b/src/libffi/libffi-3.4.6/src/moxie/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/moxie/ffi.c rename to src/libffi/libffi-3.4.6/src/moxie/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/moxie/ffitarget.h b/src/libffi/libffi-3.4.6/src/moxie/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/moxie/ffitarget.h rename to src/libffi/libffi-3.4.6/src/moxie/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/nios2/ffi.c b/src/libffi/libffi-3.4.6/src/nios2/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/nios2/ffi.c rename to src/libffi/libffi-3.4.6/src/nios2/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/nios2/ffitarget.h b/src/libffi/libffi-3.4.6/src/nios2/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/nios2/ffitarget.h rename to src/libffi/libffi-3.4.6/src/nios2/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/nios2/sysv.S b/src/libffi/libffi-3.4.6/src/nios2/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/nios2/sysv.S rename to src/libffi/libffi-3.4.6/src/nios2/sysv.S diff --git a/src/libffi/libffi-3.4.4/src/or1k/ffi.c b/src/libffi/libffi-3.4.6/src/or1k/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/or1k/ffi.c rename to src/libffi/libffi-3.4.6/src/or1k/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/or1k/ffitarget.h b/src/libffi/libffi-3.4.6/src/or1k/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/or1k/ffitarget.h rename to src/libffi/libffi-3.4.6/src/or1k/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/or1k/sysv.S b/src/libffi/libffi-3.4.6/src/or1k/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/or1k/sysv.S rename to src/libffi/libffi-3.4.6/src/or1k/sysv.S diff --git a/src/libffi/libffi-3.4.4/src/pa/ffi.c b/src/libffi/libffi-3.4.6/src/pa/ffi.c similarity index 93% rename from src/libffi/libffi-3.4.4/src/pa/ffi.c rename to src/libffi/libffi-3.4.6/src/pa/ffi.c index 95e669473..f6012397e 100644 --- a/src/libffi/libffi-3.4.4/src/pa/ffi.c +++ b/src/libffi/libffi-3.4.6/src/pa/ffi.c @@ -56,27 +56,12 @@ static inline int ffi_struct_type(ffi_type *t) size_t sz = t->size; /* Small structure results are passed in registers, - larger ones are passed by pointer. Note that - small structures of size 2, 4 and 8 differ from - the corresponding integer types in that they have - different alignment requirements. */ - - if (sz <= 1) - return FFI_TYPE_UINT8; - else if (sz == 2) - return FFI_TYPE_SMALL_STRUCT2; - else if (sz == 3) - return FFI_TYPE_SMALL_STRUCT3; - else if (sz == 4) - return FFI_TYPE_SMALL_STRUCT4; - else if (sz == 5) - return FFI_TYPE_SMALL_STRUCT5; - else if (sz == 6) - return FFI_TYPE_SMALL_STRUCT6; - else if (sz == 7) - return FFI_TYPE_SMALL_STRUCT7; - else if (sz <= 8) - return FFI_TYPE_SMALL_STRUCT8; + larger ones are passed by pointer. Note that small + structures differ from the corresponding integer + types in that they have different alignment requirements. */ + + if (sz <= 8) + return -sz; else return FFI_TYPE_STRUCT; /* else, we pass it by pointer. */ } @@ -376,10 +361,26 @@ extern void ffi_call_pa32(void (*)(UINT32 *, extended_cif *, unsigned), void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; + size_t i, nargs = cif->nargs; + ffi_type **arg_types = cif->arg_types; ecif.cif = cif; ecif.avalue = avalue; + /* If we have any large structure arguments, make a copy so we are passing + by value. */ + for (i = 0; i < nargs; i++) + { + ffi_type *at = arg_types[i]; + int size = at->size; + if (at->type == FFI_TYPE_STRUCT && size > 8) + { + char *argcopy = alloca (size); + memcpy (argcopy, avalue[i], size); + avalue[i] = argcopy; + } + } + /* If the return value is a struct and we don't have a return value address then we need to make one. */ @@ -429,7 +430,6 @@ ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack) int i, avn; unsigned int slot = FIRST_ARG_SLOT; register UINT32 r28 asm("r28"); - ffi_closure *c = (ffi_closure *)FFI_RESTORE_PTR (closure); cif = closure->cif; @@ -532,7 +532,7 @@ ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack) } /* Invoke the closure. */ - (c->fun) (cif, rvalue, avalue, c->user_data); + (closure->fun) (cif, rvalue, avalue, closure->user_data); debug(3, "after calling function, ret[0] = %08x, ret[1] = %08x\n", u.ret[0], u.ret[1]); @@ -541,16 +541,16 @@ ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack) switch (cif->flags) { case FFI_TYPE_UINT8: - *(stack - FIRST_ARG_SLOT) = (UINT8)(u.ret[0] >> 24); + *(stack - FIRST_ARG_SLOT) = (UINT8)u.ret[0]; break; case FFI_TYPE_SINT8: - *(stack - FIRST_ARG_SLOT) = (SINT8)(u.ret[0] >> 24); + *(stack - FIRST_ARG_SLOT) = (SINT8)u.ret[0]; break; case FFI_TYPE_UINT16: - *(stack - FIRST_ARG_SLOT) = (UINT16)(u.ret[0] >> 16); + *(stack - FIRST_ARG_SLOT) = (UINT16)u.ret[0]; break; case FFI_TYPE_SINT16: - *(stack - FIRST_ARG_SLOT) = (SINT16)(u.ret[0] >> 16); + *(stack - FIRST_ARG_SLOT) = (SINT16)u.ret[0]; break; case FFI_TYPE_INT: case FFI_TYPE_SINT32: @@ -575,6 +575,7 @@ ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack) /* Don't need a return value, done by caller. */ break; + case FFI_TYPE_SMALL_STRUCT1: case FFI_TYPE_SMALL_STRUCT2: case FFI_TYPE_SMALL_STRUCT3: case FFI_TYPE_SMALL_STRUCT4: @@ -633,8 +634,6 @@ ffi_prep_closure_loc (ffi_closure* closure, void *user_data, void *codeloc) { - ffi_closure *c = (ffi_closure *)FFI_RESTORE_PTR (closure); - /* The layout of a function descriptor. A function pointer with the PLABEL bit set points to a function descriptor. */ struct pa32_fd @@ -660,14 +659,14 @@ ffi_prep_closure_loc (ffi_closure* closure, fd = (struct pa32_fd *)((UINT32)ffi_closure_pa32 & ~3); /* Setup trampoline. */ - tramp = (struct ffi_pa32_trampoline_struct *)c->tramp; + tramp = (struct ffi_pa32_trampoline_struct *)closure->tramp; tramp->code_pointer = fd->code_pointer; tramp->fake_gp = (UINT32)codeloc & ~3; tramp->real_gp = fd->gp; - c->cif = cif; - c->user_data = user_data; - c->fun = fun; + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; return FFI_OK; } diff --git a/src/libffi/libffi-3.4.4/src/pa/ffitarget.h b/src/libffi/libffi-3.4.6/src/pa/ffitarget.h similarity index 77% rename from src/libffi/libffi-3.4.4/src/pa/ffitarget.h rename to src/libffi/libffi-3.4.6/src/pa/ffitarget.h index df1209eb1..dae854a69 100644 --- a/src/libffi/libffi-3.4.4/src/pa/ffitarget.h +++ b/src/libffi/libffi-3.4.6/src/pa/ffitarget.h @@ -54,7 +54,6 @@ typedef enum ffi_abi { #endif #ifdef PA64_HPUX -#error "PA64_HPUX FFI is not yet implemented" FFI_PA64, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_PA64 @@ -68,13 +67,28 @@ typedef enum ffi_abi { #define FFI_CLOSURES 1 #define FFI_NATIVE_RAW_API 0 +#if defined(PA64_HPUX) +#define FFI_TRAMPOLINE_SIZE 32 +#else #define FFI_TRAMPOLINE_SIZE 12 +#endif + +#define FFI_TYPE_SMALL_STRUCT1 -1 +#define FFI_TYPE_SMALL_STRUCT2 -2 +#define FFI_TYPE_SMALL_STRUCT3 -3 +#define FFI_TYPE_SMALL_STRUCT4 -4 +#define FFI_TYPE_SMALL_STRUCT5 -5 +#define FFI_TYPE_SMALL_STRUCT6 -6 +#define FFI_TYPE_SMALL_STRUCT7 -7 +#define FFI_TYPE_SMALL_STRUCT8 -8 + +/* linux.S and hpux32.S expect FFI_TYPE_COMPLEX is the last generic type. */ +#define FFI_PA_TYPE_LAST FFI_TYPE_COMPLEX + +/* If new generic types are added, the jump tables in linux.S and hpux32.S + likely need updating. */ +#if FFI_TYPE_LAST != FFI_PA_TYPE_LAST +# error "You likely have broken jump tables" +#endif -#define FFI_TYPE_SMALL_STRUCT2 -1 -#define FFI_TYPE_SMALL_STRUCT3 -2 -#define FFI_TYPE_SMALL_STRUCT4 -3 -#define FFI_TYPE_SMALL_STRUCT5 -4 -#define FFI_TYPE_SMALL_STRUCT6 -5 -#define FFI_TYPE_SMALL_STRUCT7 -6 -#define FFI_TYPE_SMALL_STRUCT8 -7 #endif diff --git a/src/libffi/libffi-3.4.4/src/pa/hpux32.S b/src/libffi/libffi-3.4.6/src/pa/hpux32.S similarity index 88% rename from src/libffi/libffi-3.4.4/src/pa/hpux32.S rename to src/libffi/libffi-3.4.6/src/pa/hpux32.S index d0e5f6952..1629c0356 100644 --- a/src/libffi/libffi-3.4.4/src/pa/hpux32.S +++ b/src/libffi/libffi-3.4.6/src/pa/hpux32.S @@ -109,52 +109,104 @@ L$CFI13 /* Prepare to store the result; we need to recover flags and rvalue. */ ldw -48(%r3), %r21 ; r21 <- flags - ldw -52(%r3), %r20 ; r20 <- rvalue - /* Store the result according to the return type. The most - likely types should come first. */ + /* Adjust flags range from [-8, 15] to [0, 23]. */ + addi 8, %r21, %r21 -L$checkint - comib,<>,n FFI_TYPE_INT, %r21, L$checkint8 - b L$done - stw %ret0, 0(%r20) + blr %r21, %r0 + ldw -52(%r3), %r20 ; r20 <- rvalue -L$checkint8 - comib,<>,n FFI_TYPE_UINT8, %r21, L$checkint16 + /* Giant jump table */ + /* 8-byte small struct */ + b,n L$smst8 + nop + /* 7-byte small struct */ + b,n L$smst7 + nop + /* 6-byte small struct */ + b,n L$smst6 + nop + /* 5-byte small struct */ + b,n L$smst5 + nop + /* 4-byte small struct */ + b,n L$smst4 + nop + /* 3-byte small struct */ + b,n L$smst3 + nop + /* 2-byte small struct */ + b,n L$smst2 + nop + /* 1-byte small struct */ b L$done stb %ret0, 0(%r20) - -L$checkint16 - comib,<>,n FFI_TYPE_UINT16, %r21, L$checkdbl + /* void */ + b,n L$done + nop + /* int */ b L$done - sth %ret0, 0(%r20) - -L$checkdbl - comib,<>,n FFI_TYPE_DOUBLE, %r21, L$checkfloat + stw %ret0, 0(%r20) + /* float */ + b L$done + fstw %fr4L,0(%r20) + /* double */ b L$done fstd %fr4,0(%r20) - -L$checkfloat - comib,<>,n FFI_TYPE_FLOAT, %r21, L$checkll + /* long double */ + b,n L$done + nop + /* unsigned int8 */ b L$done - fstw %fr4L,0(%r20) + stw %ret0, 0(%r20) + /* signed int8 */ + b L$done + stw %ret0, 0(%r20) + /* unsigned int16 */ + b L$done + stw %ret0, 0(%r20) + /* signed int16 */ + b L$done + stw %ret0, 0(%r20) + /* unsigned int32 */ + b L$done + stw %ret0, 0(%r20) + /* signed int32 */ + b L$done + stw %ret0, 0(%r20) + /* unsigned int64 */ + b,n L$uint64 + nop + /* signed int64 */ + b,n L$sint64 + nop + /* large struct */ + b,n L$done + nop + /* pointer */ + b L$done + stw %ret0, 0(%r20) + /* complex */ + b,n L$done + nop + + /* Store the result according to the return type. The most + likely types should come first. */ -L$checkll - comib,<>,n FFI_TYPE_UINT64, %r21, L$checksmst2 +L$uint64 +L$sint64 stw %ret0, 0(%r20) b L$done stw %ret1, 4(%r20) -L$checksmst2 - comib,<>,n FFI_TYPE_SMALL_STRUCT2, %r21, L$checksmst3 +L$smst2 /* 2-byte structs are returned in ret0 as ????xxyy. */ extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) b L$done stb %ret0, 0(%r20) -L$checksmst3 - comib,<>,n FFI_TYPE_SMALL_STRUCT3, %r21, L$checksmst4 +L$smst3 /* 3-byte structs are returned in ret0 as ??xxyyzz. */ extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) @@ -163,8 +215,7 @@ L$checksmst3 b L$done stb %ret0, 0(%r20) -L$checksmst4 - comib,<>,n FFI_TYPE_SMALL_STRUCT4, %r21, L$checksmst5 +L$smst4 /* 4-byte structs are returned in ret0 as wwxxyyzz. */ extru %ret0, 7, 8, %r22 stbs,ma %r22, 1(%r20) @@ -175,8 +226,7 @@ L$checksmst4 b L$done stb %ret0, 0(%r20) -L$checksmst5 - comib,<>,n FFI_TYPE_SMALL_STRUCT5, %r21, L$checksmst6 +L$smst5 /* 5 byte values are returned right justified: ret0 ret1 5: ??????aa bbccddee */ @@ -190,8 +240,7 @@ L$checksmst5 b L$done stb %ret1, 0(%r20) -L$checksmst6 - comib,<>,n FFI_TYPE_SMALL_STRUCT6, %r21, L$checksmst7 +L$smst6 /* 6 byte values are returned right justified: ret0 ret1 6: ????aabb ccddeeff */ @@ -207,8 +256,7 @@ L$checksmst6 b L$done stb %ret1, 0(%r20) -L$checksmst7 - comib,<>,n FFI_TYPE_SMALL_STRUCT7, %r21, L$checksmst8 +L$smst7 /* 7 byte values are returned right justified: ret0 ret1 7: ??aabbcc ddeeffgg */ @@ -226,8 +274,7 @@ L$checksmst7 b L$done stb %ret1, 0(%r20) -L$checksmst8 - comib,<>,n FFI_TYPE_SMALL_STRUCT8, %r21, L$done +L$smst8 /* 8 byte values are returned right justified: ret0 ret1 8: aabbccdd eeffgghh */ diff --git a/src/libffi/libffi-3.4.6/src/pa/hpux64.S b/src/libffi/libffi-3.4.6/src/pa/hpux64.S new file mode 100644 index 000000000..6a82b57ec --- /dev/null +++ b/src/libffi/libffi-3.4.6/src/pa/hpux64.S @@ -0,0 +1,681 @@ +/* ----------------------------------------------------------------------- + hpux64.S - (c) 2005-2022 John David Anglin + + HPUX PA 64-Bit Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + + .LEVEL 2.0w + .text + .align 4 + + /* void ffi_call_pa64(void (*)(char *, extended_cif *), + extended_cif *ecif, + unsigned bytes, + unsigned flags, + unsigned *rvalue, + void (*fn)()); + */ + + .export ffi_call_pa64,code + .import ffi_prep_args_pa64,code + + .align 4 + +L$FB1 +ffi_call_pa64 + .proc + .callinfo FRAME=48,CALLS,SAVE_RP,ENTRY_GR=4 + .entry + std %rp, -16(%sp) + copy %r3, %r1 +L$CFI11 + copy %sp, %r3 +L$CFI12 + std,ma %r1, 48(%sp) + + /* Setup the stack for calling prep_args... + We want the stack to look like this: + + [ Previous stack ] <- %r3 + + [ 48-byte register save area ] + + [ Stack space for call arguments ] <- %r4 + + [ 16-byte rame marker ] + + [ 128-byte stack for calling prep_args ] <- %sp + */ + + std %r4, 8(%r3) ; save r4 +L$CFI13 + std %r23, 16(%r3) ; save flags we need it later + std %r22, 24(%r3) ; save rvalue + std %r21, 32(%r3) ; save fn pointer + + copy %sp, %r4 + copy %r4, %r26 ; argument stack pointer + addl %r24, %sp, %sp ; allocate argument space + + ldo 112(%sp), %r29 ; arg pointer for prep args + + /* Call prep_args: + %arg0(stack) -- set up above to point to call arguments + %arg1(ecif) -- same as incoming param + %arg2(bytes) -- same as incoming param */ + bl ffi_prep_args_pa64,%r2 + ldo 128(%sp), %sp + ldo -128(%sp), %sp + + /* Load the arguments that should be passed in registers + The fp args were loaded by the prep_args function. */ + ldd 0(%r4), %r26 + ldd 8(%r4), %r25 + ldd 16(%r4), %r24 + ldd 24(%r4), %r23 + ldd 32(%r4), %r22 + ldd 40(%r4), %r21 + ldd 48(%r4), %r20 + ldd 56(%r4), %r19 + + ldd 24(%r3), %ret0 ; %ret0 <- rvalue + + ldd 32(%r3), %r1 ; %r1 <- function pointer + ldd 16(%r1), %rp ; fn address + ldd 24(%r1), %dp ; New gp + bve,l (%rp), %r2 ; Call the user function + ldo 64(%r4), %r29 ; Argument pointer + + /* Prepare to store the result; recover flags and rvalue. */ + ldd 16(%r3), %r21 ; r21 <- flags + extrd,s %r21, 63, 32, %r21 ; sign extend flags for blr + + /* Adjust flags range from [-16, 15] to [0, 31]. */ + addi 16, %r21, %r21 + + blr %r21, %r0 + ldd 24(%r3), %r20 ; r20 <- rvalue + + /* Giant jump table */ + /* 16-byte small struct */ + b,n L$smst16 + nop + /* 15-byte small struct */ + b,n L$smst15 + nop + /* 14-byte small struct */ + b,n L$smst14 + nop + /* 13-byte small struct */ + b,n L$smst13 + nop + /* 12-byte small struct */ + b,n L$smst12 + nop + /* 11-byte small struct */ + b,n L$smst11 + nop + /* 10-byte small struct */ + b,n L$smst10 + nop + /* 9-byte small struct */ + b,n L$smst9 + nop + /* 8-byte small struct */ + b,n L$smst8 + nop + /* 7-byte small struct */ + b,n L$smst7 + nop + /* 6-byte small struct */ + b,n L$smst6 + nop + /* 5-byte small struct */ + b,n L$smst5 + nop + /* 4-byte small struct */ + b,n L$smst4 + nop + /* 3-byte small struct */ + b,n L$smst3 + nop + /* 2-byte small struct */ + b,n L$smst2 + nop + /* 1-byte small struct */ + b,n L$smst1 + nop + /* void */ + b,n L$done + nop + /* int */ + b L$done + std %ret0, 0(%r20) + /* float */ + b L$done + fstw %fr4R, 0(%r20) + /* double */ + b L$done + fstd %fr4, 0(%r20) + /* long double */ + b,n L$longdouble + nop + /* unsigned int8 */ + b L$done + std %ret0, 0(%r20) + /* signed int8 */ + b L$done + std %ret0, 0(%r20) + /* unsigned int16 */ + b L$done + std %ret0, 0(%r20) + /* signed int16 */ + b L$done + std %ret0, 0(%r20) + /* unsigned int32 */ + b L$done + std %ret0, 0(%r20) + /* signed int32 */ + b L$done + std %ret0, 0(%r20) + /* unsigned int64 */ + b L$done + std %ret0, 0(%r20) + /* signed int64 */ + b L$done + std %ret0, 0(%r20) + /* large struct */ + b,n L$done + nop + /* pointer */ + b L$done + std %ret0, 0(%r20) + /* complex */ + b,n L$done + nop + +L$longdouble + std %ret0, 0(%r20) + b L$done + std %ret1, 8(%r20) + + /* We need to copy byte-by-byte the exact number bytes + in the struct to avoid clobbering other data. */ +L$smst1 + extrd,u %ret0, 7, 8, %r22 + b L$done + stb %r22, 0(%r20) + +L$smst2 + extrd,u %ret0, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 15, 8, %r22 + b L$done + stb %r22, 0(%r20) + +L$smst3 + extrd,u %ret0, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 23, 8, %r22 + b L$done + stb %r22, 0(%r20) + +L$smst4 + extrd,u %ret0, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 31, 8, %r22 + b L$done + stb %r22, 0(%r20) + +L$smst5 + extrd,u %ret0, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 31, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 39, 8, %r22 + b L$done + stb %r22, 0(%r20) + +L$smst6 + extrd,u %ret0, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 31, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 39, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 47, 8, %r22 + b L$done + stb %r22, 0(%r20) + +L$smst7 + extrd,u %ret0, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 31, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 39, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 47, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 55, 8, %r22 + b L$done + stb %r22, 0(%r20) + +L$smst8 + extrd,u %ret0, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 31, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 39, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 47, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 55, 8, %r22 + stb,ma %r22, 1(%r20) + b L$done + stb %ret0, 0(%r20) + +L$smst9 + extrd,u %ret0, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 31, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 39, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 47, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 55, 8, %r22 + stb,ma %r22, 1(%r20) + stb,ma %ret0, 1(%r20) + extrd,u %ret1, 7, 8, %r22 + b L$done + stb %r22, 0(%r20) + +L$smst10 + extrd,u %ret0, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 31, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 39, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 47, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 55, 8, %r22 + stb,ma %r22, 1(%r20) + stb,ma %ret0, 1(%r20) + extrd,u %ret1, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 15, 8, %r22 + b L$done + stb %r22, 0(%r20) + +L$smst11 + extrd,u %ret0, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 31, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 39, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 47, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 55, 8, %r22 + stb,ma %r22, 1(%r20) + stb,ma %ret0, 1(%r20) + extrd,u %ret1, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 23, 8, %r22 + b L$done + stb %r22, 0(%r20) + +L$smst12 + extrd,u %ret0, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 31, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 39, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 47, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 55, 8, %r22 + stb,ma %r22, 1(%r20) + stb,ma %ret0, 1(%r20) + extrd,u %ret1, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 31, 8, %r22 + b L$done + stb %r22, 0(%r20) + +L$smst13 + extrd,u %ret0, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 31, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 39, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 47, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 55, 8, %r22 + stb,ma %r22, 1(%r20) + stb,ma %ret0, 1(%r20) + extrd,u %ret1, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 31, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 39, 8, %r22 + b L$done + stb %r22, 0(%r20) + +L$smst14 + extrd,u %ret0, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 31, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 39, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 47, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 55, 8, %r22 + stb,ma %r22, 1(%r20) + stb,ma %ret0, 1(%r20) + extrd,u %ret1, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 31, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 39, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 47, 8, %r22 + b L$done + stb %r22, 0(%r20) + +L$smst15 + extrd,u %ret0, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 31, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 39, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 47, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 55, 8, %r22 + stb,ma %r22, 1(%r20) + stb,ma %ret0, 1(%r20) + extrd,u %ret1, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 31, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 39, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 47, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 55, 8, %r22 + b L$done + stb %r22, 0(%r20) + +L$smst16 + extrd,u %ret0, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 31, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 39, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 47, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret0, 55, 8, %r22 + stb,ma %r22, 1(%r20) + stb,ma %ret0, 1(%r20) + extrd,u %ret1, 7, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 15, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 23, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 31, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 39, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 47, 8, %r22 + stb,ma %r22, 1(%r20) + extrd,u %ret1, 55, 8, %r22 + stb,ma %r22, 1(%r20) + stb %ret1, 0(%r20) + +L$done + /* all done, restore registers and return */ + copy %r4, %sp + ldd 8(%r3), %r4 + ldd -16(%r3), %rp + bve (%rp) + ldd,mb -48(%sp), %r3 + .exit + .procend +L$FE1 + .size ffi_call_pa64, .-ffi_call_pa64 + + /* void ffi_closure_pa64(void); + Called with closure argument in %r21 */ + + .export ffi_closure_pa64,code + .import ffi_closure_inner_pa64,code + .align 4 +L$FB2 +ffi_closure_pa64 + .proc + .callinfo FRAME=128,CALLS,SAVE_RP,ENTRY_GR=3 + .entry + + std %rp, -16(%sp) + copy %r3, %r1 +L$CFI21 + copy %sp, %r3 +L$CFI22 + std,ma %r1, 128(%sp) +L$CFI23 + + /* Put arguments onto the stack and call ffi_closure_inner. */ + std %r26, -64(%r29) + std %r25, -56(%r29) + std %r24, -48(%r29) + std %r23, -40(%r29) + std %r22, -32(%r29) + std %r21, -24(%r29) + std %r20, -16(%r29) + std %r19, -8(%r29) + + /* Load and save start of argument stack. */ + ldo -64(%r29), %r25 + std %r25, 8(%r3) + + /* Setup arg pointer. */ + ldo -16(%sp), %ret1 + + /* Retrieve closure pointer and real gp. */ + copy %dp, %r26 + bl ffi_closure_inner_pa64, %r2 + ldd 0(%dp), %dp + + /* Retrieve start of argument stack. */ + ldd 8(%r3), %r1 + + /* Restore r3 and op stack. */ + ldd,mb -128(%sp), %r3 + + /* Load return address. */ + ldd -16(%sp), %rp + + /* Load return values from first and second stack slots. */ + ldd 0(%r1), %ret0 + bve (%rp) + ldd 8(%r1), %ret1 + + .exit + .procend + .end +L$FE2: + .size ffi_closure_pa64, .-ffi_closure_pa64 + + .section .eh_frame,"aw",@progbits +L$frame1: + .word L$ECIE1-L$SCIE1 ;# Length of Common Information Entry +L$SCIE1: + .word 0x0 ;# CIE Identifier Tag + .byte 0x3 ;# CIE Version + .stringz "" ;# CIE Augmentation + .uleb128 0x1 ;# CIE Code Alignment Factor + .sleb128 8 ;# CIE Data Alignment Factor + .byte 0x2 ;# CIE RA Column + .byte 0xc ;# DW_CFA_def_cfa + .uleb128 0x1e + .uleb128 0x0 + .align 8 +L$ECIE1: +L$SFDE1: + .word L$EFDE1-L$ASFDE1 ;# FDE Length +L$ASFDE1: + .word L$ASFDE1-L$frame1 ;# FDE CIE offset + .dword L$FB1 ;# FDE initial location + .dword L$FE1-L$FB1 ;# FDE address range + + .byte 0x4 ;# DW_CFA_advance_loc4 + .word L$CFI11-L$FB1 + .byte 0x9 ;# DW_CFA_register: r3 in r1 + .uleb128 0x3 + .uleb128 0x1 + .byte 0x11 ;# DW_CFA_offset_extended_sf: r2 at cfa-16 + .uleb128 0x2 + .sleb128 -2 + .byte 0x4 ;# DW_CFA_advance_loc4 + .word L$CFI12-L$CFI11 + .byte 0xd ;# DW_CFA_def_cfa_register: r3 + .uleb128 0x3 + + .byte 0x4 ;# DW_CFA_advance_loc4 + .word L$CFI13-L$CFI12 + .byte 0x83 ;# DW_CFA_offset: r3 at cfa+0 + .uleb128 0 + .byte 0x84 ;# DW_CFA_offset: r4 at cfa+8 + .uleb128 1 + + .align 8 +L$EFDE1: + +L$SFDE2: + .word L$EFDE2-L$ASFDE2 ;# FDE Length +L$ASFDE2: + .word L$ASFDE2-L$frame1 ;# FDE CIE offset + .dword L$FB2 ;# FDE initial location + .dword L$FE2-L$FB2 ;# FDE address range + .byte 0x4 ;# DW_CFA_advance_loc4 + .word L$CFI21-L$FB2 + .byte 0x9 ;# DW_CFA_register: r3 in r1 + .uleb128 0x3 + .uleb128 0x1 + .byte 0x11 ;# DW_CFA_offset_extended_sf: r2 at cfa-16 + .uleb128 0x2 + .sleb128 -2 + + .byte 0x4 ;# DW_CFA_advance_loc4 + .word L$CFI22-L$CFI21 + .byte 0xd ;# DW_CFA_def_cfa_register: r3 + .uleb128 0x3 + + .byte 0x4 ;# DW_CFA_advance_loc4 + .word L$CFI23-L$CFI22 + .byte 0x83 ;# DW_CFA_offset: r3 at cfa+0 + .uleb128 0 + + .align 8 +L$EFDE2: diff --git a/src/libffi/libffi-3.4.4/src/pa/linux.S b/src/libffi/libffi-3.4.6/src/pa/linux.S similarity index 88% rename from src/libffi/libffi-3.4.4/src/pa/linux.S rename to src/libffi/libffi-3.4.6/src/pa/linux.S index 33ef0b137..2d3b03604 100644 --- a/src/libffi/libffi-3.4.4/src/pa/linux.S +++ b/src/libffi/libffi-3.4.6/src/pa/linux.S @@ -103,51 +103,103 @@ ffi_call_pa32: /* Prepare to store the result; we need to recover flags and rvalue. */ ldw -48(%r3), %r21 /* r21 <- flags */ - ldw -52(%r3), %r20 /* r20 <- rvalue */ - /* Store the result according to the return type. */ + /* Adjust flags range from [-8, 15] to [0, 23]. */ + addi 8, %r21, %r21 -.Lcheckint: - comib,<>,n FFI_TYPE_INT, %r21, .Lcheckint8 - b .Ldone - stw %ret0, 0(%r20) + blr %r21, %r0 + ldw -52(%r3), %r20 /* r20 <- rvalue */ -.Lcheckint8: - comib,<>,n FFI_TYPE_UINT8, %r21, .Lcheckint16 + /* Giant jump table */ + /* 8-byte small struct */ + b,n .Lsmst8 + nop + /* 7-byte small struct */ + b,n .Lsmst7 + nop + /* 6-byte small struct */ + b,n .Lsmst6 + nop + /* 5-byte small struct */ + b,n .Lsmst5 + nop + /* 4-byte small struct */ + b,n .Lsmst4 + nop + /* 3-byte small struct */ + b,n .Lsmst3 + nop + /* 2-byte small struct */ + b,n .Lsmst2 + nop + /* 1-byte small struct */ b .Ldone stb %ret0, 0(%r20) - -.Lcheckint16: - comib,<>,n FFI_TYPE_UINT16, %r21, .Lcheckdbl + /* void */ + b,n .Ldone + nop + /* int */ b .Ldone - sth %ret0, 0(%r20) - -.Lcheckdbl: - comib,<>,n FFI_TYPE_DOUBLE, %r21, .Lcheckfloat + stw %ret0, 0(%r20) + /* float */ + b .Ldone + fstw %fr4L,0(%r20) + /* double */ b .Ldone fstd %fr4,0(%r20) - -.Lcheckfloat: - comib,<>,n FFI_TYPE_FLOAT, %r21, .Lcheckll + /* long double */ b .Ldone - fstw %fr4L,0(%r20) + fstd %fr4,0(%r20) + /* unsigned int8 */ + b .Ldone + stw %ret0, 0(%r20) + /* sint8 */ + b .Ldone + stw %ret0, 0(%r20) + /* unsigned int16 */ + b .Ldone + stw %ret0, 0(%r20) + /* sint16 */ + b .Ldone + stw %ret0, 0(%r20) + /* unsigned int32 */ + b .Ldone + stw %ret0, 0(%r20) + /* sint32 */ + b .Ldone + stw %ret0, 0(%r20) + /* unsigned int64 */ + b,n .Luint64 + nop + /* signed int64 */ + b,n .Lsint64 + nop + /* large struct */ + b,n .Ldone + nop + /* pointer */ + b .Ldone + stw %ret0, 0(%r20) + /* complex */ + b,n .Ldone + nop + + /* Store the result according to the return type. */ -.Lcheckll: - comib,<>,n FFI_TYPE_UINT64, %r21, .Lchecksmst2 +.Luint64: +.Lsint64: stw %ret0, 0(%r20) b .Ldone stw %ret1, 4(%r20) -.Lchecksmst2: - comib,<>,n FFI_TYPE_SMALL_STRUCT2, %r21, .Lchecksmst3 +.Lsmst2: /* 2-byte structs are returned in ret0 as ????xxyy. */ extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) b .Ldone stb %ret0, 0(%r20) -.Lchecksmst3: - comib,<>,n FFI_TYPE_SMALL_STRUCT3, %r21, .Lchecksmst4 +.Lsmst3: /* 3-byte structs are returned in ret0 as ??xxyyzz. */ extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) @@ -156,8 +208,7 @@ ffi_call_pa32: b .Ldone stb %ret0, 0(%r20) -.Lchecksmst4: - comib,<>,n FFI_TYPE_SMALL_STRUCT4, %r21, .Lchecksmst5 +.Lsmst4: /* 4-byte structs are returned in ret0 as wwxxyyzz. */ extru %ret0, 7, 8, %r22 stbs,ma %r22, 1(%r20) @@ -168,8 +219,7 @@ ffi_call_pa32: b .Ldone stb %ret0, 0(%r20) -.Lchecksmst5: - comib,<>,n FFI_TYPE_SMALL_STRUCT5, %r21, .Lchecksmst6 +.Lsmst5: /* 5 byte values are returned right justified: ret0 ret1 5: ??????aa bbccddee */ @@ -183,8 +233,7 @@ ffi_call_pa32: b .Ldone stb %ret1, 0(%r20) -.Lchecksmst6: - comib,<>,n FFI_TYPE_SMALL_STRUCT6, %r21, .Lchecksmst7 +.Lsmst6: /* 6 byte values are returned right justified: ret0 ret1 6: ????aabb ccddeeff */ @@ -200,8 +249,7 @@ ffi_call_pa32: b .Ldone stb %ret1, 0(%r20) -.Lchecksmst7: - comib,<>,n FFI_TYPE_SMALL_STRUCT7, %r21, .Lchecksmst8 +.Lsmst7: /* 7 byte values are returned right justified: ret0 ret1 7: ??aabbcc ddeeffgg */ @@ -219,8 +267,7 @@ ffi_call_pa32: b .Ldone stb %ret1, 0(%r20) -.Lchecksmst8: - comib,<>,n FFI_TYPE_SMALL_STRUCT8, %r21, .Ldone +.Lsmst8: /* 8 byte values are returned right justified: ret0 ret1 8: aabbccdd eeffgghh */ diff --git a/src/libffi/libffi-3.4.4/src/powerpc/aix.S b/src/libffi/libffi-3.4.6/src/powerpc/aix.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/powerpc/aix.S rename to src/libffi/libffi-3.4.6/src/powerpc/aix.S diff --git a/src/libffi/libffi-3.4.4/src/powerpc/aix_closure.S b/src/libffi/libffi-3.4.6/src/powerpc/aix_closure.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/powerpc/aix_closure.S rename to src/libffi/libffi-3.4.6/src/powerpc/aix_closure.S diff --git a/src/libffi/libffi-3.4.4/src/powerpc/asm.h b/src/libffi/libffi-3.4.6/src/powerpc/asm.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/powerpc/asm.h rename to src/libffi/libffi-3.4.6/src/powerpc/asm.h diff --git a/src/libffi/libffi-3.4.4/src/powerpc/darwin.S b/src/libffi/libffi-3.4.6/src/powerpc/darwin.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/powerpc/darwin.S rename to src/libffi/libffi-3.4.6/src/powerpc/darwin.S diff --git a/src/libffi/libffi-3.4.4/src/powerpc/darwin_closure.S b/src/libffi/libffi-3.4.6/src/powerpc/darwin_closure.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/powerpc/darwin_closure.S rename to src/libffi/libffi-3.4.6/src/powerpc/darwin_closure.S diff --git a/src/libffi/libffi-3.4.4/src/powerpc/ffi.c b/src/libffi/libffi-3.4.6/src/powerpc/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/powerpc/ffi.c rename to src/libffi/libffi-3.4.6/src/powerpc/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/powerpc/ffi_darwin.c b/src/libffi/libffi-3.4.6/src/powerpc/ffi_darwin.c similarity index 96% rename from src/libffi/libffi-3.4.4/src/powerpc/ffi_darwin.c rename to src/libffi/libffi-3.4.6/src/powerpc/ffi_darwin.c index 64bb94dfa..afb6750a5 100644 --- a/src/libffi/libffi-3.4.4/src/powerpc/ffi_darwin.c +++ b/src/libffi/libffi-3.4.6/src/powerpc/ffi_darwin.c @@ -623,38 +623,50 @@ darwin_adjust_aggregate_sizes (ffi_type *s) } /* Adjust the size of S to be correct for AIX. - Word-align double unless it is the first member of a structure. */ + Word-align double unless it is the first member of a structure recursively. + Return non-zero if we found a recursive first member aggregate of interest. */ -static void -aix_adjust_aggregate_sizes (ffi_type *s) +static int +aix_adjust_aggregate_sizes (ffi_type *s, int outer_most_type_or_first_member) { - int i; + int i, nested_first_member=0, final_align, rc=0; if (s->type != FFI_TYPE_STRUCT) - return; + return 0; s->size = 0; for (i = 0; s->elements[i] != NULL; i++) { - ffi_type *p; + ffi_type p; int align; - - p = s->elements[i]; - aix_adjust_aggregate_sizes (p); - align = p->alignment; - if (i != 0 && p->type == FFI_TYPE_DOUBLE) - align = 4; - s->size = FFI_ALIGN(s->size, align) + p->size; + + /* nested aggregates layout differently on AIX, so take a copy of the type */ + p = *(s->elements[i]); + if (i == 0) + nested_first_member = aix_adjust_aggregate_sizes(&p, outer_most_type_or_first_member); + else + aix_adjust_aggregate_sizes(&p, 0); + align = p.alignment; + if (i != 0 && p.type == FFI_TYPE_DOUBLE) + align = 4; + s->size = FFI_ALIGN(s->size, align) + p.size; } - - s->size = FFI_ALIGN(s->size, s->alignment); - - if (s->elements[0]->type == FFI_TYPE_UINT64 - || s->elements[0]->type == FFI_TYPE_SINT64 - || s->elements[0]->type == FFI_TYPE_DOUBLE - || s->elements[0]->alignment == 8) - s->alignment = s->alignment > 8 ? s->alignment : 8; - /* Do not add additional tail padding. */ + + final_align=s->alignment; + if ((s->elements[0]->type == FFI_TYPE_UINT64 + || s->elements[0]->type == FFI_TYPE_SINT64 + || s->elements[0]->type == FFI_TYPE_DOUBLE + || s->elements[0]->alignment == 8 || nested_first_member)) { + final_align = s->alignment > 8 ? s->alignment : 8; + rc=1; + /* still use the adjusted alignment to calculate tail padding, but don't adjust the types alignment if + we aren't in the recursive first position */ + if (outer_most_type_or_first_member) + s->alignment=final_align; + } + + s->size = FFI_ALIGN(s->size, final_align); + return rc; } /* Perform machine dependent cif processing. */ @@ -682,9 +694,9 @@ ffi_prep_cif_machdep (ffi_cif *cif) if (cif->abi == FFI_AIX) { - aix_adjust_aggregate_sizes (cif->rtype); + aix_adjust_aggregate_sizes (cif->rtype, 1); for (i = 0; i < cif->nargs; i++) - aix_adjust_aggregate_sizes (cif->arg_types[i]); + aix_adjust_aggregate_sizes (cif->arg_types[i], 1); } /* Space for the frame pointer, callee's LR, CR, etc, and for diff --git a/src/libffi/libffi-3.4.4/src/powerpc/ffi_linux64.c b/src/libffi/libffi-3.4.6/src/powerpc/ffi_linux64.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/powerpc/ffi_linux64.c rename to src/libffi/libffi-3.4.6/src/powerpc/ffi_linux64.c diff --git a/src/libffi/libffi-3.4.4/src/powerpc/ffi_powerpc.h b/src/libffi/libffi-3.4.6/src/powerpc/ffi_powerpc.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/powerpc/ffi_powerpc.h rename to src/libffi/libffi-3.4.6/src/powerpc/ffi_powerpc.h diff --git a/src/libffi/libffi-3.4.4/src/powerpc/ffi_sysv.c b/src/libffi/libffi-3.4.6/src/powerpc/ffi_sysv.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/powerpc/ffi_sysv.c rename to src/libffi/libffi-3.4.6/src/powerpc/ffi_sysv.c diff --git a/src/libffi/libffi-3.4.4/src/powerpc/ffitarget.h b/src/libffi/libffi-3.4.6/src/powerpc/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/powerpc/ffitarget.h rename to src/libffi/libffi-3.4.6/src/powerpc/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/powerpc/linux64.S b/src/libffi/libffi-3.4.6/src/powerpc/linux64.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/powerpc/linux64.S rename to src/libffi/libffi-3.4.6/src/powerpc/linux64.S diff --git a/src/libffi/libffi-3.4.4/src/powerpc/linux64_closure.S b/src/libffi/libffi-3.4.6/src/powerpc/linux64_closure.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/powerpc/linux64_closure.S rename to src/libffi/libffi-3.4.6/src/powerpc/linux64_closure.S diff --git a/src/libffi/libffi-3.4.4/src/powerpc/ppc_closure.S b/src/libffi/libffi-3.4.6/src/powerpc/ppc_closure.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/powerpc/ppc_closure.S rename to src/libffi/libffi-3.4.6/src/powerpc/ppc_closure.S diff --git a/src/libffi/libffi-3.4.4/src/powerpc/sysv.S b/src/libffi/libffi-3.4.6/src/powerpc/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/powerpc/sysv.S rename to src/libffi/libffi-3.4.6/src/powerpc/sysv.S diff --git a/src/libffi/libffi-3.4.4/src/powerpc/t-aix b/src/libffi/libffi-3.4.6/src/powerpc/t-aix similarity index 100% rename from src/libffi/libffi-3.4.4/src/powerpc/t-aix rename to src/libffi/libffi-3.4.6/src/powerpc/t-aix diff --git a/src/libffi/libffi-3.4.4/src/prep_cif.c b/src/libffi/libffi-3.4.6/src/prep_cif.c similarity index 99% rename from src/libffi/libffi-3.4.4/src/prep_cif.c rename to src/libffi/libffi-3.4.6/src/prep_cif.c index 2d0f2521f..0e2d58e5e 100644 --- a/src/libffi/libffi-3.4.4/src/prep_cif.c +++ b/src/libffi/libffi-3.4.6/src/prep_cif.c @@ -234,7 +234,7 @@ ffi_status ffi_prep_cif_var(ffi_cif *cif, { ffi_status rc; size_t int_size = ffi_type_sint.size; - int i; + unsigned int i; rc = ffi_prep_cif_core(cif, abi, 1, nfixedargs, ntotalargs, rtype, atypes); diff --git a/src/libffi/libffi-3.4.4/src/raw_api.c b/src/libffi/libffi-3.4.6/src/raw_api.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/raw_api.c rename to src/libffi/libffi-3.4.6/src/raw_api.c diff --git a/src/libffi/libffi-3.4.4/src/riscv/ffi.c b/src/libffi/libffi-3.4.6/src/riscv/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/riscv/ffi.c rename to src/libffi/libffi-3.4.6/src/riscv/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/riscv/ffitarget.h b/src/libffi/libffi-3.4.6/src/riscv/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/riscv/ffitarget.h rename to src/libffi/libffi-3.4.6/src/riscv/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/riscv/sysv.S b/src/libffi/libffi-3.4.6/src/riscv/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/riscv/sysv.S rename to src/libffi/libffi-3.4.6/src/riscv/sysv.S diff --git a/src/libffi/libffi-3.4.4/src/s390/ffi.c b/src/libffi/libffi-3.4.6/src/s390/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/s390/ffi.c rename to src/libffi/libffi-3.4.6/src/s390/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/s390/ffitarget.h b/src/libffi/libffi-3.4.6/src/s390/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/s390/ffitarget.h rename to src/libffi/libffi-3.4.6/src/s390/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/s390/internal.h b/src/libffi/libffi-3.4.6/src/s390/internal.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/s390/internal.h rename to src/libffi/libffi-3.4.6/src/s390/internal.h diff --git a/src/libffi/libffi-3.4.4/src/s390/sysv.S b/src/libffi/libffi-3.4.6/src/s390/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/s390/sysv.S rename to src/libffi/libffi-3.4.6/src/s390/sysv.S diff --git a/src/libffi/libffi-3.4.4/src/sh/ffi.c b/src/libffi/libffi-3.4.6/src/sh/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/sh/ffi.c rename to src/libffi/libffi-3.4.6/src/sh/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/sh/ffitarget.h b/src/libffi/libffi-3.4.6/src/sh/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/sh/ffitarget.h rename to src/libffi/libffi-3.4.6/src/sh/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/sh/sysv.S b/src/libffi/libffi-3.4.6/src/sh/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/sh/sysv.S rename to src/libffi/libffi-3.4.6/src/sh/sysv.S diff --git a/src/libffi/libffi-3.4.4/src/sh64/ffi.c b/src/libffi/libffi-3.4.6/src/sh64/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/sh64/ffi.c rename to src/libffi/libffi-3.4.6/src/sh64/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/sh64/ffitarget.h b/src/libffi/libffi-3.4.6/src/sh64/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/sh64/ffitarget.h rename to src/libffi/libffi-3.4.6/src/sh64/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/sh64/sysv.S b/src/libffi/libffi-3.4.6/src/sh64/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/sh64/sysv.S rename to src/libffi/libffi-3.4.6/src/sh64/sysv.S diff --git a/src/libffi/libffi-3.4.4/src/sparc/ffi.c b/src/libffi/libffi-3.4.6/src/sparc/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/sparc/ffi.c rename to src/libffi/libffi-3.4.6/src/sparc/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/sparc/ffi64.c b/src/libffi/libffi-3.4.6/src/sparc/ffi64.c similarity index 99% rename from src/libffi/libffi-3.4.4/src/sparc/ffi64.c rename to src/libffi/libffi-3.4.6/src/sparc/ffi64.c index 5ae43e87d..7a9dc3283 100644 --- a/src/libffi/libffi-3.4.4/src/sparc/ffi64.c +++ b/src/libffi/libffi-3.4.6/src/sparc/ffi64.c @@ -382,13 +382,19 @@ ffi_prep_args_v9(ffi_cif *cif, unsigned long *argp, void *rvalue, void **avalue) *argp++ = *(SINT32 *)a; break; case FFI_TYPE_UINT32: - case FFI_TYPE_FLOAT: *argp++ = *(UINT32 *)a; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: case FFI_TYPE_POINTER: + *argp++ = *(UINT64 *)a; + break; + case FFI_TYPE_FLOAT: + flags |= SPARC_FLAG_FP_ARGS; + *argp++ = *(UINT32 *)a; + break; case FFI_TYPE_DOUBLE: + flags |= SPARC_FLAG_FP_ARGS; *argp++ = *(UINT64 *)a; break; diff --git a/src/libffi/libffi-3.4.4/src/sparc/ffitarget.h b/src/libffi/libffi-3.4.6/src/sparc/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/sparc/ffitarget.h rename to src/libffi/libffi-3.4.6/src/sparc/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/sparc/internal.h b/src/libffi/libffi-3.4.6/src/sparc/internal.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/sparc/internal.h rename to src/libffi/libffi-3.4.6/src/sparc/internal.h diff --git a/src/libffi/libffi-3.4.4/src/sparc/v8.S b/src/libffi/libffi-3.4.6/src/sparc/v8.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/sparc/v8.S rename to src/libffi/libffi-3.4.6/src/sparc/v8.S diff --git a/src/libffi/libffi-3.4.4/src/sparc/v9.S b/src/libffi/libffi-3.4.6/src/sparc/v9.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/sparc/v9.S rename to src/libffi/libffi-3.4.6/src/sparc/v9.S diff --git a/src/libffi/libffi-3.4.4/src/tile/ffi.c b/src/libffi/libffi-3.4.6/src/tile/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/tile/ffi.c rename to src/libffi/libffi-3.4.6/src/tile/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/tile/ffitarget.h b/src/libffi/libffi-3.4.6/src/tile/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/tile/ffitarget.h rename to src/libffi/libffi-3.4.6/src/tile/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/tile/tile.S b/src/libffi/libffi-3.4.6/src/tile/tile.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/tile/tile.S rename to src/libffi/libffi-3.4.6/src/tile/tile.S diff --git a/src/libffi/libffi-3.4.4/src/tramp.c b/src/libffi/libffi-3.4.6/src/tramp.c similarity index 98% rename from src/libffi/libffi-3.4.4/src/tramp.c rename to src/libffi/libffi-3.4.6/src/tramp.c index b9d273a1a..8ec084868 100644 --- a/src/libffi/libffi-3.4.4/src/tramp.c +++ b/src/libffi/libffi-3.4.6/src/tramp.c @@ -39,6 +39,10 @@ #ifdef __linux__ #define _GNU_SOURCE 1 #endif + +#include +#include + #include #include #include @@ -266,7 +270,7 @@ ffi_tramp_get_temp_file (void) * trampoline table to make sure that the temporary file can be mapped. */ count = write(tramp_globals.fd, tramp_globals.text, tramp_globals.map_size); - if (count == tramp_globals.map_size && tramp_table_alloc ()) + if (count >=0 && (size_t)count == tramp_globals.map_size && tramp_table_alloc ()) return 1; close (tramp_globals.fd); @@ -303,7 +307,7 @@ ffi_tramp_lock(void) } static void -ffi_tramp_unlock() +ffi_tramp_unlock(void) { pthread_mutex_unlock (&tramp_globals_mutex); } @@ -374,6 +378,8 @@ tramp_table_unmap (struct tramp_table *table) static int ffi_tramp_init (void) { + long page_size; + if (tramp_globals.status == TRAMP_GLOBALS_PASSED) return 1; @@ -396,7 +402,8 @@ ffi_tramp_init (void) &tramp_globals.map_size); tramp_globals.ntramp = tramp_globals.map_size / tramp_globals.size; - if (sysconf (_SC_PAGESIZE) > tramp_globals.map_size) + page_size = sysconf (_SC_PAGESIZE); + if (page_size >= 0 && (size_t)page_size > tramp_globals.map_size) return 0; if (ffi_tramp_init_os ()) diff --git a/src/libffi/libffi-3.4.4/src/types.c b/src/libffi/libffi-3.4.6/src/types.c similarity index 95% rename from src/libffi/libffi-3.4.4/src/types.c rename to src/libffi/libffi-3.4.6/src/types.c index 9ec27f6cf..c1c27f38d 100644 --- a/src/libffi/libffi-3.4.4/src/types.c +++ b/src/libffi/libffi-3.4.6/src/types.c @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- - types.c - Copyright (c) 1996, 1998 Red Hat, Inc. - + types.c - Copyright (c) 1996, 1998, 2024 Red Hat, Inc. + Predefined ffi_types needed by libffi. Permission is hereby granted, free of charge, to any person obtaining @@ -87,7 +87,7 @@ FFI_TYPEDEF(double, double, FFI_TYPE_DOUBLE, const); #endif #ifdef __alpha__ -/* Even if we're not configured to default to 128-bit long double, +/* Even if we're not configured to default to 128-bit long double, maintain binary compatibility, as -mlong-double-128 can be used at any time. */ /* Validate the hard-coded number below. */ @@ -95,14 +95,12 @@ FFI_TYPEDEF(double, double, FFI_TYPE_DOUBLE, const); # error FFI_TYPE_LONGDOUBLE out of date # endif const ffi_type ffi_type_longdouble = { 16, 16, 4, NULL }; -#elif FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE +#else FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE, FFI_LDBL_CONST); #endif #ifdef FFI_TARGET_HAS_COMPLEX_TYPE FFI_COMPLEX_TYPEDEF(float, float, const); FFI_COMPLEX_TYPEDEF(double, double, const); -#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE FFI_COMPLEX_TYPEDEF(longdouble, long double, FFI_LDBL_CONST); #endif -#endif diff --git a/src/libffi/libffi-3.4.4/src/vax/elfbsd.S b/src/libffi/libffi-3.4.6/src/vax/elfbsd.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/vax/elfbsd.S rename to src/libffi/libffi-3.4.6/src/vax/elfbsd.S diff --git a/src/libffi/libffi-3.4.4/src/vax/ffi.c b/src/libffi/libffi-3.4.6/src/vax/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/vax/ffi.c rename to src/libffi/libffi-3.4.6/src/vax/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/vax/ffitarget.h b/src/libffi/libffi-3.4.6/src/vax/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/vax/ffitarget.h rename to src/libffi/libffi-3.4.6/src/vax/ffitarget.h diff --git a/src/libffi/libffi-3.4.6/src/wasm32/ffi.c b/src/libffi/libffi-3.4.6/src/wasm32/ffi.c new file mode 100644 index 000000000..1a8c9aea7 --- /dev/null +++ b/src/libffi/libffi-3.4.6/src/wasm32/ffi.c @@ -0,0 +1,947 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2018-2023 Hood Chatham, Brion Vibber, Kleis Auke Wolthuizen, and others. + + wasm32/emscripten Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +#include +#include + +#include + +#ifdef DEBUG_F +#define LOG_DEBUG(args...) \ + console.warn(`====LIBFFI(line __LINE__)`, args) +#else +#define LOG_DEBUG(args...) 0 +#endif + +#define EM_JS_MACROS(ret, name, args, body...) EM_JS(ret, name, args, body) + +#if WASM_BIGINT +EM_JS_DEPS(libffi, "$getWasmTableEntry,$setWasmTableEntry,$getEmptyTableSlot,$convertJsFunctionToWasm"); +#define CALL_FUNCTION_POINTER(ptr, args...) \ + (LOG_DEBUG("CALL_FUNC_PTR", ptr, args), \ + getWasmTableEntry(ptr).apply(null, args)) + +#define JS_FUNCTION_TO_WASM convertJsFunctionToWasm +#else +EM_JS_DEPS(libffi, "$getWasmTableEntry,$setWasmTableEntry,$getEmptyTableSlot,$convertJsFunctionToWasm,$dynCall,$generateFuncType,$uleb128Encode"); +#define CALL_FUNCTION_POINTER(ptr, args...) \ + (LOG_DEBUG("CALL_FUNC_PTR", sig, ptr, args), \ + dynCall(sig, ptr, args)) + +#define JS_FUNCTION_TO_WASM createLegalizerWrapper +#endif + +// Signature calculations are not needed if WASM_BIGINT is present. +#if WASM_BIGINT +#define SIG(sig) +#else +#define SIG(sig) sig +#endif + +#define DEREF_U8(addr, offset) HEAPU8[addr + offset] +#define DEREF_S8(addr, offset) HEAP8[addr + offset] +#define DEREF_U16(addr, offset) HEAPU16[(addr >> 1) + offset] +#define DEREF_S16(addr, offset) HEAP16[(addr >> 1) + offset] +#define DEREF_U32(addr, offset) HEAPU32[(addr >> 2) + offset] +#define DEREF_S32(addr, offset) HEAP32[(addr >> 2) + offset] + +#define DEREF_F32(addr, offset) HEAPF32[(addr >> 2) + offset] +#define DEREF_F64(addr, offset) HEAPF64[(addr >> 3) + offset] + +#if WASM_BIGINT +// We have HEAPU64 in this case. +#define DEREF_U64(addr, offset) HEAPU64[(addr >> 3) + offset] +#endif + + +#define CHECK_FIELD_OFFSET(struct, field, offset) \ + _Static_assert( \ + offsetof(struct, field) == offset, \ + "Memory layout of '" #struct "' has changed: '" #field "' is in an unexpected location"); + +CHECK_FIELD_OFFSET(ffi_cif, abi, 4*0); +CHECK_FIELD_OFFSET(ffi_cif, nargs, 4*1); +CHECK_FIELD_OFFSET(ffi_cif, arg_types, 4*2); +CHECK_FIELD_OFFSET(ffi_cif, rtype, 4*3); +CHECK_FIELD_OFFSET(ffi_cif, nfixedargs, 4*6); + +#define CIF__ABI(addr) DEREF_U32(addr, 0) +#define CIF__NARGS(addr) DEREF_U32(addr, 1) +#define CIF__ARGTYPES(addr) DEREF_U32(addr, 2) +#define CIF__RTYPE(addr) DEREF_U32(addr, 3) +#define CIF__NFIXEDARGS(addr) DEREF_U32(addr, 6) + +CHECK_FIELD_OFFSET(ffi_type, size, 0); +CHECK_FIELD_OFFSET(ffi_type, alignment, 4); +CHECK_FIELD_OFFSET(ffi_type, type, 6); +CHECK_FIELD_OFFSET(ffi_type, elements, 8); + +#define FFI_TYPE__SIZE(addr) DEREF_U32(addr, 0) +#define FFI_TYPE__ALIGN(addr) DEREF_U16(addr + 4, 0) +#define FFI_TYPE__TYPEID(addr) DEREF_U16(addr + 6, 0) +#define FFI_TYPE__ELEMENTS(addr) DEREF_U32(addr + 8, 0) + +#define ALIGN_ADDRESS(addr, align) (addr &= (~((align) - 1))) +#define STACK_ALLOC(stack, size, align) ((stack -= (size)), ALIGN_ADDRESS(stack, align)) + +// Most wasm runtimes support at most 1000 Js trampoline args. +#define MAX_ARGS 1000 + +#include + +#define VARARGS_FLAG 1 + +#define FFI_OK_MACRO 0 +_Static_assert(FFI_OK_MACRO == FFI_OK, "FFI_OK must be 0"); + +#define FFI_BAD_TYPEDEF_MACRO 1 +_Static_assert(FFI_BAD_TYPEDEF_MACRO == FFI_BAD_TYPEDEF, "FFI_BAD_TYPEDEF must be 1"); + +ffi_status FFI_HIDDEN +ffi_prep_cif_machdep(ffi_cif *cif) +{ + if (cif->abi != FFI_WASM32_EMSCRIPTEN) + return FFI_BAD_ABI; + // This is called after ffi_prep_cif_machdep_var so we need to avoid + // overwriting cif->nfixedargs. + if (!(cif->flags & VARARGS_FLAG)) + cif->nfixedargs = cif->nargs; + if (cif->nargs > MAX_ARGS) + return FFI_BAD_TYPEDEF; + if (cif->rtype->type == FFI_TYPE_COMPLEX) + return FFI_BAD_TYPEDEF; + // If they put the COMPLEX type into a struct we won't notice, but whatever. + for (int i = 0; i < cif->nargs; i++) + if (cif->arg_types[i]->type == FFI_TYPE_COMPLEX) + return FFI_BAD_TYPEDEF; + return FFI_OK; +} + +ffi_status FFI_HIDDEN +ffi_prep_cif_machdep_var(ffi_cif *cif, unsigned nfixedargs, unsigned ntotalargs) +{ + cif->flags |= VARARGS_FLAG; + cif->nfixedargs = nfixedargs; + // The varargs takes up one extra argument + if (cif->nfixedargs + 1 > MAX_ARGS) + return FFI_BAD_TYPEDEF; + return FFI_OK; +} + +/** + * A Javascript helper function. This takes an argument typ which is a wasm + * pointer to an ffi_type object. It returns a pair a type and a type id. + * + * - If it is not a struct, return its type and its typeid field. + * - If it is a struct of size >= 2, return the type and its typeid (which + * will be FFI_TYPE_STRUCT) + * - If it is a struct of size 0, return FFI_TYPE_VOID (????? this is broken) + * - If it is a struct of size 1, replace it with the single field and apply + * the same logic again to that. + * + * By always unboxing structs up front, we can avoid messy casework later. + */ +EM_JS_MACROS( +void, +unbox_small_structs, (ffi_type type_ptr), { + var type_id = FFI_TYPE__TYPEID(type_ptr); + while (type_id === FFI_TYPE_STRUCT) { + // Don't unbox single element structs if they are bigger than 16 bytes. This + // is a work around for the fact that Python will give incorrect values for + // the size of the field in these cases: it says that the struct has pointer + // size and alignment and are of type pointer, even though it is more + // accurately a struct and has a larger size. Keeping it as a struct here + // will let us get the ABI right (which is in fact that the true argument is + // a pointer to the stack... so maybe Python issn't so wrong??) + // + // See the Python comment here: + // https://github.com/python/cpython/blob/a16a9f978f42b8a09297c1efbf33877f6388c403/Modules/_ctypes/stgdict.c#L718-L779 + if (FFI_TYPE__SIZE(type_ptr) > 16) { + break; + } + var elements = FFI_TYPE__ELEMENTS(type_ptr); + var first_element = DEREF_U32(elements, 0); + if (first_element === 0) { + type_id = FFI_TYPE_VOID; + break; + } else if (DEREF_U32(elements, 1) === 0) { + type_ptr = first_element; + type_id = FFI_TYPE__TYPEID(first_element); + } else { + break; + } + } + return [type_ptr, type_id]; +}) + +EM_JS_MACROS( +void, +ffi_call_js, (ffi_cif *cif, ffi_fp fn, void *rvalue, void **avalue), +{ + var abi = CIF__ABI(cif); + var nargs = CIF__NARGS(cif); + var nfixedargs = CIF__NFIXEDARGS(cif); + var arg_types_ptr = CIF__ARGTYPES(cif); + var rtype_unboxed = unbox_small_structs(CIF__RTYPE(cif)); + var rtype_ptr = rtype_unboxed[0]; + var rtype_id = rtype_unboxed[1]; + var orig_stack_ptr = stackSave(); + var cur_stack_ptr = orig_stack_ptr; + + var args = []; + // Does our onwards call return by argument or normally? We return by argument + // no matter what. + var ret_by_arg = false; + + if (rtype_id === FFI_TYPE_COMPLEX) { + throw new Error('complex ret marshalling nyi'); + } + if (rtype_id < 0 || rtype_id > FFI_TYPE_LAST) { + throw new Error('Unexpected rtype ' + rtype_id); + } + // If the return type is a struct with multiple entries or a long double, the + // function takes an extra first argument which is a pointer to return value. + // Conveniently, we've already received a pointer to return value, so we can + // just use this. We also mark a flag that we don't need to convert the return + // value of the dynamic call back to C. + if (rtype_id === FFI_TYPE_LONGDOUBLE || rtype_id === FFI_TYPE_STRUCT) { + args.push(rvalue); + ret_by_arg = true; + } + + SIG(var sig = ""); + +#if !WASM_BIGINT + switch(rtype_id) { + case FFI_TYPE_VOID: + SIG(sig = 'v'); + break; + case FFI_TYPE_STRUCT: + case FFI_TYPE_LONGDOUBLE: + SIG(sig = 'vi'); + break; + case FFI_TYPE_INT: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + SIG(sig = 'i'); + break; + case FFI_TYPE_FLOAT: + SIG(sig = 'f'); + break; + case FFI_TYPE_DOUBLE: + SIG(sig = 'd'); + break; + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + SIG(sig = 'j'); + break; + } +#endif + + // Accumulate a Javascript list of arguments for the Javascript wrapper for + // the wasm function. The Javascript wrapper does a type conversion from + // Javascript to C automatically, here we manually do the inverse conversion + // from C to Javascript. + for (var i = 0; i < nfixedargs; i++) { + var arg_ptr = DEREF_U32(avalue, i); + var arg_unboxed = unbox_small_structs(DEREF_U32(arg_types_ptr, i)); + var arg_type_ptr = arg_unboxed[0]; + var arg_type_id = arg_unboxed[1]; + + // It's okay here to always use unsigned integers as long as the size is 32 + // or 64 bits. Smaller sizes get extended to 32 bits differently according + // to whether they are signed or unsigned. + switch (arg_type_id) { + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + case FFI_TYPE_POINTER: + args.push(DEREF_U32(arg_ptr, 0)); + SIG(sig += 'i'); + break; + case FFI_TYPE_FLOAT: + args.push(DEREF_F32(arg_ptr, 0)); + SIG(sig += 'f'); + break; + case FFI_TYPE_DOUBLE: + args.push(DEREF_F64(arg_ptr, 0)); + SIG(sig += 'd'); + break; + case FFI_TYPE_UINT8: + args.push(DEREF_U8(arg_ptr, 0)); + SIG(sig += 'i'); + break; + case FFI_TYPE_SINT8: + args.push(DEREF_S8(arg_ptr, 0)); + SIG(sig += 'i'); + break; + case FFI_TYPE_UINT16: + args.push(DEREF_U16(arg_ptr, 0)); + SIG(sig += 'i'); + break; + case FFI_TYPE_SINT16: + args.push(DEREF_S16(arg_ptr, 0)); + SIG(sig += 'i'); + break; + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + #if WASM_BIGINT + args.push(DEREF_U64(arg_ptr, 0)); + #else + args.push(DEREF_U32(arg_ptr, 0)); + args.push(DEREF_U32(arg_ptr, 1)); + #endif + SIG(sig += 'j'); + break; + case FFI_TYPE_LONGDOUBLE: + // long double is passed as a pair of BigInts. + #if WASM_BIGINT + args.push(DEREF_U64(arg_ptr, 0)); + args.push(DEREF_U64(arg_ptr, 1)); + #else + args.push(DEREF_U32(arg_ptr, 0)); + args.push(DEREF_U32(arg_ptr, 1)); + args.push(DEREF_U32(arg_ptr, 2)); + args.push(DEREF_U32(arg_ptr, 3)); + #endif + SIG(sig += "jj"); + break; + case FFI_TYPE_STRUCT: + // Nontrivial structs are passed by pointer. + // Have to copy the struct onto the stack though because C ABI says it's + // call by value. + var size = FFI_TYPE__SIZE(arg_type_ptr); + var align = FFI_TYPE__ALIGN(arg_type_ptr); + STACK_ALLOC(cur_stack_ptr, size, align); + HEAP8.subarray(cur_stack_ptr, cur_stack_ptr+size).set(HEAP8.subarray(arg_ptr, arg_ptr + size)); + args.push(cur_stack_ptr); + SIG(sig += 'i'); + break; + case FFI_TYPE_COMPLEX: + throw new Error('complex marshalling nyi'); + default: + throw new Error('Unexpected type ' + arg_type_id); + } + } + + // Wasm functions can't directly manipulate the callstack, so varargs + // arguments have to go on a separate stack. A varags function takes one extra + // argument which is a pointer to where on the separate stack the args are + // located. Because stacks are allocated backwards, we have to loop over the + // varargs backwards. + // + // We don't have any way of knowing how many args were actually passed, so we + // just always copy extra nonsense past the end. The ownwards call will know + // not to look at it. + if (nfixedargs != nargs) { + SIG(sig += 'i'); + var struct_arg_info = []; + for (var i = nargs - 1; i >= nfixedargs; i--) { + var arg_ptr = DEREF_U32(avalue, i); + var arg_unboxed = unbox_small_structs(DEREF_U32(arg_types_ptr, i)); + var arg_type_ptr = arg_unboxed[0]; + var arg_type_id = arg_unboxed[1]; + switch (arg_type_id) { + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + STACK_ALLOC(cur_stack_ptr, 1, 1); + DEREF_U8(cur_stack_ptr, 0) = DEREF_U8(arg_ptr, 0); + break; + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + STACK_ALLOC(cur_stack_ptr, 2, 2); + DEREF_U16(cur_stack_ptr, 0) = DEREF_U16(arg_ptr, 0); + break; + case FFI_TYPE_INT: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + case FFI_TYPE_FLOAT: + STACK_ALLOC(cur_stack_ptr, 4, 4); + DEREF_U32(cur_stack_ptr, 0) = DEREF_U32(arg_ptr, 0); + break; + case FFI_TYPE_DOUBLE: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + STACK_ALLOC(cur_stack_ptr, 8, 8); + DEREF_U32(cur_stack_ptr, 0) = DEREF_U32(arg_ptr, 0); + DEREF_U32(cur_stack_ptr, 1) = DEREF_U32(arg_ptr, 1); + break; + case FFI_TYPE_LONGDOUBLE: + STACK_ALLOC(cur_stack_ptr, 16, 8); + DEREF_U32(cur_stack_ptr, 0) = DEREF_U32(arg_ptr, 0); + DEREF_U32(cur_stack_ptr, 1) = DEREF_U32(arg_ptr, 1); + DEREF_U32(cur_stack_ptr, 2) = DEREF_U32(arg_ptr, 2); + DEREF_U32(cur_stack_ptr, 3) = DEREF_U32(arg_ptr, 3); + break; + case FFI_TYPE_STRUCT: + // Again, struct must be passed by pointer. + // But ABI is by value, so have to copy struct onto stack. + // Currently arguments are going onto stack so we can't put it there now. Come back for this. + STACK_ALLOC(cur_stack_ptr, 4, 4); + struct_arg_info.push([cur_stack_ptr, arg_ptr, FFI_TYPE__SIZE(arg_type_ptr), FFI_TYPE__ALIGN(arg_type_ptr)]); + break; + case FFI_TYPE_COMPLEX: + throw new Error('complex arg marshalling nyi'); + default: + throw new Error('Unexpected argtype ' + arg_type_id); + } + } + // extra normal argument which is the pointer to the varargs. + args.push(cur_stack_ptr); + // Now allocate variable struct args on stack too. + for (var i = 0; i < struct_arg_info.length; i++) { + var struct_info = struct_arg_info[i]; + var arg_target = struct_info[0]; + var arg_ptr = struct_info[1]; + var size = struct_info[2]; + var align = struct_info[3]; + STACK_ALLOC(cur_stack_ptr, size, align); + HEAP8.subarray(cur_stack_ptr, cur_stack_ptr+size).set(HEAP8.subarray(arg_ptr, arg_ptr + size)); + DEREF_U32(arg_target, 0) = cur_stack_ptr; + } + } + stackRestore(cur_stack_ptr); + stackAlloc(0); // stackAlloc enforces alignment invariants on the stack pointer + var result = CALL_FUNCTION_POINTER(fn, args); + // Put the stack pointer back (we moved it if there were any struct args or we + // made a varargs call) + stackRestore(orig_stack_ptr); + + // We need to return by argument. If return value was a nontrivial struct or + // long double, the onwards call already put the return value in rvalue + if (ret_by_arg) { + return; + } + + // Otherwise the result was automatically converted from C into Javascript and + // we need to manually convert it back to C. + switch (rtype_id) { + case FFI_TYPE_VOID: + break; + case FFI_TYPE_INT: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + DEREF_U32(rvalue, 0) = result; + break; + case FFI_TYPE_FLOAT: + DEREF_F32(rvalue, 0) = result; + break; + case FFI_TYPE_DOUBLE: + DEREF_F64(rvalue, 0) = result; + break; + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + DEREF_U8(rvalue, 0) = result; + break; + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + DEREF_U16(rvalue, 0) = result; + break; + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + #if WASM_BIGINT + DEREF_U64(rvalue, 0) = result; + #else + DEREF_U32(rvalue, 0) = result; + DEREF_U32(rvalue, 1) = getTempRet0(); + #endif + break; + case FFI_TYPE_COMPLEX: + throw new Error('complex ret marshalling nyi'); + default: + throw new Error('Unexpected rtype ' + rtype_id); + } +}); + +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { + ffi_call_js(cif, fn, rvalue, avalue); +} + +CHECK_FIELD_OFFSET(ffi_closure, ftramp, 4*0); +CHECK_FIELD_OFFSET(ffi_closure, cif, 4*1); +CHECK_FIELD_OFFSET(ffi_closure, fun, 4*2); +CHECK_FIELD_OFFSET(ffi_closure, user_data, 4*3); + +#define CLOSURE__wrapper(addr) DEREF_U32(addr, 0) +#define CLOSURE__cif(addr) DEREF_U32(addr, 1) +#define CLOSURE__fun(addr) DEREF_U32(addr, 2) +#define CLOSURE__user_data(addr) DEREF_U32(addr, 3) + +EM_JS_MACROS(void *, ffi_closure_alloc_js, (size_t size, void **code), { + var closure = _malloc(size); + var index = getEmptyTableSlot(); + DEREF_U32(code, 0) = index; + CLOSURE__wrapper(closure) = index; + return closure; +}) + +void * __attribute__ ((visibility ("default"))) +ffi_closure_alloc(size_t size, void **code) { + return ffi_closure_alloc_js(size, code); +} + +EM_JS_MACROS(void, ffi_closure_free_js, (void *closure), { + var index = CLOSURE__wrapper(closure); + freeTableIndexes.push(index); + _free(closure); +}) + +void __attribute__ ((visibility ("default"))) +ffi_closure_free(void *closure) { + return ffi_closure_free_js(closure); +} + +#if !WASM_BIGINT + +// When !WASM_BIGINT, we assume there is no JS bigint integration, so JavaScript +// functions cannot take 64 bit integer arguments. +// +// We need to make our own wasm legalizer adaptor that splits 64 bit integer +// arguments and then calls the JavaScript trampoline, then the JavaScript +// trampoline reassembles them, calls the closure, then splits the result (if +// it's a 64 bit integer) and the adaptor puts it back together. +// +// This is basically the reverse of the Emscripten function +// createDyncallWrapper. +EM_JS(void, createLegalizerWrapper, (int trampoline, int sig), { + if(!sig.includes("j")) { + return convertJsFunctionToWasm(trampoline, sig); + } + var sections = []; + var prelude = [ + 0x00, 0x61, 0x73, 0x6d, // magic ("\0asm") + 0x01, 0x00, 0x00, 0x00, // version: 1 + ]; + sections.push(prelude); + var wrappersig = [ + // if return type is j, we will put the upper 32 bits into tempRet0. + sig[0].replace("j", "i"), + // in the rest of the argument list, one 64 bit integer is legalized into + // two 32 bit integers. + sig.slice(1).replace(/j/g, "ii"), + ].join(""); + + var typeSectionBody = [ + 0x03, // number of types = 3 + ]; + generateFuncType(wrappersig, typeSectionBody); // The signature of the wrapper we are generating + generateFuncType(sig, typeSectionBody); // the signature of the function pointer we will call + generateFuncType("i", typeSectionBody); // the signature of getTempRet0 + + var typeSection = [0x01 /* Type section code */]; + uleb128Encode(typeSectionBody.length, typeSection); // length of section in bytes + typeSection.push.apply(typeSection, typeSectionBody); + sections.push(typeSection); + + var importSection = [ + 0x02, // import section code + 0x0d, // length of section in bytes + 0x02, // number of imports = 2 + // Import the getTempRet0 function, which we will call "r" + 0x01, 0x65, // name "e" + 0x01, 0x72, // name "r" + 0x00, // importing a function + 0x02, // type 2 = () -> i32 + // Import the wrapped function, which we will call "f" + 0x01, 0x65, // name "e" + 0x01, 0x66, // name "f" + 0x00, // importing a function + 0x00, // type 0 = wrappersig + ]; + sections.push(importSection); + + var functionSection = [ + 0x03, // function section code + 0x02, // length of section in bytes + 0x01, // number of functions = 1 + 0x01, // type 1 = sig + ]; + sections.push(functionSection); + + var exportSection = [ + 0x07, // export section code + 0x05, // length of section in bytes + 0x01, // One export + 0x01, 0x66, // name "f" + 0x00, // type: function + 0x02, // function index 2 = the wrapper function + ]; + sections.push(exportSection); + + var convert_code = []; + convert_code.push(0x00); // no local variables (except the arguments) + + function localGet(j) { + convert_code.push(0x20); // local.get + uleb128Encode(j, convert_code); + } + + for (var i = 1; i < sig.length; i++) { + if (sig[i] == "j") { + localGet(i - 1); + convert_code.push( + 0xa7 // i32.wrap_i64 + ); + localGet(i - 1); + convert_code.push( + 0x42, 0x20, // i64.const 32 + 0x88, // i64.shr_u + 0xa7 // i32.wrap_i64 + ); + } else { + localGet(i - 1); + } + } + convert_code.push( + 0x10, 0x01 // call f + ); + if (sig[0] === "j") { + // Need to reassemble a 64 bit integer. Lower 32 bits is on stack. Upper 32 + // bits we get from getTempRet0 + convert_code.push( + 0xad, // i64.extend_i32_unsigned + 0x10, 0x00, // Call function 0 (r = getTempRet0) + // join lower 32 bits and upper 32 bits + 0xac, // i64.extend_i32_signed + 0x42, 0x20, // i64.const 32 + 0x86, // i64.shl, + 0x84 // i64.or + ); + } + convert_code.push(0x0b); // end + + var codeBody = [0x01]; // one code + uleb128Encode(convert_code.length, codeBody); + codeBody.push.apply(codeBody, convert_code); + var codeSection = [0x0a /* Code section code */]; + uleb128Encode(codeBody.length, codeSection); + codeSection.push.apply(codeSection, codeBody); + sections.push(codeSection); + + var bytes = new Uint8Array([].concat.apply([], sections)); + // We can compile this wasm module synchronously because it is small. + var module = new WebAssembly.Module(bytes); + var instance = new WebAssembly.Instance(module, { + e: { + r: getTempRet0, + f: trampoline, + }, + }); + return instance.exports.f; +}); +#endif + +EM_JS_MACROS( +ffi_status, +ffi_prep_closure_loc_js, +(ffi_closure *closure, ffi_cif *cif, void *fun, void *user_data, void *codeloc), +{ + var abi = CIF__ABI(cif); + var nargs = CIF__NARGS(cif); + var nfixedargs = CIF__NFIXEDARGS(cif); + var arg_types_ptr = CIF__ARGTYPES(cif); + var rtype_unboxed = unbox_small_structs(CIF__RTYPE(cif)); + var rtype_ptr = rtype_unboxed[0]; + var rtype_id = rtype_unboxed[1]; + + // First construct the signature of the javascript trampoline we are going to create. + // Important: this is the signature for calling us, the onward call always has sig viiii. + var sig; + var ret_by_arg = false; + switch (rtype_id) { + case FFI_TYPE_VOID: + sig = 'v'; + break; + case FFI_TYPE_STRUCT: + case FFI_TYPE_LONGDOUBLE: + // Return via a first pointer argument. + sig = 'vi'; + ret_by_arg = true; + break; + case FFI_TYPE_INT: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + sig = 'i'; + break; + case FFI_TYPE_FLOAT: + sig = 'f'; + break; + case FFI_TYPE_DOUBLE: + sig = 'd'; + break; + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + sig = 'j'; + break; + case FFI_TYPE_COMPLEX: + throw new Error('complex ret marshalling nyi'); + default: + throw new Error('Unexpected rtype ' + rtype_id); + } + var unboxed_arg_type_id_list = []; + var unboxed_arg_type_info_list = []; + for (var i = 0; i < nargs; i++) { + var arg_unboxed = unbox_small_structs(DEREF_U32(arg_types_ptr, i)); + var arg_type_ptr = arg_unboxed[0]; + var arg_type_id = arg_unboxed[1]; + unboxed_arg_type_id_list.push(arg_type_id); + unboxed_arg_type_info_list.push([FFI_TYPE__SIZE(arg_type_ptr), FFI_TYPE__ALIGN(arg_type_ptr)]); + } + for (var i = 0; i < nfixedargs; i++) { + switch (unboxed_arg_type_id_list[i]) { + case FFI_TYPE_INT: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + case FFI_TYPE_STRUCT: + sig += 'i'; + break; + case FFI_TYPE_FLOAT: + sig += 'f'; + break; + case FFI_TYPE_DOUBLE: + sig += 'd'; + break; + case FFI_TYPE_LONGDOUBLE: + sig += 'jj'; + break; + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + sig += 'j'; + break; + case FFI_TYPE_COMPLEX: + throw new Error('complex marshalling nyi'); + default: + throw new Error('Unexpected argtype ' + arg_type_id); + } + } + if (nfixedargs < nargs) { + // extra pointer to varargs stack + sig += "i"; + } + LOG_DEBUG("CREATE_CLOSURE", "sig:", sig); + function trampoline() { + var args = Array.prototype.slice.call(arguments); + var size = 0; + var orig_stack_ptr = stackSave(); + var cur_ptr = orig_stack_ptr; + var ret_ptr; + var jsarg_idx = 0; + // Should we return by argument or not? The onwards call returns by argument + // no matter what. (Warning: ret_by_arg means the opposite in ffi_call) + if (ret_by_arg) { + ret_ptr = args[jsarg_idx++]; + } else { + // We might return 4 bytes or 8 bytes, allocate 8 just in case. + STACK_ALLOC(cur_ptr, 8, 8); + ret_ptr = cur_ptr; + } + cur_ptr -= 4 * nargs; + var args_ptr = cur_ptr; + var carg_idx = 0; + // Here we either have the actual argument, or a pair of BigInts for long + // double, or a pointer to struct. We have to store into args_ptr[i] a + // pointer to the ith argument. If the argument is a struct, just store the + // pointer. Otherwise allocate stack space and copy the js argument onto the + // stack. + for (; carg_idx < nfixedargs; carg_idx++) { + // jsarg_idx might start out as 0 or 1 depending on ret_by_arg + // it advances an extra time for long double + var cur_arg = args[jsarg_idx++]; + var arg_type_info = unboxed_arg_type_info_list[carg_idx]; + var arg_size = arg_type_info[0]; + var arg_align = arg_type_info[1]; + var arg_type_id = unboxed_arg_type_id_list[carg_idx]; + switch (arg_type_id) { + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + // Bad things happen if we don't align to 4 here + STACK_ALLOC(cur_ptr, 1, 4); + DEREF_U32(args_ptr, carg_idx) = cur_ptr; + DEREF_U8(cur_ptr, 0) = cur_arg; + break; + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + // Bad things happen if we don't align to 4 here + STACK_ALLOC(cur_ptr, 2, 4); + DEREF_U32(args_ptr, carg_idx) = cur_ptr; + DEREF_U16(cur_ptr, 0) = cur_arg; + break; + case FFI_TYPE_INT: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + STACK_ALLOC(cur_ptr, 4, 4); + DEREF_U32(args_ptr, carg_idx) = cur_ptr; + DEREF_U32(cur_ptr, 0) = cur_arg; + break; + case FFI_TYPE_STRUCT: + // cur_arg is already a pointer to struct + // copy it onto stack to pass by value + STACK_ALLOC(cur_ptr, arg_size, arg_align); + HEAP8.subarray(cur_ptr, cur_ptr + arg_size).set(HEAP8.subarray(cur_arg, cur_arg + arg_size)); + DEREF_U32(args_ptr, carg_idx) = cur_ptr; + break; + case FFI_TYPE_FLOAT: + STACK_ALLOC(cur_ptr, 4, 4); + DEREF_U32(args_ptr, carg_idx) = cur_ptr; + DEREF_F32(cur_ptr, 0) = cur_arg; + break; + case FFI_TYPE_DOUBLE: + STACK_ALLOC(cur_ptr, 8, 8); + DEREF_U32(args_ptr, carg_idx) = cur_ptr; + DEREF_F64(cur_ptr, 0) = cur_arg; + break; + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + STACK_ALLOC(cur_ptr, 8, 8); + DEREF_U32(args_ptr, carg_idx) = cur_ptr; + #if WASM_BIGINT + DEREF_U64(cur_ptr, 0) = cur_arg; + #else + // Bigint arg was split by legalizer adaptor + DEREF_U32(cur_ptr, 0) = cur_arg; + cur_arg = args[jsarg_idx++]; + DEREF_U32(cur_ptr, 1) = cur_arg; + #endif + break; + case FFI_TYPE_LONGDOUBLE: + STACK_ALLOC(cur_ptr, 16, 8); + DEREF_U32(args_ptr, carg_idx) = cur_ptr; + #if WASM_BIGINT + DEREF_U64(cur_ptr, 0) = cur_arg; + cur_arg = args[jsarg_idx++]; + DEREF_U64(cur_ptr, 1) = cur_arg; + #else + // Was split by legalizer adaptor + DEREF_U32(cur_ptr, 0) = cur_arg; + cur_arg = args[jsarg_idx++]; + DEREF_U32(cur_ptr, 1) = cur_arg; + cur_arg = args[jsarg_idx++]; + DEREF_U32(cur_ptr, 2) = cur_arg; + cur_arg = args[jsarg_idx++]; + DEREF_U32(cur_ptr, 3) = cur_arg; + #endif + break; + } + } + // If its a varargs call, last js argument is a pointer to the varargs. + var varargs = args[args.length - 1]; + // We have no way of knowing how many varargs were actually provided, this + // fills the rest of the stack space allocated with nonsense. The onward + // call will know to ignore the nonsense. + + // We either have a pointer to the argument if the argument is not a struct + // or a pointer to pointer to struct. We need to store a pointer to the + // argument into args_ptr[i] + for (; carg_idx < nargs; carg_idx++) { + var arg_type_id = unboxed_arg_type_id_list[carg_idx]; + var arg_type_info = unboxed_arg_type_info_list[carg_idx]; + var arg_size = arg_type_info[0]; + var arg_align = arg_type_info[1]; + if (arg_type_id === FFI_TYPE_STRUCT) { + // In this case varargs is a pointer to pointer to struct so we need to + // deref once + var struct_ptr = DEREF_U32(varargs, 0); + STACK_ALLOC(cur_ptr, arg_size, arg_align); + HEAP8.subarray(cur_ptr, cur_ptr + arg_size).set(HEAP8.subarray(struct_ptr, struct_ptr + arg_size)); + DEREF_U32(args_ptr, carg_idx) = cur_ptr; + } else { + DEREF_U32(args_ptr, carg_idx) = varargs; + } + varargs += 4; + } + stackRestore(cur_ptr); + stackAlloc(0); // stackAlloc enforces alignment invariants on the stack pointer + LOG_DEBUG("CALL_CLOSURE", "closure:", closure, "fptr", CLOSURE__fun(closure), "cif", CLOSURE__cif(closure)); + getWasmTableEntry(CLOSURE__fun(closure))( + CLOSURE__cif(closure), ret_ptr, args_ptr, + CLOSURE__user_data(closure) + ); + stackRestore(orig_stack_ptr); + + // If we aren't supposed to return by argument, figure out what to return. + if (!ret_by_arg) { + switch (sig[0]) { + case "i": + return DEREF_U32(ret_ptr, 0); + case "j": + #if WASM_BIGINT + return DEREF_U64(ret_ptr, 0); + #else + // Split the return i64, set the upper 32 bits into tempRet0 and return + // the lower 32 bits. + setTempRet0(DEREF_U32(ret_ptr, 1)); + return DEREF_U32(ret_ptr, 0); + #endif + case "d": + return DEREF_F64(ret_ptr, 0); + case "f": + return DEREF_F32(ret_ptr, 0); + } + } + } + try { + var wasm_trampoline = JS_FUNCTION_TO_WASM(trampoline, sig); + } catch(e) { + return FFI_BAD_TYPEDEF_MACRO; + } + setWasmTableEntry(codeloc, wasm_trampoline); + CLOSURE__cif(closure) = cif; + CLOSURE__fun(closure) = fun; + CLOSURE__user_data(closure) = user_data; + return FFI_OK_MACRO; +}) + +// EM_JS does not correctly handle function pointer arguments, so we need a +// helper +ffi_status ffi_prep_closure_loc(ffi_closure *closure, ffi_cif *cif, + void (*fun)(ffi_cif *, void *, void **, void *), + void *user_data, void *codeloc) { + if (cif->abi != FFI_WASM32_EMSCRIPTEN) + return FFI_BAD_ABI; + return ffi_prep_closure_loc_js(closure, cif, (void *)fun, user_data, + codeloc); +} diff --git a/src/libffi/libffi-3.4.6/src/wasm32/ffitarget.h b/src/libffi/libffi-3.4.6/src/wasm32/ffitarget.h new file mode 100644 index 000000000..ac78b7433 --- /dev/null +++ b/src/libffi/libffi-3.4.6/src/wasm32/ffitarget.h @@ -0,0 +1,62 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2018-2023 Hood Chatham, Brion Vibber, Kleis Auke Wolthuizen, and others. + + Target configuration macros for wasm32. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + +/* ---- Generic type definitions ----------------------------------------- */ + +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +// TODO: https://github.com/emscripten-core/emscripten/issues/9868 +typedef void (*ffi_fp)(void); + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_WASM32, // "raw", no structures, varargs, or closures (not implemented!) + FFI_WASM32_EMSCRIPTEN, // structures, varargs, and split 64-bit params + FFI_LAST_ABI, +#ifdef __EMSCRIPTEN__ + FFI_DEFAULT_ABI = FFI_WASM32_EMSCRIPTEN +#else + FFI_DEFAULT_ABI = FFI_WASM32 +#endif +} ffi_abi; + +#define FFI_CLOSURES 1 +// #define FFI_GO_CLOSURES 0 +#define FFI_TRAMPOLINE_SIZE 4 +// #define FFI_NATIVE_RAW_API 0 +#define FFI_TARGET_SPECIFIC_VARIADIC 1 +#define FFI_EXTRA_CIF_FIELDS unsigned int nfixedargs + +#endif diff --git a/src/libffi/libffi-3.4.4/src/x86/asmnames.h b/src/libffi/libffi-3.4.6/src/x86/asmnames.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/x86/asmnames.h rename to src/libffi/libffi-3.4.6/src/x86/asmnames.h diff --git a/src/libffi/libffi-3.4.4/src/x86/ffi.c b/src/libffi/libffi-3.4.6/src/x86/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/x86/ffi.c rename to src/libffi/libffi-3.4.6/src/x86/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/x86/ffi64.c b/src/libffi/libffi-3.4.6/src/x86/ffi64.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/x86/ffi64.c rename to src/libffi/libffi-3.4.6/src/x86/ffi64.c diff --git a/src/libffi/libffi-3.4.4/src/x86/ffitarget.h b/src/libffi/libffi-3.4.6/src/x86/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/x86/ffitarget.h rename to src/libffi/libffi-3.4.6/src/x86/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/x86/ffiw64.c b/src/libffi/libffi-3.4.6/src/x86/ffiw64.c similarity index 99% rename from src/libffi/libffi-3.4.4/src/x86/ffiw64.c rename to src/libffi/libffi-3.4.6/src/x86/ffiw64.c index 827165868..2be8b9927 100644 --- a/src/libffi/libffi-3.4.4/src/x86/ffiw64.c +++ b/src/libffi/libffi-3.4.6/src/x86/ffiw64.c @@ -227,7 +227,7 @@ EFI64(ffi_prep_closure_loc)(ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, - void *codeloc) + void *codeloc MAYBE_UNUSED) { static const unsigned char trampoline[FFI_TRAMPOLINE_SIZE - 8] = { /* endbr64 */ diff --git a/src/libffi/libffi-3.4.4/src/x86/internal.h b/src/libffi/libffi-3.4.6/src/x86/internal.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/x86/internal.h rename to src/libffi/libffi-3.4.6/src/x86/internal.h diff --git a/src/libffi/libffi-3.4.4/src/x86/internal64.h b/src/libffi/libffi-3.4.6/src/x86/internal64.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/x86/internal64.h rename to src/libffi/libffi-3.4.6/src/x86/internal64.h diff --git a/src/libffi/libffi-3.4.4/src/x86/sysv.S b/src/libffi/libffi-3.4.6/src/x86/sysv.S similarity index 90% rename from src/libffi/libffi-3.4.4/src/x86/sysv.S rename to src/libffi/libffi-3.4.6/src/x86/sysv.S index 7110f02f5..c7a0fb51b 100644 --- a/src/libffi/libffi-3.4.4/src/x86/sysv.S +++ b/src/libffi/libffi-3.4.6/src/x86/sysv.S @@ -888,10 +888,27 @@ ENDF(C(ffi_closure_raw_THISCALL)) #endif /* !FFI_NO_RAW_API */ #ifdef X86_DARWIN -# define COMDAT(X) \ - .section __TEXT,__text,coalesced,pure_instructions; \ +/* The linker in use on earlier Darwin needs weak definitions to be + placed in a coalesced section. That section should not be called + __TEXT,__text since that would be re-defining the attributes of the + .text section (which is an error for earlier tools). Here we use + '__textcoal_nt' which is what GCC emits for this. + Later linker versions are happy to use a normal section and, after + Darwin12 / OSX 10.8, the tools warn that using coalesced sections + for this is deprecated so we must switch to avoid build fails and/or + deprecation warnings. */ +# if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1080 +# define COMDAT(X) \ + .section __TEXT,__textcoal_nt,coalesced,pure_instructions; \ + .weak_definition X; \ + FFI_HIDDEN(X) +# else +# define COMDAT(X) \ + .text; \ .weak_definition X; \ FFI_HIDDEN(X) +# endif #elif defined __ELF__ && !(defined(__sun__) && defined(__svr4__)) # define COMDAT(X) \ .section .text.X,"axG",@progbits,X,comdat; \ @@ -916,7 +933,37 @@ ENDF(C(__x86.get_pc_thunk.dx)) #endif /* DARWIN || HIDDEN */ #endif /* __PIC__ */ -/* Sadly, OSX cctools-as doesn't understand .cfi directives at all. */ +/* Sadly, OSX cctools-as does not understand .cfi directives at all so + we build an eh frame by hand. */ + +#ifdef __APPLE__ +/* The cctools assembler will try to make a difference between two local + symbols into a relocation against, which will not work in the eh (produces + link-time fails). + To avoid this, we compute the symbol difference with a .set directive and + then substitute this value. */ +# define LEN(N, P) .set Llen$N$P,L(N)-L(P); .long Llen$N$P +/* Note, this assume DW_CFA_advance_loc1 fits into 7 bits. */ +# define ADV(N, P) .set Ladv$N$P,L(N)-L(P); .byte 2, Ladv$N$P +/* For historical reasons, the EH reg numbers for SP and FP are swapped from + the DWARF ones for 32b Darwin. */ +# define SP 5 +# define FP 4 +# define ENC 0x10 +#else +# define LEN(N, P) .long L(N)-L(P) +/* Assume DW_CFA_advance_loc1 fits. */ +# define ADV(N, P) .byte 2, L(N)-L(P) +# define SP 4 +# define FP 5 +# define ENC 0x1b +#endif + +#ifdef HAVE_AS_X86_PCREL +# define PCREL(X) X-. +#else +# define PCREL(X) X@rel +#endif #ifdef __APPLE__ .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support @@ -928,17 +975,11 @@ EHFrame0: #else .section .eh_frame,EH_FRAME_FLAGS,@progbits #endif - -#ifdef HAVE_AS_X86_PCREL -# define PCREL(X) X - . -#else -# define PCREL(X) X@rel +#ifndef __APPLE__ +/* EH sections are already suitably aligned on Darwin. */ + .balign 4 #endif -/* Simplify advancing between labels. Assume DW_CFA_advance_loc1 fits. */ -#define ADV(N, P) .byte 2, L(N)-L(P) - - .balign 4 L(CIE): .set L(set0),L(ECIE)-L(SCIE) .long L(set0) /* CIE Length */ @@ -950,8 +991,8 @@ L(SCIE): .byte 0x7c /* CIE Data Alignment Factor */ .byte 0x8 /* CIE RA Column */ .byte 1 /* Augmentation size */ - .byte 0x1b /* FDE Encoding (pcrel sdata4) */ - .byte 0xc, 4, 4 /* DW_CFA_def_cfa, %esp offset 4 */ + .byte ENC /* FDE Encoding (pcrel abs/4byte) */ + .byte 0xc, SP, 4 /* DW_CFA_def_cfa, %esp offset 4 */ .byte 0x80+8, 1 /* DW_CFA_offset, %eip offset 1*-4 */ .balign 4 L(ECIE): @@ -959,20 +1000,20 @@ L(ECIE): .set L(set1),L(EFDE1)-L(SFDE1) .long L(set1) /* FDE Length */ L(SFDE1): - .long L(SFDE1)-L(CIE) /* FDE CIE offset */ + LEN(SFDE1, CIE) /* FDE CIE offset */ .long PCREL(L(UW0)) /* Initial location */ - .long L(UW5)-L(UW0) /* Address range */ + LEN(UW5, UW0) /* Address range */ .byte 0 /* Augmentation size */ ADV(UW1, UW0) - .byte 0xc, 5, 8 /* DW_CFA_def_cfa, %ebp 8 */ - .byte 0x80+5, 2 /* DW_CFA_offset, %ebp 2*-4 */ + .byte 0xc, FP, 8 /* DW_CFA_def_cfa, %ebp 8 */ + .byte 0x80+FP, 2 /* DW_CFA_offset, %ebp 2*-4 */ ADV(UW2, UW1) .byte 0x80+3, 0 /* DW_CFA_offset, %ebx 0*-4 */ ADV(UW3, UW2) .byte 0xa /* DW_CFA_remember_state */ - .byte 0xc, 4, 4 /* DW_CFA_def_cfa, %esp 4 */ + .byte 0xc, SP, 4 /* DW_CFA_def_cfa, %esp 4 */ .byte 0xc0+3 /* DW_CFA_restore, %ebx */ - .byte 0xc0+5 /* DW_CFA_restore, %ebp */ + .byte 0xc0+FP /* DW_CFA_restore, %ebp */ ADV(UW4, UW3) .byte 0xb /* DW_CFA_restore_state */ .balign 4 @@ -981,9 +1022,9 @@ L(EFDE1): .set L(set2),L(EFDE2)-L(SFDE2) .long L(set2) /* FDE Length */ L(SFDE2): - .long L(SFDE2)-L(CIE) /* FDE CIE offset */ + LEN(SFDE2, CIE) /* FDE CIE offset */ .long PCREL(L(UW6)) /* Initial location */ - .long L(UW8)-L(UW6) /* Address range */ + LEN(UW8,UW6) /* Address range */ .byte 0 /* Augmentation size */ ADV(UW7, UW6) .byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */ @@ -993,9 +1034,9 @@ L(EFDE2): .set L(set3),L(EFDE3)-L(SFDE3) .long L(set3) /* FDE Length */ L(SFDE3): - .long L(SFDE3)-L(CIE) /* FDE CIE offset */ + LEN(SFDE3, CIE) /* FDE CIE offset */ .long PCREL(L(UW9)) /* Initial location */ - .long L(UW11)-L(UW9) /* Address range */ + LEN(UW11, UW9) /* Address range */ .byte 0 /* Augmentation size */ ADV(UW10, UW9) .byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */ @@ -1005,9 +1046,9 @@ L(EFDE3): .set L(set4),L(EFDE4)-L(SFDE4) .long L(set4) /* FDE Length */ L(SFDE4): - .long L(SFDE4)-L(CIE) /* FDE CIE offset */ + LEN(SFDE4, CIE) /* FDE CIE offset */ .long PCREL(L(UW12)) /* Initial location */ - .long L(UW20)-L(UW12) /* Address range */ + LEN(UW20, UW12) /* Address range */ .byte 0 /* Augmentation size */ ADV(UW13, UW12) .byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */ @@ -1033,9 +1074,9 @@ L(EFDE4): .set L(set5),L(EFDE5)-L(SFDE5) .long L(set5) /* FDE Length */ L(SFDE5): - .long L(SFDE5)-L(CIE) /* FDE CIE offset */ + LEN(SFDE5, CIE) /* FDE CIE offset */ .long PCREL(L(UW21)) /* Initial location */ - .long L(UW23)-L(UW21) /* Address range */ + LEN(UW23, UW21) /* Address range */ .byte 0 /* Augmentation size */ ADV(UW22, UW21) .byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */ @@ -1045,9 +1086,9 @@ L(EFDE5): .set L(set6),L(EFDE6)-L(SFDE6) .long L(set6) /* FDE Length */ L(SFDE6): - .long L(SFDE6)-L(CIE) /* FDE CIE offset */ + LEN(SFDE6, CIE) /* FDE CIE offset */ .long PCREL(L(UW24)) /* Initial location */ - .long L(UW26)-L(UW24) /* Address range */ + LEN(UW26, UW24) /* Address range */ .byte 0 /* Augmentation size */ .byte 0xe, 8 /* DW_CFA_def_cfa_offset */ .byte 0x80+8, 2 /* DW_CFA_offset %eip, 2*-4 */ @@ -1059,9 +1100,9 @@ L(EFDE6): .set L(set7),L(EFDE7)-L(SFDE7) .long L(set7) /* FDE Length */ L(SFDE7): - .long L(SFDE7)-L(CIE) /* FDE CIE offset */ + LEN(SFDE7, CIE) /* FDE CIE offset */ .long PCREL(L(UW27)) /* Initial location */ - .long L(UW31)-L(UW27) /* Address range */ + LEN(UW31, UW27) /* Address range */ .byte 0 /* Augmentation size */ ADV(UW28, UW27) .byte 0xe, closure_FS+4 /* DW_CFA_def_cfa_offset */ @@ -1073,14 +1114,13 @@ L(SFDE7): #endif .balign 4 L(EFDE7): - #if !FFI_NO_RAW_API .set L(set8),L(EFDE8)-L(SFDE8) .long L(set8) /* FDE Length */ L(SFDE8): - .long L(SFDE8)-L(CIE) /* FDE CIE offset */ + LEN(SFDE8, CIE) /* FDE CIE offset */ .long PCREL(L(UW32)) /* Initial location */ - .long L(UW40)-L(UW32) /* Address range */ + LEN(UW40, UW32) /* Address range */ .byte 0 /* Augmentation size */ ADV(UW33, UW32) .byte 0xe, raw_closure_S_FS+4 /* DW_CFA_def_cfa_offset */ @@ -1102,9 +1142,9 @@ L(EFDE8): .set L(set9),L(EFDE9)-L(SFDE9) .long L(set9) /* FDE Length */ L(SFDE9): - .long L(SFDE9)-L(CIE) /* FDE CIE offset */ + LEN(SFDE9, CIE) /* FDE CIE offset */ .long PCREL(L(UW41)) /* Initial location */ - .long L(UW52)-L(UW41) /* Address range */ + LEN(UW52, UW41) /* Address range */ .byte 0 /* Augmentation size */ ADV(UW42, UW41) .byte 0xe, 0 /* DW_CFA_def_cfa_offset */ @@ -1141,8 +1181,12 @@ L(EFDE9): @feat.00 = 1 #endif -#ifdef __APPLE__ +#if defined(__APPLE__) .subsections_via_symbols +# if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \ + __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1070 && __clang__ +/* compact unwind is not used with GCC at present, was not present before 10.6 + but has some bugs there, so do not emit until 10.7. */ .section __LD,__compact_unwind,regular,debug /* compact unwind for ffi_call_i386 */ @@ -1216,6 +1260,7 @@ L(EFDE9): .long 0x04000000 /* use dwarf unwind info */ .long 0 .long 0 +#endif /* use compact unwind */ #endif /* __APPLE__ */ #endif /* ifndef _MSC_VER */ diff --git a/src/libffi/libffi-3.4.4/src/x86/sysv_intel.S b/src/libffi/libffi-3.4.6/src/x86/sysv_intel.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/x86/sysv_intel.S rename to src/libffi/libffi-3.4.6/src/x86/sysv_intel.S diff --git a/src/libffi/libffi-3.4.4/src/x86/unix64.S b/src/libffi/libffi-3.4.6/src/x86/unix64.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/x86/unix64.S rename to src/libffi/libffi-3.4.6/src/x86/unix64.S diff --git a/src/libffi/libffi-3.4.4/src/x86/win64.S b/src/libffi/libffi-3.4.6/src/x86/win64.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/x86/win64.S rename to src/libffi/libffi-3.4.6/src/x86/win64.S diff --git a/src/libffi/libffi-3.4.4/src/x86/win64_intel.S b/src/libffi/libffi-3.4.6/src/x86/win64_intel.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/x86/win64_intel.S rename to src/libffi/libffi-3.4.6/src/x86/win64_intel.S diff --git a/src/libffi/libffi-3.4.4/src/xtensa/ffi.c b/src/libffi/libffi-3.4.6/src/xtensa/ffi.c similarity index 100% rename from src/libffi/libffi-3.4.4/src/xtensa/ffi.c rename to src/libffi/libffi-3.4.6/src/xtensa/ffi.c diff --git a/src/libffi/libffi-3.4.4/src/xtensa/ffitarget.h b/src/libffi/libffi-3.4.6/src/xtensa/ffitarget.h similarity index 100% rename from src/libffi/libffi-3.4.4/src/xtensa/ffitarget.h rename to src/libffi/libffi-3.4.6/src/xtensa/ffitarget.h diff --git a/src/libffi/libffi-3.4.4/src/xtensa/sysv.S b/src/libffi/libffi-3.4.6/src/xtensa/sysv.S similarity index 100% rename from src/libffi/libffi-3.4.4/src/xtensa/sysv.S rename to src/libffi/libffi-3.4.6/src/xtensa/sysv.S diff --git a/src/libffi/libffi-3.4.6/testsuite/Makefile.am b/src/libffi/libffi-3.4.6/testsuite/Makefile.am new file mode 100644 index 000000000..d286cf7f2 --- /dev/null +++ b/src/libffi/libffi-3.4.6/testsuite/Makefile.am @@ -0,0 +1,87 @@ +## Process this file with automake to produce Makefile.in. + +AUTOMAKE_OPTIONS = foreign dejagnu + +EXTRA_DEJAGNU_SITE_CONFIG=../local.exp + +CLEANFILES = *.exe core* *.log *.sum + +EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \ + emscripten/node-tests.sh emscripten/test.html emscripten/test_libffi.py \ + emscripten/build-tests.sh lib/libffi.exp lib/target-libpath.exp \ + lib/wrapper.exp libffi.bhaible/Makefile libffi.bhaible/README \ + libffi.bhaible/alignof.h libffi.bhaible/bhaible.exp libffi.bhaible/test-call.c \ + libffi.bhaible/test-callback.c libffi.bhaible/testcases.c libffi.call/align_mixed.c \ + libffi.call/align_stdcall.c libffi.call/bpo_38748.c libffi.call/call.exp \ + libffi.call/err_bad_typedef.c libffi.call/ffitest.h libffi.call/float.c \ + libffi.call/float1.c libffi.call/float2.c libffi.call/float3.c \ + libffi.call/float4.c libffi.call/float_va.c libffi.call/many.c \ + libffi.call/many2.c libffi.call/many_double.c libffi.call/many_mixed.c \ + libffi.call/negint.c libffi.call/offsets.c libffi.call/pr1172638.c \ + libffi.call/promotion.c libffi.call/pyobjc_tc.c libffi.call/return_dbl.c \ + libffi.call/return_dbl1.c libffi.call/return_dbl2.c libffi.call/return_fl.c \ + libffi.call/return_fl1.c libffi.call/return_fl2.c libffi.call/return_fl3.c \ + libffi.call/return_ldl.c libffi.call/return_ll.c libffi.call/return_ll1.c \ + libffi.call/return_sc.c libffi.call/return_sl.c libffi.call/return_uc.c \ + libffi.call/return_ul.c libffi.call/s55.c libffi.call/strlen.c \ + libffi.call/strlen2.c libffi.call/strlen3.c libffi.call/strlen4.c \ + libffi.call/struct1.c libffi.call/struct10.c libffi.call/struct2.c \ + libffi.call/struct3.c libffi.call/struct4.c libffi.call/struct5.c \ + libffi.call/struct6.c libffi.call/struct7.c libffi.call/struct8.c \ + libffi.call/struct9.c libffi.call/struct_by_value_2.c libffi.call/struct_by_value_3.c \ + libffi.call/struct_by_value_3f.c libffi.call/struct_by_value_4.c libffi.call/struct_by_value_4f.c \ + libffi.call/struct_by_value_big.c libffi.call/struct_by_value_small.c libffi.call/struct_return_2H.c \ + libffi.call/struct_return_8H.c libffi.call/uninitialized.c libffi.call/va_1.c \ + libffi.call/va_2.c libffi.call/va_3.c libffi.call/va_struct1.c \ + libffi.call/va_struct2.c libffi.call/va_struct3.c libffi.call/callback.c \ + libffi.call/callback2.c libffi.call/callback3.c libffi.call/callback4.c \ + libffi.closures/closure.exp libffi.closures/closure_fn0.c libffi.closures/closure_fn1.c \ + libffi.closures/closure_fn2.c libffi.closures/closure_fn3.c libffi.closures/closure_fn4.c \ + libffi.closures/closure_fn5.c libffi.closures/closure_fn6.c libffi.closures/closure_loc_fn0.c \ + libffi.closures/closure_simple.c libffi.closures/cls_12byte.c libffi.closures/cls_16byte.c \ + libffi.closures/cls_18byte.c libffi.closures/cls_19byte.c libffi.closures/cls_1_1byte.c \ + libffi.closures/cls_20byte.c libffi.closures/cls_20byte1.c libffi.closures/cls_24byte.c \ + libffi.closures/cls_2byte.c libffi.closures/cls_3_1byte.c libffi.closures/cls_3byte1.c \ + libffi.closures/cls_3byte2.c libffi.closures/cls_3float.c libffi.closures/cls_4_1byte.c \ + libffi.closures/cls_4byte.c libffi.closures/cls_5_1_byte.c libffi.closures/cls_5byte.c \ + libffi.closures/cls_64byte.c libffi.closures/cls_6_1_byte.c libffi.closures/cls_6byte.c \ + libffi.closures/cls_7_1_byte.c libffi.closures/cls_7byte.c libffi.closures/cls_8byte.c \ + libffi.closures/cls_9byte1.c libffi.closures/cls_9byte2.c libffi.closures/cls_align_double.c \ + libffi.closures/cls_align_float.c libffi.closures/cls_align_longdouble.c libffi.closures/cls_align_longdouble_split.c \ + libffi.closures/cls_align_longdouble_split2.c libffi.closures/cls_align_pointer.c libffi.closures/cls_align_sint16.c \ + libffi.closures/cls_align_sint32.c libffi.closures/cls_align_sint64.c libffi.closures/cls_align_uint16.c \ + libffi.closures/cls_align_uint32.c libffi.closures/cls_align_uint64.c libffi.closures/cls_dbls_struct.c \ + libffi.closures/cls_double.c libffi.closures/cls_double_va.c libffi.closures/cls_float.c \ + libffi.closures/cls_longdouble.c libffi.closures/cls_longdouble_va.c libffi.closures/cls_many_mixed_args.c \ + libffi.closures/cls_many_mixed_float_double.c libffi.closures/cls_multi_schar.c libffi.closures/cls_multi_sshort.c \ + libffi.closures/cls_multi_sshortchar.c libffi.closures/cls_multi_uchar.c libffi.closures/cls_multi_ushort.c \ + libffi.closures/cls_multi_ushortchar.c libffi.closures/cls_pointer.c libffi.closures/cls_pointer_stack.c \ + libffi.closures/cls_schar.c libffi.closures/cls_sint.c libffi.closures/cls_sshort.c \ + libffi.closures/cls_struct_va1.c libffi.closures/cls_uchar.c libffi.closures/cls_uint.c \ + libffi.closures/cls_uint_va.c libffi.closures/cls_ulong_va.c libffi.closures/cls_ulonglong.c \ + libffi.closures/cls_ushort.c libffi.closures/err_bad_abi.c libffi.closures/ffitest.h \ + libffi.closures/huge_struct.c libffi.closures/nested_struct.c libffi.closures/nested_struct1.c \ + libffi.closures/nested_struct10.c libffi.closures/nested_struct11.c libffi.closures/nested_struct12.c \ + libffi.closures/nested_struct13.c libffi.closures/nested_struct2.c libffi.closures/nested_struct3.c \ + libffi.closures/nested_struct4.c libffi.closures/nested_struct5.c libffi.closures/nested_struct6.c \ + libffi.closures/nested_struct7.c libffi.closures/nested_struct8.c libffi.closures/nested_struct9.c \ + libffi.closures/problem1.c libffi.closures/single_entry_structs1.c libffi.closures/single_entry_structs2.c \ + libffi.closures/single_entry_structs3.c libffi.closures/stret_large.c libffi.closures/stret_large2.c \ + libffi.closures/stret_medium.c libffi.closures/stret_medium2.c libffi.closures/testclosure.c \ + libffi.closures/unwindtest.cc libffi.closures/unwindtest_ffi_call.cc libffi.complex/cls_align_complex.inc \ + libffi.complex/cls_align_complex_double.c libffi.complex/cls_align_complex_float.c libffi.complex/cls_align_complex_longdouble.c \ + libffi.complex/cls_complex.inc libffi.complex/cls_complex_double.c libffi.complex/cls_complex_float.c \ + libffi.complex/cls_complex_longdouble.c libffi.complex/cls_complex_struct.inc libffi.complex/cls_complex_struct_double.c \ + libffi.complex/cls_complex_struct_float.c libffi.complex/cls_complex_struct_longdouble.c libffi.complex/cls_complex_va.inc \ + libffi.complex/cls_complex_va_double.c libffi.complex/cls_complex_va_float.c libffi.complex/cls_complex_va_longdouble.c \ + libffi.complex/complex.exp libffi.complex/complex.inc libffi.complex/complex_defs_double.inc \ + libffi.complex/complex_defs_float.inc libffi.complex/complex_defs_longdouble.inc libffi.complex/complex_double.c \ + libffi.complex/complex_float.c libffi.complex/complex_int.c libffi.complex/complex_longdouble.c \ + libffi.complex/ffitest.h libffi.complex/many_complex.inc libffi.complex/many_complex_double.c \ + libffi.complex/many_complex_float.c libffi.complex/many_complex_longdouble.c libffi.complex/return_complex.inc \ + libffi.complex/return_complex1.inc libffi.complex/return_complex1_double.c libffi.complex/return_complex1_float.c \ + libffi.complex/return_complex1_longdouble.c libffi.complex/return_complex2.inc libffi.complex/return_complex2_double.c \ + libffi.complex/return_complex2_float.c libffi.complex/return_complex2_longdouble.c libffi.complex/return_complex_double.c \ + libffi.complex/return_complex_float.c libffi.complex/return_complex_longdouble.c libffi.go/aa-direct.c \ + libffi.go/closure1.c libffi.go/ffitest.h libffi.go/go.exp \ + libffi.go/static-chain.h Makefile.am Makefile.in diff --git a/src/libffi/libffi-3.4.4/testsuite/Makefile.in b/src/libffi/libffi-3.4.6/testsuite/Makefile.in similarity index 68% rename from src/libffi/libffi-3.4.4/testsuite/Makefile.in rename to src/libffi/libffi-3.4.6/testsuite/Makefile.in index b3750c9e4..b99a02bf3 100644 --- a/src/libffi/libffi-3.4.4/testsuite/Makefile.in +++ b/src/libffi/libffi-3.4.6/testsuite/Makefile.in @@ -139,7 +139,6 @@ RUNTEST = runtest am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_LTLDFLAGS = @AM_LTLDFLAGS@ @@ -291,131 +290,85 @@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign dejagnu EXTRA_DEJAGNU_SITE_CONFIG = ../local.exp CLEANFILES = *.exe core* *.log *.sum -EXTRA_DIST = config/default.exp lib/libffi.exp lib/target-libpath.exp \ -lib/wrapper.exp libffi.bhaible/Makefile libffi.bhaible/README \ -libffi.bhaible/alignof.h libffi.bhaible/bhaible.exp \ -libffi.bhaible/test-call.c libffi.bhaible/test-callback.c \ -libffi.bhaible/testcases.c libffi.call/align_mixed.c \ -libffi.call/align_stdcall.c libffi.call/call.exp \ -libffi.call/err_bad_typedef.c libffi.call/ffitest.h \ -libffi.call/float.c libffi.call/float1.c libffi.call/float2.c \ -libffi.call/float3.c libffi.call/float4.c libffi.call/float_va.c \ -libffi.call/many.c libffi.call/many2.c libffi.call/many_double.c \ -libffi.call/many_mixed.c libffi.call/negint.c libffi.call/offsets.c \ -libffi.call/pr1172638.c libffi.call/promotion.c \ -libffi.call/pyobjc_tc.c libffi.call/return_dbl.c \ -libffi.call/return_dbl1.c libffi.call/return_dbl2.c \ -libffi.call/return_fl.c libffi.call/return_fl1.c \ -libffi.call/return_fl2.c libffi.call/return_fl3.c \ -libffi.call/return_ldl.c libffi.call/return_ll.c \ -libffi.call/return_ll1.c libffi.call/return_sc.c \ -libffi.call/return_sl.c libffi.call/return_uc.c \ -libffi.call/return_ul.c libffi.call/struct1.c libffi.call/struct10.c \ -libffi.call/struct2.c libffi.call/struct3.c libffi.call/struct4.c \ -libffi.call/struct5.c libffi.call/struct6.c libffi.call/struct7.c \ -libffi.call/struct8.c libffi.call/struct9.c \ -libffi.call/uninitialized.c libffi.call/va_1.c libffi.call/va_2.c \ -libffi.call/va_3.c libffi.call/va_struct1.c libffi.call/va_struct2.c \ -libffi.call/va_struct3.c libffi.call/struct_by_value_big.c \ -libffi.call/struct_by_value_2.c libffi.call/struct_by_value_3.c \ -libffi.call/struct_by_value_4.c libffi.call/struct_by_value_small.c \ -libffi.call/strlen2.c libffi.call/strlen3.c libffi.call/strlen4.c \ -libffi.call/strlen.c libffi.call/va_3.c \ -libffi.call/struct_by_value_2.c libffi.call/struct_by_value_3.c \ -libffi.call/struct_by_value_4.c libffi.closures/closure.exp \ -libffi.call/s55.c libffi.call/bpo-38748.c \ -libffi.closures/closure_fn0.c libffi.closures/closure_fn1.c \ -libffi.closures/closure_fn2.c libffi.closures/closure_fn3.c \ -libffi.closures/closure_fn4.c libffi.closures/closure_fn5.c \ -libffi.closures/closure_fn6.c libffi.closures/closure_loc_fn0.c \ -libffi.closures/closure_simple.c libffi.closures/cls_12byte.c \ -libffi.closures/cls_16byte.c libffi.closures/cls_18byte.c \ -libffi.closures/cls_19byte.c libffi.closures/cls_1_1byte.c \ -libffi.closures/cls_20byte.c libffi.closures/cls_20byte1.c \ -libffi.closures/cls_24byte.c libffi.closures/cls_2byte.c \ -libffi.closures/cls_3_1byte.c libffi.closures/cls_3byte1.c \ -libffi.closures/cls_3byte2.c libffi.closures/cls_3float.c \ -libffi.closures/cls_4_1byte.c libffi.closures/cls_4byte.c \ -libffi.closures/cls_5_1_byte.c libffi.closures/cls_5byte.c \ -libffi.closures/cls_64byte.c libffi.closures/cls_6_1_byte.c \ -libffi.closures/cls_6byte.c libffi.closures/cls_7_1_byte.c \ -libffi.closures/cls_7byte.c libffi.closures/cls_8byte.c \ -libffi.closures/cls_9byte1.c libffi.closures/cls_9byte2.c \ -libffi.closures/cls_align_double.c libffi.closures/cls_align_float.c \ -libffi.closures/cls_align_longdouble.c \ -libffi.closures/cls_align_pointer.c \ -libffi.closures/cls_align_sint16.c libffi.closures/cls_align_sint32.c \ -libffi.closures/cls_align_sint64.c libffi.closures/cls_align_uint16.c \ -libffi.closures/cls_align_uint32.c libffi.closures/cls_align_uint64.c \ -libffi.closures/cls_dbls_struct.c libffi.closures/cls_double.c \ -libffi.closures/cls_double_va.c libffi.closures/cls_float.c \ -libffi.closures/cls_longdouble_va.c \ -libffi.closures/cls_many_mixed_args.c \ -libffi.closures/cls_many_mixed_float_double.c \ -libffi.closures/cls_multi_schar.c libffi.closures/cls_multi_sshort.c \ -libffi.closures/cls_multi_sshortchar.c \ -libffi.closures/cls_multi_uchar.c libffi.closures/cls_multi_ushort.c \ -libffi.closures/cls_multi_ushortchar.c libffi.closures/cls_pointer.c \ -libffi.closures/cls_pointer_stack.c libffi.closures/cls_schar.c \ -libffi.closures/cls_sint.c libffi.closures/cls_sshort.c \ -libffi.closures/cls_struct_va1.c libffi.closures/cls_uchar.c \ -libffi.closures/cls_uint.c libffi.closures/cls_uint_va.c \ -libffi.closures/cls_ulong_va.c libffi.closures/cls_ulonglong.c \ -libffi.closures/cls_ushort.c libffi.closures/err_bad_abi.c \ -libffi.closures/ffitest.h libffi.closures/nested_struct.c \ -libffi.closures/nested_struct1.c libffi.closures/nested_struct10.c \ -libffi.closures/nested_struct11.c libffi.closures/nested_struct12.c \ -libffi.closures/nested_struct13.c libffi.closures/nested_struct2.c \ -libffi.closures/nested_struct3.c libffi.closures/nested_struct4.c \ -libffi.closures/nested_struct5.c libffi.closures/nested_struct6.c \ -libffi.closures/nested_struct7.c libffi.closures/nested_struct8.c \ -libffi.closures/nested_struct9.c libffi.closures/problem1.c \ -libffi.closures/single_entry_structs1.c \ -libffi.closures/single_entry_structs2.c \ -libffi.closures/single_entry_structs3.c libffi.closures/stret_large.c \ -libffi.closures/stret_large2.c libffi.closures/stret_medium.c \ -libffi.closures/stret_medium2.c libffi.closures/testclosure.c \ -libffi.closures/unwindtest.cc libffi.closures/unwindtest_ffi_call.cc \ -libffi.closures/cls_align_longdouble_split.c \ -libffi.closures/cls_align_longdouble_split2.c \ -libffi.closures/cls_longdouble.c libffi.closures/huge_struct.c \ -libffi.complex/cls_align_complex.inc \ -libffi.complex/cls_align_complex_double.c \ -libffi.complex/cls_align_complex_float.c \ -libffi.complex/cls_align_complex_longdouble.c \ -libffi.complex/cls_complex.inc libffi.complex/cls_complex_double.c \ -libffi.complex/cls_complex_float.c \ -libffi.complex/cls_complex_longdouble.c \ -libffi.complex/cls_complex_struct.inc \ -libffi.complex/cls_complex_struct_double.c \ -libffi.complex/cls_complex_struct_float.c \ -libffi.complex/cls_complex_struct_longdouble.c \ -libffi.complex/cls_complex_va.inc \ -libffi.complex/cls_complex_va_double.c \ -libffi.complex/cls_complex_va_float.c \ -libffi.complex/cls_complex_va_longdouble.c libffi.complex/complex.exp \ -libffi.complex/complex.inc libffi.complex/complex_defs_double.inc \ -libffi.complex/complex_defs_float.inc \ -libffi.complex/complex_defs_longdouble.inc \ -libffi.complex/complex_double.c libffi.complex/complex_float.c \ -libffi.complex/complex_int.c libffi.complex/complex_longdouble.c \ -libffi.complex/ffitest.h libffi.complex/many_complex.inc \ -libffi.complex/many_complex_double.c \ -libffi.complex/many_complex_float.c \ -libffi.complex/many_complex_longdouble.c \ -libffi.complex/return_complex.inc libffi.complex/return_complex1.inc \ -libffi.complex/return_complex1_double.c \ -libffi.complex/return_complex1_float.c \ -libffi.complex/return_complex1_longdouble.c \ -libffi.complex/return_complex2.inc \ -libffi.complex/return_complex2_double.c \ -libffi.complex/return_complex2_float.c \ -libffi.complex/return_complex2_longdouble.c \ -libffi.complex/return_complex_double.c \ -libffi.complex/return_complex_float.c \ -libffi.complex/return_complex_longdouble.c libffi.go/aa-direct.c \ -libffi.go/closure1.c libffi.go/ffitest.h libffi.go/go.exp \ -libffi.go/static-chain.h +EXTRA_DIST = config/default.exp emscripten/build.sh emscripten/conftest.py \ + emscripten/node-tests.sh emscripten/test.html emscripten/test_libffi.py \ + emscripten/build-tests.sh lib/libffi.exp lib/target-libpath.exp \ + lib/wrapper.exp libffi.bhaible/Makefile libffi.bhaible/README \ + libffi.bhaible/alignof.h libffi.bhaible/bhaible.exp libffi.bhaible/test-call.c \ + libffi.bhaible/test-callback.c libffi.bhaible/testcases.c libffi.call/align_mixed.c \ + libffi.call/align_stdcall.c libffi.call/bpo_38748.c libffi.call/call.exp \ + libffi.call/err_bad_typedef.c libffi.call/ffitest.h libffi.call/float.c \ + libffi.call/float1.c libffi.call/float2.c libffi.call/float3.c \ + libffi.call/float4.c libffi.call/float_va.c libffi.call/many.c \ + libffi.call/many2.c libffi.call/many_double.c libffi.call/many_mixed.c \ + libffi.call/negint.c libffi.call/offsets.c libffi.call/pr1172638.c \ + libffi.call/promotion.c libffi.call/pyobjc_tc.c libffi.call/return_dbl.c \ + libffi.call/return_dbl1.c libffi.call/return_dbl2.c libffi.call/return_fl.c \ + libffi.call/return_fl1.c libffi.call/return_fl2.c libffi.call/return_fl3.c \ + libffi.call/return_ldl.c libffi.call/return_ll.c libffi.call/return_ll1.c \ + libffi.call/return_sc.c libffi.call/return_sl.c libffi.call/return_uc.c \ + libffi.call/return_ul.c libffi.call/s55.c libffi.call/strlen.c \ + libffi.call/strlen2.c libffi.call/strlen3.c libffi.call/strlen4.c \ + libffi.call/struct1.c libffi.call/struct10.c libffi.call/struct2.c \ + libffi.call/struct3.c libffi.call/struct4.c libffi.call/struct5.c \ + libffi.call/struct6.c libffi.call/struct7.c libffi.call/struct8.c \ + libffi.call/struct9.c libffi.call/struct_by_value_2.c libffi.call/struct_by_value_3.c \ + libffi.call/struct_by_value_3f.c libffi.call/struct_by_value_4.c libffi.call/struct_by_value_4f.c \ + libffi.call/struct_by_value_big.c libffi.call/struct_by_value_small.c libffi.call/struct_return_2H.c \ + libffi.call/struct_return_8H.c libffi.call/uninitialized.c libffi.call/va_1.c \ + libffi.call/va_2.c libffi.call/va_3.c libffi.call/va_struct1.c \ + libffi.call/va_struct2.c libffi.call/va_struct3.c libffi.call/callback.c \ + libffi.call/callback2.c libffi.call/callback3.c libffi.call/callback4.c \ + libffi.closures/closure.exp libffi.closures/closure_fn0.c libffi.closures/closure_fn1.c \ + libffi.closures/closure_fn2.c libffi.closures/closure_fn3.c libffi.closures/closure_fn4.c \ + libffi.closures/closure_fn5.c libffi.closures/closure_fn6.c libffi.closures/closure_loc_fn0.c \ + libffi.closures/closure_simple.c libffi.closures/cls_12byte.c libffi.closures/cls_16byte.c \ + libffi.closures/cls_18byte.c libffi.closures/cls_19byte.c libffi.closures/cls_1_1byte.c \ + libffi.closures/cls_20byte.c libffi.closures/cls_20byte1.c libffi.closures/cls_24byte.c \ + libffi.closures/cls_2byte.c libffi.closures/cls_3_1byte.c libffi.closures/cls_3byte1.c \ + libffi.closures/cls_3byte2.c libffi.closures/cls_3float.c libffi.closures/cls_4_1byte.c \ + libffi.closures/cls_4byte.c libffi.closures/cls_5_1_byte.c libffi.closures/cls_5byte.c \ + libffi.closures/cls_64byte.c libffi.closures/cls_6_1_byte.c libffi.closures/cls_6byte.c \ + libffi.closures/cls_7_1_byte.c libffi.closures/cls_7byte.c libffi.closures/cls_8byte.c \ + libffi.closures/cls_9byte1.c libffi.closures/cls_9byte2.c libffi.closures/cls_align_double.c \ + libffi.closures/cls_align_float.c libffi.closures/cls_align_longdouble.c libffi.closures/cls_align_longdouble_split.c \ + libffi.closures/cls_align_longdouble_split2.c libffi.closures/cls_align_pointer.c libffi.closures/cls_align_sint16.c \ + libffi.closures/cls_align_sint32.c libffi.closures/cls_align_sint64.c libffi.closures/cls_align_uint16.c \ + libffi.closures/cls_align_uint32.c libffi.closures/cls_align_uint64.c libffi.closures/cls_dbls_struct.c \ + libffi.closures/cls_double.c libffi.closures/cls_double_va.c libffi.closures/cls_float.c \ + libffi.closures/cls_longdouble.c libffi.closures/cls_longdouble_va.c libffi.closures/cls_many_mixed_args.c \ + libffi.closures/cls_many_mixed_float_double.c libffi.closures/cls_multi_schar.c libffi.closures/cls_multi_sshort.c \ + libffi.closures/cls_multi_sshortchar.c libffi.closures/cls_multi_uchar.c libffi.closures/cls_multi_ushort.c \ + libffi.closures/cls_multi_ushortchar.c libffi.closures/cls_pointer.c libffi.closures/cls_pointer_stack.c \ + libffi.closures/cls_schar.c libffi.closures/cls_sint.c libffi.closures/cls_sshort.c \ + libffi.closures/cls_struct_va1.c libffi.closures/cls_uchar.c libffi.closures/cls_uint.c \ + libffi.closures/cls_uint_va.c libffi.closures/cls_ulong_va.c libffi.closures/cls_ulonglong.c \ + libffi.closures/cls_ushort.c libffi.closures/err_bad_abi.c libffi.closures/ffitest.h \ + libffi.closures/huge_struct.c libffi.closures/nested_struct.c libffi.closures/nested_struct1.c \ + libffi.closures/nested_struct10.c libffi.closures/nested_struct11.c libffi.closures/nested_struct12.c \ + libffi.closures/nested_struct13.c libffi.closures/nested_struct2.c libffi.closures/nested_struct3.c \ + libffi.closures/nested_struct4.c libffi.closures/nested_struct5.c libffi.closures/nested_struct6.c \ + libffi.closures/nested_struct7.c libffi.closures/nested_struct8.c libffi.closures/nested_struct9.c \ + libffi.closures/problem1.c libffi.closures/single_entry_structs1.c libffi.closures/single_entry_structs2.c \ + libffi.closures/single_entry_structs3.c libffi.closures/stret_large.c libffi.closures/stret_large2.c \ + libffi.closures/stret_medium.c libffi.closures/stret_medium2.c libffi.closures/testclosure.c \ + libffi.closures/unwindtest.cc libffi.closures/unwindtest_ffi_call.cc libffi.complex/cls_align_complex.inc \ + libffi.complex/cls_align_complex_double.c libffi.complex/cls_align_complex_float.c libffi.complex/cls_align_complex_longdouble.c \ + libffi.complex/cls_complex.inc libffi.complex/cls_complex_double.c libffi.complex/cls_complex_float.c \ + libffi.complex/cls_complex_longdouble.c libffi.complex/cls_complex_struct.inc libffi.complex/cls_complex_struct_double.c \ + libffi.complex/cls_complex_struct_float.c libffi.complex/cls_complex_struct_longdouble.c libffi.complex/cls_complex_va.inc \ + libffi.complex/cls_complex_va_double.c libffi.complex/cls_complex_va_float.c libffi.complex/cls_complex_va_longdouble.c \ + libffi.complex/complex.exp libffi.complex/complex.inc libffi.complex/complex_defs_double.inc \ + libffi.complex/complex_defs_float.inc libffi.complex/complex_defs_longdouble.inc libffi.complex/complex_double.c \ + libffi.complex/complex_float.c libffi.complex/complex_int.c libffi.complex/complex_longdouble.c \ + libffi.complex/ffitest.h libffi.complex/many_complex.inc libffi.complex/many_complex_double.c \ + libffi.complex/many_complex_float.c libffi.complex/many_complex_longdouble.c libffi.complex/return_complex.inc \ + libffi.complex/return_complex1.inc libffi.complex/return_complex1_double.c libffi.complex/return_complex1_float.c \ + libffi.complex/return_complex1_longdouble.c libffi.complex/return_complex2.inc libffi.complex/return_complex2_double.c \ + libffi.complex/return_complex2_float.c libffi.complex/return_complex2_longdouble.c libffi.complex/return_complex_double.c \ + libffi.complex/return_complex_float.c libffi.complex/return_complex_longdouble.c libffi.go/aa-direct.c \ + libffi.go/closure1.c libffi.go/ffitest.h libffi.go/go.exp \ + libffi.go/static-chain.h Makefile.am Makefile.in all: all-am diff --git a/src/libffi/libffi-3.4.4/testsuite/config/default.exp b/src/libffi/libffi-3.4.6/testsuite/config/default.exp similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/config/default.exp rename to src/libffi/libffi-3.4.6/testsuite/config/default.exp diff --git a/src/libffi/libffi-3.4.6/testsuite/emscripten/build-tests.sh b/src/libffi/libffi-3.4.6/testsuite/emscripten/build-tests.sh new file mode 100755 index 000000000..7c430601b --- /dev/null +++ b/src/libffi/libffi-3.4.6/testsuite/emscripten/build-tests.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +emcc_exists="$(command -v emcc)" +if [ ! "${emcc_exists}" ]; then + echo "Emscripten not on path" + exit 1 +fi + +set -e + +cd "$1" +shift + +# Parse arguments +while [ $# -gt 0 ]; do + case $1 in + --wasm-bigint) WASM_BIGINT=true ;; + *) + echo "ERROR: Unknown parameter: $1" >&2 + exit 1 + ;; + esac + shift +done + + +export CFLAGS="-fPIC -O2 -I../../target/include $EXTRA_CFLAGS" +export CXXFLAGS="$CFLAGS -sNO_DISABLE_EXCEPTION_CATCHING $EXTRA_CXXFLAGS" +export LDFLAGS=" \ + -L../../target/lib/ -lffi \ + -sEXPORT_ALL \ + -sMODULARIZE \ + -sMAIN_MODULE \ + -sNO_DISABLE_EXCEPTION_CATCHING \ + $EXTRA_LD_FLAGS \ +" + +# This needs to test false if there exists an environment variable called +# WASM_BIGINT whose contents are empty. Don't use +x. +if [ -n "${WASM_BIGINT}" ] ; then + export LDFLAGS+=" -sWASM_BIGINT" +else + export LDFLAGS+=" -sEXPORTED_RUNTIME_METHODS='getTempRet0,setTempRet0'" +fi + +# Rename main functions to test__filename so we can link them together +ls *c | sed 's!\(.*\)\.c!sed -i "s/main/test__\1/g" \0!g' | bash + +# Compile +ls *.c | sed 's/\(.*\)\.c/emcc $CFLAGS -c \1.c -o \1.o /g' | bash +ls *.cc | sed 's/\(.*\)\.cc/em++ $CXXFLAGS -c \1.cc -o \1.o /g' | bash + +# Link +em++ $LDFLAGS *.o -o test.js +cp ../emscripten/test.html . diff --git a/src/libffi/libffi-3.4.6/testsuite/emscripten/build.sh b/src/libffi/libffi-3.4.6/testsuite/emscripten/build.sh new file mode 100755 index 000000000..c77c041b3 --- /dev/null +++ b/src/libffi/libffi-3.4.6/testsuite/emscripten/build.sh @@ -0,0 +1,63 @@ +#!/usr/bin/env bash +command -v emcc >/dev/null 2>&1 || { + echo >&2 "emsdk could not be found. Aborting." + exit 1 +} + +set -e + +SOURCE_DIR=$PWD + +# Working directories +TARGET=$SOURCE_DIR/target +mkdir -p "$TARGET" + +# Define default arguments + +# JS BigInt to Wasm i64 integration, disabled by default +# This needs to test false if there exists an environment variable called +# WASM_BIGINT whose contents are empty. Don't use +x. +if [ -n "${WASM_BIGINT}" ]; then + WASM_BIGINT=true +else + WASM_BIGINT=false +fi + +# Parse arguments +while [ $# -gt 0 ]; do + case $1 in + --wasm-bigint) WASM_BIGINT=true ;; + --debug) DEBUG=true ;; + *) + echo "ERROR: Unknown parameter: $1" >&2 + exit 1 + ;; + esac + shift +done + +# Common compiler flags +export CFLAGS="-O3 -fPIC" +if [ "$WASM_BIGINT" = "true" ]; then + # We need to detect WASM_BIGINT support at compile time + export CFLAGS+=" -DWASM_BIGINT" +fi +if [ "$DEBUG" = "true" ]; then + export CFLAGS+=" -DDEBUG_F" +fi +export CXXFLAGS="$CFLAGS" + +# Build paths +export CPATH="$TARGET/include" +export PKG_CONFIG_PATH="$TARGET/lib/pkgconfig" +export EM_PKG_CONFIG_PATH="$PKG_CONFIG_PATH" + +# Specific variables for cross-compilation +export CHOST="wasm32-unknown-linux" # wasm32-unknown-emscripten + +autoreconf -fiv +emconfigure ./configure --host=$CHOST --prefix="$TARGET" --enable-static --disable-shared --disable-dependency-tracking \ + --disable-builddir --disable-multi-os-directory --disable-raw-api --disable-docs +make install +cp fficonfig.h target/include/ +cp include/ffi_common.h target/include/ diff --git a/src/libffi/libffi-3.4.6/testsuite/emscripten/conftest.py b/src/libffi/libffi-3.4.6/testsuite/emscripten/conftest.py new file mode 100644 index 000000000..b2e36dd5a --- /dev/null +++ b/src/libffi/libffi-3.4.6/testsuite/emscripten/conftest.py @@ -0,0 +1,86 @@ +from pathlib import Path +from pytest import fixture +from pytest_pyodide.server import spawn_web_server +from pytest_pyodide import runner + +import logging + +TEST_PATH = Path(__file__).parents[1].resolve() + + +class BaseRunner(runner._BrowserBaseRunner): + def __init__( + self, + *args, + test_dir, + **kwargs, + ): + self.test_dir = test_dir + super().__init__( + *args, + **kwargs, + load_pyodide=False, + ) + + def prepare_driver(self): + self.base_url = ( + f"http://{self.server_hostname}:{self.server_port}/{self.test_dir}/" + ) + self.goto(f"{self.base_url}/test.html") + + def javascript_setup(self): + self.run_js("globalThis.TestModule = await globalThis.Module();") + + +class FirefoxRunner(BaseRunner, runner.SeleniumFirefoxRunner): + pass + + +class ChromeRunner(BaseRunner, runner.SeleniumChromeRunner): + pass + + +# TODO: Figure out how to get NodeRunner to work. + +RUNNER_DICT = {x.browser: x for x in [FirefoxRunner, ChromeRunner]} + + +@fixture(params=list(RUNNER_DICT), scope="class") +def selenium_class_scope(request, web_server_main): + server_hostname, server_port, server_log = web_server_main + assert request.param in RUNNER_DICT + + logger = logging.getLogger('selenium') + logger.setLevel(logging.DEBUG) + + cls = RUNNER_DICT[request.param] + selenium = cls( + test_dir=request.cls.TEST_BUILD_DIR, + server_port=server_port, + server_hostname=server_hostname, + server_log=server_log, + ) + request.cls.call_number = 0 + try: + yield selenium + finally: + print(selenium.logs) + selenium.driver.quit() + + +@fixture(scope="function") +def selenium(selenium_class_scope, request): + selenium = selenium_class_scope + request.cls.call_number += 1 + # Refresh page every 50 calls to prevent firefox out of memory errors + if request.cls.call_number % 50 == 0: + selenium.driver.refresh() + selenium.javascript_setup() + selenium.clean_logs() + yield selenium + + +@fixture(scope="session") +def web_server_main(request): + with spawn_web_server(TEST_PATH) as output: + yield output diff --git a/src/libffi/libffi-3.4.6/testsuite/emscripten/node-tests.sh b/src/libffi/libffi-3.4.6/testsuite/emscripten/node-tests.sh new file mode 100755 index 000000000..88dd74b3b --- /dev/null +++ b/src/libffi/libffi-3.4.6/testsuite/emscripten/node-tests.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# JS BigInt to Wasm i64 integration, disabled by default +WASM_BIGINT=false + +emcc_exists="$(command -v emcc)" +if [ ! "${emcc_exists}" ]; then + echo "Emscripten not on path" + exit 1 +fi + +# Parse arguments +while [ $# -gt 0 ]; do + case $1 in + --wasm-bigint) WASM_BIGINT=true ;; + *) + echo "ERROR: Unknown parameter: $1" >&2 + exit 1 + ;; + esac + shift +done + +# Common compiler flags +export CFLAGS="-fPIC $EXTRA_CFLAGS" +if [ "$WASM_BIGINT" = "true" ]; then + # We need to detect WASM_BIGINT support at compile time + export CFLAGS+=" -DWASM_BIGINT" +fi +export CXXFLAGS="$CFLAGS -sNO_DISABLE_EXCEPTION_CATCHING $EXTRA_CXXFLAGS" +export LDFLAGS="-sEXPORTED_FUNCTIONS=_main,_malloc,_free -sALLOW_TABLE_GROWTH -sASSERTIONS -sNO_DISABLE_EXCEPTION_CATCHING" +if [ "$WASM_BIGINT" = "true" ]; then + export LDFLAGS+=" -sWASM_BIGINT" +else + export LDFLAGS+=" -sEXPORTED_RUNTIME_METHODS='getTempRet0,setTempRet0'" +fi + +# Specific variables for cross-compilation +export CHOST="wasm32-unknown-linux" # wasm32-unknown-emscripten + +autoreconf -fiv +emconfigure ./configure --prefix="$(pwd)/target" --host=$CHOST --enable-static --disable-shared \ + --disable-builddir --disable-multi-os-directory --disable-raw-api --disable-docs || + (cat config.log && exit 1) +make + +EMMAKEN_JUST_CONFIGURE=1 emmake make check \ + RUNTESTFLAGS="LDFLAGS_FOR_TARGET='$LDFLAGS'" || (cat testsuite/libffi.log && exit 1) diff --git a/src/libffi/libffi-3.4.6/testsuite/emscripten/test.html b/src/libffi/libffi-3.4.6/testsuite/emscripten/test.html new file mode 100644 index 000000000..770150385 --- /dev/null +++ b/src/libffi/libffi-3.4.6/testsuite/emscripten/test.html @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/libffi/libffi-3.4.6/testsuite/emscripten/test_libffi.py b/src/libffi/libffi-3.4.6/testsuite/emscripten/test_libffi.py new file mode 100644 index 000000000..059d53565 --- /dev/null +++ b/src/libffi/libffi-3.4.6/testsuite/emscripten/test_libffi.py @@ -0,0 +1,51 @@ +import subprocess +import pathlib +import pytest + +TEST_PATH = pathlib.Path(__file__).parents[1].resolve() + +xfails = {} + + +def libffi_tests(self, selenium, libffi_test): + if libffi_test in xfails: + pytest.xfail(f'known failure with code "{xfails[libffi_test]}"') + res = selenium.run_js( + """ + window.TestModule = await Module(); + """ + ) + selenium.run_js( + f""" + try {{ + TestModule._test__{libffi_test}(); + }} catch(e){{ + if(e.name !== "ExitStatus"){{ + throw e; + }} + if(e.status !== 0){{ + throw new Error(`Terminated with nonzero status code ${{e.status}}: ` + e.message); + }} + }} + """ + ) + + +class TestCall: + TEST_BUILD_DIR = "libffi.call.test" + test_call = libffi_tests + + +class TestClosures: + TEST_BUILD_DIR = "libffi.closures.test" + test_closures = libffi_tests + + +def pytest_generate_tests(metafunc): + test_build_dir = metafunc.cls.TEST_BUILD_DIR + test_names = [x.stem for x in (TEST_PATH / test_build_dir).glob("*.o")] + metafunc.parametrize("libffi_test", test_names) + + +if __name__ == "__main__": + subprocess.call(["build-tests.sh", "libffi.call"]) diff --git a/src/libffi/libffi-3.4.4/testsuite/lib/libffi.exp b/src/libffi/libffi-3.4.6/testsuite/lib/libffi.exp similarity index 96% rename from src/libffi/libffi-3.4.4/testsuite/lib/libffi.exp rename to src/libffi/libffi-3.4.6/testsuite/lib/libffi.exp index 7457af415..b5731dbc9 100644 --- a/src/libffi/libffi-3.4.4/testsuite/lib/libffi.exp +++ b/src/libffi/libffi-3.4.6/testsuite/lib/libffi.exp @@ -221,6 +221,13 @@ proc libffi-dg-test-1 { target_compile prog do_what extra_tool_flags } { set output_match [lreplace $output_match 1 1 $x] } + if { [ istarget "wasm32-*-*" ] } { + # emscripten will get confused if told to build as .exe + set exec_suffix "" + } else { + set exec_suffix ".exe" + } + # Set up the compiler flags, based on what we're going to do. set options [list] @@ -231,7 +238,7 @@ proc libffi-dg-test-1 { target_compile prog do_what extra_tool_flags } { } "link" { set compile_type "executable" - set output_file "[file rootname [file tail $prog]].exe" + set output_file "[file rootname [file tail $prog]]$exec_suffix" # The following line is needed for targets like the i960 where # the default output file is b.out. Sigh. } @@ -240,7 +247,7 @@ proc libffi-dg-test-1 { target_compile prog do_what extra_tool_flags } { # FIXME: "./" is to cope with "." not being in $PATH. # Should this be handled elsewhere? # YES. - set output_file "./[file rootname [file tail $prog]].exe" + set output_file "./[file rootname [file tail $prog]]$exec_suffix" # This is the only place where we care if an executable was # created or not. If it was, dg.exp will try to run it. remote_file build delete $output_file; @@ -271,6 +278,8 @@ proc libffi-dg-prune { target_triplet text } { regsub -all "(^|\n)\[^\n\]*unable to perform all requested operations" $text "" text # We get this from sparc64 linux systems regsub -all "(^|\n)\[^\n\]*warning: .* has a LOAD segment with RWX permissions" $text "" text + # Ignore Emscripten INFO messages + regsub -all "(^|\n)(cache|shared):INFO:\[^\n\]*" $text "" text return $text } @@ -380,6 +389,7 @@ proc libffi_target_compile { source dest type options } { || [istarget "*-*-darwin2*"] } { # lappend options "additional_flags=-Wl,-allow_stack_execute" lappend options "additional_flags=-Wno-unused-command-line-argument" + lappend options "additional_flags=-Wl,-search_paths_first" } # If you're building the compiler with --prefix set to a place @@ -416,6 +426,12 @@ proc libffi_target_compile { source dest type options } { } } + # emscripten emits this warning while building the feature test + # which causes it to be seen as unsupported. + if { [string match "wasm32-*" $target_triplet] } { + lappend options "additional_flags=-Wno-unused-command-line-argument" + } + verbose "options: $options" return [target_compile $source $dest $type $options] } diff --git a/src/libffi/libffi-3.4.4/testsuite/lib/target-libpath.exp b/src/libffi/libffi-3.4.6/testsuite/lib/target-libpath.exp similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/lib/target-libpath.exp rename to src/libffi/libffi-3.4.6/testsuite/lib/target-libpath.exp diff --git a/src/libffi/libffi-3.4.4/testsuite/lib/wrapper.exp b/src/libffi/libffi-3.4.6/testsuite/lib/wrapper.exp similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/lib/wrapper.exp rename to src/libffi/libffi-3.4.6/testsuite/lib/wrapper.exp diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.bhaible/Makefile b/src/libffi/libffi-3.4.6/testsuite/libffi.bhaible/Makefile similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.bhaible/Makefile rename to src/libffi/libffi-3.4.6/testsuite/libffi.bhaible/Makefile diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.bhaible/README b/src/libffi/libffi-3.4.6/testsuite/libffi.bhaible/README similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.bhaible/README rename to src/libffi/libffi-3.4.6/testsuite/libffi.bhaible/README diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.bhaible/alignof.h b/src/libffi/libffi-3.4.6/testsuite/libffi.bhaible/alignof.h similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.bhaible/alignof.h rename to src/libffi/libffi-3.4.6/testsuite/libffi.bhaible/alignof.h diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.bhaible/bhaible.exp b/src/libffi/libffi-3.4.6/testsuite/libffi.bhaible/bhaible.exp similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.bhaible/bhaible.exp rename to src/libffi/libffi-3.4.6/testsuite/libffi.bhaible/bhaible.exp diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.bhaible/test-call.c b/src/libffi/libffi-3.4.6/testsuite/libffi.bhaible/test-call.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.bhaible/test-call.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.bhaible/test-call.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.bhaible/test-callback.c b/src/libffi/libffi-3.4.6/testsuite/libffi.bhaible/test-callback.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.bhaible/test-callback.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.bhaible/test-callback.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.bhaible/testcases.c b/src/libffi/libffi-3.4.6/testsuite/libffi.bhaible/testcases.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.bhaible/testcases.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.bhaible/testcases.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/align_mixed.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/align_mixed.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/align_mixed.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/align_mixed.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/align_stdcall.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/align_stdcall.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/align_stdcall.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/align_stdcall.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/bpo-38748.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/bpo_38748.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/bpo-38748.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/bpo_38748.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/call.exp b/src/libffi/libffi-3.4.6/testsuite/libffi.call/call.exp similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/call.exp rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/call.exp diff --git a/src/libffi/libffi-3.4.6/testsuite/libffi.call/callback.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/callback.c new file mode 100644 index 000000000..ac45c62a6 --- /dev/null +++ b/src/libffi/libffi-3.4.6/testsuite/libffi.call/callback.c @@ -0,0 +1,99 @@ +/* Area: ffi_call + Purpose: Check structures with array and callback. + Limitations: none. + PR: none. + Originator: David Tenty */ + +/* { dg-do run } */ +#include "ffitest.h" + +int i=5; + +void callback(void) { i++; } + +typedef struct +{ + unsigned char c1; + double s[2]; + unsigned char c2; +} test_structure_12; + +static test_structure_12 ABI_ATTR struct12 (test_structure_12 ts, void (*func)(void)) +{ + ts.c1 += 1; + ts.c2 += 1; + ts.s[0] += 1; + ts.s[1] += 1; + + func(); + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts12_type,ts12a_type; + ffi_type *ts12_type_elements[4]; + ffi_type *ts12a_type_elements[3]; + + test_structure_12 ts12_arg; + void (*ptr)(void)=&callback; + + test_structure_12 *ts12_result = + (test_structure_12 *) malloc (sizeof(test_structure_12)); + + ts12a_type.size = 0; + ts12a_type.alignment = 0; + ts12a_type.type = FFI_TYPE_STRUCT; + ts12a_type.elements = ts12a_type_elements; + ts12a_type_elements[0] = &ffi_type_double; + ts12a_type_elements[1] = &ffi_type_double; + ts12a_type_elements[2] = NULL; + + ts12_type.size = 0; + ts12_type.alignment = 0; + ts12_type.type = FFI_TYPE_STRUCT; + ts12_type.elements = ts12_type_elements; + ts12_type_elements[0] = &ffi_type_uchar; + ts12_type_elements[1] = &ts12a_type; + ts12_type_elements[2] = &ffi_type_uchar; + ts12_type_elements[3] = NULL; + + + args[0] = &ts12_type; + args[1] = &ffi_type_pointer; + values[0] = &ts12_arg; + values[1] = &ptr; + + CHECK(ffi_prep_cif(&cif, ABI_NUM, 2, &ts12_type, args) == FFI_OK); + + ts12_arg.c1 = 5; + ts12_arg.c2 = 6; + ts12_arg.s[0] = 7.77; + ts12_arg.s[1] = 8.88; + + printf ("%u\n", ts12_arg.c1); + printf ("%u\n", ts12_arg.c2); + printf ("%g\n", ts12_arg.s[0]); + printf ("%g\n", ts12_arg.s[1]); + printf ("%d\n", i); + + ffi_call(&cif, FFI_FN(struct12), ts12_result, values); + + printf ("%u\n", ts12_result->c1); + printf ("%u\n", ts12_result->c2); + printf ("%g\n", ts12_result->s[0]); + printf ("%g\n", ts12_result->s[1]); + printf ("%d\n", i); + CHECK(ts12_result->c1 == 5 + 1); + CHECK(ts12_result->c2 == 6 + 1); + CHECK(ts12_result->s[0] == 7.77 + 1); + CHECK(ts12_result->s[1] == 8.88 + 1); + CHECK(i == 5 + 1); + CHECK(ts12_type.size == sizeof(test_structure_12)); + + free (ts12_result); + exit(0); +} diff --git a/src/libffi/libffi-3.4.6/testsuite/libffi.call/callback2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/callback2.c new file mode 100644 index 000000000..53a3b2fd3 --- /dev/null +++ b/src/libffi/libffi-3.4.6/testsuite/libffi.call/callback2.c @@ -0,0 +1,108 @@ +/* Area: ffi_call + Purpose: Check structures with nested array and callback. + Limitations: none. + PR: none. + Originator: David Tenty */ + +/* { dg-do run } */ +#include "ffitest.h" + +int i=5; + +void callback(void) { i++; } + +typedef struct +{ + struct { double d; } s1; + double s[2]; + unsigned char c2; +} test_structure_12; + +static test_structure_12 ABI_ATTR struct12 (test_structure_12 ts, void (*func)(void)) +{ + ts.s1.d += 1; + ts.c2 += 1; + ts.s[0] += 1; + ts.s[1] += 1; + + func(); + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts12_type,ts12a_type, ts12b_type; + ffi_type *ts12_type_elements[4]; + ffi_type *ts12a_type_elements[2]; + ffi_type *ts12b_type_elements[3]; + + + test_structure_12 ts12_arg; + void (*ptr)(void)=&callback; + + test_structure_12 *ts12_result = + (test_structure_12 *) malloc (sizeof(test_structure_12)); + + ts12a_type.size = 0; + ts12a_type.alignment = 0; + ts12a_type.type = FFI_TYPE_STRUCT; + ts12a_type.elements = ts12a_type_elements; + ts12a_type_elements[0] = &ffi_type_double; + ts12a_type_elements[1] = NULL; + + ts12b_type.size = 0; + ts12b_type.alignment = 0; + ts12b_type.type = FFI_TYPE_STRUCT; + ts12b_type.elements = ts12b_type_elements; + ts12b_type_elements[0] = &ffi_type_double; + ts12b_type_elements[1] = &ffi_type_double; + ts12b_type_elements[2] = NULL; + + ts12_type.size = 0; + ts12_type.alignment = 0; + ts12_type.type = FFI_TYPE_STRUCT; + ts12_type.elements = ts12_type_elements; + ts12_type_elements[0] = &ts12a_type; + ts12_type_elements[1] = &ts12b_type; + ts12_type_elements[2] = &ffi_type_uchar; + ts12_type_elements[3] = NULL; + + + args[0] = &ts12_type; + args[1] = &ffi_type_pointer; + values[0] = &ts12_arg; + values[1] = &ptr; + + CHECK(ffi_prep_cif(&cif, ABI_NUM, 2, &ts12_type, args) == FFI_OK); + + ts12_arg.s1.d = 5.55; + ts12_arg.c2 = 6; + ts12_arg.s[0] = 7.77; + ts12_arg.s[1] = 8.88; + + printf ("%g\n", ts12_arg.s1.d); + printf ("%u\n", ts12_arg.c2); + printf ("%g\n", ts12_arg.s[0]); + printf ("%g\n", ts12_arg.s[1]); + printf ("%d\n", i); + + ffi_call(&cif, FFI_FN(struct12), ts12_result, values); + + printf ("%g\n", ts12_result->s1.d); + printf ("%u\n", ts12_result->c2); + printf ("%g\n", ts12_result->s[0]); + printf ("%g\n", ts12_result->s[1]); + printf ("%d\n", i); + CHECK(ts12_result->s1.d == 5.55 + 1); + CHECK(ts12_result->c2 == 6 + 1); + CHECK(ts12_result->s[0] == 7.77 + 1); + CHECK(ts12_result->s[1] == 8.88 + 1); + CHECK(i == 5 + 1); + CHECK(ts12_type.size == sizeof(test_structure_12)); + + free (ts12_result); + exit(0); +} diff --git a/src/libffi/libffi-3.4.6/testsuite/libffi.call/callback3.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/callback3.c new file mode 100644 index 000000000..4a2fd978f --- /dev/null +++ b/src/libffi/libffi-3.4.6/testsuite/libffi.call/callback3.c @@ -0,0 +1,114 @@ +/* Area: ffi_call + Purpose: Check structures with array and callback. + Limitations: none. + PR: none. + Originator: David Tenty */ + +/* { dg-do run } */ +#include "ffitest.h" + +int i=5; + +void callback(void) { i++; } + + +typedef struct +{ + struct { unsigned char c; double d; } s1; + double s[2]; + unsigned char c2; +} test_structure_12; + +static test_structure_12 ABI_ATTR struct12 (test_structure_12 ts, void (*func)(void)) +{ + ts.s1.c += 1; + ts.s1.d += 1; + ts.c2 += 1; + ts.s[0] += 1; + ts.s[1] += 1; + + func(); + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts12_type,ts12b_type, ts12a_type; + ffi_type *ts12_type_elements[4]; + ffi_type *ts12b_type_elements[3]; + ffi_type *ts12a_type_elements[3]; + + test_structure_12 ts12_arg; + void (*ptr)(void)=&callback; + + test_structure_12 *ts12_result = + (test_structure_12 *) malloc (sizeof(test_structure_12)); + + ts12a_type.size = 0; + ts12a_type.alignment = 0; + ts12a_type.type = FFI_TYPE_STRUCT; + ts12a_type.elements = ts12a_type_elements; + ts12a_type_elements[0] = &ffi_type_uchar; + ts12a_type_elements[1] = &ffi_type_double; + ts12a_type_elements[2] = NULL; + + ts12b_type.size = 0; + ts12b_type.alignment = 0; + ts12b_type.type = FFI_TYPE_STRUCT; + ts12b_type.elements = ts12b_type_elements; + ts12b_type_elements[0] = &ffi_type_double; + ts12b_type_elements[1] = &ffi_type_double; + ts12b_type_elements[2] = NULL; + + ts12_type.size = 0; + ts12_type.alignment = 0; + ts12_type.type = FFI_TYPE_STRUCT; + ts12_type.elements = ts12_type_elements; + ts12_type_elements[0] = &ts12a_type; + ts12_type_elements[1] = &ts12b_type; + ts12_type_elements[2] = &ffi_type_uchar; + ts12_type_elements[3] = NULL; + + + args[0] = &ts12_type; + args[1] = &ffi_type_pointer; + values[0] = &ts12_arg; + values[1] = &ptr; + + CHECK(ffi_prep_cif(&cif, ABI_NUM, 2, &ts12_type, args) == FFI_OK); + + ts12_arg.s1.c = 5; + ts12_arg.s1.d = 5.55; + ts12_arg.c2 = 6; + ts12_arg.s[0] = 7.77; + ts12_arg.s[1] = 8.88; + + printf ("%d\n", ts12_arg.s1.c); + printf ("%g\n", ts12_arg.s1.d); + printf ("%u\n", ts12_arg.c2); + printf ("%g\n", ts12_arg.s[0]); + printf ("%g\n", ts12_arg.s[1]); + printf ("%d\n", i); + + ffi_call(&cif, FFI_FN(struct12), ts12_result, values); + + printf ("%d\n", ts12_result->s1.c); + printf ("%g\n", ts12_result->s1.d); + printf ("%u\n", ts12_result->c2); + printf ("%g\n", ts12_result->s[0]); + printf ("%g\n", ts12_result->s[1]); + printf ("%d\n", i); + CHECK(ts12_result->s1.c == 5 + 1); + CHECK(ts12_result->s1.d == 5.55 + 1); + CHECK(ts12_result->c2 == 6 + 1); + CHECK(ts12_result->s[0] == 7.77 + 1); + CHECK(ts12_result->s[1] == 8.88 + 1); + CHECK(i == 5 + 1); + CHECK(ts12_type.size == sizeof(test_structure_12)); + + free (ts12_result); + exit(0); +} diff --git a/src/libffi/libffi-3.4.6/testsuite/libffi.call/callback4.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/callback4.c new file mode 100644 index 000000000..350338c3c --- /dev/null +++ b/src/libffi/libffi-3.4.6/testsuite/libffi.call/callback4.c @@ -0,0 +1,119 @@ +/* Area: ffi_call + Purpose: Check structures with array and callback. + Limitations: none. + PR: none. + Originator: David Tenty */ + +/* { dg-do run } */ +#include "ffitest.h" + +int i=5; + +void callback(void) { i++; } + + +typedef struct +{ + unsigned char c1; + struct { double d; unsigned char c; } s[2]; + unsigned char c2; +} test_structure_12; + +static test_structure_12 ABI_ATTR struct12 (test_structure_12 ts, void (*func)(void)) +{ + ts.c1 += 1; + ts.s[0].d += 1; + ts.s[0].c += 1; + ts.s[1].d += 1; + ts.s[1].c += 1; + ts.c2 += 1; + + func(); + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts12_type,ts12b_type, ts12a_type; + ffi_type *ts12_type_elements[4]; + ffi_type *ts12b_type_elements[3]; + ffi_type *ts12a_type_elements[3]; + + test_structure_12 ts12_arg; + void (*ptr)(void)=&callback; + + test_structure_12 *ts12_result = + (test_structure_12 *) malloc (sizeof(test_structure_12)); + + ts12a_type.size = 0; + ts12a_type.alignment = 0; + ts12a_type.type = FFI_TYPE_STRUCT; + ts12a_type.elements = ts12a_type_elements; + ts12a_type_elements[0] = &ffi_type_double; + ts12a_type_elements[1] = &ffi_type_uchar; + ts12a_type_elements[2] = NULL; + + ts12b_type.size = 0; + ts12b_type.alignment = 0; + ts12b_type.type = FFI_TYPE_STRUCT; + ts12b_type.elements = ts12b_type_elements; + ts12b_type_elements[0] = &ts12a_type; + ts12b_type_elements[1] = &ts12a_type; + ts12b_type_elements[2] = NULL; + + ts12_type.size = 0; + ts12_type.alignment = 0; + ts12_type.type = FFI_TYPE_STRUCT; + ts12_type.elements = ts12_type_elements; + ts12_type_elements[0] = &ffi_type_uchar; + ts12_type_elements[1] = &ts12b_type; + ts12_type_elements[2] = &ffi_type_uchar; + ts12_type_elements[3] = NULL; + + + args[0] = &ts12_type; + args[1] = &ffi_type_pointer; + values[0] = &ts12_arg; + values[1] = &ptr; + + CHECK(ffi_prep_cif(&cif, ABI_NUM, 2, &ts12_type, args) == FFI_OK); + + ts12_arg.c1 = 5; + ts12_arg.s[0].d = 5.55; + ts12_arg.s[0].c = 6; + ts12_arg.s[1].d = 7.77; + ts12_arg.s[1].c = 8; + ts12_arg.c2 = 9; + + printf ("%u\n", ts12_arg.c1); + printf ("%g\n", ts12_arg.s[0].d); + printf ("%u\n", ts12_arg.s[0].c); + printf ("%g\n", ts12_arg.s[1].d); + printf ("%u\n", ts12_arg.s[1].c); + printf ("%u\n", ts12_arg.c2); + printf ("%d\n", i); + + ffi_call(&cif, FFI_FN(struct12), ts12_result, values); + + printf ("%u\n", ts12_result->c1); + printf ("%g\n", ts12_result->s[0].d); + printf ("%u\n", ts12_result->s[0].c); + printf ("%g\n", ts12_result->s[1].d); + printf ("%u\n", ts12_result->s[1].c); + printf ("%u\n", ts12_result->c2); + printf ("%d\n", i); + CHECK(ts12_result->c1 == 5 + 1); + CHECK(ts12_result->s[0].d == 5.55 + 1); + CHECK(ts12_result->s[0].c == 6 + 1); + CHECK(ts12_result->s[1].d == 7.77 + 1); + CHECK(ts12_result->s[1].c == 8 + 1); + CHECK(ts12_result->c2 == 9 + 1); + CHECK(i == 5 + 1); + CHECK(ts12_type.size == sizeof(test_structure_12)); + + free (ts12_result); + exit(0); +} diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/err_bad_typedef.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/err_bad_typedef.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/err_bad_typedef.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/err_bad_typedef.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/ffitest.h b/src/libffi/libffi-3.4.6/testsuite/libffi.call/ffitest.h similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/ffitest.h rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/ffitest.h diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/float.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/float.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/float.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/float.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/float1.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/float1.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/float1.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/float1.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/float2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/float2.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/float2.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/float2.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/float3.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/float3.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/float3.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/float3.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/float4.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/float4.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/float4.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/float4.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/float_va.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/float_va.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/float_va.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/float_va.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/many.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/many.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/many.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/many.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/many2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/many2.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/many2.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/many2.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/many_double.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/many_double.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/many_double.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/many_double.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/many_mixed.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/many_mixed.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/many_mixed.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/many_mixed.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/negint.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/negint.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/negint.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/negint.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/offsets.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/offsets.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/offsets.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/offsets.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/pr1172638.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/pr1172638.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/pr1172638.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/pr1172638.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/promotion.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/promotion.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/promotion.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/promotion.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/pyobjc_tc.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/pyobjc_tc.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/pyobjc_tc.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/pyobjc_tc.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/return_dbl.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/return_dbl.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/return_dbl.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/return_dbl.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/return_dbl1.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/return_dbl1.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/return_dbl1.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/return_dbl1.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/return_dbl2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/return_dbl2.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/return_dbl2.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/return_dbl2.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/return_fl.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/return_fl.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/return_fl.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/return_fl.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/return_fl1.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/return_fl1.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/return_fl1.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/return_fl1.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/return_fl2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/return_fl2.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/return_fl2.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/return_fl2.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/return_fl3.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/return_fl3.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/return_fl3.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/return_fl3.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/return_ldl.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/return_ldl.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/return_ldl.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/return_ldl.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/return_ll.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/return_ll.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/return_ll.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/return_ll.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/return_ll1.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/return_ll1.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/return_ll1.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/return_ll1.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/return_sc.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/return_sc.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/return_sc.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/return_sc.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/return_sl.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/return_sl.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/return_sl.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/return_sl.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/return_uc.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/return_uc.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/return_uc.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/return_uc.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/return_ul.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/return_ul.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/return_ul.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/return_ul.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/s55.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/s55.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/s55.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/s55.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/strlen.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/strlen.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/strlen.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/strlen.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/strlen2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/strlen2.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/strlen2.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/strlen2.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/strlen3.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/strlen3.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/strlen3.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/strlen3.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/strlen4.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/strlen4.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/strlen4.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/strlen4.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/struct1.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct1.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/struct1.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/struct1.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/struct10.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct10.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/struct10.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/struct10.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/struct2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct2.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/struct2.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/struct2.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/struct3.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct3.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/struct3.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/struct3.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/struct4.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct4.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/struct4.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/struct4.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/struct5.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct5.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/struct5.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/struct5.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/struct6.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct6.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/struct6.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/struct6.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/struct7.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct7.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/struct7.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/struct7.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/struct8.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct8.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/struct8.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/struct8.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/struct9.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct9.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/struct9.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/struct9.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/struct_by_value_2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_by_value_2.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/struct_by_value_2.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_by_value_2.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/struct_by_value_3.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_by_value_3.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/struct_by_value_3.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_by_value_3.c diff --git a/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_by_value_3f.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_by_value_3f.c new file mode 100644 index 000000000..8b5b1db75 --- /dev/null +++ b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_by_value_3f.c @@ -0,0 +1,65 @@ +/* Area: ffi_call + Purpose: Check structures. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct +{ + float f01; + float f02; + float f03; +} test_structure_1; + +static test_structure_1 ABI_ATTR struct1(test_structure_1 ts) +{ + ts.f03++; + + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts1_type; + ffi_type *ts1_type_elements[5]; + + test_structure_1 ts1_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_1 *ts1_result = + (test_structure_1 *) malloc (sizeof(test_structure_1)); + + ts1_type.size = 0; + ts1_type.alignment = 0; + ts1_type.type = FFI_TYPE_STRUCT; + ts1_type.elements = ts1_type_elements; + ts1_type_elements[0] = &ffi_type_float; + ts1_type_elements[1] = &ffi_type_float; + ts1_type_elements[2] = &ffi_type_float; + ts1_type_elements[3] = NULL; + + args[0] = &ts1_type; + values[0] = &ts1_arg; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, + &ts1_type, args) == FFI_OK); + + ts1_arg.f03 = 555.5; + + ffi_call(&cif, FFI_FN(struct1), ts1_result, values); + + CHECK(fabs(ts1_result->f03 - 556.5) < FLT_EPSILON); + + /* This will fail if ffi_call isn't passing the struct by value. */ + CHECK(fabs(ts1_arg.f03 - 555.5) < FLT_EPSILON); + + free (ts1_result); + exit(0); +} diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/struct_by_value_4.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_by_value_4.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/struct_by_value_4.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_by_value_4.c diff --git a/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_by_value_4f.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_by_value_4f.c new file mode 100644 index 000000000..bf6775ac4 --- /dev/null +++ b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_by_value_4f.c @@ -0,0 +1,67 @@ +/* Area: ffi_call + Purpose: Check structures. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct +{ + float f01; + float f02; + float f03; + float f04; +} test_structure_1; + +static test_structure_1 ABI_ATTR struct1(test_structure_1 ts) +{ + ts.f04++; + + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts1_type; + ffi_type *ts1_type_elements[5]; + + test_structure_1 ts1_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_1 *ts1_result = + (test_structure_1 *) malloc (sizeof(test_structure_1)); + + ts1_type.size = 0; + ts1_type.alignment = 0; + ts1_type.type = FFI_TYPE_STRUCT; + ts1_type.elements = ts1_type_elements; + ts1_type_elements[0] = &ffi_type_float; + ts1_type_elements[1] = &ffi_type_float; + ts1_type_elements[2] = &ffi_type_float; + ts1_type_elements[3] = &ffi_type_float; + ts1_type_elements[4] = NULL; + + args[0] = &ts1_type; + values[0] = &ts1_arg; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, + &ts1_type, args) == FFI_OK); + + ts1_arg.f04 = 555.5; + + ffi_call(&cif, FFI_FN(struct1), ts1_result, values); + + CHECK(fabs(ts1_result->f04 - 556.5) < FLT_EPSILON); + + /* This will fail if ffi_call isn't passing the struct by value. */ + CHECK(fabs(ts1_arg.f04 - 555.5) < FLT_EPSILON); + + free (ts1_result); + exit(0); +} diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/struct_by_value_big.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_by_value_big.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/struct_by_value_big.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_by_value_big.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/struct_by_value_small.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_by_value_small.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/struct_by_value_small.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_by_value_small.c diff --git a/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_return_2H.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_return_2H.c new file mode 100644 index 000000000..277355035 --- /dev/null +++ b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_return_2H.c @@ -0,0 +1,63 @@ +/* Area: ffi_call + Purpose: Check structures. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" +typedef struct +{ + short x; + short y; +} test_structure_5; + +static test_structure_5 ABI_ATTR struct5(test_structure_5 inp) +{ + inp.x *= 2; + inp.y *= 3; + + return inp; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts5_type; + ffi_type *ts5_type_elements[3]; + + test_structure_5 ts5_arg1; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_5 *ts5_result = + (test_structure_5 *) malloc (sizeof(test_structure_5)); + + ts5_type.size = 0; + ts5_type.alignment = 0; + ts5_type.type = FFI_TYPE_STRUCT; + ts5_type.elements = ts5_type_elements; + ts5_type_elements[0] = &ffi_type_sshort; + ts5_type_elements[1] = &ffi_type_sshort; + ts5_type_elements[2] = NULL; + + args[0] = &ts5_type; + values[0] = &ts5_arg1; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ts5_type, args) == FFI_OK); + + ts5_arg1.x = 99; + ts5_arg1.y = 88; + + ffi_call (&cif, FFI_FN(struct5), ts5_result, values); + + CHECK(ts5_result->x == 99*2); + CHECK(ts5_result->y == 88*3); + CHECK(ts5_arg1.x == 99); + CHECK(ts5_arg1.y == 88); + + free (ts5_result); + exit(0); +} diff --git a/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_return_8H.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_return_8H.c new file mode 100644 index 000000000..5018daa1f --- /dev/null +++ b/src/libffi/libffi-3.4.6/testsuite/libffi.call/struct_return_8H.c @@ -0,0 +1,90 @@ +/* Area: ffi_call + Purpose: Check structures. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" +typedef struct +{ + int a; + int b; + int c; + int d; + int e; + int f; + int g; + int h; +} test_structure_5; + +static test_structure_5 ABI_ATTR struct5(test_structure_5 inp) +{ + inp.a *= 2; + inp.b *= 3; + inp.c *= 4; + inp.d *= 5; + inp.e *= 6; + inp.f *= 7; + inp.g *= 8; + inp.h *= 9; + return inp; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts5_type; + ffi_type *ts5_type_elements[9]; + + test_structure_5 ts5_arg1; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_5 *ts5_result = + (test_structure_5 *) malloc (sizeof(test_structure_5)); + + ts5_type.size = 0; + ts5_type.alignment = 0; + ts5_type.type = FFI_TYPE_STRUCT; + ts5_type.elements = ts5_type_elements; + ts5_type_elements[0] = &ffi_type_sint; + ts5_type_elements[1] = &ffi_type_sint; + ts5_type_elements[2] = &ffi_type_sint; + ts5_type_elements[3] = &ffi_type_sint; + ts5_type_elements[4] = &ffi_type_sint; + ts5_type_elements[5] = &ffi_type_sint; + ts5_type_elements[6] = &ffi_type_sint; + ts5_type_elements[7] = &ffi_type_sint; + ts5_type_elements[8] = NULL; + + args[0] = &ts5_type; + values[0] = &ts5_arg1; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, ABI_NUM, 1, &ts5_type, args) == FFI_OK); + + ts5_arg1.a = 9; + ts5_arg1.b = 8; + ts5_arg1.c = 7; + ts5_arg1.d = 6; + ts5_arg1.e = 5; + ts5_arg1.f = 4; + ts5_arg1.g = 3; + ts5_arg1.h = 2; + + ffi_call (&cif, FFI_FN(struct5), ts5_result, values); + + CHECK(ts5_result->a == 9*2); + CHECK(ts5_result->b == 8*3); + CHECK(ts5_result->c == 7*4); + CHECK(ts5_result->d == 6*5); + CHECK(ts5_result->e == 5*6); + CHECK(ts5_result->f == 4*7); + CHECK(ts5_result->g == 3*8); + CHECK(ts5_result->h == 2*9); + + free (ts5_result); + exit(0); +} diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/uninitialized.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/uninitialized.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/uninitialized.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/uninitialized.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/va_1.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/va_1.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/va_1.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/va_1.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/va_2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/va_2.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/va_2.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/va_2.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/va_3.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/va_3.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/va_3.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/va_3.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/va_struct1.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/va_struct1.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/va_struct1.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/va_struct1.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/va_struct2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/va_struct2.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/va_struct2.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/va_struct2.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.call/va_struct3.c b/src/libffi/libffi-3.4.6/testsuite/libffi.call/va_struct3.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.call/va_struct3.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.call/va_struct3.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure.exp b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure.exp similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure.exp rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure.exp diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_fn0.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_fn0.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_fn0.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_fn0.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_fn1.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_fn1.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_fn1.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_fn1.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_fn2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_fn2.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_fn2.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_fn2.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_fn3.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_fn3.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_fn3.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_fn3.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_fn4.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_fn4.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_fn4.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_fn4.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_fn5.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_fn5.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_fn5.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_fn5.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_fn6.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_fn6.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_fn6.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_fn6.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_loc_fn0.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_loc_fn0.c similarity index 96% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_loc_fn0.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_loc_fn0.c index 4f2f4f8c1..f344a6074 100644 --- a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_loc_fn0.c +++ b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_loc_fn0.c @@ -7,9 +7,6 @@ Originator: 20030828 */ - - -/* { dg-do run { xfail wasm32*-*-* } } */ #include "ffitest.h" static void @@ -83,9 +80,9 @@ int main (void) CHECK(ffi_prep_closure_loc(pcl, &cif, closure_loc_test_fn0, (void *) 3 /* userdata */, codeloc) == FFI_OK); -#ifndef FFI_EXEC_STATIC_TRAMP +#if !defined(FFI_EXEC_STATIC_TRAMP) && !defined(__EMSCRIPTEN__) /* With static trampolines, the codeloc does not point to closure */ - CHECK(memcmp(pcl, codeloc, sizeof(*pcl)) == 0); + CHECK(memcmp(pcl, FFI_CL(codeloc), sizeof(*pcl)) == 0); #endif res = (*((closure_loc_test_type0)codeloc)) diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_simple.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_simple.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/closure_simple.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/closure_simple.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_12byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_12byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_12byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_12byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_16byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_16byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_16byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_16byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_18byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_18byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_18byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_18byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_19byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_19byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_19byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_19byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_1_1byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_1_1byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_1_1byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_1_1byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_20byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_20byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_20byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_20byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_20byte1.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_20byte1.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_20byte1.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_20byte1.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_24byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_24byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_24byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_24byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_2byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_2byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_2byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_2byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_3_1byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_3_1byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_3_1byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_3_1byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_3byte1.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_3byte1.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_3byte1.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_3byte1.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_3byte2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_3byte2.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_3byte2.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_3byte2.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_3float.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_3float.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_3float.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_3float.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_4_1byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_4_1byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_4_1byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_4_1byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_4byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_4byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_4byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_4byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_5_1_byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_5_1_byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_5_1_byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_5_1_byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_5byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_5byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_5byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_5byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_64byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_64byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_64byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_64byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_6_1_byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_6_1_byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_6_1_byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_6_1_byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_6byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_6byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_6byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_6byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_7_1_byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_7_1_byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_7_1_byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_7_1_byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_7byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_7byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_7byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_7byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_8byte.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_8byte.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_8byte.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_8byte.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_9byte1.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_9byte1.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_9byte1.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_9byte1.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_9byte2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_9byte2.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_9byte2.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_9byte2.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_double.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_double.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_double.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_double.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_float.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_float.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_float.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_float.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_longdouble.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_longdouble.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_longdouble.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_longdouble.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_longdouble_split.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_longdouble_split.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_longdouble_split.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_longdouble_split.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_longdouble_split2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_longdouble_split2.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_longdouble_split2.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_longdouble_split2.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_pointer.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_pointer.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_pointer.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_pointer.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_sint16.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_sint16.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_sint16.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_sint16.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_sint32.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_sint32.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_sint32.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_sint32.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_sint64.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_sint64.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_sint64.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_sint64.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_uint16.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_uint16.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_uint16.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_uint16.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_uint32.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_uint32.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_uint32.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_uint32.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_uint64.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_uint64.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_align_uint64.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_align_uint64.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_dbls_struct.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_dbls_struct.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_dbls_struct.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_dbls_struct.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_double.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_double.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_double.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_double.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_double_va.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_double_va.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_double_va.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_double_va.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_float.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_float.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_float.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_float.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_longdouble.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_longdouble.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_longdouble.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_longdouble.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_longdouble_va.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_longdouble_va.c similarity index 86% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_longdouble_va.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_longdouble_va.c index 493f0f6f6..ba32f5c85 100644 --- a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_longdouble_va.c +++ b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_longdouble_va.c @@ -9,10 +9,21 @@ /* { dg-output "" { xfail mips-sgi-irix6* } } PR libffi/46660 */ #include "ffitest.h" +#include #define BUF_SIZE 50 static char buffer[BUF_SIZE]; +static int +wrap_printf(char* fmt, ...) { + va_list ap; + va_start(ap, fmt); + long double ldArg = va_arg(ap, long double); + va_end(ap); + CHECK((int)ldArg == 7); + return printf(fmt, ldArg); +} + static void cls_longdouble_va_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) @@ -50,7 +61,7 @@ int main (void) args[1] = &ldArg; args[2] = NULL; - ffi_call(&cif, FFI_FN(printf), &res, args); + ffi_call(&cif, FFI_FN(wrap_printf), &res, args); /* { dg-output "7.0" } */ printf("res: %d\n", (int) res); /* { dg-output "\nres: 4" } */ diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_many_mixed_args.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_many_mixed_args.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_many_mixed_args.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_many_mixed_args.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_many_mixed_float_double.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_many_mixed_float_double.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_many_mixed_float_double.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_many_mixed_float_double.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_multi_schar.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_multi_schar.c similarity index 97% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_multi_schar.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_multi_schar.c index 921777a0f..9eb02f9e3 100644 --- a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_multi_schar.c +++ b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_multi_schar.c @@ -64,7 +64,7 @@ int main (void) /* { dg-output "2 125: 127" } */ printf("res: %d\n", (signed char)res_call); /* { dg-output "\nres: 127" } */ - CHECK(res_call == 127); + CHECK((signed char)res_call == 127); CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_multi_sshort.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_multi_sshort.c similarity index 97% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_multi_sshort.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_multi_sshort.c index d78c62d2d..9d4db5b6c 100644 --- a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_multi_sshort.c +++ b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_multi_sshort.c @@ -65,7 +65,7 @@ int main (void) /* { dg-output "2 32765: 32767" } */ printf("res: %d\n", (unsigned short)res_call); /* { dg-output "\nres: 32767" } */ - CHECK(res_call == 32767); + CHECK((unsigned short)res_call == 32767); CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_multi_sshortchar.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_multi_sshortchar.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_multi_sshortchar.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_multi_sshortchar.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_multi_uchar.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_multi_uchar.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_multi_uchar.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_multi_uchar.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_multi_ushort.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_multi_ushort.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_multi_ushort.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_multi_ushort.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_multi_ushortchar.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_multi_ushortchar.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_multi_ushortchar.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_multi_ushortchar.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_pointer.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_pointer.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_pointer.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_pointer.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_pointer_stack.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_pointer_stack.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_pointer_stack.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_pointer_stack.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_schar.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_schar.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_schar.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_schar.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_sint.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_sint.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_sint.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_sint.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_sshort.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_sshort.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_sshort.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_sshort.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_struct_va1.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_struct_va1.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_struct_va1.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_struct_va1.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_uchar.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_uchar.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_uchar.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_uchar.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_uint.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_uint.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_uint.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_uint.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_uint_va.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_uint_va.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_uint_va.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_uint_va.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_ulong_va.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_ulong_va.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_ulong_va.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_ulong_va.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_ulonglong.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_ulonglong.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_ulonglong.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_ulonglong.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_ushort.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_ushort.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/cls_ushort.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/cls_ushort.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/err_bad_abi.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/err_bad_abi.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/err_bad_abi.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/err_bad_abi.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/ffitest.h b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/ffitest.h similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/ffitest.h rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/ffitest.h diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/huge_struct.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/huge_struct.c similarity index 99% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/huge_struct.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/huge_struct.c index 71cae2681..572a0c8fb 100644 --- a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/huge_struct.c +++ b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/huge_struct.c @@ -5,7 +5,7 @@ Originator: Blake Chaffin 6/18/2007 */ -/* { dg-do run { xfail strongarm*-*-* xscale*-*-* wasm32*-*-* } } */ +/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-linux-gnu* } } */ /* { dg-options -Wformat=0 { target moxie*-*-elf or1k-*-* } } */ diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct1.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct1.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct1.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct1.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct10.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct10.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct10.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct10.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct11.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct11.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct11.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct11.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct12.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct12.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct12.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct12.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct13.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct13.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct13.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct13.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct2.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct2.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct2.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct3.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct3.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct3.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct3.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct4.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct4.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct4.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct4.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct5.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct5.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct5.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct5.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct6.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct6.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct6.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct6.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct7.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct7.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct7.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct7.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct8.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct8.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct8.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct8.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct9.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct9.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/nested_struct9.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/nested_struct9.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/problem1.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/problem1.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/problem1.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/problem1.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/single_entry_structs1.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/single_entry_structs1.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/single_entry_structs1.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/single_entry_structs1.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/single_entry_structs2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/single_entry_structs2.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/single_entry_structs2.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/single_entry_structs2.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/single_entry_structs3.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/single_entry_structs3.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/single_entry_structs3.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/single_entry_structs3.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/stret_large.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/stret_large.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/stret_large.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/stret_large.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/stret_large2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/stret_large2.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/stret_large2.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/stret_large2.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/stret_medium.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/stret_medium.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/stret_medium.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/stret_medium.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/stret_medium2.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/stret_medium2.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/stret_medium2.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/stret_medium2.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/testclosure.c b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/testclosure.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/testclosure.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/testclosure.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/unwindtest.cc b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/unwindtest.cc similarity index 99% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/unwindtest.cc rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/unwindtest.cc index 6c97c61e8..b643c48e4 100644 --- a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/unwindtest.cc +++ b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/unwindtest.cc @@ -48,6 +48,7 @@ typedef int (*closure_test_type1)(float, float, float, float, signed short, float, float, int, double, int, int, float, int, int, int, int); +extern "C" int main (void) { ffi_cif cif; diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/unwindtest_ffi_call.cc b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/unwindtest_ffi_call.cc similarity index 98% rename from src/libffi/libffi-3.4.4/testsuite/libffi.closures/unwindtest_ffi_call.cc rename to src/libffi/libffi-3.4.6/testsuite/libffi.closures/unwindtest_ffi_call.cc index 153d24094..6feaa5752 100644 --- a/src/libffi/libffi-3.4.4/testsuite/libffi.closures/unwindtest_ffi_call.cc +++ b/src/libffi/libffi-3.4.6/testsuite/libffi.closures/unwindtest_ffi_call.cc @@ -14,6 +14,7 @@ static int checking(int a __UNUSED__, short b __UNUSED__, throw 9; } +extern "C" int main (void) { ffi_cif cif; diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_align_complex.inc b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_align_complex.inc similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_align_complex.inc rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_align_complex.inc diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_align_complex_double.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_align_complex_double.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_align_complex_double.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_align_complex_double.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_align_complex_float.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_align_complex_float.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_align_complex_float.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_align_complex_float.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_align_complex_longdouble.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_align_complex_longdouble.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_align_complex_longdouble.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_align_complex_longdouble.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex.inc b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex.inc similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex.inc rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex.inc diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_double.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_double.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_double.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_double.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_float.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_float.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_float.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_float.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_longdouble.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_longdouble.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_longdouble.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_longdouble.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_struct.inc b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_struct.inc similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_struct.inc rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_struct.inc diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_struct_double.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_struct_double.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_struct_double.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_struct_double.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_struct_float.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_struct_float.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_struct_float.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_struct_float.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_struct_longdouble.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_struct_longdouble.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_struct_longdouble.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_struct_longdouble.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_va.inc b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_va.inc similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_va.inc rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_va.inc diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_va_double.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_va_double.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_va_double.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_va_double.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_va_float.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_va_float.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_va_float.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_va_float.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_va_longdouble.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_va_longdouble.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/cls_complex_va_longdouble.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/cls_complex_va_longdouble.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex.exp b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex.exp similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex.exp rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex.exp diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex.inc b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex.inc similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex.inc rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex.inc diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex_defs_double.inc b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex_defs_double.inc similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex_defs_double.inc rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex_defs_double.inc diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex_defs_float.inc b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex_defs_float.inc similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex_defs_float.inc rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex_defs_float.inc diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex_defs_longdouble.inc b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex_defs_longdouble.inc similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex_defs_longdouble.inc rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex_defs_longdouble.inc diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex_double.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex_double.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex_double.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex_double.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex_float.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex_float.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex_float.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex_float.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex_int.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex_int.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex_int.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex_int.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex_longdouble.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex_longdouble.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/complex_longdouble.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/complex_longdouble.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/ffitest.h b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/ffitest.h similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/ffitest.h rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/ffitest.h diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/many_complex.inc b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/many_complex.inc similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/many_complex.inc rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/many_complex.inc diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/many_complex_double.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/many_complex_double.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/many_complex_double.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/many_complex_double.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/many_complex_float.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/many_complex_float.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/many_complex_float.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/many_complex_float.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/many_complex_longdouble.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/many_complex_longdouble.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/many_complex_longdouble.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/many_complex_longdouble.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex.inc b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex.inc similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex.inc rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex.inc diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex1.inc b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex1.inc similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex1.inc rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex1.inc diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex1_double.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex1_double.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex1_double.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex1_double.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex1_float.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex1_float.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex1_float.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex1_float.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex1_longdouble.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex1_longdouble.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex1_longdouble.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex1_longdouble.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex2.inc b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex2.inc similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex2.inc rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex2.inc diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex2_double.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex2_double.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex2_double.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex2_double.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex2_float.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex2_float.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex2_float.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex2_float.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex2_longdouble.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex2_longdouble.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex2_longdouble.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex2_longdouble.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex_double.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex_double.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex_double.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex_double.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex_float.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex_float.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex_float.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex_float.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex_longdouble.c b/src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex_longdouble.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.complex/return_complex_longdouble.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.complex/return_complex_longdouble.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.go/aa-direct.c b/src/libffi/libffi-3.4.6/testsuite/libffi.go/aa-direct.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.go/aa-direct.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.go/aa-direct.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.go/closure1.c b/src/libffi/libffi-3.4.6/testsuite/libffi.go/closure1.c similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.go/closure1.c rename to src/libffi/libffi-3.4.6/testsuite/libffi.go/closure1.c diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.go/ffitest.h b/src/libffi/libffi-3.4.6/testsuite/libffi.go/ffitest.h similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.go/ffitest.h rename to src/libffi/libffi-3.4.6/testsuite/libffi.go/ffitest.h diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.go/go.exp b/src/libffi/libffi-3.4.6/testsuite/libffi.go/go.exp similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.go/go.exp rename to src/libffi/libffi-3.4.6/testsuite/libffi.go/go.exp diff --git a/src/libffi/libffi-3.4.4/testsuite/libffi.go/static-chain.h b/src/libffi/libffi-3.4.6/testsuite/libffi.go/static-chain.h similarity index 100% rename from src/libffi/libffi-3.4.4/testsuite/libffi.go/static-chain.h rename to src/libffi/libffi-3.4.6/testsuite/libffi.go/static-chain.h diff --git a/src/openssl/README b/src/openssl/README index 8be4a82de..446ab4e87 100644 --- a/src/openssl/README +++ b/src/openssl/README @@ -1,6 +1,11 @@ -# OpenSSL 1.0.2 sources are patched with latest security fixes from the +# OpenSSL 1.1.1 tree is patched with security fixes for the 1.1.1f sources in +# Ubuntu 20.04 at http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/. +# E.g. see debian/patches in openssl_1.1.1f-1ubuntu2.23.debian.tar.xz. + +# OpenSSL 1.0.2 tree is patched with the security fixes from the # CentOS 7 sources at https://git.centos.org/rpms/openssl/blob/c7/f/SOURCES. # Latest patches are at https://git.centos.org/rpms/openssl/commits/c7. -# Until 2023, Ubuntu Server 16.04 source packages were available for download at -# http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/. E.g. -# http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/openssl_1.0.2g-1ubuntu4.19.debian.tar.xz + +# Until 2023, Ubuntu Server 16.04 source updates for OpenSSL 1.0.2 were +# available at http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/. +# E.g. see debian/patches in openssl_1.0.2g-1ubuntu4.19.debian.tar.xz. diff --git a/src/openssl/openssl-1.1.1w/ACKNOWLEDGEMENTS b/src/openssl/openssl-1.1.1w-chevah2/ACKNOWLEDGEMENTS similarity index 100% rename from src/openssl/openssl-1.1.1w/ACKNOWLEDGEMENTS rename to src/openssl/openssl-1.1.1w-chevah2/ACKNOWLEDGEMENTS diff --git a/src/openssl/openssl-1.1.1w/AUTHORS b/src/openssl/openssl-1.1.1w-chevah2/AUTHORS similarity index 100% rename from src/openssl/openssl-1.1.1w/AUTHORS rename to src/openssl/openssl-1.1.1w-chevah2/AUTHORS diff --git a/src/openssl/openssl-1.1.1w/CHANGES b/src/openssl/openssl-1.1.1w-chevah2/CHANGES similarity index 99% rename from src/openssl/openssl-1.1.1w/CHANGES rename to src/openssl/openssl-1.1.1w-chevah2/CHANGES index c4409489e..c63a5ea23 100644 --- a/src/openssl/openssl-1.1.1w/CHANGES +++ b/src/openssl/openssl-1.1.1w-chevah2/CHANGES @@ -7,6 +7,33 @@ https://github.com/openssl/openssl/commits/ and pick the appropriate release branch. + + Changes between 1.1.1w-chevah1 and 1.1.1w-chevah2 [15 Aug 2024] + + *) Fix SSL_select_next_proto buffer overread. + + (CVE-2024-5535) + + *) Fix Use After Free with SSL_free_buffers. + + (CVE-2024-4741) + + *) Fix unbounded memory growth with session handling in TLSv1.3. + + (CVE-2024-2511) + + + Changes between 1.1.1w and 1.1.1w-chevah1 [26 Jul 2024] + + *) Fix PKCS12 decoding crashes. + + (CVE-2024-0727) + + *) Fix excessive time in DH check/generation with large Q parameter value. + + (CVE-2023-5678) + + Changes between 1.1.1v and 1.1.1w [11 Sep 2023] *) Fix POLY1305 MAC implementation corrupting XMM registers on Windows. diff --git a/src/openssl/openssl-1.1.1w/CONTRIBUTING b/src/openssl/openssl-1.1.1w-chevah2/CONTRIBUTING similarity index 100% rename from src/openssl/openssl-1.1.1w/CONTRIBUTING rename to src/openssl/openssl-1.1.1w-chevah2/CONTRIBUTING diff --git a/src/openssl/openssl-1.1.1w/Configurations/00-base-templates.conf b/src/openssl/openssl-1.1.1w-chevah2/Configurations/00-base-templates.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/00-base-templates.conf rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/00-base-templates.conf diff --git a/src/openssl/openssl-1.1.1w/Configurations/10-main.conf b/src/openssl/openssl-1.1.1w-chevah2/Configurations/10-main.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/10-main.conf rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/10-main.conf diff --git a/src/openssl/openssl-1.1.1w/Configurations/15-android.conf b/src/openssl/openssl-1.1.1w-chevah2/Configurations/15-android.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/15-android.conf rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/15-android.conf diff --git a/src/openssl/openssl-1.1.1w/Configurations/15-ios.conf b/src/openssl/openssl-1.1.1w-chevah2/Configurations/15-ios.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/15-ios.conf rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/15-ios.conf diff --git a/src/openssl/openssl-1.1.1w/Configurations/50-djgpp.conf b/src/openssl/openssl-1.1.1w-chevah2/Configurations/50-djgpp.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/50-djgpp.conf rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/50-djgpp.conf diff --git a/src/openssl/openssl-1.1.1w/Configurations/50-haiku.conf b/src/openssl/openssl-1.1.1w-chevah2/Configurations/50-haiku.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/50-haiku.conf rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/50-haiku.conf diff --git a/src/openssl/openssl-1.1.1w/Configurations/50-masm.conf b/src/openssl/openssl-1.1.1w-chevah2/Configurations/50-masm.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/50-masm.conf rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/50-masm.conf diff --git a/src/openssl/openssl-1.1.1w/Configurations/50-win-onecore.conf b/src/openssl/openssl-1.1.1w-chevah2/Configurations/50-win-onecore.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/50-win-onecore.conf rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/50-win-onecore.conf diff --git a/src/openssl/openssl-1.1.1w/Configurations/INTERNALS.Configure b/src/openssl/openssl-1.1.1w-chevah2/Configurations/INTERNALS.Configure similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/INTERNALS.Configure rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/INTERNALS.Configure diff --git a/src/openssl/openssl-1.1.1w/Configurations/README b/src/openssl/openssl-1.1.1w-chevah2/Configurations/README similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/README rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/README diff --git a/src/openssl/openssl-1.1.1w/Configurations/README.design b/src/openssl/openssl-1.1.1w-chevah2/Configurations/README.design similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/README.design rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/README.design diff --git a/src/openssl/openssl-1.1.1w/Configurations/common.tmpl b/src/openssl/openssl-1.1.1w-chevah2/Configurations/common.tmpl similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/common.tmpl rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/common.tmpl diff --git a/src/openssl/openssl-1.1.1w/Configurations/common0.tmpl b/src/openssl/openssl-1.1.1w-chevah2/Configurations/common0.tmpl similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/common0.tmpl rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/common0.tmpl diff --git a/src/openssl/openssl-1.1.1w/Configurations/descrip.mms.tmpl b/src/openssl/openssl-1.1.1w-chevah2/Configurations/descrip.mms.tmpl similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/descrip.mms.tmpl rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/descrip.mms.tmpl diff --git a/src/openssl/openssl-1.1.1w/Configurations/shared-info.pl b/src/openssl/openssl-1.1.1w-chevah2/Configurations/shared-info.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/shared-info.pl rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/shared-info.pl diff --git a/src/openssl/openssl-1.1.1w/Configurations/unix-Makefile.tmpl b/src/openssl/openssl-1.1.1w-chevah2/Configurations/unix-Makefile.tmpl similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/unix-Makefile.tmpl rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/unix-Makefile.tmpl diff --git a/src/openssl/openssl-1.1.1w/Configurations/unix-checker.pm b/src/openssl/openssl-1.1.1w-chevah2/Configurations/unix-checker.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/unix-checker.pm rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/unix-checker.pm diff --git a/src/openssl/openssl-1.1.1w/Configurations/windows-checker.pm b/src/openssl/openssl-1.1.1w-chevah2/Configurations/windows-checker.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/windows-checker.pm rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/windows-checker.pm diff --git a/src/openssl/openssl-1.1.1w/Configurations/windows-makefile.tmpl b/src/openssl/openssl-1.1.1w-chevah2/Configurations/windows-makefile.tmpl similarity index 100% rename from src/openssl/openssl-1.1.1w/Configurations/windows-makefile.tmpl rename to src/openssl/openssl-1.1.1w-chevah2/Configurations/windows-makefile.tmpl diff --git a/src/openssl/openssl-1.1.1w/Configure b/src/openssl/openssl-1.1.1w-chevah2/Configure similarity index 100% rename from src/openssl/openssl-1.1.1w/Configure rename to src/openssl/openssl-1.1.1w-chevah2/Configure diff --git a/src/openssl/openssl-1.1.1w/FAQ b/src/openssl/openssl-1.1.1w-chevah2/FAQ similarity index 100% rename from src/openssl/openssl-1.1.1w/FAQ rename to src/openssl/openssl-1.1.1w-chevah2/FAQ diff --git a/src/openssl/openssl-1.1.1w/INSTALL b/src/openssl/openssl-1.1.1w-chevah2/INSTALL similarity index 100% rename from src/openssl/openssl-1.1.1w/INSTALL rename to src/openssl/openssl-1.1.1w-chevah2/INSTALL diff --git a/src/openssl/openssl-1.1.1w/LICENSE b/src/openssl/openssl-1.1.1w-chevah2/LICENSE similarity index 100% rename from src/openssl/openssl-1.1.1w/LICENSE rename to src/openssl/openssl-1.1.1w-chevah2/LICENSE diff --git a/src/openssl/openssl-1.1.1w/NEWS b/src/openssl/openssl-1.1.1w-chevah2/NEWS similarity index 98% rename from src/openssl/openssl-1.1.1w/NEWS rename to src/openssl/openssl-1.1.1w-chevah2/NEWS index 1b849cdf7..6f8c72917 100644 --- a/src/openssl/openssl-1.1.1w/NEWS +++ b/src/openssl/openssl-1.1.1w-chevah2/NEWS @@ -5,6 +5,19 @@ This file gives a brief overview of the major changes between each OpenSSL release. For more details please read the CHANGES file. + Major changes between OpenSSL 1.1.1w-chevah1 and 1.1.1w-chevah2 [15 Aug 2024] + + o Fix SSL_select_next_proto buffer overread (CVE-2024-5535) + o Fix Use After Free with SSL_free_buffers (CVE-2024-4741) + o Fix unbounded memory growth with session handling in TLSv1.3 + (CVE-2024-2511) + + Major changes between OpenSSL 1.1.1w and OpenSSL 1.1.1w-chevah1 [26 Jul 2024] + + o Fix PKCS12 decoding crashes (CVE-2024-0727) + o Fix excessive time spent in DH check / generation with large Q + parameter value. (CVE-2023-5678) + Major changes between OpenSSL 1.1.1v and OpenSSL 1.1.1w [11 Sep 2023] o Fix POLY1305 MAC implementation corrupting XMM registers on Windows diff --git a/src/openssl/openssl-1.1.1w/NOTES.ANDROID b/src/openssl/openssl-1.1.1w-chevah2/NOTES.ANDROID similarity index 100% rename from src/openssl/openssl-1.1.1w/NOTES.ANDROID rename to src/openssl/openssl-1.1.1w-chevah2/NOTES.ANDROID diff --git a/src/openssl/openssl-1.1.1w/NOTES.DJGPP b/src/openssl/openssl-1.1.1w-chevah2/NOTES.DJGPP similarity index 100% rename from src/openssl/openssl-1.1.1w/NOTES.DJGPP rename to src/openssl/openssl-1.1.1w-chevah2/NOTES.DJGPP diff --git a/src/openssl/openssl-1.1.1w/NOTES.PERL b/src/openssl/openssl-1.1.1w-chevah2/NOTES.PERL similarity index 100% rename from src/openssl/openssl-1.1.1w/NOTES.PERL rename to src/openssl/openssl-1.1.1w-chevah2/NOTES.PERL diff --git a/src/openssl/openssl-1.1.1w/NOTES.UNIX b/src/openssl/openssl-1.1.1w-chevah2/NOTES.UNIX similarity index 100% rename from src/openssl/openssl-1.1.1w/NOTES.UNIX rename to src/openssl/openssl-1.1.1w-chevah2/NOTES.UNIX diff --git a/src/openssl/openssl-1.1.1w/NOTES.VMS b/src/openssl/openssl-1.1.1w-chevah2/NOTES.VMS similarity index 100% rename from src/openssl/openssl-1.1.1w/NOTES.VMS rename to src/openssl/openssl-1.1.1w-chevah2/NOTES.VMS diff --git a/src/openssl/openssl-1.1.1w/NOTES.WIN b/src/openssl/openssl-1.1.1w-chevah2/NOTES.WIN similarity index 100% rename from src/openssl/openssl-1.1.1w/NOTES.WIN rename to src/openssl/openssl-1.1.1w-chevah2/NOTES.WIN diff --git a/src/openssl/openssl-1.1.1w/README b/src/openssl/openssl-1.1.1w-chevah2/README similarity index 98% rename from src/openssl/openssl-1.1.1w/README rename to src/openssl/openssl-1.1.1w-chevah2/README index e924e1529..6777947da 100644 --- a/src/openssl/openssl-1.1.1w/README +++ b/src/openssl/openssl-1.1.1w-chevah2/README @@ -1,5 +1,5 @@ - OpenSSL 1.1.1w 11 Sep 2023 + OpenSSL 1.1.1w-chevah2 15 Aug 2024 Copyright (c) 1998-2023 The OpenSSL Project Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson diff --git a/src/openssl/openssl-1.1.1w/README.ENGINE b/src/openssl/openssl-1.1.1w-chevah2/README.ENGINE similarity index 100% rename from src/openssl/openssl-1.1.1w/README.ENGINE rename to src/openssl/openssl-1.1.1w-chevah2/README.ENGINE diff --git a/src/openssl/openssl-1.1.1w/README.FIPS b/src/openssl/openssl-1.1.1w-chevah2/README.FIPS similarity index 100% rename from src/openssl/openssl-1.1.1w/README.FIPS rename to src/openssl/openssl-1.1.1w-chevah2/README.FIPS diff --git a/src/openssl/openssl-1.1.1w/VMS/VMSify-conf.pl b/src/openssl/openssl-1.1.1w-chevah2/VMS/VMSify-conf.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/VMS/VMSify-conf.pl rename to src/openssl/openssl-1.1.1w-chevah2/VMS/VMSify-conf.pl diff --git a/src/openssl/openssl-1.1.1w/VMS/engine.opt b/src/openssl/openssl-1.1.1w-chevah2/VMS/engine.opt similarity index 100% rename from src/openssl/openssl-1.1.1w/VMS/engine.opt rename to src/openssl/openssl-1.1.1w-chevah2/VMS/engine.opt diff --git a/src/openssl/openssl-1.1.1w/VMS/msg_install.com b/src/openssl/openssl-1.1.1w-chevah2/VMS/msg_install.com similarity index 100% rename from src/openssl/openssl-1.1.1w/VMS/msg_install.com rename to src/openssl/openssl-1.1.1w-chevah2/VMS/msg_install.com diff --git a/src/openssl/openssl-1.1.1w/VMS/msg_staging.com b/src/openssl/openssl-1.1.1w-chevah2/VMS/msg_staging.com similarity index 100% rename from src/openssl/openssl-1.1.1w/VMS/msg_staging.com rename to src/openssl/openssl-1.1.1w-chevah2/VMS/msg_staging.com diff --git a/src/openssl/openssl-1.1.1w/VMS/openssl_ivp.com.in b/src/openssl/openssl-1.1.1w-chevah2/VMS/openssl_ivp.com.in similarity index 100% rename from src/openssl/openssl-1.1.1w/VMS/openssl_ivp.com.in rename to src/openssl/openssl-1.1.1w-chevah2/VMS/openssl_ivp.com.in diff --git a/src/openssl/openssl-1.1.1w/VMS/openssl_shutdown.com.in b/src/openssl/openssl-1.1.1w-chevah2/VMS/openssl_shutdown.com.in similarity index 100% rename from src/openssl/openssl-1.1.1w/VMS/openssl_shutdown.com.in rename to src/openssl/openssl-1.1.1w-chevah2/VMS/openssl_shutdown.com.in diff --git a/src/openssl/openssl-1.1.1w/VMS/openssl_startup.com.in b/src/openssl/openssl-1.1.1w-chevah2/VMS/openssl_startup.com.in similarity index 100% rename from src/openssl/openssl-1.1.1w/VMS/openssl_startup.com.in rename to src/openssl/openssl-1.1.1w-chevah2/VMS/openssl_startup.com.in diff --git a/src/openssl/openssl-1.1.1w/VMS/openssl_utils.com.in b/src/openssl/openssl-1.1.1w-chevah2/VMS/openssl_utils.com.in similarity index 100% rename from src/openssl/openssl-1.1.1w/VMS/openssl_utils.com.in rename to src/openssl/openssl-1.1.1w-chevah2/VMS/openssl_utils.com.in diff --git a/src/openssl/openssl-1.1.1w/VMS/test-includes.com b/src/openssl/openssl-1.1.1w-chevah2/VMS/test-includes.com similarity index 100% rename from src/openssl/openssl-1.1.1w/VMS/test-includes.com rename to src/openssl/openssl-1.1.1w-chevah2/VMS/test-includes.com diff --git a/src/openssl/openssl-1.1.1w/VMS/translatesyms.pl b/src/openssl/openssl-1.1.1w-chevah2/VMS/translatesyms.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/VMS/translatesyms.pl rename to src/openssl/openssl-1.1.1w-chevah2/VMS/translatesyms.pl diff --git a/src/openssl/openssl-1.1.1w/apps/CA.pl.in b/src/openssl/openssl-1.1.1w-chevah2/apps/CA.pl.in similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/CA.pl.in rename to src/openssl/openssl-1.1.1w-chevah2/apps/CA.pl.in diff --git a/src/openssl/openssl-1.1.1w/apps/app_rand.c b/src/openssl/openssl-1.1.1w-chevah2/apps/app_rand.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/app_rand.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/app_rand.c diff --git a/src/openssl/openssl-1.1.1w/apps/apps.c b/src/openssl/openssl-1.1.1w-chevah2/apps/apps.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/apps.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/apps.c diff --git a/src/openssl/openssl-1.1.1w/apps/apps.h b/src/openssl/openssl-1.1.1w-chevah2/apps/apps.h similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/apps.h rename to src/openssl/openssl-1.1.1w-chevah2/apps/apps.h diff --git a/src/openssl/openssl-1.1.1w/apps/asn1pars.c b/src/openssl/openssl-1.1.1w-chevah2/apps/asn1pars.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/asn1pars.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/asn1pars.c diff --git a/src/openssl/openssl-1.1.1w/apps/bf_prefix.c b/src/openssl/openssl-1.1.1w-chevah2/apps/bf_prefix.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/bf_prefix.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/bf_prefix.c diff --git a/src/openssl/openssl-1.1.1w/apps/build.info b/src/openssl/openssl-1.1.1w-chevah2/apps/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/build.info rename to src/openssl/openssl-1.1.1w-chevah2/apps/build.info diff --git a/src/openssl/openssl-1.1.1w/apps/ca-cert.srl b/src/openssl/openssl-1.1.1w-chevah2/apps/ca-cert.srl similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/ca-cert.srl rename to src/openssl/openssl-1.1.1w-chevah2/apps/ca-cert.srl diff --git a/src/openssl/openssl-1.1.1w/apps/ca-key.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/ca-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/ca-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/ca-key.pem diff --git a/src/openssl/openssl-1.1.1w/apps/ca-req.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/ca-req.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/ca-req.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/ca-req.pem diff --git a/src/openssl/openssl-1.1.1w/apps/ca.c b/src/openssl/openssl-1.1.1w-chevah2/apps/ca.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/ca.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/ca.c diff --git a/src/openssl/openssl-1.1.1w/apps/cert.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/cert.pem diff --git a/src/openssl/openssl-1.1.1w/apps/ciphers.c b/src/openssl/openssl-1.1.1w-chevah2/apps/ciphers.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/ciphers.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/ciphers.c diff --git a/src/openssl/openssl-1.1.1w/apps/client.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/client.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/client.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/client.pem diff --git a/src/openssl/openssl-1.1.1w/apps/cms.c b/src/openssl/openssl-1.1.1w-chevah2/apps/cms.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/cms.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/cms.c diff --git a/src/openssl/openssl-1.1.1w/apps/crl.c b/src/openssl/openssl-1.1.1w-chevah2/apps/crl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/crl.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/crl.c diff --git a/src/openssl/openssl-1.1.1w/apps/crl2p7.c b/src/openssl/openssl-1.1.1w-chevah2/apps/crl2p7.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/crl2p7.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/crl2p7.c diff --git a/src/openssl/openssl-1.1.1w/apps/ct_log_list.cnf b/src/openssl/openssl-1.1.1w-chevah2/apps/ct_log_list.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/ct_log_list.cnf rename to src/openssl/openssl-1.1.1w-chevah2/apps/ct_log_list.cnf diff --git a/src/openssl/openssl-1.1.1w/apps/demoSRP/srp_verifier.txt b/src/openssl/openssl-1.1.1w-chevah2/apps/demoSRP/srp_verifier.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/demoSRP/srp_verifier.txt rename to src/openssl/openssl-1.1.1w-chevah2/apps/demoSRP/srp_verifier.txt diff --git a/src/openssl/openssl-1.1.1w/apps/demoSRP/srp_verifier.txt.attr b/src/openssl/openssl-1.1.1w-chevah2/apps/demoSRP/srp_verifier.txt.attr similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/demoSRP/srp_verifier.txt.attr rename to src/openssl/openssl-1.1.1w-chevah2/apps/demoSRP/srp_verifier.txt.attr diff --git a/src/openssl/openssl-1.1.1w/apps/dgst.c b/src/openssl/openssl-1.1.1w-chevah2/apps/dgst.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/dgst.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/dgst.c diff --git a/src/openssl/openssl-1.1.1w/apps/dh1024.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/dh1024.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/dh1024.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/dh1024.pem diff --git a/src/openssl/openssl-1.1.1w/apps/dh2048.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/dh2048.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/dh2048.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/dh2048.pem diff --git a/src/openssl/openssl-1.1.1w/apps/dh4096.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/dh4096.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/dh4096.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/dh4096.pem diff --git a/src/openssl/openssl-1.1.1w/apps/dhparam.c b/src/openssl/openssl-1.1.1w-chevah2/apps/dhparam.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/dhparam.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/dhparam.c diff --git a/src/openssl/openssl-1.1.1w/apps/dsa-ca.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/dsa-ca.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/dsa-ca.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/dsa-ca.pem diff --git a/src/openssl/openssl-1.1.1w/apps/dsa-pca.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/dsa-pca.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/dsa-pca.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/dsa-pca.pem diff --git a/src/openssl/openssl-1.1.1w/apps/dsa.c b/src/openssl/openssl-1.1.1w-chevah2/apps/dsa.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/dsa.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/dsa.c diff --git a/src/openssl/openssl-1.1.1w/apps/dsa1024.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/dsa1024.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/dsa1024.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/dsa1024.pem diff --git a/src/openssl/openssl-1.1.1w/apps/dsa512.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/dsa512.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/dsa512.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/dsa512.pem diff --git a/src/openssl/openssl-1.1.1w/apps/dsap.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/dsap.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/dsap.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/dsap.pem diff --git a/src/openssl/openssl-1.1.1w/apps/dsaparam.c b/src/openssl/openssl-1.1.1w-chevah2/apps/dsaparam.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/dsaparam.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/dsaparam.c diff --git a/src/openssl/openssl-1.1.1w/apps/ec.c b/src/openssl/openssl-1.1.1w-chevah2/apps/ec.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/ec.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/ec.c diff --git a/src/openssl/openssl-1.1.1w/apps/ecparam.c b/src/openssl/openssl-1.1.1w-chevah2/apps/ecparam.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/ecparam.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/ecparam.c diff --git a/src/openssl/openssl-1.1.1w/apps/enc.c b/src/openssl/openssl-1.1.1w-chevah2/apps/enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/enc.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/enc.c diff --git a/src/openssl/openssl-1.1.1w/apps/engine.c b/src/openssl/openssl-1.1.1w-chevah2/apps/engine.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/engine.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/engine.c diff --git a/src/openssl/openssl-1.1.1w/apps/errstr.c b/src/openssl/openssl-1.1.1w-chevah2/apps/errstr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/errstr.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/errstr.c diff --git a/src/openssl/openssl-1.1.1w/apps/gendsa.c b/src/openssl/openssl-1.1.1w-chevah2/apps/gendsa.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/gendsa.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/gendsa.c diff --git a/src/openssl/openssl-1.1.1w/apps/genpkey.c b/src/openssl/openssl-1.1.1w-chevah2/apps/genpkey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/genpkey.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/genpkey.c diff --git a/src/openssl/openssl-1.1.1w/apps/genrsa.c b/src/openssl/openssl-1.1.1w-chevah2/apps/genrsa.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/genrsa.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/genrsa.c diff --git a/src/openssl/openssl-1.1.1w/apps/nseq.c b/src/openssl/openssl-1.1.1w-chevah2/apps/nseq.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/nseq.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/nseq.c diff --git a/src/openssl/openssl-1.1.1w/apps/ocsp.c b/src/openssl/openssl-1.1.1w-chevah2/apps/ocsp.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/ocsp.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/ocsp.c diff --git a/src/openssl/openssl-1.1.1w/apps/openssl-vms.cnf b/src/openssl/openssl-1.1.1w-chevah2/apps/openssl-vms.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/openssl-vms.cnf rename to src/openssl/openssl-1.1.1w-chevah2/apps/openssl-vms.cnf diff --git a/src/openssl/openssl-1.1.1w/apps/openssl.c b/src/openssl/openssl-1.1.1w-chevah2/apps/openssl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/openssl.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/openssl.c diff --git a/src/openssl/openssl-1.1.1w/apps/openssl.cnf b/src/openssl/openssl-1.1.1w-chevah2/apps/openssl.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/openssl.cnf rename to src/openssl/openssl-1.1.1w-chevah2/apps/openssl.cnf diff --git a/src/openssl/openssl-1.1.1w/apps/opt.c b/src/openssl/openssl-1.1.1w-chevah2/apps/opt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/opt.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/opt.c diff --git a/src/openssl/openssl-1.1.1w/apps/passwd.c b/src/openssl/openssl-1.1.1w-chevah2/apps/passwd.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/passwd.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/passwd.c diff --git a/src/openssl/openssl-1.1.1w/apps/pca-cert.srl b/src/openssl/openssl-1.1.1w-chevah2/apps/pca-cert.srl similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/pca-cert.srl rename to src/openssl/openssl-1.1.1w-chevah2/apps/pca-cert.srl diff --git a/src/openssl/openssl-1.1.1w/apps/pca-key.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/pca-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/pca-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/pca-key.pem diff --git a/src/openssl/openssl-1.1.1w/apps/pca-req.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/pca-req.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/pca-req.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/pca-req.pem diff --git a/src/openssl/openssl-1.1.1w/apps/pkcs12.c b/src/openssl/openssl-1.1.1w-chevah2/apps/pkcs12.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/pkcs12.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/pkcs12.c diff --git a/src/openssl/openssl-1.1.1w/apps/pkcs7.c b/src/openssl/openssl-1.1.1w-chevah2/apps/pkcs7.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/pkcs7.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/pkcs7.c diff --git a/src/openssl/openssl-1.1.1w/apps/pkcs8.c b/src/openssl/openssl-1.1.1w-chevah2/apps/pkcs8.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/pkcs8.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/pkcs8.c diff --git a/src/openssl/openssl-1.1.1w/apps/pkey.c b/src/openssl/openssl-1.1.1w-chevah2/apps/pkey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/pkey.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/pkey.c diff --git a/src/openssl/openssl-1.1.1w/apps/pkeyparam.c b/src/openssl/openssl-1.1.1w-chevah2/apps/pkeyparam.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/pkeyparam.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/pkeyparam.c diff --git a/src/openssl/openssl-1.1.1w/apps/pkeyutl.c b/src/openssl/openssl-1.1.1w-chevah2/apps/pkeyutl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/pkeyutl.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/pkeyutl.c diff --git a/src/openssl/openssl-1.1.1w/apps/prime.c b/src/openssl/openssl-1.1.1w-chevah2/apps/prime.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/prime.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/prime.c diff --git a/src/openssl/openssl-1.1.1w/apps/privkey.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/privkey.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/privkey.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/privkey.pem diff --git a/src/openssl/openssl-1.1.1w/apps/progs.pl b/src/openssl/openssl-1.1.1w-chevah2/apps/progs.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/progs.pl rename to src/openssl/openssl-1.1.1w-chevah2/apps/progs.pl diff --git a/src/openssl/openssl-1.1.1w/apps/rand.c b/src/openssl/openssl-1.1.1w-chevah2/apps/rand.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/rand.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/rand.c diff --git a/src/openssl/openssl-1.1.1w/apps/rehash.c b/src/openssl/openssl-1.1.1w-chevah2/apps/rehash.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/rehash.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/rehash.c diff --git a/src/openssl/openssl-1.1.1w/apps/req.c b/src/openssl/openssl-1.1.1w-chevah2/apps/req.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/req.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/req.c diff --git a/src/openssl/openssl-1.1.1w/apps/req.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/req.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/req.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/req.pem diff --git a/src/openssl/openssl-1.1.1w/apps/rsa.c b/src/openssl/openssl-1.1.1w-chevah2/apps/rsa.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/rsa.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/rsa.c diff --git a/src/openssl/openssl-1.1.1w/apps/rsa8192.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/rsa8192.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/rsa8192.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/rsa8192.pem diff --git a/src/openssl/openssl-1.1.1w/apps/rsautl.c b/src/openssl/openssl-1.1.1w-chevah2/apps/rsautl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/rsautl.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/rsautl.c diff --git a/src/openssl/openssl-1.1.1w/apps/s1024key.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/s1024key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/s1024key.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/s1024key.pem diff --git a/src/openssl/openssl-1.1.1w/apps/s1024req.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/s1024req.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/s1024req.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/s1024req.pem diff --git a/src/openssl/openssl-1.1.1w/apps/s512-key.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/s512-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/s512-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/s512-key.pem diff --git a/src/openssl/openssl-1.1.1w/apps/s512-req.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/s512-req.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/s512-req.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/s512-req.pem diff --git a/src/openssl/openssl-1.1.1w/apps/s_apps.h b/src/openssl/openssl-1.1.1w-chevah2/apps/s_apps.h similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/s_apps.h rename to src/openssl/openssl-1.1.1w-chevah2/apps/s_apps.h diff --git a/src/openssl/openssl-1.1.1w/apps/s_cb.c b/src/openssl/openssl-1.1.1w-chevah2/apps/s_cb.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/s_cb.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/s_cb.c diff --git a/src/openssl/openssl-1.1.1w/apps/s_client.c b/src/openssl/openssl-1.1.1w-chevah2/apps/s_client.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/s_client.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/s_client.c diff --git a/src/openssl/openssl-1.1.1w/apps/s_server.c b/src/openssl/openssl-1.1.1w-chevah2/apps/s_server.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/s_server.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/s_server.c diff --git a/src/openssl/openssl-1.1.1w/apps/s_socket.c b/src/openssl/openssl-1.1.1w-chevah2/apps/s_socket.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/s_socket.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/s_socket.c diff --git a/src/openssl/openssl-1.1.1w/apps/s_time.c b/src/openssl/openssl-1.1.1w-chevah2/apps/s_time.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/s_time.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/s_time.c diff --git a/src/openssl/openssl-1.1.1w/apps/server.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/server.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/server.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/server.pem diff --git a/src/openssl/openssl-1.1.1w/apps/server.srl b/src/openssl/openssl-1.1.1w-chevah2/apps/server.srl similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/server.srl rename to src/openssl/openssl-1.1.1w-chevah2/apps/server.srl diff --git a/src/openssl/openssl-1.1.1w/apps/server2.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/server2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/server2.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/server2.pem diff --git a/src/openssl/openssl-1.1.1w/apps/sess_id.c b/src/openssl/openssl-1.1.1w-chevah2/apps/sess_id.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/sess_id.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/sess_id.c diff --git a/src/openssl/openssl-1.1.1w/apps/smime.c b/src/openssl/openssl-1.1.1w-chevah2/apps/smime.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/smime.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/smime.c diff --git a/src/openssl/openssl-1.1.1w/apps/speed.c b/src/openssl/openssl-1.1.1w-chevah2/apps/speed.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/speed.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/speed.c diff --git a/src/openssl/openssl-1.1.1w/apps/spkac.c b/src/openssl/openssl-1.1.1w-chevah2/apps/spkac.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/spkac.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/spkac.c diff --git a/src/openssl/openssl-1.1.1w/apps/srp.c b/src/openssl/openssl-1.1.1w-chevah2/apps/srp.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/srp.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/srp.c diff --git a/src/openssl/openssl-1.1.1w/apps/storeutl.c b/src/openssl/openssl-1.1.1w-chevah2/apps/storeutl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/storeutl.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/storeutl.c diff --git a/src/openssl/openssl-1.1.1w/apps/testCA.pem b/src/openssl/openssl-1.1.1w-chevah2/apps/testCA.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/testCA.pem rename to src/openssl/openssl-1.1.1w-chevah2/apps/testCA.pem diff --git a/src/openssl/openssl-1.1.1w/apps/testdsa.h b/src/openssl/openssl-1.1.1w-chevah2/apps/testdsa.h similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/testdsa.h rename to src/openssl/openssl-1.1.1w-chevah2/apps/testdsa.h diff --git a/src/openssl/openssl-1.1.1w/apps/testrsa.h b/src/openssl/openssl-1.1.1w-chevah2/apps/testrsa.h similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/testrsa.h rename to src/openssl/openssl-1.1.1w-chevah2/apps/testrsa.h diff --git a/src/openssl/openssl-1.1.1w/apps/timeouts.h b/src/openssl/openssl-1.1.1w-chevah2/apps/timeouts.h similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/timeouts.h rename to src/openssl/openssl-1.1.1w-chevah2/apps/timeouts.h diff --git a/src/openssl/openssl-1.1.1w/apps/ts.c b/src/openssl/openssl-1.1.1w-chevah2/apps/ts.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/ts.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/ts.c diff --git a/src/openssl/openssl-1.1.1w/apps/tsget.in b/src/openssl/openssl-1.1.1w-chevah2/apps/tsget.in similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/tsget.in rename to src/openssl/openssl-1.1.1w-chevah2/apps/tsget.in diff --git a/src/openssl/openssl-1.1.1w/apps/verify.c b/src/openssl/openssl-1.1.1w-chevah2/apps/verify.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/verify.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/verify.c diff --git a/src/openssl/openssl-1.1.1w/apps/version.c b/src/openssl/openssl-1.1.1w-chevah2/apps/version.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/version.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/version.c diff --git a/src/openssl/openssl-1.1.1w/apps/vms_decc_argv.c b/src/openssl/openssl-1.1.1w-chevah2/apps/vms_decc_argv.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/vms_decc_argv.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/vms_decc_argv.c diff --git a/src/openssl/openssl-1.1.1w/apps/vms_decc_init.c b/src/openssl/openssl-1.1.1w-chevah2/apps/vms_decc_init.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/vms_decc_init.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/vms_decc_init.c diff --git a/src/openssl/openssl-1.1.1w/apps/vms_term_sock.c b/src/openssl/openssl-1.1.1w-chevah2/apps/vms_term_sock.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/vms_term_sock.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/vms_term_sock.c diff --git a/src/openssl/openssl-1.1.1w/apps/vms_term_sock.h b/src/openssl/openssl-1.1.1w-chevah2/apps/vms_term_sock.h similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/vms_term_sock.h rename to src/openssl/openssl-1.1.1w-chevah2/apps/vms_term_sock.h diff --git a/src/openssl/openssl-1.1.1w/apps/win32_init.c b/src/openssl/openssl-1.1.1w-chevah2/apps/win32_init.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/win32_init.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/win32_init.c diff --git a/src/openssl/openssl-1.1.1w/apps/x509.c b/src/openssl/openssl-1.1.1w-chevah2/apps/x509.c similarity index 100% rename from src/openssl/openssl-1.1.1w/apps/x509.c rename to src/openssl/openssl-1.1.1w-chevah2/apps/x509.c diff --git a/src/openssl/openssl-1.1.1w/build.info b/src/openssl/openssl-1.1.1w-chevah2/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/build.info rename to src/openssl/openssl-1.1.1w-chevah2/build.info diff --git a/src/openssl/openssl-1.1.1w/config b/src/openssl/openssl-1.1.1w-chevah2/config similarity index 100% rename from src/openssl/openssl-1.1.1w/config rename to src/openssl/openssl-1.1.1w-chevah2/config diff --git a/src/openssl/openssl-1.1.1w/config.com b/src/openssl/openssl-1.1.1w-chevah2/config.com similarity index 100% rename from src/openssl/openssl-1.1.1w/config.com rename to src/openssl/openssl-1.1.1w-chevah2/config.com diff --git a/src/openssl/openssl-1.1.1w/crypto/LPdir_nyi.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/LPdir_nyi.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/LPdir_nyi.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/LPdir_nyi.c diff --git a/src/openssl/openssl-1.1.1w/crypto/LPdir_unix.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/LPdir_unix.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/LPdir_unix.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/LPdir_unix.c diff --git a/src/openssl/openssl-1.1.1w/crypto/LPdir_vms.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/LPdir_vms.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/LPdir_vms.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/LPdir_vms.c diff --git a/src/openssl/openssl-1.1.1w/crypto/LPdir_win.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/LPdir_win.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/LPdir_win.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/LPdir_win.c diff --git a/src/openssl/openssl-1.1.1w/crypto/LPdir_win32.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/LPdir_win32.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/LPdir_win32.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/LPdir_win32.c diff --git a/src/openssl/openssl-1.1.1w/crypto/LPdir_wince.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/LPdir_wince.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/LPdir_wince.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/LPdir_wince.c diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/aes_cbc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_cbc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/aes_cbc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_cbc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/aes_cfb.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_cfb.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/aes_cfb.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_cfb.c diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/aes_core.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_core.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/aes_core.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_core.c diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/aes_ecb.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_ecb.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/aes_ecb.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_ecb.c diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/aes_ige.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_ige.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/aes_ige.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_ige.c diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/aes_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/aes_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/aes_misc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_misc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/aes_misc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_misc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/aes_ofb.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_ofb.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/aes_ofb.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_ofb.c diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/aes_wrap.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_wrap.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/aes_wrap.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_wrap.c diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/aes_x86core.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_x86core.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/aes_x86core.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/aes_x86core.c diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/aes-armv4.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aes-armv4.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/aes-armv4.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aes-armv4.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/aes-c64xplus.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aes-c64xplus.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/aes-c64xplus.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aes-c64xplus.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/aes-ia64.S b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aes-ia64.S similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/aes-ia64.S rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aes-ia64.S diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/aes-mips.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aes-mips.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/aes-mips.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aes-mips.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/aes-parisc.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aes-parisc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/aes-parisc.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aes-parisc.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/aes-ppc.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aes-ppc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/aes-ppc.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aes-ppc.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/aes-s390x.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aes-s390x.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/aes-s390x.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aes-s390x.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/aes-sparcv9.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aes-sparcv9.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/aes-sparcv9.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aes-sparcv9.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/aesfx-sparcv9.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aesfx-sparcv9.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/aesfx-sparcv9.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aesfx-sparcv9.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/aesni-mb-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aesni-mb-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/aesni-mb-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aesni-mb-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/aesni-sha1-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aesni-sha1-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/aesni-sha1-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aesni-sha1-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/aesni-sha256-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aesni-sha256-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/aesni-sha256-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aesni-sha256-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/aesni-x86.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aesni-x86.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/aesni-x86.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aesni-x86.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/aesni-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aesni-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/aesni-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aesni-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/aesp8-ppc.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aesp8-ppc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/aesp8-ppc.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aesp8-ppc.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/aest4-sparcv9.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aest4-sparcv9.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/aest4-sparcv9.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aest4-sparcv9.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/aesv8-armx.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aesv8-armx.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/aesv8-armx.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/aesv8-armx.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/bsaes-armv7.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/bsaes-armv7.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/bsaes-armv7.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/bsaes-armv7.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/vpaes-armv8.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/vpaes-armv8.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/vpaes-armv8.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/vpaes-armv8.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/vpaes-ppc.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/vpaes-ppc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/vpaes-ppc.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/vpaes-ppc.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/vpaes-x86.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/vpaes-x86.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/vpaes-x86.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/vpaes-x86.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/asm/vpaes-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/vpaes-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/asm/vpaes-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/asm/vpaes-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aes/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/aes/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aes/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aes/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/alphacpuid.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/alphacpuid.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/alphacpuid.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/alphacpuid.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/aria/aria.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/aria/aria.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aria/aria.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aria/aria.c diff --git a/src/openssl/openssl-1.1.1w/crypto/aria/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/aria/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/aria/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/aria/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/arm64cpuid.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/arm64cpuid.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/arm64cpuid.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/arm64cpuid.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/arm_arch.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/arm_arch.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/arm_arch.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/arm_arch.h diff --git a/src/openssl/openssl-1.1.1w/crypto/armcap.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/armcap.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/armcap.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/armcap.c diff --git a/src/openssl/openssl-1.1.1w/crypto/armv4cpuid.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/armv4cpuid.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/armv4cpuid.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/armv4cpuid.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_bitstr.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_bitstr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_bitstr.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_bitstr.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_d2i_fp.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_d2i_fp.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_d2i_fp.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_d2i_fp.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_digest.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_digest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_digest.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_digest.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_dup.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_dup.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_dup.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_dup.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_gentm.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_gentm.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_gentm.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_gentm.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_i2d_fp.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_i2d_fp.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_i2d_fp.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_i2d_fp.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_int.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_int.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_int.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_int.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_mbstr.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_mbstr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_mbstr.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_mbstr.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_object.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_object.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_object.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_object.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_octet.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_octet.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_octet.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_octet.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_print.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_print.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_print.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_print.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_sign.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_sign.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_sign.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_sign.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_strex.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_strex.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_strex.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_strex.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_strnid.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_strnid.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_strnid.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_strnid.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_time.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_time.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_time.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_time.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_type.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_type.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_type.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_type.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_utctm.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_utctm.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_utctm.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_utctm.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_utf8.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_utf8.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_utf8.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_utf8.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/a_verify.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_verify.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/a_verify.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/a_verify.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/ameth_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/ameth_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/ameth_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/ameth_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/asn1_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn1_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/asn1_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn1_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/asn1_gen.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn1_gen.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/asn1_gen.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn1_gen.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/asn1_item_list.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn1_item_list.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/asn1_item_list.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn1_item_list.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/asn1_item_list.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn1_item_list.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/asn1_item_list.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn1_item_list.h diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/asn1_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn1_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/asn1_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn1_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/asn1_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn1_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/asn1_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn1_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/asn1_par.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn1_par.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/asn1_par.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn1_par.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/asn_mime.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn_mime.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/asn_mime.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn_mime.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/asn_moid.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn_moid.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/asn_moid.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn_moid.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/asn_mstbl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn_mstbl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/asn_mstbl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn_mstbl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/asn_pack.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn_pack.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/asn_pack.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/asn_pack.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/bio_asn1.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/bio_asn1.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/bio_asn1.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/bio_asn1.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/bio_ndef.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/bio_ndef.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/bio_ndef.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/bio_ndef.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/charmap.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/charmap.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/charmap.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/charmap.h diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/charmap.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/charmap.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/charmap.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/charmap.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/d2i_pr.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/d2i_pr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/d2i_pr.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/d2i_pr.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/d2i_pu.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/d2i_pu.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/d2i_pu.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/d2i_pu.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/evp_asn1.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/evp_asn1.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/evp_asn1.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/evp_asn1.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/f_int.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/f_int.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/f_int.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/f_int.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/f_string.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/f_string.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/f_string.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/f_string.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/i2d_pr.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/i2d_pr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/i2d_pr.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/i2d_pr.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/i2d_pu.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/i2d_pu.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/i2d_pu.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/i2d_pu.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/n_pkey.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/n_pkey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/n_pkey.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/n_pkey.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/nsseq.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/nsseq.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/nsseq.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/nsseq.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/p5_pbe.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/p5_pbe.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/p5_pbe.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/p5_pbe.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/p5_pbev2.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/p5_pbev2.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/p5_pbev2.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/p5_pbev2.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/p5_scrypt.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/p5_scrypt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/p5_scrypt.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/p5_scrypt.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/p8_pkey.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/p8_pkey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/p8_pkey.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/p8_pkey.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/standard_methods.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/standard_methods.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/standard_methods.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/standard_methods.h diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/t_bitst.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/t_bitst.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/t_bitst.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/t_bitst.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/t_pkey.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/t_pkey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/t_pkey.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/t_pkey.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/t_spki.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/t_spki.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/t_spki.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/t_spki.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/tasn_dec.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tasn_dec.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/tasn_dec.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tasn_dec.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/tasn_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tasn_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/tasn_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tasn_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/tasn_fre.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tasn_fre.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/tasn_fre.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tasn_fre.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/tasn_new.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tasn_new.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/tasn_new.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tasn_new.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/tasn_prn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tasn_prn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/tasn_prn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tasn_prn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/tasn_scn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tasn_scn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/tasn_scn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tasn_scn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/tasn_typ.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tasn_typ.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/tasn_typ.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tasn_typ.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/tasn_utl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tasn_utl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/tasn_utl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tasn_utl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/tbl_standard.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tbl_standard.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/tbl_standard.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/tbl_standard.h diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/x_algor.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_algor.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/x_algor.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_algor.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/x_bignum.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_bignum.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/x_bignum.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_bignum.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/x_info.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_info.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/x_info.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_info.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/x_int64.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_int64.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/x_int64.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_int64.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/x_long.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_long.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/x_long.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_long.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/x_pkey.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_pkey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/x_pkey.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_pkey.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/x_sig.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_sig.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/x_sig.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_sig.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/x_spki.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_spki.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/x_spki.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_spki.c diff --git a/src/openssl/openssl-1.1.1w/crypto/asn1/x_val.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_val.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/asn1/x_val.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/asn1/x_val.c diff --git a/src/openssl/openssl-1.1.1w/crypto/async/arch/async_null.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/async/arch/async_null.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/async/arch/async_null.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/async/arch/async_null.c diff --git a/src/openssl/openssl-1.1.1w/crypto/async/arch/async_null.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/async/arch/async_null.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/async/arch/async_null.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/async/arch/async_null.h diff --git a/src/openssl/openssl-1.1.1w/crypto/async/arch/async_posix.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/async/arch/async_posix.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/async/arch/async_posix.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/async/arch/async_posix.c diff --git a/src/openssl/openssl-1.1.1w/crypto/async/arch/async_posix.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/async/arch/async_posix.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/async/arch/async_posix.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/async/arch/async_posix.h diff --git a/src/openssl/openssl-1.1.1w/crypto/async/arch/async_win.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/async/arch/async_win.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/async/arch/async_win.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/async/arch/async_win.c diff --git a/src/openssl/openssl-1.1.1w/crypto/async/arch/async_win.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/async/arch/async_win.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/async/arch/async_win.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/async/arch/async_win.h diff --git a/src/openssl/openssl-1.1.1w/crypto/async/async.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/async/async.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/async/async.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/async/async.c diff --git a/src/openssl/openssl-1.1.1w/crypto/async/async_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/async/async_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/async/async_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/async/async_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/async/async_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/async/async_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/async/async_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/async/async_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/async/async_wait.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/async/async_wait.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/async/async_wait.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/async/async_wait.c diff --git a/src/openssl/openssl-1.1.1w/crypto/async/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/async/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/async/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/async/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/bf/asm/bf-586.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bf/asm/bf-586.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bf/asm/bf-586.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bf/asm/bf-586.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bf/bf_cfb64.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bf/bf_cfb64.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bf/bf_cfb64.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bf/bf_cfb64.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bf/bf_ecb.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bf/bf_ecb.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bf/bf_ecb.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bf/bf_ecb.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bf/bf_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bf/bf_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bf/bf_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bf/bf_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bf/bf_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/bf/bf_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bf/bf_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bf/bf_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/bf/bf_ofb64.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bf/bf_ofb64.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bf/bf_ofb64.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bf/bf_ofb64.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bf/bf_pi.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/bf/bf_pi.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bf/bf_pi.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bf/bf_pi.h diff --git a/src/openssl/openssl-1.1.1w/crypto/bf/bf_skey.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bf/bf_skey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bf/bf_skey.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bf/bf_skey.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bf/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/bf/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bf/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bf/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/b_addr.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/b_addr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/b_addr.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/b_addr.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/b_dump.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/b_dump.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/b_dump.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/b_dump.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/b_print.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/b_print.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/b_print.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/b_print.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/b_sock.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/b_sock.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/b_sock.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/b_sock.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/b_sock2.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/b_sock2.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/b_sock2.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/b_sock2.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bf_buff.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bf_buff.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bf_buff.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bf_buff.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bf_lbuf.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bf_lbuf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bf_lbuf.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bf_lbuf.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bf_nbio.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bf_nbio.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bf_nbio.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bf_nbio.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bf_null.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bf_null.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bf_null.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bf_null.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bio_cb.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bio_cb.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bio_cb.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bio_cb.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bio_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bio_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bio_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bio_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bio_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bio_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bio_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bio_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bio_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bio_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bio_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bio_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bio_meth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bio_meth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bio_meth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bio_meth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bss_acpt.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_acpt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bss_acpt.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_acpt.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bss_bio.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_bio.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bss_bio.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_bio.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bss_conn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_conn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bss_conn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_conn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bss_dgram.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_dgram.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bss_dgram.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_dgram.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bss_fd.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_fd.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bss_fd.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_fd.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bss_file.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_file.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bss_file.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_file.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bss_log.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_log.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bss_log.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_log.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bss_mem.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_mem.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bss_mem.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_mem.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bss_null.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_null.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bss_null.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_null.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/bss_sock.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_sock.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/bss_sock.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/bss_sock.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bio/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/bio/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bio/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bio/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/blake2/blake2_impl.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/blake2/blake2_impl.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/blake2/blake2_impl.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/blake2/blake2_impl.h diff --git a/src/openssl/openssl-1.1.1w/crypto/blake2/blake2_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/blake2/blake2_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/blake2/blake2_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/blake2/blake2_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/blake2/blake2b.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/blake2/blake2b.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/blake2/blake2b.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/blake2/blake2b.c diff --git a/src/openssl/openssl-1.1.1w/crypto/blake2/blake2s.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/blake2/blake2s.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/blake2/blake2s.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/blake2/blake2s.c diff --git a/src/openssl/openssl-1.1.1w/crypto/blake2/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/blake2/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/blake2/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/blake2/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/blake2/m_blake2b.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/blake2/m_blake2b.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/blake2/m_blake2b.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/blake2/m_blake2b.c diff --git a/src/openssl/openssl-1.1.1w/crypto/blake2/m_blake2s.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/blake2/m_blake2s.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/blake2/m_blake2s.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/blake2/m_blake2s.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/README.pod b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/README.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/README.pod rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/README.pod diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/alpha-mont.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/alpha-mont.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/alpha-mont.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/alpha-mont.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/armv4-gf2m.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/armv4-gf2m.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/armv4-gf2m.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/armv4-gf2m.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/armv4-mont.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/armv4-mont.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/armv4-mont.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/armv4-mont.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/armv8-mont.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/armv8-mont.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/armv8-mont.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/armv8-mont.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/bn-586.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/bn-586.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/bn-586.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/bn-586.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/bn-c64xplus.asm b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/bn-c64xplus.asm similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/bn-c64xplus.asm rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/bn-c64xplus.asm diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/c64xplus-gf2m.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/c64xplus-gf2m.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/c64xplus-gf2m.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/c64xplus-gf2m.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/co-586.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/co-586.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/co-586.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/co-586.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/ia64-mont.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/ia64-mont.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/ia64-mont.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/ia64-mont.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/ia64.S b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/ia64.S similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/ia64.S rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/ia64.S diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/mips-mont.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/mips-mont.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/mips-mont.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/mips-mont.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/mips.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/mips.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/mips.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/mips.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/parisc-mont.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/parisc-mont.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/parisc-mont.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/parisc-mont.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/ppc-mont.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/ppc-mont.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/ppc-mont.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/ppc-mont.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/ppc.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/ppc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/ppc.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/ppc.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/ppc64-mont.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/ppc64-mont.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/ppc64-mont.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/ppc64-mont.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/rsaz-avx2.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/rsaz-avx2.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/rsaz-avx2.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/rsaz-avx2.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/rsaz-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/rsaz-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/rsaz-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/rsaz-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/s390x-gf2m.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/s390x-gf2m.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/s390x-gf2m.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/s390x-gf2m.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/s390x-mont.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/s390x-mont.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/s390x-mont.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/s390x-mont.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/s390x.S b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/s390x.S similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/s390x.S rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/s390x.S diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/sparct4-mont.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/sparct4-mont.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/sparct4-mont.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/sparct4-mont.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/sparcv8.S b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/sparcv8.S similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/sparcv8.S rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/sparcv8.S diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/sparcv8plus.S b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/sparcv8plus.S similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/sparcv8plus.S rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/sparcv8plus.S diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/sparcv9-gf2m.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/sparcv9-gf2m.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/sparcv9-gf2m.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/sparcv9-gf2m.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/sparcv9-mont.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/sparcv9-mont.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/sparcv9-mont.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/sparcv9-mont.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/sparcv9a-mont.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/sparcv9a-mont.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/sparcv9a-mont.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/sparcv9a-mont.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/via-mont.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/via-mont.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/via-mont.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/via-mont.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/vis3-mont.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/vis3-mont.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/vis3-mont.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/vis3-mont.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/x86-gf2m.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/x86-gf2m.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/x86-gf2m.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/x86-gf2m.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/x86-mont.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/x86-mont.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/x86-mont.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/x86-mont.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/x86_64-gcc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/x86_64-gcc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/x86_64-gcc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/x86_64-gcc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/x86_64-gf2m.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/x86_64-gf2m.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/x86_64-gf2m.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/x86_64-gf2m.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/x86_64-mont.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/x86_64-mont.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/x86_64-mont.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/x86_64-mont.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/asm/x86_64-mont5.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/x86_64-mont5.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/asm/x86_64-mont5.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/asm/x86_64-mont5.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_add.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_add.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_add.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_add.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_asm.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_asm.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_asm.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_asm.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_blind.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_blind.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_blind.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_blind.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_const.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_const.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_const.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_const.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_ctx.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_ctx.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_ctx.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_ctx.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_depr.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_depr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_depr.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_depr.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_dh.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_dh.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_dh.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_dh.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_div.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_div.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_div.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_div.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_exp.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_exp.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_exp.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_exp.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_exp2.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_exp2.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_exp2.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_exp2.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_gcd.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_gcd.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_gcd.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_gcd.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_gf2m.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_gf2m.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_gf2m.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_gf2m.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_intern.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_intern.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_intern.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_intern.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_kron.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_kron.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_kron.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_kron.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_mod.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_mod.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_mod.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_mod.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_mont.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_mont.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_mont.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_mont.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_mpi.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_mpi.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_mpi.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_mpi.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_mul.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_mul.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_mul.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_mul.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_nist.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_nist.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_nist.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_nist.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_prime.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_prime.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_prime.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_prime.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_prime.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_prime.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_prime.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_prime.h diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_prime.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_prime.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_prime.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_prime.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_print.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_print.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_print.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_print.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_rand.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_rand.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_rand.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_rand.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_recp.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_recp.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_recp.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_recp.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_shift.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_shift.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_shift.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_shift.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_sqr.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_sqr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_sqr.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_sqr.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_sqrt.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_sqrt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_sqrt.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_sqrt.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_srp.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_srp.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_srp.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_srp.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_word.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_word.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_word.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_word.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/bn_x931p.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_x931p.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/bn_x931p.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/bn_x931p.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/rsaz_exp.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/rsaz_exp.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/rsaz_exp.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/rsaz_exp.c diff --git a/src/openssl/openssl-1.1.1w/crypto/bn/rsaz_exp.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/bn/rsaz_exp.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/bn/rsaz_exp.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/bn/rsaz_exp.h diff --git a/src/openssl/openssl-1.1.1w/crypto/buffer/buf_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/buffer/buf_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/buffer/buf_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/buffer/buf_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/buffer/buffer.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/buffer/buffer.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/buffer/buffer.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/buffer/buffer.c diff --git a/src/openssl/openssl-1.1.1w/crypto/buffer/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/buffer/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/buffer/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/buffer/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/c64xpluscpuid.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/c64xpluscpuid.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/c64xpluscpuid.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/c64xpluscpuid.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/camellia/asm/cmll-x86.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/asm/cmll-x86.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/camellia/asm/cmll-x86.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/asm/cmll-x86.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/camellia/asm/cmll-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/asm/cmll-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/camellia/asm/cmll-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/asm/cmll-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/camellia/asm/cmllt4-sparcv9.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/asm/cmllt4-sparcv9.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/camellia/asm/cmllt4-sparcv9.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/asm/cmllt4-sparcv9.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/camellia/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/camellia/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/camellia/camellia.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/camellia.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/camellia/camellia.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/camellia.c diff --git a/src/openssl/openssl-1.1.1w/crypto/camellia/cmll_cbc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/cmll_cbc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/camellia/cmll_cbc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/cmll_cbc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/camellia/cmll_cfb.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/cmll_cfb.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/camellia/cmll_cfb.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/cmll_cfb.c diff --git a/src/openssl/openssl-1.1.1w/crypto/camellia/cmll_ctr.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/cmll_ctr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/camellia/cmll_ctr.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/cmll_ctr.c diff --git a/src/openssl/openssl-1.1.1w/crypto/camellia/cmll_ecb.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/cmll_ecb.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/camellia/cmll_ecb.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/cmll_ecb.c diff --git a/src/openssl/openssl-1.1.1w/crypto/camellia/cmll_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/cmll_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/camellia/cmll_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/cmll_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/camellia/cmll_misc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/cmll_misc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/camellia/cmll_misc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/cmll_misc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/camellia/cmll_ofb.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/cmll_ofb.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/camellia/cmll_ofb.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/camellia/cmll_ofb.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cast/asm/cast-586.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/cast/asm/cast-586.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cast/asm/cast-586.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cast/asm/cast-586.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/cast/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/cast/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cast/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cast/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/cast/c_cfb64.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cast/c_cfb64.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cast/c_cfb64.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cast/c_cfb64.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cast/c_ecb.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cast/c_ecb.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cast/c_ecb.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cast/c_ecb.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cast/c_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cast/c_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cast/c_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cast/c_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cast/c_ofb64.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cast/c_ofb64.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cast/c_ofb64.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cast/c_ofb64.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cast/c_skey.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cast/c_skey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cast/c_skey.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cast/c_skey.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cast/cast_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/cast/cast_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cast/cast_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cast/cast_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/cast/cast_s.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/cast/cast_s.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cast/cast_s.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cast/cast_s.h diff --git a/src/openssl/openssl-1.1.1w/crypto/chacha/asm/chacha-armv4.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/asm/chacha-armv4.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/chacha/asm/chacha-armv4.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/asm/chacha-armv4.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/chacha/asm/chacha-armv8.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/asm/chacha-armv8.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/chacha/asm/chacha-armv8.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/asm/chacha-armv8.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/chacha/asm/chacha-c64xplus.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/asm/chacha-c64xplus.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/chacha/asm/chacha-c64xplus.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/asm/chacha-c64xplus.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/chacha/asm/chacha-ppc.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/asm/chacha-ppc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/chacha/asm/chacha-ppc.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/asm/chacha-ppc.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/chacha/asm/chacha-s390x.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/asm/chacha-s390x.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/chacha/asm/chacha-s390x.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/asm/chacha-s390x.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/chacha/asm/chacha-x86.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/asm/chacha-x86.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/chacha/asm/chacha-x86.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/asm/chacha-x86.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/chacha/asm/chacha-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/asm/chacha-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/chacha/asm/chacha-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/asm/chacha-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/chacha/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/chacha/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/chacha/chacha_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/chacha_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/chacha/chacha_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/chacha/chacha_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cmac/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/cmac/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cmac/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cmac/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/cmac/cm_ameth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cmac/cm_ameth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cmac/cm_ameth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cmac/cm_ameth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cmac/cm_pmeth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cmac/cm_pmeth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cmac/cm_pmeth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cmac/cm_pmeth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cmac/cmac.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cmac/cmac.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cmac/cmac.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cmac/cmac.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cms/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/cms/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cms/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cms/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/cms/cms_asn1.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_asn1.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cms/cms_asn1.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_asn1.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cms/cms_att.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_att.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cms/cms_att.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_att.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cms/cms_cd.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_cd.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cms/cms_cd.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_cd.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cms/cms_dd.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_dd.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cms/cms_dd.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_dd.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cms/cms_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cms/cms_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cms/cms_env.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_env.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cms/cms_env.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_env.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cms/cms_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cms/cms_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cms/cms_ess.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_ess.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cms/cms_ess.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_ess.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cms/cms_io.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_io.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cms/cms_io.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_io.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cms/cms_kari.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_kari.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cms/cms_kari.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_kari.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cms/cms_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cms/cms_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cms/cms_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cms/cms_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/cms/cms_pwri.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_pwri.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cms/cms_pwri.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_pwri.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cms/cms_sd.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_sd.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cms/cms_sd.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_sd.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cms/cms_smime.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_smime.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cms/cms_smime.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cms/cms_smime.c diff --git a/src/openssl/openssl-1.1.1w/crypto/comp/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/comp/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/comp/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/comp/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/comp/c_zlib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/comp/c_zlib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/comp/c_zlib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/comp/c_zlib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/comp/comp_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/comp/comp_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/comp/comp_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/comp/comp_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/comp/comp_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/comp/comp_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/comp/comp_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/comp/comp_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/comp/comp_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/comp/comp_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/comp/comp_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/comp/comp_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/conf/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/conf/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/conf/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/conf/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/conf/conf_api.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_api.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/conf/conf_api.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_api.c diff --git a/src/openssl/openssl-1.1.1w/crypto/conf/conf_def.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_def.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/conf/conf_def.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_def.c diff --git a/src/openssl/openssl-1.1.1w/crypto/conf/conf_def.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_def.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/conf/conf_def.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_def.h diff --git a/src/openssl/openssl-1.1.1w/crypto/conf/conf_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/conf/conf_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/conf/conf_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/conf/conf_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/conf/conf_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/conf/conf_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/conf/conf_mall.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_mall.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/conf/conf_mall.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_mall.c diff --git a/src/openssl/openssl-1.1.1w/crypto/conf/conf_mod.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_mod.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/conf/conf_mod.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_mod.c diff --git a/src/openssl/openssl-1.1.1w/crypto/conf/conf_sap.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_sap.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/conf/conf_sap.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_sap.c diff --git a/src/openssl/openssl-1.1.1w/crypto/conf/conf_ssl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_ssl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/conf/conf_ssl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/conf/conf_ssl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/conf/keysets.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/conf/keysets.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/conf/keysets.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/conf/keysets.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/cpt_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cpt_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cpt_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cpt_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cryptlib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cryptlib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cryptlib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cryptlib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ct/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/ct/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ct/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ct/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/ct/ct_b64.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_b64.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ct/ct_b64.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_b64.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ct/ct_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ct/ct_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ct/ct_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ct/ct_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/ct/ct_log.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_log.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ct/ct_log.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_log.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ct/ct_oct.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_oct.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ct/ct_oct.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_oct.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ct/ct_policy.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_policy.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ct/ct_policy.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_policy.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ct/ct_prn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_prn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ct/ct_prn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_prn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ct/ct_sct.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_sct.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ct/ct_sct.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_sct.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ct/ct_sct_ctx.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_sct_ctx.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ct/ct_sct_ctx.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_sct_ctx.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ct/ct_vfy.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_vfy.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ct/ct_vfy.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_vfy.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ct/ct_x509v3.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_x509v3.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ct/ct_x509v3.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ct/ct_x509v3.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ctype.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ctype.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ctype.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ctype.c diff --git a/src/openssl/openssl-1.1.1w/crypto/cversion.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/cversion.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/cversion.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/cversion.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/asm/crypt586.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/asm/crypt586.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/asm/crypt586.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/asm/crypt586.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/des/asm/des-586.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/asm/des-586.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/asm/des-586.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/asm/des-586.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/des/asm/des_enc.m4 b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/asm/des_enc.m4 similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/asm/des_enc.m4 rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/asm/des_enc.m4 diff --git a/src/openssl/openssl-1.1.1w/crypto/des/asm/desboth.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/asm/desboth.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/asm/desboth.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/asm/desboth.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/des/asm/dest4-sparcv9.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/asm/dest4-sparcv9.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/asm/dest4-sparcv9.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/asm/dest4-sparcv9.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/des/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/des/cbc_cksm.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/cbc_cksm.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/cbc_cksm.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/cbc_cksm.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/cbc_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/cbc_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/cbc_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/cbc_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/cfb64ede.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/cfb64ede.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/cfb64ede.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/cfb64ede.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/cfb64enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/cfb64enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/cfb64enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/cfb64enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/cfb_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/cfb_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/cfb_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/cfb_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/des_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/des_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/des_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/des_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/des_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/des_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/des_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/des_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/des/ecb3_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/ecb3_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/ecb3_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/ecb3_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/ecb_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/ecb_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/ecb_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/ecb_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/fcrypt.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/fcrypt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/fcrypt.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/fcrypt.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/fcrypt_b.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/fcrypt_b.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/fcrypt_b.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/fcrypt_b.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/ncbc_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/ncbc_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/ncbc_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/ncbc_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/ofb64ede.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/ofb64ede.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/ofb64ede.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/ofb64ede.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/ofb64enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/ofb64enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/ofb64enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/ofb64enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/ofb_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/ofb_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/ofb_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/ofb_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/pcbc_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/pcbc_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/pcbc_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/pcbc_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/qud_cksm.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/qud_cksm.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/qud_cksm.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/qud_cksm.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/rand_key.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/rand_key.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/rand_key.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/rand_key.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/set_key.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/set_key.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/set_key.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/set_key.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/spr.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/spr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/spr.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/spr.h diff --git a/src/openssl/openssl-1.1.1w/crypto/des/str2key.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/str2key.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/str2key.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/str2key.c diff --git a/src/openssl/openssl-1.1.1w/crypto/des/xcbc_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/des/xcbc_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/des/xcbc_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/des/xcbc_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh1024.pem b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh1024.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh1024.pem rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh1024.pem diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh192.pem b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh192.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh192.pem rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh192.pem diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh2048.pem b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh2048.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh2048.pem rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh2048.pem diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh4096.pem b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh4096.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh4096.pem rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh4096.pem diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh512.pem b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh512.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh512.pem rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh512.pem diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh_ameth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_ameth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh_ameth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_ameth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh_asn1.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_asn1.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh_asn1.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_asn1.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh_check.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_check.c similarity index 93% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh_check.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_check.c index ae1b03bc9..5e97861af 100644 --- a/src/openssl/openssl-1.1.1w/crypto/dh/dh_check.c +++ b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_check.c @@ -202,6 +202,19 @@ int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret) if (ctx == NULL) goto err; BN_CTX_start(ctx); + + /* Don't do any checks at all with an excessively large modulus */ + if (BN_num_bits(dh->p) > OPENSSL_DH_CHECK_MAX_MODULUS_BITS) { + DHerr(DH_F_DH_CHECK, DH_R_MODULUS_TOO_LARGE); + *ret = DH_MODULUS_TOO_LARGE | DH_CHECK_PUBKEY_INVALID; + goto err; + } + + if (dh->q != NULL && BN_ucmp(dh->p, dh->q) < 0) { + *ret |= DH_CHECK_INVALID_Q_VALUE | DH_CHECK_PUBKEY_INVALID; + goto out; + } + tmp = BN_CTX_get(ctx); if (tmp == NULL || !BN_set_word(tmp, 1)) goto err; @@ -220,6 +233,7 @@ int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret) *ret |= DH_CHECK_PUBKEY_INVALID; } + out: ok = 1; err: BN_CTX_end(ctx); diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh_depr.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_depr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh_depr.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_depr.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_err.c similarity index 98% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_err.c index 92800d3fc..b3b1e7a70 100644 --- a/src/openssl/openssl-1.1.1w/crypto/dh/dh_err.c +++ b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_err.c @@ -82,6 +82,7 @@ static const ERR_STRING_DATA DH_str_reasons[] = { {ERR_PACK(ERR_LIB_DH, 0, DH_R_PARAMETER_ENCODING_ERROR), "parameter encoding error"}, {ERR_PACK(ERR_LIB_DH, 0, DH_R_PEER_KEY_ERROR), "peer key error"}, + {ERR_PACK(ERR_LIB_DH, 0, DH_R_Q_TOO_LARGE), "q too large"}, {ERR_PACK(ERR_LIB_DH, 0, DH_R_SHARED_INFO_ERROR), "shared info error"}, {ERR_PACK(ERR_LIB_DH, 0, DH_R_UNABLE_TO_CHECK_GENERATOR), "unable to check generator"}, diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh_gen.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_gen.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh_gen.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_gen.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh_kdf.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_kdf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh_kdf.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_kdf.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh_key.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_key.c similarity index 95% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh_key.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_key.c index 117f2fa88..c77ce1b09 100644 --- a/src/openssl/openssl-1.1.1w/crypto/dh/dh_key.c +++ b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_key.c @@ -114,6 +114,12 @@ static int generate_key(DH *dh) return 0; } + if (dh->q != NULL + && BN_num_bits(dh->q) > OPENSSL_DH_MAX_MODULUS_BITS) { + DHerr(DH_F_GENERATE_KEY, DH_R_Q_TOO_LARGE); + return 0; + } + ctx = BN_CTX_new(); if (ctx == NULL) goto err; @@ -207,6 +213,12 @@ static int compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) goto err; } + if (dh->q != NULL + && BN_num_bits(dh->q) > OPENSSL_DH_MAX_MODULUS_BITS) { + DHerr(DH_F_COMPUTE_KEY, DH_R_Q_TOO_LARGE); + goto err; + } + ctx = BN_CTX_new(); if (ctx == NULL) goto err; diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh_meth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_meth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh_meth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_meth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh_pmeth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_pmeth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh_pmeth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_pmeth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh_prn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_prn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh_prn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_prn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh_rfc5114.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_rfc5114.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh_rfc5114.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_rfc5114.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dh/dh_rfc7919.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_rfc7919.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dh/dh_rfc7919.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dh/dh_rfc7919.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dllmain.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dllmain.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dllmain.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dllmain.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dsa/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dsa/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/dsa/dsa_ameth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_ameth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dsa/dsa_ameth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_ameth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dsa/dsa_asn1.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_asn1.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dsa/dsa_asn1.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_asn1.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dsa/dsa_depr.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_depr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dsa/dsa_depr.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_depr.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dsa/dsa_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dsa/dsa_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dsa/dsa_gen.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_gen.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dsa/dsa_gen.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_gen.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dsa/dsa_key.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_key.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dsa/dsa_key.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_key.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dsa/dsa_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dsa/dsa_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dsa/dsa_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dsa/dsa_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/dsa/dsa_meth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_meth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dsa/dsa_meth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_meth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dsa/dsa_ossl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_ossl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dsa/dsa_ossl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_ossl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dsa/dsa_pmeth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_pmeth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dsa/dsa_pmeth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_pmeth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dsa/dsa_prn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_prn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dsa/dsa_prn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_prn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dsa/dsa_sign.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_sign.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dsa/dsa_sign.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_sign.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dsa/dsa_vrf.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_vrf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dsa/dsa_vrf.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dsa/dsa_vrf.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dso/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/dso/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dso/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dso/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/dso/dso_dl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dso/dso_dl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dso/dso_dl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dso/dso_dl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dso/dso_dlfcn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dso/dso_dlfcn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dso/dso_dlfcn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dso/dso_dlfcn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dso/dso_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dso/dso_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dso/dso_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dso/dso_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dso/dso_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dso/dso_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dso/dso_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dso/dso_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dso/dso_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/dso/dso_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dso/dso_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dso/dso_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/dso/dso_openssl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dso/dso_openssl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dso/dso_openssl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dso/dso_openssl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dso/dso_vms.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dso/dso_vms.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dso/dso_vms.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dso/dso_vms.c diff --git a/src/openssl/openssl-1.1.1w/crypto/dso/dso_win32.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/dso/dso_win32.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/dso/dso_win32.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/dso/dso_win32.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ebcdic.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ebcdic.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ebcdic.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ebcdic.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/asm/ecp_nistz256-armv4.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/asm/ecp_nistz256-armv4.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/asm/ecp_nistz256-armv4.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/asm/ecp_nistz256-armv4.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/asm/ecp_nistz256-armv8.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/asm/ecp_nistz256-armv8.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/asm/ecp_nistz256-armv8.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/asm/ecp_nistz256-armv8.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/asm/ecp_nistz256-ppc64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/asm/ecp_nistz256-ppc64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/asm/ecp_nistz256-ppc64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/asm/ecp_nistz256-ppc64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/asm/ecp_nistz256-sparcv9.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/asm/ecp_nistz256-sparcv9.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/asm/ecp_nistz256-sparcv9.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/asm/ecp_nistz256-sparcv9.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/asm/ecp_nistz256-x86.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/asm/ecp_nistz256-x86.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/asm/ecp_nistz256-x86.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/asm/ecp_nistz256-x86.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/asm/ecp_nistz256-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/asm/ecp_nistz256-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/asm/ecp_nistz256-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/asm/ecp_nistz256-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/asm/x25519-ppc64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/asm/x25519-ppc64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/asm/x25519-ppc64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/asm/x25519-ppc64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/asm/x25519-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/asm/x25519-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/asm/x25519-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/asm/x25519-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/curve25519.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve25519.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/curve25519.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve25519.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/curve448/arch_32/arch_intrinsics.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/arch_32/arch_intrinsics.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/curve448/arch_32/arch_intrinsics.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/arch_32/arch_intrinsics.h diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/curve448/arch_32/f_impl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/arch_32/f_impl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/curve448/arch_32/f_impl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/arch_32/f_impl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/curve448/arch_32/f_impl.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/arch_32/f_impl.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/curve448/arch_32/f_impl.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/arch_32/f_impl.h diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/curve448/curve448.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/curve448.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/curve448/curve448.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/curve448.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/curve448/curve448_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/curve448_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/curve448/curve448_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/curve448_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/curve448/curve448_tables.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/curve448_tables.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/curve448/curve448_tables.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/curve448_tables.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/curve448/curve448utils.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/curve448utils.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/curve448/curve448utils.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/curve448utils.h diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/curve448/ed448.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/ed448.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/curve448/ed448.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/ed448.h diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/curve448/eddsa.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/eddsa.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/curve448/eddsa.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/eddsa.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/curve448/f_generic.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/f_generic.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/curve448/f_generic.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/f_generic.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/curve448/field.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/field.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/curve448/field.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/field.h diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/curve448/point_448.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/point_448.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/curve448/point_448.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/point_448.h diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/curve448/scalar.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/scalar.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/curve448/scalar.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/scalar.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/curve448/word.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/word.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/curve448/word.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/curve448/word.h diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ec2_oct.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec2_oct.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ec2_oct.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec2_oct.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ec2_smpl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec2_smpl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ec2_smpl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec2_smpl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ec_ameth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_ameth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ec_ameth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_ameth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ec_asn1.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_asn1.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ec_asn1.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_asn1.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ec_check.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_check.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ec_check.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_check.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ec_curve.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_curve.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ec_curve.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_curve.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ec_cvt.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_cvt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ec_cvt.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_cvt.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ec_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ec_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ec_key.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_key.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ec_key.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_key.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ec_kmeth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_kmeth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ec_kmeth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_kmeth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ec_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ec_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ec_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ec_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ec_mult.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_mult.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ec_mult.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_mult.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ec_oct.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_oct.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ec_oct.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_oct.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ec_pmeth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_pmeth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ec_pmeth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_pmeth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ec_print.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_print.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ec_print.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ec_print.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ecdh_kdf.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecdh_kdf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ecdh_kdf.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecdh_kdf.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ecdh_ossl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecdh_ossl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ecdh_ossl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecdh_ossl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ecdsa_ossl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecdsa_ossl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ecdsa_ossl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecdsa_ossl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ecdsa_sign.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecdsa_sign.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ecdsa_sign.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecdsa_sign.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ecdsa_vrf.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecdsa_vrf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ecdsa_vrf.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecdsa_vrf.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/eck_prn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/eck_prn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/eck_prn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/eck_prn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ecp_mont.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_mont.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ecp_mont.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_mont.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ecp_nist.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_nist.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ecp_nist.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_nist.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ecp_nistp224.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_nistp224.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ecp_nistp224.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_nistp224.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ecp_nistp256.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_nistp256.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ecp_nistp256.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_nistp256.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ecp_nistp521.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_nistp521.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ecp_nistp521.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_nistp521.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ecp_nistputil.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_nistputil.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ecp_nistputil.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_nistputil.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ecp_nistz256.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_nistz256.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ecp_nistz256.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_nistz256.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ecp_nistz256_table.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_nistz256_table.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ecp_nistz256_table.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_nistz256_table.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ecp_oct.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_oct.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ecp_oct.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_oct.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ecp_smpl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_smpl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ecp_smpl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecp_smpl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ec/ecx_meth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecx_meth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ec/ecx_meth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ec/ecx_meth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/README b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/README similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/README rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/README diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/eng_all.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_all.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/eng_all.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_all.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/eng_cnf.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_cnf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/eng_cnf.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_cnf.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/eng_ctrl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_ctrl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/eng_ctrl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_ctrl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/eng_devcrypto.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_devcrypto.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/eng_devcrypto.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_devcrypto.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/eng_dyn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_dyn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/eng_dyn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_dyn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/eng_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/eng_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/eng_fat.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_fat.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/eng_fat.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_fat.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/eng_init.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_init.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/eng_init.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_init.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/eng_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/eng_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/eng_list.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_list.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/eng_list.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_list.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/eng_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/eng_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/eng_openssl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_openssl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/eng_openssl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_openssl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/eng_pkey.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_pkey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/eng_pkey.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_pkey.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/eng_rdrand.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_rdrand.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/eng_rdrand.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_rdrand.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/eng_table.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_table.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/eng_table.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/eng_table.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/tb_asnmth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_asnmth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/tb_asnmth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_asnmth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/tb_cipher.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_cipher.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/tb_cipher.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_cipher.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/tb_dh.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_dh.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/tb_dh.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_dh.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/tb_digest.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_digest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/tb_digest.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_digest.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/tb_dsa.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_dsa.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/tb_dsa.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_dsa.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/tb_eckey.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_eckey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/tb_eckey.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_eckey.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/tb_pkmeth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_pkmeth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/tb_pkmeth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_pkmeth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/tb_rand.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_rand.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/tb_rand.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_rand.c diff --git a/src/openssl/openssl-1.1.1w/crypto/engine/tb_rsa.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_rsa.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/engine/tb_rsa.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/engine/tb_rsa.c diff --git a/src/openssl/openssl-1.1.1w/crypto/err/README b/src/openssl/openssl-1.1.1w-chevah2/crypto/err/README similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/err/README rename to src/openssl/openssl-1.1.1w-chevah2/crypto/err/README diff --git a/src/openssl/openssl-1.1.1w/crypto/err/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/err/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/err/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/err/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/err/err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/err/err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/err/err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/err/err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/err/err_all.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/err/err_all.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/err/err_all.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/err/err_all.c diff --git a/src/openssl/openssl-1.1.1w/crypto/err/err_prn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/err/err_prn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/err/err_prn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/err/err_prn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/err/openssl.ec b/src/openssl/openssl-1.1.1w-chevah2/crypto/err/openssl.ec similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/err/openssl.ec rename to src/openssl/openssl-1.1.1w-chevah2/crypto/err/openssl.ec diff --git a/src/openssl/openssl-1.1.1w/crypto/err/openssl.txt b/src/openssl/openssl-1.1.1w-chevah2/crypto/err/openssl.txt similarity index 99% rename from src/openssl/openssl-1.1.1w/crypto/err/openssl.txt rename to src/openssl/openssl-1.1.1w-chevah2/crypto/err/openssl.txt index c0a3cd720..5e0ff4751 100644 --- a/src/openssl/openssl-1.1.1w/crypto/err/openssl.txt +++ b/src/openssl/openssl-1.1.1w-chevah2/crypto/err/openssl.txt @@ -2106,6 +2106,7 @@ DH_R_NO_PARAMETERS_SET:107:no parameters set DH_R_NO_PRIVATE_VALUE:100:no private value DH_R_PARAMETER_ENCODING_ERROR:105:parameter encoding error DH_R_PEER_KEY_ERROR:111:peer key error +DH_R_Q_TOO_LARGE:130:q too large DH_R_SHARED_INFO_ERROR:113:shared info error DH_R_UNABLE_TO_CHECK_GENERATOR:121:unable to check generator DSA_R_BAD_Q_VALUE:102:bad q value diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/bio_b64.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/bio_b64.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/bio_b64.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/bio_b64.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/bio_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/bio_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/bio_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/bio_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/bio_md.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/bio_md.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/bio_md.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/bio_md.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/bio_ok.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/bio_ok.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/bio_ok.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/bio_ok.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/c_allc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/c_allc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/c_allc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/c_allc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/c_alld.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/c_alld.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/c_alld.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/c_alld.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/cmeth_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/cmeth_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/cmeth_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/cmeth_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/digest.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/digest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/digest.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/digest.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_aes.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_aes.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_aes.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_aes.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_aes_cbc_hmac_sha1.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_aes_cbc_hmac_sha1.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_aes_cbc_hmac_sha1.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_aes_cbc_hmac_sha1.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_aes_cbc_hmac_sha256.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_aes_cbc_hmac_sha256.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_aes_cbc_hmac_sha256.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_aes_cbc_hmac_sha256.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_aria.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_aria.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_aria.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_aria.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_bf.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_bf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_bf.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_bf.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_camellia.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_camellia.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_camellia.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_camellia.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_cast.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_cast.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_cast.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_cast.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_chacha20_poly1305.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_chacha20_poly1305.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_chacha20_poly1305.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_chacha20_poly1305.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_des.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_des.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_des.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_des.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_des3.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_des3.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_des3.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_des3.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_idea.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_idea.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_idea.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_idea.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_null.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_null.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_null.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_null.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_old.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_old.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_old.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_old.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_rc2.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_rc2.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_rc2.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_rc2.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_rc4.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_rc4.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_rc4.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_rc4.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_rc4_hmac_md5.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_rc4_hmac_md5.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_rc4_hmac_md5.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_rc4_hmac_md5.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_rc5.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_rc5.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_rc5.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_rc5.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_seed.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_seed.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_seed.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_seed.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_sm4.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_sm4.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_sm4.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_sm4.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/e_xcbc_d.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_xcbc_d.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/e_xcbc_d.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/e_xcbc_d.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/encode.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/encode.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/encode.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/encode.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/evp_cnf.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/evp_cnf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/evp_cnf.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/evp_cnf.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/evp_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/evp_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/evp_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/evp_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/evp_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/evp_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/evp_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/evp_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/evp_key.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/evp_key.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/evp_key.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/evp_key.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/evp_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/evp_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/evp_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/evp_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/evp_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/evp_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/evp_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/evp_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/evp_pbe.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/evp_pbe.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/evp_pbe.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/evp_pbe.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/evp_pkey.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/evp_pkey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/evp_pkey.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/evp_pkey.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/m_md2.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_md2.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/m_md2.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_md2.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/m_md4.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_md4.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/m_md4.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_md4.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/m_md5.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_md5.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/m_md5.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_md5.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/m_md5_sha1.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_md5_sha1.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/m_md5_sha1.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_md5_sha1.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/m_mdc2.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_mdc2.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/m_mdc2.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_mdc2.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/m_null.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_null.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/m_null.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_null.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/m_ripemd.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_ripemd.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/m_ripemd.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_ripemd.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/m_sha1.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_sha1.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/m_sha1.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_sha1.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/m_sha3.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_sha3.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/m_sha3.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_sha3.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/m_sigver.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_sigver.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/m_sigver.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_sigver.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/m_wp.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_wp.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/m_wp.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/m_wp.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/names.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/names.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/names.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/names.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/p5_crpt.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p5_crpt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/p5_crpt.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p5_crpt.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/p5_crpt2.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p5_crpt2.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/p5_crpt2.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p5_crpt2.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/p_dec.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p_dec.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/p_dec.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p_dec.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/p_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/p_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/p_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/p_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/p_open.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p_open.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/p_open.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p_open.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/p_seal.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p_seal.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/p_seal.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p_seal.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/p_sign.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p_sign.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/p_sign.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p_sign.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/p_verify.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p_verify.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/p_verify.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/p_verify.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/pbe_scrypt.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/pbe_scrypt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/pbe_scrypt.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/pbe_scrypt.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/pmeth_fn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/pmeth_fn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/pmeth_fn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/pmeth_fn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/pmeth_gn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/pmeth_gn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/pmeth_gn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/pmeth_gn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/evp/pmeth_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/evp/pmeth_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/evp/pmeth_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/evp/pmeth_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ex_data.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ex_data.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ex_data.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ex_data.c diff --git a/src/openssl/openssl-1.1.1w/crypto/getenv.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/getenv.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/getenv.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/getenv.c diff --git a/src/openssl/openssl-1.1.1w/crypto/hmac/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/hmac/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/hmac/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/hmac/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/hmac/hm_ameth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/hmac/hm_ameth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/hmac/hm_ameth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/hmac/hm_ameth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/hmac/hm_pmeth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/hmac/hm_pmeth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/hmac/hm_pmeth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/hmac/hm_pmeth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/hmac/hmac.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/hmac/hmac.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/hmac/hmac.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/hmac/hmac.c diff --git a/src/openssl/openssl-1.1.1w/crypto/hmac/hmac_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/hmac/hmac_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/hmac/hmac_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/hmac/hmac_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/ia64cpuid.S b/src/openssl/openssl-1.1.1w-chevah2/crypto/ia64cpuid.S similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ia64cpuid.S rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ia64cpuid.S diff --git a/src/openssl/openssl-1.1.1w/crypto/idea/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/idea/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/idea/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/idea/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/idea/i_cbc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/idea/i_cbc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/idea/i_cbc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/idea/i_cbc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/idea/i_cfb64.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/idea/i_cfb64.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/idea/i_cfb64.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/idea/i_cfb64.c diff --git a/src/openssl/openssl-1.1.1w/crypto/idea/i_ecb.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/idea/i_ecb.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/idea/i_ecb.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/idea/i_ecb.c diff --git a/src/openssl/openssl-1.1.1w/crypto/idea/i_ofb64.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/idea/i_ofb64.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/idea/i_ofb64.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/idea/i_ofb64.c diff --git a/src/openssl/openssl-1.1.1w/crypto/idea/i_skey.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/idea/i_skey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/idea/i_skey.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/idea/i_skey.c diff --git a/src/openssl/openssl-1.1.1w/crypto/idea/idea_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/idea/idea_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/idea/idea_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/idea/idea_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/init.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/init.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/init.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/init.c diff --git a/src/openssl/openssl-1.1.1w/crypto/kdf/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/kdf/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/kdf/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/kdf/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/kdf/hkdf.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/kdf/hkdf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/kdf/hkdf.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/kdf/hkdf.c diff --git a/src/openssl/openssl-1.1.1w/crypto/kdf/kdf_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/kdf/kdf_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/kdf/kdf_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/kdf/kdf_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/kdf/scrypt.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/kdf/scrypt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/kdf/scrypt.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/kdf/scrypt.c diff --git a/src/openssl/openssl-1.1.1w/crypto/kdf/tls1_prf.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/kdf/tls1_prf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/kdf/tls1_prf.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/kdf/tls1_prf.c diff --git a/src/openssl/openssl-1.1.1w/crypto/lhash/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/lhash/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/lhash/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/lhash/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/lhash/lh_stats.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/lhash/lh_stats.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/lhash/lh_stats.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/lhash/lh_stats.c diff --git a/src/openssl/openssl-1.1.1w/crypto/lhash/lhash.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/lhash/lhash.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/lhash/lhash.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/lhash/lhash.c diff --git a/src/openssl/openssl-1.1.1w/crypto/lhash/lhash_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/lhash/lhash_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/lhash/lhash_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/lhash/lhash_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/md2/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/md2/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/md2/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/md2/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/md2/md2_dgst.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/md2/md2_dgst.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/md2/md2_dgst.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/md2/md2_dgst.c diff --git a/src/openssl/openssl-1.1.1w/crypto/md2/md2_one.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/md2/md2_one.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/md2/md2_one.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/md2/md2_one.c diff --git a/src/openssl/openssl-1.1.1w/crypto/md4/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/md4/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/md4/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/md4/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/md4/md4_dgst.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/md4/md4_dgst.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/md4/md4_dgst.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/md4/md4_dgst.c diff --git a/src/openssl/openssl-1.1.1w/crypto/md4/md4_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/md4/md4_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/md4/md4_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/md4/md4_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/md4/md4_one.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/md4/md4_one.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/md4/md4_one.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/md4/md4_one.c diff --git a/src/openssl/openssl-1.1.1w/crypto/md5/asm/md5-586.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/md5/asm/md5-586.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/md5/asm/md5-586.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/md5/asm/md5-586.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/md5/asm/md5-sparcv9.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/md5/asm/md5-sparcv9.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/md5/asm/md5-sparcv9.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/md5/asm/md5-sparcv9.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/md5/asm/md5-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/md5/asm/md5-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/md5/asm/md5-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/md5/asm/md5-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/md5/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/md5/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/md5/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/md5/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/md5/md5_dgst.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/md5/md5_dgst.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/md5/md5_dgst.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/md5/md5_dgst.c diff --git a/src/openssl/openssl-1.1.1w/crypto/md5/md5_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/md5/md5_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/md5/md5_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/md5/md5_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/md5/md5_one.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/md5/md5_one.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/md5/md5_one.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/md5/md5_one.c diff --git a/src/openssl/openssl-1.1.1w/crypto/mdc2/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/mdc2/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/mdc2/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/mdc2/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/mdc2/mdc2_one.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/mdc2/mdc2_one.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/mdc2/mdc2_one.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/mdc2/mdc2_one.c diff --git a/src/openssl/openssl-1.1.1w/crypto/mdc2/mdc2dgst.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/mdc2/mdc2dgst.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/mdc2/mdc2dgst.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/mdc2/mdc2dgst.c diff --git a/src/openssl/openssl-1.1.1w/crypto/mem.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/mem.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/mem.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/mem.c diff --git a/src/openssl/openssl-1.1.1w/crypto/mem_clr.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/mem_clr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/mem_clr.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/mem_clr.c diff --git a/src/openssl/openssl-1.1.1w/crypto/mem_dbg.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/mem_dbg.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/mem_dbg.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/mem_dbg.c diff --git a/src/openssl/openssl-1.1.1w/crypto/mem_sec.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/mem_sec.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/mem_sec.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/mem_sec.c diff --git a/src/openssl/openssl-1.1.1w/crypto/mips_arch.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/mips_arch.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/mips_arch.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/mips_arch.h diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/asm/aesni-gcm-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/aesni-gcm-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/asm/aesni-gcm-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/aesni-gcm-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-alpha.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-alpha.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-alpha.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-alpha.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-armv4.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-armv4.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-armv4.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-armv4.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-c64xplus.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-c64xplus.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-c64xplus.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-c64xplus.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-ia64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-ia64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-ia64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-ia64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-parisc.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-parisc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-parisc.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-parisc.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-s390x.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-s390x.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-s390x.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-s390x.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-sparcv9.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-sparcv9.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-sparcv9.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-sparcv9.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-x86.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-x86.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-x86.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-x86.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/asm/ghash-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghash-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/asm/ghashp8-ppc.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghashp8-ppc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/asm/ghashp8-ppc.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghashp8-ppc.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/asm/ghashv8-armx.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghashv8-armx.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/asm/ghashv8-armx.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/asm/ghashv8-armx.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/cbc128.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/cbc128.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/cbc128.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/cbc128.c diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/ccm128.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/ccm128.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/ccm128.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/ccm128.c diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/cfb128.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/cfb128.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/cfb128.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/cfb128.c diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/ctr128.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/ctr128.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/ctr128.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/ctr128.c diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/cts128.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/cts128.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/cts128.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/cts128.c diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/gcm128.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/gcm128.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/gcm128.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/gcm128.c diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/modes_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/modes_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/modes_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/modes_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/ocb128.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/ocb128.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/ocb128.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/ocb128.c diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/ofb128.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/ofb128.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/ofb128.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/ofb128.c diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/wrap128.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/wrap128.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/wrap128.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/wrap128.c diff --git a/src/openssl/openssl-1.1.1w/crypto/modes/xts128.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/modes/xts128.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/modes/xts128.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/modes/xts128.c diff --git a/src/openssl/openssl-1.1.1w/crypto/o_dir.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/o_dir.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/o_dir.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/o_dir.c diff --git a/src/openssl/openssl-1.1.1w/crypto/o_fips.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/o_fips.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/o_fips.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/o_fips.c diff --git a/src/openssl/openssl-1.1.1w/crypto/o_fopen.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/o_fopen.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/o_fopen.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/o_fopen.c diff --git a/src/openssl/openssl-1.1.1w/crypto/o_init.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/o_init.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/o_init.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/o_init.c diff --git a/src/openssl/openssl-1.1.1w/crypto/o_str.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/o_str.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/o_str.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/o_str.c diff --git a/src/openssl/openssl-1.1.1w/crypto/o_time.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/o_time.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/o_time.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/o_time.c diff --git a/src/openssl/openssl-1.1.1w/crypto/objects/README b/src/openssl/openssl-1.1.1w-chevah2/crypto/objects/README similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/objects/README rename to src/openssl/openssl-1.1.1w-chevah2/crypto/objects/README diff --git a/src/openssl/openssl-1.1.1w/crypto/objects/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/objects/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/objects/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/objects/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/objects/o_names.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/objects/o_names.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/objects/o_names.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/objects/o_names.c diff --git a/src/openssl/openssl-1.1.1w/crypto/objects/obj_dat.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_dat.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/objects/obj_dat.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_dat.c diff --git a/src/openssl/openssl-1.1.1w/crypto/objects/obj_dat.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_dat.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/objects/obj_dat.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_dat.h diff --git a/src/openssl/openssl-1.1.1w/crypto/objects/obj_dat.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_dat.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/objects/obj_dat.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_dat.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/objects/obj_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/objects/obj_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/objects/obj_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/objects/obj_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/objects/obj_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/objects/obj_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/objects/obj_mac.num b/src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_mac.num similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/objects/obj_mac.num rename to src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_mac.num diff --git a/src/openssl/openssl-1.1.1w/crypto/objects/obj_xref.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_xref.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/objects/obj_xref.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_xref.c diff --git a/src/openssl/openssl-1.1.1w/crypto/objects/obj_xref.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_xref.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/objects/obj_xref.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_xref.h diff --git a/src/openssl/openssl-1.1.1w/crypto/objects/obj_xref.txt b/src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_xref.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/objects/obj_xref.txt rename to src/openssl/openssl-1.1.1w-chevah2/crypto/objects/obj_xref.txt diff --git a/src/openssl/openssl-1.1.1w/crypto/objects/objects.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/objects/objects.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/objects/objects.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/objects/objects.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/objects/objects.txt b/src/openssl/openssl-1.1.1w-chevah2/crypto/objects/objects.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/objects/objects.txt rename to src/openssl/openssl-1.1.1w-chevah2/crypto/objects/objects.txt diff --git a/src/openssl/openssl-1.1.1w/crypto/objects/objxref.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/objects/objxref.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/objects/objxref.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/objects/objxref.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/ocsp/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ocsp/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_asn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_asn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_asn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_asn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_cl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_cl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_cl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_cl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_ext.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_ext.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_ext.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_ext.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_ht.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_ht.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_ht.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_ht.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_prn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_prn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_prn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_prn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_srv.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_srv.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_srv.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_srv.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_vfy.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_vfy.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ocsp/ocsp_vfy.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/ocsp_vfy.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ocsp/v3_ocsp.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/v3_ocsp.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ocsp/v3_ocsp.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ocsp/v3_ocsp.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pariscid.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/pariscid.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pariscid.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pariscid.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/pem/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/pem/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pem/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pem/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/pem/pem_all.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_all.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pem/pem_all.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_all.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pem/pem_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pem/pem_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pem/pem_info.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_info.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pem/pem_info.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_info.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pem/pem_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pem/pem_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pem/pem_oth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_oth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pem/pem_oth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_oth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pem/pem_pk8.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_pk8.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pem/pem_pk8.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_pk8.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pem/pem_pkey.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_pkey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pem/pem_pkey.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_pkey.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pem/pem_sign.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_sign.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pem/pem_sign.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_sign.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pem/pem_x509.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_x509.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pem/pem_x509.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_x509.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pem/pem_xaux.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_xaux.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pem/pem_xaux.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pem_xaux.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pem/pvkfmt.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pvkfmt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pem/pvkfmt.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pem/pvkfmt.c diff --git a/src/openssl/openssl-1.1.1w/crypto/perlasm/README b/src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/README similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/perlasm/README rename to src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/README diff --git a/src/openssl/openssl-1.1.1w/crypto/perlasm/arm-xlate.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/arm-xlate.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/perlasm/arm-xlate.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/arm-xlate.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/perlasm/cbc.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/cbc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/perlasm/cbc.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/cbc.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/perlasm/ppc-xlate.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/ppc-xlate.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/perlasm/ppc-xlate.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/ppc-xlate.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/perlasm/sparcv9_modes.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/sparcv9_modes.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/perlasm/sparcv9_modes.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/sparcv9_modes.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/perlasm/x86_64-xlate.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/x86_64-xlate.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/perlasm/x86_64-xlate.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/x86_64-xlate.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/perlasm/x86asm.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/x86asm.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/perlasm/x86asm.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/x86asm.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/perlasm/x86gas.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/x86gas.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/perlasm/x86gas.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/x86gas.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/perlasm/x86masm.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/x86masm.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/perlasm/x86masm.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/x86masm.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/perlasm/x86nasm.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/x86nasm.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/perlasm/x86nasm.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/perlasm/x86nasm.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_add.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_add.c similarity index 91% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_add.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_add.c index af184c86a..39f70198f 100644 --- a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_add.c +++ b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_add.c @@ -76,6 +76,13 @@ STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7) PKCS12_R_CONTENT_TYPE_NOT_DATA); return NULL; } + + if (p7->d.data == NULL) { + PKCS12err(PKCS12_F_PKCS12_UNPACK_P7DATA, + PKCS12_R_DECODE_ERROR); + return NULL; + } + return ASN1_item_unpack(p7->d.data, ASN1_ITEM_rptr(PKCS12_SAFEBAGS)); } @@ -132,6 +139,12 @@ STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, { if (!PKCS7_type_is_encrypted(p7)) return NULL; + + if (p7->d.encrypted == NULL) { + PKCS12err(PKCS12_F_PKCS12_UNPACK_P7DATA, PKCS12_R_DECODE_ERROR); + return NULL; + } + return PKCS12_item_decrypt_d2i(p7->d.encrypted->enc_data->algorithm, ASN1_ITEM_rptr(PKCS12_SAFEBAGS), pass, passlen, @@ -159,6 +172,13 @@ STACK_OF(PKCS7) *PKCS12_unpack_authsafes(const PKCS12 *p12) PKCS12_R_CONTENT_TYPE_NOT_DATA); return NULL; } + + if (p12->authsafes->d.data == NULL) { + PKCS12err(PKCS12_F_PKCS12_UNPACK_AUTHSAFES, + PKCS12_R_DECODE_ERROR); + return NULL; + } + return ASN1_item_unpack(p12->authsafes->d.data, ASN1_ITEM_rptr(PKCS12_AUTHSAFES)); } diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_asn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_asn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_asn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_asn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_attr.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_attr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_attr.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_attr.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_crpt.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_crpt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_crpt.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_crpt.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_crt.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_crt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_crt.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_crt.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_decr.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_decr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_decr.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_decr.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_init.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_init.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_init.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_init.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_key.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_key.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_key.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_key.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_kiss.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_kiss.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_kiss.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_kiss.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_mutl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_mutl.c similarity index 98% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_mutl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_mutl.c index 3658003fe..766c9c1e9 100644 --- a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_mutl.c +++ b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_mutl.c @@ -93,6 +93,11 @@ static int pkcs12_gen_mac(PKCS12 *p12, const char *pass, int passlen, return 0; } + if (p12->authsafes->d.data == NULL) { + PKCS12err(PKCS12_F_PKCS12_GEN_MAC, PKCS12_R_DECODE_ERROR); + return 0; + } + salt = p12->mac->salt->data; saltlen = p12->mac->salt->length; if (!p12->mac->iter) diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_npas.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_npas.c similarity index 96% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_npas.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_npas.c index 0334289a8..130337638 100644 --- a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_npas.c +++ b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_npas.c @@ -78,8 +78,9 @@ static int newpass_p12(PKCS12 *p12, const char *oldpass, const char *newpass) bags = PKCS12_unpack_p7data(p7); } else if (bagnid == NID_pkcs7_encrypted) { bags = PKCS12_unpack_p7encdata(p7, oldpass, -1); - if (!alg_get(p7->d.encrypted->enc_data->algorithm, - &pbe_nid, &pbe_iter, &pbe_saltlen)) + if (p7->d.encrypted == NULL + || !alg_get(p7->d.encrypted->enc_data->algorithm, + &pbe_nid, &pbe_iter, &pbe_saltlen)) goto err; } else { continue; diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_p8d.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_p8d.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_p8d.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_p8d.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_p8e.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_p8e.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_p8e.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_p8e.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_sbag.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_sbag.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_sbag.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_sbag.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_utl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_utl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/p12_utl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/p12_utl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs12/pk12err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/pk12err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs12/pk12err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs12/pk12err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs7/bio_pk7.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/bio_pk7.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs7/bio_pk7.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/bio_pk7.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs7/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs7/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs7/pk7_asn1.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/pk7_asn1.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs7/pk7_asn1.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/pk7_asn1.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs7/pk7_attr.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/pk7_attr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs7/pk7_attr.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/pk7_attr.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs7/pk7_doit.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/pk7_doit.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs7/pk7_doit.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/pk7_doit.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs7/pk7_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/pk7_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs7/pk7_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/pk7_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs7/pk7_mime.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/pk7_mime.c similarity index 92% rename from src/openssl/openssl-1.1.1w/crypto/pkcs7/pk7_mime.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/pk7_mime.c index 19e686814..0ecfd5df8 100644 --- a/src/openssl/openssl-1.1.1w/crypto/pkcs7/pk7_mime.c +++ b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/pk7_mime.c @@ -30,10 +30,13 @@ int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags) { STACK_OF(X509_ALGOR) *mdalgs; int ctype_nid = OBJ_obj2nid(p7->type); - if (ctype_nid == NID_pkcs7_signed) + if (ctype_nid == NID_pkcs7_signed) { + if (p7->d.sign == NULL) + return 0; mdalgs = p7->d.sign->md_algs; - else + } else { mdalgs = NULL; + } flags ^= SMIME_OLDMIME; diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs7/pk7_smime.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/pk7_smime.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs7/pk7_smime.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/pk7_smime.c diff --git a/src/openssl/openssl-1.1.1w/crypto/pkcs7/pkcs7err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/pkcs7err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/pkcs7/pkcs7err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/pkcs7/pkcs7err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-armv4.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-armv4.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-armv4.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-armv4.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-armv8.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-armv8.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-armv8.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-armv8.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-c64xplus.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-c64xplus.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-c64xplus.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-c64xplus.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-mips.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-mips.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-mips.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-mips.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-ppc.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-ppc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-ppc.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-ppc.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-ppcfp.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-ppcfp.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-ppcfp.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-ppcfp.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-s390x.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-s390x.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-s390x.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-s390x.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-sparcv9.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-sparcv9.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-sparcv9.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-sparcv9.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-x86.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-x86.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-x86.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-x86.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/poly1305/asm/poly1305-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/asm/poly1305-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/poly1305/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/poly1305/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/poly1305/poly1305.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/poly1305.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/poly1305/poly1305.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/poly1305.c diff --git a/src/openssl/openssl-1.1.1w/crypto/poly1305/poly1305_ameth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/poly1305_ameth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/poly1305/poly1305_ameth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/poly1305_ameth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/poly1305/poly1305_base2_44.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/poly1305_base2_44.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/poly1305/poly1305_base2_44.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/poly1305_base2_44.c diff --git a/src/openssl/openssl-1.1.1w/crypto/poly1305/poly1305_ieee754.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/poly1305_ieee754.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/poly1305/poly1305_ieee754.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/poly1305_ieee754.c diff --git a/src/openssl/openssl-1.1.1w/crypto/poly1305/poly1305_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/poly1305_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/poly1305/poly1305_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/poly1305_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/poly1305/poly1305_pmeth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/poly1305_pmeth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/poly1305/poly1305_pmeth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/poly1305/poly1305_pmeth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ppc_arch.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/ppc_arch.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ppc_arch.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ppc_arch.h diff --git a/src/openssl/openssl-1.1.1w/crypto/ppccap.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ppccap.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ppccap.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ppccap.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ppccpuid.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/ppccpuid.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ppccpuid.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ppccpuid.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/rand/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/rand/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rand/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rand/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/rand/drbg_ctr.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rand/drbg_ctr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rand/drbg_ctr.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rand/drbg_ctr.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rand/drbg_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rand/drbg_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rand/drbg_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rand/drbg_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rand/rand_egd.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rand/rand_egd.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rand/rand_egd.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rand/rand_egd.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rand/rand_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rand/rand_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rand/rand_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rand/rand_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rand/rand_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rand/rand_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rand/rand_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rand/rand_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rand/rand_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/rand/rand_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rand/rand_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rand/rand_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/rand/rand_unix.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rand/rand_unix.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rand/rand_unix.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rand/rand_unix.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rand/rand_vms.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rand/rand_vms.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rand/rand_vms.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rand/rand_vms.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rand/rand_win.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rand/rand_win.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rand/rand_win.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rand/rand_win.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rand/randfile.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rand/randfile.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rand/randfile.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rand/randfile.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rc2/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc2/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc2/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc2/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/rc2/rc2_cbc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc2/rc2_cbc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc2/rc2_cbc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc2/rc2_cbc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rc2/rc2_ecb.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc2/rc2_ecb.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc2/rc2_ecb.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc2/rc2_ecb.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rc2/rc2_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc2/rc2_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc2/rc2_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc2/rc2_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/rc2/rc2_skey.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc2/rc2_skey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc2/rc2_skey.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc2/rc2_skey.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rc2/rc2cfb64.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc2/rc2cfb64.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc2/rc2cfb64.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc2/rc2cfb64.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rc2/rc2ofb64.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc2/rc2ofb64.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc2/rc2ofb64.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc2/rc2ofb64.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rc4/asm/rc4-586.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/asm/rc4-586.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc4/asm/rc4-586.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/asm/rc4-586.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/rc4/asm/rc4-c64xplus.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/asm/rc4-c64xplus.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc4/asm/rc4-c64xplus.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/asm/rc4-c64xplus.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/rc4/asm/rc4-md5-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/asm/rc4-md5-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc4/asm/rc4-md5-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/asm/rc4-md5-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/rc4/asm/rc4-parisc.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/asm/rc4-parisc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc4/asm/rc4-parisc.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/asm/rc4-parisc.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/rc4/asm/rc4-s390x.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/asm/rc4-s390x.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc4/asm/rc4-s390x.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/asm/rc4-s390x.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/rc4/asm/rc4-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/asm/rc4-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc4/asm/rc4-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/asm/rc4-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/rc4/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc4/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/rc4/rc4_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/rc4_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc4/rc4_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/rc4_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rc4/rc4_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/rc4_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc4/rc4_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/rc4_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/rc4/rc4_skey.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/rc4_skey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc4/rc4_skey.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc4/rc4_skey.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rc5/asm/rc5-586.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc5/asm/rc5-586.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc5/asm/rc5-586.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc5/asm/rc5-586.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/rc5/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc5/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc5/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc5/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/rc5/rc5_ecb.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc5/rc5_ecb.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc5/rc5_ecb.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc5/rc5_ecb.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rc5/rc5_enc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc5/rc5_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc5/rc5_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc5/rc5_enc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rc5/rc5_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc5/rc5_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc5/rc5_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc5/rc5_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/rc5/rc5_skey.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc5/rc5_skey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc5/rc5_skey.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc5/rc5_skey.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rc5/rc5cfb64.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc5/rc5cfb64.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc5/rc5cfb64.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc5/rc5cfb64.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rc5/rc5ofb64.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rc5/rc5ofb64.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rc5/rc5ofb64.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rc5/rc5ofb64.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ripemd/asm/rmd-586.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/ripemd/asm/rmd-586.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ripemd/asm/rmd-586.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ripemd/asm/rmd-586.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/ripemd/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/ripemd/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ripemd/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ripemd/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/ripemd/rmd_dgst.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ripemd/rmd_dgst.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ripemd/rmd_dgst.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ripemd/rmd_dgst.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ripemd/rmd_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/ripemd/rmd_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ripemd/rmd_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ripemd/rmd_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/ripemd/rmd_one.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ripemd/rmd_one.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ripemd/rmd_one.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ripemd/rmd_one.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ripemd/rmdconst.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/ripemd/rmdconst.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ripemd/rmdconst.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ripemd/rmdconst.h diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_ameth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_ameth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_ameth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_ameth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_asn1.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_asn1.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_asn1.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_asn1.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_chk.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_chk.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_chk.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_chk.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_crpt.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_crpt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_crpt.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_crpt.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_depr.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_depr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_depr.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_depr.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_gen.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_gen.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_gen.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_gen.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_meth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_meth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_meth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_meth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_mp.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_mp.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_mp.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_mp.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_none.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_none.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_none.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_none.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_oaep.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_oaep.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_oaep.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_oaep.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_ossl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_ossl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_ossl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_ossl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_pk1.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_pk1.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_pk1.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_pk1.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_pmeth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_pmeth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_pmeth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_pmeth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_prn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_prn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_prn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_prn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_pss.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_pss.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_pss.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_pss.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_saos.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_saos.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_saos.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_saos.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_sign.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_sign.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_sign.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_sign.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_ssl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_ssl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_ssl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_ssl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_x931.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_x931.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_x931.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_x931.c diff --git a/src/openssl/openssl-1.1.1w/crypto/rsa/rsa_x931g.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_x931g.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/rsa/rsa_x931g.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/rsa/rsa_x931g.c diff --git a/src/openssl/openssl-1.1.1w/crypto/s390x_arch.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/s390x_arch.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/s390x_arch.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/s390x_arch.h diff --git a/src/openssl/openssl-1.1.1w/crypto/s390xcap.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/s390xcap.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/s390xcap.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/s390xcap.c diff --git a/src/openssl/openssl-1.1.1w/crypto/s390xcpuid.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/s390xcpuid.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/s390xcpuid.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/s390xcpuid.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/seed/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/seed/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/seed/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/seed/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/seed/seed.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/seed/seed.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/seed/seed.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/seed/seed.c diff --git a/src/openssl/openssl-1.1.1w/crypto/seed/seed_cbc.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/seed/seed_cbc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/seed/seed_cbc.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/seed/seed_cbc.c diff --git a/src/openssl/openssl-1.1.1w/crypto/seed/seed_cfb.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/seed/seed_cfb.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/seed/seed_cfb.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/seed/seed_cfb.c diff --git a/src/openssl/openssl-1.1.1w/crypto/seed/seed_ecb.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/seed/seed_ecb.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/seed/seed_ecb.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/seed/seed_ecb.c diff --git a/src/openssl/openssl-1.1.1w/crypto/seed/seed_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/seed/seed_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/seed/seed_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/seed/seed_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/seed/seed_ofb.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/seed/seed_ofb.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/seed/seed_ofb.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/seed/seed_ofb.c diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-armv4.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-armv4.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-armv4.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-armv4.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-armv8.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-armv8.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-armv8.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-armv8.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-avx2.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-avx2.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-avx2.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-avx2.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-avx512.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-avx512.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-avx512.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-avx512.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-avx512vl.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-avx512vl.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-avx512vl.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-avx512vl.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-c64x.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-c64x.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-c64x.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-c64x.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-mmx.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-mmx.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-mmx.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-mmx.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-ppc64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-ppc64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-ppc64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-ppc64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-s390x.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-s390x.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-s390x.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-s390x.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600p8-ppc.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600p8-ppc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/keccak1600p8-ppc.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/keccak1600p8-ppc.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-586.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-586.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-586.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-586.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-alpha.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-alpha.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-alpha.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-alpha.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-armv4-large.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-armv4-large.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-armv4-large.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-armv4-large.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-armv8.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-armv8.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-armv8.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-armv8.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-c64xplus.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-c64xplus.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-c64xplus.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-c64xplus.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-ia64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-ia64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-ia64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-ia64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-mb-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-mb-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-mb-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-mb-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-mips.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-mips.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-mips.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-mips.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-parisc.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-parisc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-parisc.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-parisc.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-ppc.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-ppc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-ppc.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-ppc.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-s390x.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-s390x.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-s390x.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-s390x.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-sparcv9.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-sparcv9.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-sparcv9.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-sparcv9.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-sparcv9a.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-sparcv9a.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-sparcv9a.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-sparcv9a.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-thumb.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-thumb.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-thumb.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-thumb.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha1-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha1-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha256-586.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha256-586.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha256-586.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha256-586.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha256-armv4.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha256-armv4.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha256-armv4.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha256-armv4.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha256-c64xplus.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha256-c64xplus.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha256-c64xplus.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha256-c64xplus.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha256-mb-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha256-mb-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha256-mb-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha256-mb-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-586.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-586.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-586.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-586.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-armv4.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-armv4.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-armv4.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-armv4.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-armv8.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-armv8.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-armv8.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-armv8.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-c64xplus.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-c64xplus.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-c64xplus.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-c64xplus.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-ia64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-ia64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-ia64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-ia64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-mips.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-mips.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-mips.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-mips.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-parisc.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-parisc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-parisc.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-parisc.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-ppc.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-ppc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-ppc.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-ppc.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-s390x.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-s390x.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-s390x.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-s390x.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-sparcv9.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-sparcv9.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-sparcv9.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-sparcv9.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512p8-ppc.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512p8-ppc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/asm/sha512p8-ppc.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/asm/sha512p8-ppc.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/keccak1600.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/keccak1600.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/keccak1600.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/keccak1600.c diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/sha1_one.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/sha1_one.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/sha1_one.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/sha1_one.c diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/sha1dgst.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/sha1dgst.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/sha1dgst.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/sha1dgst.c diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/sha256.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/sha256.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/sha256.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/sha256.c diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/sha512.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/sha512.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/sha512.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/sha512.c diff --git a/src/openssl/openssl-1.1.1w/crypto/sha/sha_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/sha/sha_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sha/sha_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sha/sha_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/siphash/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/siphash/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/siphash/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/siphash/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/siphash/siphash.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/siphash/siphash.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/siphash/siphash.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/siphash/siphash.c diff --git a/src/openssl/openssl-1.1.1w/crypto/siphash/siphash_ameth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/siphash/siphash_ameth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/siphash/siphash_ameth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/siphash/siphash_ameth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/siphash/siphash_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/siphash/siphash_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/siphash/siphash_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/siphash/siphash_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/siphash/siphash_pmeth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/siphash/siphash_pmeth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/siphash/siphash_pmeth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/siphash/siphash_pmeth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/sm2/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/sm2/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sm2/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sm2/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/sm2/sm2_crypt.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/sm2/sm2_crypt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sm2/sm2_crypt.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sm2/sm2_crypt.c diff --git a/src/openssl/openssl-1.1.1w/crypto/sm2/sm2_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/sm2/sm2_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sm2/sm2_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sm2/sm2_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/sm2/sm2_pmeth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/sm2/sm2_pmeth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sm2/sm2_pmeth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sm2/sm2_pmeth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/sm2/sm2_sign.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/sm2/sm2_sign.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sm2/sm2_sign.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sm2/sm2_sign.c diff --git a/src/openssl/openssl-1.1.1w/crypto/sm3/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/sm3/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sm3/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sm3/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/sm3/m_sm3.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/sm3/m_sm3.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sm3/m_sm3.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sm3/m_sm3.c diff --git a/src/openssl/openssl-1.1.1w/crypto/sm3/sm3.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/sm3/sm3.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sm3/sm3.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sm3/sm3.c diff --git a/src/openssl/openssl-1.1.1w/crypto/sm3/sm3_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/sm3/sm3_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sm3/sm3_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sm3/sm3_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/sm4/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/sm4/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sm4/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sm4/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/sm4/sm4.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/sm4/sm4.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sm4/sm4.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sm4/sm4.c diff --git a/src/openssl/openssl-1.1.1w/crypto/sparc_arch.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/sparc_arch.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sparc_arch.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sparc_arch.h diff --git a/src/openssl/openssl-1.1.1w/crypto/sparccpuid.S b/src/openssl/openssl-1.1.1w-chevah2/crypto/sparccpuid.S similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sparccpuid.S rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sparccpuid.S diff --git a/src/openssl/openssl-1.1.1w/crypto/sparcv9cap.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/sparcv9cap.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/sparcv9cap.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/sparcv9cap.c diff --git a/src/openssl/openssl-1.1.1w/crypto/srp/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/srp/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/srp/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/srp/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/srp/srp_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/srp/srp_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/srp/srp_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/srp/srp_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/srp/srp_vfy.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/srp/srp_vfy.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/srp/srp_vfy.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/srp/srp_vfy.c diff --git a/src/openssl/openssl-1.1.1w/crypto/stack/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/stack/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/stack/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/stack/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/stack/stack.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/stack/stack.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/stack/stack.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/stack/stack.c diff --git a/src/openssl/openssl-1.1.1w/crypto/store/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/store/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/store/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/store/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/store/loader_file.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/store/loader_file.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/store/loader_file.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/store/loader_file.c diff --git a/src/openssl/openssl-1.1.1w/crypto/store/store_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/store/store_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/store/store_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/store/store_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/store/store_init.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/store/store_init.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/store/store_init.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/store/store_init.c diff --git a/src/openssl/openssl-1.1.1w/crypto/store/store_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/store/store_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/store/store_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/store/store_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/store/store_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/store/store_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/store/store_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/store/store_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/store/store_register.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/store/store_register.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/store/store_register.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/store/store_register.c diff --git a/src/openssl/openssl-1.1.1w/crypto/store/store_strings.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/store/store_strings.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/store/store_strings.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/store/store_strings.c diff --git a/src/openssl/openssl-1.1.1w/crypto/threads_none.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/threads_none.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/threads_none.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/threads_none.c diff --git a/src/openssl/openssl-1.1.1w/crypto/threads_pthread.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/threads_pthread.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/threads_pthread.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/threads_pthread.c diff --git a/src/openssl/openssl-1.1.1w/crypto/threads_win.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/threads_win.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/threads_win.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/threads_win.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ts/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/ts/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ts/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ts/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/ts/ts_asn1.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_asn1.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ts/ts_asn1.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_asn1.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ts/ts_conf.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_conf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ts/ts_conf.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_conf.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ts/ts_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ts/ts_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ts/ts_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ts/ts_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ts/ts_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ts/ts_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/ts/ts_req_print.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_req_print.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ts/ts_req_print.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_req_print.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ts/ts_req_utils.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_req_utils.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ts/ts_req_utils.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_req_utils.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ts/ts_rsp_print.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_rsp_print.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ts/ts_rsp_print.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_rsp_print.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ts/ts_rsp_sign.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_rsp_sign.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ts/ts_rsp_sign.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_rsp_sign.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ts/ts_rsp_utils.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_rsp_utils.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ts/ts_rsp_utils.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_rsp_utils.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ts/ts_rsp_verify.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_rsp_verify.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ts/ts_rsp_verify.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_rsp_verify.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ts/ts_verify_ctx.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_verify_ctx.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ts/ts_verify_ctx.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ts/ts_verify_ctx.c diff --git a/src/openssl/openssl-1.1.1w/crypto/txt_db/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/txt_db/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/txt_db/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/txt_db/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/txt_db/txt_db.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/txt_db/txt_db.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/txt_db/txt_db.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/txt_db/txt_db.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ui/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/ui/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ui/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ui/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/ui/ui_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ui/ui_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ui/ui_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ui/ui_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ui/ui_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ui/ui_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ui/ui_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ui/ui_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ui/ui_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/ui/ui_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ui/ui_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ui/ui_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/ui/ui_null.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ui/ui_null.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ui/ui_null.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ui/ui_null.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ui/ui_openssl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ui/ui_openssl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ui/ui_openssl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ui/ui_openssl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/ui/ui_util.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/ui/ui_util.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/ui/ui_util.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/ui/ui_util.c diff --git a/src/openssl/openssl-1.1.1w/crypto/uid.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/uid.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/uid.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/uid.c diff --git a/src/openssl/openssl-1.1.1w/crypto/vms_rms.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/vms_rms.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/vms_rms.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/vms_rms.h diff --git a/src/openssl/openssl-1.1.1w/crypto/whrlpool/asm/wp-mmx.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/whrlpool/asm/wp-mmx.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/whrlpool/asm/wp-mmx.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/whrlpool/asm/wp-mmx.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/whrlpool/asm/wp-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/whrlpool/asm/wp-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/whrlpool/asm/wp-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/whrlpool/asm/wp-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/whrlpool/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/whrlpool/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/whrlpool/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/whrlpool/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/whrlpool/wp_block.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/whrlpool/wp_block.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/whrlpool/wp_block.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/whrlpool/wp_block.c diff --git a/src/openssl/openssl-1.1.1w/crypto/whrlpool/wp_dgst.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/whrlpool/wp_dgst.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/whrlpool/wp_dgst.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/whrlpool/wp_dgst.c diff --git a/src/openssl/openssl-1.1.1w/crypto/whrlpool/wp_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/whrlpool/wp_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/whrlpool/wp_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/whrlpool/wp_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/by_dir.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/by_dir.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/by_dir.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/by_dir.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/by_file.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/by_file.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/by_file.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/by_file.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/t_crl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/t_crl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/t_crl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/t_crl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/t_req.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/t_req.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/t_req.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/t_req.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/t_x509.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/t_x509.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/t_x509.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/t_x509.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_att.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_att.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_att.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_att.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_cmp.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_cmp.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_cmp.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_cmp.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_d2.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_d2.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_d2.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_d2.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_def.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_def.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_def.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_def.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_ext.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_ext.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_ext.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_ext.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_lu.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_lu.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_lu.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_lu.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_meth.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_meth.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_meth.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_meth.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_obj.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_obj.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_obj.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_obj.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_r2x.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_r2x.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_r2x.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_r2x.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_req.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_req.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_req.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_req.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_set.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_set.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_set.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_set.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_trs.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_trs.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_trs.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_trs.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_txt.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_txt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_txt.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_txt.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_v3.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_v3.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_v3.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_v3.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_vfy.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_vfy.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_vfy.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_vfy.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509_vpm.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_vpm.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509_vpm.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509_vpm.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509cset.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509cset.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509cset.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509cset.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509name.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509name.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509name.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509name.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509rset.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509rset.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509rset.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509rset.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509spki.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509spki.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509spki.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509spki.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x509type.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509type.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x509type.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x509type.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x_all.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_all.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x_all.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_all.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x_attrib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_attrib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x_attrib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_attrib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x_crl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_crl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x_crl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_crl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x_exten.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_exten.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x_exten.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_exten.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x_name.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_name.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x_name.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_name.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x_pubkey.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_pubkey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x_pubkey.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_pubkey.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x_req.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_req.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x_req.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_req.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x_x509.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_x509.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x_x509.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_x509.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509/x_x509a.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_x509a.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509/x_x509a.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509/x_x509a.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/build.info b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/build.info rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/build.info diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/ext_dat.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/ext_dat.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/ext_dat.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/ext_dat.h diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/pcy_cache.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/pcy_cache.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/pcy_cache.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/pcy_cache.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/pcy_data.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/pcy_data.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/pcy_data.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/pcy_data.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/pcy_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/pcy_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/pcy_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/pcy_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/pcy_local.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/pcy_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/pcy_local.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/pcy_local.h diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/pcy_map.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/pcy_map.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/pcy_map.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/pcy_map.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/pcy_node.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/pcy_node.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/pcy_node.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/pcy_node.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/pcy_tree.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/pcy_tree.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/pcy_tree.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/pcy_tree.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/standard_exts.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/standard_exts.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/standard_exts.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/standard_exts.h diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_addr.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_addr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_addr.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_addr.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_admis.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_admis.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_admis.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_admis.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_admis.h b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_admis.h similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_admis.h rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_admis.h diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_akey.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_akey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_akey.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_akey.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_akeya.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_akeya.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_akeya.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_akeya.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_alt.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_alt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_alt.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_alt.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_asid.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_asid.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_asid.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_asid.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_bcons.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_bcons.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_bcons.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_bcons.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_bitst.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_bitst.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_bitst.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_bitst.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_conf.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_conf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_conf.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_conf.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_cpols.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_cpols.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_cpols.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_cpols.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_crld.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_crld.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_crld.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_crld.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_enum.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_enum.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_enum.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_enum.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_extku.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_extku.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_extku.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_extku.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_genn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_genn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_genn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_genn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_ia5.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_ia5.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_ia5.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_ia5.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_info.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_info.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_info.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_info.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_int.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_int.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_int.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_int.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_lib.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_lib.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_ncons.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_ncons.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_ncons.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_ncons.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_pci.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_pci.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_pci.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_pci.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_pcia.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_pcia.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_pcia.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_pcia.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_pcons.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_pcons.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_pcons.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_pcons.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_pku.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_pku.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_pku.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_pku.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_pmaps.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_pmaps.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_pmaps.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_pmaps.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_prn.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_prn.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_prn.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_prn.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_purp.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_purp.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_purp.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_purp.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_skey.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_skey.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_skey.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_skey.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_sxnet.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_sxnet.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_sxnet.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_sxnet.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_tlsf.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_tlsf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_tlsf.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_tlsf.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3_utl.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_utl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3_utl.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3_utl.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x509v3/v3err.c b/src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x509v3/v3err.c rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x509v3/v3err.c diff --git a/src/openssl/openssl-1.1.1w/crypto/x86_64cpuid.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/x86_64cpuid.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x86_64cpuid.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x86_64cpuid.pl diff --git a/src/openssl/openssl-1.1.1w/crypto/x86cpuid.pl b/src/openssl/openssl-1.1.1w-chevah2/crypto/x86cpuid.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/crypto/x86cpuid.pl rename to src/openssl/openssl-1.1.1w-chevah2/crypto/x86cpuid.pl diff --git a/src/openssl/openssl-1.1.1w/demos/README b/src/openssl/openssl-1.1.1w-chevah2/demos/README similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/README rename to src/openssl/openssl-1.1.1w-chevah2/demos/README diff --git a/src/openssl/openssl-1.1.1w/demos/bio/Makefile b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/Makefile similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/Makefile rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/Makefile diff --git a/src/openssl/openssl-1.1.1w/demos/bio/README b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/README similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/README rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/README diff --git a/src/openssl/openssl-1.1.1w/demos/bio/accept.cnf b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/accept.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/accept.cnf rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/accept.cnf diff --git a/src/openssl/openssl-1.1.1w/demos/bio/client-arg.c b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/client-arg.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/client-arg.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/client-arg.c diff --git a/src/openssl/openssl-1.1.1w/demos/bio/client-conf.c b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/client-conf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/client-conf.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/client-conf.c diff --git a/src/openssl/openssl-1.1.1w/demos/bio/cmod.cnf b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/cmod.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/cmod.cnf rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/cmod.cnf diff --git a/src/openssl/openssl-1.1.1w/demos/bio/connect.cnf b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/connect.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/connect.cnf rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/connect.cnf diff --git a/src/openssl/openssl-1.1.1w/demos/bio/descrip.mms b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/descrip.mms similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/descrip.mms rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/descrip.mms diff --git a/src/openssl/openssl-1.1.1w/demos/bio/intca.pem b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/intca.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/intca.pem rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/intca.pem diff --git a/src/openssl/openssl-1.1.1w/demos/bio/root.pem b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/root.pem rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/root.pem diff --git a/src/openssl/openssl-1.1.1w/demos/bio/saccept.c b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/saccept.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/saccept.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/saccept.c diff --git a/src/openssl/openssl-1.1.1w/demos/bio/sconnect.c b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/sconnect.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/sconnect.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/sconnect.c diff --git a/src/openssl/openssl-1.1.1w/demos/bio/server-arg.c b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/server-arg.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/server-arg.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/server-arg.c diff --git a/src/openssl/openssl-1.1.1w/demos/bio/server-cmod.c b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/server-cmod.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/server-cmod.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/server-cmod.c diff --git a/src/openssl/openssl-1.1.1w/demos/bio/server-conf.c b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/server-conf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/server-conf.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/server-conf.c diff --git a/src/openssl/openssl-1.1.1w/demos/bio/server-ec.pem b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/server-ec.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/server-ec.pem rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/server-ec.pem diff --git a/src/openssl/openssl-1.1.1w/demos/bio/server.pem b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/server.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/server.pem rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/server.pem diff --git a/src/openssl/openssl-1.1.1w/demos/bio/shared.opt b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/shared.opt similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/shared.opt rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/shared.opt diff --git a/src/openssl/openssl-1.1.1w/demos/bio/static.opt b/src/openssl/openssl-1.1.1w-chevah2/demos/bio/static.opt similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/bio/static.opt rename to src/openssl/openssl-1.1.1w-chevah2/demos/bio/static.opt diff --git a/src/openssl/openssl-1.1.1w/demos/certs/README b/src/openssl/openssl-1.1.1w-chevah2/demos/certs/README similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/certs/README rename to src/openssl/openssl-1.1.1w-chevah2/demos/certs/README diff --git a/src/openssl/openssl-1.1.1w/demos/certs/apps/apps.cnf b/src/openssl/openssl-1.1.1w-chevah2/demos/certs/apps/apps.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/certs/apps/apps.cnf rename to src/openssl/openssl-1.1.1w-chevah2/demos/certs/apps/apps.cnf diff --git a/src/openssl/openssl-1.1.1w/demos/certs/apps/ckey.pem b/src/openssl/openssl-1.1.1w-chevah2/demos/certs/apps/ckey.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/certs/apps/ckey.pem rename to src/openssl/openssl-1.1.1w-chevah2/demos/certs/apps/ckey.pem diff --git a/src/openssl/openssl-1.1.1w/demos/certs/apps/intkey.pem b/src/openssl/openssl-1.1.1w-chevah2/demos/certs/apps/intkey.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/certs/apps/intkey.pem rename to src/openssl/openssl-1.1.1w-chevah2/demos/certs/apps/intkey.pem diff --git a/src/openssl/openssl-1.1.1w/demos/certs/apps/mkacerts.sh b/src/openssl/openssl-1.1.1w-chevah2/demos/certs/apps/mkacerts.sh similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/certs/apps/mkacerts.sh rename to src/openssl/openssl-1.1.1w-chevah2/demos/certs/apps/mkacerts.sh diff --git a/src/openssl/openssl-1.1.1w/demos/certs/apps/mkxcerts.sh b/src/openssl/openssl-1.1.1w-chevah2/demos/certs/apps/mkxcerts.sh similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/certs/apps/mkxcerts.sh rename to src/openssl/openssl-1.1.1w-chevah2/demos/certs/apps/mkxcerts.sh diff --git a/src/openssl/openssl-1.1.1w/demos/certs/apps/rootkey.pem b/src/openssl/openssl-1.1.1w-chevah2/demos/certs/apps/rootkey.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/certs/apps/rootkey.pem rename to src/openssl/openssl-1.1.1w-chevah2/demos/certs/apps/rootkey.pem diff --git a/src/openssl/openssl-1.1.1w/demos/certs/apps/skey.pem b/src/openssl/openssl-1.1.1w-chevah2/demos/certs/apps/skey.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/certs/apps/skey.pem rename to src/openssl/openssl-1.1.1w-chevah2/demos/certs/apps/skey.pem diff --git a/src/openssl/openssl-1.1.1w/demos/certs/apps/skey2.pem b/src/openssl/openssl-1.1.1w-chevah2/demos/certs/apps/skey2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/certs/apps/skey2.pem rename to src/openssl/openssl-1.1.1w-chevah2/demos/certs/apps/skey2.pem diff --git a/src/openssl/openssl-1.1.1w/demos/certs/ca.cnf b/src/openssl/openssl-1.1.1w-chevah2/demos/certs/ca.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/certs/ca.cnf rename to src/openssl/openssl-1.1.1w-chevah2/demos/certs/ca.cnf diff --git a/src/openssl/openssl-1.1.1w/demos/certs/mkcerts.sh b/src/openssl/openssl-1.1.1w-chevah2/demos/certs/mkcerts.sh similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/certs/mkcerts.sh rename to src/openssl/openssl-1.1.1w-chevah2/demos/certs/mkcerts.sh diff --git a/src/openssl/openssl-1.1.1w/demos/certs/ocspquery.sh b/src/openssl/openssl-1.1.1w-chevah2/demos/certs/ocspquery.sh similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/certs/ocspquery.sh rename to src/openssl/openssl-1.1.1w-chevah2/demos/certs/ocspquery.sh diff --git a/src/openssl/openssl-1.1.1w/demos/certs/ocsprun.sh b/src/openssl/openssl-1.1.1w-chevah2/demos/certs/ocsprun.sh similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/certs/ocsprun.sh rename to src/openssl/openssl-1.1.1w-chevah2/demos/certs/ocsprun.sh diff --git a/src/openssl/openssl-1.1.1w/demos/cms/cacert.pem b/src/openssl/openssl-1.1.1w-chevah2/demos/cms/cacert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/cms/cacert.pem rename to src/openssl/openssl-1.1.1w-chevah2/demos/cms/cacert.pem diff --git a/src/openssl/openssl-1.1.1w/demos/cms/cakey.pem b/src/openssl/openssl-1.1.1w-chevah2/demos/cms/cakey.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/cms/cakey.pem rename to src/openssl/openssl-1.1.1w-chevah2/demos/cms/cakey.pem diff --git a/src/openssl/openssl-1.1.1w/demos/cms/cms_comp.c b/src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_comp.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/cms/cms_comp.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_comp.c diff --git a/src/openssl/openssl-1.1.1w/demos/cms/cms_ddec.c b/src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_ddec.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/cms/cms_ddec.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_ddec.c diff --git a/src/openssl/openssl-1.1.1w/demos/cms/cms_dec.c b/src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_dec.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/cms/cms_dec.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_dec.c diff --git a/src/openssl/openssl-1.1.1w/demos/cms/cms_denc.c b/src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_denc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/cms/cms_denc.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_denc.c diff --git a/src/openssl/openssl-1.1.1w/demos/cms/cms_enc.c b/src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/cms/cms_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_enc.c diff --git a/src/openssl/openssl-1.1.1w/demos/cms/cms_sign.c b/src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_sign.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/cms/cms_sign.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_sign.c diff --git a/src/openssl/openssl-1.1.1w/demos/cms/cms_sign2.c b/src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_sign2.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/cms/cms_sign2.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_sign2.c diff --git a/src/openssl/openssl-1.1.1w/demos/cms/cms_uncomp.c b/src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_uncomp.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/cms/cms_uncomp.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_uncomp.c diff --git a/src/openssl/openssl-1.1.1w/demos/cms/cms_ver.c b/src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_ver.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/cms/cms_ver.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/cms/cms_ver.c diff --git a/src/openssl/openssl-1.1.1w/demos/cms/comp.txt b/src/openssl/openssl-1.1.1w-chevah2/demos/cms/comp.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/cms/comp.txt rename to src/openssl/openssl-1.1.1w-chevah2/demos/cms/comp.txt diff --git a/src/openssl/openssl-1.1.1w/demos/cms/encr.txt b/src/openssl/openssl-1.1.1w-chevah2/demos/cms/encr.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/cms/encr.txt rename to src/openssl/openssl-1.1.1w-chevah2/demos/cms/encr.txt diff --git a/src/openssl/openssl-1.1.1w/demos/cms/sign.txt b/src/openssl/openssl-1.1.1w-chevah2/demos/cms/sign.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/cms/sign.txt rename to src/openssl/openssl-1.1.1w-chevah2/demos/cms/sign.txt diff --git a/src/openssl/openssl-1.1.1w/demos/cms/signer.pem b/src/openssl/openssl-1.1.1w-chevah2/demos/cms/signer.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/cms/signer.pem rename to src/openssl/openssl-1.1.1w-chevah2/demos/cms/signer.pem diff --git a/src/openssl/openssl-1.1.1w/demos/cms/signer2.pem b/src/openssl/openssl-1.1.1w-chevah2/demos/cms/signer2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/cms/signer2.pem rename to src/openssl/openssl-1.1.1w-chevah2/demos/cms/signer2.pem diff --git a/src/openssl/openssl-1.1.1w/demos/engines/e_chil.txt b/src/openssl/openssl-1.1.1w-chevah2/demos/engines/e_chil.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/engines/e_chil.txt rename to src/openssl/openssl-1.1.1w-chevah2/demos/engines/e_chil.txt diff --git a/src/openssl/openssl-1.1.1w/demos/evp/Makefile b/src/openssl/openssl-1.1.1w-chevah2/demos/evp/Makefile similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/evp/Makefile rename to src/openssl/openssl-1.1.1w-chevah2/demos/evp/Makefile diff --git a/src/openssl/openssl-1.1.1w/demos/evp/aesccm.c b/src/openssl/openssl-1.1.1w-chevah2/demos/evp/aesccm.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/evp/aesccm.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/evp/aesccm.c diff --git a/src/openssl/openssl-1.1.1w/demos/evp/aesgcm.c b/src/openssl/openssl-1.1.1w-chevah2/demos/evp/aesgcm.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/evp/aesgcm.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/evp/aesgcm.c diff --git a/src/openssl/openssl-1.1.1w/demos/pkcs12/pkread.c b/src/openssl/openssl-1.1.1w-chevah2/demos/pkcs12/pkread.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/pkcs12/pkread.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/pkcs12/pkread.c diff --git a/src/openssl/openssl-1.1.1w/demos/pkcs12/pkwrite.c b/src/openssl/openssl-1.1.1w-chevah2/demos/pkcs12/pkwrite.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/pkcs12/pkwrite.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/pkcs12/pkwrite.c diff --git a/src/openssl/openssl-1.1.1w/demos/smime/cacert.pem b/src/openssl/openssl-1.1.1w-chevah2/demos/smime/cacert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/smime/cacert.pem rename to src/openssl/openssl-1.1.1w-chevah2/demos/smime/cacert.pem diff --git a/src/openssl/openssl-1.1.1w/demos/smime/cakey.pem b/src/openssl/openssl-1.1.1w-chevah2/demos/smime/cakey.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/smime/cakey.pem rename to src/openssl/openssl-1.1.1w-chevah2/demos/smime/cakey.pem diff --git a/src/openssl/openssl-1.1.1w/demos/smime/encr.txt b/src/openssl/openssl-1.1.1w-chevah2/demos/smime/encr.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/smime/encr.txt rename to src/openssl/openssl-1.1.1w-chevah2/demos/smime/encr.txt diff --git a/src/openssl/openssl-1.1.1w/demos/smime/sign.txt b/src/openssl/openssl-1.1.1w-chevah2/demos/smime/sign.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/smime/sign.txt rename to src/openssl/openssl-1.1.1w-chevah2/demos/smime/sign.txt diff --git a/src/openssl/openssl-1.1.1w/demos/smime/signer.pem b/src/openssl/openssl-1.1.1w-chevah2/demos/smime/signer.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/smime/signer.pem rename to src/openssl/openssl-1.1.1w-chevah2/demos/smime/signer.pem diff --git a/src/openssl/openssl-1.1.1w/demos/smime/signer2.pem b/src/openssl/openssl-1.1.1w-chevah2/demos/smime/signer2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/smime/signer2.pem rename to src/openssl/openssl-1.1.1w-chevah2/demos/smime/signer2.pem diff --git a/src/openssl/openssl-1.1.1w/demos/smime/smdec.c b/src/openssl/openssl-1.1.1w-chevah2/demos/smime/smdec.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/smime/smdec.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/smime/smdec.c diff --git a/src/openssl/openssl-1.1.1w/demos/smime/smenc.c b/src/openssl/openssl-1.1.1w-chevah2/demos/smime/smenc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/smime/smenc.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/smime/smenc.c diff --git a/src/openssl/openssl-1.1.1w/demos/smime/smsign.c b/src/openssl/openssl-1.1.1w-chevah2/demos/smime/smsign.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/smime/smsign.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/smime/smsign.c diff --git a/src/openssl/openssl-1.1.1w/demos/smime/smsign2.c b/src/openssl/openssl-1.1.1w-chevah2/demos/smime/smsign2.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/smime/smsign2.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/smime/smsign2.c diff --git a/src/openssl/openssl-1.1.1w/demos/smime/smver.c b/src/openssl/openssl-1.1.1w-chevah2/demos/smime/smver.c similarity index 100% rename from src/openssl/openssl-1.1.1w/demos/smime/smver.c rename to src/openssl/openssl-1.1.1w-chevah2/demos/smime/smver.c diff --git a/src/openssl/openssl-1.1.1w/doc/HOWTO/certificates.txt b/src/openssl/openssl-1.1.1w-chevah2/doc/HOWTO/certificates.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/HOWTO/certificates.txt rename to src/openssl/openssl-1.1.1w-chevah2/doc/HOWTO/certificates.txt diff --git a/src/openssl/openssl-1.1.1w/doc/HOWTO/keys.txt b/src/openssl/openssl-1.1.1w-chevah2/doc/HOWTO/keys.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/HOWTO/keys.txt rename to src/openssl/openssl-1.1.1w-chevah2/doc/HOWTO/keys.txt diff --git a/src/openssl/openssl-1.1.1w/doc/README b/src/openssl/openssl-1.1.1w-chevah2/doc/README similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/README rename to src/openssl/openssl-1.1.1w-chevah2/doc/README diff --git a/src/openssl/openssl-1.1.1w/doc/dir-locals.example.el b/src/openssl/openssl-1.1.1w-chevah2/doc/dir-locals.example.el similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/dir-locals.example.el rename to src/openssl/openssl-1.1.1w-chevah2/doc/dir-locals.example.el diff --git a/src/openssl/openssl-1.1.1w/doc/fingerprints.txt b/src/openssl/openssl-1.1.1w-chevah2/doc/fingerprints.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/fingerprints.txt rename to src/openssl/openssl-1.1.1w-chevah2/doc/fingerprints.txt diff --git a/src/openssl/openssl-1.1.1w/doc/man1/CA.pl.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/CA.pl.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/CA.pl.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/CA.pl.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/asn1parse.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/asn1parse.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/asn1parse.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/asn1parse.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/ca.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/ca.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/ca.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/ca.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/ciphers.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/ciphers.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/ciphers.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/ciphers.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/cms.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/cms.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/cms.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/cms.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/crl.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/crl.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/crl.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/crl.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/crl2pkcs7.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/crl2pkcs7.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/crl2pkcs7.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/crl2pkcs7.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/dgst.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/dgst.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/dgst.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/dgst.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/dhparam.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/dhparam.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/dhparam.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/dhparam.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/dsa.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/dsa.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/dsa.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/dsa.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/dsaparam.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/dsaparam.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/dsaparam.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/dsaparam.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/ec.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/ec.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/ec.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/ec.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/ecparam.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/ecparam.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/ecparam.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/ecparam.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/enc.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/enc.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/enc.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/enc.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/engine.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/engine.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/engine.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/engine.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/errstr.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/errstr.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/errstr.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/errstr.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/gendsa.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/gendsa.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/gendsa.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/gendsa.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/genpkey.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/genpkey.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/genpkey.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/genpkey.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/genrsa.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/genrsa.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/genrsa.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/genrsa.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/list.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/list.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/list.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/list.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/nseq.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/nseq.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/nseq.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/nseq.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/ocsp.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/ocsp.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/ocsp.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/ocsp.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/openssl.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/openssl.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/openssl.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/openssl.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/passwd.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/passwd.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/passwd.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/passwd.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/pkcs12.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/pkcs12.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/pkcs12.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/pkcs12.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/pkcs7.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/pkcs7.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/pkcs7.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/pkcs7.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/pkcs8.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/pkcs8.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/pkcs8.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/pkcs8.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/pkey.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/pkey.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/pkey.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/pkey.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/pkeyparam.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/pkeyparam.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/pkeyparam.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/pkeyparam.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/pkeyutl.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/pkeyutl.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/pkeyutl.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/pkeyutl.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/prime.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/prime.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/prime.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/prime.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/rand.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/rand.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/rand.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/rand.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/rehash.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/rehash.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/rehash.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/rehash.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/req.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/req.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/req.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/req.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/rsa.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/rsa.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/rsa.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/rsa.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/rsautl.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/rsautl.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/rsautl.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/rsautl.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/s_client.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/s_client.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/s_client.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/s_client.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/s_server.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/s_server.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/s_server.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/s_server.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/s_time.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/s_time.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/s_time.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/s_time.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/sess_id.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/sess_id.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/sess_id.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/sess_id.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/smime.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/smime.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/smime.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/smime.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/speed.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/speed.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/speed.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/speed.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/spkac.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/spkac.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/spkac.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/spkac.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/srp.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/srp.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/srp.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/srp.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/storeutl.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/storeutl.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/storeutl.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/storeutl.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/ts.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/ts.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/ts.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/ts.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/tsget.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/tsget.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/tsget.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/tsget.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/verify.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/verify.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/verify.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/verify.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/version.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/version.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/version.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/version.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man1/x509.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man1/x509.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man1/x509.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man1/x509.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ADMISSIONS.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ADMISSIONS.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ADMISSIONS.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ADMISSIONS.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ASN1_INTEGER_get_int64.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_INTEGER_get_int64.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ASN1_INTEGER_get_int64.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_INTEGER_get_int64.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ASN1_ITEM_lookup.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_ITEM_lookup.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ASN1_ITEM_lookup.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_ITEM_lookup.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ASN1_OBJECT_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_OBJECT_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ASN1_OBJECT_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_OBJECT_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ASN1_STRING_TABLE_add.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_STRING_TABLE_add.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ASN1_STRING_TABLE_add.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_STRING_TABLE_add.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ASN1_STRING_length.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_STRING_length.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ASN1_STRING_length.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_STRING_length.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ASN1_STRING_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_STRING_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ASN1_STRING_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_STRING_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ASN1_STRING_print_ex.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_STRING_print_ex.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ASN1_STRING_print_ex.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_STRING_print_ex.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ASN1_TIME_set.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_TIME_set.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ASN1_TIME_set.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_TIME_set.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ASN1_TYPE_get.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_TYPE_get.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ASN1_TYPE_get.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_TYPE_get.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ASN1_generate_nconf.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_generate_nconf.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ASN1_generate_nconf.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASN1_generate_nconf.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ASYNC_WAIT_CTX_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASYNC_WAIT_CTX_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ASYNC_WAIT_CTX_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASYNC_WAIT_CTX_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ASYNC_start_job.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASYNC_start_job.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ASYNC_start_job.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ASYNC_start_job.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BF_encrypt.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BF_encrypt.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BF_encrypt.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BF_encrypt.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_ADDR.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_ADDR.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_ADDR.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_ADDR.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_ADDRINFO.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_ADDRINFO.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_ADDRINFO.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_ADDRINFO.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_connect.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_connect.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_connect.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_connect.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_ctrl.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_ctrl.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_ctrl.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_ctrl.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_f_base64.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_f_base64.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_f_base64.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_f_base64.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_f_buffer.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_f_buffer.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_f_buffer.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_f_buffer.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_f_cipher.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_f_cipher.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_f_cipher.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_f_cipher.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_f_md.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_f_md.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_f_md.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_f_md.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_f_null.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_f_null.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_f_null.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_f_null.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_f_ssl.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_f_ssl.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_f_ssl.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_f_ssl.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_find_type.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_find_type.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_find_type.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_find_type.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_get_data.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_get_data.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_get_data.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_get_data.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_get_ex_new_index.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_get_ex_new_index.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_get_ex_new_index.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_get_ex_new_index.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_meth_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_meth_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_meth_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_meth_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_new_CMS.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_new_CMS.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_new_CMS.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_new_CMS.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_parse_hostserv.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_parse_hostserv.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_parse_hostserv.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_parse_hostserv.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_printf.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_printf.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_printf.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_printf.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_push.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_push.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_push.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_push.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_read.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_read.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_read.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_read.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_s_accept.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_s_accept.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_s_accept.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_s_accept.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_s_bio.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_s_bio.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_s_bio.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_s_bio.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_s_connect.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_s_connect.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_s_connect.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_s_connect.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_s_fd.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_s_fd.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_s_fd.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_s_fd.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_s_file.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_s_file.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_s_file.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_s_file.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_s_mem.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_s_mem.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_s_mem.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_s_mem.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_s_null.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_s_null.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_s_null.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_s_null.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_s_socket.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_s_socket.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_s_socket.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_s_socket.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_set_callback.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_set_callback.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_set_callback.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_set_callback.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BIO_should_retry.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_should_retry.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BIO_should_retry.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BIO_should_retry.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_BLINDING_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_BLINDING_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_BLINDING_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_BLINDING_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_CTX_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_CTX_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_CTX_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_CTX_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_CTX_start.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_CTX_start.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_CTX_start.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_CTX_start.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_add.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_add.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_add.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_add.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_add_word.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_add_word.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_add_word.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_add_word.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_bn2bin.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_bn2bin.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_bn2bin.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_bn2bin.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_cmp.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_cmp.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_cmp.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_cmp.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_copy.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_copy.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_copy.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_copy.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_generate_prime.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_generate_prime.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_generate_prime.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_generate_prime.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_mod_inverse.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_mod_inverse.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_mod_inverse.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_mod_inverse.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_mod_mul_montgomery.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_mod_mul_montgomery.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_mod_mul_montgomery.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_mod_mul_montgomery.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_mod_mul_reciprocal.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_mod_mul_reciprocal.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_mod_mul_reciprocal.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_mod_mul_reciprocal.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_num_bytes.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_num_bytes.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_num_bytes.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_num_bytes.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_rand.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_rand.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_rand.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_rand.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_security_bits.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_security_bits.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_security_bits.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_security_bits.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_set_bit.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_set_bit.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_set_bit.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_set_bit.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_swap.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_swap.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_swap.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_swap.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BN_zero.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_zero.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BN_zero.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BN_zero.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/BUF_MEM_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/BUF_MEM_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/BUF_MEM_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/BUF_MEM_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CMS_add0_cert.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_add0_cert.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CMS_add0_cert.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_add0_cert.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CMS_add1_recipient_cert.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_add1_recipient_cert.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CMS_add1_recipient_cert.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_add1_recipient_cert.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CMS_add1_signer.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_add1_signer.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CMS_add1_signer.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_add1_signer.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CMS_compress.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_compress.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CMS_compress.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_compress.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CMS_decrypt.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_decrypt.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CMS_decrypt.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_decrypt.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CMS_encrypt.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_encrypt.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CMS_encrypt.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_encrypt.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CMS_final.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_final.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CMS_final.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_final.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CMS_get0_RecipientInfos.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_get0_RecipientInfos.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CMS_get0_RecipientInfos.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_get0_RecipientInfos.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CMS_get0_SignerInfos.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_get0_SignerInfos.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CMS_get0_SignerInfos.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_get0_SignerInfos.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CMS_get0_type.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_get0_type.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CMS_get0_type.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_get0_type.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CMS_get1_ReceiptRequest.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_get1_ReceiptRequest.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CMS_get1_ReceiptRequest.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_get1_ReceiptRequest.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CMS_sign.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_sign.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CMS_sign.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_sign.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CMS_sign_receipt.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_sign_receipt.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CMS_sign_receipt.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_sign_receipt.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CMS_uncompress.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_uncompress.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CMS_uncompress.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_uncompress.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CMS_verify.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_verify.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CMS_verify.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_verify.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CMS_verify_receipt.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_verify_receipt.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CMS_verify_receipt.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CMS_verify_receipt.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CONF_modules_free.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CONF_modules_free.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CONF_modules_free.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CONF_modules_free.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CONF_modules_load_file.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CONF_modules_load_file.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CONF_modules_load_file.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CONF_modules_load_file.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CRYPTO_THREAD_run_once.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CRYPTO_THREAD_run_once.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CRYPTO_THREAD_run_once.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CRYPTO_THREAD_run_once.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CRYPTO_get_ex_new_index.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CRYPTO_get_ex_new_index.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CRYPTO_get_ex_new_index.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CRYPTO_get_ex_new_index.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CRYPTO_memcmp.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CRYPTO_memcmp.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CRYPTO_memcmp.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CRYPTO_memcmp.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CTLOG_STORE_get0_log_by_id.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CTLOG_STORE_get0_log_by_id.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CTLOG_STORE_get0_log_by_id.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CTLOG_STORE_get0_log_by_id.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CTLOG_STORE_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CTLOG_STORE_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CTLOG_STORE_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CTLOG_STORE_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CTLOG_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CTLOG_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CTLOG_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CTLOG_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/CT_POLICY_EVAL_CTX_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/CT_POLICY_EVAL_CTX_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/CT_POLICY_EVAL_CTX_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/CT_POLICY_EVAL_CTX_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DEFINE_STACK_OF.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DEFINE_STACK_OF.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DEFINE_STACK_OF.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DEFINE_STACK_OF.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DES_random_key.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DES_random_key.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DES_random_key.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DES_random_key.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DH_generate_key.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_generate_key.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DH_generate_key.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_generate_key.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DH_generate_parameters.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_generate_parameters.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DH_generate_parameters.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_generate_parameters.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DH_get0_pqg.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_get0_pqg.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DH_get0_pqg.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_get0_pqg.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DH_get_1024_160.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_get_1024_160.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DH_get_1024_160.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_get_1024_160.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DH_meth_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_meth_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DH_meth_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_meth_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DH_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DH_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DH_new_by_nid.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_new_by_nid.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DH_new_by_nid.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_new_by_nid.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DH_set_method.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_set_method.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DH_set_method.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_set_method.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DH_size.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_size.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DH_size.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DH_size.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DSA_SIG_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_SIG_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DSA_SIG_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_SIG_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DSA_do_sign.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_do_sign.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DSA_do_sign.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_do_sign.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DSA_dup_DH.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_dup_DH.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DSA_dup_DH.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_dup_DH.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DSA_generate_key.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_generate_key.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DSA_generate_key.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_generate_key.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DSA_generate_parameters.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_generate_parameters.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DSA_generate_parameters.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_generate_parameters.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DSA_get0_pqg.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_get0_pqg.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DSA_get0_pqg.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_get0_pqg.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DSA_meth_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_meth_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DSA_meth_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_meth_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DSA_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DSA_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DSA_set_method.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_set_method.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DSA_set_method.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_set_method.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DSA_sign.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_sign.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DSA_sign.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_sign.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DSA_size.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_size.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DSA_size.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DSA_size.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DTLS_get_data_mtu.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DTLS_get_data_mtu.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DTLS_get_data_mtu.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DTLS_get_data_mtu.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DTLS_set_timer_cb.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DTLS_set_timer_cb.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DTLS_set_timer_cb.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DTLS_set_timer_cb.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/DTLSv1_listen.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/DTLSv1_listen.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/DTLSv1_listen.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/DTLSv1_listen.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ECDSA_SIG_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ECDSA_SIG_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ECDSA_SIG_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ECDSA_SIG_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ECPKParameters_print.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ECPKParameters_print.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ECPKParameters_print.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ECPKParameters_print.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EC_GFp_simple_method.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EC_GFp_simple_method.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EC_GFp_simple_method.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EC_GFp_simple_method.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EC_GROUP_copy.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EC_GROUP_copy.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EC_GROUP_copy.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EC_GROUP_copy.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EC_GROUP_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EC_GROUP_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EC_GROUP_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EC_GROUP_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EC_KEY_get_enc_flags.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EC_KEY_get_enc_flags.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EC_KEY_get_enc_flags.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EC_KEY_get_enc_flags.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EC_KEY_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EC_KEY_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EC_KEY_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EC_KEY_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EC_POINT_add.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EC_POINT_add.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EC_POINT_add.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EC_POINT_add.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EC_POINT_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EC_POINT_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EC_POINT_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EC_POINT_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ENGINE_add.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ENGINE_add.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ENGINE_add.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ENGINE_add.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ERR_GET_LIB.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_GET_LIB.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ERR_GET_LIB.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_GET_LIB.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ERR_clear_error.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_clear_error.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ERR_clear_error.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_clear_error.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ERR_error_string.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_error_string.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ERR_error_string.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_error_string.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ERR_get_error.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_get_error.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ERR_get_error.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_get_error.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ERR_load_crypto_strings.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_load_crypto_strings.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ERR_load_crypto_strings.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_load_crypto_strings.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ERR_load_strings.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_load_strings.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ERR_load_strings.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_load_strings.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ERR_print_errors.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_print_errors.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ERR_print_errors.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_print_errors.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ERR_put_error.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_put_error.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ERR_put_error.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_put_error.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ERR_remove_state.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_remove_state.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ERR_remove_state.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_remove_state.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/ERR_set_mark.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_set_mark.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/ERR_set_mark.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/ERR_set_mark.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_BytesToKey.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_BytesToKey.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_BytesToKey.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_BytesToKey.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_CIPHER_CTX_get_cipher_data.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_CIPHER_CTX_get_cipher_data.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_CIPHER_CTX_get_cipher_data.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_CIPHER_CTX_get_cipher_data.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_CIPHER_meth_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_CIPHER_meth_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_CIPHER_meth_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_CIPHER_meth_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_DigestInit.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_DigestInit.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_DigestInit.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_DigestInit.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_DigestSignInit.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_DigestSignInit.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_DigestSignInit.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_DigestSignInit.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_DigestVerifyInit.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_DigestVerifyInit.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_DigestVerifyInit.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_DigestVerifyInit.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_EncodeInit.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_EncodeInit.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_EncodeInit.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_EncodeInit.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_EncryptInit.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_EncryptInit.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_EncryptInit.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_EncryptInit.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_MD_meth_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_MD_meth_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_MD_meth_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_MD_meth_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_OpenInit.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_OpenInit.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_OpenInit.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_OpenInit.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_ASN1_METHOD.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_ASN1_METHOD.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_ASN1_METHOD.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_ASN1_METHOD.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_CTX_ctrl.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_CTX_ctrl.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_CTX_ctrl.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_CTX_ctrl.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_CTX_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_CTX_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_CTX_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_CTX_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_CTX_set1_pbe_pass.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_CTX_set1_pbe_pass.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_CTX_set1_pbe_pass.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_CTX_set1_pbe_pass.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_CTX_set_hkdf_md.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_CTX_set_hkdf_md.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_CTX_set_hkdf_md.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_CTX_set_hkdf_md.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_CTX_set_rsa_pss_keygen_md.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_CTX_set_scrypt_N.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_CTX_set_scrypt_N.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_CTX_set_scrypt_N.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_CTX_set_scrypt_N.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_CTX_set_tls1_prf_md.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_CTX_set_tls1_prf_md.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_CTX_set_tls1_prf_md.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_CTX_set_tls1_prf_md.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_asn1_get_count.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_asn1_get_count.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_asn1_get_count.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_asn1_get_count.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_cmp.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_cmp.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_cmp.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_cmp.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_decrypt.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_decrypt.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_decrypt.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_decrypt.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_derive.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_derive.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_derive.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_derive.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_encrypt.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_encrypt.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_encrypt.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_encrypt.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_get_default_digest_nid.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_get_default_digest_nid.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_get_default_digest_nid.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_get_default_digest_nid.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_keygen.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_keygen.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_keygen.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_keygen.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_meth_get_count.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_meth_get_count.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_meth_get_count.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_meth_get_count.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_meth_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_meth_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_meth_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_meth_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_print_private.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_print_private.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_print_private.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_print_private.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_set1_RSA.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_set1_RSA.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_set1_RSA.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_set1_RSA.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_sign.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_sign.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_sign.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_sign.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_size.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_size.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_size.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_size.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_verify.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_verify.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_verify.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_verify.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_verify_recover.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_verify_recover.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_PKEY_verify_recover.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_PKEY_verify_recover.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_SealInit.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_SealInit.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_SealInit.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_SealInit.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_SignInit.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_SignInit.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_SignInit.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_SignInit.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_VerifyInit.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_VerifyInit.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_VerifyInit.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_VerifyInit.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_aes.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_aes.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_aes.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_aes.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_aria.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_aria.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_aria.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_aria.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_bf_cbc.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_bf_cbc.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_bf_cbc.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_bf_cbc.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_blake2b512.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_blake2b512.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_blake2b512.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_blake2b512.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_camellia.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_camellia.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_camellia.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_camellia.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_cast5_cbc.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_cast5_cbc.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_cast5_cbc.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_cast5_cbc.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_chacha20.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_chacha20.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_chacha20.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_chacha20.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_des.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_des.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_des.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_des.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_desx_cbc.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_desx_cbc.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_desx_cbc.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_desx_cbc.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_idea_cbc.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_idea_cbc.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_idea_cbc.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_idea_cbc.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_md2.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_md2.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_md2.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_md2.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_md4.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_md4.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_md4.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_md4.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_md5.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_md5.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_md5.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_md5.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_mdc2.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_mdc2.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_mdc2.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_mdc2.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_rc2_cbc.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_rc2_cbc.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_rc2_cbc.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_rc2_cbc.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_rc4.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_rc4.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_rc4.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_rc4.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_rc5_32_12_16_cbc.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_rc5_32_12_16_cbc.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_rc5_32_12_16_cbc.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_rc5_32_12_16_cbc.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_ripemd160.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_ripemd160.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_ripemd160.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_ripemd160.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_seed_cbc.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_seed_cbc.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_seed_cbc.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_seed_cbc.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_sha1.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_sha1.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_sha1.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_sha1.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_sha224.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_sha224.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_sha224.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_sha224.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_sha3_224.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_sha3_224.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_sha3_224.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_sha3_224.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_sm3.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_sm3.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_sm3.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_sm3.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_sm4_cbc.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_sm4_cbc.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_sm4_cbc.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_sm4_cbc.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/EVP_whirlpool.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_whirlpool.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/EVP_whirlpool.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/EVP_whirlpool.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/HMAC.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/HMAC.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/HMAC.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/HMAC.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/MD5.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/MD5.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/MD5.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/MD5.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/MDC2_Init.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/MDC2_Init.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/MDC2_Init.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/MDC2_Init.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OBJ_nid2obj.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OBJ_nid2obj.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OBJ_nid2obj.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OBJ_nid2obj.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OCSP_REQUEST_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OCSP_REQUEST_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OCSP_REQUEST_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OCSP_REQUEST_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OCSP_cert_to_id.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OCSP_cert_to_id.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OCSP_cert_to_id.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OCSP_cert_to_id.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OCSP_request_add1_nonce.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OCSP_request_add1_nonce.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OCSP_request_add1_nonce.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OCSP_request_add1_nonce.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OCSP_resp_find_status.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OCSP_resp_find_status.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OCSP_resp_find_status.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OCSP_resp_find_status.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OCSP_response_status.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OCSP_response_status.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OCSP_response_status.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OCSP_response_status.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OCSP_sendreq_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OCSP_sendreq_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OCSP_sendreq_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OCSP_sendreq_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_Applink.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_Applink.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_Applink.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_Applink.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_LH_COMPFUNC.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_LH_COMPFUNC.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_LH_COMPFUNC.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_LH_COMPFUNC.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_LH_stats.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_LH_stats.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_LH_stats.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_LH_stats.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_VERSION_NUMBER.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_VERSION_NUMBER.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_VERSION_NUMBER.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_VERSION_NUMBER.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_config.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_config.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_config.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_config.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_fork_prepare.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_fork_prepare.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_fork_prepare.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_fork_prepare.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_ia32cap.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_ia32cap.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_ia32cap.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_ia32cap.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_init_crypto.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_init_crypto.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_init_crypto.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_init_crypto.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_init_ssl.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_init_ssl.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_init_ssl.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_init_ssl.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_instrument_bus.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_instrument_bus.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_instrument_bus.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_instrument_bus.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_load_builtin_modules.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_load_builtin_modules.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_load_builtin_modules.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_load_builtin_modules.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_malloc.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_malloc.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_malloc.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_malloc.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_secure_malloc.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_secure_malloc.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OPENSSL_secure_malloc.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OPENSSL_secure_malloc.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OSSL_STORE_INFO.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OSSL_STORE_INFO.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OSSL_STORE_INFO.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OSSL_STORE_INFO.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OSSL_STORE_LOADER.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OSSL_STORE_LOADER.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OSSL_STORE_LOADER.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OSSL_STORE_LOADER.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OSSL_STORE_SEARCH.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OSSL_STORE_SEARCH.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OSSL_STORE_SEARCH.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OSSL_STORE_SEARCH.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OSSL_STORE_expect.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OSSL_STORE_expect.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OSSL_STORE_expect.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OSSL_STORE_expect.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OSSL_STORE_open.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OSSL_STORE_open.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OSSL_STORE_open.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OSSL_STORE_open.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/OpenSSL_add_all_algorithms.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/OpenSSL_add_all_algorithms.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/OpenSSL_add_all_algorithms.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/OpenSSL_add_all_algorithms.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/PEM_bytes_read_bio.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/PEM_bytes_read_bio.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/PEM_bytes_read_bio.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/PEM_bytes_read_bio.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/PEM_read.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/PEM_read.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/PEM_read.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/PEM_read.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/PEM_read_CMS.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/PEM_read_CMS.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/PEM_read_CMS.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/PEM_read_CMS.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/PEM_read_bio_PrivateKey.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/PEM_read_bio_PrivateKey.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/PEM_read_bio_PrivateKey.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/PEM_read_bio_PrivateKey.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/PEM_read_bio_ex.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/PEM_read_bio_ex.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/PEM_read_bio_ex.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/PEM_read_bio_ex.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/PEM_write_bio_CMS_stream.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/PEM_write_bio_CMS_stream.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/PEM_write_bio_CMS_stream.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/PEM_write_bio_CMS_stream.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/PEM_write_bio_PKCS7_stream.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/PEM_write_bio_PKCS7_stream.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/PEM_write_bio_PKCS7_stream.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/PEM_write_bio_PKCS7_stream.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/PKCS12_create.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS12_create.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/PKCS12_create.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS12_create.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/PKCS12_newpass.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS12_newpass.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/PKCS12_newpass.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS12_newpass.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/PKCS12_parse.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS12_parse.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/PKCS12_parse.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS12_parse.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/PKCS5_PBKDF2_HMAC.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS5_PBKDF2_HMAC.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/PKCS5_PBKDF2_HMAC.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS5_PBKDF2_HMAC.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/PKCS7_decrypt.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS7_decrypt.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/PKCS7_decrypt.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS7_decrypt.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/PKCS7_encrypt.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS7_encrypt.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/PKCS7_encrypt.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS7_encrypt.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/PKCS7_sign.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS7_sign.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/PKCS7_sign.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS7_sign.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/PKCS7_sign_add_signer.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS7_sign_add_signer.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/PKCS7_sign_add_signer.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS7_sign_add_signer.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/PKCS7_verify.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS7_verify.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/PKCS7_verify.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/PKCS7_verify.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RAND_DRBG_generate.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_DRBG_generate.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RAND_DRBG_generate.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_DRBG_generate.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RAND_DRBG_get0_master.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_DRBG_get0_master.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RAND_DRBG_get0_master.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_DRBG_get0_master.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RAND_DRBG_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_DRBG_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RAND_DRBG_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_DRBG_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RAND_DRBG_reseed.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_DRBG_reseed.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RAND_DRBG_reseed.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_DRBG_reseed.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RAND_DRBG_set_callbacks.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_DRBG_set_callbacks.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RAND_DRBG_set_callbacks.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_DRBG_set_callbacks.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RAND_DRBG_set_ex_data.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_DRBG_set_ex_data.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RAND_DRBG_set_ex_data.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_DRBG_set_ex_data.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RAND_add.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_add.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RAND_add.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_add.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RAND_bytes.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_bytes.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RAND_bytes.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_bytes.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RAND_cleanup.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_cleanup.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RAND_cleanup.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_cleanup.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RAND_egd.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_egd.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RAND_egd.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_egd.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RAND_load_file.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_load_file.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RAND_load_file.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_load_file.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RAND_set_rand_method.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_set_rand_method.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RAND_set_rand_method.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RAND_set_rand_method.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RC4_set_key.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RC4_set_key.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RC4_set_key.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RC4_set_key.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RIPEMD160_Init.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RIPEMD160_Init.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RIPEMD160_Init.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RIPEMD160_Init.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RSA_blinding_on.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_blinding_on.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RSA_blinding_on.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_blinding_on.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RSA_check_key.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_check_key.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RSA_check_key.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_check_key.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RSA_generate_key.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_generate_key.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RSA_generate_key.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_generate_key.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RSA_get0_key.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_get0_key.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RSA_get0_key.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_get0_key.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RSA_meth_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_meth_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RSA_meth_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_meth_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RSA_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RSA_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RSA_padding_add_PKCS1_type_1.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_padding_add_PKCS1_type_1.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RSA_padding_add_PKCS1_type_1.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_padding_add_PKCS1_type_1.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RSA_print.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_print.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RSA_print.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_print.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RSA_private_encrypt.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_private_encrypt.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RSA_private_encrypt.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_private_encrypt.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RSA_public_encrypt.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_public_encrypt.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RSA_public_encrypt.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_public_encrypt.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RSA_set_method.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_set_method.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RSA_set_method.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_set_method.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RSA_sign.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_sign.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RSA_sign.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_sign.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RSA_sign_ASN1_OCTET_STRING.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_sign_ASN1_OCTET_STRING.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RSA_sign_ASN1_OCTET_STRING.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_sign_ASN1_OCTET_STRING.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/RSA_size.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_size.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/RSA_size.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/RSA_size.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SCT_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SCT_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SCT_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SCT_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SCT_print.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SCT_print.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SCT_print.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SCT_print.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SCT_validate.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SCT_validate.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SCT_validate.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SCT_validate.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SHA256_Init.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SHA256_Init.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SHA256_Init.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SHA256_Init.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SMIME_read_CMS.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SMIME_read_CMS.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SMIME_read_CMS.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SMIME_read_CMS.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SMIME_read_PKCS7.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SMIME_read_PKCS7.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SMIME_read_PKCS7.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SMIME_read_PKCS7.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SMIME_write_CMS.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SMIME_write_CMS.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SMIME_write_CMS.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SMIME_write_CMS.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SMIME_write_PKCS7.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SMIME_write_PKCS7.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SMIME_write_PKCS7.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SMIME_write_PKCS7.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CIPHER_get_name.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CIPHER_get_name.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CIPHER_get_name.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CIPHER_get_name.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_COMP_add_compression_method.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_COMP_add_compression_method.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_COMP_add_compression_method.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_COMP_add_compression_method.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CONF_CTX_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CONF_CTX_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CONF_CTX_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CONF_CTX_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CONF_CTX_set1_prefix.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CONF_CTX_set1_prefix.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CONF_CTX_set1_prefix.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CONF_CTX_set1_prefix.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CONF_CTX_set_flags.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CONF_CTX_set_flags.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CONF_CTX_set_flags.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CONF_CTX_set_flags.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CONF_CTX_set_ssl_ctx.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CONF_CTX_set_ssl_ctx.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CONF_CTX_set_ssl_ctx.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CONF_CTX_set_ssl_ctx.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CONF_cmd.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CONF_cmd.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CONF_cmd.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CONF_cmd.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CONF_cmd_argv.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CONF_cmd_argv.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CONF_cmd_argv.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CONF_cmd_argv.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_add1_chain_cert.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_add1_chain_cert.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_add1_chain_cert.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_add1_chain_cert.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_add_extra_chain_cert.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_add_extra_chain_cert.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_add_extra_chain_cert.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_add_extra_chain_cert.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_add_session.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_add_session.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_add_session.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_add_session.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_config.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_config.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_config.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_config.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_ctrl.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_ctrl.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_ctrl.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_ctrl.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_dane_enable.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_dane_enable.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_dane_enable.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_dane_enable.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_flush_sessions.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_flush_sessions.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_flush_sessions.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_flush_sessions.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_free.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_free.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_free.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_free.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_get0_param.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_get0_param.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_get0_param.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_get0_param.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_get_verify_mode.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_get_verify_mode.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_get_verify_mode.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_get_verify_mode.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_has_client_custom_ext.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_has_client_custom_ext.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_has_client_custom_ext.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_has_client_custom_ext.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_load_verify_locations.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_load_verify_locations.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_load_verify_locations.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_load_verify_locations.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_sess_number.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_sess_number.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_sess_number.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_sess_number.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_sess_set_cache_size.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_sess_set_cache_size.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_sess_set_cache_size.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_sess_set_cache_size.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_sess_set_get_cb.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_sess_set_get_cb.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_sess_set_get_cb.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_sess_set_get_cb.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_sessions.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_sessions.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_sessions.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_sessions.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set0_CA_list.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set0_CA_list.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set0_CA_list.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set0_CA_list.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set1_curves.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set1_curves.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set1_curves.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set1_curves.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set1_sigalgs.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set1_sigalgs.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set1_sigalgs.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set1_sigalgs.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set1_verify_cert_store.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set1_verify_cert_store.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set1_verify_cert_store.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set1_verify_cert_store.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_alpn_select_cb.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_alpn_select_cb.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_alpn_select_cb.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_alpn_select_cb.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_cert_cb.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_cert_cb.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_cert_cb.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_cert_cb.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_cert_store.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_cert_store.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_cert_store.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_cert_store.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_cert_verify_callback.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_cert_verify_callback.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_cert_verify_callback.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_cert_verify_callback.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_cipher_list.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_cipher_list.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_cipher_list.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_cipher_list.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_client_cert_cb.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_client_cert_cb.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_client_cert_cb.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_client_cert_cb.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_client_hello_cb.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_client_hello_cb.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_client_hello_cb.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_client_hello_cb.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_ct_validation_callback.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_ct_validation_callback.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_ct_validation_callback.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_ct_validation_callback.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_ctlog_list_file.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_ctlog_list_file.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_ctlog_list_file.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_ctlog_list_file.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_default_passwd_cb.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_default_passwd_cb.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_default_passwd_cb.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_default_passwd_cb.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_ex_data.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_ex_data.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_ex_data.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_ex_data.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_generate_session_id.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_generate_session_id.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_generate_session_id.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_generate_session_id.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_info_callback.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_info_callback.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_info_callback.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_info_callback.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_keylog_callback.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_keylog_callback.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_keylog_callback.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_keylog_callback.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_max_cert_list.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_max_cert_list.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_max_cert_list.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_max_cert_list.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_min_proto_version.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_min_proto_version.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_min_proto_version.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_min_proto_version.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_mode.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_mode.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_mode.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_mode.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_msg_callback.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_msg_callback.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_msg_callback.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_msg_callback.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_num_tickets.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_num_tickets.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_num_tickets.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_num_tickets.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_options.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_options.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_options.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_options.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_psk_client_callback.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_psk_client_callback.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_psk_client_callback.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_psk_client_callback.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_quiet_shutdown.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_quiet_shutdown.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_quiet_shutdown.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_quiet_shutdown.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_read_ahead.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_read_ahead.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_read_ahead.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_read_ahead.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_record_padding_callback.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_record_padding_callback.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_record_padding_callback.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_record_padding_callback.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_security_level.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_security_level.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_security_level.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_security_level.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_session_cache_mode.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_session_cache_mode.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_session_cache_mode.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_session_cache_mode.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_session_id_context.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_session_id_context.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_session_id_context.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_session_id_context.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_session_ticket_cb.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_session_ticket_cb.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_session_ticket_cb.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_session_ticket_cb.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_split_send_fragment.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_split_send_fragment.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_split_send_fragment.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_split_send_fragment.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_ssl_version.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_ssl_version.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_ssl_version.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_ssl_version.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_stateless_cookie_generate_cb.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_stateless_cookie_generate_cb.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_stateless_cookie_generate_cb.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_stateless_cookie_generate_cb.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_timeout.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_timeout.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_timeout.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_timeout.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_tlsext_servername_callback.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_tlsext_servername_callback.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_tlsext_servername_callback.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_tlsext_servername_callback.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_tlsext_status_cb.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_tlsext_status_cb.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_tlsext_status_cb.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_tlsext_status_cb.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_tlsext_ticket_key_cb.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_tlsext_ticket_key_cb.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_tlsext_ticket_key_cb.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_tlsext_ticket_key_cb.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_tlsext_use_srtp.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_tlsext_use_srtp.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_tlsext_use_srtp.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_tlsext_use_srtp.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_tmp_dh_callback.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_tmp_dh_callback.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_tmp_dh_callback.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_tmp_dh_callback.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_verify.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_verify.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_set_verify.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_set_verify.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_use_certificate.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_use_certificate.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_use_certificate.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_use_certificate.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_use_psk_identity_hint.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_use_psk_identity_hint.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_use_psk_identity_hint.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_use_psk_identity_hint.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_use_serverinfo.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_use_serverinfo.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_CTX_use_serverinfo.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_CTX_use_serverinfo.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_free.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_free.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_free.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_free.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_get0_cipher.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_get0_cipher.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_get0_cipher.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_get0_cipher.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_get0_hostname.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_get0_hostname.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_get0_hostname.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_get0_hostname.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_get0_id_context.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_get0_id_context.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_get0_id_context.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_get0_id_context.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_get0_peer.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_get0_peer.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_get0_peer.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_get0_peer.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_get_compress_id.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_get_compress_id.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_get_compress_id.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_get_compress_id.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_get_ex_data.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_get_ex_data.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_get_ex_data.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_get_ex_data.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_get_protocol_version.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_get_protocol_version.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_get_protocol_version.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_get_protocol_version.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_get_time.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_get_time.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_get_time.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_get_time.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_has_ticket.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_has_ticket.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_has_ticket.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_has_ticket.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_is_resumable.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_is_resumable.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_is_resumable.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_is_resumable.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_print.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_print.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_print.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_print.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_set1_id.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_set1_id.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_SESSION_set1_id.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_SESSION_set1_id.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_accept.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_accept.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_accept.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_accept.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_alert_type_string.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_alert_type_string.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_alert_type_string.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_alert_type_string.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_alloc_buffers.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_alloc_buffers.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_alloc_buffers.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_alloc_buffers.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_check_chain.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_check_chain.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_check_chain.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_check_chain.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_clear.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_clear.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_clear.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_clear.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_connect.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_connect.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_connect.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_connect.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_do_handshake.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_do_handshake.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_do_handshake.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_do_handshake.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_export_keying_material.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_export_keying_material.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_export_keying_material.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_export_keying_material.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_extension_supported.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_extension_supported.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_extension_supported.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_extension_supported.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_free.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_free.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_free.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_free.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get0_peer_scts.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get0_peer_scts.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get0_peer_scts.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get0_peer_scts.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_SSL_CTX.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_SSL_CTX.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_SSL_CTX.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_SSL_CTX.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_all_async_fds.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_all_async_fds.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_all_async_fds.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_all_async_fds.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_ciphers.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_ciphers.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_ciphers.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_ciphers.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_client_random.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_client_random.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_client_random.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_client_random.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_current_cipher.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_current_cipher.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_current_cipher.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_current_cipher.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_default_timeout.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_default_timeout.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_default_timeout.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_default_timeout.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_error.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_error.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_error.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_error.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_extms_support.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_extms_support.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_extms_support.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_extms_support.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_fd.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_fd.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_fd.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_fd.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_peer_cert_chain.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_peer_cert_chain.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_peer_cert_chain.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_peer_cert_chain.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_peer_certificate.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_peer_certificate.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_peer_certificate.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_peer_certificate.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_peer_signature_nid.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_peer_signature_nid.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_peer_signature_nid.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_peer_signature_nid.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_peer_tmp_key.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_peer_tmp_key.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_peer_tmp_key.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_peer_tmp_key.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_psk_identity.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_psk_identity.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_psk_identity.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_psk_identity.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_rbio.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_rbio.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_rbio.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_rbio.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_session.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_session.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_session.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_session.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_shared_sigalgs.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_shared_sigalgs.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_shared_sigalgs.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_shared_sigalgs.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_verify_result.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_verify_result.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_verify_result.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_verify_result.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_get_version.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_version.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_get_version.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_get_version.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_in_init.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_in_init.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_in_init.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_in_init.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_key_update.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_key_update.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_key_update.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_key_update.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_library_init.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_library_init.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_library_init.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_library_init.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_load_client_CA_file.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_load_client_CA_file.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_load_client_CA_file.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_load_client_CA_file.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_pending.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_pending.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_pending.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_pending.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_read.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_read.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_read.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_read.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_read_early_data.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_read_early_data.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_read_early_data.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_read_early_data.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_rstate_string.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_rstate_string.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_rstate_string.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_rstate_string.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_session_reused.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_session_reused.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_session_reused.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_session_reused.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_set1_host.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_set1_host.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_set1_host.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_set1_host.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_set_bio.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_set_bio.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_set_bio.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_set_bio.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_set_connect_state.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_set_connect_state.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_set_connect_state.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_set_connect_state.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_set_fd.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_set_fd.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_set_fd.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_set_fd.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_set_session.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_set_session.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_set_session.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_set_session.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_set_shutdown.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_set_shutdown.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_set_shutdown.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_set_shutdown.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_set_verify_result.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_set_verify_result.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_set_verify_result.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_set_verify_result.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_shutdown.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_shutdown.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_shutdown.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_shutdown.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_state_string.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_state_string.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_state_string.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_state_string.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_want.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_want.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_want.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_want.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/SSL_write.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_write.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/SSL_write.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/SSL_write.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/UI_STRING.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/UI_STRING.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/UI_STRING.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/UI_STRING.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/UI_UTIL_read_pw.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/UI_UTIL_read_pw.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/UI_UTIL_read_pw.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/UI_UTIL_read_pw.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/UI_create_method.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/UI_create_method.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/UI_create_method.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/UI_create_method.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/UI_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/UI_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/UI_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/UI_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509V3_get_d2i.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509V3_get_d2i.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509V3_get_d2i.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509V3_get_d2i.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_ALGOR_dup.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_ALGOR_dup.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_ALGOR_dup.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_ALGOR_dup.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_CRL_get0_by_serial.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_CRL_get0_by_serial.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_CRL_get0_by_serial.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_CRL_get0_by_serial.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_EXTENSION_set_object.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_EXTENSION_set_object.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_EXTENSION_set_object.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_EXTENSION_set_object.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_LOOKUP.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_LOOKUP.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_LOOKUP.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_LOOKUP.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_LOOKUP_hash_dir.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_LOOKUP_hash_dir.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_LOOKUP_hash_dir.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_LOOKUP_hash_dir.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_LOOKUP_meth_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_LOOKUP_meth_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_LOOKUP_meth_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_LOOKUP_meth_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_NAME_ENTRY_get_object.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_NAME_ENTRY_get_object.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_NAME_ENTRY_get_object.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_NAME_ENTRY_get_object.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_NAME_add_entry_by_txt.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_NAME_add_entry_by_txt.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_NAME_add_entry_by_txt.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_NAME_add_entry_by_txt.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_NAME_get0_der.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_NAME_get0_der.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_NAME_get0_der.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_NAME_get0_der.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_NAME_get_index_by_NID.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_NAME_get_index_by_NID.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_NAME_get_index_by_NID.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_NAME_get_index_by_NID.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_NAME_print_ex.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_NAME_print_ex.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_NAME_print_ex.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_NAME_print_ex.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_PUBKEY_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_PUBKEY_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_PUBKEY_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_PUBKEY_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_SIG_get0.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_SIG_get0.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_SIG_get0.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_SIG_get0.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_STORE_CTX_get_error.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_STORE_CTX_get_error.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_STORE_CTX_get_error.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_STORE_CTX_get_error.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_STORE_CTX_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_STORE_CTX_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_STORE_CTX_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_STORE_CTX_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_STORE_CTX_set_verify_cb.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_STORE_CTX_set_verify_cb.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_STORE_CTX_set_verify_cb.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_STORE_CTX_set_verify_cb.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_STORE_add_cert.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_STORE_add_cert.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_STORE_add_cert.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_STORE_add_cert.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_STORE_get0_param.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_STORE_get0_param.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_STORE_get0_param.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_STORE_get0_param.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_STORE_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_STORE_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_STORE_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_STORE_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_STORE_set_verify_cb_func.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_STORE_set_verify_cb_func.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_STORE_set_verify_cb_func.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_STORE_set_verify_cb_func.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_VERIFY_PARAM_set_flags.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_VERIFY_PARAM_set_flags.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_VERIFY_PARAM_set_flags.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_VERIFY_PARAM_set_flags.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_check_ca.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_check_ca.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_check_ca.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_check_ca.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_check_host.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_check_host.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_check_host.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_check_host.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_check_issued.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_check_issued.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_check_issued.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_check_issued.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_check_private_key.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_check_private_key.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_check_private_key.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_check_private_key.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_check_purpose.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_check_purpose.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_check_purpose.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_check_purpose.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_cmp.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_cmp.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_cmp.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_cmp.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_cmp_time.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_cmp_time.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_cmp_time.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_cmp_time.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_digest.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_digest.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_digest.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_digest.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_dup.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_dup.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_dup.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_dup.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_get0_notBefore.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_get0_notBefore.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_get0_notBefore.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_get0_notBefore.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_get0_signature.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_get0_signature.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_get0_signature.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_get0_signature.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_get0_uids.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_get0_uids.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_get0_uids.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_get0_uids.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_get_extension_flags.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_get_extension_flags.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_get_extension_flags.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_get_extension_flags.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_get_pubkey.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_get_pubkey.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_get_pubkey.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_get_pubkey.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_get_serialNumber.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_get_serialNumber.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_get_serialNumber.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_get_serialNumber.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_get_subject_name.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_get_subject_name.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_get_subject_name.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_get_subject_name.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_get_version.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_get_version.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_get_version.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_get_version.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_new.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_new.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_new.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_new.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_sign.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_sign.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_sign.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_sign.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509_verify_cert.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_verify_cert.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509_verify_cert.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509_verify_cert.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/X509v3_get_ext_by_NID.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509v3_get_ext_by_NID.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/X509v3_get_ext_by_NID.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/X509v3_get_ext_by_NID.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/d2i_DHparams.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/d2i_DHparams.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/d2i_DHparams.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/d2i_DHparams.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/d2i_PKCS8PrivateKey_bio.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/d2i_PKCS8PrivateKey_bio.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/d2i_PKCS8PrivateKey_bio.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/d2i_PKCS8PrivateKey_bio.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/d2i_PrivateKey.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/d2i_PrivateKey.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/d2i_PrivateKey.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/d2i_PrivateKey.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/d2i_SSL_SESSION.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/d2i_SSL_SESSION.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/d2i_SSL_SESSION.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/d2i_SSL_SESSION.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/d2i_X509.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/d2i_X509.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/d2i_X509.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/d2i_X509.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/i2d_CMS_bio_stream.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/i2d_CMS_bio_stream.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/i2d_CMS_bio_stream.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/i2d_CMS_bio_stream.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/i2d_PKCS7_bio_stream.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/i2d_PKCS7_bio_stream.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/i2d_PKCS7_bio_stream.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/i2d_PKCS7_bio_stream.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/i2d_re_X509_tbs.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/i2d_re_X509_tbs.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/i2d_re_X509_tbs.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/i2d_re_X509_tbs.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man3/o2i_SCT_LIST.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man3/o2i_SCT_LIST.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man3/o2i_SCT_LIST.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man3/o2i_SCT_LIST.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man5/config.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man5/config.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man5/config.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man5/config.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man5/x509v3_config.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man5/x509v3_config.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man5/x509v3_config.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man5/x509v3_config.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/Ed25519.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/Ed25519.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/Ed25519.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/Ed25519.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/RAND.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/RAND.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/RAND.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/RAND.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/RAND_DRBG.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/RAND_DRBG.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/RAND_DRBG.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/RAND_DRBG.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/RSA-PSS.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/RSA-PSS.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/RSA-PSS.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/RSA-PSS.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/SM2.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/SM2.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/SM2.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/SM2.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/X25519.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/X25519.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/X25519.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/X25519.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/bio.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/bio.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/bio.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/bio.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/crypto.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/crypto.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/crypto.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/crypto.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/ct.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/ct.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/ct.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/ct.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/des_modes.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/des_modes.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/des_modes.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/des_modes.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/evp.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/evp.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/evp.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/evp.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/ossl_store-file.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/ossl_store-file.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/ossl_store-file.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/ossl_store-file.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/ossl_store.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/ossl_store.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/ossl_store.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/ossl_store.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/passphrase-encoding.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/passphrase-encoding.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/passphrase-encoding.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/passphrase-encoding.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/proxy-certificates.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/proxy-certificates.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/proxy-certificates.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/proxy-certificates.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/scrypt.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/scrypt.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/scrypt.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/scrypt.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/ssl.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/ssl.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/ssl.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/ssl.pod diff --git a/src/openssl/openssl-1.1.1w/doc/man7/x509.pod b/src/openssl/openssl-1.1.1w-chevah2/doc/man7/x509.pod similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/man7/x509.pod rename to src/openssl/openssl-1.1.1w-chevah2/doc/man7/x509.pod diff --git a/src/openssl/openssl-1.1.1w/doc/openssl-c-indent.el b/src/openssl/openssl-1.1.1w-chevah2/doc/openssl-c-indent.el similarity index 100% rename from src/openssl/openssl-1.1.1w/doc/openssl-c-indent.el rename to src/openssl/openssl-1.1.1w-chevah2/doc/openssl-c-indent.el diff --git a/src/openssl/openssl-1.1.1w/e_os.h b/src/openssl/openssl-1.1.1w-chevah2/e_os.h similarity index 100% rename from src/openssl/openssl-1.1.1w/e_os.h rename to src/openssl/openssl-1.1.1w-chevah2/e_os.h diff --git a/src/openssl/openssl-1.1.1w/engines/asm/e_padlock-x86.pl b/src/openssl/openssl-1.1.1w-chevah2/engines/asm/e_padlock-x86.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/asm/e_padlock-x86.pl rename to src/openssl/openssl-1.1.1w-chevah2/engines/asm/e_padlock-x86.pl diff --git a/src/openssl/openssl-1.1.1w/engines/asm/e_padlock-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/engines/asm/e_padlock-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/asm/e_padlock-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/engines/asm/e_padlock-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/engines/build.info b/src/openssl/openssl-1.1.1w-chevah2/engines/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/build.info rename to src/openssl/openssl-1.1.1w-chevah2/engines/build.info diff --git a/src/openssl/openssl-1.1.1w/engines/e_afalg.c b/src/openssl/openssl-1.1.1w-chevah2/engines/e_afalg.c similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_afalg.c rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_afalg.c diff --git a/src/openssl/openssl-1.1.1w/engines/e_afalg.ec b/src/openssl/openssl-1.1.1w-chevah2/engines/e_afalg.ec similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_afalg.ec rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_afalg.ec diff --git a/src/openssl/openssl-1.1.1w/engines/e_afalg.h b/src/openssl/openssl-1.1.1w-chevah2/engines/e_afalg.h similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_afalg.h rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_afalg.h diff --git a/src/openssl/openssl-1.1.1w/engines/e_afalg.txt b/src/openssl/openssl-1.1.1w-chevah2/engines/e_afalg.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_afalg.txt rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_afalg.txt diff --git a/src/openssl/openssl-1.1.1w/engines/e_afalg_err.c b/src/openssl/openssl-1.1.1w-chevah2/engines/e_afalg_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_afalg_err.c rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_afalg_err.c diff --git a/src/openssl/openssl-1.1.1w/engines/e_afalg_err.h b/src/openssl/openssl-1.1.1w-chevah2/engines/e_afalg_err.h similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_afalg_err.h rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_afalg_err.h diff --git a/src/openssl/openssl-1.1.1w/engines/e_capi.c b/src/openssl/openssl-1.1.1w-chevah2/engines/e_capi.c similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_capi.c rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_capi.c diff --git a/src/openssl/openssl-1.1.1w/engines/e_capi.ec b/src/openssl/openssl-1.1.1w-chevah2/engines/e_capi.ec similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_capi.ec rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_capi.ec diff --git a/src/openssl/openssl-1.1.1w/engines/e_capi.txt b/src/openssl/openssl-1.1.1w-chevah2/engines/e_capi.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_capi.txt rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_capi.txt diff --git a/src/openssl/openssl-1.1.1w/engines/e_capi_err.c b/src/openssl/openssl-1.1.1w-chevah2/engines/e_capi_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_capi_err.c rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_capi_err.c diff --git a/src/openssl/openssl-1.1.1w/engines/e_capi_err.h b/src/openssl/openssl-1.1.1w-chevah2/engines/e_capi_err.h similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_capi_err.h rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_capi_err.h diff --git a/src/openssl/openssl-1.1.1w/engines/e_dasync.c b/src/openssl/openssl-1.1.1w-chevah2/engines/e_dasync.c similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_dasync.c rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_dasync.c diff --git a/src/openssl/openssl-1.1.1w/engines/e_dasync.ec b/src/openssl/openssl-1.1.1w-chevah2/engines/e_dasync.ec similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_dasync.ec rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_dasync.ec diff --git a/src/openssl/openssl-1.1.1w/engines/e_dasync.txt b/src/openssl/openssl-1.1.1w-chevah2/engines/e_dasync.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_dasync.txt rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_dasync.txt diff --git a/src/openssl/openssl-1.1.1w/engines/e_dasync_err.c b/src/openssl/openssl-1.1.1w-chevah2/engines/e_dasync_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_dasync_err.c rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_dasync_err.c diff --git a/src/openssl/openssl-1.1.1w/engines/e_dasync_err.h b/src/openssl/openssl-1.1.1w-chevah2/engines/e_dasync_err.h similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_dasync_err.h rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_dasync_err.h diff --git a/src/openssl/openssl-1.1.1w/engines/e_ossltest.c b/src/openssl/openssl-1.1.1w-chevah2/engines/e_ossltest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_ossltest.c rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_ossltest.c diff --git a/src/openssl/openssl-1.1.1w/engines/e_ossltest.ec b/src/openssl/openssl-1.1.1w-chevah2/engines/e_ossltest.ec similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_ossltest.ec rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_ossltest.ec diff --git a/src/openssl/openssl-1.1.1w/engines/e_ossltest.txt b/src/openssl/openssl-1.1.1w-chevah2/engines/e_ossltest.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_ossltest.txt rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_ossltest.txt diff --git a/src/openssl/openssl-1.1.1w/engines/e_ossltest_err.c b/src/openssl/openssl-1.1.1w-chevah2/engines/e_ossltest_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_ossltest_err.c rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_ossltest_err.c diff --git a/src/openssl/openssl-1.1.1w/engines/e_ossltest_err.h b/src/openssl/openssl-1.1.1w-chevah2/engines/e_ossltest_err.h similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_ossltest_err.h rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_ossltest_err.h diff --git a/src/openssl/openssl-1.1.1w/engines/e_padlock.c b/src/openssl/openssl-1.1.1w-chevah2/engines/e_padlock.c similarity index 100% rename from src/openssl/openssl-1.1.1w/engines/e_padlock.c rename to src/openssl/openssl-1.1.1w-chevah2/engines/e_padlock.c diff --git a/src/openssl/openssl-1.1.1w/external/perl/Downloaded.txt b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Downloaded.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Downloaded.txt rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Downloaded.txt diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/Artistic b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/Artistic similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/Artistic rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/Artistic diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/COPYING b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/COPYING similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/COPYING rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/COPYING diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/INSTALL b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/INSTALL similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/INSTALL rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/INSTALL diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/MANIFEST b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/MANIFEST similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/MANIFEST rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/MANIFEST diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/META.json b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/META.json similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/META.json rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/META.json diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/META.yml b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/META.yml similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/META.yml rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/META.yml diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/Makefile.PL b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/Makefile.PL similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/Makefile.PL rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/Makefile.PL diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/README b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/README similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/README rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/README diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/lib/Text/Template.pm b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/lib/Text/Template.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/lib/Text/Template.pm rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/lib/Text/Template.pm diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/lib/Text/Template/Preprocess.pm b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/lib/Text/Template/Preprocess.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/lib/Text/Template/Preprocess.pm rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/lib/Text/Template/Preprocess.pm diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/00-version.t b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/00-version.t similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/00-version.t rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/00-version.t diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/01-basic.t b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/01-basic.t similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/01-basic.t rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/01-basic.t diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/02-hash.t b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/02-hash.t similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/02-hash.t rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/02-hash.t diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/03-out.t b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/03-out.t similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/03-out.t rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/03-out.t diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/04-safe.t b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/04-safe.t similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/04-safe.t rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/04-safe.t diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/05-safe2.t b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/05-safe2.t similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/05-safe2.t rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/05-safe2.t diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/06-ofh.t b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/06-ofh.t similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/06-ofh.t rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/06-ofh.t diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/07-safe3.t b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/07-safe3.t similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/07-safe3.t rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/07-safe3.t diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/08-exported.t b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/08-exported.t similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/08-exported.t rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/08-exported.t diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/09-error.t b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/09-error.t similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/09-error.t rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/09-error.t diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/10-delimiters.t b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/10-delimiters.t similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/10-delimiters.t rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/10-delimiters.t diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/11-prepend.t b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/11-prepend.t similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/11-prepend.t rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/11-prepend.t diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/12-preprocess.t b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/12-preprocess.t similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/12-preprocess.t rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/12-preprocess.t diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/13-taint.t b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/13-taint.t similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/13-taint.t rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/13-taint.t diff --git a/src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/14-broken.t b/src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/14-broken.t similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/Text-Template-1.46/t/14-broken.t rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/Text-Template-1.46/t/14-broken.t diff --git a/src/openssl/openssl-1.1.1w/external/perl/transfer/Text/Template.pm b/src/openssl/openssl-1.1.1w-chevah2/external/perl/transfer/Text/Template.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/external/perl/transfer/Text/Template.pm rename to src/openssl/openssl-1.1.1w-chevah2/external/perl/transfer/Text/Template.pm diff --git a/src/openssl/openssl-1.1.1w/fuzz/README.md b/src/openssl/openssl-1.1.1w-chevah2/fuzz/README.md similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/README.md rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/README.md diff --git a/src/openssl/openssl-1.1.1w/fuzz/asn1.c b/src/openssl/openssl-1.1.1w-chevah2/fuzz/asn1.c similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/asn1.c rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/asn1.c diff --git a/src/openssl/openssl-1.1.1w/fuzz/asn1parse.c b/src/openssl/openssl-1.1.1w-chevah2/fuzz/asn1parse.c similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/asn1parse.c rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/asn1parse.c diff --git a/src/openssl/openssl-1.1.1w/fuzz/bignum.c b/src/openssl/openssl-1.1.1w-chevah2/fuzz/bignum.c similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/bignum.c rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/bignum.c diff --git a/src/openssl/openssl-1.1.1w/fuzz/bndiv.c b/src/openssl/openssl-1.1.1w-chevah2/fuzz/bndiv.c similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/bndiv.c rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/bndiv.c diff --git a/src/openssl/openssl-1.1.1w/fuzz/build.info b/src/openssl/openssl-1.1.1w-chevah2/fuzz/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/build.info rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/build.info diff --git a/src/openssl/openssl-1.1.1w/fuzz/client.c b/src/openssl/openssl-1.1.1w-chevah2/fuzz/client.c similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/client.c rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/client.c diff --git a/src/openssl/openssl-1.1.1w/fuzz/cms.c b/src/openssl/openssl-1.1.1w-chevah2/fuzz/cms.c similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/cms.c rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/cms.c diff --git a/src/openssl/openssl-1.1.1w/fuzz/conf.c b/src/openssl/openssl-1.1.1w-chevah2/fuzz/conf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/conf.c rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/conf.c diff --git a/src/openssl/openssl-1.1.1w/fuzz/crl.c b/src/openssl/openssl-1.1.1w-chevah2/fuzz/crl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/crl.c rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/crl.c diff --git a/src/openssl/openssl-1.1.1w/fuzz/ct.c b/src/openssl/openssl-1.1.1w-chevah2/fuzz/ct.c similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/ct.c rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/ct.c diff --git a/src/openssl/openssl-1.1.1w/fuzz/driver.c b/src/openssl/openssl-1.1.1w-chevah2/fuzz/driver.c similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/driver.c rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/driver.c diff --git a/src/openssl/openssl-1.1.1w/fuzz/fuzzer.h b/src/openssl/openssl-1.1.1w-chevah2/fuzz/fuzzer.h similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/fuzzer.h rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/fuzzer.h diff --git a/src/openssl/openssl-1.1.1w/fuzz/helper.py b/src/openssl/openssl-1.1.1w-chevah2/fuzz/helper.py similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/helper.py rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/helper.py diff --git a/src/openssl/openssl-1.1.1w/fuzz/mkfuzzoids.pl b/src/openssl/openssl-1.1.1w-chevah2/fuzz/mkfuzzoids.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/mkfuzzoids.pl rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/mkfuzzoids.pl diff --git a/src/openssl/openssl-1.1.1w/fuzz/oids.txt b/src/openssl/openssl-1.1.1w-chevah2/fuzz/oids.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/oids.txt rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/oids.txt diff --git a/src/openssl/openssl-1.1.1w/fuzz/rand.inc b/src/openssl/openssl-1.1.1w-chevah2/fuzz/rand.inc similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/rand.inc rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/rand.inc diff --git a/src/openssl/openssl-1.1.1w/fuzz/server.c b/src/openssl/openssl-1.1.1w-chevah2/fuzz/server.c similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/server.c rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/server.c diff --git a/src/openssl/openssl-1.1.1w/fuzz/test-corpus.c b/src/openssl/openssl-1.1.1w-chevah2/fuzz/test-corpus.c similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/test-corpus.c rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/test-corpus.c diff --git a/src/openssl/openssl-1.1.1w/fuzz/x509.c b/src/openssl/openssl-1.1.1w-chevah2/fuzz/x509.c similarity index 100% rename from src/openssl/openssl-1.1.1w/fuzz/x509.c rename to src/openssl/openssl-1.1.1w-chevah2/fuzz/x509.c diff --git a/src/openssl/openssl-1.1.1w/include/crypto/__DECC_INCLUDE_EPILOGUE.H b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/__DECC_INCLUDE_EPILOGUE.H similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/__DECC_INCLUDE_EPILOGUE.H rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/__DECC_INCLUDE_EPILOGUE.H diff --git a/src/openssl/openssl-1.1.1w/include/crypto/__DECC_INCLUDE_PROLOGUE.H b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/__DECC_INCLUDE_PROLOGUE.H similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/__DECC_INCLUDE_PROLOGUE.H rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/__DECC_INCLUDE_PROLOGUE.H diff --git a/src/openssl/openssl-1.1.1w/include/crypto/aria.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/aria.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/aria.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/aria.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/asn1.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/asn1.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/asn1.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/asn1.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/async.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/async.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/async.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/async.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/bn.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/bn.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/bn.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/bn.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/bn_conf.h.in b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/bn_conf.h.in similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/bn_conf.h.in rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/bn_conf.h.in diff --git a/src/openssl/openssl-1.1.1w/include/crypto/bn_dh.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/bn_dh.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/bn_dh.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/bn_dh.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/bn_srp.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/bn_srp.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/bn_srp.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/bn_srp.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/chacha.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/chacha.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/chacha.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/chacha.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/cryptlib.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/cryptlib.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/cryptlib.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/cryptlib.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/ctype.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/ctype.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/ctype.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/ctype.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/dso_conf.h.in b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/dso_conf.h.in similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/dso_conf.h.in rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/dso_conf.h.in diff --git a/src/openssl/openssl-1.1.1w/include/crypto/ec.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/ec.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/ec.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/ec.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/engine.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/engine.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/engine.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/engine.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/err.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/err.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/err.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/err.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/evp.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/evp.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/evp.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/evp.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/lhash.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/lhash.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/lhash.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/lhash.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/md32_common.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/md32_common.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/md32_common.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/md32_common.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/objects.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/objects.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/objects.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/objects.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/poly1305.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/poly1305.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/poly1305.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/poly1305.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/rand.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/rand.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/rand.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/rand.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/sha.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/sha.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/sha.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/sha.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/siphash.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/siphash.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/siphash.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/siphash.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/sm2.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/sm2.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/sm2.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/sm2.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/sm2err.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/sm2err.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/sm2err.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/sm2err.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/sm3.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/sm3.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/sm3.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/sm3.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/sm4.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/sm4.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/sm4.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/sm4.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/store.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/store.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/store.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/store.h diff --git a/src/openssl/openssl-1.1.1w/include/crypto/x509.h b/src/openssl/openssl-1.1.1w-chevah2/include/crypto/x509.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/crypto/x509.h rename to src/openssl/openssl-1.1.1w-chevah2/include/crypto/x509.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/__DECC_INCLUDE_EPILOGUE.H b/src/openssl/openssl-1.1.1w-chevah2/include/internal/__DECC_INCLUDE_EPILOGUE.H similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/__DECC_INCLUDE_EPILOGUE.H rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/__DECC_INCLUDE_EPILOGUE.H diff --git a/src/openssl/openssl-1.1.1w/include/internal/__DECC_INCLUDE_PROLOGUE.H b/src/openssl/openssl-1.1.1w-chevah2/include/internal/__DECC_INCLUDE_PROLOGUE.H similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/__DECC_INCLUDE_PROLOGUE.H rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/__DECC_INCLUDE_PROLOGUE.H diff --git a/src/openssl/openssl-1.1.1w/include/internal/bio.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/bio.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/bio.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/bio.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/comp.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/comp.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/comp.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/comp.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/conf.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/conf.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/conf.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/conf.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/constant_time.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/constant_time.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/constant_time.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/constant_time.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/cryptlib.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/cryptlib.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/cryptlib.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/cryptlib.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/dane.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/dane.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/dane.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/dane.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/dso.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/dso.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/dso.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/dso.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/dsoerr.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/dsoerr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/dsoerr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/dsoerr.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/err.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/err.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/err.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/err.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/nelem.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/nelem.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/nelem.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/nelem.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/numbers.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/numbers.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/numbers.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/numbers.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/o_dir.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/o_dir.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/o_dir.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/o_dir.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/o_str.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/o_str.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/o_str.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/o_str.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/refcount.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/refcount.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/refcount.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/refcount.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/sockets.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/sockets.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/sockets.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/sockets.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/sslconf.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/sslconf.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/sslconf.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/sslconf.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/thread_once.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/thread_once.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/thread_once.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/thread_once.h diff --git a/src/openssl/openssl-1.1.1w/include/internal/tsan_assist.h b/src/openssl/openssl-1.1.1w-chevah2/include/internal/tsan_assist.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/internal/tsan_assist.h rename to src/openssl/openssl-1.1.1w-chevah2/include/internal/tsan_assist.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/__DECC_INCLUDE_EPILOGUE.H b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/__DECC_INCLUDE_EPILOGUE.H similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/__DECC_INCLUDE_EPILOGUE.H rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/__DECC_INCLUDE_EPILOGUE.H diff --git a/src/openssl/openssl-1.1.1w/include/openssl/__DECC_INCLUDE_PROLOGUE.H b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/__DECC_INCLUDE_PROLOGUE.H similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/__DECC_INCLUDE_PROLOGUE.H rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/__DECC_INCLUDE_PROLOGUE.H diff --git a/src/openssl/openssl-1.1.1w/include/openssl/aes.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/aes.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/aes.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/aes.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/asn1.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/asn1.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/asn1.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/asn1.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/asn1_mac.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/asn1_mac.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/asn1_mac.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/asn1_mac.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/asn1err.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/asn1err.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/asn1err.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/asn1err.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/asn1t.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/asn1t.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/asn1t.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/asn1t.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/async.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/async.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/async.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/async.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/asyncerr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/asyncerr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/asyncerr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/asyncerr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/bio.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/bio.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/bio.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/bio.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/bioerr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/bioerr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/bioerr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/bioerr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/blowfish.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/blowfish.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/blowfish.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/blowfish.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/bn.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/bn.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/bn.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/bn.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/bnerr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/bnerr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/bnerr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/bnerr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/buffer.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/buffer.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/buffer.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/buffer.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/buffererr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/buffererr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/buffererr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/buffererr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/camellia.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/camellia.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/camellia.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/camellia.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/cast.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/cast.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/cast.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/cast.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/cmac.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/cmac.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/cmac.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/cmac.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/cms.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/cms.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/cms.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/cms.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/cmserr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/cmserr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/cmserr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/cmserr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/comp.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/comp.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/comp.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/comp.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/comperr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/comperr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/comperr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/comperr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/conf.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/conf.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/conf.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/conf.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/conf_api.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/conf_api.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/conf_api.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/conf_api.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/conferr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/conferr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/conferr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/conferr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/crypto.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/crypto.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/crypto.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/crypto.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/cryptoerr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/cryptoerr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/cryptoerr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/cryptoerr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/ct.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/ct.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/ct.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/ct.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/cterr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/cterr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/cterr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/cterr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/des.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/des.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/des.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/des.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/dh.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/dh.h similarity index 98% rename from src/openssl/openssl-1.1.1w/include/openssl/dh.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/dh.h index 6c6ff3636..d2a9c0d34 100644 --- a/src/openssl/openssl-1.1.1w/include/openssl/dh.h +++ b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/dh.h @@ -71,14 +71,16 @@ DECLARE_ASN1_ITEM(DHparams) /* #define DH_GENERATOR_3 3 */ # define DH_GENERATOR_5 5 -/* DH_check error codes */ +/* DH_check error codes, some of them shared with DH_check_pub_key */ # define DH_CHECK_P_NOT_PRIME 0x01 # define DH_CHECK_P_NOT_SAFE_PRIME 0x02 # define DH_UNABLE_TO_CHECK_GENERATOR 0x04 # define DH_NOT_SUITABLE_GENERATOR 0x08 # define DH_CHECK_Q_NOT_PRIME 0x10 -# define DH_CHECK_INVALID_Q_VALUE 0x20 +# define DH_CHECK_INVALID_Q_VALUE 0x20 /* +DH_check_pub_key */ # define DH_CHECK_INVALID_J_VALUE 0x40 +# define DH_MODULUS_TOO_SMALL 0x80 +# define DH_MODULUS_TOO_LARGE 0x100 /* +DH_check_pub_key */ /* DH_check_pub_key error codes */ # define DH_CHECK_PUBKEY_TOO_SMALL 0x01 diff --git a/src/openssl/openssl-1.1.1w/include/openssl/dherr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/dherr.h similarity index 98% rename from src/openssl/openssl-1.1.1w/include/openssl/dherr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/dherr.h index 528c81985..d66c35aa8 100644 --- a/src/openssl/openssl-1.1.1w/include/openssl/dherr.h +++ b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/dherr.h @@ -82,6 +82,7 @@ int ERR_load_DH_strings(void); # define DH_R_NO_PRIVATE_VALUE 100 # define DH_R_PARAMETER_ENCODING_ERROR 105 # define DH_R_PEER_KEY_ERROR 111 +# define DH_R_Q_TOO_LARGE 130 # define DH_R_SHARED_INFO_ERROR 113 # define DH_R_UNABLE_TO_CHECK_GENERATOR 121 diff --git a/src/openssl/openssl-1.1.1w/include/openssl/dsa.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/dsa.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/dsa.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/dsa.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/dsaerr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/dsaerr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/dsaerr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/dsaerr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/dtls1.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/dtls1.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/dtls1.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/dtls1.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/e_os2.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/e_os2.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/e_os2.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/e_os2.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/ebcdic.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/ebcdic.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/ebcdic.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/ebcdic.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/ec.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/ec.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/ec.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/ec.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/ecdh.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/ecdh.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/ecdh.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/ecdh.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/ecdsa.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/ecdsa.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/ecdsa.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/ecdsa.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/ecerr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/ecerr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/ecerr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/ecerr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/engine.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/engine.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/engine.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/engine.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/engineerr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/engineerr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/engineerr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/engineerr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/err.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/err.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/err.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/err.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/evp.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/evp.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/evp.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/evp.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/evperr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/evperr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/evperr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/evperr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/hmac.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/hmac.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/hmac.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/hmac.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/idea.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/idea.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/idea.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/idea.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/kdf.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/kdf.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/kdf.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/kdf.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/kdferr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/kdferr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/kdferr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/kdferr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/lhash.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/lhash.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/lhash.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/lhash.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/md2.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/md2.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/md2.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/md2.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/md4.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/md4.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/md4.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/md4.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/md5.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/md5.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/md5.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/md5.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/mdc2.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/mdc2.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/mdc2.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/mdc2.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/modes.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/modes.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/modes.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/modes.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/obj_mac.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/obj_mac.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/obj_mac.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/obj_mac.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/objects.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/objects.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/objects.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/objects.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/objectserr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/objectserr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/objectserr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/objectserr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/ocsp.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/ocsp.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/ocsp.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/ocsp.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/ocsperr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/ocsperr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/ocsperr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/ocsperr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/opensslconf.h.in b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/opensslconf.h.in similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/opensslconf.h.in rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/opensslconf.h.in diff --git a/src/openssl/openssl-1.1.1w/include/openssl/opensslv.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/opensslv.h similarity index 98% rename from src/openssl/openssl-1.1.1w/include/openssl/opensslv.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/opensslv.h index 5667d4712..c190518b6 100644 --- a/src/openssl/openssl-1.1.1w/include/openssl/opensslv.h +++ b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/opensslv.h @@ -40,7 +40,7 @@ extern "C" { * major minor fix final patch/beta) */ # define OPENSSL_VERSION_NUMBER 0x1010117fL -# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1w 11 Sep 2023" +# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.1w-chevah2 15 Aug 2024" /*- * The macros below are to be used for shared library (.so, .dll, ...) diff --git a/src/openssl/openssl-1.1.1w/include/openssl/ossl_typ.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/ossl_typ.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/ossl_typ.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/ossl_typ.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/pem.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/pem.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/pem.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/pem.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/pem2.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/pem2.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/pem2.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/pem2.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/pemerr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/pemerr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/pemerr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/pemerr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/pkcs12.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/pkcs12.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/pkcs12.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/pkcs12.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/pkcs12err.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/pkcs12err.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/pkcs12err.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/pkcs12err.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/pkcs7.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/pkcs7.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/pkcs7.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/pkcs7.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/pkcs7err.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/pkcs7err.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/pkcs7err.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/pkcs7err.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/rand.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/rand.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/rand.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/rand.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/rand_drbg.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/rand_drbg.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/rand_drbg.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/rand_drbg.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/randerr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/randerr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/randerr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/randerr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/rc2.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/rc2.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/rc2.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/rc2.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/rc4.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/rc4.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/rc4.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/rc4.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/rc5.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/rc5.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/rc5.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/rc5.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/ripemd.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/ripemd.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/ripemd.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/ripemd.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/rsa.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/rsa.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/rsa.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/rsa.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/rsaerr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/rsaerr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/rsaerr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/rsaerr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/safestack.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/safestack.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/safestack.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/safestack.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/seed.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/seed.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/seed.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/seed.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/sha.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/sha.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/sha.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/sha.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/srp.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/srp.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/srp.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/srp.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/srtp.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/srtp.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/srtp.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/srtp.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/ssl.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/ssl.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/ssl.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/ssl.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/ssl2.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/ssl2.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/ssl2.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/ssl2.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/ssl3.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/ssl3.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/ssl3.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/ssl3.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/sslerr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/sslerr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/sslerr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/sslerr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/stack.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/stack.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/stack.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/stack.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/store.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/store.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/store.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/store.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/storeerr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/storeerr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/storeerr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/storeerr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/symhacks.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/symhacks.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/symhacks.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/symhacks.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/tls1.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/tls1.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/tls1.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/tls1.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/ts.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/ts.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/ts.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/ts.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/tserr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/tserr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/tserr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/tserr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/txt_db.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/txt_db.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/txt_db.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/txt_db.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/ui.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/ui.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/ui.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/ui.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/uierr.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/uierr.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/uierr.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/uierr.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/whrlpool.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/whrlpool.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/whrlpool.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/whrlpool.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/x509.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/x509.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/x509.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/x509.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/x509_vfy.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/x509_vfy.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/x509_vfy.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/x509_vfy.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/x509err.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/x509err.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/x509err.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/x509err.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/x509v3.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/x509v3.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/x509v3.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/x509v3.h diff --git a/src/openssl/openssl-1.1.1w/include/openssl/x509v3err.h b/src/openssl/openssl-1.1.1w-chevah2/include/openssl/x509v3err.h similarity index 100% rename from src/openssl/openssl-1.1.1w/include/openssl/x509v3err.h rename to src/openssl/openssl-1.1.1w-chevah2/include/openssl/x509v3err.h diff --git a/src/openssl/openssl-1.1.1w/ms/applink.c b/src/openssl/openssl-1.1.1w-chevah2/ms/applink.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ms/applink.c rename to src/openssl/openssl-1.1.1w-chevah2/ms/applink.c diff --git a/src/openssl/openssl-1.1.1w/ms/cmp.pl b/src/openssl/openssl-1.1.1w-chevah2/ms/cmp.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/ms/cmp.pl rename to src/openssl/openssl-1.1.1w-chevah2/ms/cmp.pl diff --git a/src/openssl/openssl-1.1.1w/ms/uplink-common.pl b/src/openssl/openssl-1.1.1w-chevah2/ms/uplink-common.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/ms/uplink-common.pl rename to src/openssl/openssl-1.1.1w-chevah2/ms/uplink-common.pl diff --git a/src/openssl/openssl-1.1.1w/ms/uplink-ia64.pl b/src/openssl/openssl-1.1.1w-chevah2/ms/uplink-ia64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/ms/uplink-ia64.pl rename to src/openssl/openssl-1.1.1w-chevah2/ms/uplink-ia64.pl diff --git a/src/openssl/openssl-1.1.1w/ms/uplink-x86.pl b/src/openssl/openssl-1.1.1w-chevah2/ms/uplink-x86.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/ms/uplink-x86.pl rename to src/openssl/openssl-1.1.1w-chevah2/ms/uplink-x86.pl diff --git a/src/openssl/openssl-1.1.1w/ms/uplink-x86_64.pl b/src/openssl/openssl-1.1.1w-chevah2/ms/uplink-x86_64.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/ms/uplink-x86_64.pl rename to src/openssl/openssl-1.1.1w-chevah2/ms/uplink-x86_64.pl diff --git a/src/openssl/openssl-1.1.1w/ms/uplink.c b/src/openssl/openssl-1.1.1w-chevah2/ms/uplink.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ms/uplink.c rename to src/openssl/openssl-1.1.1w-chevah2/ms/uplink.c diff --git a/src/openssl/openssl-1.1.1w/ms/uplink.h b/src/openssl/openssl-1.1.1w-chevah2/ms/uplink.h similarity index 100% rename from src/openssl/openssl-1.1.1w/ms/uplink.h rename to src/openssl/openssl-1.1.1w-chevah2/ms/uplink.h diff --git a/src/openssl/openssl-1.1.1w/os-dep/haiku.h b/src/openssl/openssl-1.1.1w-chevah2/os-dep/haiku.h similarity index 100% rename from src/openssl/openssl-1.1.1w/os-dep/haiku.h rename to src/openssl/openssl-1.1.1w-chevah2/os-dep/haiku.h diff --git a/src/openssl/openssl-1.1.1w/ssl/bio_ssl.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/bio_ssl.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/bio_ssl.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/bio_ssl.c diff --git a/src/openssl/openssl-1.1.1w/ssl/build.info b/src/openssl/openssl-1.1.1w-chevah2/ssl/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/build.info rename to src/openssl/openssl-1.1.1w-chevah2/ssl/build.info diff --git a/src/openssl/openssl-1.1.1w/ssl/d1_lib.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/d1_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/d1_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/d1_lib.c diff --git a/src/openssl/openssl-1.1.1w/ssl/d1_msg.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/d1_msg.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/d1_msg.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/d1_msg.c diff --git a/src/openssl/openssl-1.1.1w/ssl/d1_srtp.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/d1_srtp.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/d1_srtp.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/d1_srtp.c diff --git a/src/openssl/openssl-1.1.1w/ssl/methods.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/methods.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/methods.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/methods.c diff --git a/src/openssl/openssl-1.1.1w/ssl/packet.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/packet.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/packet.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/packet.c diff --git a/src/openssl/openssl-1.1.1w/ssl/packet_local.h b/src/openssl/openssl-1.1.1w-chevah2/ssl/packet_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/packet_local.h rename to src/openssl/openssl-1.1.1w-chevah2/ssl/packet_local.h diff --git a/src/openssl/openssl-1.1.1w/ssl/pqueue.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/pqueue.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/pqueue.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/pqueue.c diff --git a/src/openssl/openssl-1.1.1w/ssl/record/README b/src/openssl/openssl-1.1.1w-chevah2/ssl/record/README similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/record/README rename to src/openssl/openssl-1.1.1w-chevah2/ssl/record/README diff --git a/src/openssl/openssl-1.1.1w/ssl/record/dtls1_bitmap.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/record/dtls1_bitmap.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/record/dtls1_bitmap.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/record/dtls1_bitmap.c diff --git a/src/openssl/openssl-1.1.1w/ssl/record/rec_layer_d1.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/record/rec_layer_d1.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/record/rec_layer_d1.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/record/rec_layer_d1.c diff --git a/src/openssl/openssl-1.1.1w/ssl/record/rec_layer_s3.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/record/rec_layer_s3.c similarity index 99% rename from src/openssl/openssl-1.1.1w/ssl/record/rec_layer_s3.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/record/rec_layer_s3.c index 1db1712a0..525c3abf4 100644 --- a/src/openssl/openssl-1.1.1w/ssl/record/rec_layer_s3.c +++ b/src/openssl/openssl-1.1.1w-chevah2/ssl/record/rec_layer_s3.c @@ -81,6 +81,15 @@ int RECORD_LAYER_read_pending(const RECORD_LAYER *rl) return SSL3_BUFFER_get_left(&rl->rbuf) != 0; } +int RECORD_LAYER_data_present(const RECORD_LAYER *rl) +{ + if (rl->rstate == SSL_ST_READ_BODY) + return 1; + if (RECORD_LAYER_processed_read_pending(rl)) + return 1; + return 0; +} + /* Checks if we have decrypted unread record data pending */ int RECORD_LAYER_processed_read_pending(const RECORD_LAYER *rl) { diff --git a/src/openssl/openssl-1.1.1w/ssl/record/record.h b/src/openssl/openssl-1.1.1w-chevah2/ssl/record/record.h similarity index 99% rename from src/openssl/openssl-1.1.1w/ssl/record/record.h rename to src/openssl/openssl-1.1.1w-chevah2/ssl/record/record.h index af56206e0..513ab3988 100644 --- a/src/openssl/openssl-1.1.1w/ssl/record/record.h +++ b/src/openssl/openssl-1.1.1w-chevah2/ssl/record/record.h @@ -197,6 +197,7 @@ void RECORD_LAYER_release(RECORD_LAYER *rl); int RECORD_LAYER_read_pending(const RECORD_LAYER *rl); int RECORD_LAYER_processed_read_pending(const RECORD_LAYER *rl); int RECORD_LAYER_write_pending(const RECORD_LAYER *rl); +int RECORD_LAYER_data_present(const RECORD_LAYER *rl); void RECORD_LAYER_reset_read_sequence(RECORD_LAYER *rl); void RECORD_LAYER_reset_write_sequence(RECORD_LAYER *rl); int RECORD_LAYER_is_sslv2_record(RECORD_LAYER *rl); diff --git a/src/openssl/openssl-1.1.1w/ssl/record/record_local.h b/src/openssl/openssl-1.1.1w-chevah2/ssl/record/record_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/record/record_local.h rename to src/openssl/openssl-1.1.1w-chevah2/ssl/record/record_local.h diff --git a/src/openssl/openssl-1.1.1w/ssl/record/ssl3_buffer.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/record/ssl3_buffer.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/record/ssl3_buffer.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/record/ssl3_buffer.c diff --git a/src/openssl/openssl-1.1.1w/ssl/record/ssl3_record.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/record/ssl3_record.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/record/ssl3_record.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/record/ssl3_record.c diff --git a/src/openssl/openssl-1.1.1w/ssl/record/ssl3_record_tls13.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/record/ssl3_record_tls13.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/record/ssl3_record_tls13.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/record/ssl3_record_tls13.c diff --git a/src/openssl/openssl-1.1.1w/ssl/s3_cbc.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/s3_cbc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/s3_cbc.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/s3_cbc.c diff --git a/src/openssl/openssl-1.1.1w/ssl/s3_enc.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/s3_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/s3_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/s3_enc.c diff --git a/src/openssl/openssl-1.1.1w/ssl/s3_lib.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/s3_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/s3_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/s3_lib.c diff --git a/src/openssl/openssl-1.1.1w/ssl/s3_msg.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/s3_msg.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/s3_msg.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/s3_msg.c diff --git a/src/openssl/openssl-1.1.1w/ssl/ssl_asn1.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_asn1.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/ssl_asn1.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_asn1.c diff --git a/src/openssl/openssl-1.1.1w/ssl/ssl_cert.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_cert.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/ssl_cert.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_cert.c diff --git a/src/openssl/openssl-1.1.1w/ssl/ssl_cert_table.h b/src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_cert_table.h similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/ssl_cert_table.h rename to src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_cert_table.h diff --git a/src/openssl/openssl-1.1.1w/ssl/ssl_ciph.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_ciph.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/ssl_ciph.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_ciph.c diff --git a/src/openssl/openssl-1.1.1w/ssl/ssl_conf.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_conf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/ssl_conf.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_conf.c diff --git a/src/openssl/openssl-1.1.1w/ssl/ssl_err.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_err.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/ssl_err.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_err.c diff --git a/src/openssl/openssl-1.1.1w/ssl/ssl_init.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_init.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/ssl_init.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_init.c diff --git a/src/openssl/openssl-1.1.1w/ssl/ssl_lib.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_lib.c similarity index 98% rename from src/openssl/openssl-1.1.1w/ssl/ssl_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_lib.c index 47adc3211..ccb1d4a0c 100644 --- a/src/openssl/openssl-1.1.1w/ssl/ssl_lib.c +++ b/src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_lib.c @@ -2761,37 +2761,54 @@ int SSL_select_next_proto(unsigned char **out, unsigned char *outlen, unsigned int server_len, const unsigned char *client, unsigned int client_len) { - unsigned int i, j; - const unsigned char *result; - int status = OPENSSL_NPN_UNSUPPORTED; + PACKET cpkt, csubpkt, spkt, ssubpkt; + + if (!PACKET_buf_init(&cpkt, client, client_len) + || !PACKET_get_length_prefixed_1(&cpkt, &csubpkt) + || PACKET_remaining(&csubpkt) == 0) { + *out = NULL; + *outlen = 0; + return OPENSSL_NPN_NO_OVERLAP; + } + + /* + * Set the default opportunistic protocol. Will be overwritten if we find + * a match. + */ + *out = (unsigned char *)PACKET_data(&csubpkt); + *outlen = (unsigned char)PACKET_remaining(&csubpkt); /* * For each protocol in server preference order, see if we support it. */ - for (i = 0; i < server_len;) { - for (j = 0; j < client_len;) { - if (server[i] == client[j] && - memcmp(&server[i + 1], &client[j + 1], server[i]) == 0) { - /* We found a match */ - result = &server[i]; - status = OPENSSL_NPN_NEGOTIATED; - goto found; + if (PACKET_buf_init(&spkt, server, server_len)) { + while (PACKET_get_length_prefixed_1(&spkt, &ssubpkt)) { + if (PACKET_remaining(&ssubpkt) == 0) + continue; /* Invalid - ignore it */ + if (PACKET_buf_init(&cpkt, client, client_len)) { + while (PACKET_get_length_prefixed_1(&cpkt, &csubpkt)) { + if (PACKET_equal(&csubpkt, PACKET_data(&ssubpkt), + PACKET_remaining(&ssubpkt))) { + /* We found a match */ + *out = (unsigned char *)PACKET_data(&ssubpkt); + *outlen = (unsigned char)PACKET_remaining(&ssubpkt); + return OPENSSL_NPN_NEGOTIATED; + } + } + /* Ignore spurious trailing bytes in the client list */ + } else { + /* This should never happen */ + return OPENSSL_NPN_NO_OVERLAP; } - j += client[j]; - j++; } - i += server[i]; - i++; + /* Ignore spurious trailing bytes in the server list */ } - /* There's no overlap between our protocols and the server's list. */ - result = client; - status = OPENSSL_NPN_NO_OVERLAP; - - found: - *out = (unsigned char *)result + 1; - *outlen = result[0]; - return status; + /* + * There's no overlap between our protocols and the server's list. We use + * the default opportunistic protocol selected earlier + */ + return OPENSSL_NPN_NO_OVERLAP; } #ifndef OPENSSL_NO_NEXTPROTONEG @@ -3515,9 +3532,10 @@ void ssl_update_cache(SSL *s, int mode) /* * If the session_id_length is 0, we are not supposed to cache it, and it - * would be rather hard to do anyway :-) + * would be rather hard to do anyway :-). Also if the session has already + * been marked as not_resumable we should not cache it for later reuse. */ - if (s->session->session_id_length == 0) + if (s->session->session_id_length == 0 || s->session->not_resumable) return; /* @@ -5247,6 +5265,9 @@ int SSL_free_buffers(SSL *ssl) if (RECORD_LAYER_read_pending(rl) || RECORD_LAYER_write_pending(rl)) return 0; + if (RECORD_LAYER_data_present(rl)) + return 0; + RECORD_LAYER_release(rl); return 1; } diff --git a/src/openssl/openssl-1.1.1w/ssl/ssl_local.h b/src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/ssl_local.h rename to src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_local.h diff --git a/src/openssl/openssl-1.1.1w/ssl/ssl_mcnf.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_mcnf.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/ssl_mcnf.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_mcnf.c diff --git a/src/openssl/openssl-1.1.1w/ssl/ssl_rsa.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_rsa.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/ssl_rsa.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_rsa.c diff --git a/src/openssl/openssl-1.1.1w/ssl/ssl_sess.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_sess.c similarity index 98% rename from src/openssl/openssl-1.1.1w/ssl/ssl_sess.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_sess.c index 68d1737ac..4c25e05d9 100644 --- a/src/openssl/openssl-1.1.1w/ssl/ssl_sess.c +++ b/src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_sess.c @@ -94,16 +94,11 @@ SSL_SESSION *SSL_SESSION_new(void) return ss; } -SSL_SESSION *SSL_SESSION_dup(SSL_SESSION *src) -{ - return ssl_session_dup(src, 1); -} - /* * Create a new SSL_SESSION and duplicate the contents of |src| into it. If * ticket == 0 then no ticket information is duplicated, otherwise it is. */ -SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket) +static SSL_SESSION *ssl_session_dup_intern(SSL_SESSION *src, int ticket) { SSL_SESSION *dest; @@ -226,6 +221,27 @@ SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket) return NULL; } +SSL_SESSION *SSL_SESSION_dup(SSL_SESSION *src) +{ + return ssl_session_dup_intern(src, 1); +} + +/* + * Used internally when duplicating a session which might be already shared. + * We will have resumed the original session. Subsequently we might have marked + * it as non-resumable (e.g. in another thread) - but this copy should be ok to + * resume from. + */ +SSL_SESSION *ssl_session_dup(SSL_SESSION *src, int ticket) +{ + SSL_SESSION *sess = ssl_session_dup_intern(src, ticket); + + if (sess != NULL) + sess->not_resumable = 0; + + return sess; +} + const unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, unsigned int *len) { if (len) diff --git a/src/openssl/openssl-1.1.1w/ssl/ssl_stat.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_stat.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/ssl_stat.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_stat.c diff --git a/src/openssl/openssl-1.1.1w/ssl/ssl_txt.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_txt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/ssl_txt.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_txt.c diff --git a/src/openssl/openssl-1.1.1w/ssl/ssl_utst.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_utst.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/ssl_utst.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/ssl_utst.c diff --git a/src/openssl/openssl-1.1.1w/ssl/statem/README b/src/openssl/openssl-1.1.1w-chevah2/ssl/statem/README similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/statem/README rename to src/openssl/openssl-1.1.1w-chevah2/ssl/statem/README diff --git a/src/openssl/openssl-1.1.1w/ssl/statem/extensions.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/statem/extensions.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/statem/extensions.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/statem/extensions.c diff --git a/src/openssl/openssl-1.1.1w/ssl/statem/extensions_clnt.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/statem/extensions_clnt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/statem/extensions_clnt.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/statem/extensions_clnt.c diff --git a/src/openssl/openssl-1.1.1w/ssl/statem/extensions_cust.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/statem/extensions_cust.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/statem/extensions_cust.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/statem/extensions_cust.c diff --git a/src/openssl/openssl-1.1.1w/ssl/statem/extensions_srvr.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/statem/extensions_srvr.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/statem/extensions_srvr.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/statem/extensions_srvr.c diff --git a/src/openssl/openssl-1.1.1w/ssl/statem/statem.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/statem/statem.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/statem/statem.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/statem/statem.c diff --git a/src/openssl/openssl-1.1.1w/ssl/statem/statem.h b/src/openssl/openssl-1.1.1w-chevah2/ssl/statem/statem.h similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/statem/statem.h rename to src/openssl/openssl-1.1.1w-chevah2/ssl/statem/statem.h diff --git a/src/openssl/openssl-1.1.1w/ssl/statem/statem_clnt.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/statem/statem_clnt.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/statem/statem_clnt.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/statem/statem_clnt.c diff --git a/src/openssl/openssl-1.1.1w/ssl/statem/statem_dtls.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/statem/statem_dtls.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/statem/statem_dtls.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/statem/statem_dtls.c diff --git a/src/openssl/openssl-1.1.1w/ssl/statem/statem_lib.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/statem/statem_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/statem/statem_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/statem/statem_lib.c diff --git a/src/openssl/openssl-1.1.1w/ssl/statem/statem_local.h b/src/openssl/openssl-1.1.1w-chevah2/ssl/statem/statem_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/statem/statem_local.h rename to src/openssl/openssl-1.1.1w-chevah2/ssl/statem/statem_local.h diff --git a/src/openssl/openssl-1.1.1w/ssl/statem/statem_srvr.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/statem/statem_srvr.c similarity index 99% rename from src/openssl/openssl-1.1.1w/ssl/statem/statem_srvr.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/statem/statem_srvr.c index 43f77a589..f55e11bde 100644 --- a/src/openssl/openssl-1.1.1w/ssl/statem/statem_srvr.c +++ b/src/openssl/openssl-1.1.1w-chevah2/ssl/statem/statem_srvr.c @@ -2403,9 +2403,8 @@ int tls_construct_server_hello(SSL *s, WPACKET *pkt) * so the following won't overwrite an ID that we're supposed * to send back. */ - if (s->session->not_resumable || - (!(s->ctx->session_cache_mode & SSL_SESS_CACHE_SERVER) - && !s->hit)) + if (!(s->ctx->session_cache_mode & SSL_SESS_CACHE_SERVER) + && !s->hit) s->session->session_id_length = 0; if (usetls13) { diff --git a/src/openssl/openssl-1.1.1w/ssl/t1_enc.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/t1_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/t1_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/t1_enc.c diff --git a/src/openssl/openssl-1.1.1w/ssl/t1_lib.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/t1_lib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/t1_lib.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/t1_lib.c diff --git a/src/openssl/openssl-1.1.1w/ssl/t1_trce.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/t1_trce.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/t1_trce.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/t1_trce.c diff --git a/src/openssl/openssl-1.1.1w/ssl/tls13_enc.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/tls13_enc.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/tls13_enc.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/tls13_enc.c diff --git a/src/openssl/openssl-1.1.1w/ssl/tls_srp.c b/src/openssl/openssl-1.1.1w-chevah2/ssl/tls_srp.c similarity index 100% rename from src/openssl/openssl-1.1.1w/ssl/tls_srp.c rename to src/openssl/openssl-1.1.1w-chevah2/ssl/tls_srp.c diff --git a/src/openssl/openssl-1.1.1w/test/CAss.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/CAss.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/CAss.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/CAss.cnf diff --git a/src/openssl/openssl-1.1.1w/test/CAssdh.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/CAssdh.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/CAssdh.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/CAssdh.cnf diff --git a/src/openssl/openssl-1.1.1w/test/CAssdsa.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/CAssdsa.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/CAssdsa.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/CAssdsa.cnf diff --git a/src/openssl/openssl-1.1.1w/test/CAssrsa.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/CAssrsa.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/CAssrsa.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/CAssrsa.cnf diff --git a/src/openssl/openssl-1.1.1w/test/CAtsa.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/CAtsa.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/CAtsa.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/CAtsa.cnf diff --git a/src/openssl/openssl-1.1.1w/test/P1ss.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/P1ss.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/P1ss.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/P1ss.cnf diff --git a/src/openssl/openssl-1.1.1w/test/P2ss.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/P2ss.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/P2ss.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/P2ss.cnf diff --git a/src/openssl/openssl-1.1.1w/test/README b/src/openssl/openssl-1.1.1w-chevah2/test/README similarity index 100% rename from src/openssl/openssl-1.1.1w/test/README rename to src/openssl/openssl-1.1.1w-chevah2/test/README diff --git a/src/openssl/openssl-1.1.1w/test/README.external b/src/openssl/openssl-1.1.1w-chevah2/test/README.external similarity index 100% rename from src/openssl/openssl-1.1.1w/test/README.external rename to src/openssl/openssl-1.1.1w-chevah2/test/README.external diff --git a/src/openssl/openssl-1.1.1w/test/README.ssltest.md b/src/openssl/openssl-1.1.1w-chevah2/test/README.ssltest.md similarity index 100% rename from src/openssl/openssl-1.1.1w/test/README.ssltest.md rename to src/openssl/openssl-1.1.1w-chevah2/test/README.ssltest.md diff --git a/src/openssl/openssl-1.1.1w/test/Sssdsa.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/Sssdsa.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/Sssdsa.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/Sssdsa.cnf diff --git a/src/openssl/openssl-1.1.1w/test/Sssrsa.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/Sssrsa.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/Sssrsa.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/Sssrsa.cnf diff --git a/src/openssl/openssl-1.1.1w/test/Uss.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/Uss.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/Uss.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/Uss.cnf diff --git a/src/openssl/openssl-1.1.1w/test/aborttest.c b/src/openssl/openssl-1.1.1w-chevah2/test/aborttest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/aborttest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/aborttest.c diff --git a/src/openssl/openssl-1.1.1w/test/afalgtest.c b/src/openssl/openssl-1.1.1w-chevah2/test/afalgtest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/afalgtest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/afalgtest.c diff --git a/src/openssl/openssl-1.1.1w/test/asn1_decode_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/asn1_decode_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/asn1_decode_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/asn1_decode_test.c diff --git a/src/openssl/openssl-1.1.1w/test/asn1_encode_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/asn1_encode_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/asn1_encode_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/asn1_encode_test.c diff --git a/src/openssl/openssl-1.1.1w/test/asn1_internal_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/asn1_internal_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/asn1_internal_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/asn1_internal_test.c diff --git a/src/openssl/openssl-1.1.1w/test/asn1_string_table_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/asn1_string_table_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/asn1_string_table_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/asn1_string_table_test.c diff --git a/src/openssl/openssl-1.1.1w/test/asn1_time_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/asn1_time_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/asn1_time_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/asn1_time_test.c diff --git a/src/openssl/openssl-1.1.1w/test/asynciotest.c b/src/openssl/openssl-1.1.1w-chevah2/test/asynciotest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/asynciotest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/asynciotest.c diff --git a/src/openssl/openssl-1.1.1w/test/asynctest.c b/src/openssl/openssl-1.1.1w-chevah2/test/asynctest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/asynctest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/asynctest.c diff --git a/src/openssl/openssl-1.1.1w/test/bad_dtls_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/bad_dtls_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/bad_dtls_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/bad_dtls_test.c diff --git a/src/openssl/openssl-1.1.1w/test/bftest.c b/src/openssl/openssl-1.1.1w-chevah2/test/bftest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/bftest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/bftest.c diff --git a/src/openssl/openssl-1.1.1w/test/bio_callback_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/bio_callback_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/bio_callback_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/bio_callback_test.c diff --git a/src/openssl/openssl-1.1.1w/test/bio_enc_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/bio_enc_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/bio_enc_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/bio_enc_test.c diff --git a/src/openssl/openssl-1.1.1w/test/bio_memleak_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/bio_memleak_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/bio_memleak_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/bio_memleak_test.c diff --git a/src/openssl/openssl-1.1.1w/test/bioprinttest.c b/src/openssl/openssl-1.1.1w-chevah2/test/bioprinttest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/bioprinttest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/bioprinttest.c diff --git a/src/openssl/openssl-1.1.1w/test/bntest.c b/src/openssl/openssl-1.1.1w-chevah2/test/bntest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/bntest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/bntest.c diff --git a/src/openssl/openssl-1.1.1w/test/bntests.pl b/src/openssl/openssl-1.1.1w-chevah2/test/bntests.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/test/bntests.pl rename to src/openssl/openssl-1.1.1w-chevah2/test/bntests.pl diff --git a/src/openssl/openssl-1.1.1w/test/build.info b/src/openssl/openssl-1.1.1w-chevah2/test/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/test/build.info rename to src/openssl/openssl-1.1.1w-chevah2/test/build.info diff --git a/src/openssl/openssl-1.1.1w/test/casttest.c b/src/openssl/openssl-1.1.1w-chevah2/test/casttest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/casttest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/casttest.c diff --git a/src/openssl/openssl-1.1.1w/test/certs/alt1-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/alt1-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/alt1-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/alt1-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/alt1-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/alt1-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/alt1-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/alt1-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/alt2-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/alt2-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/alt2-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/alt2-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/alt2-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/alt2-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/alt2-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/alt2-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/alt3-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/alt3-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/alt3-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/alt3-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/alt3-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/alt3-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/alt3-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/alt3-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/bad-pc3-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/bad-pc3-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/bad-pc3-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/bad-pc3-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/bad-pc3-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/bad-pc3-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/bad-pc3-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/bad-pc3-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/bad-pc4-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/bad-pc4-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/bad-pc4-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/bad-pc4-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/bad-pc4-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/bad-pc4-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/bad-pc4-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/bad-pc4-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/bad-pc6-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/bad-pc6-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/bad-pc6-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/bad-pc6-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/bad-pc6-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/bad-pc6-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/bad-pc6-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/bad-pc6-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/bad.key b/src/openssl/openssl-1.1.1w-chevah2/test/certs/bad.key similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/bad.key rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/bad.key diff --git a/src/openssl/openssl-1.1.1w/test/certs/bad.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/bad.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/bad.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/bad.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt1-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt1-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt1-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt1-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt1-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt1-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt1-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt1-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt10-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt10-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt10-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt10-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt10-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt10-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt10-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt10-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt2-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt2-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt2-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt2-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt2-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt2-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt2-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt2-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt3-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt3-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt3-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt3-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt3-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt3-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt3-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt3-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt4-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt4-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt4-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt4-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt4-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt4-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt4-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt4-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt5-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt5-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt5-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt5-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt5-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt5-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt5-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt5-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt6-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt6-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt6-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt6-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt6-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt6-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt6-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt6-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt7-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt7-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt7-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt7-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt7-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt7-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt7-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt7-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt8-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt8-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt8-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt8-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt8-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt8-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt8-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt8-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt9-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt9-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt9-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt9-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badalt9-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt9-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badalt9-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badalt9-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badcn1-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badcn1-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badcn1-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badcn1-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/badcn1-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/badcn1-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/badcn1-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/badcn1-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca+anyEKU.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca+anyEKU.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca+anyEKU.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca+anyEKU.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca+clientAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca+clientAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca+clientAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca+clientAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca+serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca+serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca+serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca+serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-anyEKU.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-anyEKU.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-anyEKU.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-anyEKU.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-cert-768.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-cert-768.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-cert-768.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-cert-768.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-cert-768i.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-cert-768i.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-cert-768i.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-cert-768i.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-cert-ec-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-cert-ec-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-cert-ec-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-cert-ec-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-cert-ec-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-cert-ec-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-cert-ec-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-cert-ec-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-cert-md5-any.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-cert-md5-any.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-cert-md5-any.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-cert-md5-any.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-cert-md5.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-cert-md5.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-cert-md5.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-cert-md5.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-cert2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-cert2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-cert2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-cert2.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-clientAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-clientAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-clientAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-clientAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-expired.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-expired.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-expired.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-expired.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-key-768.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-key-768.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-key-768.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-key-768.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-key-ec-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-key-ec-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-key-ec-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-key-ec-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-key-ec-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-key-ec-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-key-ec-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-key-ec-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-key2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-key2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-key2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-key2.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-name2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-name2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-name2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-name2.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-nonbc.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-nonbc.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-nonbc.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-nonbc.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-nonca.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-nonca.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-nonca.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-nonca.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-pol-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-pol-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-pol-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-pol-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-pss-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-pss-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-pss-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-pss-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-pss-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-pss-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-pss-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-pss-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-root2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-root2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-root2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-root2.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ca-serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ca-serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ca-serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/cca+anyEKU.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/cca+anyEKU.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/cca+anyEKU.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/cca+anyEKU.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/cca+clientAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/cca+clientAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/cca+clientAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/cca+clientAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/cca+serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/cca+serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/cca+serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/cca+serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/cca-anyEKU.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/cca-anyEKU.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/cca-anyEKU.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/cca-anyEKU.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/cca-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/cca-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/cca-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/cca-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/cca-clientAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/cca-clientAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/cca-clientAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/cca-clientAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/cca-serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/cca-serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/cca-serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/cca-serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/client-ed25519-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/client-ed25519-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/client-ed25519-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/client-ed25519-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/client-ed25519-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/client-ed25519-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/client-ed25519-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/client-ed25519-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/client-ed448-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/client-ed448-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/client-ed448-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/client-ed448-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/client-ed448-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/client-ed448-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/client-ed448-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/client-ed448-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/croot+anyEKU.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/croot+anyEKU.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/croot+anyEKU.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/croot+anyEKU.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/croot+clientAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/croot+clientAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/croot+clientAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/croot+clientAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/croot+serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/croot+serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/croot+serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/croot+serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/croot-anyEKU.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/croot-anyEKU.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/croot-anyEKU.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/croot-anyEKU.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/croot-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/croot-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/croot-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/croot-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/croot-clientAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/croot-clientAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/croot-clientAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/croot-clientAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/croot-serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/croot-serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/croot-serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/croot-serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/cross-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/cross-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/cross-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/cross-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/cross-root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/cross-root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/cross-root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/cross-root.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/cyrillic.msb b/src/openssl/openssl-1.1.1w-chevah2/test/certs/cyrillic.msb similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/cyrillic.msb rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/cyrillic.msb diff --git a/src/openssl/openssl-1.1.1w/test/certs/cyrillic.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/cyrillic.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/cyrillic.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/cyrillic.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/cyrillic.utf8 b/src/openssl/openssl-1.1.1w-chevah2/test/certs/cyrillic.utf8 similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/cyrillic.utf8 rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/cyrillic.utf8 diff --git a/src/openssl/openssl-1.1.1w/test/certs/cyrillic_crl.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/cyrillic_crl.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/cyrillic_crl.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/cyrillic_crl.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/cyrillic_crl.utf8 b/src/openssl/openssl-1.1.1w-chevah2/test/certs/cyrillic_crl.utf8 similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/cyrillic_crl.utf8 rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/cyrillic_crl.utf8 diff --git a/src/openssl/openssl-1.1.1w/test/certs/dhp2048.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/dhp2048.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/dhp2048.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/dhp2048.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee+clientAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee+clientAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee+clientAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee+clientAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee+serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee+serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee+serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee+serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-cert-768.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert-768.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-cert-768.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert-768.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-cert-768i.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert-768i.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-cert-768i.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert-768i.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-cert-ec-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert-ec-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-cert-ec-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert-ec-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-cert-ec-named-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert-ec-named-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-cert-ec-named-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert-ec-named-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-cert-ec-named-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert-ec-named-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-cert-ec-named-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert-ec-named-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-cert-md5.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert-md5.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-cert-md5.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert-md5.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-cert-policies-bad.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert-policies-bad.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-cert-policies-bad.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert-policies-bad.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-cert-policies.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert-policies.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-cert-policies.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert-policies.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-cert2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-cert2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-cert2.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-client-chain.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-client-chain.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-client-chain.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-client-chain.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-client.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-client.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-client.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-client.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-clientAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-clientAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-clientAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-clientAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-ecdsa-client-chain.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-ecdsa-client-chain.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-ecdsa-client-chain.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-ecdsa-client-chain.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-ecdsa-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-ecdsa-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-ecdsa-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-ecdsa-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-ed25519.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-ed25519.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-ed25519.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-ed25519.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-expired.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-expired.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-expired.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-expired.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-key-768.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-key-768.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-key-768.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-key-768.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-key-ec-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-key-ec-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-key-ec-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-key-ec-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-key-ec-named-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-key-ec-named-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-key-ec-named-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-key-ec-named-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-key-ec-named-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-key-ec-named-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-key-ec-named-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-key-ec-named-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-name2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-name2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-name2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-name2.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-pathlen.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-pathlen.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-pathlen.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-pathlen.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-pss-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-pss-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-pss-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-pss-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-pss-sha1-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-pss-sha1-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-pss-sha1-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-pss-sha1-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-pss-sha256-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-pss-sha256-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-pss-sha256-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-pss-sha256-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-self-signed.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-self-signed.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-self-signed.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-self-signed.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ee-serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ee-serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ee-serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/embeddedSCTs1-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/embeddedSCTs1-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/embeddedSCTs1-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/embeddedSCTs1-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/embeddedSCTs1.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/embeddedSCTs1.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/embeddedSCTs1.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/embeddedSCTs1.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/embeddedSCTs1.sct b/src/openssl/openssl-1.1.1w-chevah2/test/certs/embeddedSCTs1.sct similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/embeddedSCTs1.sct rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/embeddedSCTs1.sct diff --git a/src/openssl/openssl-1.1.1w/test/certs/embeddedSCTs1_issuer-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/embeddedSCTs1_issuer-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/embeddedSCTs1_issuer-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/embeddedSCTs1_issuer-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/embeddedSCTs1_issuer.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/embeddedSCTs1_issuer.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/embeddedSCTs1_issuer.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/embeddedSCTs1_issuer.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/embeddedSCTs3.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/embeddedSCTs3.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/embeddedSCTs3.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/embeddedSCTs3.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/embeddedSCTs3.sct b/src/openssl/openssl-1.1.1w-chevah2/test/certs/embeddedSCTs3.sct similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/embeddedSCTs3.sct rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/embeddedSCTs3.sct diff --git a/src/openssl/openssl-1.1.1w/test/certs/embeddedSCTs3_issuer.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/embeddedSCTs3_issuer.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/embeddedSCTs3_issuer.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/embeddedSCTs3_issuer.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/goodcn1-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/goodcn1-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/goodcn1-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/goodcn1-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/goodcn1-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/goodcn1-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/goodcn1-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/goodcn1-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/interCA.key b/src/openssl/openssl-1.1.1w-chevah2/test/certs/interCA.key similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/interCA.key rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/interCA.key diff --git a/src/openssl/openssl-1.1.1w/test/certs/interCA.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/interCA.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/interCA.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/interCA.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/invalid-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/invalid-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/invalid-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/invalid-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/leaf.key b/src/openssl/openssl-1.1.1w-chevah2/test/certs/leaf.key similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/leaf.key rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/leaf.key diff --git a/src/openssl/openssl-1.1.1w/test/certs/leaf.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/leaf.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/leaf.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/leaf.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/many-constraints.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/many-constraints.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/many-constraints.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/many-constraints.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/many-names1.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/many-names1.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/many-names1.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/many-names1.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/many-names2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/many-names2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/many-names2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/many-names2.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/many-names3.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/many-names3.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/many-names3.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/many-names3.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/mkcert.sh b/src/openssl/openssl-1.1.1w-chevah2/test/certs/mkcert.sh similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/mkcert.sh rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/mkcert.sh diff --git a/src/openssl/openssl-1.1.1w/test/certs/nca+anyEKU.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/nca+anyEKU.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/nca+anyEKU.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/nca+anyEKU.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/nca+serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/nca+serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/nca+serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/nca+serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ncca-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ncca-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ncca-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ncca-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ncca-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ncca-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ncca-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ncca-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ncca1-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ncca1-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ncca1-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ncca1-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ncca1-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ncca1-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ncca1-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ncca1-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ncca2-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ncca2-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ncca2-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ncca2-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ncca2-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ncca2-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ncca2-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ncca2-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ncca3-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ncca3-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ncca3-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ncca3-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/ncca3-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/ncca3-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/ncca3-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/ncca3-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/nroot+anyEKU.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/nroot+anyEKU.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/nroot+anyEKU.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/nroot+anyEKU.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/nroot+serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/nroot+serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/nroot+serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/nroot+serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/p256-server-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/p256-server-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/p256-server-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/p256-server-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/p256-server-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/p256-server-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/p256-server-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/p256-server-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/p384-root-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/p384-root-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/p384-root-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/p384-root-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/p384-root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/p384-root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/p384-root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/p384-root.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/p384-server-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/p384-server-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/p384-server-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/p384-server-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/p384-server-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/p384-server-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/p384-server-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/p384-server-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/pathlen.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/pathlen.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/pathlen.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/pathlen.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/pc1-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/pc1-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/pc1-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/pc1-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/pc1-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/pc1-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/pc1-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/pc1-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/pc2-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/pc2-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/pc2-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/pc2-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/pc2-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/pc2-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/pc2-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/pc2-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/pc5-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/pc5-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/pc5-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/pc5-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/pc5-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/pc5-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/pc5-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/pc5-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root+anyEKU.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root+anyEKU.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root+anyEKU.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root+anyEKU.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root+clientAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root+clientAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root+clientAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root+clientAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root+serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root+serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root+serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root+serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-anyEKU.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-anyEKU.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-anyEKU.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-anyEKU.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-cert-768.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-cert-768.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-cert-768.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-cert-768.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-cert-md5.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-cert-md5.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-cert-md5.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-cert-md5.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-cert-rsa2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-cert-rsa2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-cert-rsa2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-cert-rsa2.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-cert2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-cert2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-cert2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-cert2.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-clientAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-clientAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-clientAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-clientAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-cross-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-cross-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-cross-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-cross-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-ed25519.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-ed25519.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-ed25519.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-ed25519.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-ed448-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-ed448-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-ed448-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-ed448-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-ed448-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-ed448-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-ed448-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-ed448-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-expired.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-expired.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-expired.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-expired.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-key-768.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-key-768.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-key-768.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-key-768.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-key2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-key2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-key2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-key2.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-name2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-name2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-name2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-name2.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-nonca.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-nonca.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-nonca.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-nonca.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-noserver.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-noserver.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-noserver.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-noserver.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root-serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root-serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root-serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root-serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root2+clientAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root2+clientAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root2+clientAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root2+clientAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root2+serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root2+serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root2+serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root2+serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/root2-serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/root2-serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/root2-serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/root2-serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/rootCA.key b/src/openssl/openssl-1.1.1w-chevah2/test/certs/rootCA.key similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/rootCA.key rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/rootCA.key diff --git a/src/openssl/openssl-1.1.1w/test/certs/rootCA.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/rootCA.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/rootCA.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/rootCA.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/rootcert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/rootcert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/rootcert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/rootcert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/rootkey.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/rootkey.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/rootkey.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/rootkey.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/roots.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/roots.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/roots.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/roots.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/sca+anyEKU.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/sca+anyEKU.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/sca+anyEKU.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/sca+anyEKU.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/sca+clientAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/sca+clientAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/sca+clientAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/sca+clientAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/sca+serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/sca+serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/sca+serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/sca+serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/sca-anyEKU.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/sca-anyEKU.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/sca-anyEKU.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/sca-anyEKU.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/sca-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/sca-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/sca-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/sca-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/sca-clientAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/sca-clientAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/sca-clientAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/sca-clientAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/sca-serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/sca-serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/sca-serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/sca-serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/server-cecdsa-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/server-cecdsa-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/server-cecdsa-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/server-cecdsa-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/server-cecdsa-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/server-cecdsa-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/server-cecdsa-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/server-cecdsa-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/server-dsa-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/server-dsa-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/server-dsa-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/server-dsa-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/server-dsa-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/server-dsa-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/server-dsa-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/server-dsa-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/server-ecdsa-brainpoolP256r1-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/server-ecdsa-brainpoolP256r1-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/server-ecdsa-brainpoolP256r1-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/server-ecdsa-brainpoolP256r1-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/server-ecdsa-brainpoolP256r1-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/server-ecdsa-brainpoolP256r1-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/server-ecdsa-brainpoolP256r1-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/server-ecdsa-brainpoolP256r1-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/server-ecdsa-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/server-ecdsa-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/server-ecdsa-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/server-ecdsa-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/server-ecdsa-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/server-ecdsa-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/server-ecdsa-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/server-ecdsa-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/server-ed25519-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/server-ed25519-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/server-ed25519-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/server-ed25519-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/server-ed25519-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/server-ed25519-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/server-ed25519-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/server-ed25519-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/server-ed448-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/server-ed448-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/server-ed448-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/server-ed448-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/server-ed448-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/server-ed448-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/server-ed448-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/server-ed448-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/server-pss-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/server-pss-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/server-pss-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/server-pss-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/server-pss-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/server-pss-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/server-pss-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/server-pss-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/server-pss-restrict-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/server-pss-restrict-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/server-pss-restrict-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/server-pss-restrict-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/server-pss-restrict-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/server-pss-restrict-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/server-pss-restrict-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/server-pss-restrict-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/server-trusted.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/server-trusted.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/server-trusted.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/server-trusted.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/servercert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/servercert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/servercert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/servercert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/serverkey.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/serverkey.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/serverkey.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/serverkey.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/setup.sh b/src/openssl/openssl-1.1.1w-chevah2/test/certs/setup.sh similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/setup.sh rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/setup.sh diff --git a/src/openssl/openssl-1.1.1w/test/certs/some-names1.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/some-names1.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/some-names1.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/some-names1.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/some-names2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/some-names2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/some-names2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/some-names2.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/some-names3.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/some-names3.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/some-names3.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/some-names3.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/sroot+anyEKU.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/sroot+anyEKU.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/sroot+anyEKU.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/sroot+anyEKU.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/sroot+clientAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/sroot+clientAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/sroot+clientAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/sroot+clientAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/sroot+serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/sroot+serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/sroot+serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/sroot+serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/sroot-anyEKU.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/sroot-anyEKU.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/sroot-anyEKU.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/sroot-anyEKU.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/sroot-cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/sroot-cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/sroot-cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/sroot-cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/sroot-clientAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/sroot-clientAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/sroot-clientAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/sroot-clientAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/sroot-serverAuth.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/sroot-serverAuth.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/sroot-serverAuth.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/sroot-serverAuth.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/subinterCA-ss.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/subinterCA-ss.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/subinterCA-ss.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/subinterCA-ss.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/subinterCA.key b/src/openssl/openssl-1.1.1w-chevah2/test/certs/subinterCA.key similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/subinterCA.key rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/subinterCA.key diff --git a/src/openssl/openssl-1.1.1w/test/certs/subinterCA.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/subinterCA.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/subinterCA.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/subinterCA.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/untrusted.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/untrusted.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/untrusted.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/untrusted.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/wrongcert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/wrongcert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/wrongcert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/wrongcert.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/wrongkey.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/wrongkey.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/wrongkey.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/wrongkey.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/x509-check-key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/certs/x509-check-key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/x509-check-key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/x509-check-key.pem diff --git a/src/openssl/openssl-1.1.1w/test/certs/x509-check.csr b/src/openssl/openssl-1.1.1w-chevah2/test/certs/x509-check.csr similarity index 100% rename from src/openssl/openssl-1.1.1w/test/certs/x509-check.csr rename to src/openssl/openssl-1.1.1w-chevah2/test/certs/x509-check.csr diff --git a/src/openssl/openssl-1.1.1w/test/chacha_internal_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/chacha_internal_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/chacha_internal_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/chacha_internal_test.c diff --git a/src/openssl/openssl-1.1.1w/test/cipher_overhead_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/cipher_overhead_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/cipher_overhead_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/cipher_overhead_test.c diff --git a/src/openssl/openssl-1.1.1w/test/cipherbytes_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/cipherbytes_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/cipherbytes_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/cipherbytes_test.c diff --git a/src/openssl/openssl-1.1.1w/test/cipherlist_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/cipherlist_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/cipherlist_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/cipherlist_test.c diff --git a/src/openssl/openssl-1.1.1w/test/ciphername_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/ciphername_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ciphername_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/ciphername_test.c diff --git a/src/openssl/openssl-1.1.1w/test/clienthellotest.c b/src/openssl/openssl-1.1.1w-chevah2/test/clienthellotest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/clienthellotest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/clienthellotest.c diff --git a/src/openssl/openssl-1.1.1w/test/cmactest.c b/src/openssl/openssl-1.1.1w-chevah2/test/cmactest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/cmactest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/cmactest.c diff --git a/src/openssl/openssl-1.1.1w/test/cms-examples.pl b/src/openssl/openssl-1.1.1w-chevah2/test/cms-examples.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/test/cms-examples.pl rename to src/openssl/openssl-1.1.1w-chevah2/test/cms-examples.pl diff --git a/src/openssl/openssl-1.1.1w/test/cmsapitest.c b/src/openssl/openssl-1.1.1w-chevah2/test/cmsapitest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/cmsapitest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/cmsapitest.c diff --git a/src/openssl/openssl-1.1.1w/test/conf_include_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/conf_include_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/conf_include_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/conf_include_test.c diff --git a/src/openssl/openssl-1.1.1w/test/constant_time_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/constant_time_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/constant_time_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/constant_time_test.c diff --git a/src/openssl/openssl-1.1.1w/test/crltest.c b/src/openssl/openssl-1.1.1w-chevah2/test/crltest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/crltest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/crltest.c diff --git a/src/openssl/openssl-1.1.1w/test/ct/log_list.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ct/log_list.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ct/log_list.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ct/log_list.conf diff --git a/src/openssl/openssl-1.1.1w/test/ct/tls1.sct b/src/openssl/openssl-1.1.1w-chevah2/test/ct/tls1.sct similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ct/tls1.sct rename to src/openssl/openssl-1.1.1w-chevah2/test/ct/tls1.sct diff --git a/src/openssl/openssl-1.1.1w/test/ct_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/ct_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ct_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/ct_test.c diff --git a/src/openssl/openssl-1.1.1w/test/ctype_internal_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/ctype_internal_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ctype_internal_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/ctype_internal_test.c diff --git a/src/openssl/openssl-1.1.1w/test/curve448_internal_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/curve448_internal_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/curve448_internal_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/curve448_internal_test.c diff --git a/src/openssl/openssl-1.1.1w/test/d2i-tests/bad-cms.der b/src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/bad-cms.der similarity index 100% rename from src/openssl/openssl-1.1.1w/test/d2i-tests/bad-cms.der rename to src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/bad-cms.der diff --git a/src/openssl/openssl-1.1.1w/test/d2i-tests/bad-int-pad0.der b/src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/bad-int-pad0.der similarity index 100% rename from src/openssl/openssl-1.1.1w/test/d2i-tests/bad-int-pad0.der rename to src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/bad-int-pad0.der diff --git a/src/openssl/openssl-1.1.1w/test/d2i-tests/bad-int-padminus1.der b/src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/bad-int-padminus1.der similarity index 100% rename from src/openssl/openssl-1.1.1w/test/d2i-tests/bad-int-padminus1.der rename to src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/bad-int-padminus1.der diff --git a/src/openssl/openssl-1.1.1w/test/d2i-tests/bad_bio.der b/src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/bad_bio.der similarity index 100% rename from src/openssl/openssl-1.1.1w/test/d2i-tests/bad_bio.der rename to src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/bad_bio.der diff --git a/src/openssl/openssl-1.1.1w/test/d2i-tests/bad_cert.der b/src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/bad_cert.der similarity index 100% rename from src/openssl/openssl-1.1.1w/test/d2i-tests/bad_cert.der rename to src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/bad_cert.der diff --git a/src/openssl/openssl-1.1.1w/test/d2i-tests/bad_generalname.der b/src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/bad_generalname.der similarity index 100% rename from src/openssl/openssl-1.1.1w/test/d2i-tests/bad_generalname.der rename to src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/bad_generalname.der diff --git a/src/openssl/openssl-1.1.1w/test/d2i-tests/high_tag.der b/src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/high_tag.der similarity index 100% rename from src/openssl/openssl-1.1.1w/test/d2i-tests/high_tag.der rename to src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/high_tag.der diff --git a/src/openssl/openssl-1.1.1w/test/d2i-tests/int0.der b/src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/int0.der similarity index 100% rename from src/openssl/openssl-1.1.1w/test/d2i-tests/int0.der rename to src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/int0.der diff --git a/src/openssl/openssl-1.1.1w/test/d2i-tests/int1.der b/src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/int1.der similarity index 100% rename from src/openssl/openssl-1.1.1w/test/d2i-tests/int1.der rename to src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/int1.der diff --git a/src/openssl/openssl-1.1.1w/test/d2i-tests/intminus1.der b/src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/intminus1.der similarity index 100% rename from src/openssl/openssl-1.1.1w/test/d2i-tests/intminus1.der rename to src/openssl/openssl-1.1.1w-chevah2/test/d2i-tests/intminus1.der diff --git a/src/openssl/openssl-1.1.1w/test/d2i_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/d2i_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/d2i_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/d2i_test.c diff --git a/src/openssl/openssl-1.1.1w/test/dane-cross.in b/src/openssl/openssl-1.1.1w-chevah2/test/dane-cross.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/dane-cross.in rename to src/openssl/openssl-1.1.1w-chevah2/test/dane-cross.in diff --git a/src/openssl/openssl-1.1.1w/test/danetest.c b/src/openssl/openssl-1.1.1w-chevah2/test/danetest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/danetest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/danetest.c diff --git a/src/openssl/openssl-1.1.1w/test/danetest.in b/src/openssl/openssl-1.1.1w-chevah2/test/danetest.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/danetest.in rename to src/openssl/openssl-1.1.1w-chevah2/test/danetest.in diff --git a/src/openssl/openssl-1.1.1w/test/danetest.pem b/src/openssl/openssl-1.1.1w-chevah2/test/danetest.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/danetest.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/danetest.pem diff --git a/src/openssl/openssl-1.1.1w/test/data.bin b/src/openssl/openssl-1.1.1w-chevah2/test/data.bin similarity index 100% rename from src/openssl/openssl-1.1.1w/test/data.bin rename to src/openssl/openssl-1.1.1w-chevah2/test/data.bin diff --git a/src/openssl/openssl-1.1.1w/test/destest.c b/src/openssl/openssl-1.1.1w-chevah2/test/destest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/destest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/destest.c diff --git a/src/openssl/openssl-1.1.1w/test/dhtest.c b/src/openssl/openssl-1.1.1w-chevah2/test/dhtest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/dhtest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/dhtest.c diff --git a/src/openssl/openssl-1.1.1w/test/drbg_cavs_data.c b/src/openssl/openssl-1.1.1w-chevah2/test/drbg_cavs_data.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/drbg_cavs_data.c rename to src/openssl/openssl-1.1.1w-chevah2/test/drbg_cavs_data.c diff --git a/src/openssl/openssl-1.1.1w/test/drbg_cavs_data.h b/src/openssl/openssl-1.1.1w-chevah2/test/drbg_cavs_data.h similarity index 100% rename from src/openssl/openssl-1.1.1w/test/drbg_cavs_data.h rename to src/openssl/openssl-1.1.1w-chevah2/test/drbg_cavs_data.h diff --git a/src/openssl/openssl-1.1.1w/test/drbg_cavs_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/drbg_cavs_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/drbg_cavs_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/drbg_cavs_test.c diff --git a/src/openssl/openssl-1.1.1w/test/drbgtest.c b/src/openssl/openssl-1.1.1w-chevah2/test/drbgtest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/drbgtest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/drbgtest.c diff --git a/src/openssl/openssl-1.1.1w/test/drbgtest.h b/src/openssl/openssl-1.1.1w-chevah2/test/drbgtest.h similarity index 100% rename from src/openssl/openssl-1.1.1w/test/drbgtest.h rename to src/openssl/openssl-1.1.1w-chevah2/test/drbgtest.h diff --git a/src/openssl/openssl-1.1.1w/test/dsa_no_digest_size_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/dsa_no_digest_size_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/dsa_no_digest_size_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/dsa_no_digest_size_test.c diff --git a/src/openssl/openssl-1.1.1w/test/dsatest.c b/src/openssl/openssl-1.1.1w-chevah2/test/dsatest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/dsatest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/dsatest.c diff --git a/src/openssl/openssl-1.1.1w/test/dtls_mtu_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/dtls_mtu_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/dtls_mtu_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/dtls_mtu_test.c diff --git a/src/openssl/openssl-1.1.1w/test/dtlstest.c b/src/openssl/openssl-1.1.1w-chevah2/test/dtlstest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/dtlstest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/dtlstest.c diff --git a/src/openssl/openssl-1.1.1w/test/dtlsv1listentest.c b/src/openssl/openssl-1.1.1w-chevah2/test/dtlsv1listentest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/dtlsv1listentest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/dtlsv1listentest.c diff --git a/src/openssl/openssl-1.1.1w/test/ec_internal_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/ec_internal_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ec_internal_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/ec_internal_test.c diff --git a/src/openssl/openssl-1.1.1w/test/ecdsatest.c b/src/openssl/openssl-1.1.1w-chevah2/test/ecdsatest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ecdsatest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/ecdsatest.c diff --git a/src/openssl/openssl-1.1.1w/test/ecdsatest.h b/src/openssl/openssl-1.1.1w-chevah2/test/ecdsatest.h similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ecdsatest.h rename to src/openssl/openssl-1.1.1w-chevah2/test/ecdsatest.h diff --git a/src/openssl/openssl-1.1.1w/test/ecstresstest.c b/src/openssl/openssl-1.1.1w-chevah2/test/ecstresstest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ecstresstest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/ecstresstest.c diff --git a/src/openssl/openssl-1.1.1w/test/ectest.c b/src/openssl/openssl-1.1.1w-chevah2/test/ectest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ectest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/ectest.c diff --git a/src/openssl/openssl-1.1.1w/test/enginetest.c b/src/openssl/openssl-1.1.1w-chevah2/test/enginetest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/enginetest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/enginetest.c diff --git a/src/openssl/openssl-1.1.1w/test/errtest.c b/src/openssl/openssl-1.1.1w-chevah2/test/errtest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/errtest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/errtest.c diff --git a/src/openssl/openssl-1.1.1w/test/evp_extra_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/evp_extra_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/evp_extra_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/evp_extra_test.c diff --git a/src/openssl/openssl-1.1.1w/test/evp_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/evp_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/evp_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/evp_test.c diff --git a/src/openssl/openssl-1.1.1w/test/evp_test.h b/src/openssl/openssl-1.1.1w-chevah2/test/evp_test.h similarity index 100% rename from src/openssl/openssl-1.1.1w/test/evp_test.h rename to src/openssl/openssl-1.1.1w-chevah2/test/evp_test.h diff --git a/src/openssl/openssl-1.1.1w/test/exdatatest.c b/src/openssl/openssl-1.1.1w-chevah2/test/exdatatest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/exdatatest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/exdatatest.c diff --git a/src/openssl/openssl-1.1.1w/test/exptest.c b/src/openssl/openssl-1.1.1w-chevah2/test/exptest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/exptest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/exptest.c diff --git a/src/openssl/openssl-1.1.1w/test/fatalerrtest.c b/src/openssl/openssl-1.1.1w-chevah2/test/fatalerrtest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/fatalerrtest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/fatalerrtest.c diff --git a/src/openssl/openssl-1.1.1w/test/generate_buildtest.pl b/src/openssl/openssl-1.1.1w-chevah2/test/generate_buildtest.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/test/generate_buildtest.pl rename to src/openssl/openssl-1.1.1w-chevah2/test/generate_buildtest.pl diff --git a/src/openssl/openssl-1.1.1w/test/generate_ssl_tests.pl b/src/openssl/openssl-1.1.1w-chevah2/test/generate_ssl_tests.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/test/generate_ssl_tests.pl rename to src/openssl/openssl-1.1.1w-chevah2/test/generate_ssl_tests.pl diff --git a/src/openssl/openssl-1.1.1w/test/gmdifftest.c b/src/openssl/openssl-1.1.1w-chevah2/test/gmdifftest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/gmdifftest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/gmdifftest.c diff --git a/src/openssl/openssl-1.1.1w/test/gosttest.c b/src/openssl/openssl-1.1.1w-chevah2/test/gosttest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/gosttest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/gosttest.c diff --git a/src/openssl/openssl-1.1.1w/test/handshake_helper.c b/src/openssl/openssl-1.1.1w-chevah2/test/handshake_helper.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/handshake_helper.c rename to src/openssl/openssl-1.1.1w-chevah2/test/handshake_helper.c diff --git a/src/openssl/openssl-1.1.1w/test/handshake_helper.h b/src/openssl/openssl-1.1.1w-chevah2/test/handshake_helper.h similarity index 100% rename from src/openssl/openssl-1.1.1w/test/handshake_helper.h rename to src/openssl/openssl-1.1.1w-chevah2/test/handshake_helper.h diff --git a/src/openssl/openssl-1.1.1w/test/hmactest.c b/src/openssl/openssl-1.1.1w-chevah2/test/hmactest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/hmactest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/hmactest.c diff --git a/src/openssl/openssl-1.1.1w/test/ideatest.c b/src/openssl/openssl-1.1.1w-chevah2/test/ideatest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ideatest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/ideatest.c diff --git a/src/openssl/openssl-1.1.1w/test/igetest.c b/src/openssl/openssl-1.1.1w-chevah2/test/igetest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/igetest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/igetest.c diff --git a/src/openssl/openssl-1.1.1w/test/lhash_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/lhash_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/lhash_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/lhash_test.c diff --git a/src/openssl/openssl-1.1.1w/test/md2test.c b/src/openssl/openssl-1.1.1w-chevah2/test/md2test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/md2test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/md2test.c diff --git a/src/openssl/openssl-1.1.1w/test/mdc2_internal_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/mdc2_internal_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/mdc2_internal_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/mdc2_internal_test.c diff --git a/src/openssl/openssl-1.1.1w/test/mdc2test.c b/src/openssl/openssl-1.1.1w-chevah2/test/mdc2test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/mdc2test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/mdc2test.c diff --git a/src/openssl/openssl-1.1.1w/test/memleaktest.c b/src/openssl/openssl-1.1.1w-chevah2/test/memleaktest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/memleaktest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/memleaktest.c diff --git a/src/openssl/openssl-1.1.1w/test/modes_internal_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/modes_internal_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/modes_internal_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/modes_internal_test.c diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/D1.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D1.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/D1.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D1.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/D1_Cert_EE.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D1_Cert_EE.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/D1_Cert_EE.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D1_Cert_EE.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/D1_Issuer_ICA.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D1_Issuer_ICA.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/D1_Issuer_ICA.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D1_Issuer_ICA.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/D2.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D2.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/D2.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D2.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/D2_Cert_ICA.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D2_Cert_ICA.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/D2_Cert_ICA.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D2_Cert_ICA.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/D2_Issuer_Root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D2_Issuer_Root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/D2_Issuer_Root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D2_Issuer_Root.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/D3.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D3.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/D3.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D3.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/D3_Cert_EE.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D3_Cert_EE.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/D3_Cert_EE.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D3_Cert_EE.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/D3_Issuer_Root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D3_Issuer_Root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/D3_Issuer_Root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/D3_Issuer_Root.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ISDOSC_D1.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISDOSC_D1.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ISDOSC_D1.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISDOSC_D1.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ISDOSC_D2.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISDOSC_D2.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ISDOSC_D2.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISDOSC_D2.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ISDOSC_D3.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISDOSC_D3.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ISDOSC_D3.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISDOSC_D3.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ISIC_D1_Issuer_ICA.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISIC_D1_Issuer_ICA.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ISIC_D1_Issuer_ICA.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISIC_D1_Issuer_ICA.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ISIC_D2_Issuer_Root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISIC_D2_Issuer_Root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ISIC_D2_Issuer_Root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISIC_D2_Issuer_Root.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ISIC_D3_Issuer_Root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISIC_D3_Issuer_Root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ISIC_D3_Issuer_Root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISIC_D3_Issuer_Root.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ISIC_ND1_Issuer_ICA.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISIC_ND1_Issuer_ICA.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ISIC_ND1_Issuer_ICA.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISIC_ND1_Issuer_ICA.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ISIC_ND2_Issuer_Root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISIC_ND2_Issuer_Root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ISIC_ND2_Issuer_Root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISIC_ND2_Issuer_Root.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ISIC_ND3_Issuer_Root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISIC_ND3_Issuer_Root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ISIC_ND3_Issuer_Root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISIC_ND3_Issuer_Root.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ISOP_D1.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISOP_D1.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ISOP_D1.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISOP_D1.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ISOP_D2.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISOP_D2.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ISOP_D2.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISOP_D2.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ISOP_D3.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISOP_D3.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ISOP_D3.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISOP_D3.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ISOP_ND1.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISOP_ND1.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ISOP_ND1.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISOP_ND1.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ISOP_ND2.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISOP_ND2.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ISOP_ND2.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISOP_ND2.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ISOP_ND3.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISOP_ND3.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ISOP_ND3.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ISOP_ND3.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ND1.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND1.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ND1.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND1.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ND1_Cert_EE.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND1_Cert_EE.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ND1_Cert_EE.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND1_Cert_EE.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ND1_Cross_Root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND1_Cross_Root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ND1_Cross_Root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND1_Cross_Root.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ND1_Issuer_ICA-Cross.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND1_Issuer_ICA-Cross.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ND1_Issuer_ICA-Cross.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND1_Issuer_ICA-Cross.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ND1_Issuer_ICA.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND1_Issuer_ICA.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ND1_Issuer_ICA.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND1_Issuer_ICA.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ND2.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND2.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ND2.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND2.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ND2_Cert_ICA.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND2_Cert_ICA.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ND2_Cert_ICA.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND2_Cert_ICA.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ND2_Issuer_Root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND2_Issuer_Root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ND2_Issuer_Root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND2_Issuer_Root.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ND3.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND3.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ND3.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND3.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ND3_Cert_EE.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND3_Cert_EE.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ND3_Cert_EE.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND3_Cert_EE.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/ND3_Issuer_Root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND3_Issuer_Root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/ND3_Issuer_Root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/ND3_Issuer_Root.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WIKH_D1.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WIKH_D1.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WIKH_D1.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WIKH_D1.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WIKH_D2.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WIKH_D2.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WIKH_D2.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WIKH_D2.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WIKH_D3.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WIKH_D3.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WIKH_D3.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WIKH_D3.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WIKH_ND1.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WIKH_ND1.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WIKH_ND1.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WIKH_ND1.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WIKH_ND2.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WIKH_ND2.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WIKH_ND2.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WIKH_ND2.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WIKH_ND3.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WIKH_ND3.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WIKH_ND3.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WIKH_ND3.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WINH_D1.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WINH_D1.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WINH_D1.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WINH_D1.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WINH_D2.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WINH_D2.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WINH_D2.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WINH_D2.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WINH_D3.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WINH_D3.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WINH_D3.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WINH_D3.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WINH_ND1.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WINH_ND1.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WINH_ND1.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WINH_ND1.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WINH_ND2.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WINH_ND2.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WINH_ND2.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WINH_ND2.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WINH_ND3.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WINH_ND3.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WINH_ND3.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WINH_ND3.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WKDOSC_D1.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKDOSC_D1.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WKDOSC_D1.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKDOSC_D1.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WKDOSC_D2.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKDOSC_D2.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WKDOSC_D2.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKDOSC_D2.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WKDOSC_D3.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKDOSC_D3.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WKDOSC_D3.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKDOSC_D3.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WKIC_D1_Issuer_ICA.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKIC_D1_Issuer_ICA.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WKIC_D1_Issuer_ICA.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKIC_D1_Issuer_ICA.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WKIC_D2_Issuer_Root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKIC_D2_Issuer_Root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WKIC_D2_Issuer_Root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKIC_D2_Issuer_Root.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WKIC_D3_Issuer_Root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKIC_D3_Issuer_Root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WKIC_D3_Issuer_Root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKIC_D3_Issuer_Root.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WKIC_ND1_Issuer_ICA.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKIC_ND1_Issuer_ICA.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WKIC_ND1_Issuer_ICA.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKIC_ND1_Issuer_ICA.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WKIC_ND2_Issuer_Root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKIC_ND2_Issuer_Root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WKIC_ND2_Issuer_Root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKIC_ND2_Issuer_Root.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WKIC_ND3_Issuer_Root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKIC_ND3_Issuer_Root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WKIC_ND3_Issuer_Root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WKIC_ND3_Issuer_Root.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WRID_D1.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WRID_D1.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WRID_D1.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WRID_D1.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WRID_D2.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WRID_D2.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WRID_D2.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WRID_D2.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WRID_D3.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WRID_D3.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WRID_D3.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WRID_D3.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WRID_ND1.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WRID_ND1.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WRID_ND1.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WRID_ND1.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WRID_ND2.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WRID_ND2.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WRID_ND2.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WRID_ND2.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WRID_ND3.ors b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WRID_ND3.ors similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WRID_ND3.ors rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WRID_ND3.ors diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WSNIC_D1_Issuer_ICA.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WSNIC_D1_Issuer_ICA.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WSNIC_D1_Issuer_ICA.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WSNIC_D1_Issuer_ICA.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WSNIC_D2_Issuer_Root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WSNIC_D2_Issuer_Root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WSNIC_D2_Issuer_Root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WSNIC_D2_Issuer_Root.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WSNIC_D3_Issuer_Root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WSNIC_D3_Issuer_Root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WSNIC_D3_Issuer_Root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WSNIC_D3_Issuer_Root.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WSNIC_ND1_Issuer_ICA.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WSNIC_ND1_Issuer_ICA.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WSNIC_ND1_Issuer_ICA.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WSNIC_ND1_Issuer_ICA.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WSNIC_ND2_Issuer_Root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WSNIC_ND2_Issuer_Root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WSNIC_ND2_Issuer_Root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WSNIC_ND2_Issuer_Root.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocsp-tests/WSNIC_ND3_Issuer_Root.pem b/src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WSNIC_ND3_Issuer_Root.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocsp-tests/WSNIC_ND3_Issuer_Root.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/ocsp-tests/WSNIC_ND3_Issuer_Root.pem diff --git a/src/openssl/openssl-1.1.1w/test/ocspapitest.c b/src/openssl/openssl-1.1.1w-chevah2/test/ocspapitest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ocspapitest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/ocspapitest.c diff --git a/src/openssl/openssl-1.1.1w/test/ossl_shim/async_bio.cc b/src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/async_bio.cc similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ossl_shim/async_bio.cc rename to src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/async_bio.cc diff --git a/src/openssl/openssl-1.1.1w/test/ossl_shim/async_bio.h b/src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/async_bio.h similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ossl_shim/async_bio.h rename to src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/async_bio.h diff --git a/src/openssl/openssl-1.1.1w/test/ossl_shim/build.info b/src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ossl_shim/build.info rename to src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/build.info diff --git a/src/openssl/openssl-1.1.1w/test/ossl_shim/include/openssl/base.h b/src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/include/openssl/base.h similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ossl_shim/include/openssl/base.h rename to src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/include/openssl/base.h diff --git a/src/openssl/openssl-1.1.1w/test/ossl_shim/ossl_config.json b/src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/ossl_config.json similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ossl_shim/ossl_config.json rename to src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/ossl_config.json diff --git a/src/openssl/openssl-1.1.1w/test/ossl_shim/ossl_shim.cc b/src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/ossl_shim.cc similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ossl_shim/ossl_shim.cc rename to src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/ossl_shim.cc diff --git a/src/openssl/openssl-1.1.1w/test/ossl_shim/packeted_bio.cc b/src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/packeted_bio.cc similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ossl_shim/packeted_bio.cc rename to src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/packeted_bio.cc diff --git a/src/openssl/openssl-1.1.1w/test/ossl_shim/packeted_bio.h b/src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/packeted_bio.h similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ossl_shim/packeted_bio.h rename to src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/packeted_bio.h diff --git a/src/openssl/openssl-1.1.1w/test/ossl_shim/test_config.cc b/src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/test_config.cc similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ossl_shim/test_config.cc rename to src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/test_config.cc diff --git a/src/openssl/openssl-1.1.1w/test/ossl_shim/test_config.h b/src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/test_config.h similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ossl_shim/test_config.h rename to src/openssl/openssl-1.1.1w-chevah2/test/ossl_shim/test_config.h diff --git a/src/openssl/openssl-1.1.1w/test/packettest.c b/src/openssl/openssl-1.1.1w-chevah2/test/packettest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/packettest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/packettest.c diff --git a/src/openssl/openssl-1.1.1w/test/pbelutest.c b/src/openssl/openssl-1.1.1w-chevah2/test/pbelutest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/pbelutest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/pbelutest.c diff --git a/src/openssl/openssl-1.1.1w/test/pemtest.c b/src/openssl/openssl-1.1.1w-chevah2/test/pemtest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/pemtest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/pemtest.c diff --git a/src/openssl/openssl-1.1.1w/test/pkcs7-1.pem b/src/openssl/openssl-1.1.1w-chevah2/test/pkcs7-1.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/pkcs7-1.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/pkcs7-1.pem diff --git a/src/openssl/openssl-1.1.1w/test/pkcs7.pem b/src/openssl/openssl-1.1.1w-chevah2/test/pkcs7.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/pkcs7.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/pkcs7.pem diff --git a/src/openssl/openssl-1.1.1w/test/pkey_meth_kdf_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/pkey_meth_kdf_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/pkey_meth_kdf_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/pkey_meth_kdf_test.c diff --git a/src/openssl/openssl-1.1.1w/test/pkey_meth_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/pkey_meth_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/pkey_meth_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/pkey_meth_test.c diff --git a/src/openssl/openssl-1.1.1w/test/pkits-test.pl b/src/openssl/openssl-1.1.1w-chevah2/test/pkits-test.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/test/pkits-test.pl rename to src/openssl/openssl-1.1.1w-chevah2/test/pkits-test.pl diff --git a/src/openssl/openssl-1.1.1w/test/poly1305_internal_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/poly1305_internal_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/poly1305_internal_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/poly1305_internal_test.c diff --git a/src/openssl/openssl-1.1.1w/test/rc2test.c b/src/openssl/openssl-1.1.1w-chevah2/test/rc2test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/rc2test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/rc2test.c diff --git a/src/openssl/openssl-1.1.1w/test/rc4test.c b/src/openssl/openssl-1.1.1w-chevah2/test/rc4test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/rc4test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/rc4test.c diff --git a/src/openssl/openssl-1.1.1w/test/rc5test.c b/src/openssl/openssl-1.1.1w-chevah2/test/rc5test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/rc5test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/rc5test.c diff --git a/src/openssl/openssl-1.1.1w/test/rdrand_sanitytest.c b/src/openssl/openssl-1.1.1w-chevah2/test/rdrand_sanitytest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/rdrand_sanitytest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/rdrand_sanitytest.c diff --git a/src/openssl/openssl-1.1.1w/test/recipes/01-test_abort.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/01-test_abort.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/01-test_abort.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/01-test_abort.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/01-test_sanity.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/01-test_sanity.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/01-test_sanity.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/01-test_sanity.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/01-test_symbol_presence.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/01-test_symbol_presence.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/01-test_symbol_presence.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/01-test_symbol_presence.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/01-test_test.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/01-test_test.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/01-test_test.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/01-test_test.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/02-test_errstr.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/02-test_errstr.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/02-test_errstr.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/02-test_errstr.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/02-test_internal_ctype.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/02-test_internal_ctype.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/02-test_internal_ctype.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/02-test_internal_ctype.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/02-test_lhash.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/02-test_lhash.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/02-test_lhash.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/02-test_lhash.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/02-test_ordinals.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/02-test_ordinals.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/02-test_ordinals.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/02-test_ordinals.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/02-test_stack.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/02-test_stack.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/02-test_stack.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/02-test_stack.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/03-test_exdata.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_exdata.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/03-test_exdata.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_exdata.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_asn1.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_asn1.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_asn1.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_asn1.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_chacha.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_chacha.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_chacha.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_chacha.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_curve448.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_curve448.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_curve448.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_curve448.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_ec.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_ec.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_ec.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_ec.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_mdc2.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_mdc2.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_mdc2.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_mdc2.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_modes.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_modes.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_modes.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_modes.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_poly1305.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_poly1305.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_poly1305.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_poly1305.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_siphash.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_siphash.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_siphash.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_siphash.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_sm2.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_sm2.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_sm2.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_sm2.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_sm4.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_sm4.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_sm4.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_sm4.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_ssl_cert_table.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_ssl_cert_table.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_ssl_cert_table.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_ssl_cert_table.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_x509.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_x509.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/03-test_internal_x509.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_internal_x509.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/03-test_ui.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_ui.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/03-test_ui.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/03-test_ui.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_asn1_decode.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_asn1_decode.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_asn1_decode.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_asn1_decode.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_asn1_encode.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_asn1_encode.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_asn1_encode.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_asn1_encode.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_asn1_string_table.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_asn1_string_table.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_asn1_string_table.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_asn1_string_table.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_bio_callback.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_bio_callback.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_bio_callback.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_bio_callback.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_bioprint.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_bioprint.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_bioprint.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_bioprint.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_err.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_err.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_err.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_err.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/NOTES b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/NOTES similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/NOTES rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/NOTES diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/beermug.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/beermug.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/beermug.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/beermug.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-1023line.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-1023line.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-1023line.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-1023line.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-1024line.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-1024line.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-1024line.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-1024line.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-1025line.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-1025line.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-1025line.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-1025line.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-254-chars-at-the-end.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-254-chars-at-the-end.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-254-chars-at-the-end.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-254-chars-at-the-end.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-254-chars-in-the-middle.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-254-chars-in-the-middle.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-254-chars-in-the-middle.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-254-chars-in-the-middle.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-255line.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-255line.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-255line.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-255line.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-256line.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-256line.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-256line.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-256line.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-257line.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-257line.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-257line.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-257line.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-blankline.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-blankline.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-blankline.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-blankline.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-comment.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-comment.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-comment.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-comment.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-earlypad.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-earlypad.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-earlypad.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-earlypad.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-extrapad.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-extrapad.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-extrapad.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-extrapad.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-infixwhitespace.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-infixwhitespace.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-infixwhitespace.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-infixwhitespace.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-junk.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-junk.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-junk.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-junk.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-leadingwhitespace.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-leadingwhitespace.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-leadingwhitespace.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-leadingwhitespace.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-longline.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-longline.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-longline.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-longline.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-misalignedpad.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-misalignedpad.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-misalignedpad.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-misalignedpad.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-onecolumn.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-onecolumn.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-onecolumn.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-onecolumn.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-oneline-multiple-of-254.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-oneline-multiple-of-254.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-oneline-multiple-of-254.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-oneline-multiple-of-254.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-oneline.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-oneline.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-oneline.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-oneline.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-shortandlongline.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-shortandlongline.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-shortandlongline.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-shortandlongline.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-shortline.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-shortline.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-shortline.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-shortline.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-threecolumn.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-threecolumn.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-threecolumn.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-threecolumn.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-trailingwhitespace.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-trailingwhitespace.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert-trailingwhitespace.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert-trailingwhitespace.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/csr.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/csr.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/csr.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/csr.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-1023line.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-1023line.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-1023line.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-1023line.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-1024line.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-1024line.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-1024line.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-1024line.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-1025line.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-1025line.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-1025line.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-1025line.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-255line.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-255line.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-255line.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-255line.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-256line.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-256line.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-256line.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-256line.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-257line.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-257line.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-257line.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-257line.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-blankline.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-blankline.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-blankline.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-blankline.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-comment.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-comment.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-comment.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-comment.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-corruptedheader.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-corruptedheader.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-corruptedheader.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-corruptedheader.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-corruptiv.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-corruptiv.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-corruptiv.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-corruptiv.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-earlypad.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-earlypad.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-earlypad.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-earlypad.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-extrapad.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-extrapad.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-extrapad.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-extrapad.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-infixwhitespace.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-infixwhitespace.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-infixwhitespace.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-infixwhitespace.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-junk.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-junk.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-junk.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-junk.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-leadingwhitespace.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-leadingwhitespace.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-leadingwhitespace.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-leadingwhitespace.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-longline.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-longline.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-longline.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-longline.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-misalignedpad.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-misalignedpad.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-misalignedpad.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-misalignedpad.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-onecolumn.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-onecolumn.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-onecolumn.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-onecolumn.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-oneline.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-oneline.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-oneline.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-oneline.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-onelineheader.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-onelineheader.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-onelineheader.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-onelineheader.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-shortandlongline.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-shortandlongline.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-shortandlongline.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-shortandlongline.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-shortline.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-shortline.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-shortline.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-shortline.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-threecolumn.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-threecolumn.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-threecolumn.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-threecolumn.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-trailingwhitespace.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-trailingwhitespace.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa-trailingwhitespace.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa-trailingwhitespace.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsa.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsa.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsaparam.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsaparam.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/dsaparam.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/dsaparam.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/key.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/wellknown b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/wellknown similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/04-test_pem_data/wellknown rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/04-test_pem_data/wellknown diff --git a/src/openssl/openssl-1.1.1w/test/recipes/05-test_bf.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_bf.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/05-test_bf.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_bf.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/05-test_cast.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_cast.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/05-test_cast.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_cast.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/05-test_cmac.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_cmac.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/05-test_cmac.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_cmac.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/05-test_des.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_des.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/05-test_des.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_des.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/05-test_hmac.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_hmac.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/05-test_hmac.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_hmac.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/05-test_idea.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_idea.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/05-test_idea.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_idea.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/05-test_md2.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_md2.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/05-test_md2.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_md2.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/05-test_mdc2.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_mdc2.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/05-test_mdc2.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_mdc2.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/05-test_rand.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_rand.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/05-test_rand.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_rand.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/05-test_rc2.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_rc2.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/05-test_rc2.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_rc2.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/05-test_rc4.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_rc4.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/05-test_rc4.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_rc4.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/05-test_rc5.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_rc5.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/05-test_rc5.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/05-test_rc5.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/06-test-rdrand.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/06-test-rdrand.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/06-test-rdrand.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/06-test-rdrand.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/10-test_bn.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/10-test_bn.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/10-test_bn.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/10-test_bn.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/10-test_bn_data/bnexp.txt b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/10-test_bn_data/bnexp.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/10-test_bn_data/bnexp.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/10-test_bn_data/bnexp.txt diff --git a/src/openssl/openssl-1.1.1w/test/recipes/10-test_bn_data/bngcd.txt b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/10-test_bn_data/bngcd.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/10-test_bn_data/bngcd.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/10-test_bn_data/bngcd.txt diff --git a/src/openssl/openssl-1.1.1w/test/recipes/10-test_bn_data/bnmod.txt b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/10-test_bn_data/bnmod.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/10-test_bn_data/bnmod.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/10-test_bn_data/bnmod.txt diff --git a/src/openssl/openssl-1.1.1w/test/recipes/10-test_bn_data/bnmul.txt b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/10-test_bn_data/bnmul.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/10-test_bn_data/bnmul.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/10-test_bn_data/bnmul.txt diff --git a/src/openssl/openssl-1.1.1w/test/recipes/10-test_bn_data/bnshift.txt b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/10-test_bn_data/bnshift.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/10-test_bn_data/bnshift.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/10-test_bn_data/bnshift.txt diff --git a/src/openssl/openssl-1.1.1w/test/recipes/10-test_bn_data/bnsum.txt b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/10-test_bn_data/bnsum.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/10-test_bn_data/bnsum.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/10-test_bn_data/bnsum.txt diff --git a/src/openssl/openssl-1.1.1w/test/recipes/10-test_exp.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/10-test_exp.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/10-test_exp.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/10-test_exp.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_dh.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_dh.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_dh.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_dh.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_dsa.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_dsa.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_dsa.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_dsa.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ec.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ec.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ec.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ec.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecdsa.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecdsa.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecdsa.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecdsa.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/invalid/c2pnb208w1-reducible.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/invalid/c2pnb208w1-reducible.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/invalid/c2pnb208w1-reducible.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/invalid/c2pnb208w1-reducible.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/invalid/nistp256-nonprime.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/invalid/nistp256-nonprime.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/invalid/nistp256-nonprime.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/invalid/nistp256-nonprime.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/invalid/nistp256-offcurve.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/invalid/nistp256-offcurve.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/invalid/nistp256-offcurve.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/invalid/nistp256-offcurve.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/invalid/nistp256-wrongorder.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/invalid/nistp256-wrongorder.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/invalid/nistp256-wrongorder.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/invalid/nistp256-wrongorder.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb163v1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb163v1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb163v1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb163v1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb163v1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb163v1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb163v1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb163v1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb163v2-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb163v2-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb163v2-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb163v2-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb163v2-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb163v2-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb163v2-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb163v2-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb163v3-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb163v3-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb163v3-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb163v3-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb163v3-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb163v3-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb163v3-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb163v3-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb176v1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb176v1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb176v1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb176v1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb176v1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb176v1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb176v1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb176v1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb208w1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb208w1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb208w1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb208w1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb208w1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb208w1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb208w1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb208w1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb272w1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb272w1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb272w1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb272w1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb272w1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb272w1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb272w1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb272w1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb304w1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb304w1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb304w1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb304w1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb304w1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb304w1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb304w1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb304w1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb368w1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb368w1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb368w1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb368w1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb368w1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb368w1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2pnb368w1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2pnb368w1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb191v1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb191v1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb191v1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb191v1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb191v1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb191v1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb191v1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb191v1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb191v2-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb191v2-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb191v2-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb191v2-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb191v2-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb191v2-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb191v2-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb191v2-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb191v3-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb191v3-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb191v3-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb191v3-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb191v3-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb191v3-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb191v3-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb191v3-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb239v1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb239v1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb239v1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb239v1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb239v1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb239v1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb239v1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb239v1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb239v2-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb239v2-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb239v2-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb239v2-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb239v2-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb239v2-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb239v2-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb239v2-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb239v3-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb239v3-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb239v3-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb239v3-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb239v3-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb239v3-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb239v3-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb239v3-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb359v1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb359v1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb359v1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb359v1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb359v1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb359v1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb359v1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb359v1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb431r1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb431r1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb431r1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb431r1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb431r1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb431r1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/c2tnb431r1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/c2tnb431r1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime192v1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime192v1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime192v1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime192v1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime192v1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime192v1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime192v1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime192v1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime192v2-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime192v2-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime192v2-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime192v2-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime192v2-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime192v2-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime192v2-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime192v2-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime192v3-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime192v3-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime192v3-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime192v3-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime192v3-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime192v3-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime192v3-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime192v3-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime239v1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime239v1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime239v1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime239v1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime239v1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime239v1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime239v1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime239v1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime239v2-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime239v2-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime239v2-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime239v2-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime239v2-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime239v2-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime239v2-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime239v2-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime239v3-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime239v3-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime239v3-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime239v3-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime239v3-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime239v3-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime239v3-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime239v3-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime256v1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime256v1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime256v1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime256v1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime256v1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime256v1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/prime256v1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/prime256v1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp112r1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp112r1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp112r1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp112r1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp112r1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp112r1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp112r1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp112r1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp112r2-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp112r2-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp112r2-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp112r2-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp112r2-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp112r2-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp112r2-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp112r2-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp128r1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp128r1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp128r1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp128r1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp128r1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp128r1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp128r1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp128r1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp128r2-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp128r2-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp128r2-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp128r2-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp128r2-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp128r2-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp128r2-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp128r2-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp160k1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp160k1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp160k1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp160k1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp160k1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp160k1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp160k1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp160k1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp160r1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp160r1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp160r1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp160r1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp160r1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp160r1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp160r1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp160r1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp160r2-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp160r2-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp160r2-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp160r2-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp160r2-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp160r2-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp160r2-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp160r2-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp192k1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp192k1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp192k1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp192k1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp192k1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp192k1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp192k1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp192k1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp224k1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp224k1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp224k1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp224k1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp224k1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp224k1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp224k1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp224k1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp224r1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp224r1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp224r1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp224r1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp224r1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp224r1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp224r1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp224r1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp256k1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp256k1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp256k1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp256k1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp256k1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp256k1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp256k1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp256k1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp384r1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp384r1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp384r1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp384r1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp384r1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp384r1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp384r1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp384r1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp521r1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp521r1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp521r1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp521r1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp521r1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp521r1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/secp521r1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/secp521r1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect113r1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect113r1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect113r1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect113r1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect113r1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect113r1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect113r1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect113r1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect113r2-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect113r2-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect113r2-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect113r2-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect113r2-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect113r2-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect113r2-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect113r2-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect131r1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect131r1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect131r1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect131r1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect131r1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect131r1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect131r1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect131r1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect131r2-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect131r2-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect131r2-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect131r2-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect131r2-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect131r2-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect131r2-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect131r2-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect163k1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect163k1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect163k1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect163k1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect163k1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect163k1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect163k1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect163k1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect163r1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect163r1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect163r1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect163r1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect163r1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect163r1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect163r1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect163r1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect163r2-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect163r2-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect163r2-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect163r2-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect163r2-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect163r2-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect163r2-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect163r2-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect193r1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect193r1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect193r1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect193r1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect193r1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect193r1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect193r1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect193r1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect193r2-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect193r2-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect193r2-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect193r2-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect193r2-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect193r2-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect193r2-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect193r2-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect233k1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect233k1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect233k1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect233k1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect233k1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect233k1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect233k1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect233k1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect233r1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect233r1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect233r1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect233r1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect233r1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect233r1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect233r1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect233r1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect239k1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect239k1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect239k1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect239k1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect239k1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect239k1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect239k1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect239k1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect283k1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect283k1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect283k1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect283k1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect283k1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect283k1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect283k1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect283k1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect283r1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect283r1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect283r1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect283r1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect283r1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect283r1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect283r1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect283r1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect409k1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect409k1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect409k1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect409k1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect409k1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect409k1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect409k1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect409k1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect409r1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect409r1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect409r1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect409r1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect409r1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect409r1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect409r1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect409r1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect571k1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect571k1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect571k1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect571k1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect571k1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect571k1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect571k1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect571k1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect571r1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect571r1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect571r1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect571r1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect571r1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect571r1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/sect571r1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/sect571r1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls1-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls1-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls1-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls1-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls1-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls1-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls1-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls1-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls10-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls10-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls10-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls10-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls10-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls10-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls10-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls10-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls11-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls11-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls11-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls11-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls11-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls11-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls11-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls11-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls12-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls12-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls12-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls12-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls12-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls12-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls12-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls12-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls3-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls3-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls3-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls3-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls3-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls3-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls3-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls3-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls4-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls4-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls4-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls4-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls4-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls4-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls4-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls4-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls5-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls5-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls5-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls5-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls5-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls5-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls5-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls5-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls6-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls6-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls6-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls6-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls6-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls6-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls6-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls6-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls7-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls7-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls7-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls7-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls7-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls7-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls7-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls7-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls8-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls8-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls8-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls8-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls8-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls8-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls8-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls8-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls9-explicit.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls9-explicit.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls9-explicit.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls9-explicit.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls9-named.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls9-named.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls9-named.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_ecparam_data/valid/wap-wsg-idm-ecid-wtls9-named.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_genec.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_genec.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_genec.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_genec.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_genrsa.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_genrsa.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_genrsa.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_genrsa.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_mp_rsa.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_mp_rsa.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_mp_rsa.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_mp_rsa.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_mp_rsa_data/plain_text b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_mp_rsa_data/plain_text similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_mp_rsa_data/plain_text rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_mp_rsa_data/plain_text diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_out_option.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_out_option.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_out_option.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_out_option.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_rsa.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_rsa.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_rsa.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_rsa.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/15-test_rsapss.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_rsapss.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/15-test_rsapss.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/15-test_rsapss.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/20-test_dgst.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/20-test_dgst.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/20-test_dgst.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/20-test_dgst.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/20-test_enc.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/20-test_enc.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/20-test_enc.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/20-test_enc.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/20-test_enc_more.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/20-test_enc_more.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/20-test_enc_more.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/20-test_enc_more.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/20-test_passwd.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/20-test_passwd.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/20-test_passwd.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/20-test_passwd.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/25-test_crl.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/25-test_crl.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/25-test_crl.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/25-test_crl.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/25-test_d2i.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/25-test_d2i.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/25-test_d2i.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/25-test_d2i.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/25-test_pkcs7.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/25-test_pkcs7.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/25-test_pkcs7.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/25-test_pkcs7.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/25-test_req.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/25-test_req.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/25-test_req.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/25-test_req.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/25-test_sid.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/25-test_sid.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/25-test_sid.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/25-test_sid.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/25-test_verify.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/25-test_verify.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/25-test_verify.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/25-test_verify.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/25-test_x509.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/25-test_x509.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/25-test_x509.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/25-test_x509.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/30-test_afalg.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_afalg.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/30-test_afalg.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_afalg.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/30-test_engine.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_engine.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/30-test_engine.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_engine.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/30-test_evp.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/30-test_evp.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evpcase.txt b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evpcase.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evpcase.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evpcase.txt diff --git a/src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evpccmcavs.txt b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evpccmcavs.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evpccmcavs.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evpccmcavs.txt diff --git a/src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evpciph.txt b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evpciph.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evpciph.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evpciph.txt diff --git a/src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evpdigest.txt b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evpdigest.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evpdigest.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evpdigest.txt diff --git a/src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evpencod.txt b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evpencod.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evpencod.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evpencod.txt diff --git a/src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evpkdf.txt b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evpkdf.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evpkdf.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evpkdf.txt diff --git a/src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evpmac.txt b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evpmac.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evpmac.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evpmac.txt diff --git a/src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evppbe.txt b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evppbe.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evppbe.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evppbe.txt diff --git a/src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evppkey.txt b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evppkey.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evppkey.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evppkey.txt diff --git a/src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evppkey_ecc.txt b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evppkey_ecc.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_data/evppkey_ecc.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_data/evppkey_ecc.txt diff --git a/src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_extra.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_extra.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/30-test_evp_extra.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_evp_extra.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/30-test_pbelu.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_pbelu.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/30-test_pbelu.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_pbelu.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/30-test_pkey_meth.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_pkey_meth.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/30-test_pkey_meth.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_pkey_meth.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/30-test_pkey_meth_kdf.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_pkey_meth_kdf.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/30-test_pkey_meth_kdf.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/30-test_pkey_meth_kdf.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/40-test_rehash.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/40-test_rehash.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/40-test_rehash.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/40-test_rehash.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/60-test_x509_check_cert_pkey.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/60-test_x509_check_cert_pkey.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/60-test_x509_check_cert_pkey.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/60-test_x509_check_cert_pkey.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/60-test_x509_dup_cert.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/60-test_x509_dup_cert.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/60-test_x509_dup_cert.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/60-test_x509_dup_cert.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/60-test_x509_store.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/60-test_x509_store.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/60-test_x509_store.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/60-test_x509_store.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/60-test_x509_time.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/60-test_x509_time.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/60-test_x509_time.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/60-test_x509_time.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_asyncio.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_asyncio.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_asyncio.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_asyncio.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_bad_dtls.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_bad_dtls.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_bad_dtls.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_bad_dtls.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_clienthello.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_clienthello.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_clienthello.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_clienthello.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_comp.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_comp.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_comp.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_comp.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_key_share.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_key_share.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_key_share.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_key_share.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_packet.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_packet.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_packet.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_packet.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_recordlen.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_recordlen.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_recordlen.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_recordlen.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_renegotiation.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_renegotiation.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_renegotiation.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_renegotiation.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_servername.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_servername.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_servername.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_servername.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_sslcbcpadding.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslcbcpadding.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_sslcbcpadding.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslcbcpadding.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_sslcertstatus.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslcertstatus.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_sslcertstatus.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslcertstatus.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_sslextension.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslextension.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_sslextension.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslextension.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_sslmessages.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslmessages.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_sslmessages.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslmessages.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_sslrecords.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslrecords.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_sslrecords.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslrecords.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_sslsessiontick.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslsessiontick.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_sslsessiontick.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslsessiontick.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_sslsigalgs.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslsigalgs.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_sslsigalgs.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslsigalgs.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_sslsignature.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslsignature.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_sslsignature.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslsignature.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_sslskewith0p.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslskewith0p.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_sslskewith0p.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslskewith0p.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_sslversions.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslversions.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_sslversions.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslversions.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_sslvertol.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslvertol.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_sslvertol.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_sslvertol.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_tls13alerts.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_tls13alerts.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_tls13alerts.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_tls13alerts.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_tls13cookie.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_tls13cookie.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_tls13cookie.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_tls13cookie.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_tls13downgrade.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_tls13downgrade.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_tls13downgrade.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_tls13downgrade.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_tls13hrr.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_tls13hrr.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_tls13hrr.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_tls13hrr.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_tls13kexmodes.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_tls13kexmodes.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_tls13kexmodes.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_tls13kexmodes.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_tls13messages.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_tls13messages.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_tls13messages.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_tls13messages.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_tls13psk.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_tls13psk.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_tls13psk.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_tls13psk.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_tlsextms.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_tlsextms.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_tlsextms.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_tlsextms.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_verify_extra.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_verify_extra.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_verify_extra.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_verify_extra.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/70-test_wpacket.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_wpacket.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/70-test_wpacket.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/70-test_wpacket.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_ca.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ca.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_ca.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ca.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_cipherbytes.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_cipherbytes.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_cipherbytes.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_cipherbytes.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_cipherlist.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_cipherlist.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_cipherlist.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_cipherlist.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_ciphername.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ciphername.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_ciphername.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ciphername.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_cms.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_cms.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_cms.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_cms.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_cms_data/bad_signtime_attr.cms b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_cms_data/bad_signtime_attr.cms similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_cms_data/bad_signtime_attr.cms rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_cms_data/bad_signtime_attr.cms diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_cms_data/ct_multiple_attr.cms b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_cms_data/ct_multiple_attr.cms similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_cms_data/ct_multiple_attr.cms rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_cms_data/ct_multiple_attr.cms diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_cms_data/no_ct_attr.cms b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_cms_data/no_ct_attr.cms similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_cms_data/no_ct_attr.cms rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_cms_data/no_ct_attr.cms diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_cms_data/no_md_attr.cms b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_cms_data/no_md_attr.cms similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_cms_data/no_md_attr.cms rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_cms_data/no_md_attr.cms diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_cmsapi.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_cmsapi.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_cmsapi.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_cmsapi.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_ct.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ct.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_ct.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ct.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_dane.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_dane.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_dane.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_dane.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_dtls.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_dtls.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_dtls.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_dtls.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_dtls_mtu.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_dtls_mtu.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_dtls_mtu.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_dtls_mtu.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_dtlsv1listen.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_dtlsv1listen.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_dtlsv1listen.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_dtlsv1listen.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_ocsp.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ocsp.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_ocsp.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ocsp.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_ocsp_data/cert.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ocsp_data/cert.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_ocsp_data/cert.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ocsp_data/cert.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_ocsp_data/key.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ocsp_data/key.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_ocsp_data/key.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ocsp_data/key.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_pkcs12.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_pkcs12.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_pkcs12.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_pkcs12.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_policy_tree.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_policy_tree.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_policy_tree.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_policy_tree.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_policy_tree_data/large_leaf.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_policy_tree_data/large_leaf.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_policy_tree_data/large_leaf.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_policy_tree_data/large_leaf.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_policy_tree_data/large_policy_tree.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_policy_tree_data/large_policy_tree.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_policy_tree_data/large_policy_tree.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_policy_tree_data/large_policy_tree.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_policy_tree_data/small_leaf.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_policy_tree_data/small_leaf.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_policy_tree_data/small_leaf.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_policy_tree_data/small_leaf.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_policy_tree_data/small_policy_tree.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_policy_tree_data/small_policy_tree.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_policy_tree_data/small_policy_tree.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_policy_tree_data/small_policy_tree.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_ssl_new.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ssl_new.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_ssl_new.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ssl_new.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_ssl_old.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ssl_old.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_ssl_old.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ssl_old.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_ssl_test_ctx.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ssl_test_ctx.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_ssl_test_ctx.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_ssl_test_ctx.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_sslcorrupt.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_sslcorrupt.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_sslcorrupt.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_sslcorrupt.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_tsa.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_tsa.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_tsa.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_tsa.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/80-test_x509aux.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_x509aux.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/80-test_x509aux.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/80-test_x509aux.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_asn1_time.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_asn1_time.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_asn1_time.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_asn1_time.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_async.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_async.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_async.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_async.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_bio_enc.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_bio_enc.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_bio_enc.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_bio_enc.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_bio_memleak.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_bio_memleak.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_bio_memleak.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_bio_memleak.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_constant_time.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_constant_time.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_constant_time.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_constant_time.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_fatalerr.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_fatalerr.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_fatalerr.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_fatalerr.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_gmdiff.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_gmdiff.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_gmdiff.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_gmdiff.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_gost.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_gost.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_gost.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_gost.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_gost_data/gost.conf b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_gost_data/gost.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_gost_data/gost.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_gost_data/gost.conf diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_gost_data/server-cert2001.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_gost_data/server-cert2001.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_gost_data/server-cert2001.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_gost_data/server-cert2001.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_gost_data/server-cert2012.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_gost_data/server-cert2012.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_gost_data/server-cert2012.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_gost_data/server-cert2012.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_gost_data/server-key2001.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_gost_data/server-key2001.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_gost_data/server-key2001.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_gost_data/server-key2001.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_gost_data/server-key2012.pem b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_gost_data/server-key2012.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_gost_data/server-key2012.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_gost_data/server-key2012.pem diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_ige.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_ige.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_ige.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_ige.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_includes.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_includes.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/conf-includes/includes1.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/conf-includes/includes1.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/conf-includes/includes1.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/conf-includes/includes1.cnf diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/conf-includes/includes2.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/conf-includes/includes2.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/conf-includes/includes2.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/conf-includes/includes2.cnf diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/includes-broken.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/includes-broken.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/includes-broken.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/includes-broken.cnf diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/includes-eq-ws.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/includes-eq-ws.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/includes-eq-ws.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/includes-eq-ws.cnf diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/includes-eq.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/includes-eq.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/includes-eq.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/includes-eq.cnf diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/includes-file.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/includes-file.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/includes-file.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/includes-file.cnf diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/includes.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/includes.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/includes.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/includes.cnf diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/vms-includes-file.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/vms-includes-file.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/vms-includes-file.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/vms-includes-file.cnf diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/vms-includes.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/vms-includes.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_includes_data/vms-includes.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_includes_data/vms-includes.cnf diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_memleak.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_memleak.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_memleak.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_memleak.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_overhead.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_overhead.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_overhead.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_overhead.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_secmem.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_secmem.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_secmem.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_secmem.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_shlibload.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_shlibload.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_shlibload.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_shlibload.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_srp.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_srp.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_srp.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_srp.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_sslapi.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_sslapi.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_sslapi.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_sslapi.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_sslapi_data/passwd.txt b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_sslapi_data/passwd.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_sslapi_data/passwd.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_sslapi_data/passwd.txt diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_sslbuffers.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_sslbuffers.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_sslbuffers.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_sslbuffers.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_store.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_store.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_store.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_store.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_store_data/ca.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_store_data/ca.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_store_data/ca.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_store_data/ca.cnf diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_store_data/user.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_store_data/user.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_store_data/user.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_store_data/user.cnf diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_sysdefault.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_sysdefault.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_sysdefault.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_sysdefault.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_threads.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_threads.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_threads.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_threads.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_time_offset.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_time_offset.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_time_offset.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_time_offset.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_tls13ccs.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_tls13ccs.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_tls13ccs.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_tls13ccs.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_tls13encryption.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_tls13encryption.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_tls13encryption.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_tls13encryption.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_tls13secrets.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_tls13secrets.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_tls13secrets.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_tls13secrets.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/90-test_v3name.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_v3name.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/90-test_v3name.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/90-test_v3name.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/95-test_external_boringssl.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/95-test_external_boringssl.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/95-test_external_boringssl.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/95-test_external_boringssl.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/95-test_external_krb5.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/95-test_external_krb5.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/95-test_external_krb5.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/95-test_external_krb5.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/95-test_external_krb5_data/krb5.sh b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/95-test_external_krb5_data/krb5.sh similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/95-test_external_krb5_data/krb5.sh rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/95-test_external_krb5_data/krb5.sh diff --git a/src/openssl/openssl-1.1.1w/test/recipes/95-test_external_pyca.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/95-test_external_pyca.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/95-test_external_pyca.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/95-test_external_pyca.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/95-test_external_pyca_data/cryptography.sh b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/95-test_external_pyca_data/cryptography.sh similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/95-test_external_pyca_data/cryptography.sh rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/95-test_external_pyca_data/cryptography.sh diff --git a/src/openssl/openssl-1.1.1w/test/recipes/99-test_ecstress.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/99-test_ecstress.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/99-test_ecstress.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/99-test_ecstress.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/99-test_fuzz.t b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/99-test_fuzz.t similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/99-test_fuzz.t rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/99-test_fuzz.t diff --git a/src/openssl/openssl-1.1.1w/test/recipes/ocsp-response.der b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/ocsp-response.der similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/ocsp-response.der rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/ocsp-response.der diff --git a/src/openssl/openssl-1.1.1w/test/recipes/tconversion.pl b/src/openssl/openssl-1.1.1w-chevah2/test/recipes/tconversion.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recipes/tconversion.pl rename to src/openssl/openssl-1.1.1w-chevah2/test/recipes/tconversion.pl diff --git a/src/openssl/openssl-1.1.1w/test/recordlentest.c b/src/openssl/openssl-1.1.1w-chevah2/test/recordlentest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/recordlentest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/recordlentest.c diff --git a/src/openssl/openssl-1.1.1w/test/rsa_complex.c b/src/openssl/openssl-1.1.1w-chevah2/test/rsa_complex.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/rsa_complex.c rename to src/openssl/openssl-1.1.1w-chevah2/test/rsa_complex.c diff --git a/src/openssl/openssl-1.1.1w/test/rsa_mp_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/rsa_mp_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/rsa_mp_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/rsa_mp_test.c diff --git a/src/openssl/openssl-1.1.1w/test/rsa_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/rsa_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/rsa_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/rsa_test.c diff --git a/src/openssl/openssl-1.1.1w/test/run_tests.pl b/src/openssl/openssl-1.1.1w-chevah2/test/run_tests.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/test/run_tests.pl rename to src/openssl/openssl-1.1.1w-chevah2/test/run_tests.pl diff --git a/src/openssl/openssl-1.1.1w/test/sanitytest.c b/src/openssl/openssl-1.1.1w-chevah2/test/sanitytest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/sanitytest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/sanitytest.c diff --git a/src/openssl/openssl-1.1.1w/test/secmemtest.c b/src/openssl/openssl-1.1.1w-chevah2/test/secmemtest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/secmemtest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/secmemtest.c diff --git a/src/openssl/openssl-1.1.1w/test/serverinfo.pem b/src/openssl/openssl-1.1.1w-chevah2/test/serverinfo.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/serverinfo.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/serverinfo.pem diff --git a/src/openssl/openssl-1.1.1w/test/serverinfo2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/serverinfo2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/serverinfo2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/serverinfo2.pem diff --git a/src/openssl/openssl-1.1.1w/test/servername_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/servername_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/servername_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/servername_test.c diff --git a/src/openssl/openssl-1.1.1w/test/session.pem b/src/openssl/openssl-1.1.1w-chevah2/test/session.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/session.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/session.pem diff --git a/src/openssl/openssl-1.1.1w/test/shibboleth.pfx b/src/openssl/openssl-1.1.1w-chevah2/test/shibboleth.pfx similarity index 100% rename from src/openssl/openssl-1.1.1w/test/shibboleth.pfx rename to src/openssl/openssl-1.1.1w-chevah2/test/shibboleth.pfx diff --git a/src/openssl/openssl-1.1.1w/test/shlibloadtest.c b/src/openssl/openssl-1.1.1w-chevah2/test/shlibloadtest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/shlibloadtest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/shlibloadtest.c diff --git a/src/openssl/openssl-1.1.1w/test/siphash_internal_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/siphash_internal_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/siphash_internal_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/siphash_internal_test.c diff --git a/src/openssl/openssl-1.1.1w/test/sm2_internal_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/sm2_internal_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/sm2_internal_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/sm2_internal_test.c diff --git a/src/openssl/openssl-1.1.1w/test/sm4_internal_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/sm4_internal_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/sm4_internal_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/sm4_internal_test.c diff --git a/src/openssl/openssl-1.1.1w/test/smcont.txt b/src/openssl/openssl-1.1.1w-chevah2/test/smcont.txt similarity index 100% rename from src/openssl/openssl-1.1.1w/test/smcont.txt rename to src/openssl/openssl-1.1.1w-chevah2/test/smcont.txt diff --git a/src/openssl/openssl-1.1.1w/test/smime-certs/badrsa.pem b/src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/badrsa.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/smime-certs/badrsa.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/badrsa.pem diff --git a/src/openssl/openssl-1.1.1w/test/smime-certs/ca.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/ca.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/smime-certs/ca.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/ca.cnf diff --git a/src/openssl/openssl-1.1.1w/test/smime-certs/mksmime-certs.sh b/src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/mksmime-certs.sh similarity index 100% rename from src/openssl/openssl-1.1.1w/test/smime-certs/mksmime-certs.sh rename to src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/mksmime-certs.sh diff --git a/src/openssl/openssl-1.1.1w/test/smime-certs/smdh.pem b/src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smdh.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/smime-certs/smdh.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smdh.pem diff --git a/src/openssl/openssl-1.1.1w/test/smime-certs/smdsa1.pem b/src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smdsa1.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/smime-certs/smdsa1.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smdsa1.pem diff --git a/src/openssl/openssl-1.1.1w/test/smime-certs/smdsa2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smdsa2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/smime-certs/smdsa2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smdsa2.pem diff --git a/src/openssl/openssl-1.1.1w/test/smime-certs/smdsa3.pem b/src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smdsa3.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/smime-certs/smdsa3.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smdsa3.pem diff --git a/src/openssl/openssl-1.1.1w/test/smime-certs/smdsap.pem b/src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smdsap.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/smime-certs/smdsap.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smdsap.pem diff --git a/src/openssl/openssl-1.1.1w/test/smime-certs/smec1.pem b/src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smec1.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/smime-certs/smec1.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smec1.pem diff --git a/src/openssl/openssl-1.1.1w/test/smime-certs/smec2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smec2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/smime-certs/smec2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smec2.pem diff --git a/src/openssl/openssl-1.1.1w/test/smime-certs/smec3.pem b/src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smec3.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/smime-certs/smec3.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smec3.pem diff --git a/src/openssl/openssl-1.1.1w/test/smime-certs/smroot.pem b/src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smroot.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/smime-certs/smroot.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smroot.pem diff --git a/src/openssl/openssl-1.1.1w/test/smime-certs/smrsa1.pem b/src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smrsa1.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/smime-certs/smrsa1.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smrsa1.pem diff --git a/src/openssl/openssl-1.1.1w/test/smime-certs/smrsa2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smrsa2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/smime-certs/smrsa2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smrsa2.pem diff --git a/src/openssl/openssl-1.1.1w/test/smime-certs/smrsa3.pem b/src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smrsa3.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/smime-certs/smrsa3.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/smime-certs/smrsa3.pem diff --git a/src/openssl/openssl-1.1.1w/test/srptest.c b/src/openssl/openssl-1.1.1w-chevah2/test/srptest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/srptest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/srptest.c diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/01-simple.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/01-simple.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/01-simple.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/01-simple.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/01-simple.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/01-simple.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/01-simple.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/01-simple.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/02-protocol-version.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/02-protocol-version.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/02-protocol-version.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/02-protocol-version.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/02-protocol-version.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/02-protocol-version.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/02-protocol-version.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/02-protocol-version.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/03-custom_verify.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/03-custom_verify.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/03-custom_verify.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/03-custom_verify.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/03-custom_verify.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/03-custom_verify.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/03-custom_verify.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/03-custom_verify.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/04-client_auth.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/04-client_auth.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/04-client_auth.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/04-client_auth.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/04-client_auth.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/04-client_auth.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/04-client_auth.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/04-client_auth.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/05-sni.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/05-sni.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/05-sni.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/05-sni.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/05-sni.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/05-sni.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/05-sni.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/05-sni.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/06-sni-ticket.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/06-sni-ticket.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/06-sni-ticket.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/06-sni-ticket.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/06-sni-ticket.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/06-sni-ticket.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/06-sni-ticket.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/06-sni-ticket.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/07-dtls-protocol-version.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/07-dtls-protocol-version.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/07-dtls-protocol-version.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/07-dtls-protocol-version.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/07-dtls-protocol-version.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/07-dtls-protocol-version.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/07-dtls-protocol-version.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/07-dtls-protocol-version.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/08-npn.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/08-npn.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/08-npn.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/08-npn.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/08-npn.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/08-npn.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/08-npn.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/08-npn.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/09-alpn.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/09-alpn.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/09-alpn.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/09-alpn.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/09-alpn.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/09-alpn.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/09-alpn.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/09-alpn.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/10-resumption.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/10-resumption.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/10-resumption.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/10-resumption.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/10-resumption.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/10-resumption.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/10-resumption.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/10-resumption.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/11-dtls_resumption.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/11-dtls_resumption.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/11-dtls_resumption.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/11-dtls_resumption.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/11-dtls_resumption.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/11-dtls_resumption.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/11-dtls_resumption.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/11-dtls_resumption.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/12-ct.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/12-ct.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/12-ct.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/12-ct.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/12-ct.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/12-ct.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/12-ct.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/12-ct.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/13-fragmentation.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/13-fragmentation.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/13-fragmentation.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/13-fragmentation.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/13-fragmentation.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/13-fragmentation.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/13-fragmentation.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/13-fragmentation.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/14-curves.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/14-curves.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/14-curves.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/14-curves.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/14-curves.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/14-curves.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/14-curves.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/14-curves.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/15-certstatus.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/15-certstatus.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/15-certstatus.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/15-certstatus.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/15-certstatus.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/15-certstatus.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/15-certstatus.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/15-certstatus.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/16-dtls-certstatus.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/16-dtls-certstatus.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/16-dtls-certstatus.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/16-dtls-certstatus.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/16-dtls-certstatus.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/16-dtls-certstatus.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/16-dtls-certstatus.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/16-dtls-certstatus.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/17-renegotiate.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/17-renegotiate.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/17-renegotiate.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/17-renegotiate.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/17-renegotiate.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/17-renegotiate.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/17-renegotiate.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/17-renegotiate.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/18-dtls-renegotiate.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/18-dtls-renegotiate.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/18-dtls-renegotiate.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/18-dtls-renegotiate.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/18-dtls-renegotiate.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/18-dtls-renegotiate.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/18-dtls-renegotiate.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/18-dtls-renegotiate.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/19-mac-then-encrypt.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/19-mac-then-encrypt.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/19-mac-then-encrypt.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/19-mac-then-encrypt.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/19-mac-then-encrypt.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/19-mac-then-encrypt.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/19-mac-then-encrypt.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/19-mac-then-encrypt.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/20-cert-select.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/20-cert-select.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/20-cert-select.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/20-cert-select.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/20-cert-select.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/20-cert-select.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/20-cert-select.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/20-cert-select.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/21-key-update.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/21-key-update.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/21-key-update.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/21-key-update.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/21-key-update.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/21-key-update.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/21-key-update.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/21-key-update.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/22-compression.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/22-compression.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/22-compression.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/22-compression.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/22-compression.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/22-compression.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/22-compression.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/22-compression.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/23-srp.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/23-srp.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/23-srp.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/23-srp.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/23-srp.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/23-srp.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/23-srp.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/23-srp.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/24-padding.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/24-padding.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/24-padding.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/24-padding.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/24-padding.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/24-padding.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/24-padding.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/24-padding.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/25-cipher.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/25-cipher.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/25-cipher.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/25-cipher.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/25-cipher.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/25-cipher.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/25-cipher.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/25-cipher.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/26-tls13_client_auth.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/26-tls13_client_auth.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/26-tls13_client_auth.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/26-tls13_client_auth.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/26-tls13_client_auth.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/26-tls13_client_auth.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/26-tls13_client_auth.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/26-tls13_client_auth.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/27-ticket-appdata.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/27-ticket-appdata.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/27-ticket-appdata.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/27-ticket-appdata.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/27-ticket-appdata.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/27-ticket-appdata.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/27-ticket-appdata.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/27-ticket-appdata.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/28-seclevel.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/28-seclevel.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/28-seclevel.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/28-seclevel.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/28-seclevel.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/28-seclevel.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/28-seclevel.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/28-seclevel.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/29-dtls-sctp-label-bug.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/29-dtls-sctp-label-bug.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/29-dtls-sctp-label-bug.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/29-dtls-sctp-label-bug.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/29-dtls-sctp-label-bug.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/29-dtls-sctp-label-bug.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/29-dtls-sctp-label-bug.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/29-dtls-sctp-label-bug.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/30-supported-groups.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/30-supported-groups.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/30-supported-groups.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/30-supported-groups.conf diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/30-supported-groups.conf.in b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/30-supported-groups.conf.in similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/30-supported-groups.conf.in rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/30-supported-groups.conf.in diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/protocol_version.pm b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/protocol_version.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/protocol_version.pm rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/protocol_version.pm diff --git a/src/openssl/openssl-1.1.1w/test/ssl-tests/ssltests_base.pm b/src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/ssltests_base.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl-tests/ssltests_base.pm rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl-tests/ssltests_base.pm diff --git a/src/openssl/openssl-1.1.1w/test/ssl_cert_table_internal_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/ssl_cert_table_internal_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl_cert_table_internal_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl_cert_table_internal_test.c diff --git a/src/openssl/openssl-1.1.1w/test/ssl_ctx_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/ssl_ctx_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl_ctx_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl_ctx_test.c diff --git a/src/openssl/openssl-1.1.1w/test/ssl_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/ssl_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl_test.c diff --git a/src/openssl/openssl-1.1.1w/test/ssl_test.tmpl b/src/openssl/openssl-1.1.1w-chevah2/test/ssl_test.tmpl similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl_test.tmpl rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl_test.tmpl diff --git a/src/openssl/openssl-1.1.1w/test/ssl_test_ctx.c b/src/openssl/openssl-1.1.1w-chevah2/test/ssl_test_ctx.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl_test_ctx.c rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl_test_ctx.c diff --git a/src/openssl/openssl-1.1.1w/test/ssl_test_ctx.h b/src/openssl/openssl-1.1.1w-chevah2/test/ssl_test_ctx.h similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl_test_ctx.h rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl_test_ctx.h diff --git a/src/openssl/openssl-1.1.1w/test/ssl_test_ctx_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/ssl_test_ctx_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl_test_ctx_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl_test_ctx_test.c diff --git a/src/openssl/openssl-1.1.1w/test/ssl_test_ctx_test.conf b/src/openssl/openssl-1.1.1w-chevah2/test/ssl_test_ctx_test.conf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssl_test_ctx_test.conf rename to src/openssl/openssl-1.1.1w-chevah2/test/ssl_test_ctx_test.conf diff --git a/src/openssl/openssl-1.1.1w/test/sslapitest.c b/src/openssl/openssl-1.1.1w-chevah2/test/sslapitest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/sslapitest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/sslapitest.c diff --git a/src/openssl/openssl-1.1.1w/test/sslbuffertest.c b/src/openssl/openssl-1.1.1w-chevah2/test/sslbuffertest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/sslbuffertest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/sslbuffertest.c diff --git a/src/openssl/openssl-1.1.1w/test/sslcorrupttest.c b/src/openssl/openssl-1.1.1w-chevah2/test/sslcorrupttest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/sslcorrupttest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/sslcorrupttest.c diff --git a/src/openssl/openssl-1.1.1w/test/ssltest_old.c b/src/openssl/openssl-1.1.1w-chevah2/test/ssltest_old.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssltest_old.c rename to src/openssl/openssl-1.1.1w-chevah2/test/ssltest_old.c diff --git a/src/openssl/openssl-1.1.1w/test/ssltestlib.c b/src/openssl/openssl-1.1.1w-chevah2/test/ssltestlib.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssltestlib.c rename to src/openssl/openssl-1.1.1w-chevah2/test/ssltestlib.c diff --git a/src/openssl/openssl-1.1.1w/test/ssltestlib.h b/src/openssl/openssl-1.1.1w-chevah2/test/ssltestlib.h similarity index 100% rename from src/openssl/openssl-1.1.1w/test/ssltestlib.h rename to src/openssl/openssl-1.1.1w-chevah2/test/ssltestlib.h diff --git a/src/openssl/openssl-1.1.1w/test/stack_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/stack_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/stack_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/stack_test.c diff --git a/src/openssl/openssl-1.1.1w/test/sysdefault.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/sysdefault.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/sysdefault.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/sysdefault.cnf diff --git a/src/openssl/openssl-1.1.1w/test/sysdefaulttest.c b/src/openssl/openssl-1.1.1w-chevah2/test/sysdefaulttest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/sysdefaulttest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/sysdefaulttest.c diff --git a/src/openssl/openssl-1.1.1w/test/test.cnf b/src/openssl/openssl-1.1.1w-chevah2/test/test.cnf similarity index 100% rename from src/openssl/openssl-1.1.1w/test/test.cnf rename to src/openssl/openssl-1.1.1w-chevah2/test/test.cnf diff --git a/src/openssl/openssl-1.1.1w/test/test_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/test_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/test_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/test_test.c diff --git a/src/openssl/openssl-1.1.1w/test/testcrl.pem b/src/openssl/openssl-1.1.1w-chevah2/test/testcrl.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testcrl.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/testcrl.pem diff --git a/src/openssl/openssl-1.1.1w/test/testdsa.pem b/src/openssl/openssl-1.1.1w-chevah2/test/testdsa.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testdsa.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/testdsa.pem diff --git a/src/openssl/openssl-1.1.1w/test/testdsapub.pem b/src/openssl/openssl-1.1.1w-chevah2/test/testdsapub.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testdsapub.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/testdsapub.pem diff --git a/src/openssl/openssl-1.1.1w/test/testec-p256.pem b/src/openssl/openssl-1.1.1w-chevah2/test/testec-p256.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testec-p256.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/testec-p256.pem diff --git a/src/openssl/openssl-1.1.1w/test/testecpub-p256.pem b/src/openssl/openssl-1.1.1w-chevah2/test/testecpub-p256.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testecpub-p256.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/testecpub-p256.pem diff --git a/src/openssl/openssl-1.1.1w/test/tested25519.pem b/src/openssl/openssl-1.1.1w-chevah2/test/tested25519.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/tested25519.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/tested25519.pem diff --git a/src/openssl/openssl-1.1.1w/test/tested25519pub.pem b/src/openssl/openssl-1.1.1w-chevah2/test/tested25519pub.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/tested25519pub.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/tested25519pub.pem diff --git a/src/openssl/openssl-1.1.1w/test/tested448.pem b/src/openssl/openssl-1.1.1w-chevah2/test/tested448.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/tested448.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/tested448.pem diff --git a/src/openssl/openssl-1.1.1w/test/tested448pub.pem b/src/openssl/openssl-1.1.1w-chevah2/test/tested448pub.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/tested448pub.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/tested448pub.pem diff --git a/src/openssl/openssl-1.1.1w/test/testp7.pem b/src/openssl/openssl-1.1.1w-chevah2/test/testp7.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testp7.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/testp7.pem diff --git a/src/openssl/openssl-1.1.1w/test/testreq2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/testreq2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testreq2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/testreq2.pem diff --git a/src/openssl/openssl-1.1.1w/test/testrsa.pem b/src/openssl/openssl-1.1.1w-chevah2/test/testrsa.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testrsa.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/testrsa.pem diff --git a/src/openssl/openssl-1.1.1w/test/testrsa_withattrs.der b/src/openssl/openssl-1.1.1w-chevah2/test/testrsa_withattrs.der similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testrsa_withattrs.der rename to src/openssl/openssl-1.1.1w-chevah2/test/testrsa_withattrs.der diff --git a/src/openssl/openssl-1.1.1w/test/testrsa_withattrs.pem b/src/openssl/openssl-1.1.1w-chevah2/test/testrsa_withattrs.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testrsa_withattrs.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/testrsa_withattrs.pem diff --git a/src/openssl/openssl-1.1.1w/test/testrsapub.pem b/src/openssl/openssl-1.1.1w-chevah2/test/testrsapub.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testrsapub.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/testrsapub.pem diff --git a/src/openssl/openssl-1.1.1w/test/testsid.pem b/src/openssl/openssl-1.1.1w-chevah2/test/testsid.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testsid.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/testsid.pem diff --git a/src/openssl/openssl-1.1.1w/test/testutil.h b/src/openssl/openssl-1.1.1w-chevah2/test/testutil.h similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testutil.h rename to src/openssl/openssl-1.1.1w-chevah2/test/testutil.h diff --git a/src/openssl/openssl-1.1.1w/test/testutil/basic_output.c b/src/openssl/openssl-1.1.1w-chevah2/test/testutil/basic_output.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testutil/basic_output.c rename to src/openssl/openssl-1.1.1w-chevah2/test/testutil/basic_output.c diff --git a/src/openssl/openssl-1.1.1w/test/testutil/cb.c b/src/openssl/openssl-1.1.1w-chevah2/test/testutil/cb.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testutil/cb.c rename to src/openssl/openssl-1.1.1w-chevah2/test/testutil/cb.c diff --git a/src/openssl/openssl-1.1.1w/test/testutil/driver.c b/src/openssl/openssl-1.1.1w-chevah2/test/testutil/driver.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testutil/driver.c rename to src/openssl/openssl-1.1.1w-chevah2/test/testutil/driver.c diff --git a/src/openssl/openssl-1.1.1w/test/testutil/format_output.c b/src/openssl/openssl-1.1.1w-chevah2/test/testutil/format_output.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testutil/format_output.c rename to src/openssl/openssl-1.1.1w-chevah2/test/testutil/format_output.c diff --git a/src/openssl/openssl-1.1.1w/test/testutil/main.c b/src/openssl/openssl-1.1.1w-chevah2/test/testutil/main.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testutil/main.c rename to src/openssl/openssl-1.1.1w-chevah2/test/testutil/main.c diff --git a/src/openssl/openssl-1.1.1w/test/testutil/output.h b/src/openssl/openssl-1.1.1w-chevah2/test/testutil/output.h similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testutil/output.h rename to src/openssl/openssl-1.1.1w-chevah2/test/testutil/output.h diff --git a/src/openssl/openssl-1.1.1w/test/testutil/output_helpers.c b/src/openssl/openssl-1.1.1w-chevah2/test/testutil/output_helpers.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testutil/output_helpers.c rename to src/openssl/openssl-1.1.1w-chevah2/test/testutil/output_helpers.c diff --git a/src/openssl/openssl-1.1.1w/test/testutil/random.c b/src/openssl/openssl-1.1.1w-chevah2/test/testutil/random.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testutil/random.c rename to src/openssl/openssl-1.1.1w-chevah2/test/testutil/random.c diff --git a/src/openssl/openssl-1.1.1w/test/testutil/stanza.c b/src/openssl/openssl-1.1.1w-chevah2/test/testutil/stanza.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testutil/stanza.c rename to src/openssl/openssl-1.1.1w-chevah2/test/testutil/stanza.c diff --git a/src/openssl/openssl-1.1.1w/test/testutil/tap_bio.c b/src/openssl/openssl-1.1.1w-chevah2/test/testutil/tap_bio.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testutil/tap_bio.c rename to src/openssl/openssl-1.1.1w-chevah2/test/testutil/tap_bio.c diff --git a/src/openssl/openssl-1.1.1w/test/testutil/test_cleanup.c b/src/openssl/openssl-1.1.1w-chevah2/test/testutil/test_cleanup.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testutil/test_cleanup.c rename to src/openssl/openssl-1.1.1w-chevah2/test/testutil/test_cleanup.c diff --git a/src/openssl/openssl-1.1.1w/test/testutil/tests.c b/src/openssl/openssl-1.1.1w-chevah2/test/testutil/tests.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testutil/tests.c rename to src/openssl/openssl-1.1.1w-chevah2/test/testutil/tests.c diff --git a/src/openssl/openssl-1.1.1w/test/testutil/testutil_init.c b/src/openssl/openssl-1.1.1w-chevah2/test/testutil/testutil_init.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testutil/testutil_init.c rename to src/openssl/openssl-1.1.1w-chevah2/test/testutil/testutil_init.c diff --git a/src/openssl/openssl-1.1.1w/test/testutil/tu_local.h b/src/openssl/openssl-1.1.1w-chevah2/test/testutil/tu_local.h similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testutil/tu_local.h rename to src/openssl/openssl-1.1.1w-chevah2/test/testutil/tu_local.h diff --git a/src/openssl/openssl-1.1.1w/test/testx509.pem b/src/openssl/openssl-1.1.1w-chevah2/test/testx509.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/testx509.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/testx509.pem diff --git a/src/openssl/openssl-1.1.1w/test/threadstest.c b/src/openssl/openssl-1.1.1w-chevah2/test/threadstest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/threadstest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/threadstest.c diff --git a/src/openssl/openssl-1.1.1w/test/time_offset_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/time_offset_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/time_offset_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/time_offset_test.c diff --git a/src/openssl/openssl-1.1.1w/test/tls13ccstest.c b/src/openssl/openssl-1.1.1w-chevah2/test/tls13ccstest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/tls13ccstest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/tls13ccstest.c diff --git a/src/openssl/openssl-1.1.1w/test/tls13encryptiontest.c b/src/openssl/openssl-1.1.1w-chevah2/test/tls13encryptiontest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/tls13encryptiontest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/tls13encryptiontest.c diff --git a/src/openssl/openssl-1.1.1w/test/tls13secretstest.c b/src/openssl/openssl-1.1.1w-chevah2/test/tls13secretstest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/tls13secretstest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/tls13secretstest.c diff --git a/src/openssl/openssl-1.1.1w/test/uitest.c b/src/openssl/openssl-1.1.1w-chevah2/test/uitest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/uitest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/uitest.c diff --git a/src/openssl/openssl-1.1.1w/test/v3-cert1.pem b/src/openssl/openssl-1.1.1w-chevah2/test/v3-cert1.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/v3-cert1.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/v3-cert1.pem diff --git a/src/openssl/openssl-1.1.1w/test/v3-cert2.pem b/src/openssl/openssl-1.1.1w-chevah2/test/v3-cert2.pem similarity index 100% rename from src/openssl/openssl-1.1.1w/test/v3-cert2.pem rename to src/openssl/openssl-1.1.1w-chevah2/test/v3-cert2.pem diff --git a/src/openssl/openssl-1.1.1w/test/v3ext.c b/src/openssl/openssl-1.1.1w-chevah2/test/v3ext.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/v3ext.c rename to src/openssl/openssl-1.1.1w-chevah2/test/v3ext.c diff --git a/src/openssl/openssl-1.1.1w/test/v3nametest.c b/src/openssl/openssl-1.1.1w-chevah2/test/v3nametest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/v3nametest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/v3nametest.c diff --git a/src/openssl/openssl-1.1.1w/test/verify_extra_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/verify_extra_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/verify_extra_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/verify_extra_test.c diff --git a/src/openssl/openssl-1.1.1w/test/versions.c b/src/openssl/openssl-1.1.1w-chevah2/test/versions.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/versions.c rename to src/openssl/openssl-1.1.1w-chevah2/test/versions.c diff --git a/src/openssl/openssl-1.1.1w/test/wpackettest.c b/src/openssl/openssl-1.1.1w-chevah2/test/wpackettest.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/wpackettest.c rename to src/openssl/openssl-1.1.1w-chevah2/test/wpackettest.c diff --git a/src/openssl/openssl-1.1.1w/test/x509_check_cert_pkey_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/x509_check_cert_pkey_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/x509_check_cert_pkey_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/x509_check_cert_pkey_test.c diff --git a/src/openssl/openssl-1.1.1w/test/x509_dup_cert_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/x509_dup_cert_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/x509_dup_cert_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/x509_dup_cert_test.c diff --git a/src/openssl/openssl-1.1.1w/test/x509_internal_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/x509_internal_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/x509_internal_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/x509_internal_test.c diff --git a/src/openssl/openssl-1.1.1w/test/x509_time_test.c b/src/openssl/openssl-1.1.1w-chevah2/test/x509_time_test.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/x509_time_test.c rename to src/openssl/openssl-1.1.1w-chevah2/test/x509_time_test.c diff --git a/src/openssl/openssl-1.1.1w/test/x509aux.c b/src/openssl/openssl-1.1.1w-chevah2/test/x509aux.c similarity index 100% rename from src/openssl/openssl-1.1.1w/test/x509aux.c rename to src/openssl/openssl-1.1.1w-chevah2/test/x509aux.c diff --git a/src/openssl/openssl-1.1.1w/tools/build.info b/src/openssl/openssl-1.1.1w-chevah2/tools/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/tools/build.info rename to src/openssl/openssl-1.1.1w-chevah2/tools/build.info diff --git a/src/openssl/openssl-1.1.1w/tools/c_rehash.in b/src/openssl/openssl-1.1.1w-chevah2/tools/c_rehash.in similarity index 100% rename from src/openssl/openssl-1.1.1w/tools/c_rehash.in rename to src/openssl/openssl-1.1.1w-chevah2/tools/c_rehash.in diff --git a/src/openssl/openssl-1.1.1w/util/add-depends.pl b/src/openssl/openssl-1.1.1w-chevah2/util/add-depends.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/util/add-depends.pl rename to src/openssl/openssl-1.1.1w-chevah2/util/add-depends.pl diff --git a/src/openssl/openssl-1.1.1w/util/build.info b/src/openssl/openssl-1.1.1w-chevah2/util/build.info similarity index 100% rename from src/openssl/openssl-1.1.1w/util/build.info rename to src/openssl/openssl-1.1.1w-chevah2/util/build.info diff --git a/src/openssl/openssl-1.1.1w/util/cavs-to-evptest.pl b/src/openssl/openssl-1.1.1w-chevah2/util/cavs-to-evptest.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/util/cavs-to-evptest.pl rename to src/openssl/openssl-1.1.1w-chevah2/util/cavs-to-evptest.pl diff --git a/src/openssl/openssl-1.1.1w/util/check-malloc-errs b/src/openssl/openssl-1.1.1w-chevah2/util/check-malloc-errs similarity index 100% rename from src/openssl/openssl-1.1.1w/util/check-malloc-errs rename to src/openssl/openssl-1.1.1w-chevah2/util/check-malloc-errs diff --git a/src/openssl/openssl-1.1.1w/util/ck_errf.pl b/src/openssl/openssl-1.1.1w-chevah2/util/ck_errf.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/util/ck_errf.pl rename to src/openssl/openssl-1.1.1w-chevah2/util/ck_errf.pl diff --git a/src/openssl/openssl-1.1.1w/util/copy.pl b/src/openssl/openssl-1.1.1w-chevah2/util/copy.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/util/copy.pl rename to src/openssl/openssl-1.1.1w-chevah2/util/copy.pl diff --git a/src/openssl/openssl-1.1.1w/util/dofile.pl b/src/openssl/openssl-1.1.1w-chevah2/util/dofile.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/util/dofile.pl rename to src/openssl/openssl-1.1.1w-chevah2/util/dofile.pl diff --git a/src/openssl/openssl-1.1.1w/util/echo.pl b/src/openssl/openssl-1.1.1w-chevah2/util/echo.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/util/echo.pl rename to src/openssl/openssl-1.1.1w-chevah2/util/echo.pl diff --git a/src/openssl/openssl-1.1.1w/util/find-doc-nits b/src/openssl/openssl-1.1.1w-chevah2/util/find-doc-nits similarity index 100% rename from src/openssl/openssl-1.1.1w/util/find-doc-nits rename to src/openssl/openssl-1.1.1w-chevah2/util/find-doc-nits diff --git a/src/openssl/openssl-1.1.1w/util/find-unused-errs b/src/openssl/openssl-1.1.1w-chevah2/util/find-unused-errs similarity index 100% rename from src/openssl/openssl-1.1.1w/util/find-unused-errs rename to src/openssl/openssl-1.1.1w-chevah2/util/find-unused-errs diff --git a/src/openssl/openssl-1.1.1w/util/fix-includes b/src/openssl/openssl-1.1.1w-chevah2/util/fix-includes similarity index 100% rename from src/openssl/openssl-1.1.1w/util/fix-includes rename to src/openssl/openssl-1.1.1w-chevah2/util/fix-includes diff --git a/src/openssl/openssl-1.1.1w/util/fix-includes.sed b/src/openssl/openssl-1.1.1w-chevah2/util/fix-includes.sed similarity index 100% rename from src/openssl/openssl-1.1.1w/util/fix-includes.sed rename to src/openssl/openssl-1.1.1w-chevah2/util/fix-includes.sed diff --git a/src/openssl/openssl-1.1.1w/util/indent.pro b/src/openssl/openssl-1.1.1w-chevah2/util/indent.pro similarity index 100% rename from src/openssl/openssl-1.1.1w/util/indent.pro rename to src/openssl/openssl-1.1.1w-chevah2/util/indent.pro diff --git a/src/openssl/openssl-1.1.1w/util/libcrypto.num b/src/openssl/openssl-1.1.1w-chevah2/util/libcrypto.num similarity index 100% rename from src/openssl/openssl-1.1.1w/util/libcrypto.num rename to src/openssl/openssl-1.1.1w-chevah2/util/libcrypto.num diff --git a/src/openssl/openssl-1.1.1w/util/libssl.num b/src/openssl/openssl-1.1.1w-chevah2/util/libssl.num similarity index 100% rename from src/openssl/openssl-1.1.1w/util/libssl.num rename to src/openssl/openssl-1.1.1w-chevah2/util/libssl.num diff --git a/src/openssl/openssl-1.1.1w/util/local_shlib.com.in b/src/openssl/openssl-1.1.1w-chevah2/util/local_shlib.com.in similarity index 100% rename from src/openssl/openssl-1.1.1w/util/local_shlib.com.in rename to src/openssl/openssl-1.1.1w-chevah2/util/local_shlib.com.in diff --git a/src/openssl/openssl-1.1.1w/util/mkbuildinf.pl b/src/openssl/openssl-1.1.1w-chevah2/util/mkbuildinf.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/util/mkbuildinf.pl rename to src/openssl/openssl-1.1.1w-chevah2/util/mkbuildinf.pl diff --git a/src/openssl/openssl-1.1.1w/util/mkdef.pl b/src/openssl/openssl-1.1.1w-chevah2/util/mkdef.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/util/mkdef.pl rename to src/openssl/openssl-1.1.1w-chevah2/util/mkdef.pl diff --git a/src/openssl/openssl-1.1.1w/util/mkdir-p.pl b/src/openssl/openssl-1.1.1w-chevah2/util/mkdir-p.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/util/mkdir-p.pl rename to src/openssl/openssl-1.1.1w-chevah2/util/mkdir-p.pl diff --git a/src/openssl/openssl-1.1.1w/util/mkerr.pl b/src/openssl/openssl-1.1.1w-chevah2/util/mkerr.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/util/mkerr.pl rename to src/openssl/openssl-1.1.1w-chevah2/util/mkerr.pl diff --git a/src/openssl/openssl-1.1.1w/util/mkrc.pl b/src/openssl/openssl-1.1.1w-chevah2/util/mkrc.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/util/mkrc.pl rename to src/openssl/openssl-1.1.1w-chevah2/util/mkrc.pl diff --git a/src/openssl/openssl-1.1.1w/util/openssl-format-source b/src/openssl/openssl-1.1.1w-chevah2/util/openssl-format-source similarity index 100% rename from src/openssl/openssl-1.1.1w/util/openssl-format-source rename to src/openssl/openssl-1.1.1w-chevah2/util/openssl-format-source diff --git a/src/openssl/openssl-1.1.1w/util/openssl-update-copyright b/src/openssl/openssl-1.1.1w-chevah2/util/openssl-update-copyright similarity index 100% rename from src/openssl/openssl-1.1.1w/util/openssl-update-copyright rename to src/openssl/openssl-1.1.1w-chevah2/util/openssl-update-copyright diff --git a/src/openssl/openssl-1.1.1w/util/opensslwrap.sh b/src/openssl/openssl-1.1.1w-chevah2/util/opensslwrap.sh similarity index 100% rename from src/openssl/openssl-1.1.1w/util/opensslwrap.sh rename to src/openssl/openssl-1.1.1w-chevah2/util/opensslwrap.sh diff --git a/src/openssl/openssl-1.1.1w/util/perl/OpenSSL/Glob.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/OpenSSL/Glob.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/OpenSSL/Glob.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/OpenSSL/Glob.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/OpenSSL/Test.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/OpenSSL/Test.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/OpenSSL/Test.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/OpenSSL/Test.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/OpenSSL/Test/Simple.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/OpenSSL/Test/Simple.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/OpenSSL/Test/Simple.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/OpenSSL/Test/Simple.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/OpenSSL/Test/Utils.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/OpenSSL/Test/Utils.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/OpenSSL/Test/Utils.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/OpenSSL/Test/Utils.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/OpenSSL/Util/Pod.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/OpenSSL/Util/Pod.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/OpenSSL/Util/Pod.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/OpenSSL/Util/Pod.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/OpenSSL/copyright.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/OpenSSL/copyright.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/OpenSSL/copyright.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/OpenSSL/copyright.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/TLSProxy/Alert.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/Alert.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/TLSProxy/Alert.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/Alert.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/TLSProxy/Certificate.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/Certificate.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/TLSProxy/Certificate.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/Certificate.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/TLSProxy/CertificateRequest.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/CertificateRequest.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/TLSProxy/CertificateRequest.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/CertificateRequest.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/TLSProxy/CertificateVerify.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/CertificateVerify.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/TLSProxy/CertificateVerify.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/CertificateVerify.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/TLSProxy/ClientHello.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/ClientHello.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/TLSProxy/ClientHello.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/ClientHello.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/TLSProxy/EncryptedExtensions.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/EncryptedExtensions.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/TLSProxy/EncryptedExtensions.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/EncryptedExtensions.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/TLSProxy/Message.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/Message.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/TLSProxy/Message.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/Message.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/TLSProxy/NewSessionTicket.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/NewSessionTicket.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/TLSProxy/NewSessionTicket.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/NewSessionTicket.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/TLSProxy/Proxy.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/Proxy.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/TLSProxy/Proxy.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/Proxy.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/TLSProxy/Record.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/Record.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/TLSProxy/Record.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/Record.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/TLSProxy/ServerHello.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/ServerHello.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/TLSProxy/ServerHello.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/ServerHello.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/TLSProxy/ServerKeyExchange.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/ServerKeyExchange.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/TLSProxy/ServerKeyExchange.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/TLSProxy/ServerKeyExchange.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/checkhandshake.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/checkhandshake.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/checkhandshake.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/checkhandshake.pm diff --git a/src/openssl/openssl-1.1.1w/util/perl/with_fallback.pm b/src/openssl/openssl-1.1.1w-chevah2/util/perl/with_fallback.pm similarity index 100% rename from src/openssl/openssl-1.1.1w/util/perl/with_fallback.pm rename to src/openssl/openssl-1.1.1w-chevah2/util/perl/with_fallback.pm diff --git a/src/openssl/openssl-1.1.1w/util/private.num b/src/openssl/openssl-1.1.1w-chevah2/util/private.num similarity index 100% rename from src/openssl/openssl-1.1.1w/util/private.num rename to src/openssl/openssl-1.1.1w-chevah2/util/private.num diff --git a/src/openssl/openssl-1.1.1w/util/process_docs.pl b/src/openssl/openssl-1.1.1w-chevah2/util/process_docs.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/util/process_docs.pl rename to src/openssl/openssl-1.1.1w-chevah2/util/process_docs.pl diff --git a/src/openssl/openssl-1.1.1w/util/shlib_wrap.sh.in b/src/openssl/openssl-1.1.1w-chevah2/util/shlib_wrap.sh.in similarity index 100% rename from src/openssl/openssl-1.1.1w/util/shlib_wrap.sh.in rename to src/openssl/openssl-1.1.1w-chevah2/util/shlib_wrap.sh.in diff --git a/src/openssl/openssl-1.1.1w/util/su-filter.pl b/src/openssl/openssl-1.1.1w-chevah2/util/su-filter.pl similarity index 100% rename from src/openssl/openssl-1.1.1w/util/su-filter.pl rename to src/openssl/openssl-1.1.1w-chevah2/util/su-filter.pl diff --git a/src/openssl/openssl-1.1.1w/util/unlocal_shlib.com.in b/src/openssl/openssl-1.1.1w-chevah2/util/unlocal_shlib.com.in similarity index 100% rename from src/openssl/openssl-1.1.1w/util/unlocal_shlib.com.in rename to src/openssl/openssl-1.1.1w-chevah2/util/unlocal_shlib.com.in diff --git a/src/python/CVE-2017-18207.diff b/src/python/CVE-2017-18207.diff new file mode 100644 index 000000000..67d1c6ee7 --- /dev/null +++ b/src/python/CVE-2017-18207.diff @@ -0,0 +1,365 @@ +diff --git a/Lib/aifc.py b/Lib/aifc.py +index 981f8010690e00..880ad50a48da67 100644 +--- a/Lib/aifc.py ++++ b/Lib/aifc.py +@@ -135,6 +135,7 @@ + """ + + import struct ++import warnings + import __builtin__ + + __all__ = ["Error","open","openfp"] +@@ -316,16 +317,16 @@ def initfp(self, file): + except EOFError: + break + chunkname = chunk.getname() +- if chunkname == 'COMM': ++ if chunkname == b'COMM': + self._read_comm_chunk(chunk) + self._comm_chunk_read = 1 +- elif chunkname == 'SSND': ++ elif chunkname == b'SSND': + self._ssnd_chunk = chunk + dummy = chunk.read(8) + self._ssnd_seek_needed = 0 +- elif chunkname == 'FVER': ++ elif chunkname == b'FVER': + self._version = _read_ulong(chunk) +- elif chunkname == 'MARK': ++ elif chunkname == b'MARK': + self._readmark(chunk) + chunk.skip() + if not self._comm_chunk_read or not self._ssnd_chunk: +@@ -465,13 +466,18 @@ def _read_comm_chunk(self, chunk): + self._nframes = _read_long(chunk) + self._sampwidth = (_read_short(chunk) + 7) // 8 + self._framerate = int(_read_float(chunk)) ++ if self._sampwidth <= 0: ++ raise Error, 'bad sample width' ++ if self._nchannels <= 0: ++ raise Error, 'bad # of channels' ++ + self._framesize = self._nchannels * self._sampwidth + if self._aifc: + #DEBUG: SGI's soundeditor produces a bad size :-( + kludge = 0 + if chunk.chunksize == 18: + kludge = 1 +- print 'Warning: bad COMM chunk size' ++ warnings.warn("bad COMM chunk size") + chunk.chunksize = 23 + #DEBUG end + self._comptype = chunk.read(4) +@@ -535,11 +541,13 @@ def _readmark(self, chunk): + # a position 0 and name '' + self._markers.append((id, pos, name)) + except EOFError: +- print 'Warning: MARK chunk contains only', +- print len(self._markers), +- if len(self._markers) == 1: print 'marker', +- else: print 'markers', +- print 'instead of', nmarkers ++ warning_message = 'MARK chunk contains only ' + str(len(self._markers)) ++ if len(self._markers) == 1: ++ warning_message += ' marker ' ++ else: ++ warning_message += ' markers ' ++ warning_message += 'instead of ' + str(nmarkers) ++ warnings.warn(warning_message) + + class Aifc_write: + # Variables used in this class: +diff --git a/Lib/sunau.py b/Lib/sunau.py +index b53044d22b1648..b5d83ea4b464c6 100644 +--- a/Lib/sunau.py ++++ b/Lib/sunau.py +@@ -194,6 +194,8 @@ def initfp(self, file): + raise Error, 'unknown encoding' + self._framerate = int(_read_u32(file)) + self._nchannels = int(_read_u32(file)) ++ if not self._nchannels: ++ raise Error('bad # of channels') + self._framesize = self._framesize * self._nchannels + if self._hdr_size > 24: + self._info = file.read(self._hdr_size - 24) +diff --git a/Lib/test/test_aifc.py b/Lib/test/test_aifc.py +index 92bbe7bc75da93..f21798dfe4bc7c 100644 +--- a/Lib/test/test_aifc.py ++++ b/Lib/test/test_aifc.py +@@ -7,6 +7,7 @@ + import sys + import struct + import aifc ++from test.test_support import check_warnings + + + class AifcTest(audiotests.AudioWriteTests, +@@ -216,47 +217,68 @@ def test_read_no_comm_chunk(self): + + def test_read_no_ssnd_chunk(self): + b = b'FORM' + struct.pack('>L', 4) + b'AIFC' +- b += b'COMM' + struct.pack('>LhlhhLL', 38, 0, 0, 0, 0, 0, 0) ++ b += b'COMM' + struct.pack('>LhlhhLL', 38, 1, 0, 8, ++ 0x4000 | 12, 11025<<18, 0) + b += b'NONE' + struct.pack('B', 14) + b'not compressed' + b'\x00' + with self.assertRaisesRegexp(aifc.Error, 'COMM chunk and/or SSND chunk' + ' missing'): + aifc.open(io.BytesIO(b)) + + def test_read_wrong_compression_type(self): +- b = 'FORM' + struct.pack('>L', 4) + 'AIFC' +- b += 'COMM' + struct.pack('>LhlhhLL', 23, 0, 0, 0, 0, 0, 0) +- b += 'WRNG' + struct.pack('B', 0) ++ b = b'FORM' + struct.pack('>L', 4) + b'AIFC' ++ b += b'COMM' + struct.pack('>LhlhhLL', 23, 1, 0, 8, ++ 0x4000 | 12, 11025<<18, 0) ++ b += b'WRNG' + struct.pack('B', 0) + self.assertRaises(aifc.Error, aifc.open, io.BytesIO(b)) + ++ def test_read_wrong_number_of_channels(self): ++ for nchannels in 0, -1: ++ b = b'FORM' + struct.pack('>L', 4) + b'AIFC' ++ b += b'COMM' + struct.pack('>LhlhhLL', 38, nchannels, 0, 8, ++ 0x4000 | 12, 11025<<18, 0) ++ b += b'NONE' + struct.pack('B', 14) + b'not compressed' + b'\x00' ++ b += b'SSND' + struct.pack('>L', 8) + b'\x00' * 8 ++ with self.assertRaisesRegexp(aifc.Error, 'bad # of channels'): ++ aifc.open(io.BytesIO(b)) ++ ++ def test_read_wrong_sample_width(self): ++ for sampwidth in 0, -1: ++ b = b'FORM' + struct.pack('>L', 4) + b'AIFC' ++ b += b'COMM' + struct.pack('>LhlhhLL', 38, 1, 0, sampwidth, ++ 0x4000 | 12, 11025<<18, 0) ++ b += b'NONE' + struct.pack('B', 14) + b'not compressed' + b'\x00' ++ b += b'SSND' + struct.pack('>L', 8) + b'\x00' * 8 ++ with self.assertRaisesRegexp(aifc.Error, 'bad sample width'): ++ aifc.open(io.BytesIO(b)) ++ + def test_read_wrong_marks(self): +- b = 'FORM' + struct.pack('>L', 4) + 'AIFF' +- b += 'COMM' + struct.pack('>LhlhhLL', 18, 0, 0, 0, 0, 0, 0) +- b += 'SSND' + struct.pack('>L', 8) + '\x00' * 8 +- b += 'MARK' + struct.pack('>LhB', 3, 1, 1) +- with captured_stdout() as s: ++ b = b'FORM' + struct.pack('>L', 4) + b'AIFF' ++ b += b'COMM' + struct.pack('>LhlhhLL', 18, 1, 0, 8, ++ 0x4000 | 12, 11025<<18, 0) ++ b += b'SSND' + struct.pack('>L', 8) + b'\x00' * 8 ++ b += b'MARK' + struct.pack('>LhB', 3, 1, 1) ++ with check_warnings(('MARK chunk contains only 0 markers instead of 1', UserWarning)): + f = aifc.open(io.BytesIO(b)) +- self.assertEqual(s.getvalue(), 'Warning: MARK chunk contains ' +- 'only 0 markers instead of 1\n') +- self.assertEqual(f.getmarkers(), None) ++ self.assertEqual(f.getmarkers(), None) + + def test_read_comm_kludge_compname_even(self): +- b = 'FORM' + struct.pack('>L', 4) + 'AIFC' +- b += 'COMM' + struct.pack('>LhlhhLL', 18, 0, 0, 0, 0, 0, 0) +- b += 'NONE' + struct.pack('B', 4) + 'even' + '\x00' +- b += 'SSND' + struct.pack('>L', 8) + '\x00' * 8 +- with captured_stdout() as s: ++ b = b'FORM' + struct.pack('>L', 4) + b'AIFC' ++ b += b'COMM' + struct.pack('>LhlhhLL', 18, 1, 0, 8, ++ 0x4000 | 12, 11025<<18, 0) ++ b += b'NONE' + struct.pack('B', 4) + b'even' + b'\x00' ++ b += b'SSND' + struct.pack('>L', 8) + b'\x00' * 8 ++ with check_warnings(('bad COMM chunk size', UserWarning)): + f = aifc.open(io.BytesIO(b)) +- self.assertEqual(s.getvalue(), 'Warning: bad COMM chunk size\n') + self.assertEqual(f.getcompname(), 'even') + + def test_read_comm_kludge_compname_odd(self): +- b = 'FORM' + struct.pack('>L', 4) + 'AIFC' +- b += 'COMM' + struct.pack('>LhlhhLL', 18, 0, 0, 0, 0, 0, 0) +- b += 'NONE' + struct.pack('B', 3) + 'odd' +- b += 'SSND' + struct.pack('>L', 8) + '\x00' * 8 +- with captured_stdout() as s: ++ b = b'FORM' + struct.pack('>L', 4) + b'AIFC' ++ b += b'COMM' + struct.pack('>LhlhhLL', 18, 1, 0, 8, ++ 0x4000 | 12, 11025<<18, 0) ++ b += b'NONE' + struct.pack('B', 3) + b'odd' ++ b += b'SSND' + struct.pack('>L', 8) + b'\x00' * 8 ++ with check_warnings(('bad COMM chunk size', UserWarning)): + f = aifc.open(io.BytesIO(b)) +- self.assertEqual(s.getvalue(), 'Warning: bad COMM chunk size\n') + self.assertEqual(f.getcompname(), 'odd') + + def test_write_params_raises(self): +diff --git a/Lib/test/test_sunau.py b/Lib/test/test_sunau.py +index f6828683521df1..1550600495fa78 100644 +--- a/Lib/test/test_sunau.py ++++ b/Lib/test/test_sunau.py +@@ -1,6 +1,8 @@ + from test.test_support import TESTFN, run_unittest + import unittest + from test import audiotests ++import io ++import struct + import sys + import sunau + +@@ -96,5 +98,41 @@ def test_main(): + run_unittest(SunauPCM8Test, SunauPCM16Test, SunauPCM16Test, + SunauPCM32Test, SunauULAWTest) + ++ ++class SunauLowLevelTest(unittest.TestCase): ++ ++ def test_read_bad_magic_number(self): ++ b = b'SPA' ++ with self.assertRaises(EOFError): ++ sunau.open(io.BytesIO(b)) ++ b = b'SPAM' ++ with self.assertRaisesRegex(sunau.Error, 'bad magic number'): ++ sunau.open(io.BytesIO(b)) ++ ++ def test_read_too_small_header(self): ++ b = struct.pack('>LLLLL', sunau.AUDIO_FILE_MAGIC, 20, 0, ++ sunau.AUDIO_FILE_ENCODING_LINEAR_8, 11025) ++ with self.assertRaisesRegex(sunau.Error, 'header size too small'): ++ sunau.open(io.BytesIO(b)) ++ ++ def test_read_too_large_header(self): ++ b = struct.pack('>LLLLLL', sunau.AUDIO_FILE_MAGIC, 124, 0, ++ sunau.AUDIO_FILE_ENCODING_LINEAR_8, 11025, 1) ++ b += b'\0' * 100 ++ with self.assertRaisesRegex(sunau.Error, 'header size ridiculously large'): ++ sunau.open(io.BytesIO(b)) ++ ++ def test_read_wrong_encoding(self): ++ b = struct.pack('>LLLLLL', sunau.AUDIO_FILE_MAGIC, 24, 0, 0, 11025, 1) ++ with self.assertRaisesRegex(sunau.Error, r'encoding not \(yet\) supported'): ++ sunau.open(io.BytesIO(b)) ++ ++ def test_read_wrong_number_of_channels(self): ++ b = struct.pack('>LLLLLL', sunau.AUDIO_FILE_MAGIC, 24, 0, ++ sunau.AUDIO_FILE_ENCODING_LINEAR_8, 11025, 0) ++ with self.assertRaisesRegex(sunau.Error, 'bad # of channels'): ++ sunau.open(io.BytesIO(b)) ++ ++ + if __name__ == "__main__": + test_main() +diff --git a/Lib/test/test_wave.py b/Lib/test/test_wave.py +index 9513df459386b2..9d01eacc539a43 100644 +--- a/Lib/test/test_wave.py ++++ b/Lib/test/test_wave.py +@@ -1,6 +1,9 @@ + from test.test_support import TESTFN, run_unittest + import unittest + from test import audiotests ++from test import support ++import io ++import struct + import sys + import wave + +@@ -119,5 +122,66 @@ def test_unseekable_incompleted_write(self): + def test_main(): + run_unittest(WavePCM8Test, WavePCM16Test, WavePCM24Test, WavePCM32Test) + ++ ++class WaveLowLevelTest(unittest.TestCase): ++ ++ def test_read_no_chunks(self): ++ b = b'SPAM' ++ with self.assertRaises(EOFError): ++ wave.open(io.BytesIO(b)) ++ ++ def test_read_no_riff_chunk(self): ++ b = b'SPAM' + struct.pack(' (address, port)""" + if self.af == socket.AF_INET: +- host, port = parse227(self.sendcmd('PASV')) ++ untrusted_host, port = parse227(self.sendcmd('PASV')) ++ if self.trust_server_pasv_ipv4_address: ++ host = untrusted_host ++ else: ++ host = self.sock.getpeername()[0] + else: + host, port = parse229(self.sendcmd('EPSV'), self.sock.getpeername()) + return host, port +diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py +index 8a3eb067a4462b..a1d725206de7c3 100644 +--- a/Lib/test/test_ftplib.py ++++ b/Lib/test/test_ftplib.py +@@ -15,6 +15,7 @@ + except ImportError: + ssl = None + ++from contextlib import closing + from unittest import TestCase, SkipTest, skipUnless + from test import test_support + from test.test_support import HOST, HOSTv6 +@@ -67,6 +68,10 @@ def __init__(self, conn): + self.rest = None + self.next_retr_data = RETR_DATA + self.push('220 welcome') ++ # We use this as the string IPv4 address to direct the client ++ # to in response to a PASV command. To test security behavior. ++ # https://bugs.python.org/issue43285/. ++ self.fake_pasv_server_ip = '252.253.254.255' + + def collect_incoming_data(self, data): + self.in_buffer.append(data) +@@ -109,13 +114,13 @@ def cmd_pasv(self, arg): + sock.bind((self.socket.getsockname()[0], 0)) + sock.listen(5) + sock.settimeout(10) +- ip, port = sock.getsockname()[:2] +- ip = ip.replace('.', ',') +- p1, p2 = divmod(port, 256) ++ port = sock.getsockname()[1] ++ ip = self.fake_pasv_server_ip ++ ip = ip.replace('.', ','); p1 = port / 256; p2 = port % 256 + self.push('227 entering passive mode (%s,%d,%d)' %(ip, p1, p2)) + conn, addr = sock.accept() + self.dtp = self.dtp_handler(conn, baseclass=self) +- ++ + def cmd_eprt(self, arg): + af, ip, port = arg.split(arg[0])[1:-1] + port = int(port) +@@ -577,6 +582,107 @@ def test_makepasv(self): + # IPv4 is in use, just make sure send_epsv has not been used + self.assertEqual(self.server.handler_instance.last_received_cmd, 'pasv') + ++ def test_makepasv_issue43285_security_disabled(self): ++ """Test the opt-in to the old vulnerable behavior.""" ++ self.client.trust_server_pasv_ipv4_address = True ++ bad_host, port = self.client.makepasv() ++ self.assertEqual( ++ bad_host, self.server.handler_instance.fake_pasv_server_ip) ++ # Opening and closing a connection keeps the dummy server happy ++ # instead of timing out on accept. ++ socket.create_connection((self.client.sock.getpeername()[0], port), ++ timeout=TIMEOUT).close() ++ ++ def test_makepasv_issue43285_security_enabled_default(self): ++ self.assertFalse(self.client.trust_server_pasv_ipv4_address) ++ trusted_host, port = self.client.makepasv() ++ self.assertNotEqual( ++ trusted_host, self.server.handler_instance.fake_pasv_server_ip) ++ # Opening and closing a connection keeps the dummy server happy ++ # instead of timing out on accept. ++ socket.create_connection((trusted_host, port), timeout=TIMEOUT).close() ++ ++ def test_with_statement(self): ++ self.client.quit() ++ ++ def is_client_connected(): ++ if self.client.sock is None: ++ return False ++ try: ++ self.client.sendcmd('noop') ++ except (OSError, EOFError): ++ return False ++ return True ++ ++ # base test ++ with ftplib.FTP(timeout=TIMEOUT) as self.client: ++ self.client.connect(self.server.host, self.server.port) ++ self.client.sendcmd('noop') ++ self.assertTrue(is_client_connected()) ++ self.assertEqual(self.server.handler_instance.last_received_cmd, 'quit') ++ self.assertFalse(is_client_connected()) ++ ++ # QUIT sent inside the with block ++ with ftplib.FTP(timeout=TIMEOUT) as self.client: ++ self.client.connect(self.server.host, self.server.port) ++ self.client.sendcmd('noop') ++ self.client.quit() ++ self.assertEqual(self.server.handler_instance.last_received_cmd, 'quit') ++ self.assertFalse(is_client_connected()) ++ ++ # force a wrong response code to be sent on QUIT: error_perm ++ # is expected and the connection is supposed to be closed ++ try: ++ with ftplib.FTP(timeout=TIMEOUT) as self.client: ++ self.client.connect(self.server.host, self.server.port) ++ self.client.sendcmd('noop') ++ self.server.handler_instance.next_response = '550 error on quit' ++ except ftplib.error_perm as err: ++ self.assertEqual(str(err), '550 error on quit') ++ else: ++ self.fail('Exception not raised') ++ # needed to give the threaded server some time to set the attribute ++ # which otherwise would still be == 'noop' ++ time.sleep(0.1) ++ self.assertEqual(self.server.handler_instance.last_received_cmd, 'quit') ++ self.assertFalse(is_client_connected()) ++ ++ def test_source_address(self): ++ self.client.quit() ++ port = test_support.find_unused_port() ++ try: ++ self.client.connect(self.server.host, self.server.port, ++ source_address=(HOST, port)) ++ self.assertEqual(self.client.sock.getsockname()[1], port) ++ self.client.quit() ++ except OSError as e: ++ if e.errno == errno.EADDRINUSE: ++ self.skipTest("couldn't bind to port %d" % port) ++ raise ++ ++ def test_source_address_passive_connection(self): ++ port = test_support.find_unused_port() ++ self.client.source_address = (HOST, port) ++ try: ++ with closing(self.client.transfercmd('list')) as sock: ++ self.assertEqual(sock.getsockname()[1], port) ++ except OSError as e: ++ if e.errno == errno.EADDRINUSE: ++ self.skipTest("couldn't bind to port %d" % port) ++ raise ++ ++ def test_parse257(self): ++ self.assertEqual(ftplib.parse257('257 "/foo/bar"'), '/foo/bar') ++ self.assertEqual(ftplib.parse257('257 "/foo/bar" created'), '/foo/bar') ++ self.assertEqual(ftplib.parse257('257 ""'), '') ++ self.assertEqual(ftplib.parse257('257 "" created'), '') ++ self.assertRaises(ftplib.error_reply, ftplib.parse257, '250 "/foo/bar"') ++ # The 257 response is supposed to include the directory ++ # name and in case it contains embedded double-quotes ++ # they must be doubled (see RFC-959, chapter 7, appendix 2). ++ self.assertEqual(ftplib.parse257('257 "/foo/b""ar"'), '/foo/b"ar') ++ self.assertEqual(ftplib.parse257('257 "/foo/b""ar" created'), '/foo/b"ar') ++ + def test_line_too_long(self): + self.assertRaises(ftplib.Error, self.client.sendcmd, + 'x' * self.client.maxline * 2) +diff --git a/Misc/NEWS.d/next/Security/2021-03-13-03-48-14.bpo-43285.g-Hah3.rst b/Misc/NEWS.d/next/Security/2021-03-13-03-48-14.bpo-43285.g-Hah3.rst +new file mode 100644 +index 00000000000000..8312b7e885441d +--- /dev/null ++++ b/Misc/NEWS.d/next/Security/2021-03-13-03-48-14.bpo-43285.g-Hah3.rst +@@ -0,0 +1,8 @@ ++:mod:`ftplib` no longer trusts the IP address value returned from the server ++in response to the PASV command by default. This prevents a malicious FTP ++server from using the response to probe IPv4 address and port combinations ++on the client network. ++ ++Code that requires the former vulnerable behavior may set a ++``trust_server_pasv_ipv4_address`` attribute on their ++:class:`ftplib.FTP` instances to ``True`` to re-enable it. diff --git a/src/python/CVE-2022-45061.diff b/src/python/CVE-2022-45061.diff new file mode 100644 index 000000000..1baf5e435 --- /dev/null +++ b/src/python/CVE-2022-45061.diff @@ -0,0 +1,72 @@ +diff --git a/Lib/encodings/idna.py b/Lib/encodings/idna.py +index ea90d67142f6ac..2ce798cf47e52e 100644 +--- a/Lib/encodings/idna.py ++++ b/Lib/encodings/idna.py +@@ -39,23 +39,21 @@ def nameprep(label): + + # Check bidi + RandAL = map(stringprep.in_table_d1, label) +- for c in RandAL: +- if c: +- # There is a RandAL char in the string. Must perform further +- # tests: +- # 1) The characters in section 5.8 MUST be prohibited. +- # This is table C.8, which was already checked +- # 2) If a string contains any RandALCat character, the string +- # MUST NOT contain any LCat character. +- if filter(stringprep.in_table_d2, label): +- raise UnicodeError("Violation of BIDI requirement 2") +- +- # 3) If a string contains any RandALCat character, a +- # RandALCat character MUST be the first character of the +- # string, and a RandALCat character MUST be the last +- # character of the string. +- if not RandAL[0] or not RandAL[-1]: +- raise UnicodeError("Violation of BIDI requirement 3") ++ if any(RandAL): ++ # There is a RandAL char in the string. Must perform further ++ # tests: ++ # 1) The characters in section 5.8 MUST be prohibited. ++ # This is table C.8, which was already checked ++ # 2) If a string contains any RandALCat character, the string ++ # MUST NOT contain any LCat character. ++ if any(stringprep.in_table_d2(x) for x in label): ++ raise UnicodeError("Violation of BIDI requirement 2") ++ # 3) If a string contains any RandALCat character, a ++ # RandALCat character MUST be the first character of the ++ # string, and a RandALCat character MUST be the last ++ # character of the string. ++ if not RandAL[0] or not RandAL[-1]: ++ raise UnicodeError("Violation of BIDI requirement 3") + + return label + +diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py +index 0ec8bf5a4b4f26..76428e1794a542 100644 +--- a/Lib/test/test_codecs.py ++++ b/Lib/test/test_codecs.py +@@ -1318,6 +1318,12 @@ def test_builtin_encode(self): + self.assertEqual(u"pyth\xf6n.org".encode("idna"), "xn--pythn-mua.org") + self.assertEqual(u"pyth\xf6n.org.".encode("idna"), "xn--pythn-mua.org.") + ++ def test_builtin_decode_length_limit(self): ++ with self.assertRaisesRegexp(UnicodeError, "too long"): ++ (b"xn--016c"+b"a"*1100).decode("idna") ++ with self.assertRaisesRegexp(UnicodeError, "too long"): ++ (b"xn--016c"+b"a"*70).decode("idna") ++ + def test_stream(self): + import StringIO + r = codecs.getreader("idna")(StringIO.StringIO("abc")) +diff --git a/Misc/NEWS.d/next/Security/2022-11-04-09-29-36.gh-issue-98433.l76c5G.rst b/Misc/NEWS.d/next/Security/2022-11-04-09-29-36.gh-issue-98433.l76c5G.rst +new file mode 100644 +index 00000000000000..5185fac2e29d91 +--- /dev/null ++++ b/Misc/NEWS.d/next/Security/2022-11-04-09-29-36.gh-issue-98433.l76c5G.rst +@@ -0,0 +1,6 @@ ++The IDNA codec decoder used on DNS hostnames by :mod:`socket` or :mod:`asyncio` ++related name resolution functions no longer involves a quadratic algorithm. ++This prevents a potential CPU denial of service if an out-of-spec excessive ++length hostname involving bidirectional characters were decoded. Some protocols ++such as :mod:`urllib` http ``3xx`` redirects potentially allow for an attacker ++to supply such a name. diff --git a/src/python/CVE-2022-48565.diff b/src/python/CVE-2022-48565.diff new file mode 100644 index 000000000..2d1003c48 --- /dev/null +++ b/src/python/CVE-2022-48565.diff @@ -0,0 +1,136 @@ +diff --git a/Lib/plistlib.py b/Lib/plistlib.py +index 42897b8da8b268..286c5e078fb76d 100644 +--- a/Lib/plistlib.py ++++ b/Lib/plistlib.py +@@ -403,9 +403,16 @@ def parse(self, fileobj): + parser.StartElementHandler = self.handleBeginElement + parser.EndElementHandler = self.handleEndElement + parser.CharacterDataHandler = self.handleData ++ parser.EntityDeclHandler = self.handle_entity_decl + parser.ParseFile(fileobj) + return self.root + ++ def handle_entity_decl(self, entity_name, is_parameter_entity, value, base, system_id, public_id, notation_name): ++ # Reject plist files with entity declarations to avoid XML vulnerabilies in expat. ++ # Regular plist files don't contain those declerations, and Apple's plutil tool does not ++ # accept them either. ++ raise InvalidFileException("XML entity declarations are not supported in plist files") ++ + def handleBeginElement(self, element, attrs): + self.data = [] + handler = getattr(self, "begin_" + element, None) +@@ -472,3 +479,8 @@ def end_data(self): + self.addObject(Data.fromBase64(self.getData())) + def end_date(self): + self.addObject(_dateFromString(self.getData())) ++ ++ ++class InvalidFileException (ValueError): ++ def __init__(self, message="Invalid file"): ++ ValueError.__init__(self, message) +diff --git a/Lib/test/test_plistlib.py b/Lib/test/test_plistlib.py +index 7859ad05723015..285fefca5ccade 100644 +--- a/Lib/test/test_plistlib.py ++++ b/Lib/test/test_plistlib.py +@@ -86,6 +86,19 @@ + + """.replace(" " * 8, "\t") # Apple as well as plistlib.py output hard tabs + ++XML_PLIST_WITH_ENTITY=b'''\ ++ ++ ++ ]> ++ ++ ++ A ++ &entity; ++ ++ ++''' ++ + + class TestPlistlib(unittest.TestCase): + +@@ -195,6 +208,10 @@ def test_nondictroot(self): + self.assertEqual(test1, result1) + self.assertEqual(test2, result2) + ++ def test_xml_plist_with_entity_decl(self): ++ with self.assertRaisesRegexp(plistlib.InvalidFileException, ++ "XML entity declarations are not supported"): ++ plistlib.readPlistFromString(XML_PLIST_WITH_ENTITY) + + def test_main(): + test_support.run_unittest(TestPlistlib) +diff --git a/Misc/NEWS.d/2.7.18.8.rst b/Misc/NEWS.d/2.7.18.8.rst +new file mode 100644 +index 00000000000000..a2c30f48a949e0 +--- /dev/null ++++ b/Misc/NEWS.d/2.7.18.8.rst +@@ -0,0 +1,56 @@ ++.. bpo: 37428 ++.. date: 2024-02-15 ++.. nonce: ++.. release date: 2024-02-15 ++.. section: Core and Builtins ++ ++CVE-2023-40217 ++ ++SSLContext.post_handshake_auth = True no longer sets ++SSL_VERIFY_POST_HANDSHAKE verify flag for client connections. Although the ++option is documented as ignored for clients, OpenSSL implicitly enables cert ++chain validation when the flag is set. ++ ++.. bpo: ? ++.. date: 2024-02-15 ++.. nonce: ++.. release date: 2024-02-15 ++.. section: Core and Builtins ++ ++CVE-2023-24329 ++ ++Start stripping C0 control and space chars in urlsplit (#… …102508) ++ ++`urllib.parse.urlsplit` has already been respecting the WHATWG spec a bit #25595. ++ ++This adds more sanitizing to respect the "Remove any leading C0 control or space from input" [rule](https://url.spec.whatwg.org/#url-parsing:~:text=Remove%20any%20leading%20and%20trailing%20C0%20control%20or%20space%20from%20input.) in response to [CVE-2023-24329](https://nvd.nist.gov/vuln/detail/CVE-2023-24329). ++ ++.. bpo: 43882 ++.. date: 2024-02-15 ++.. nonce: ++.. release date: 2024-02-15 ++.. section: Core and Builtins ++ ++CVE-2022-0391 ++ ++A flaw was found in Python, specifically within the urllib.parse module. This module helps break Uniform Resource Locator (URL) strings into components. The issue involves how the urlparse method does not sanitize input and allows characters like '\r' and '\n' in the URL path. This flaw allows an attacker to input a crafted URL, leading to injection attacks. This flaw affects Python versions prior to 3.10.0b1, 3.9.5, 3.8.11, 3.7.11 and 3.6.14. ++ ++.. bpo: 43285 ++.. date: 2024-02-15 ++.. nonce: ++.. release date: 2024-02-15 ++.. section: Core and Builtins ++ ++CVE-2021-4189 ++ ++A flaw was found in Python, specifically in the FTP (File Transfer Protocol) client library in PASV (passive) mode. The issue is how the FTP client trusts the host from the PASV response by default. This flaw allows an attacker to set up a malicious FTP server that can trick FTP clients into connecting back to a given IP address and port. This vulnerability could lead to FTP client scanning ports, which otherwise would not have been possible. ++ ++.. bpo: 42051 ++.. date: 2024-03-12 ++.. nonce: ++.. release date: 2024-03-12 ++.. section: Core and Builtins ++ ++CVE-2022-48565 ++ ++An XML External Entity (XXE) issue was discovered in Python through 3.9.1. The plistlib module no longer accepts entity declarations in XML plist files to avoid XML vulnerabilities. +diff --git a/Misc/NEWS.d/next/Security/2020-10-19-10-56-27.bpo-42051.EU_B7u.rst b/Misc/NEWS.d/next/Security/2020-10-19-10-56-27.bpo-42051.EU_B7u.rst +new file mode 100644 +index 00000000000000..70fb731ea3eacf +--- /dev/null ++++ b/Misc/NEWS.d/next/Security/2020-10-19-10-56-27.bpo-42051.EU_B7u.rst +@@ -0,0 +1,3 @@ ++The :mod: module no longer accepts entity declarations in XML ++plist files to avoid XML vulnerabilities. This should not affect users as ++entity declarations are not used in regular plist files. diff --git a/src/python/CVE-2024-7592.diff b/src/python/CVE-2024-7592.diff new file mode 100644 index 000000000..07e64bea9 --- /dev/null +++ b/src/python/CVE-2024-7592.diff @@ -0,0 +1,107 @@ +diff --git a/Lib/Cookie.py b/Lib/Cookie.py +index 10823637..a6ba4a92 100644 +--- a/Lib/Cookie.py ++++ b/Lib/Cookie.py +@@ -323,9 +323,13 @@ def _quote(str, LegalChars=_LegalChars, + return '"' + _nulljoin( map(_Translator.get, str, str) ) + '"' + # end _quote + ++_unquote_sub = re.compile(r'\\(?:([0-3][0-7][0-7])|(.))').sub + +-_OctalPatt = re.compile(r"\\[0-3][0-7][0-7]") +-_QuotePatt = re.compile(r"[\\].") ++def _unquote_replace(m): ++ if m.group(1): ++ return chr(int(m.group(1), 8)) ++ else: ++ return m.group(2) + + def _unquote(str): + # If there aren't any doublequotes, +@@ -345,28 +349,7 @@ def _unquote(str): + # \012 --> \n + # \" --> " + # +- i = 0 +- n = len(str) +- res = [] +- while 0 <= i < n: +- Omatch = _OctalPatt.search(str, i) +- Qmatch = _QuotePatt.search(str, i) +- if not Omatch and not Qmatch: # Neither matched +- res.append(str[i:]) +- break +- # else: +- j = k = -1 +- if Omatch: j = Omatch.start(0) +- if Qmatch: k = Qmatch.start(0) +- if Qmatch and ( not Omatch or k < j ): # QuotePatt matched +- res.append(str[i:k]) +- res.append(str[k+1]) +- i = k+2 +- else: # OctalPatt matched +- res.append(str[i:j]) +- res.append( chr( int(str[j+1:j+4], 8) ) ) +- i = j+4 +- return _nulljoin(res) ++ return _unquote_sub(_unquote_replace, str) + # end _unquote + + # The _getdate() routine is used to set the expiration time in +diff --git a/Lib/test/test_cookie.py b/Lib/test/test_cookie.py +index 40419012..efd2ed3c 100644 +--- a/Lib/test/test_cookie.py ++++ b/Lib/test/test_cookie.py +@@ -1,6 +1,7 @@ + # Simple test suite for Cookie.py + + from test.test_support import run_unittest, run_doctest, check_warnings ++from test import support + import unittest + import Cookie + import pickle +@@ -156,6 +157,44 @@ class CookieTests(unittest.TestCase): + self.assertEqual(dict(C), {}) + self.assertEqual(C.output(), '') + ++ def test_unquote(self): ++ cases = [ ++ (r'a="b=\""', 'b="'), ++ (r'a="b=\\"', 'b=\\'), ++ (r'a="b=\="', 'b=='), ++ (r'a="b=\n"', 'b=n'), ++ (r'a="b=\042"', 'b="'), ++ (r'a="b=\134"', 'b=\\'), ++ (r'a="b=\377"', 'b=\xff'), ++ (r'a="b=\400"', 'b=400'), ++ (r'a="b=\42"', 'b=42'), ++ (r'a="b=\\042"', 'b=\\042'), ++ (r'a="b=\\134"', 'b=\\134'), ++ (r'a="b=\\\""', 'b=\\"'), ++ (r'a="b=\\\042"', 'b=\\"'), ++ (r'a="b=\134\""', 'b=\\"'), ++ (r'a="b=\134\042"', 'b=\\"'), ++ ] ++ for encoded, decoded in cases: ++ # with self.subTest(encoded): ++ C = Cookie.SimpleCookie() ++ C.load(encoded) ++ self.assertEqual(C['a'].value, decoded) ++ ++ @support.requires_resource('cpu') ++ def test_unquote_large(self): ++ n = 10**6 ++ for encoded in r'\\', r'\134': ++ # with self.subTest(encoded): ++ data = 'a="b=' + encoded*n + ';"' ++ C = Cookie.SimpleCookie() ++ C.load(data) ++ value = C['a'].value ++ self.assertEqual(value[:3], 'b=\\') ++ self.assertEqual(value[-2:], '\\;') ++ self.assertEqual(len(value), n + 3) ++ ++ + def test_pickle(self): + rawdata = 'Customer="WILE_E_COYOTE"; Path=/acme; Version=1' + expected_output = 'Set-Cookie: %s' % rawdata diff --git a/src/python/Python-2.7.18/Doc/library/socket.rst b/src/python/Python-2.7.18/Doc/library/socket.rst index 7b761d7ec..9cc9a6869 100644 --- a/src/python/Python-2.7.18/Doc/library/socket.rst +++ b/src/python/Python-2.7.18/Doc/library/socket.rst @@ -636,6 +636,23 @@ correspond to Unix system calls applicable to sockets. to decode C structures encoded as strings). +.. method:: socket.getblocking() + + Return ``True`` if socket is in blocking mode, ``False`` if in + non-blocking. + + This is equivalent to checking ``socket.gettimeout() == 0``. + + .. versionadded:: 3.7 + + +.. method:: socket.gettimeout() + + Return the timeout in seconds (float) associated with socket operations, + or ``None`` if no timeout is set. This reflects the last call to + :meth:`setblocking` or :meth:`settimeout`. + + .. method:: socket.ioctl(control, option) :platform: Windows diff --git a/src/python/Python-2.7.18/Include/Python.h b/src/python/Python-2.7.18/Include/Python.h index a9327b02c..384c86a74 100644 --- a/src/python/Python-2.7.18/Include/Python.h +++ b/src/python/Python-2.7.18/Include/Python.h @@ -78,6 +78,7 @@ #error "PYMALLOC_DEBUG requires WITH_PYMALLOC" #endif #include "pymath.h" +#include "pytime.h" #include "pymem.h" #include "object.h" diff --git a/src/python/Python-2.7.18/Include/pyport.h b/src/python/Python-2.7.18/Include/pyport.h index 35562a6a8..5cebaecb5 100644 --- a/src/python/Python-2.7.18/Include/pyport.h +++ b/src/python/Python-2.7.18/Include/pyport.h @@ -3,11 +3,12 @@ #include "pyconfig.h" /* include for defines */ +/* Always include inttypes.h now because of pytime.h */ /* Some versions of HP-UX & Solaris need inttypes.h for int32_t, INT32_MAX, etc. */ -#ifdef HAVE_INTTYPES_H +/* #ifdef HAVE_INTTYPES_H */ #include -#endif +/* #endif */ #ifdef HAVE_STDINT_H #include diff --git a/src/python/Python-2.7.18/Include/pytime.h b/src/python/Python-2.7.18/Include/pytime.h new file mode 100644 index 000000000..bdda1da2e --- /dev/null +++ b/src/python/Python-2.7.18/Include/pytime.h @@ -0,0 +1,246 @@ +#ifndef Py_LIMITED_API +#ifndef Py_PYTIME_H +#define Py_PYTIME_H + +#include "pyconfig.h" /* include for defines */ +#include "object.h" + +/************************************************************************** +Symbols and macros to supply platform-independent interfaces to time related +functions and constants +**************************************************************************/ +#ifdef __cplusplus +extern "C" { +#endif + +/* _PyTime_t: Python timestamp with subsecond precision. It can be used to + store a duration, and so indirectly a date (related to another date, like + UNIX epoch). */ +typedef int64_t _PyTime_t; +#define _PyTime_MIN INT64_MIN +#define _PyTime_MAX INT64_MAX + +typedef enum { + /* Round towards minus infinity (-inf). + For example, used to read a clock. */ + _PyTime_ROUND_FLOOR=0, + /* Round towards infinity (+inf). + For example, used for timeout to wait "at least" N seconds. */ + _PyTime_ROUND_CEILING=1, + /* Round to nearest with ties going to nearest even integer. + For example, used to round from a Python float. */ + _PyTime_ROUND_HALF_EVEN=2, + /* Round away from zero + For example, used for timeout. _PyTime_ROUND_CEILING rounds + -1e-9 to 0 milliseconds which causes bpo-31786 issue. + _PyTime_ROUND_UP rounds -1e-9 to -1 millisecond which keeps + the timeout sign as expected. select.poll(timeout) must block + for negative values." */ + _PyTime_ROUND_UP=3, + /* _PyTime_ROUND_TIMEOUT (an alias for _PyTime_ROUND_UP) should be + used for timeouts. */ + _PyTime_ROUND_TIMEOUT = _PyTime_ROUND_UP +} _PyTime_round_t; + + +/* Convert a time_t to a PyLong. */ +PyAPI_FUNC(PyObject *) _PyLong_FromTime_t( + time_t sec); + +/* Convert a PyLong to a time_t. */ +PyAPI_FUNC(time_t) _PyLong_AsTime_t( + PyObject *obj); + +/* Convert a number of seconds, int or float, to time_t. */ +PyAPI_FUNC(int) _PyTime_ObjectToTime_t( + PyObject *obj, + time_t *sec, + _PyTime_round_t); + +/* Convert a number of seconds, int or float, to a timeval structure. + usec is in the range [0; 999999] and rounded towards zero. + For example, -1.2 is converted to (-2, 800000). */ +PyAPI_FUNC(int) _PyTime_ObjectToTimeval( + PyObject *obj, + time_t *sec, + long *usec, + _PyTime_round_t); + +/* Convert a number of seconds, int or float, to a timespec structure. + nsec is in the range [0; 999999999] and rounded towards zero. + For example, -1.2 is converted to (-2, 800000000). */ +PyAPI_FUNC(int) _PyTime_ObjectToTimespec( + PyObject *obj, + time_t *sec, + long *nsec, + _PyTime_round_t); + + +/* Create a timestamp from a number of seconds. */ +PyAPI_FUNC(_PyTime_t) _PyTime_FromSeconds(int seconds); + +/* Macro to create a timestamp from a number of seconds, no integer overflow. + Only use the macro for small values, prefer _PyTime_FromSeconds(). */ +#define _PYTIME_FROMSECONDS(seconds) \ + ((_PyTime_t)(seconds) * (1000 * 1000 * 1000)) + +/* Create a timestamp from a number of nanoseconds. */ +PyAPI_FUNC(_PyTime_t) _PyTime_FromNanoseconds(_PyTime_t ns); + +/* Create a timestamp from nanoseconds (Python int). */ +PyAPI_FUNC(int) _PyTime_FromNanosecondsObject(_PyTime_t *t, + PyObject *obj); + +/* Convert a number of seconds (Python float or int) to a timetamp. + Raise an exception and return -1 on error, return 0 on success. */ +PyAPI_FUNC(int) _PyTime_FromSecondsObject(_PyTime_t *t, + PyObject *obj, + _PyTime_round_t round); + +/* Convert a number of milliseconds (Python float or int, 10^-3) to a timetamp. + Raise an exception and return -1 on error, return 0 on success. */ +PyAPI_FUNC(int) _PyTime_FromMillisecondsObject(_PyTime_t *t, + PyObject *obj, + _PyTime_round_t round); + +/* Convert a timestamp to a number of seconds as a C double. */ +PyAPI_FUNC(double) _PyTime_AsSecondsDouble(_PyTime_t t); + +/* Convert timestamp to a number of milliseconds (10^-3 seconds). */ +PyAPI_FUNC(_PyTime_t) _PyTime_AsMilliseconds(_PyTime_t t, + _PyTime_round_t round); + +/* Convert timestamp to a number of microseconds (10^-6 seconds). */ +PyAPI_FUNC(_PyTime_t) _PyTime_AsMicroseconds(_PyTime_t t, + _PyTime_round_t round); + +/* Convert timestamp to a number of nanoseconds (10^-9 seconds) as a Python int + object. */ +PyAPI_FUNC(PyObject *) _PyTime_AsNanosecondsObject(_PyTime_t t); + +/* Create a timestamp from a timeval structure. + Raise an exception and return -1 on overflow, return 0 on success. */ +PyAPI_FUNC(int) _PyTime_FromTimeval(_PyTime_t *tp, struct timeval *tv); + +/* Convert a timestamp to a timeval structure (microsecond resolution). + tv_usec is always positive. + Raise an exception and return -1 if the conversion overflowed, + return 0 on success. */ +PyAPI_FUNC(int) _PyTime_AsTimeval(_PyTime_t t, + struct timeval *tv, + _PyTime_round_t round); + +/* Similar to _PyTime_AsTimeval(), but don't raise an exception on error. */ +PyAPI_FUNC(int) _PyTime_AsTimeval_noraise(_PyTime_t t, + struct timeval *tv, + _PyTime_round_t round); + +/* Convert a timestamp to a number of seconds (secs) and microseconds (us). + us is always positive. This function is similar to _PyTime_AsTimeval() + except that secs is always a time_t type, whereas the timeval structure + uses a C long for tv_sec on Windows. + Raise an exception and return -1 if the conversion overflowed, + return 0 on success. */ +PyAPI_FUNC(int) _PyTime_AsTimevalTime_t( + _PyTime_t t, + time_t *secs, + int *us, + _PyTime_round_t round); + +#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_KQUEUE) +/* Create a timestamp from a timespec structure. + Raise an exception and return -1 on overflow, return 0 on success. */ +PyAPI_FUNC(int) _PyTime_FromTimespec(_PyTime_t *tp, struct timespec *ts); + +/* Convert a timestamp to a timespec structure (nanosecond resolution). + tv_nsec is always positive. + Raise an exception and return -1 on error, return 0 on success. */ +PyAPI_FUNC(int) _PyTime_AsTimespec(_PyTime_t t, struct timespec *ts); +#endif + +/* Compute ticks * mul / div. + The caller must ensure that ((div - 1) * mul) cannot overflow. */ +PyAPI_FUNC(_PyTime_t) _PyTime_MulDiv(_PyTime_t ticks, + _PyTime_t mul, + _PyTime_t div); + +/* Get the current time from the system clock. + + The function cannot fail. _PyTime_Init() ensures that the system clock + works. */ +PyAPI_FUNC(_PyTime_t) _PyTime_GetSystemClock(void); + +/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards. + The clock is not affected by system clock updates. The reference point of + the returned value is undefined, so that only the difference between the + results of consecutive calls is valid. + + The function cannot fail. _PyTime_Init() ensures that a monotonic clock + is available and works. */ +PyAPI_FUNC(_PyTime_t) _PyTime_GetMonotonicClock(void); + + +/* Structure used by time.get_clock_info() */ +typedef struct { + const char *implementation; + int monotonic; + int adjustable; + double resolution; +} _Py_clock_info_t; + +/* Get the current time from the system clock. + * Fill clock information if info is not NULL. + * Raise an exception and return -1 on error, return 0 on success. + */ +PyAPI_FUNC(int) _PyTime_GetSystemClockWithInfo( + _PyTime_t *t, + _Py_clock_info_t *info); + +/* Get the time of a monotonic clock, i.e. a clock that cannot go backwards. + The clock is not affected by system clock updates. The reference point of + the returned value is undefined, so that only the difference between the + results of consecutive calls is valid. + + Fill info (if set) with information of the function used to get the time. + + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyTime_GetMonotonicClockWithInfo( + _PyTime_t *t, + _Py_clock_info_t *info); + + +/* Initialize time. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyTime_Init(void); + +/* Converts a timestamp to the Gregorian time, using the local time zone. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyTime_localtime(time_t t, struct tm *tm); + +/* Converts a timestamp to the Gregorian time, assuming UTC. + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyTime_gmtime(time_t t, struct tm *tm); + +/* Get the performance counter: clock with the highest available resolution to + measure a short duration. + + The function cannot fail. _PyTime_Init() ensures that the system clock + works. */ +PyAPI_FUNC(_PyTime_t) _PyTime_GetPerfCounter(void); + +/* Get the performance counter: clock with the highest available resolution to + measure a short duration. + + Fill info (if set) with information of the function used to get the time. + + Return 0 on success, raise an exception and return -1 on error. */ +PyAPI_FUNC(int) _PyTime_GetPerfCounterWithInfo( + _PyTime_t *t, + _Py_clock_info_t *info); + +#ifdef __cplusplus +} +#endif + +#endif /* Py_PYTIME_H */ +#endif /* Py_LIMITED_API */ diff --git a/src/python/Python-2.7.18/Lib/socket.py b/src/python/Python-2.7.18/Lib/socket.py index 437634cc3..55e446cd6 100644 --- a/src/python/Python-2.7.18/Lib/socket.py +++ b/src/python/Python-2.7.18/Lib/socket.py @@ -154,7 +154,7 @@ def getfqdn(name=''): _socketmethods = ( 'bind', 'connect', 'connect_ex', 'fileno', 'listen', 'getpeername', 'getsockname', 'getsockopt', 'setsockopt', - 'sendall', 'setblocking', + 'sendall', 'getblocking', 'setblocking', 'settimeout', 'gettimeout', 'shutdown') if os.name == "nt": diff --git a/src/python/Python-2.7.18/Lib/ssl.py b/src/python/Python-2.7.18/Lib/ssl.py index 0bb43a4a4..e295aa593 100644 --- a/src/python/Python-2.7.18/Lib/ssl.py +++ b/src/python/Python-2.7.18/Lib/ssl.py @@ -94,6 +94,10 @@ import os from collections import namedtuple from contextlib import closing +import socket + +# import logging + import _ssl # if we can't import it, let the error propagate @@ -523,6 +527,7 @@ def __init__(self, sock=None, keyfile=None, certfile=None, server_hostname=None, _context=None): + self._sslobj = None self._makefile_refs = 0 if _context: self._context = _context @@ -568,6 +573,7 @@ def __init__(self, sock=None, keyfile=None, certfile=None, "in client mode") if self._context.check_hostname and not server_hostname: raise ValueError("check_hostname requires server_hostname") + sock_timeout = sock.gettimeout() self.server_side = server_side self.server_hostname = server_hostname self.do_handshake_on_connect = do_handshake_on_connect @@ -580,11 +586,42 @@ def __init__(self, sock=None, keyfile=None, certfile=None, if e.errno != errno.ENOTCONN: raise connected = False + blocking = self.getblocking() + self.setblocking(False) + try: + # We are not connected so this is not supposed to block, but + # testing revealed otherwise on macOS and Windows so we do + # the non-blocking dance regardless. Our raise when any data + # is found means consuming the data is harmless. + notconn_pre_handshake_data = self.recv(1) + except (OSError, socket_error) as e: + + # EINVAL occurs for recv(1) on non-connected on unix sockets. + if e.errno not in (errno.ENOTCONN, errno.EINVAL): + raise + + notconn_pre_handshake_data = b'' + self.setblocking(blocking) + if notconn_pre_handshake_data: + # This prevents pending data sent to the socket before it was + # closed from escaping to the caller who could otherwise + # presume it came through a successful TLS connection. + reason = "Closed before TLS handshake with data in recv buffer." + notconn_pre_handshake_data_error = SSLError(e.errno, reason) + # Add the SSLError attributes that _ssl.c always adds. + notconn_pre_handshake_data_error.reason = reason + notconn_pre_handshake_data_error.library = None + try: + self.close() + except (OSError, socket_error): + pass + raise notconn_pre_handshake_data_error else: connected = True self._closed = False self._sslobj = None + self.settimeout(sock_timeout) # Must come after setblocking() calls. self._connected = connected if connected: # create the SSL object @@ -598,7 +635,7 @@ def __init__(self, sock=None, keyfile=None, certfile=None, raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets") self.do_handshake() - except (OSError, ValueError): + except (OSError, ValueError, socket_error): self.close() raise @@ -814,6 +851,12 @@ def unwrap(self): else: raise ValueError("No SSL wrapper around " + str(self)) + def verify_client_post_handshake(self): + if self._sslobj: + return self._sslobj.verify_client_post_handshake() + else: + raise ValueError("No SSL wrapper around " + str(self)) + def _real_close(self): self._sslobj = None socket._real_close(self) @@ -915,7 +958,6 @@ def version(self): return None return self._sslobj.version() - def wrap_socket(sock, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, ssl_version=PROTOCOL_TLS, ca_certs=None, diff --git a/src/python/Python-2.7.18/Lib/test/test_heapq.py b/src/python/Python-2.7.18/Lib/test/test_heapq.py index c4de593bb..0f2990971 100644 --- a/src/python/Python-2.7.18/Lib/test/test_heapq.py +++ b/src/python/Python-2.7.18/Lib/test/test_heapq.py @@ -396,6 +396,40 @@ def test_heappop_mutating_heap(self): with self.assertRaises((IndexError, RuntimeError)): self.module.heappop(heap) + def test_comparison_operator_modifiying_heap(self): + # See bpo-39421: Strong references need to be taken + # when comparing objects as they can alter the heap + class EvilClass(int): + def __lt__(self, o): + # heap.clear() + del heap[:] + return NotImplemented + + heap = [] + self.module.heappush(heap, EvilClass(0)) + self.assertRaises(IndexError, self.module.heappushpop, heap, 1) + + def test_comparison_operator_modifiying_heap_two_heaps(self): + + class h(int): + def __lt__(self, o): + # list2.clear() + del list2[:] + return NotImplemented + + class g(int): + def __lt__(self, o): + # list1.clear() + del list1[:] + return NotImplemented + + list1, list2 = [], [] + + self.module.heappush(list1, h(0)) + self.module.heappush(list2, g(0)) + + self.assertRaises((IndexError, RuntimeError), self.module.heappush, list1, g(1)) + self.assertRaises((IndexError, RuntimeError), self.module.heappush, list2, h(1)) class TestErrorHandlingPython(TestErrorHandling): module = py_heapq diff --git a/src/python/Python-2.7.18/Lib/test/test_socket.py b/src/python/Python-2.7.18/Lib/test/test_socket.py index 988e12a81..2c1b48c69 100644 --- a/src/python/Python-2.7.18/Lib/test/test_socket.py +++ b/src/python/Python-2.7.18/Lib/test/test_socket.py @@ -50,6 +50,13 @@ def try_address(host, port=0, family=socket.AF_INET): HOST = test_support.HOST MSG = 'Michael Gilfix was here\n' +def _is_fd_in_blocking_mode(sock): + return not bool( + fcntl.fcntl(sock, fcntl.F_GETFL, os.O_NONBLOCK) & os.O_NONBLOCK) + + +HAVE_SOCKET_CAN = _have_socket_can() + class SocketTCPTest(unittest.TestCase): def setUp(self): @@ -957,8 +964,44 @@ def testSetBlocking(self): # Testing whether set blocking works self.serv.setblocking(True) self.assertIsNone(self.serv.gettimeout()) + self.assertTrue(self.serv.getblocking()) + if fcntl: + self.assertTrue(_is_fd_in_blocking_mode(self.serv)) + self.serv.setblocking(False) self.assertEqual(self.serv.gettimeout(), 0.0) + self.assertFalse(self.serv.getblocking()) + if fcntl: + self.assertFalse(_is_fd_in_blocking_mode(self.serv)) + + self.serv.settimeout(None) + self.assertTrue(self.serv.getblocking()) + if fcntl: + self.assertTrue(_is_fd_in_blocking_mode(self.serv)) + + self.serv.settimeout(0) + self.assertFalse(self.serv.getblocking()) + self.assertEqual(self.serv.gettimeout(), 0) + if fcntl: + self.assertFalse(_is_fd_in_blocking_mode(self.serv)) + + self.serv.settimeout(10) + self.assertTrue(self.serv.getblocking()) + self.assertEqual(self.serv.gettimeout(), 10) + if fcntl: + # When a Python socket has a non-zero timeout, it's + # switched internally to a non-blocking mode. + # Later, sock.sendall(), sock.recv(), and other socket + # operations use a `select()` call and handle EWOULDBLOCK/EGAIN + # on all socket operations. That's how timeouts are + # enforced. + self.assertFalse(_is_fd_in_blocking_mode(self.serv)) + + self.serv.settimeout(0) + self.assertFalse(self.serv.getblocking()) + if fcntl: + self.assertFalse(_is_fd_in_blocking_mode(self.serv)) + start = time.time() try: self.serv.accept() @@ -983,6 +1026,47 @@ def testSetBlocking_overflow(self): _testSetBlocking_overflow = test_support.cpython_only(_testSetBlocking) + @unittest.skipUnless(hasattr(socket, 'SOCK_NONBLOCK'), + 'test needs socket.SOCK_NONBLOCK') + @support.requires_linux_version(2, 6, 28) + def testInitNonBlocking(self): + # reinit server socket + self.serv.close() + self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM | + socket.SOCK_NONBLOCK) + self.assertFalse(self.serv.getblocking()) + self.assertEqual(self.serv.gettimeout(), 0) + self.port = support.bind_port(self.serv) + self.serv.listen() + # actual testing + start = time.time() + try: + self.serv.accept() + except OSError: + pass + end = time.time() + self.assertTrue((end - start) < 1.0, "Error creating with non-blocking mode.") + + def _testInitNonBlocking(self): + pass + + def testInheritFlags(self): + # Issue #7995: when calling accept() on a listening socket with a + # timeout, the resulting socket should not be non-blocking. + self.serv.settimeout(10) + try: + conn, addr = self.serv.accept() + message = conn.recv(len(MSG)) + finally: + conn.close() + self.serv.settimeout(None) + + def _testInheritFlags(self): + time.sleep(0.1) + self.cli.connect((HOST, self.port)) + time.sleep(0.5) + self.cli.send(MSG) + def testAccept(self): # Testing non-blocking accept self.serv.setblocking(0) @@ -1805,6 +1889,728 @@ def _testStream(self): self.cli.close() +class ContextManagersTest(ThreadedTCPSocketTest): + + def _testSocketClass(self): + # base test + with socket.socket() as sock: + self.assertFalse(sock._closed) + self.assertTrue(sock._closed) + # close inside with block + with socket.socket() as sock: + sock.close() + self.assertTrue(sock._closed) + # exception inside with block + with socket.socket() as sock: + self.assertRaises(OSError, sock.sendall, b'foo') + self.assertTrue(sock._closed) + + def testCreateConnectionBase(self): + conn, addr = self.serv.accept() + self.addCleanup(conn.close) + data = conn.recv(1024) + conn.sendall(data) + + def _testCreateConnectionBase(self): + address = self.serv.getsockname() + with socket.create_connection(address) as sock: + self.assertFalse(sock._closed) + sock.sendall(b'foo') + self.assertEqual(sock.recv(1024), b'foo') + self.assertTrue(sock._closed) + + def testCreateConnectionClose(self): + conn, addr = self.serv.accept() + self.addCleanup(conn.close) + data = conn.recv(1024) + conn.sendall(data) + + def _testCreateConnectionClose(self): + address = self.serv.getsockname() + with socket.create_connection(address) as sock: + sock.close() + self.assertTrue(sock._closed) + self.assertRaises(OSError, sock.sendall, b'foo') + + +class InheritanceTest(unittest.TestCase): + @unittest.skipUnless(hasattr(socket, "SOCK_CLOEXEC"), + "SOCK_CLOEXEC not defined") + @support.requires_linux_version(2, 6, 28) + def test_SOCK_CLOEXEC(self): + with socket.socket(socket.AF_INET, + socket.SOCK_STREAM | socket.SOCK_CLOEXEC) as s: + self.assertEqual(s.type, socket.SOCK_STREAM) + self.assertFalse(s.get_inheritable()) + + def test_default_inheritable(self): + sock = socket.socket() + with sock: + self.assertEqual(sock.get_inheritable(), False) + + def test_dup(self): + sock = socket.socket() + with sock: + newsock = sock.dup() + sock.close() + with newsock: + self.assertEqual(newsock.get_inheritable(), False) + + def test_set_inheritable(self): + sock = socket.socket() + with sock: + sock.set_inheritable(True) + self.assertEqual(sock.get_inheritable(), True) + + sock.set_inheritable(False) + self.assertEqual(sock.get_inheritable(), False) + + @unittest.skipIf(fcntl is None, "need fcntl") + def test_get_inheritable_cloexec(self): + sock = socket.socket() + with sock: + fd = sock.fileno() + self.assertEqual(sock.get_inheritable(), False) + + # clear FD_CLOEXEC flag + flags = fcntl.fcntl(fd, fcntl.F_GETFD) + flags &= ~fcntl.FD_CLOEXEC + fcntl.fcntl(fd, fcntl.F_SETFD, flags) + + self.assertEqual(sock.get_inheritable(), True) + + @unittest.skipIf(fcntl is None, "need fcntl") + def test_set_inheritable_cloexec(self): + sock = socket.socket() + with sock: + fd = sock.fileno() + self.assertEqual(fcntl.fcntl(fd, fcntl.F_GETFD) & fcntl.FD_CLOEXEC, + fcntl.FD_CLOEXEC) + + sock.set_inheritable(True) + self.assertEqual(fcntl.fcntl(fd, fcntl.F_GETFD) & fcntl.FD_CLOEXEC, + 0) + + + def test_socketpair(self): + s1, s2 = socket.socketpair() + self.addCleanup(s1.close) + self.addCleanup(s2.close) + self.assertEqual(s1.get_inheritable(), False) + self.assertEqual(s2.get_inheritable(), False) + + +@unittest.skipUnless(hasattr(socket, "SOCK_NONBLOCK"), + "SOCK_NONBLOCK not defined") +class NonblockConstantTest(unittest.TestCase): + def checkNonblock(self, s, nonblock=True, timeout=0.0): + if nonblock: + self.assertEqual(s.type, socket.SOCK_STREAM) + self.assertEqual(s.gettimeout(), timeout) + self.assertTrue( + fcntl.fcntl(s, fcntl.F_GETFL, os.O_NONBLOCK) & os.O_NONBLOCK) + if timeout == 0: + # timeout == 0: means that getblocking() must be False. + self.assertFalse(s.getblocking()) + else: + # If timeout > 0, the socket will be in a "blocking" mode + # from the standpoint of the Python API. For Python socket + # object, "blocking" means that operations like 'sock.recv()' + # will block. Internally, file descriptors for + # "blocking" Python sockets *with timeouts* are in a + # *non-blocking* mode, and 'sock.recv()' uses 'select()' + # and handles EWOULDBLOCK/EAGAIN to enforce the timeout. + self.assertTrue(s.getblocking()) + else: + self.assertEqual(s.type, socket.SOCK_STREAM) + self.assertEqual(s.gettimeout(), None) + self.assertFalse( + fcntl.fcntl(s, fcntl.F_GETFL, os.O_NONBLOCK) & os.O_NONBLOCK) + self.assertTrue(s.getblocking()) + + @support.requires_linux_version(2, 6, 28) + def test_SOCK_NONBLOCK(self): + # a lot of it seems silly and redundant, but I wanted to test that + # changing back and forth worked ok + with socket.socket(socket.AF_INET, + socket.SOCK_STREAM | socket.SOCK_NONBLOCK) as s: + self.checkNonblock(s) + s.setblocking(1) + self.checkNonblock(s, nonblock=False) + s.setblocking(0) + self.checkNonblock(s) + s.settimeout(None) + self.checkNonblock(s, nonblock=False) + s.settimeout(2.0) + self.checkNonblock(s, timeout=2.0) + s.setblocking(1) + self.checkNonblock(s, nonblock=False) + # defaulttimeout + t = socket.getdefaulttimeout() + socket.setdefaulttimeout(0.0) + with socket.socket() as s: + self.checkNonblock(s) + socket.setdefaulttimeout(None) + with socket.socket() as s: + self.checkNonblock(s, False) + socket.setdefaulttimeout(2.0) + with socket.socket() as s: + self.checkNonblock(s, timeout=2.0) + socket.setdefaulttimeout(None) + with socket.socket() as s: + self.checkNonblock(s, False) + socket.setdefaulttimeout(t) + + +@unittest.skipUnless(os.name == "nt", "Windows specific") +@unittest.skipUnless(multiprocessing, "need multiprocessing") +class TestSocketSharing(SocketTCPTest): + # This must be classmethod and not staticmethod or multiprocessing + # won't be able to bootstrap it. + @classmethod + def remoteProcessServer(cls, q): + # Recreate socket from shared data + sdata = q.get() + message = q.get() + + s = socket.fromshare(sdata) + s2, c = s.accept() + + # Send the message + s2.sendall(message) + s2.close() + s.close() + + def testShare(self): + # Transfer the listening server socket to another process + # and service it from there. + + # Create process: + q = multiprocessing.Queue() + p = multiprocessing.Process(target=self.remoteProcessServer, args=(q,)) + p.start() + + # Get the shared socket data + data = self.serv.share(p.pid) + + # Pass the shared socket to the other process + addr = self.serv.getsockname() + self.serv.close() + q.put(data) + + # The data that the server will send us + message = b"slapmahfro" + q.put(message) + + # Connect + s = socket.create_connection(addr) + # listen for the data + m = [] + while True: + data = s.recv(100) + if not data: + break + m.append(data) + s.close() + received = b"".join(m) + self.assertEqual(received, message) + p.join() + + def testShareLength(self): + data = self.serv.share(os.getpid()) + self.assertRaises(ValueError, socket.fromshare, data[:-1]) + self.assertRaises(ValueError, socket.fromshare, data+b"foo") + + def compareSockets(self, org, other): + # socket sharing is expected to work only for blocking socket + # since the internal python timeout value isn't transferred. + self.assertEqual(org.gettimeout(), None) + self.assertEqual(org.gettimeout(), other.gettimeout()) + + self.assertEqual(org.family, other.family) + self.assertEqual(org.type, other.type) + # If the user specified "0" for proto, then + # internally windows will have picked the correct value. + # Python introspection on the socket however will still return + # 0. For the shared socket, the python value is recreated + # from the actual value, so it may not compare correctly. + if org.proto != 0: + self.assertEqual(org.proto, other.proto) + + def testShareLocal(self): + data = self.serv.share(os.getpid()) + s = socket.fromshare(data) + try: + self.compareSockets(self.serv, s) + finally: + s.close() + + def testTypes(self): + families = [socket.AF_INET, socket.AF_INET6] + types = [socket.SOCK_STREAM, socket.SOCK_DGRAM] + for f in families: + for t in types: + try: + source = socket.socket(f, t) + except OSError: + continue # This combination is not supported + try: + data = source.share(os.getpid()) + shared = socket.fromshare(data) + try: + self.compareSockets(source, shared) + finally: + shared.close() + finally: + source.close() + + +class SendfileUsingSendTest(ThreadedTCPSocketTest): + """ + Test the send() implementation of socket.sendfile(). + """ + + FILESIZE = (10 * 1024 * 1024) # 10 MiB + BUFSIZE = 8192 + FILEDATA = b"" + TIMEOUT = 2 + + @classmethod + def setUpClass(cls): + def chunks(total, step): + assert total >= step + while total > step: + yield step + total -= step + if total: + yield total + + chunk = b"".join([random.choice(string.ascii_letters).encode() + for i in range(cls.BUFSIZE)]) + with open(support.TESTFN, 'wb') as f: + for csize in chunks(cls.FILESIZE, cls.BUFSIZE): + f.write(chunk) + with open(support.TESTFN, 'rb') as f: + cls.FILEDATA = f.read() + assert len(cls.FILEDATA) == cls.FILESIZE + + @classmethod + def tearDownClass(cls): + support.unlink(support.TESTFN) + + def accept_conn(self): + self.serv.settimeout(self.TIMEOUT) + conn, addr = self.serv.accept() + conn.settimeout(self.TIMEOUT) + self.addCleanup(conn.close) + return conn + + def recv_data(self, conn): + received = [] + while True: + chunk = conn.recv(self.BUFSIZE) + if not chunk: + break + received.append(chunk) + return b''.join(received) + + def meth_from_sock(self, sock): + # Depending on the mixin class being run return either send() + # or sendfile() method implementation. + return getattr(sock, "_sendfile_use_send") + + # regular file + + def _testRegularFile(self): + address = self.serv.getsockname() + file = open(support.TESTFN, 'rb') + with socket.create_connection(address) as sock, file as file: + meth = self.meth_from_sock(sock) + sent = meth(file) + self.assertEqual(sent, self.FILESIZE) + self.assertEqual(file.tell(), self.FILESIZE) + + def testRegularFile(self): + conn = self.accept_conn() + data = self.recv_data(conn) + self.assertEqual(len(data), self.FILESIZE) + self.assertEqual(data, self.FILEDATA) + + # non regular file + + def _testNonRegularFile(self): + address = self.serv.getsockname() + file = io.BytesIO(self.FILEDATA) + with socket.create_connection(address) as sock, file as file: + sent = sock.sendfile(file) + self.assertEqual(sent, self.FILESIZE) + self.assertEqual(file.tell(), self.FILESIZE) + self.assertRaises(socket._GiveupOnSendfile, + sock._sendfile_use_sendfile, file) + + def testNonRegularFile(self): + conn = self.accept_conn() + data = self.recv_data(conn) + self.assertEqual(len(data), self.FILESIZE) + self.assertEqual(data, self.FILEDATA) + + # empty file + + def _testEmptyFileSend(self): + address = self.serv.getsockname() + filename = support.TESTFN + "2" + with open(filename, 'wb'): + self.addCleanup(support.unlink, filename) + file = open(filename, 'rb') + with socket.create_connection(address) as sock, file as file: + meth = self.meth_from_sock(sock) + sent = meth(file) + self.assertEqual(sent, 0) + self.assertEqual(file.tell(), 0) + + def testEmptyFileSend(self): + conn = self.accept_conn() + data = self.recv_data(conn) + self.assertEqual(data, b"") + + # offset + + def _testOffset(self): + address = self.serv.getsockname() + file = open(support.TESTFN, 'rb') + with socket.create_connection(address) as sock, file as file: + meth = self.meth_from_sock(sock) + sent = meth(file, offset=5000) + self.assertEqual(sent, self.FILESIZE - 5000) + self.assertEqual(file.tell(), self.FILESIZE) + + def testOffset(self): + conn = self.accept_conn() + data = self.recv_data(conn) + self.assertEqual(len(data), self.FILESIZE - 5000) + self.assertEqual(data, self.FILEDATA[5000:]) + + # count + + def _testCount(self): + address = self.serv.getsockname() + file = open(support.TESTFN, 'rb') + with socket.create_connection(address, timeout=2) as sock, file as file: + count = 5000007 + meth = self.meth_from_sock(sock) + sent = meth(file, count=count) + self.assertEqual(sent, count) + self.assertEqual(file.tell(), count) + + def testCount(self): + count = 5000007 + conn = self.accept_conn() + data = self.recv_data(conn) + self.assertEqual(len(data), count) + self.assertEqual(data, self.FILEDATA[:count]) + + # count small + + def _testCountSmall(self): + address = self.serv.getsockname() + file = open(support.TESTFN, 'rb') + with socket.create_connection(address, timeout=2) as sock, file as file: + count = 1 + meth = self.meth_from_sock(sock) + sent = meth(file, count=count) + self.assertEqual(sent, count) + self.assertEqual(file.tell(), count) + + def testCountSmall(self): + count = 1 + conn = self.accept_conn() + data = self.recv_data(conn) + self.assertEqual(len(data), count) + self.assertEqual(data, self.FILEDATA[:count]) + + # count + offset + + def _testCountWithOffset(self): + address = self.serv.getsockname() + file = open(support.TESTFN, 'rb') + with socket.create_connection(address, timeout=2) as sock, file as file: + count = 100007 + meth = self.meth_from_sock(sock) + sent = meth(file, offset=2007, count=count) + self.assertEqual(sent, count) + self.assertEqual(file.tell(), count + 2007) + + def testCountWithOffset(self): + count = 100007 + conn = self.accept_conn() + data = self.recv_data(conn) + self.assertEqual(len(data), count) + self.assertEqual(data, self.FILEDATA[2007:count+2007]) + + # non blocking sockets are not supposed to work + + def _testNonBlocking(self): + address = self.serv.getsockname() + file = open(support.TESTFN, 'rb') + with socket.create_connection(address) as sock, file as file: + sock.setblocking(False) + meth = self.meth_from_sock(sock) + self.assertRaises(ValueError, meth, file) + self.assertRaises(ValueError, sock.sendfile, file) + + def testNonBlocking(self): + conn = self.accept_conn() + if conn.recv(8192): + self.fail('was not supposed to receive any data') + + # timeout (non-triggered) + + def _testWithTimeout(self): + address = self.serv.getsockname() + file = open(support.TESTFN, 'rb') + with socket.create_connection(address, timeout=2) as sock, file as file: + meth = self.meth_from_sock(sock) + sent = meth(file) + self.assertEqual(sent, self.FILESIZE) + + def testWithTimeout(self): + conn = self.accept_conn() + data = self.recv_data(conn) + self.assertEqual(len(data), self.FILESIZE) + self.assertEqual(data, self.FILEDATA) + + # timeout (triggered) + + def _testWithTimeoutTriggeredSend(self): + address = self.serv.getsockname() + file = open(support.TESTFN, 'rb') + with socket.create_connection(address, timeout=0.01) as sock, \ + file as file: + meth = self.meth_from_sock(sock) + self.assertRaises(socket.timeout, meth, file) + + def testWithTimeoutTriggeredSend(self): + conn = self.accept_conn() + conn.recv(88192) + + # errors + + def _test_errors(self): + pass + + def test_errors(self): + with open(support.TESTFN, 'rb') as file: + with socket.socket(type=socket.SOCK_DGRAM) as s: + meth = self.meth_from_sock(s) + self.assertRaisesRegex( + ValueError, "SOCK_STREAM", meth, file) + with open(support.TESTFN, 'rt') as file: + with socket.socket() as s: + meth = self.meth_from_sock(s) + self.assertRaisesRegex( + ValueError, "binary mode", meth, file) + with open(support.TESTFN, 'rb') as file: + with socket.socket() as s: + meth = self.meth_from_sock(s) + self.assertRaisesRegex(TypeError, "positive integer", + meth, file, count='2') + self.assertRaisesRegex(TypeError, "positive integer", + meth, file, count=0.1) + self.assertRaisesRegex(ValueError, "positive integer", + meth, file, count=0) + self.assertRaisesRegex(ValueError, "positive integer", + meth, file, count=-1) + + +@unittest.skipUnless(hasattr(os, "sendfile"), + 'os.sendfile() required for this test.') +class SendfileUsingSendfileTest(SendfileUsingSendTest): + """ + Test the sendfile() implementation of socket.sendfile(). + """ + def meth_from_sock(self, sock): + return getattr(sock, "_sendfile_use_sendfile") + + +@unittest.skipUnless(HAVE_SOCKET_ALG, 'AF_ALG required') +class LinuxKernelCryptoAPI(unittest.TestCase): + # tests for AF_ALG + def create_alg(self, typ, name): + sock = socket.socket(socket.AF_ALG, socket.SOCK_SEQPACKET, 0) + try: + sock.bind((typ, name)) + except FileNotFoundError as e: + # type / algorithm is not available + sock.close() + raise unittest.SkipTest(str(e), typ, name) + else: + return sock + + # bpo-31705: On kernel older than 4.5, sendto() failed with ENOKEY, + # at least on ppc64le architecture + @support.requires_linux_version(4, 5) + def test_sha256(self): + expected = bytes.fromhex("ba7816bf8f01cfea414140de5dae2223b00361a396" + "177a9cb410ff61f20015ad") + with self.create_alg('hash', 'sha256') as algo: + op, _ = algo.accept() + with op: + op.sendall(b"abc") + self.assertEqual(op.recv(512), expected) + + op, _ = algo.accept() + with op: + op.send(b'a', socket.MSG_MORE) + op.send(b'b', socket.MSG_MORE) + op.send(b'c', socket.MSG_MORE) + op.send(b'') + self.assertEqual(op.recv(512), expected) + + def test_hmac_sha1(self): + expected = bytes.fromhex("effcdf6ae5eb2fa2d27416d5f184df9c259a7c79") + with self.create_alg('hash', 'hmac(sha1)') as algo: + algo.setsockopt(socket.SOL_ALG, socket.ALG_SET_KEY, b"Jefe") + op, _ = algo.accept() + with op: + op.sendall(b"what do ya want for nothing?") + self.assertEqual(op.recv(512), expected) + + # Although it should work with 3.19 and newer the test blocks on + # Ubuntu 15.10 with Kernel 4.2.0-19. + @support.requires_linux_version(4, 3) + def test_aes_cbc(self): + key = bytes.fromhex('06a9214036b8a15b512e03d534120006') + iv = bytes.fromhex('3dafba429d9eb430b422da802c9fac41') + msg = b"Single block msg" + ciphertext = bytes.fromhex('e353779c1079aeb82708942dbe77181a') + msglen = len(msg) + with self.create_alg('skcipher', 'cbc(aes)') as algo: + algo.setsockopt(socket.SOL_ALG, socket.ALG_SET_KEY, key) + op, _ = algo.accept() + with op: + op.sendmsg_afalg(op=socket.ALG_OP_ENCRYPT, iv=iv, + flags=socket.MSG_MORE) + op.sendall(msg) + self.assertEqual(op.recv(msglen), ciphertext) + + op, _ = algo.accept() + with op: + op.sendmsg_afalg([ciphertext], + op=socket.ALG_OP_DECRYPT, iv=iv) + self.assertEqual(op.recv(msglen), msg) + + # long message + multiplier = 1024 + longmsg = [msg] * multiplier + op, _ = algo.accept() + with op: + op.sendmsg_afalg(longmsg, + op=socket.ALG_OP_ENCRYPT, iv=iv) + enc = op.recv(msglen * multiplier) + self.assertEqual(len(enc), msglen * multiplier) + self.assertTrue(enc[:msglen], ciphertext) + + op, _ = algo.accept() + with op: + op.sendmsg_afalg([enc], + op=socket.ALG_OP_DECRYPT, iv=iv) + dec = op.recv(msglen * multiplier) + self.assertEqual(len(dec), msglen * multiplier) + self.assertEqual(dec, msg * multiplier) + + @support.requires_linux_version(4, 9) # see issue29324 + def test_aead_aes_gcm(self): + key = bytes.fromhex('c939cc13397c1d37de6ae0e1cb7c423c') + iv = bytes.fromhex('b3d8cc017cbb89b39e0f67e2') + plain = bytes.fromhex('c3b3c41f113a31b73d9a5cd432103069') + assoc = bytes.fromhex('24825602bd12a984e0092d3e448eda5f') + expected_ct = bytes.fromhex('93fe7d9e9bfd10348a5606e5cafa7354') + expected_tag = bytes.fromhex('0032a1dc85f1c9786925a2e71d8272dd') + + taglen = len(expected_tag) + assoclen = len(assoc) + + with self.create_alg('aead', 'gcm(aes)') as algo: + algo.setsockopt(socket.SOL_ALG, socket.ALG_SET_KEY, key) + algo.setsockopt(socket.SOL_ALG, socket.ALG_SET_AEAD_AUTHSIZE, + None, taglen) + + # send assoc, plain and tag buffer in separate steps + op, _ = algo.accept() + with op: + op.sendmsg_afalg(op=socket.ALG_OP_ENCRYPT, iv=iv, + assoclen=assoclen, flags=socket.MSG_MORE) + op.sendall(assoc, socket.MSG_MORE) + op.sendall(plain) + res = op.recv(assoclen + len(plain) + taglen) + self.assertEqual(expected_ct, res[assoclen:-taglen]) + self.assertEqual(expected_tag, res[-taglen:]) + + # now with msg + op, _ = algo.accept() + with op: + msg = assoc + plain + op.sendmsg_afalg([msg], op=socket.ALG_OP_ENCRYPT, iv=iv, + assoclen=assoclen) + res = op.recv(assoclen + len(plain) + taglen) + self.assertEqual(expected_ct, res[assoclen:-taglen]) + self.assertEqual(expected_tag, res[-taglen:]) + + # create anc data manually + pack_uint32 = struct.Struct('I').pack + op, _ = algo.accept() + with op: + msg = assoc + plain + op.sendmsg( + [msg], + ([socket.SOL_ALG, socket.ALG_SET_OP, pack_uint32(socket.ALG_OP_ENCRYPT)], + [socket.SOL_ALG, socket.ALG_SET_IV, pack_uint32(len(iv)) + iv], + [socket.SOL_ALG, socket.ALG_SET_AEAD_ASSOCLEN, pack_uint32(assoclen)], + ) + ) + res = op.recv(len(msg) + taglen) + self.assertEqual(expected_ct, res[assoclen:-taglen]) + self.assertEqual(expected_tag, res[-taglen:]) + + # decrypt and verify + op, _ = algo.accept() + with op: + msg = assoc + expected_ct + expected_tag + op.sendmsg_afalg([msg], op=socket.ALG_OP_DECRYPT, iv=iv, + assoclen=assoclen) + res = op.recv(len(msg) - taglen) + self.assertEqual(plain, res[assoclen:]) + + @support.requires_linux_version(4, 3) # see test_aes_cbc + def test_drbg_pr_sha256(self): + # deterministic random bit generator, prediction resistance, sha256 + with self.create_alg('rng', 'drbg_pr_sha256') as algo: + extra_seed = os.urandom(32) + algo.setsockopt(socket.SOL_ALG, socket.ALG_SET_KEY, extra_seed) + op, _ = algo.accept() + with op: + rn = op.recv(32) + self.assertEqual(len(rn), 32) + + def test_sendmsg_afalg_args(self): + sock = socket.socket(socket.AF_ALG, socket.SOCK_SEQPACKET, 0) + with sock: + with self.assertRaises(TypeError): + sock.sendmsg_afalg() + + with self.assertRaises(TypeError): + sock.sendmsg_afalg(op=None) + + with self.assertRaises(TypeError): + sock.sendmsg_afalg(1) + + with self.assertRaises(TypeError): + sock.sendmsg_afalg(op=socket.ALG_OP_ENCRYPT, assoclen=None) + + with self.assertRaises(TypeError): + sock.sendmsg_afalg(op=socket.ALG_OP_ENCRYPT, assoclen=-1) + + def test_main(): tests = [GeneralModuleTests, BasicTCPTest, TCPCloserTest, TCPTimeoutTest, TestExceptions, BufferIOTest, BasicTCPTest2, BasicUDPTest, diff --git a/src/python/Python-2.7.18/Lib/test/test_ssl.py b/src/python/Python-2.7.18/Lib/test/test_ssl.py index ef2e59c1d..ff4adb46b 100644 --- a/src/python/Python-2.7.18/Lib/test/test_ssl.py +++ b/src/python/Python-2.7.18/Lib/test/test_ssl.py @@ -6,8 +6,13 @@ from test import test_support as support from test.script_helper import assert_python_ok import asyncore +# import unittest.mock +from mock import Mock +from test import support +import re import socket import select +import struct import time import datetime import gc @@ -85,6 +90,35 @@ def data_file(*name): OP_CIPHER_SERVER_PREFERENCE = getattr(ssl, "OP_CIPHER_SERVER_PREFERENCE", 0) OP_ENABLE_MIDDLEBOX_COMPAT = getattr(ssl, "OP_ENABLE_MIDDLEBOX_COMPAT", 0) +SIGNED_CERTFILE_HOSTNAME = 'localhost' +SIGNED_CERTFILE2_HOSTNAME = 'fakehostname' +NOSANFILE = data_file("nosan.pem") +NOSAN_HOSTNAME = 'localhost' + + +def testing_context(server_cert=SIGNED_CERTFILE): + """Create context + + client_context, server_context, hostname = testing_context() + """ + if server_cert == SIGNED_CERTFILE: + hostname = SIGNED_CERTFILE_HOSTNAME + elif server_cert == SIGNED_CERTFILE2: + hostname = SIGNED_CERTFILE2_HOSTNAME + elif server_cert == NOSANFILE: + hostname = NOSAN_HOSTNAME + else: + raise ValueError(server_cert) + + client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) + client_context.load_verify_locations(SIGNING_CA) + + server_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) + server_context.load_cert_chain(server_cert) + server_context.load_verify_locations(SIGNING_CA) + + return client_context, server_context, hostname + def handle_error(prefix): exc_format = ' '.join(traceback.format_exception(*sys.exc_info())) @@ -1753,7 +1787,7 @@ def wrap_conn(self): return False else: # OSError may occur with wrong protocols, e.g. both - # sides use PROTOCOL_TLS_SERVER. + # sides use PROTOCOL_TLS. # # XXX Various errors can have happened here, for example # a mismatching protocol version, an invalid certificate, @@ -2153,7 +2187,7 @@ def try_protocol_combo(server_protocol, client_protocol, expect_success, class ThreadedTests(unittest.TestCase): - + # FIX: client_context, server_context, hostname = testing_context() @skip_if_broken_ubuntu_ssl def test_echo(self): """Basic test of an SSL client connecting to a server""" @@ -2232,8 +2266,7 @@ def test_crl_check(self): server = ThreadedEchoServer(context=server_context, chatty=True) with server: with closing(context.wrap_socket(socket.socket())) as s: - with self.assertRaisesRegexp(ssl.SSLError, - "certificate verify failed"): + with self.assertRaisesRegexp(ssl.SSLError, "certificate verify failed"): s.connect((HOST, server.port)) # now load a CRL file. The CRL file is signed by the CA. @@ -2261,8 +2294,7 @@ def test_check_hostname(self): # correct hostname should verify server = ThreadedEchoServer(context=server_context, chatty=True) with server: - with closing(context.wrap_socket(socket.socket(), - server_hostname="localhost")) as s: + with closing(context.wrap_socket(socket.socket(), server_hostname="localhost")) as s: s.connect((HOST, server.port)) cert = s.getpeercert() self.assertTrue(cert, "Can't get peer certificate.") @@ -2270,8 +2302,7 @@ def test_check_hostname(self): # incorrect hostname should raise an exception server = ThreadedEchoServer(context=server_context, chatty=True) with server: - with closing(context.wrap_socket(socket.socket(), - server_hostname="invalid")) as s: + with closing(context.wrap_socket(socket.socket(), server_hostname="invalid")) as s: with self.assertRaisesRegexp(ssl.CertificateError, "hostname 'invalid' doesn't match u?'localhost'"): s.connect((HOST, server.port)) @@ -3240,6 +3271,481 @@ def test_read_write_after_close_raises_valuerror(self): self.assertRaises(ValueError, s.read, 1024) self.assertRaises(ValueError, s.write, b'hello') + def test_pha_no_pha_client(self): + client_context, server_context, hostname = testing_context() + server_context.post_handshake_auth = True + server_context.verify_mode = ssl.CERT_REQUIRED + client_context.load_cert_chain(SIGNED_CERTFILE) + + server = ThreadedEchoServer(context=server_context, chatty=False) + with server: + with closing (client_context.wrap_socket(socket.socket(), server_hostname=hostname)) as s: + s.connect((HOST, server.port)) + with self.assertRaisesRegexp(ssl.SSLError, 'not server'): + s.verify_client_post_handshake() + s.write(b'PHA') + self.assertIn(b'extension not received', s.recv(1024)) + + def test_pha_no_pha_server(self): + # server doesn't have PHA enabled, cert is requested in handshake + client_context, server_context, hostname = testing_context() + server_context.verify_mode = ssl.CERT_REQUIRED + client_context.post_handshake_auth = True + client_context.load_cert_chain(SIGNED_CERTFILE) + + server = ThreadedEchoServer(context=server_context, chatty=False) + with server: + with closing(client_context.wrap_socket(socket.socket(), server_hostname=hostname)) as s: + s.connect((HOST, server.port)) + s.write(b'HASCERT') + self.assertEqual(s.recv(1024), b'TRUE\n') + # PHA doesn't fail if there is already a cert + s.write(b'PHA') + self.assertEqual(s.recv(1024), b'OK\n') + s.write(b'HASCERT') + self.assertEqual(s.recv(1024), b'TRUE\n') + + def test_pha_not_tls13(self): + # TLS 1.2 + client_context, server_context, hostname = testing_context() + server_context.verify_mode = ssl.CERT_REQUIRED + client_context.maximum_version = ssl.TLSVersion.TLSv1_2 + client_context.post_handshake_auth = True + client_context.load_cert_chain(SIGNED_CERTFILE) + + server = ThreadedEchoServer(context=server_context, chatty=False) + with server: + with client_context.wrap_socket(socket.socket(), + server_hostname=hostname) as s: + s.connect((HOST, server.port)) + # PHA fails for TLS != 1.3 + s.write(b'PHA') + self.assertIn(b'WRONG_SSL_VERSION', s.recv(1024)) + + def test_bpo37428_pha_cert_none(self): + # verify that post_handshake_auth does not implicitly enable cert + # validation. + hostname = SIGNED_CERTFILE_HOSTNAME + client_context = ssl.SSLContext(ssl.PROTOCOL_TLS) + client_context.post_handshake_auth = True + client_context.load_cert_chain(SIGNED_CERTFILE) + # no cert validation and CA on client side + client_context.check_hostname = False + client_context.verify_mode = ssl.CERT_NONE + + server_context = ssl.SSLContext(ssl.PROTOCOL_TLS) + server_context.load_cert_chain(SIGNED_CERTFILE) + server_context.load_verify_locations(SIGNING_CA) + server_context.post_handshake_auth = True + server_context.verify_mode = ssl.CERT_REQUIRED + + server = ThreadedEchoServer(context=server_context, chatty=False) + with server: + with closing(client_context.wrap_socket(socket.socket(), server_hostname=hostname)) as s: + s.connect((HOST, server.port)) + s.write(b'HASCERT') + self.assertEqual(s.recv(1024), b'FALSE\n') + s.write(b'PHA') + self.assertEqual(s.recv(1024), b'OK\n') + s.write(b'HASCERT') + self.assertEqual(s.recv(1024), b'TRUE\n') + # server cert has not been validated + self.assertEqual(s.getpeercert(), {}) + + +HAS_KEYLOG = hasattr(ssl.SSLContext, 'keylog_filename') +requires_keylog = unittest.skipUnless( + HAS_KEYLOG, 'test requires OpenSSL 1.1.1 with keylog callback') + +class TestSSLDebug(unittest.TestCase): + + def keylog_lines(self, fname=support.TESTFN): + with open(fname) as f: + return len(list(f)) + + @requires_keylog + def test_keylog_defaults(self): + self.addCleanup(support.unlink, support.TESTFN) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS) + self.assertEqual(ctx.keylog_filename, None) + + self.assertFalse(os.path.isfile(support.TESTFN)) + ctx.keylog_filename = support.TESTFN + self.assertEqual(ctx.keylog_filename, support.TESTFN) + self.assertTrue(os.path.isfile(support.TESTFN)) + self.assertEqual(self.keylog_lines(), 1) + + ctx.keylog_filename = None + self.assertEqual(ctx.keylog_filename, None) + + with self.assertRaises((IsADirectoryError, PermissionError)): + # Windows raises PermissionError + ctx.keylog_filename = os.path.dirname( + os.path.abspath(support.TESTFN)) + + with self.assertRaises(TypeError): + ctx.keylog_filename = 1 + + @requires_keylog + def test_keylog_filename(self): + self.addCleanup(support.unlink, support.TESTFN) + client_context, server_context, hostname = testing_context() + + client_context.keylog_filename = support.TESTFN + server = ThreadedEchoServer(context=server_context, chatty=False) + with server: + with closing(client_context.wrap_socket(socket.socket(), server_hostname=hostname)) as s: + s.connect((HOST, server.port)) + # header, 5 lines for TLS 1.3 + self.assertEqual(self.keylog_lines(), 6) + + client_context.keylog_filename = None + server_context.keylog_filename = support.TESTFN + server = ThreadedEchoServer(context=server_context, chatty=False) + with server: + with closing(client_context.wrap_socket(socket.socket(), server_hostname=hostname)) as s: + s.connect((HOST, server.port)) + self.assertGreaterEqual(self.keylog_lines(), 11) + + client_context.keylog_filename = support.TESTFN + server_context.keylog_filename = support.TESTFN + server = ThreadedEchoServer(context=server_context, chatty=False) + with server: + with closing(client_context.wrap_socket(socket.socket(), server_hostname=hostname)) as s: + s.connect((HOST, server.port)) + self.assertGreaterEqual(self.keylog_lines(), 21) + + client_context.keylog_filename = None + server_context.keylog_filename = None + + @requires_keylog + @unittest.skipIf(sys.flags.ignore_environment, + "test is not compatible with ignore_environment") + def test_keylog_env(self): + self.addCleanup(support.unlink, support.TESTFN) + with mock.patch.dict(os.environ): + os.environ['SSLKEYLOGFILE'] = support.TESTFN + self.assertEqual(os.environ['SSLKEYLOGFILE'], support.TESTFN) + + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS) + self.assertEqual(ctx.keylog_filename, None) + + ctx = ssl.create_default_context() + self.assertEqual(ctx.keylog_filename, support.TESTFN) + + ctx = ssl._create_stdlib_context() + self.assertEqual(ctx.keylog_filename, support.TESTFN) + + def test_msg_callback(self): + client_context, server_context, hostname = testing_context() + + def msg_cb(conn, direction, version, content_type, msg_type, data): + pass + + self.assertIs(client_context._msg_callback, None) + client_context._msg_callback = msg_cb + self.assertIs(client_context._msg_callback, msg_cb) + with self.assertRaises(TypeError): + client_context._msg_callback = object() + + def test_msg_callback_tls12(self): + client_context, server_context, hostname = testing_context() + client_context.options |= ssl.OP_NO_TLSv1_3 + + msg = [] + + def msg_cb(conn, direction, version, content_type, msg_type, data): + self.assertIsInstance(conn, ssl.SSLSocket) + self.assertIsInstance(data, bytes) + self.assertIn(direction, {'read', 'write'}) + msg.append((direction, version, content_type, msg_type)) + + client_context._msg_callback = msg_cb + + server = ThreadedEchoServer(context=server_context, chatty=False) + with server: + with closing(client_context.wrap_socket(socket.socket(), server_hostname=hostname)) as s: + s.connect((HOST, server.port)) + + self.assertIn( + ("read", TLSVersion.TLSv1_2, _TLSContentType.HANDSHAKE, + _TLSMessageType.SERVER_KEY_EXCHANGE), + msg + ) + self.assertIn( + ("write", TLSVersion.TLSv1_2, _TLSContentType.CHANGE_CIPHER_SPEC, + _TLSMessageType.CHANGE_CIPHER_SPEC), + msg + ) + + def test_msg_callback_deadlock_bpo43577(self): + client_context, server_context, hostname = testing_context() + server_context2 = testing_context()[1] + + def msg_cb(conn, direction, version, content_type, msg_type, data): + pass + + def sni_cb(sock, servername, ctx): + sock.context = server_context2 + + server_context._msg_callback = msg_cb + server_context.sni_callback = sni_cb + + server = ThreadedEchoServer(context=server_context, chatty=False) + with server: + with closing(client_context.wrap_socket(socket.socket(), server_hostname=hostname)) as s: + s.connect((HOST, server.port)) + with closing(client_context.wrap_socket(socket.socket(), server_hostname=hostname)) as s: + s.connect((HOST, server.port)) + + +def set_socket_so_linger_on_with_zero_timeout(sock): + sock.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', 1, 0)) + + +class TestPreHandshakeClose(unittest.TestCase): + """Verify behavior of close sockets with received data before to the handshake. + """ + + class SingleConnectionTestServerThread(threading.Thread): + + def __init__(self, _dummy=object(), name="name", call_after_accept=False): + self.call_after_accept = call_after_accept + self.received_data = b'' # set by .run() + self.wrap_error = None # set by .run() + self.listener = None # set by .start() + self.port = None # set by .start() + super().__init__(name=name) + + def __enter__(self): + self.start() + return self + + def __exit__(self, *args): + try: + if self.listener: + self.listener.close() + except (OSError, socket_error): + pass + self.join() + self.wrap_error = None # avoid dangling references + + def start(self): + self.ssl_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH) + self.ssl_ctx.verify_mode = ssl.CERT_REQUIRED + self.ssl_ctx.load_verify_locations(cafile=ONLYCERT) + self.ssl_ctx.load_cert_chain(certfile=ONLYCERT, keyfile=ONLYKEY) + self.listener = socket.socket() + self.port = support.bind_port(self.listener) + self.listener.settimeout(2.0) + self.listener.listen(1) + super().start() + + def run(self): + conn, address = self.listener.accept() + self.listener.close() + with conn: + if self.call_after_accept(conn): + return + try: + tls_socket = self.ssl_ctx.wrap_socket(conn, server_side=True) + except OSError as err: # ssl.SSLError inherits from OSError + self.wrap_error = err + else: + try: + self.received_data = tls_socket.recv(400) + except OSError: + pass # closed, protocol error, etc. + + def non_linux_skip_if_other_okay_error(self, err): + if sys.platform == "linux": + return # Expect the full test setup to always work on Linux. + if (isinstance(err, ConnectionResetError) or + (isinstance(err, OSError) and err.errno == errno.EINVAL) or + re.search('wrong.version.number', getattr(err, "reason", ""), re.I)): + # On Windows the TCP RST leads to a ConnectionResetError + # (ECONNRESET) which Linux doesn't appear to surface to userspace. + # If wrap_socket() winds up on the "if connected:" path and doing + # the actual wrapping... we get an SSLError from OpenSSL. Typically + # WRONG_VERSION_NUMBER. While appropriate, neither is the scenario + # we're specifically trying to test. The way this test is written + # is known to work on Linux. We'll skip it anywhere else that it + # does not present as doing so. + self.skipTest("Could not recreate conditions on {sys.platform}: {err}".format(sys.plattform,err)) + # If maintaining this conditional winds up being a problem. + # just turn this into an unconditional skip anything but Linux. + # The important thing is that our CI has the logic covered. + + def test_preauth_data_to_tls_server(self): + server_accept_called = threading.Event() + ready_for_server_wrap_socket = threading.Event() + + def call_after_accept(unused): + server_accept_called.set() + if not ready_for_server_wrap_socket.wait(2.0): + raise RuntimeError("wrap_socket event never set, test may fail.") + return False # Tell the server thread to continue. + + server = self.SingleConnectionTestServerThread( + call_after_accept=call_after_accept, + name="preauth_data_to_tls_server") + server.__enter__() # starts it + self.addCleanup(server.__exit__) # ... & unittest.TestCase stops it. + + with socket.socket() as client: + client.connect(server.listener.getsockname()) + # This forces an immediate connection close via RST on .close(). + set_socket_so_linger_on_with_zero_timeout(client) + client.setblocking(False) + + server_accept_called.wait() + client.send(b"DELETE /data HTTP/1.0\r\n\r\n") + client.close() # RST + + ready_for_server_wrap_socket.set() + server.join() + wrap_error = server.wrap_error + self.assertEqual(b"", server.received_data) + self.assertIsInstance(wrap_error, OSError) # All platforms. + self.non_linux_skip_if_other_okay_error(wrap_error) + self.assertIsInstance(wrap_error, ssl.SSLError) + self.assertIn("before TLS handshake with data", wrap_error.args[1]) + self.assertIn("before TLS handshake with data", wrap_error.reason) + self.assertNotEqual(0, wrap_error.args[0]) + self.assertIsNone(wrap_error.library, msg="attr must exist") + + def test_preauth_data_to_tls_client(self): + client_can_continue_with_wrap_socket = threading.Event() + + def call_after_accept(conn_to_client): + # This forces an immediate connection close via RST on .close(). + set_socket_so_linger_on_with_zero_timeout(conn_to_client) + conn_to_client.send( + b"HTTP/1.0 307 Temporary Redirect\r\n" + b"Location: https://example.com/someone-elses-server\r\n" + b"\r\n") + conn_to_client.close() # RST + client_can_continue_with_wrap_socket.set() + return True # Tell the server to stop. + + server = self.SingleConnectionTestServerThread( + call_after_accept=call_after_accept, + name="preauth_data_to_tls_client") + server.__enter__() # starts it + self.addCleanup(server.__exit__) # ... & unittest.TestCase stops it. + + # Redundant; call_after_accept sets SO_LINGER on the accepted conn. + set_socket_so_linger_on_with_zero_timeout(server.listener) + + with socket.socket() as client: + client.connect(server.listener.getsockname()) + if not client_can_continue_with_wrap_socket.wait(2.0): + self.fail("test server took too long.") + ssl_ctx = ssl.create_default_context() + try: + tls_client = ssl_ctx.wrap_socket( + client, server_hostname="localhost") + except OSError as err: # SSLError inherits from OSError + wrap_error = err + received_data = b"" + else: + wrap_error = None + received_data = tls_client.recv(400) + tls_client.close() + + server.join() + self.assertEqual(b"", received_data) + self.assertIsInstance(wrap_error, OSError) # All platforms. + self.non_linux_skip_if_other_okay_error(wrap_error) + self.assertIsInstance(wrap_error, ssl.SSLError) + self.assertIn("before TLS handshake with data", wrap_error.args[1]) + self.assertIn("before TLS handshake with data", wrap_error.reason) + self.assertNotEqual(0, wrap_error.args[0]) + self.assertIsNone(wrap_error.library, msg="attr must exist") + + def test_https_client_non_tls_response_ignored(self): + server_responding = threading.Event() + + class SynchronizedHTTPSConnection(http.client.HTTPSConnection): + def connect(self): + # Call clear text HTTP connect(), not the encrypted HTTPS (TLS) + # connect(): wrap_socket() is called manually below. + http.client.HTTPConnection.connect(self) + + # Wait for our fault injection server to have done its thing. + if not server_responding.wait(support.SHORT_TIMEOUT) and support.verbose: + sys.stdout.write("server_responding event never set.") + self.sock = self._context.wrap_socket( + self.sock, server_hostname=self.host) + + def call_after_accept(conn_to_client): + # This forces an immediate connection close via RST on .close(). + set_socket_so_linger_on_with_zero_timeout(conn_to_client) + conn_to_client.send( + b"HTTP/1.0 402 Payment Required\r\n" + b"\r\n") + conn_to_client.close() # RST + server_responding.set() + return True # Tell the server to stop. + + timeout = 2.0 + server = self.SingleConnectionTestServerThread( + call_after_accept=call_after_accept, + name="non_tls_http_RST_responder", + timeout=timeout) + server.__enter__() # starts it + self.addCleanup(server.__exit__) # ... & unittest.TestCase stops it. + # Redundant; call_after_accept sets SO_LINGER on the accepted conn. + set_socket_so_linger_on_with_zero_timeout(server.listener) + + connection = SynchronizedHTTPSConnection( + server.listener.getsockname()[0], + port=server.port, + context=ssl.create_default_context(), + timeout=timeout, + ) + + # There are lots of reasons this raises as desired, long before this + # test was added. Sending the request requires a successful TLS wrapped + # socket; that fails if the connection is broken. It may seem pointless + # to test this. It serves as an illustration of something that we never + # want to happen... properly not happening. + with self.assertRaises(OSError): + connection.request("HEAD", "/test", headers={"Host": "localhost"}) + response = connection.getresponse() + + server.join() + + def test_bpo37428_pha_cert_none(self): + # verify that post_handshake_auth does not implicitly enable cert + # validation. + hostname = SIGNED_CERTFILE_HOSTNAME + client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + client_context.post_handshake_auth = True + client_context.load_cert_chain(SIGNED_CERTFILE) + # no cert validation and CA on client side + client_context.check_hostname = False + client_context.verify_mode = ssl.CERT_NONE + + server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + server_context.load_cert_chain(SIGNED_CERTFILE) + server_context.load_verify_locations(SIGNING_CA) + server_context.post_handshake_auth = True + server_context.verify_mode = ssl.CERT_REQUIRED + + server = ThreadedEchoServer(context=server_context, chatty=False) + with server: + with closing(client_context.wrap_socket(socket.socket(), server_hostname=hostname)) as s: + s.connect((HOST, server.port)) + s.write(b'HASCERT') + self.assertEqual(s.recv(1024), b'FALSE\n') + s.write(b'PHA') + self.assertEqual(s.recv(1024), b'OK\n') + s.write(b'HASCERT') + self.assertEqual(s.recv(1024), b'TRUE\n') + # server cert has not been validated + self.assertEqual(s.getpeercert(), {}) + def test_main(verbose=False): if support.verbose: diff --git a/src/python/Python-2.7.18/Misc/NEWS.d/next/Core and Builtins/2020-01-22-15-53-37.bpo-39421.O3nG7u.rst b/src/python/Python-2.7.18/Misc/NEWS.d/next/Core and Builtins/2020-01-22-15-53-37.bpo-39421.O3nG7u.rst new file mode 100644 index 000000000..bae008150 --- /dev/null +++ b/src/python/Python-2.7.18/Misc/NEWS.d/next/Core and Builtins/2020-01-22-15-53-37.bpo-39421.O3nG7u.rst @@ -0,0 +1,2 @@ +Fix possible crashes when operating with the functions in the :mod:`heapq` +module and custom comparison operators. diff --git a/src/python/Python-2.7.18/Misc/NEWS.d/next/Library/2017-12-19-09-23-46.bpo-32373.8qAkoW.rst b/src/python/Python-2.7.18/Misc/NEWS.d/next/Library/2017-12-19-09-23-46.bpo-32373.8qAkoW.rst new file mode 100644 index 000000000..9772dda35 --- /dev/null +++ b/src/python/Python-2.7.18/Misc/NEWS.d/next/Library/2017-12-19-09-23-46.bpo-32373.8qAkoW.rst @@ -0,0 +1 @@ +Add socket.getblocking() method. diff --git a/src/python/Python-2.7.18/Misc/NEWS.d/next/Library/2019-06-27-13-27-02.bpo-37428._wcwUd.rst b/src/python/Python-2.7.18/Misc/NEWS.d/next/Library/2019-06-27-13-27-02.bpo-37428._wcwUd.rst new file mode 100644 index 000000000..2cdce6b24 --- /dev/null +++ b/src/python/Python-2.7.18/Misc/NEWS.d/next/Library/2019-06-27-13-27-02.bpo-37428._wcwUd.rst @@ -0,0 +1,4 @@ +SSLContext.post_handshake_auth = True no longer sets +SSL_VERIFY_POST_HANDSHAKE verify flag for client connections. Although the +option is documented as ignored for clients, OpenSSL implicitly enables cert +chain validation when the flag is set. diff --git a/src/python/Python-2.7.18/Misc/NEWS.d/next/Security/2020-05-28-06-06-47.bpo-40791.QGZClX.rst b/src/python/Python-2.7.18/Misc/NEWS.d/next/Security/2020-05-28-06-06-47.bpo-40791.QGZClX.rst new file mode 100644 index 000000000..69b9de1be --- /dev/null +++ b/src/python/Python-2.7.18/Misc/NEWS.d/next/Security/2020-05-28-06-06-47.bpo-40791.QGZClX.rst @@ -0,0 +1 @@ +Add ``volatile`` to the accumulator variable in ``hmac.compare_digest``, making constant-time-defeating optimizations less likely. \ No newline at end of file diff --git a/src/python/Python-2.7.18/Misc/NEWS.d/next/Security/2023-08-22-17-39-12.gh-issue-108310.fVM3sg.rst b/src/python/Python-2.7.18/Misc/NEWS.d/next/Security/2023-08-22-17-39-12.gh-issue-108310.fVM3sg.rst new file mode 100644 index 000000000..403c77a9d --- /dev/null +++ b/src/python/Python-2.7.18/Misc/NEWS.d/next/Security/2023-08-22-17-39-12.gh-issue-108310.fVM3sg.rst @@ -0,0 +1,7 @@ +Fixed an issue where instances of :class:`ssl.SSLSocket` were vulnerable to +a bypass of the TLS handshake and included protections (like certificate +verification) and treating sent unencrypted data as if it were +post-handshake TLS encrypted data. Security issue reported as +`CVE-2023-40217 +`_ by +Aapo Oksman. Patch by Gregory P. Smith. diff --git a/src/python/Python-2.7.18/Modules/_heapqmodule.c b/src/python/Python-2.7.18/Modules/_heapqmodule.c index 5b0ef6915..9e2c5c784 100644 --- a/src/python/Python-2.7.18/Modules/_heapqmodule.c +++ b/src/python/Python-2.7.18/Modules/_heapqmodule.c @@ -52,7 +52,11 @@ _siftdown(PyListObject *heap, Py_ssize_t startpos, Py_ssize_t pos) while (pos > startpos) { parentpos = (pos - 1) >> 1; parent = PyList_GET_ITEM(heap, parentpos); + Py_INCREF(newitem); + Py_INCREF(parent); cmp = cmp_lt(newitem, parent); + Py_DECREF(parent); + Py_DECREF(newitem); if (cmp == -1) return -1; if (size != PyList_GET_SIZE(heap)) { @@ -93,9 +97,13 @@ _siftup(PyListObject *heap, Py_ssize_t pos) childpos = 2*pos + 1; /* leftmost child position */ rightpos = childpos + 1; if (rightpos < endpos) { - cmp = cmp_lt( - PyList_GET_ITEM(heap, childpos), - PyList_GET_ITEM(heap, rightpos)); + PyObject* a = PyList_GET_ITEM(heap, childpos); + PyObject* b = PyList_GET_ITEM(heap, rightpos); + Py_INCREF(a); + Py_INCREF(b); + cmp = cmp_lt(a,b); + Py_DECREF(a); + Py_DECREF(b); if (cmp == -1) return -1; if (cmp == 0) @@ -236,7 +244,10 @@ heappushpop(PyObject *self, PyObject *args) return item; } - cmp = cmp_lt(PyList_GET_ITEM(heap, 0), item); + PyObject* top = PyList_GET_ITEM(heap, 0); + Py_INCREF(top); + cmp = cmp_lt(top, item); + Py_DECREF(top); if (cmp == -1) return NULL; if (cmp == 0) { @@ -395,7 +406,11 @@ _siftdownmax(PyListObject *heap, Py_ssize_t startpos, Py_ssize_t pos) while (pos > startpos){ parentpos = (pos - 1) >> 1; parent = PyList_GET_ITEM(heap, parentpos); + Py_INCREF(parent); + Py_INCREF(newitem); cmp = cmp_lt(parent, newitem); + Py_DECREF(parent); + Py_DECREF(newitem); if (cmp == -1) { Py_DECREF(newitem); return -1; @@ -436,9 +451,13 @@ _siftupmax(PyListObject *heap, Py_ssize_t pos) childpos = 2*pos + 1; /* leftmost child position */ rightpos = childpos + 1; if (rightpos < endpos) { - cmp = cmp_lt( - PyList_GET_ITEM(heap, rightpos), - PyList_GET_ITEM(heap, childpos)); + PyObject* a = PyList_GET_ITEM(heap, rightpos); + PyObject* b = PyList_GET_ITEM(heap, childpos); + Py_INCREF(a); + Py_INCREF(b); + cmp = cmp_lt(a, b); + Py_DECREF(a); + Py_DECREF(b); if (cmp == -1) { Py_DECREF(newitem); return -1; diff --git a/src/python/Python-2.7.18/Modules/_ssl.c b/src/python/Python-2.7.18/Modules/_ssl.c index 98c8a5a4a..e28f02d12 100644 --- a/src/python/Python-2.7.18/Modules/_ssl.c +++ b/src/python/Python-2.7.18/Modules/_ssl.c @@ -106,6 +106,10 @@ struct py_ssl_library_code { # define PY_OPENSSL_1_1_API 1 #endif +#if (OPENSSL_VERSION_NUMBER >= 0x30300000L) && !defined(LIBRESSL_VERSION_NUMBER) +# define OPENSSL_VERSION_3_3 1 +#endif + /* LibreSSL 2.7.0 provides necessary OpenSSL 1.1.0 APIs */ #if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x2070000fL # define PY_OPENSSL_1_1_API 1 @@ -161,6 +165,16 @@ struct py_ssl_library_code { #define HAVE_OPENSSL_CRYPTO_LOCK #endif +/* OpenSSL 1.1+ allows locking X509_STORE, 1.0.2 doesn't. */ +#ifdef OPENSSL_VERSION_1_1 +#define HAVE_OPENSSL_X509_STORE_LOCK +#endif + +/* OpenSSL 3.3 added the X509_STORE_get1_objects API */ +#ifdef OPENSSL_VERSION_3_3 +#define HAVE_OPENSSL_X509_STORE_GET1_OBJECTS 1 +#endif + #if defined(OPENSSL_VERSION_1_1) && !defined(OPENSSL_NO_SSL2) #define OPENSSL_NO_SSL2 #endif @@ -324,6 +338,9 @@ typedef struct { PyObject *set_hostname; #endif int check_hostname; +#ifdef TLS1_3_VERSION + int post_handshake_auth; +#endif } PySSLContext; typedef struct { @@ -606,6 +623,28 @@ newPySSLSocket(PySSLContext *sslctx, PySocketSockObject *sock, #endif SSL_set_mode(self->ssl, mode); + /* bpo-37428: newPySSLSocket() sets SSL_VERIFY_POST_HANDSHAKE flag for + * server sockets and SSL_set_post_handshake_auth() for client. */ +// #ifdef TLS1_3_VERSION +// if (sslctx->post_handshake_auth == 1) { +// if (socket_type == PY_SSL_SERVER) { +// /* bpo-37428: OpenSSL does not ignore SSL_VERIFY_POST_HANDSHAKE. +// * Set SSL_VERIFY_POST_HANDSHAKE flag only for server sockets and +// * only in combination with SSL_VERIFY_PEER flag. */ +// int mode = SSL_get_verify_mode(self->ssl); +// if (mode & SSL_VERIFY_PEER) { +// int (*verify_cb)(int, X509_STORE_CTX *) = NULL; +// verify_cb = SSL_get_verify_callback(self->ssl); +// mode |= SSL_VERIFY_POST_HANDSHAKE; +// SSL_set_verify(self->ssl, mode, verify_cb); +// } +// } else { +// /* client socket */ +// SSL_set_post_handshake_auth(self->ssl, 1); +// } +// } +// #endif + #if HAVE_SNI if (server_hostname != NULL) { /* Don't send SNI for IP addresses. We cannot simply use inet_aton() and @@ -2100,6 +2139,36 @@ If the TLS handshake is not yet complete, None is returned"); #endif /* HAVE_OPENSSL_FINISHED */ +/*[clinic input] +_ssl._SSLSocket.verify_client_post_handshake + +Initiate TLS 1.3 post-handshake authentication +[clinic start generated code]*/ + +PyDoc_STRVAR(_ssl__SSLSocket_verify_client_post_handshake__doc__, +"verify_client_post_handshake($self, /)\n" +"--\n" +"\n" +"Initiate TLS 1.3 post-handshake authentication"); + +static PyObject * +_ssl__SSLSocket_verify_client_post_handshake_impl(PySSLSocket *self) +/*[clinic end generated code: output=532147f3b1341425 input=6bfa874810a3d889]*/ +{ +#ifdef TLS1_3_VERSION + int err = SSL_verify_client_post_handshake(self->ssl); + if (err == 0) + return _setSSLError(NULL, 0, __FILE__, __LINE__); + else + Py_RETURN_NONE; +#else + PyErr_SetString(PyExc_NotImplementedError, + "Post-handshake auth is not supported by your " + "OpenSSL version."); + return NULL; +#endif +} + static PyGetSetDef ssl_getsetlist[] = { {"context", (getter) PySSL_get_context, (setter) PySSL_set_context, PySSL_set_context_doc}, @@ -2131,6 +2200,7 @@ static PyMethodDef PySSLMethods[] = { {"tls_unique_cb", (PyCFunction)PySSL_tls_unique_cb, METH_NOARGS, PySSL_tls_unique_cb_doc}, #endif + {"verify_client_post_handshake", (PyCFunction)_ssl__SSLSocket_verify_client_post_handshake_impl, METH_NOARGS, _ssl__SSLSocket_verify_client_post_handshake__doc__}, {NULL, NULL} }; @@ -2308,6 +2378,13 @@ context_new(PyTypeObject *type, PyObject *args, PyObject *kwds) } #endif +#ifdef TLS1_3_VERSION + { + self->post_handshake_auth = 0; + SSL_CTX_set_post_handshake_auth(self->ctx, self->post_handshake_auth); + } +#endif + return (PyObject *)self; } @@ -2527,6 +2604,8 @@ static int set_verify_mode(PySSLContext *self, PyObject *arg, void *c) { int n, mode; + int (*verify_cb)(int, X509_STORE_CTX *) = NULL; + if (!PyArg_Parse(arg, "i", &n)) return -1; if (n == PY_SSL_CERT_NONE) @@ -2540,13 +2619,20 @@ set_verify_mode(PySSLContext *self, PyObject *arg, void *c) "invalid value for verify_mode"); return -1; } + if (mode == SSL_VERIFY_NONE && self->check_hostname) { PyErr_SetString(PyExc_ValueError, "Cannot set verify_mode to CERT_NONE when " "check_hostname is enabled."); return -1; } - SSL_CTX_set_verify(self->ctx, mode, NULL); + + /* bpo-37428: newPySSLSocket() sets SSL_VERIFY_POST_HANDSHAKE flag for + * server sockets and SSL_set_post_handshake_auth() for client. */ + + /* keep current verify cb */ + verify_cb = SSL_CTX_get_verify_callback(self->ctx); + SSL_CTX_set_verify(self->ctx, mode, verify_cb); return 0; } @@ -2651,6 +2737,36 @@ set_check_hostname(PySSLContext *self, PyObject *arg, void *c) return 0; } +static PyObject * +get_post_handshake_auth(PySSLContext *self, void *c) { +#if TLS1_3_VERSION + return PyBool_FromLong(self->post_handshake_auth); +#else + Py_RETURN_NONE; +#endif +} + +#if TLS1_3_VERSION +static int +set_post_handshake_auth(PySSLContext *self, PyObject *arg, void *c) { + if (arg == NULL) { + PyErr_SetString(PyExc_AttributeError, "cannot delete attribute"); + return -1; + } + int pha = PyObject_IsTrue(arg); + + if (pha == -1) { + return -1; + } + self->post_handshake_auth = pha; + + /* bpo-37428: newPySSLSocket() sets SSL_VERIFY_POST_HANDSHAKE flag for + * server sockets and SSL_set_post_handshake_auth() for client. */ + + return 0; +} +#endif + typedef struct { PyThreadState *thread_state; @@ -3402,7 +3518,15 @@ cert_store_stats(PySSLContext *self) int x509 = 0, crl = 0, ca = 0, i; store = SSL_CTX_get_cert_store(self->ctx); - objs = X509_STORE_get0_objects(store); + #if HAVE_OPENSSL_X509_STORE_GET1_OBJECTS + objs = X509_STORE_get1_objects(store); + if (objs == NULL) { + PyErr_SetString(PyExc_MemoryError, "failed to query cert store"); + return NULL; + } + #else + objs = X509_STORE_get0_objects(store); + #endif for (i = 0; i < sk_X509_OBJECT_num(objs); i++) { obj = sk_X509_OBJECT_value(objs, i); switch (X509_OBJECT_get_type(obj)) { @@ -3419,9 +3543,15 @@ cert_store_stats(PySSLContext *self) /* Ignore X509_LU_FAIL, X509_LU_RETRY, X509_LU_PKEY. * As far as I can tell they are internal states and never * stored in a cert store */ + /* Ignore enrecognized types */ break; } } + +#if HAVE_OPENSSL_X509_STORE_GET1_OBJECTS + sk_X509_OBJECT_pop_free(objs, X509_OBJECT_free); +#endif + return Py_BuildValue("{sisisi}", "x509", x509, "crl", crl, "x509_ca", ca); } @@ -3456,9 +3586,16 @@ get_ca_certs(PySSLContext *self, PyObject *args, PyObject *kwds) if ((rlist = PyList_New(0)) == NULL) { return NULL; } - store = SSL_CTX_get_cert_store(self->ctx); +#if HAVE_OPENSSL_X509_STORE_GET1_OBJECTS + objs = X509_STORE_get1_objects(store); + if (objs == NULL) { + PyErr_SetString(PyExc_MemoryError, "failed to query cert store"); + return NULL; + } +#else objs = X509_STORE_get0_objects(store); +#endif for (i = 0; i < sk_X509_OBJECT_num(objs); i++) { X509_OBJECT *obj; X509 *cert; @@ -3486,9 +3623,15 @@ get_ca_certs(PySSLContext *self, PyObject *args, PyObject *kwds) } Py_CLEAR(ci); } + #if HAVE_OPENSSL_X509_STORE_GET1_OBJECTS + sk_X509_OBJECT_pop_free(objs, X509_OBJECT_free); + #endif return rlist; error: +#if HAVE_OPENSSL_X509_STORE_GET1_OBJECTS + sk_X509_OBJECT_pop_free(objs, X509_OBJECT_free); +#endif Py_XDECREF(ci); Py_XDECREF(rlist); return NULL; @@ -3506,6 +3649,13 @@ static PyGetSetDef context_getsetlist[] = { #endif {"verify_mode", (getter) get_verify_mode, (setter) set_verify_mode, NULL}, + {"post_handshake_auth", (getter) get_post_handshake_auth, +#ifdef TLS1_3_VERSION + (setter) set_post_handshake_auth, +#else + NULL, +#endif + }, {NULL}, /* sentinel */ }; @@ -4532,3 +4682,52 @@ init_ssl(void) if (r == NULL || PyModule_AddObject(m, "_OPENSSL_API_VERSION", r)) return; } + +/* Shim of X509_STORE_get1_objects API from OpenSSL 3.3 + * Only available with the X509_STORE_lock() API */ +#if defined(HAVE_OPENSSL_X509_STORE_LOCK) && !defined(OPENSSL_VERSION_3_3) +#define HAVE_OPENSSL_X509_STORE_GET1_OBJECTS 1 + +static X509_OBJECT *x509_object_dup(const X509_OBJECT *obj) +{ + int ok; + X509_OBJECT *ret = X509_OBJECT_new(); + if (ret == NULL) { + return NULL; + } + switch (X509_OBJECT_get_type(obj)) { + case X509_LU_X509: + ok = X509_OBJECT_set1_X509(ret, X509_OBJECT_get0_X509(obj)); + break; + case X509_LU_CRL: + /* X509_OBJECT_get0_X509_CRL was not const-correct prior to 3.0.*/ + ok = X509_OBJECT_set1_X509_CRL( + ret, X509_OBJECT_get0_X509_CRL((X509_OBJECT *)obj)); + break; + default: + /* We cannot duplicate unrecognized types in a polyfill, but it is + * safe to leave an empty object. The caller will ignore it. */ + ok = 1; + break; + } + if (!ok) { + X509_OBJECT_free(ret); + return NULL; + } + return ret; +} + +static STACK_OF(X509_OBJECT) * +X509_STORE_get1_objects(X509_STORE *store) +{ + STACK_OF(X509_OBJECT) *ret; + if (!X509_STORE_lock(store)) { + return NULL; + } + ret = sk_X509_OBJECT_deep_copy(X509_STORE_get0_objects(store), + x509_object_dup, X509_OBJECT_free); + X509_STORE_unlock(store); + return ret; +} +#endif + diff --git a/src/python/Python-2.7.18/Modules/operator.c b/src/python/Python-2.7.18/Modules/operator.c index 7ddd123f4..67011a6a8 100644 --- a/src/python/Python-2.7.18/Modules/operator.c +++ b/src/python/Python-2.7.18/Modules/operator.c @@ -259,7 +259,7 @@ _tscmp(const unsigned char *a, const unsigned char *b, volatile const unsigned char *left; volatile const unsigned char *right; Py_ssize_t i; - unsigned char result; + volatile unsigned char result; /* loop count depends on length of b */ length = len_b; diff --git a/src/python/Python-2.7.18/Modules/socketmodule.c b/src/python/Python-2.7.18/Modules/socketmodule.c index 4d5a8f6f0..b145daf5c 100644 --- a/src/python/Python-2.7.18/Modules/socketmodule.c +++ b/src/python/Python-2.7.18/Modules/socketmodule.c @@ -142,7 +142,8 @@ sendall(data[, flags]) -- send all data\n\ send(data[, flags]) -- send data, may not send all of it\n\ sendto(data[, flags], addr) -- send data to a given address\n\ setblocking(0 | 1) -- set or clear the blocking I/O flag\n\ -setsockopt(level, optname, value) -- set socket options\n\ +getblocking() -- return True if socket is blocking, False if non-blocking\n\ +setsockopt(level, optname, value[, optlen]) -- set socket options\n\ settimeout(None | float) -- set or clear the timeout\n\ shutdown(how) -- shut down traffic in one or both directions\n\ \n\ @@ -1814,6 +1815,68 @@ Set the socket to blocking (flag is true) or non-blocking (false).\n\ setblocking(True) is equivalent to settimeout(None);\n\ setblocking(False) is equivalent to settimeout(0.0)."); +/* s.getblocking() method. + Returns True if socket is in blocking mode, + False if it is in non-blocking mode. +*/ +static PyObject * +sock_getblocking(PySocketSockObject *s) +{ + if (s->sock_timeout) { + Py_RETURN_TRUE; + } + else { + Py_RETURN_FALSE; + } +} + +PyDoc_STRVAR(getblocking_doc, +"getblocking()\n\ +\n\ +Returns True if socket is in blocking mode, or False if it\n\ +is in non-blocking mode."); + +static int +socket_parse_timeout(_PyTime_t *timeout, PyObject *timeout_obj) +{ +#ifdef MS_WINDOWS + struct timeval tv; +#endif +#ifndef HAVE_POLL + _PyTime_t ms; +#endif + int overflow = 0; + + if (timeout_obj == Py_None) { + *timeout = _PyTime_FromSeconds(-1); + return 0; + } + + if (_PyTime_FromSecondsObject(timeout, + timeout_obj, _PyTime_ROUND_TIMEOUT) < 0) + return -1; + + if (*timeout < 0) { + PyErr_SetString(PyExc_ValueError, "Timeout value out of range"); + return -1; + } + +#ifdef MS_WINDOWS + overflow |= (_PyTime_AsTimeval(*timeout, &tv, _PyTime_ROUND_TIMEOUT) < 0); +#endif +#ifndef HAVE_POLL + ms = _PyTime_AsMilliseconds(*timeout, _PyTime_ROUND_TIMEOUT); + overflow |= (ms > INT_MAX); +#endif + if (overflow) { + PyErr_SetString(PyExc_OverflowError, + "timeout doesn't fit into C timeval"); + return -1; + } + + return 0; +} + /* s.settimeout(timeout) method. Argument: None -- no timeout, blocking mode; same as setblocking(True) 0.0 -- non-blocking mode; same as setblocking(False) @@ -1837,11 +1900,34 @@ sock_settimeout(PySocketSockObject *s, PyObject *arg) } } - s->sock_timeout = timeout; - internal_setblocking(s, timeout < 0.0); + s->sock_timeout = timeout; - Py_INCREF(Py_None); - return Py_None; + int block = timeout < 0; + /* Blocking mode for a Python socket object means that operations + like :meth:`recv` or :meth:`sendall` will block the execution of + the current thread until they are complete or aborted with a + `socket.timeout` or `socket.error` errors. When timeout is `None`, + the underlying FD is in a blocking mode. When timeout is a positive + number, the FD is in a non-blocking mode, and socket ops are + implemented with a `select()` call. + + When timeout is 0.0, the FD is in a non-blocking mode. + + This table summarizes all states in which the socket object and + its underlying FD can be: + + ==================== ===================== ============== + `gettimeout()` `getblocking()` FD + ==================== ===================== ============== + ``None`` ``True`` blocking + ``0.0`` ``False`` non-blocking + ``> 0`` ``True`` non-blocking + */ + + if (internal_setblocking(s, block) == -1) { + return NULL; + } + Py_RETURN_NONE; } PyDoc_STRVAR(settimeout_doc, @@ -3122,6 +3208,8 @@ static PyMethodDef sock_methods[] = { sendto_doc}, {"setblocking", (PyCFunction)sock_setblocking, METH_O, setblocking_doc}, + {"getblocking", (PyCFunction)sock_getblocking, METH_NOARGS, + getblocking_doc}, {"settimeout", (PyCFunction)sock_settimeout, METH_O, settimeout_doc}, {"gettimeout", (PyCFunction)sock_gettimeout, METH_NOARGS, diff --git a/src/python/Python-2.7.18/Python/pytime.c b/src/python/Python-2.7.18/Python/pytime.c new file mode 100644 index 000000000..109d52692 --- /dev/null +++ b/src/python/Python-2.7.18/Python/pytime.c @@ -0,0 +1,1114 @@ +#include "Python.h" +#ifdef MS_WINDOWS +#include /* struct timeval */ +#endif + +#if defined(__APPLE__) +#include /* mach_absolute_time(), mach_timebase_info() */ +#endif + +#define _PyTime_check_mul_overflow(a, b) \ + (assert(b > 0), \ + (_PyTime_t)(a) < _PyTime_MIN / (_PyTime_t)(b) \ + || _PyTime_MAX / (_PyTime_t)(b) < (_PyTime_t)(a)) + +/* To millisecond (10^-3) */ +#define SEC_TO_MS 1000 + +/* To microseconds (10^-6) */ +#define MS_TO_US 1000 +#define SEC_TO_US (SEC_TO_MS * MS_TO_US) + +/* To nanoseconds (10^-9) */ +#define US_TO_NS 1000 +#define MS_TO_NS (MS_TO_US * US_TO_NS) +#define SEC_TO_NS (SEC_TO_MS * MS_TO_NS) + +/* Conversion from nanoseconds */ +#define NS_TO_MS (1000 * 1000) +#define NS_TO_US (1000) + +static void +error_time_t_overflow(void) +{ + PyErr_SetString(PyExc_OverflowError, + "timestamp out of range for platform time_t"); +} + +static void +_PyTime_overflow(void) +{ + PyErr_SetString(PyExc_OverflowError, + "timestamp too large to convert to C _PyTime_t"); +} + + +_PyTime_t +_PyTime_MulDiv(_PyTime_t ticks, _PyTime_t mul, _PyTime_t div) +{ + _PyTime_t intpart, remaining; + /* Compute (ticks * mul / div) in two parts to prevent integer overflow: + compute integer part, and then the remaining part. + + (ticks * mul) / div == (ticks / div) * mul + (ticks % div) * mul / div + + The caller must ensure that "(div - 1) * mul" cannot overflow. */ + intpart = ticks / div; + ticks %= div; + remaining = ticks * mul; + remaining /= div; + return intpart * mul + remaining; +} + + +time_t +_PyLong_AsTime_t(PyObject *obj) +{ +#if SIZEOF_TIME_T == SIZEOF_LONG_LONG + long long val; + val = PyLong_AsLongLong(obj); +#else + long val; + Py_BUILD_ASSERT(sizeof(time_t) <= sizeof(long)); + val = PyLong_AsLong(obj); +#endif + if (val == -1 && PyErr_Occurred()) { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) { + error_time_t_overflow(); + } + return -1; + } + return (time_t)val; +} + +PyObject * +_PyLong_FromTime_t(time_t t) +{ +#if SIZEOF_TIME_T == SIZEOF_LONG_LONG + return PyLong_FromLongLong((long long)t); +#else + Py_BUILD_ASSERT(sizeof(time_t) <= sizeof(long)); + return PyLong_FromLong((long)t); +#endif +} + +/* Round to nearest with ties going to nearest even integer + (_PyTime_ROUND_HALF_EVEN) */ +static double +_PyTime_RoundHalfEven(double x) +{ + double rounded = round(x); + if (fabs(x-rounded) == 0.5) { + /* halfway case: round to even */ + rounded = 2.0*round(x/2.0); + } + return rounded; +} + +static double +_PyTime_Round(double x, _PyTime_round_t round) +{ + /* volatile avoids optimization changing how numbers are rounded */ + volatile double d; + + d = x; + if (round == _PyTime_ROUND_HALF_EVEN) { + d = _PyTime_RoundHalfEven(d); + } + else if (round == _PyTime_ROUND_CEILING) { + d = ceil(d); + } + else if (round == _PyTime_ROUND_FLOOR) { + d = floor(d); + } + else { + assert(round == _PyTime_ROUND_UP); + d = (d >= 0.0) ? ceil(d) : floor(d); + } + return d; +} + +static int +_PyTime_DoubleToDenominator(double d, time_t *sec, long *numerator, + long idenominator, _PyTime_round_t round) +{ + double denominator = (double)idenominator; + double intpart; + /* volatile avoids optimization changing how numbers are rounded */ + volatile double floatpart; + + floatpart = modf(d, &intpart); + + floatpart *= denominator; + floatpart = _PyTime_Round(floatpart, round); + if (floatpart >= denominator) { + floatpart -= denominator; + intpart += 1.0; + } + else if (floatpart < 0) { + floatpart += denominator; + intpart -= 1.0; + } + assert(0.0 <= floatpart && floatpart < denominator); + + if (!_Py_InIntegralTypeRange(time_t, intpart)) { + error_time_t_overflow(); + return -1; + } + *sec = (time_t)intpart; + *numerator = (long)floatpart; + assert(0 <= *numerator && *numerator < idenominator); + return 0; +} + +static int +_PyTime_ObjectToDenominator(PyObject *obj, time_t *sec, long *numerator, + long denominator, _PyTime_round_t round) +{ + assert(denominator >= 1); + + if (PyFloat_Check(obj)) { + double d = PyFloat_AsDouble(obj); + if (Py_IS_NAN(d)) { + *numerator = 0; + PyErr_SetString(PyExc_ValueError, "Invalid value NaN (not a number)"); + return -1; + } + return _PyTime_DoubleToDenominator(d, sec, numerator, + denominator, round); + } + else { + *sec = _PyLong_AsTime_t(obj); + *numerator = 0; + if (*sec == (time_t)-1 && PyErr_Occurred()) { + return -1; + } + return 0; + } +} + +int +_PyTime_ObjectToTime_t(PyObject *obj, time_t *sec, _PyTime_round_t round) +{ + if (PyFloat_Check(obj)) { + double intpart; + /* volatile avoids optimization changing how numbers are rounded */ + volatile double d; + + d = PyFloat_AsDouble(obj); + if (Py_IS_NAN(d)) { + PyErr_SetString(PyExc_ValueError, "Invalid value NaN (not a number)"); + return -1; + } + + d = _PyTime_Round(d, round); + (void)modf(d, &intpart); + + if (!_Py_InIntegralTypeRange(time_t, intpart)) { + error_time_t_overflow(); + return -1; + } + *sec = (time_t)intpart; + return 0; + } + else { + *sec = _PyLong_AsTime_t(obj); + if (*sec == (time_t)-1 && PyErr_Occurred()) { + return -1; + } + return 0; + } +} + +int +_PyTime_ObjectToTimespec(PyObject *obj, time_t *sec, long *nsec, + _PyTime_round_t round) +{ + return _PyTime_ObjectToDenominator(obj, sec, nsec, SEC_TO_NS, round); +} + +int +_PyTime_ObjectToTimeval(PyObject *obj, time_t *sec, long *usec, + _PyTime_round_t round) +{ + return _PyTime_ObjectToDenominator(obj, sec, usec, SEC_TO_US, round); +} + +_PyTime_t +_PyTime_FromSeconds(int seconds) +{ + _PyTime_t t; + /* ensure that integer overflow cannot happen, int type should have 32 + bits, whereas _PyTime_t type has at least 64 bits (SEC_TO_MS takes 30 + bits). */ + Py_BUILD_ASSERT(INT_MAX <= _PyTime_MAX / SEC_TO_NS); + Py_BUILD_ASSERT(INT_MIN >= _PyTime_MIN / SEC_TO_NS); + + t = (_PyTime_t)seconds; + assert((t >= 0 && t <= _PyTime_MAX / SEC_TO_NS) + || (t < 0 && t >= _PyTime_MIN / SEC_TO_NS)); + t *= SEC_TO_NS; + return t; +} + +_PyTime_t +_PyTime_FromNanoseconds(_PyTime_t ns) +{ + /* _PyTime_t already uses nanosecond resolution, no conversion needed */ + return ns; +} + +int +_PyTime_FromNanosecondsObject(_PyTime_t *tp, PyObject *obj) +{ + long long nsec; + _PyTime_t t; + + if (!PyLong_Check(obj)) { + PyErr_Format(PyExc_TypeError, "expect int, got %s", + Py_TYPE(obj)->tp_name); + return -1; + } + + Py_BUILD_ASSERT(sizeof(long long) == sizeof(_PyTime_t)); + nsec = PyLong_AsLongLong(obj); + if (nsec == -1 && PyErr_Occurred()) { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) { + _PyTime_overflow(); + } + return -1; + } + + /* _PyTime_t already uses nanosecond resolution, no conversion needed */ + t = (_PyTime_t)nsec; + *tp = t; + return 0; +} + +#ifdef HAVE_CLOCK_GETTIME +static int +pytime_fromtimespec(_PyTime_t *tp, struct timespec *ts, int raise) +{ + _PyTime_t t, nsec; + int res = 0; + + Py_BUILD_ASSERT(sizeof(ts->tv_sec) <= sizeof(_PyTime_t)); + t = (_PyTime_t)ts->tv_sec; + + if (_PyTime_check_mul_overflow(t, SEC_TO_NS)) { + if (raise) { + _PyTime_overflow(); + } + res = -1; + t = (t > 0) ? _PyTime_MAX : _PyTime_MIN; + } + else { + t = t * SEC_TO_NS; + } + + nsec = ts->tv_nsec; + /* The following test is written for positive only nsec */ + assert(nsec >= 0); + if (t > _PyTime_MAX - nsec) { + if (raise) { + _PyTime_overflow(); + } + res = -1; + t = _PyTime_MAX; + } + else { + t += nsec; + } + + *tp = t; + return res; +} + +int +_PyTime_FromTimespec(_PyTime_t *tp, struct timespec *ts) +{ + return pytime_fromtimespec(tp, ts, 1); +} +#endif + +#if !defined(MS_WINDOWS) +static int +pytime_fromtimeval(_PyTime_t *tp, struct timeval *tv, int raise) +{ + _PyTime_t t, usec; + int res = 0; + + Py_BUILD_ASSERT(sizeof(tv->tv_sec) <= sizeof(_PyTime_t)); + t = (_PyTime_t)tv->tv_sec; + + if (_PyTime_check_mul_overflow(t, SEC_TO_NS)) { + if (raise) { + _PyTime_overflow(); + } + res = -1; + t = (t > 0) ? _PyTime_MAX : _PyTime_MIN; + } + else { + t = t * SEC_TO_NS; + } + + usec = (_PyTime_t)tv->tv_usec * US_TO_NS; + /* The following test is written for positive only usec */ + assert(usec >= 0); + if (t > _PyTime_MAX - usec) { + if (raise) { + _PyTime_overflow(); + } + res = -1; + t = _PyTime_MAX; + } + else { + t += usec; + } + + *tp = t; + return res; +} + +int +_PyTime_FromTimeval(_PyTime_t *tp, struct timeval *tv) +{ + return pytime_fromtimeval(tp, tv, 1); +} +#endif + +static int +_PyTime_FromDouble(_PyTime_t *t, double value, _PyTime_round_t round, + long unit_to_ns) +{ + /* volatile avoids optimization changing how numbers are rounded */ + volatile double d; + + /* convert to a number of nanoseconds */ + d = value; + d *= (double)unit_to_ns; + d = _PyTime_Round(d, round); + + if (!_Py_InIntegralTypeRange(_PyTime_t, d)) { + _PyTime_overflow(); + return -1; + } + *t = (_PyTime_t)d; + return 0; +} + +static int +_PyTime_FromObject(_PyTime_t *t, PyObject *obj, _PyTime_round_t round, + long unit_to_ns) +{ + if (PyFloat_Check(obj)) { + double d; + d = PyFloat_AsDouble(obj); + if (Py_IS_NAN(d)) { + PyErr_SetString(PyExc_ValueError, "Invalid value NaN (not a number)"); + return -1; + } + return _PyTime_FromDouble(t, d, round, unit_to_ns); + } + else { + long long sec; + Py_BUILD_ASSERT(sizeof(long long) <= sizeof(_PyTime_t)); + + sec = PyLong_AsLongLong(obj); + if (sec == -1 && PyErr_Occurred()) { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) { + _PyTime_overflow(); + } + return -1; + } + + if (_PyTime_check_mul_overflow(sec, unit_to_ns)) { + _PyTime_overflow(); + return -1; + } + *t = sec * unit_to_ns; + return 0; + } +} + +int +_PyTime_FromSecondsObject(_PyTime_t *t, PyObject *obj, _PyTime_round_t round) +{ + return _PyTime_FromObject(t, obj, round, SEC_TO_NS); +} + +int +_PyTime_FromMillisecondsObject(_PyTime_t *t, PyObject *obj, _PyTime_round_t round) +{ + return _PyTime_FromObject(t, obj, round, MS_TO_NS); +} + +double +_PyTime_AsSecondsDouble(_PyTime_t t) +{ + /* volatile avoids optimization changing how numbers are rounded */ + volatile double d; + + if (t % SEC_TO_NS == 0) { + _PyTime_t secs; + /* Divide using integers to avoid rounding issues on the integer part. + 1e-9 cannot be stored exactly in IEEE 64-bit. */ + secs = t / SEC_TO_NS; + d = (double)secs; + } + else { + d = (double)t; + d /= 1e9; + } + return d; +} + +PyObject * +_PyTime_AsNanosecondsObject(_PyTime_t t) +{ + Py_BUILD_ASSERT(sizeof(long long) >= sizeof(_PyTime_t)); + return PyLong_FromLongLong((long long)t); +} + +static _PyTime_t +_PyTime_Divide(const _PyTime_t t, const _PyTime_t k, + const _PyTime_round_t round) +{ + assert(k > 1); + if (round == _PyTime_ROUND_HALF_EVEN) { + _PyTime_t x, r, abs_r; + x = t / k; + r = t % k; + abs_r = Py_ABS(r); + if (abs_r > k / 2 || (abs_r == k / 2 && (Py_ABS(x) & 1))) { + if (t >= 0) { + x++; + } + else { + x--; + } + } + return x; + } + else if (round == _PyTime_ROUND_CEILING) { + if (t >= 0) { + return (t + k - 1) / k; + } + else { + return t / k; + } + } + else if (round == _PyTime_ROUND_FLOOR){ + if (t >= 0) { + return t / k; + } + else { + return (t - (k - 1)) / k; + } + } + else { + assert(round == _PyTime_ROUND_UP); + if (t >= 0) { + return (t + k - 1) / k; + } + else { + return (t - (k - 1)) / k; + } + } +} + +_PyTime_t +_PyTime_AsMilliseconds(_PyTime_t t, _PyTime_round_t round) +{ + return _PyTime_Divide(t, NS_TO_MS, round); +} + +_PyTime_t +_PyTime_AsMicroseconds(_PyTime_t t, _PyTime_round_t round) +{ + return _PyTime_Divide(t, NS_TO_US, round); +} + +static int +_PyTime_AsTimeval_impl(_PyTime_t t, _PyTime_t *p_secs, int *p_us, + _PyTime_round_t round) +{ + _PyTime_t secs, ns; + int usec; + int res = 0; + + secs = t / SEC_TO_NS; + ns = t % SEC_TO_NS; + + usec = (int)_PyTime_Divide(ns, US_TO_NS, round); + if (usec < 0) { + usec += SEC_TO_US; + if (secs != _PyTime_MIN) { + secs -= 1; + } + else { + res = -1; + } + } + else if (usec >= SEC_TO_US) { + usec -= SEC_TO_US; + if (secs != _PyTime_MAX) { + secs += 1; + } + else { + res = -1; + } + } + assert(0 <= usec && usec < SEC_TO_US); + + *p_secs = secs; + *p_us = usec; + + return res; +} + +static int +_PyTime_AsTimevalStruct_impl(_PyTime_t t, struct timeval *tv, + _PyTime_round_t round, int raise) +{ + _PyTime_t secs, secs2; + int us; + int res; + + res = _PyTime_AsTimeval_impl(t, &secs, &us, round); + +#ifdef MS_WINDOWS + tv->tv_sec = (long)secs; +#else + tv->tv_sec = secs; +#endif + tv->tv_usec = us; + + secs2 = (_PyTime_t)tv->tv_sec; + if (res < 0 || secs2 != secs) { + if (raise) { + error_time_t_overflow(); + } + return -1; + } + return 0; +} + +int +_PyTime_AsTimeval(_PyTime_t t, struct timeval *tv, _PyTime_round_t round) +{ + return _PyTime_AsTimevalStruct_impl(t, tv, round, 1); +} + +int +_PyTime_AsTimeval_noraise(_PyTime_t t, struct timeval *tv, _PyTime_round_t round) +{ + return _PyTime_AsTimevalStruct_impl(t, tv, round, 0); +} + +int +_PyTime_AsTimevalTime_t(_PyTime_t t, time_t *p_secs, int *us, + _PyTime_round_t round) +{ + _PyTime_t secs; + int res; + + res = _PyTime_AsTimeval_impl(t, &secs, us, round); + + *p_secs = secs; + + if (res < 0 || (_PyTime_t)*p_secs != secs) { + error_time_t_overflow(); + return -1; + } + return 0; +} + + +#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_KQUEUE) +int +_PyTime_AsTimespec(_PyTime_t t, struct timespec *ts) +{ + _PyTime_t secs, nsec; + + secs = t / SEC_TO_NS; + nsec = t % SEC_TO_NS; + if (nsec < 0) { + nsec += SEC_TO_NS; + secs -= 1; + } + ts->tv_sec = (time_t)secs; + assert(0 <= nsec && nsec < SEC_TO_NS); + ts->tv_nsec = nsec; + + if ((_PyTime_t)ts->tv_sec != secs) { + error_time_t_overflow(); + return -1; + } + return 0; +} +#endif + +static int +pygettimeofday(_PyTime_t *tp, _Py_clock_info_t *info, int raise) +{ +#ifdef MS_WINDOWS + FILETIME system_time; + ULARGE_INTEGER large; + + assert(info == NULL || raise); + + GetSystemTimeAsFileTime(&system_time); + large.u.LowPart = system_time.dwLowDateTime; + large.u.HighPart = system_time.dwHighDateTime; + /* 11,644,473,600,000,000,000: number of nanoseconds between + the 1st january 1601 and the 1st january 1970 (369 years + 89 leap + days). */ + *tp = large.QuadPart * 100 - 11644473600000000000; + if (info) { + DWORD timeAdjustment, timeIncrement; + BOOL isTimeAdjustmentDisabled, ok; + + info->implementation = "GetSystemTimeAsFileTime()"; + info->monotonic = 0; + ok = GetSystemTimeAdjustment(&timeAdjustment, &timeIncrement, + &isTimeAdjustmentDisabled); + if (!ok) { + PyErr_SetFromWindowsErr(0); + return -1; + } + info->resolution = timeIncrement * 1e-7; + info->adjustable = 1; + } + +#else /* MS_WINDOWS */ + int err; +#ifdef HAVE_CLOCK_GETTIME + struct timespec ts; +#else + struct timeval tv; +#endif + + assert(info == NULL || raise); + +#ifdef HAVE_CLOCK_GETTIME + err = clock_gettime(CLOCK_REALTIME, &ts); + if (err) { + if (raise) { + PyErr_SetFromErrno(PyExc_OSError); + } + return -1; + } + if (pytime_fromtimespec(tp, &ts, raise) < 0) { + return -1; + } + + if (info) { + struct timespec res; + info->implementation = "clock_gettime(CLOCK_REALTIME)"; + info->monotonic = 0; + info->adjustable = 1; + if (clock_getres(CLOCK_REALTIME, &res) == 0) { + info->resolution = res.tv_sec + res.tv_nsec * 1e-9; + } + else { + info->resolution = 1e-9; + } + } +#else /* HAVE_CLOCK_GETTIME */ + + /* test gettimeofday() */ +#ifdef GETTIMEOFDAY_NO_TZ + err = gettimeofday(&tv); +#else + err = gettimeofday(&tv, (struct timezone *)NULL); +#endif + if (err) { + if (raise) { + PyErr_SetFromErrno(PyExc_OSError); + } + return -1; + } + if (pytime_fromtimeval(tp, &tv, raise) < 0) { + return -1; + } + + if (info) { + info->implementation = "gettimeofday()"; + info->resolution = 1e-6; + info->monotonic = 0; + info->adjustable = 1; + } +#endif /* !HAVE_CLOCK_GETTIME */ +#endif /* !MS_WINDOWS */ + return 0; +} + +_PyTime_t +_PyTime_GetSystemClock(void) +{ + _PyTime_t t; + if (pygettimeofday(&t, NULL, 0) < 0) { + /* should not happen, _PyTime_Init() checked the clock at startup */ + Py_UNREACHABLE(); + } + return t; +} + +int +_PyTime_GetSystemClockWithInfo(_PyTime_t *t, _Py_clock_info_t *info) +{ + return pygettimeofday(t, info, 1); +} + +static int +pymonotonic(_PyTime_t *tp, _Py_clock_info_t *info, int raise) +{ +#if defined(MS_WINDOWS) + ULONGLONG ticks; + _PyTime_t t; + + assert(info == NULL || raise); + + ticks = GetTickCount64(); + Py_BUILD_ASSERT(sizeof(ticks) <= sizeof(_PyTime_t)); + t = (_PyTime_t)ticks; + + if (_PyTime_check_mul_overflow(t, MS_TO_NS)) { + if (raise) { + _PyTime_overflow(); + return -1; + } + /* Hello, time traveler! */ + Py_UNREACHABLE(); + } + *tp = t * MS_TO_NS; + + if (info) { + DWORD timeAdjustment, timeIncrement; + BOOL isTimeAdjustmentDisabled, ok; + info->implementation = "GetTickCount64()"; + info->monotonic = 1; + ok = GetSystemTimeAdjustment(&timeAdjustment, &timeIncrement, + &isTimeAdjustmentDisabled); + if (!ok) { + PyErr_SetFromWindowsErr(0); + return -1; + } + info->resolution = timeIncrement * 1e-7; + info->adjustable = 0; + } + +#elif defined(__APPLE__) + static mach_timebase_info_data_t timebase; + static uint64_t t0 = 0; + uint64_t ticks; + + if (timebase.denom == 0) { + /* According to the Technical Q&A QA1398, mach_timebase_info() cannot + fail: https://developer.apple.com/library/mac/#qa/qa1398/ */ + (void)mach_timebase_info(&timebase); + + /* Sanity check: should never occur in practice */ + if (timebase.numer < 1 || timebase.denom < 1) { + PyErr_SetString(PyExc_RuntimeError, + "invalid mach_timebase_info"); + return -1; + } + + /* Check that timebase.numer and timebase.denom can be casted to + _PyTime_t. In practice, timebase uses uint32_t, so casting cannot + overflow. At the end, only make sure that the type is uint32_t + (_PyTime_t is 64-bit long). */ + assert(sizeof(timebase.numer) < sizeof(_PyTime_t)); + assert(sizeof(timebase.denom) < sizeof(_PyTime_t)); + + /* Make sure that (ticks * timebase.numer) cannot overflow in + _PyTime_MulDiv(), with ticks < timebase.denom. + + Known time bases: + + * always (1, 1) on Intel + * (1000000000, 33333335) or (1000000000, 25000000) on PowerPC + + None of these time bases can overflow with 64-bit _PyTime_t, but + check for overflow, just in case. */ + if ((_PyTime_t)timebase.numer > _PyTime_MAX / (_PyTime_t)timebase.denom) { + PyErr_SetString(PyExc_OverflowError, + "mach_timebase_info is too large"); + return -1; + } + + t0 = mach_absolute_time(); + } + + if (info) { + info->implementation = "mach_absolute_time()"; + info->resolution = (double)timebase.numer / (double)timebase.denom * 1e-9; + info->monotonic = 1; + info->adjustable = 0; + } + + ticks = mach_absolute_time(); + /* Use a "time zero" to reduce precision loss when converting time + to floatting point number, as in time.monotonic(). */ + ticks -= t0; + *tp = _PyTime_MulDiv(ticks, + (_PyTime_t)timebase.numer, + (_PyTime_t)timebase.denom); + +#elif defined(__hpux) + hrtime_t time; + + time = gethrtime(); + if (time == -1) { + if (raise) { + PyErr_SetFromErrno(PyExc_OSError); + } + return -1; + } + + *tp = time; + + if (info) { + info->implementation = "gethrtime()"; + info->resolution = 1e-9; + info->monotonic = 1; + info->adjustable = 0; + } + +#else + struct timespec ts; +#ifdef CLOCK_HIGHRES + const clockid_t clk_id = CLOCK_HIGHRES; + const char *implementation = "clock_gettime(CLOCK_HIGHRES)"; +#else + const clockid_t clk_id = CLOCK_MONOTONIC; + const char *implementation = "clock_gettime(CLOCK_MONOTONIC)"; +#endif + + assert(info == NULL || raise); + + if (clock_gettime(clk_id, &ts) != 0) { + if (raise) { + PyErr_SetFromErrno(PyExc_OSError); + return -1; + } + return -1; + } + + if (info) { + struct timespec res; + info->monotonic = 1; + info->implementation = implementation; + info->adjustable = 0; + if (clock_getres(clk_id, &res) != 0) { + PyErr_SetFromErrno(PyExc_OSError); + return -1; + } + info->resolution = res.tv_sec + res.tv_nsec * 1e-9; + } + if (pytime_fromtimespec(tp, &ts, raise) < 0) { + return -1; + } +#endif + return 0; +} + +_PyTime_t +_PyTime_GetMonotonicClock(void) +{ + _PyTime_t t; + if (pymonotonic(&t, NULL, 0) < 0) { + /* should not happen, _PyTime_Init() checked that monotonic clock at + startup */ + Py_UNREACHABLE(); + } + return t; +} + +int +_PyTime_GetMonotonicClockWithInfo(_PyTime_t *tp, _Py_clock_info_t *info) +{ + return pymonotonic(tp, info, 1); +} + + +#ifdef MS_WINDOWS +static int +win_perf_counter(_PyTime_t *tp, _Py_clock_info_t *info) +{ + static LONGLONG frequency = 0; + static LONGLONG t0 = 0; + LARGE_INTEGER now; + LONGLONG ticksll; + _PyTime_t ticks; + + if (frequency == 0) { + LARGE_INTEGER freq; + if (!QueryPerformanceFrequency(&freq)) { + PyErr_SetFromWindowsErr(0); + return -1; + } + frequency = freq.QuadPart; + + /* Sanity check: should never occur in practice */ + if (frequency < 1) { + PyErr_SetString(PyExc_RuntimeError, + "invalid QueryPerformanceFrequency"); + return -1; + } + + /* Check that frequency can be casted to _PyTime_t. + + Make also sure that (ticks * SEC_TO_NS) cannot overflow in + _PyTime_MulDiv(), with ticks < frequency. + + Known QueryPerformanceFrequency() values: + + * 10,000,000 (10 MHz): 100 ns resolution + * 3,579,545 Hz (3.6 MHz): 279 ns resolution + + None of these frequencies can overflow with 64-bit _PyTime_t, but + check for overflow, just in case. */ + if (frequency > _PyTime_MAX + || frequency > (LONGLONG)_PyTime_MAX / (LONGLONG)SEC_TO_NS) { + PyErr_SetString(PyExc_OverflowError, + "QueryPerformanceFrequency is too large"); + return -1; + } + + QueryPerformanceCounter(&now); + t0 = now.QuadPart; + } + + if (info) { + info->implementation = "QueryPerformanceCounter()"; + info->resolution = 1.0 / (double)frequency; + info->monotonic = 1; + info->adjustable = 0; + } + + QueryPerformanceCounter(&now); + ticksll = now.QuadPart; + + /* Use a "time zero" to reduce precision loss when converting time + to floatting point number, as in time.perf_counter(). */ + ticksll -= t0; + + /* Make sure that casting LONGLONG to _PyTime_t cannot overflow, + both types are signed */ + Py_BUILD_ASSERT(sizeof(ticksll) <= sizeof(ticks)); + ticks = (_PyTime_t)ticksll; + + *tp = _PyTime_MulDiv(ticks, SEC_TO_NS, (_PyTime_t)frequency); + return 0; +} +#endif + + +int +_PyTime_GetPerfCounterWithInfo(_PyTime_t *t, _Py_clock_info_t *info) +{ +#ifdef MS_WINDOWS + return win_perf_counter(t, info); +#else + return _PyTime_GetMonotonicClockWithInfo(t, info); +#endif +} + + +_PyTime_t +_PyTime_GetPerfCounter(void) +{ + _PyTime_t t; + if (_PyTime_GetPerfCounterWithInfo(&t, NULL)) { + Py_UNREACHABLE(); + } + return t; +} + + +int +_PyTime_Init(void) +{ + /* check that time.time(), time.monotonic() and time.perf_counter() clocks + are working properly to not have to check for exceptions at runtime. If + a clock works once, it cannot fail in next calls. */ + _PyTime_t t; + if (_PyTime_GetSystemClockWithInfo(&t, NULL) < 0) { + return -1; + } + if (_PyTime_GetMonotonicClockWithInfo(&t, NULL) < 0) { + return -1; + } + if (_PyTime_GetPerfCounterWithInfo(&t, NULL) < 0) { + return -1; + } + return 0; +} + +int +_PyTime_localtime(time_t t, struct tm *tm) +{ +#ifdef MS_WINDOWS + int error; + + error = localtime_s(tm, &t); + if (error != 0) { + errno = error; + PyErr_SetFromErrno(PyExc_OSError); + return -1; + } + return 0; +#else /* !MS_WINDOWS */ + +#ifdef _AIX + /* bpo-34373: AIX does not return NULL if t is too small or too large */ + if (t < -2145916800 /* 1902-01-01 */ + || t > 2145916800 /* 2038-01-01 */) { + errno = EINVAL; + PyErr_SetString(PyExc_OverflowError, + "localtime argument out of range"); + return -1; + } +#endif + + errno = 0; + if (localtime_r(&t, tm) == NULL) { + if (errno == 0) { + errno = EINVAL; + } + PyErr_SetFromErrno(PyExc_OSError); + return -1; + } + return 0; +#endif /* MS_WINDOWS */ +} + +int +_PyTime_gmtime(time_t t, struct tm *tm) +{ +#ifdef MS_WINDOWS + int error; + + error = gmtime_s(tm, &t); + if (error != 0) { + errno = error; + PyErr_SetFromErrno(PyExc_OSError); + return -1; + } + return 0; +#else /* !MS_WINDOWS */ + if (gmtime_r(&t, tm) == NULL) { +#ifdef EINVAL + if (errno == 0) { + errno = EINVAL; + } +#endif + PyErr_SetFromErrno(PyExc_OSError); + return -1; + } + return 0; +#endif /* MS_WINDOWS */ +} diff --git a/src/python/README b/src/python/README index 73969b6b4..0cfb8e210 100644 --- a/src/python/README +++ b/src/python/README @@ -14,6 +14,12 @@ to apply to our Python sources tree, then issue something like: cd Python-2.7.18 patch -p1 < ~/Downloads/CVE-2020-10735.diff +Python sources are currently patched from upstream Active State branch up to and +including fixes from Aug 22, 2024 for ActiveState Python version 2.7.18.10. + +Patches that can be applied on Windows as hot fixes (see below for more details) +are saved as diff files in the current directory. They are also applied on +non-Windows platforms before building Python. Building Python on Windows diff --git a/src/sqlite/SQLite-3.43.1/INSTALL b/src/sqlite/SQLite-3.46.0/INSTALL similarity index 100% rename from src/sqlite/SQLite-3.43.1/INSTALL rename to src/sqlite/SQLite-3.46.0/INSTALL diff --git a/src/sqlite/SQLite-3.43.1/Makefile.am b/src/sqlite/SQLite-3.46.0/Makefile.am similarity index 100% rename from src/sqlite/SQLite-3.43.1/Makefile.am rename to src/sqlite/SQLite-3.46.0/Makefile.am diff --git a/src/sqlite/SQLite-3.43.1/Makefile.fallback b/src/sqlite/SQLite-3.46.0/Makefile.fallback similarity index 100% rename from src/sqlite/SQLite-3.43.1/Makefile.fallback rename to src/sqlite/SQLite-3.46.0/Makefile.fallback diff --git a/src/sqlite/SQLite-3.43.1/Makefile.in b/src/sqlite/SQLite-3.46.0/Makefile.in similarity index 100% rename from src/sqlite/SQLite-3.43.1/Makefile.in rename to src/sqlite/SQLite-3.46.0/Makefile.in diff --git a/src/sqlite/SQLite-3.43.1/Makefile.msc b/src/sqlite/SQLite-3.46.0/Makefile.msc similarity index 97% rename from src/sqlite/SQLite-3.43.1/Makefile.msc rename to src/sqlite/SQLite-3.46.0/Makefile.msc index 13663d877..a4270fb2a 100644 --- a/src/sqlite/SQLite-3.43.1/Makefile.msc +++ b/src/sqlite/SQLite-3.46.0/Makefile.msc @@ -18,6 +18,13 @@ TOP = . +# Optionally set EXTRA_SRC to a list of C files to append to +# the generated sqlite3.c. +# +!IFNDEF EXTRA_SRC +EXTRA_SRC = +!ENDIF + # Set this non-0 to enable full warnings (-W4, etc) when compiling. # !IFNDEF USE_FULLWARN @@ -52,8 +59,8 @@ MINIMAL_AMALGAMATION = 0 USE_STDCALL = 0 !ENDIF -# Set this non-0 to use structured exception handling (SEH) for WAL mode -# in the core library. +# Use the USE_SEH=0 option on the nmake command line to omit structured +# exception handling (SEH) support. SEH is on by default. # !IFNDEF USE_SEH USE_SEH = 1 @@ -296,6 +303,7 @@ SQLITE3EXEPDB = /pdb:sqlite3sh.pdb !IFNDEF OPT_FEATURE_FLAGS !IF $(MINIMAL_AMALGAMATION)==0 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS3=1 +OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_FTS5=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RTREE=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_GEOPOLY=1 OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_STMTVTAB=1 @@ -325,10 +333,11 @@ OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_ENABLE_RBU=1 !ENDIF # Should structured exception handling (SEH) be enabled for WAL mode in -# the core library? +# the core library? It is on by default. Only omit it if the +# USE_SEH=0 option is provided on the nmake command-line. # -!IF $(USE_SEH)!=0 -OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_USE_SEH=1 +!IF $(USE_SEH)==0 +OPT_FEATURE_FLAGS = $(OPT_FEATURE_FLAGS) -DSQLITE_OMIT_SEH=1 !ENDIF # These are the "extended" SQLite compilation options used when compiling for @@ -986,6 +995,9 @@ SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_DQS=0 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_FTS4=1 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_EXPLAIN_COMMENTS=1 SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_OFFSET_SQL_FUNC=1 +SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION=1 +SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_ENABLE_STMT_SCANSTATUS=1 +SHELL_COMPILE_OPTS = $(SHELL_COMPILE_OPTS) -DSQLITE_STRICT_SUBTYPE=1 !ENDIF diff --git a/src/sqlite/SQLite-3.43.1/README.txt b/src/sqlite/SQLite-3.46.0/README.txt similarity index 100% rename from src/sqlite/SQLite-3.43.1/README.txt rename to src/sqlite/SQLite-3.46.0/README.txt diff --git a/src/sqlite/SQLite-3.43.1/Replace.cs b/src/sqlite/SQLite-3.46.0/Replace.cs similarity index 100% rename from src/sqlite/SQLite-3.43.1/Replace.cs rename to src/sqlite/SQLite-3.46.0/Replace.cs diff --git a/src/sqlite/SQLite-3.43.1/aclocal.m4 b/src/sqlite/SQLite-3.46.0/aclocal.m4 similarity index 100% rename from src/sqlite/SQLite-3.43.1/aclocal.m4 rename to src/sqlite/SQLite-3.46.0/aclocal.m4 diff --git a/src/sqlite/SQLite-3.43.1/compile b/src/sqlite/SQLite-3.46.0/compile similarity index 100% rename from src/sqlite/SQLite-3.43.1/compile rename to src/sqlite/SQLite-3.46.0/compile diff --git a/src/sqlite/SQLite-3.43.1/config.guess b/src/sqlite/SQLite-3.46.0/config.guess similarity index 100% rename from src/sqlite/SQLite-3.43.1/config.guess rename to src/sqlite/SQLite-3.46.0/config.guess diff --git a/src/libffi/libffi-3.4.4/config.sub b/src/sqlite/SQLite-3.46.0/config.sub old mode 100644 new mode 100755 similarity index 100% rename from src/libffi/libffi-3.4.4/config.sub rename to src/sqlite/SQLite-3.46.0/config.sub diff --git a/src/sqlite/SQLite-3.43.1/configure b/src/sqlite/SQLite-3.46.0/configure similarity index 99% rename from src/sqlite/SQLite-3.43.1/configure rename to src/sqlite/SQLite-3.46.0/configure index 39694c067..f2f70b5ae 100755 --- a/src/sqlite/SQLite-3.43.1/configure +++ b/src/sqlite/SQLite-3.46.0/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for sqlite 3.43.1. +# Generated by GNU Autoconf 2.71 for sqlite 3.46.0. # # Report bugs to . # @@ -621,8 +621,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.43.1' -PACKAGE_STRING='sqlite 3.43.1' +PACKAGE_VERSION='3.46.0' +PACKAGE_STRING='sqlite 3.46.0' PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_URL='' @@ -1367,7 +1367,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.43.1 to adapt to many kinds of systems. +\`configure' configures sqlite 3.46.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1438,7 +1438,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.43.1:";; + short | recursive ) echo "Configuration of sqlite 3.46.0:";; esac cat <<\_ACEOF @@ -1563,7 +1563,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.43.1 +sqlite configure 3.46.0 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1833,7 +1833,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.43.1, which was +It was created by sqlite $as_me 3.46.0, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3106,7 +3106,7 @@ fi # Define the identity of the package. PACKAGE='sqlite' - VERSION='3.43.1' + VERSION='3.46.0' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -15314,7 +15314,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.43.1, which was +This file was extended by sqlite $as_me 3.46.0, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15373,7 +15373,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -sqlite config.status 3.43.1 +sqlite config.status 3.46.0 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/src/sqlite/SQLite-3.43.1/configure.ac b/src/sqlite/SQLite-3.46.0/configure.ac similarity index 99% rename from src/sqlite/SQLite-3.43.1/configure.ac rename to src/sqlite/SQLite-3.46.0/configure.ac index 3d7da8b98..c83f381d9 100644 --- a/src/sqlite/SQLite-3.43.1/configure.ac +++ b/src/sqlite/SQLite-3.46.0/configure.ac @@ -10,7 +10,7 @@ # AC_PREREQ(2.61) -AC_INIT(sqlite, 3.43.1, http://www.sqlite.org) +AC_INIT(sqlite, 3.46.0, http://www.sqlite.org) AC_CONFIG_SRCDIR([sqlite3.c]) AC_CONFIG_AUX_DIR([.]) diff --git a/src/sqlite/SQLite-3.43.1/depcomp b/src/sqlite/SQLite-3.46.0/depcomp similarity index 100% rename from src/sqlite/SQLite-3.43.1/depcomp rename to src/sqlite/SQLite-3.46.0/depcomp diff --git a/src/sqlite/SQLite-3.43.1/install-sh b/src/sqlite/SQLite-3.46.0/install-sh similarity index 100% rename from src/sqlite/SQLite-3.43.1/install-sh rename to src/sqlite/SQLite-3.46.0/install-sh diff --git a/src/sqlite/SQLite-3.43.1/ltmain.sh b/src/sqlite/SQLite-3.46.0/ltmain.sh similarity index 100% rename from src/sqlite/SQLite-3.43.1/ltmain.sh rename to src/sqlite/SQLite-3.46.0/ltmain.sh diff --git a/src/sqlite/SQLite-3.43.1/missing b/src/sqlite/SQLite-3.46.0/missing similarity index 100% rename from src/sqlite/SQLite-3.43.1/missing rename to src/sqlite/SQLite-3.46.0/missing diff --git a/src/sqlite/SQLite-3.43.1/shell.c b/src/sqlite/SQLite-3.46.0/shell.c similarity index 86% rename from src/sqlite/SQLite-3.43.1/shell.c rename to src/sqlite/SQLite-3.46.0/shell.c index 6b2cdca83..7d46e4aca 100644 --- a/src/sqlite/SQLite-3.43.1/shell.c +++ b/src/sqlite/SQLite-3.46.0/shell.c @@ -252,476 +252,967 @@ typedef unsigned char u8; /* string conversion routines only needed on Win32 */ extern char *sqlite3_win32_unicode_to_utf8(LPCWSTR); -extern char *sqlite3_win32_mbcs_to_utf8_v2(const char *, int); -extern char *sqlite3_win32_utf8_to_mbcs_v2(const char *, int); extern LPWSTR sqlite3_win32_utf8_to_unicode(const char *zText); #endif -/* On Windows, we normally run with output mode of TEXT so that \n characters -** are automatically translated into \r\n. However, this behavior needs -** to be disabled in some cases (ex: when generating CSV output and when -** rendering quoted strings that contain \n characters). The following -** routines take care of that. -*/ -#if (defined(_WIN32) || defined(WIN32)) && !SQLITE_OS_WINRT -static void setBinaryMode(FILE *file, int isOutput){ - if( isOutput ) fflush(file); - _setmode(_fileno(file), _O_BINARY); -} -static void setTextMode(FILE *file, int isOutput){ - if( isOutput ) fflush(file); - _setmode(_fileno(file), _O_TEXT); -} +/* Use console I/O package as a direct INCLUDE. */ +#define SQLITE_INTERNAL_LINKAGE static + +#ifdef SQLITE_SHELL_FIDDLE +/* Deselect most features from the console I/O package for Fiddle. */ +# define SQLITE_CIO_NO_REDIRECT +# define SQLITE_CIO_NO_CLASSIFY +# define SQLITE_CIO_NO_TRANSLATE +# define SQLITE_CIO_NO_SETMODE +#endif +/************************* Begin ../ext/consio/console_io.h ******************/ +/* +** 2023 November 1 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +******************************************************************************** +** This file exposes various interfaces used for console and other I/O +** by the SQLite project command-line tools. These interfaces are used +** at either source conglomeration time, compilation time, or run time. +** This source provides for either inclusion into conglomerated, +** "single-source" forms or separate compilation then linking. +** +** Platform dependencies are "hidden" here by various stratagems so +** that, provided certain conditions are met, the programs using this +** source or object code compiled from it need no explicit conditional +** compilation in their source for their console and stream I/O. +** +** The symbols and functionality exposed here are not a public API. +** This code may change in tandem with other project code as needed. +** +** When this .h file and its companion .c are directly incorporated into +** a source conglomeration (such as shell.c), the preprocessor symbol +** CIO_WIN_WC_XLATE is defined as 0 or 1, reflecting whether console I/O +** translation for Windows is effected for the build. +*/ +#define HAVE_CONSOLE_IO_H 1 +#ifndef SQLITE_INTERNAL_LINKAGE +# define SQLITE_INTERNAL_LINKAGE extern /* external to translation unit */ +# include #else -# define setBinaryMode(X,Y) -# define setTextMode(X,Y) +# define SHELL_NO_SYSINC /* Better yet, modify mkshellc.tcl for this. */ #endif -/* True if the timer is enabled */ -static int enableTimer = 0; - -/* A version of strcmp() that works with NULL values */ -static int cli_strcmp(const char *a, const char *b){ - if( a==0 ) a = ""; - if( b==0 ) b = ""; - return strcmp(a,b); -} -static int cli_strncmp(const char *a, const char *b, size_t n){ - if( a==0 ) a = ""; - if( b==0 ) b = ""; - return strncmp(a,b,n); -} - -/* Return the current wall-clock time */ -static sqlite3_int64 timeOfDay(void){ - static sqlite3_vfs *clockVfs = 0; - sqlite3_int64 t; - if( clockVfs==0 ) clockVfs = sqlite3_vfs_find(0); - if( clockVfs==0 ) return 0; /* Never actually happens */ - if( clockVfs->iVersion>=2 && clockVfs->xCurrentTimeInt64!=0 ){ - clockVfs->xCurrentTimeInt64(clockVfs, &t); - }else{ - double r; - clockVfs->xCurrentTime(clockVfs, &r); - t = (sqlite3_int64)(r*86400000.0); - } - return t; -} - -#if !defined(_WIN32) && !defined(WIN32) && !defined(__minux) -#include -#include - -/* VxWorks does not support getrusage() as far as we can determine */ -#if defined(_WRS_KERNEL) || defined(__RTP__) -struct rusage { - struct timeval ru_utime; /* user CPU time used */ - struct timeval ru_stime; /* system CPU time used */ -}; -#define getrusage(A,B) memset(B,0,sizeof(*B)) +#ifndef SQLITE3_H +/* # include "sqlite3.h" */ #endif -/* Saved resource information for the beginning of an operation */ -static struct rusage sBegin; /* CPU time at start */ -static sqlite3_int64 iBegin; /* Wall-clock time at start */ - -/* -** Begin timing an operation -*/ -static void beginTimer(void){ - if( enableTimer ){ - getrusage(RUSAGE_SELF, &sBegin); - iBegin = timeOfDay(); - } -} +#ifndef SQLITE_CIO_NO_CLASSIFY -/* Return the difference of two time_structs in seconds */ -static double timeDiff(struct timeval *pStart, struct timeval *pEnd){ - return (pEnd->tv_usec - pStart->tv_usec)*0.000001 + - (double)(pEnd->tv_sec - pStart->tv_sec); -} +/* Define enum for use with following function. */ +typedef enum StreamsAreConsole { + SAC_NoConsole = 0, + SAC_InConsole = 1, SAC_OutConsole = 2, SAC_ErrConsole = 4, + SAC_AnyConsole = 0x7 +} StreamsAreConsole; /* -** Print the timing results. +** Classify the three standard I/O streams according to whether +** they are connected to a console attached to the process. +** +** Returns the bit-wise OR of SAC_{In,Out,Err}Console values, +** or SAC_NoConsole if none of the streams reaches a console. +** +** This function should be called before any I/O is done with +** the given streams. As a side-effect, the given inputs are +** recorded so that later I/O operations on them may be done +** differently than the C library FILE* I/O would be done, +** iff the stream is used for the I/O functions that follow, +** and to support the ones that use an implicit stream. +** +** On some platforms, stream or console mode alteration (aka +** "Setup") may be made which is undone by consoleRestore(). */ -static void endTimer(void){ - if( enableTimer ){ - sqlite3_int64 iEnd = timeOfDay(); - struct rusage sEnd; - getrusage(RUSAGE_SELF, &sEnd); - printf("Run Time: real %.3f user %f sys %f\n", - (iEnd - iBegin)*0.001, - timeDiff(&sBegin.ru_utime, &sEnd.ru_utime), - timeDiff(&sBegin.ru_stime, &sEnd.ru_stime)); - } -} - -#define BEGIN_TIMER beginTimer() -#define END_TIMER endTimer() -#define HAS_TIMER 1 - -#elif (defined(_WIN32) || defined(WIN32)) - -/* Saved resource information for the beginning of an operation */ -static HANDLE hProcess; -static FILETIME ftKernelBegin; -static FILETIME ftUserBegin; -static sqlite3_int64 ftWallBegin; -typedef BOOL (WINAPI *GETPROCTIMES)(HANDLE, LPFILETIME, LPFILETIME, - LPFILETIME, LPFILETIME); -static GETPROCTIMES getProcessTimesAddr = NULL; +SQLITE_INTERNAL_LINKAGE StreamsAreConsole +consoleClassifySetup( FILE *pfIn, FILE *pfOut, FILE *pfErr ); +/* A usual call for convenience: */ +#define SQLITE_STD_CONSOLE_INIT() consoleClassifySetup(stdin,stdout,stderr) /* -** Check to see if we have timer support. Return 1 if necessary -** support found (or found previously). +** After an initial call to consoleClassifySetup(...), renew +** the same setup it effected. (A call not after is an error.) +** This will restore state altered by consoleRestore(); +** +** Applications which run an inferior (child) process which +** inherits the same I/O streams may call this function after +** such a process exits to guard against console mode changes. */ -static int hasTimer(void){ - if( getProcessTimesAddr ){ - return 1; - } else { -#if !SQLITE_OS_WINRT - /* GetProcessTimes() isn't supported in WIN95 and some other Windows - ** versions. See if the version we are running on has it, and if it - ** does, save off a pointer to it and the current process handle. - */ - hProcess = GetCurrentProcess(); - if( hProcess ){ - HINSTANCE hinstLib = LoadLibrary(TEXT("Kernel32.dll")); - if( NULL != hinstLib ){ - getProcessTimesAddr = - (GETPROCTIMES) GetProcAddress(hinstLib, "GetProcessTimes"); - if( NULL != getProcessTimesAddr ){ - return 1; - } - FreeLibrary(hinstLib); - } - } -#endif - } - return 0; -} +SQLITE_INTERNAL_LINKAGE void consoleRenewSetup(void); /* -** Begin timing an operation +** Undo any side-effects left by consoleClassifySetup(...). +** +** This should be called after consoleClassifySetup() and +** before the process terminates normally. It is suitable +** for use with the atexit() C library procedure. After +** this call, no console I/O should be done until one of +** console{Classify or Renew}Setup(...) is called again. +** +** Applications which run an inferior (child) process that +** inherits the same I/O streams might call this procedure +** before so that said process will have a console setup +** however users have configured it or come to expect. */ -static void beginTimer(void){ - if( enableTimer && getProcessTimesAddr ){ - FILETIME ftCreation, ftExit; - getProcessTimesAddr(hProcess,&ftCreation,&ftExit, - &ftKernelBegin,&ftUserBegin); - ftWallBegin = timeOfDay(); - } -} +SQLITE_INTERNAL_LINKAGE void SQLITE_CDECL consoleRestore( void ); -/* Return the difference of two FILETIME structs in seconds */ -static double timeDiff(FILETIME *pStart, FILETIME *pEnd){ - sqlite_int64 i64Start = *((sqlite_int64 *) pStart); - sqlite_int64 i64End = *((sqlite_int64 *) pEnd); - return (double) ((i64End - i64Start) / 10000000.0); -} +#else /* defined(SQLITE_CIO_NO_CLASSIFY) */ +# define consoleClassifySetup(i,o,e) +# define consoleRenewSetup() +# define consoleRestore() +#endif /* defined(SQLITE_CIO_NO_CLASSIFY) */ +#ifndef SQLITE_CIO_NO_REDIRECT /* -** Print the timing results. +** Set stream to be used for the functions below which write +** to "the designated X stream", where X is Output or Error. +** Returns the previous value. +** +** Alternatively, pass the special value, invalidFileStream, +** to get the designated stream value without setting it. +** +** Before the designated streams are set, they default to +** those passed to consoleClassifySetup(...), and before +** that is called they default to stdout and stderr. +** +** It is error to close a stream so designated, then, without +** designating another, use the corresponding {o,e}Emit(...). */ -static void endTimer(void){ - if( enableTimer && getProcessTimesAddr){ - FILETIME ftCreation, ftExit, ftKernelEnd, ftUserEnd; - sqlite3_int64 ftWallEnd = timeOfDay(); - getProcessTimesAddr(hProcess,&ftCreation,&ftExit,&ftKernelEnd,&ftUserEnd); - printf("Run Time: real %.3f user %f sys %f\n", - (ftWallEnd - ftWallBegin)*0.001, - timeDiff(&ftUserBegin, &ftUserEnd), - timeDiff(&ftKernelBegin, &ftKernelEnd)); - } -} - -#define BEGIN_TIMER beginTimer() -#define END_TIMER endTimer() -#define HAS_TIMER hasTimer() - +SQLITE_INTERNAL_LINKAGE FILE *invalidFileStream; +SQLITE_INTERNAL_LINKAGE FILE *setOutputStream(FILE *pf); +# ifdef CONSIO_SET_ERROR_STREAM +SQLITE_INTERNAL_LINKAGE FILE *setErrorStream(FILE *pf); +# endif #else -#define BEGIN_TIMER -#define END_TIMER -#define HAS_TIMER 0 -#endif +# define setOutputStream(pf) +# define setErrorStream(pf) +#endif /* !defined(SQLITE_CIO_NO_REDIRECT) */ +#ifndef SQLITE_CIO_NO_TRANSLATE /* -** Used to prevent warnings about unused parameters +** Emit output like fprintf(). If the output is going to the +** console and translation from UTF-8 is necessary, perform +** the needed translation. Otherwise, write formatted output +** to the provided stream almost as-is, possibly with newline +** translation as specified by set{Binary,Text}Mode(). */ -#define UNUSED_PARAMETER(x) (void)(x) +SQLITE_INTERNAL_LINKAGE int fPrintfUtf8(FILE *pfO, const char *zFormat, ...); +/* Like fPrintfUtf8 except stream is always the designated output. */ +SQLITE_INTERNAL_LINKAGE int oPrintfUtf8(const char *zFormat, ...); +/* Like fPrintfUtf8 except stream is always the designated error. */ +SQLITE_INTERNAL_LINKAGE int ePrintfUtf8(const char *zFormat, ...); /* -** Number of elements in an array +** Emit output like fputs(). If the output is going to the +** console and translation from UTF-8 is necessary, perform +** the needed translation. Otherwise, write given text to the +** provided stream almost as-is, possibly with newline +** translation as specified by set{Binary,Text}Mode(). */ -#define ArraySize(X) (int)(sizeof(X)/sizeof(X[0])) +SQLITE_INTERNAL_LINKAGE int fPutsUtf8(const char *z, FILE *pfO); +/* Like fPutsUtf8 except stream is always the designated output. */ +SQLITE_INTERNAL_LINKAGE int oPutsUtf8(const char *z); +/* Like fPutsUtf8 except stream is always the designated error. */ +SQLITE_INTERNAL_LINKAGE int ePutsUtf8(const char *z); /* -** If the following flag is set, then command execution stops -** at an error if we are not interactive. +** Emit output like fPutsUtf8(), except that the length of the +** accepted char or character sequence is limited by nAccept. +** +** Returns the number of accepted char values. */ -static int bail_on_error = 0; +#ifdef CONSIO_SPUTB +SQLITE_INTERNAL_LINKAGE int +fPutbUtf8(FILE *pfOut, const char *cBuf, int nAccept); +/* Like fPutbUtf8 except stream is always the designated output. */ +#endif +SQLITE_INTERNAL_LINKAGE int +oPutbUtf8(const char *cBuf, int nAccept); +/* Like fPutbUtf8 except stream is always the designated error. */ +#ifdef CONSIO_EPUTB +SQLITE_INTERNAL_LINKAGE int +ePutbUtf8(const char *cBuf, int nAccept); +#endif /* -** Treat stdin as an interactive input if the following variable -** is true. Otherwise, assume stdin is connected to a file or pipe. +** Collect input like fgets(...) with special provisions for input +** from the console on platforms that require same. Defers to the +** C library fgets() when input is not from the console. Newline +** translation may be done as set by set{Binary,Text}Mode(). As a +** convenience, pfIn==NULL is treated as stdin. */ -static int stdin_is_interactive = 1; +SQLITE_INTERNAL_LINKAGE char* fGetsUtf8(char *cBuf, int ncMax, FILE *pfIn); +/* Like fGetsUtf8 except stream is always the designated input. */ +/* SQLITE_INTERNAL_LINKAGE char* iGetsUtf8(char *cBuf, int ncMax); */ -#if (defined(_WIN32) || defined(WIN32)) && SHELL_USE_LOCAL_GETLINE \ - && !defined(SHELL_OMIT_WIN_UTF8) -# define SHELL_WIN_UTF8_OPT 1 -#else -# define SHELL_WIN_UTF8_OPT 0 -#endif +#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */ -#if SHELL_WIN_UTF8_OPT +#ifndef SQLITE_CIO_NO_SETMODE /* -** Setup console for UTF-8 input/output when following variable true. +** Set given stream for binary mode, where newline translation is +** not done, or for text mode where, for some platforms, newlines +** are translated to the platform's conventional char sequence. +** If bFlush true, flush the stream. +** +** An additional side-effect is that if the stream is one passed +** to consoleClassifySetup() as an output, it is flushed first. +** +** Note that binary/text mode has no effect on console I/O +** translation. On all platforms, newline to the console starts +** a new line and CR,LF chars from the console become a newline. */ -static int console_utf8 = 0; +SQLITE_INTERNAL_LINKAGE void setBinaryMode(FILE *, short bFlush); +SQLITE_INTERNAL_LINKAGE void setTextMode(FILE *, short bFlush); #endif -/* -** On Windows systems we have to know if standard output is a console -** in order to translate UTF-8 into MBCS. The following variable is -** true if translation is required. -*/ -static int stdout_is_console = 1; +#ifdef SQLITE_CIO_PROMPTED_IN +typedef struct Prompts { + int numPrompts; + const char **azPrompts; +} Prompts; /* -** The following is the open SQLite database. We make a pointer -** to this database a static variable so that it can be accessed -** by the SIGINT handler to interrupt database processing. +** Macros for use of a line editor. +** +** The following macros define operations involving use of a +** line-editing library or simple console interaction. +** A "T" argument is a text (char *) buffer or filename. +** A "N" argument is an integer. +** +** SHELL_ADD_HISTORY(T) // Record text as line(s) of history. +** SHELL_READ_HISTORY(T) // Read history from file named by T. +** SHELL_WRITE_HISTORY(T) // Write history to file named by T. +** SHELL_STIFLE_HISTORY(N) // Limit history to N entries. +** +** A console program which does interactive console input is +** expected to call: +** SHELL_READ_HISTORY(T) before collecting such input; +** SHELL_ADD_HISTORY(T) as record-worthy input is taken; +** SHELL_STIFLE_HISTORY(N) after console input ceases; then +** SHELL_WRITE_HISTORY(T) before the program exits. */ -static sqlite3 *globalDb = 0; /* -** True if an interrupt (Control-C) has been received. +** Retrieve a single line of input text from an input stream. +** +** If pfIn is the input stream passed to consoleClassifySetup(), +** and azPrompt is not NULL, then a prompt is issued before the +** line is collected, as selected by the isContinuation flag. +** Array azPrompt[{0,1}] holds the {main,continuation} prompt. +** +** If zBufPrior is not NULL then it is a buffer from a prior +** call to this routine that can be reused, or will be freed. +** +** The result is stored in space obtained from malloc() and +** must either be freed by the caller or else passed back to +** this function as zBufPrior for reuse. +** +** This function may call upon services of a line-editing +** library to interactively collect line edited input. */ -static volatile int seenInterrupt = 0; - +SQLITE_INTERNAL_LINKAGE char * +shellGetLine(FILE *pfIn, char *zBufPrior, int nLen, + short isContinuation, Prompts azPrompt); +#endif /* defined(SQLITE_CIO_PROMPTED_IN) */ /* -** This is the name of our program. It is set in main(), used -** in a number of other places, mostly for error messages. +** TBD: Define an interface for application(s) to generate +** completion candidates for use by the line-editor. +** +** This may be premature; the CLI is the only application +** that does this. Yet, getting line-editing melded into +** console I/O is desirable because a line-editing library +** may have to establish console operating mode, possibly +** in a way that interferes with the above functionality. */ -static char *Argv0; +#if !(defined(SQLITE_CIO_NO_UTF8SCAN)&&defined(SQLITE_CIO_NO_TRANSLATE)) +/* Skip over as much z[] input char sequence as is valid UTF-8, +** limited per nAccept char's or whole characters and containing +** no char cn such that ((1<=0 => char count, nAccept<0 => character + */ +SQLITE_INTERNAL_LINKAGE const char* +zSkipValidUtf8(const char *z, int nAccept, long ccm); + +#endif + +/************************* End ../ext/consio/console_io.h ********************/ +/************************* Begin ../ext/consio/console_io.c ******************/ /* -** Prompt strings. Initialized in main. Settable with -** .prompt main continue +** 2023 November 4 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +******************************************************************************** +** This file implements various interfaces used for console and stream I/O +** by the SQLite project command-line tools, as explained in console_io.h . +** Functions prefixed by "SQLITE_INTERNAL_LINKAGE" behave as described there. */ -#define PROMPT_LEN_MAX 20 -/* First line prompt. default: "sqlite> " */ -static char mainPrompt[PROMPT_LEN_MAX]; -/* Continuation prompt. default: " ...> " */ -static char continuePrompt[PROMPT_LEN_MAX]; -/* This is variant of the standard-library strncpy() routine with the -** one change that the destination string is always zero-terminated, even -** if there is no zero-terminator in the first n-1 characters of the source -** string. -*/ -static char *shell_strncpy(char *dest, const char *src, size_t n){ - size_t i; - for(i=0; i +# include +# include +# include +# include +/* # include "sqlite3.h" */ +#endif +#ifndef HAVE_CONSOLE_IO_H +# include "console_io.h" +#endif +#if defined(_MSC_VER) +# pragma warning(disable : 4204) +#endif + +#ifndef SQLITE_CIO_NO_TRANSLATE +# if (defined(_WIN32) || defined(WIN32)) && !SQLITE_OS_WINRT +# ifndef SHELL_NO_SYSINC +# include +# include +# undef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +# include +# endif +# define CIO_WIN_WC_XLATE 1 /* Use WCHAR Windows APIs for console I/O */ +# else +# ifndef SHELL_NO_SYSINC +# include +# endif +# define CIO_WIN_WC_XLATE 0 /* Use plain C library stream I/O at console */ +# endif +#else +# define CIO_WIN_WC_XLATE 0 /* Not exposing translation routines at all */ +#endif + +#if CIO_WIN_WC_XLATE +/* Character used to represent a known-incomplete UTF-8 char group (�) */ +static WCHAR cBadGroup = 0xfffd; +#endif + +#if CIO_WIN_WC_XLATE +static HANDLE handleOfFile(FILE *pf){ + int fileDesc = _fileno(pf); + union { intptr_t osfh; HANDLE fh; } fid = { + (fileDesc>=0)? _get_osfhandle(fileDesc) : (intptr_t)INVALID_HANDLE_VALUE + }; + return fid.fh; } +#endif -/* -** Optionally disable dynamic continuation prompt. -** Unless disabled, the continuation prompt shows open SQL lexemes if any, -** or open parentheses level if non-zero, or continuation prompt as set. -** This facility interacts with the scanner and process_input() where the -** below 5 macros are used. -*/ -#ifdef SQLITE_OMIT_DYNAPROMPT -# define CONTINUATION_PROMPT continuePrompt -# define CONTINUE_PROMPT_RESET -# define CONTINUE_PROMPT_AWAITS(p,s) -# define CONTINUE_PROMPT_AWAITC(p,c) -# define CONTINUE_PAREN_INCR(p,n) -# define CONTINUE_PROMPT_PSTATE 0 -typedef void *t_NoDynaPrompt; -# define SCAN_TRACKER_REFTYPE t_NoDynaPrompt -#else -# define CONTINUATION_PROMPT dynamicContinuePrompt() -# define CONTINUE_PROMPT_RESET \ - do {setLexemeOpen(&dynPrompt,0,0); trackParenLevel(&dynPrompt,0);} while(0) -# define CONTINUE_PROMPT_AWAITS(p,s) \ - if(p && stdin_is_interactive) setLexemeOpen(p, s, 0) -# define CONTINUE_PROMPT_AWAITC(p,c) \ - if(p && stdin_is_interactive) setLexemeOpen(p, 0, c) -# define CONTINUE_PAREN_INCR(p,n) \ - if(p && stdin_is_interactive) (trackParenLevel(p,n)) -# define CONTINUE_PROMPT_PSTATE (&dynPrompt) -typedef struct DynaPrompt *t_DynaPromptRef; -# define SCAN_TRACKER_REFTYPE t_DynaPromptRef +#ifndef SQLITE_CIO_NO_TRANSLATE +typedef struct PerStreamTags { +# if CIO_WIN_WC_XLATE + HANDLE hx; + DWORD consMode; + char acIncomplete[4]; +# else + short reachesConsole; +# endif + FILE *pf; +} PerStreamTags; -static struct DynaPrompt { - char dynamicPrompt[PROMPT_LEN_MAX]; - char acAwait[2]; - int inParenLevel; - char *zScannerAwaits; -} dynPrompt = { {0}, {0}, 0, 0 }; +/* Define NULL-like value for things which can validly be 0. */ +# define SHELL_INVALID_FILE_PTR ((FILE *)~0) +# if CIO_WIN_WC_XLATE +# define SHELL_INVALID_CONS_MODE 0xFFFF0000 +# endif -/* Record parenthesis nesting level change, or force level to 0. */ -static void trackParenLevel(struct DynaPrompt *p, int ni){ - p->inParenLevel += ni; - if( ni==0 ) p->inParenLevel = 0; - p->zScannerAwaits = 0; +# if CIO_WIN_WC_XLATE +# define PST_INITIALIZER { INVALID_HANDLE_VALUE, SHELL_INVALID_CONS_MODE, \ + {0,0,0,0}, SHELL_INVALID_FILE_PTR } +# else +# define PST_INITIALIZER { 0, SHELL_INVALID_FILE_PTR } +# endif + +/* Quickly say whether a known output is going to the console. */ +# if CIO_WIN_WC_XLATE +static short pstReachesConsole(PerStreamTags *ppst){ + return (ppst->hx != INVALID_HANDLE_VALUE); } +# else +# define pstReachesConsole(ppst) 0 +# endif -/* Record that a lexeme is opened, or closed with args==0. */ -static void setLexemeOpen(struct DynaPrompt *p, char *s, char c){ - if( s!=0 || c==0 ){ - p->zScannerAwaits = s; - p->acAwait[0] = 0; - }else{ - p->acAwait[0] = c; - p->zScannerAwaits = p->acAwait; +# if CIO_WIN_WC_XLATE +static void restoreConsoleArb(PerStreamTags *ppst){ + if( pstReachesConsole(ppst) ) SetConsoleMode(ppst->hx, ppst->consMode); +} +# else +# define restoreConsoleArb(ppst) +# endif + +/* Say whether FILE* appears to be a console, collect associated info. */ +static short streamOfConsole(FILE *pf, /* out */ PerStreamTags *ppst){ +# if CIO_WIN_WC_XLATE + short rv = 0; + DWORD dwCM = SHELL_INVALID_CONS_MODE; + HANDLE fh = handleOfFile(pf); + ppst->pf = pf; + if( INVALID_HANDLE_VALUE != fh ){ + rv = (GetFileType(fh) == FILE_TYPE_CHAR && GetConsoleMode(fh,&dwCM)); + } + ppst->hx = (rv)? fh : INVALID_HANDLE_VALUE; + ppst->consMode = dwCM; + return rv; +# else + ppst->pf = pf; + ppst->reachesConsole = ( (short)isatty(fileno(pf)) ); + return ppst->reachesConsole; +# endif +} + +# ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING +# define ENABLE_VIRTUAL_TERMINAL_PROCESSING (0x4) +# endif + +# if CIO_WIN_WC_XLATE +/* Define console modes for use with the Windows Console API. */ +# define SHELL_CONI_MODE \ + (ENABLE_ECHO_INPUT | ENABLE_INSERT_MODE | ENABLE_LINE_INPUT | 0x80 \ + | ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS | ENABLE_PROCESSED_INPUT) +# define SHELL_CONO_MODE (ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT \ + | ENABLE_VIRTUAL_TERMINAL_PROCESSING) +# endif + +typedef struct ConsoleInfo { + PerStreamTags pstSetup[3]; + PerStreamTags pstDesignated[3]; + StreamsAreConsole sacSetup; +} ConsoleInfo; + +static short isValidStreamInfo(PerStreamTags *ppst){ + return (ppst->pf != SHELL_INVALID_FILE_PTR); +} + +static ConsoleInfo consoleInfo = { + { /* pstSetup */ PST_INITIALIZER, PST_INITIALIZER, PST_INITIALIZER }, + { /* pstDesignated[] */ PST_INITIALIZER, PST_INITIALIZER, PST_INITIALIZER }, + SAC_NoConsole /* sacSetup */ +}; + +SQLITE_INTERNAL_LINKAGE FILE* invalidFileStream = (FILE *)~0; + +# if CIO_WIN_WC_XLATE +static void maybeSetupAsConsole(PerStreamTags *ppst, short odir){ + if( pstReachesConsole(ppst) ){ + DWORD cm = odir? SHELL_CONO_MODE : SHELL_CONI_MODE; + SetConsoleMode(ppst->hx, cm); } } +# else +# define maybeSetupAsConsole(ppst,odir) +# endif -/* Upon demand, derive the continuation prompt to display. */ -static char *dynamicContinuePrompt(void){ - if( continuePrompt[0]==0 - || (dynPrompt.zScannerAwaits==0 && dynPrompt.inParenLevel == 0) ){ - return continuePrompt; - }else{ - if( dynPrompt.zScannerAwaits ){ - size_t ncp = strlen(continuePrompt); - size_t ndp = strlen(dynPrompt.zScannerAwaits); - if( ndp > ncp-3 ) return continuePrompt; - strcpy(dynPrompt.dynamicPrompt, dynPrompt.zScannerAwaits); - while( ndp<3 ) dynPrompt.dynamicPrompt[ndp++] = ' '; - shell_strncpy(dynPrompt.dynamicPrompt+3, continuePrompt+3, - PROMPT_LEN_MAX-4); - }else{ - if( dynPrompt.inParenLevel>9 ){ - shell_strncpy(dynPrompt.dynamicPrompt, "(..", 4); - }else if( dynPrompt.inParenLevel<0 ){ - shell_strncpy(dynPrompt.dynamicPrompt, ")x!", 4); - }else{ - shell_strncpy(dynPrompt.dynamicPrompt, "(x.", 4); - dynPrompt.dynamicPrompt[2] = (char)('0'+dynPrompt.inParenLevel); +SQLITE_INTERNAL_LINKAGE void consoleRenewSetup(void){ +# if CIO_WIN_WC_XLATE + int ix = 0; + while( ix < 6 ){ + PerStreamTags *ppst = (ix<3)? + &consoleInfo.pstSetup[ix] : &consoleInfo.pstDesignated[ix-3]; + maybeSetupAsConsole(ppst, (ix % 3)>0); + ++ix; + } +# endif +} + +SQLITE_INTERNAL_LINKAGE StreamsAreConsole +consoleClassifySetup( FILE *pfIn, FILE *pfOut, FILE *pfErr ){ + StreamsAreConsole rv = SAC_NoConsole; + FILE* apf[3] = { pfIn, pfOut, pfErr }; + int ix; + for( ix = 2; ix >= 0; --ix ){ + PerStreamTags *ppst = &consoleInfo.pstSetup[ix]; + if( streamOfConsole(apf[ix], ppst) ){ + rv |= (SAC_InConsole< 0 ) fflush(apf[ix]); + } + consoleInfo.sacSetup = rv; + consoleRenewSetup(); + return rv; +} + +SQLITE_INTERNAL_LINKAGE void SQLITE_CDECL consoleRestore( void ){ +# if CIO_WIN_WC_XLATE + static ConsoleInfo *pci = &consoleInfo; + if( pci->sacSetup ){ + int ix; + for( ix=0; ix<3; ++ix ){ + if( pci->sacSetup & (SAC_InConsole<pstSetup[ix]; + SetConsoleMode(ppst->hx, ppst->consMode); } - shell_strncpy(dynPrompt.dynamicPrompt+3, continuePrompt+3, PROMPT_LEN_MAX-4); } } - return dynPrompt.dynamicPrompt; +# endif } -#endif /* !defined(SQLITE_OMIT_DYNAPROMPT) */ +#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */ -#if SHELL_WIN_UTF8_OPT -/* Following struct is used for -utf8 operation. */ -static struct ConsoleState { - int stdinEof; /* EOF has been seen on console input */ - int infsMode; /* Input file stream mode upon shell start */ - UINT inCodePage; /* Input code page upon shell start */ - UINT outCodePage; /* Output code page upon shell start */ - HANDLE hConsoleIn; /* Console input handle */ - DWORD consoleMode; /* Console mode upon shell start */ -} conState = { 0, 0, 0, 0, INVALID_HANDLE_VALUE, 0 }; - -#ifndef _O_U16TEXT /* For build environments lacking this constant: */ -# define _O_U16TEXT 0x20000 -#endif - -/* -** Prepare console, (if known to be a WIN32 console), for UTF-8 -** input (from either typing or suitable paste operations) and for -** UTF-8 rendering. This may "fail" with a message to stderr, where -** the preparation is not done and common "code page" issues occur. -*/ -static void console_prepare(void){ - HANDLE hCI = GetStdHandle(STD_INPUT_HANDLE); - DWORD consoleMode = 0; - if( isatty(0) && GetFileType(hCI)==FILE_TYPE_CHAR - && GetConsoleMode( hCI, &consoleMode) ){ - if( !IsValidCodePage(CP_UTF8) ){ - fprintf(stderr, "Cannot use UTF-8 code page.\n"); - console_utf8 = 0; - return; +#ifdef SQLITE_CIO_INPUT_REDIR +/* Say whether given FILE* is among those known, via either +** consoleClassifySetup() or set{Output,Error}Stream, as +** readable, and return an associated PerStreamTags pointer +** if so. Otherwise, return 0. +*/ +static PerStreamTags * isKnownReadable(FILE *pf){ + static PerStreamTags *apst[] = { + &consoleInfo.pstDesignated[0], &consoleInfo.pstSetup[0], 0 + }; + int ix = 0; + do { + if( apst[ix]->pf == pf ) break; + } while( apst[++ix] != 0 ); + return apst[ix]; +} +#endif + +#ifndef SQLITE_CIO_NO_TRANSLATE +/* Say whether given FILE* is among those known, via either +** consoleClassifySetup() or set{Output,Error}Stream, as +** writable, and return an associated PerStreamTags pointer +** if so. Otherwise, return 0. +*/ +static PerStreamTags * isKnownWritable(FILE *pf){ + static PerStreamTags *apst[] = { + &consoleInfo.pstDesignated[1], &consoleInfo.pstDesignated[2], + &consoleInfo.pstSetup[1], &consoleInfo.pstSetup[2], 0 + }; + int ix = 0; + do { + if( apst[ix]->pf == pf ) break; + } while( apst[++ix] != 0 ); + return apst[ix]; +} + +static FILE *designateEmitStream(FILE *pf, unsigned chix){ + FILE *rv = consoleInfo.pstDesignated[chix].pf; + if( pf == invalidFileStream ) return rv; + else{ + /* Setting a possibly new output stream. */ + PerStreamTags *ppst = isKnownWritable(pf); + if( ppst != 0 ){ + PerStreamTags pst = *ppst; + consoleInfo.pstDesignated[chix] = pst; + }else streamOfConsole(pf, &consoleInfo.pstDesignated[chix]); + } + return rv; +} + +SQLITE_INTERNAL_LINKAGE FILE *setOutputStream(FILE *pf){ + return designateEmitStream(pf, 1); +} +# ifdef CONSIO_SET_ERROR_STREAM +SQLITE_INTERNAL_LINKAGE FILE *setErrorStream(FILE *pf){ + return designateEmitStream(pf, 2); +} +# endif +#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */ + +#ifndef SQLITE_CIO_NO_SETMODE +# if CIO_WIN_WC_XLATE +static void setModeFlushQ(FILE *pf, short bFlush, int mode){ + if( bFlush ) fflush(pf); + _setmode(_fileno(pf), mode); +} +# else +# define setModeFlushQ(f, b, m) if(b) fflush(f) +# endif + +SQLITE_INTERNAL_LINKAGE void setBinaryMode(FILE *pf, short bFlush){ + setModeFlushQ(pf, bFlush, _O_BINARY); +} +SQLITE_INTERNAL_LINKAGE void setTextMode(FILE *pf, short bFlush){ + setModeFlushQ(pf, bFlush, _O_TEXT); +} +# undef setModeFlushQ + +#else /* defined(SQLITE_CIO_NO_SETMODE) */ +# define setBinaryMode(f, bFlush) do{ if((bFlush)) fflush(f); }while(0) +# define setTextMode(f, bFlush) do{ if((bFlush)) fflush(f); }while(0) +#endif /* defined(SQLITE_CIO_NO_SETMODE) */ + +#ifndef SQLITE_CIO_NO_TRANSLATE +# if CIO_WIN_WC_XLATE +/* Write buffer cBuf as output to stream known to reach console, +** limited to ncTake char's. Return ncTake on success, else 0. */ +static int conZstrEmit(PerStreamTags *ppst, const char *z, int ncTake){ + int rv = 0; + if( z!=NULL ){ + int nwc = MultiByteToWideChar(CP_UTF8,0, z,ncTake, 0,0); + if( nwc > 0 ){ + WCHAR *zw = sqlite3_malloc64(nwc*sizeof(WCHAR)); + if( zw!=NULL ){ + nwc = MultiByteToWideChar(CP_UTF8,0, z,ncTake, zw,nwc); + if( nwc > 0 ){ + /* Translation from UTF-8 to UTF-16, then WCHARs out. */ + if( WriteConsoleW(ppst->hx, zw,nwc, 0, NULL) ){ + rv = ncTake; + } + } + sqlite3_free(zw); + } } - conState.hConsoleIn = hCI; - conState.consoleMode = consoleMode; - conState.inCodePage = GetConsoleCP(); - conState.outCodePage = GetConsoleOutputCP(); - SetConsoleCP(CP_UTF8); - SetConsoleOutputCP(CP_UTF8); - consoleMode |= ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT; - SetConsoleMode(conState.hConsoleIn, consoleMode); - conState.infsMode = _setmode(_fileno(stdin), _O_U16TEXT); - console_utf8 = 1; + } + return rv; +} + +/* For {f,o,e}PrintfUtf8() when stream is known to reach console. */ +static int conioVmPrintf(PerStreamTags *ppst, const char *zFormat, va_list ap){ + char *z = sqlite3_vmprintf(zFormat, ap); + if( z ){ + int rv = conZstrEmit(ppst, z, (int)strlen(z)); + sqlite3_free(z); + return rv; + }else return 0; +} +# endif /* CIO_WIN_WC_XLATE */ + +# ifdef CONSIO_GET_EMIT_STREAM +static PerStreamTags * getDesignatedEmitStream(FILE *pf, unsigned chix, + PerStreamTags *ppst){ + PerStreamTags *rv = isKnownWritable(pf); + short isValid = (rv!=0)? isValidStreamInfo(rv) : 0; + if( rv != 0 && isValid ) return rv; + streamOfConsole(pf, ppst); + return ppst; +} +# endif + +/* Get stream info, either for designated output or error stream when +** chix equals 1 or 2, or for an arbitrary stream when chix == 0. +** In either case, ppst references a caller-owned PerStreamTags +** struct which may be filled in if none of the known writable +** streams is being held by consoleInfo. The ppf parameter is a +** byref output when chix!=0 and a byref input when chix==0. + */ +static PerStreamTags * +getEmitStreamInfo(unsigned chix, PerStreamTags *ppst, + /* in/out */ FILE **ppf){ + PerStreamTags *ppstTry; + FILE *pfEmit; + if( chix > 0 ){ + ppstTry = &consoleInfo.pstDesignated[chix]; + if( !isValidStreamInfo(ppstTry) ){ + ppstTry = &consoleInfo.pstSetup[chix]; + pfEmit = ppst->pf; + }else pfEmit = ppstTry->pf; + if( !isValidStreamInfo(ppstTry) ){ + pfEmit = (chix > 1)? stderr : stdout; + ppstTry = ppst; + streamOfConsole(pfEmit, ppstTry); + } + *ppf = pfEmit; }else{ - console_utf8 = 0; + ppstTry = isKnownWritable(*ppf); + if( ppstTry != 0 ) return ppstTry; + streamOfConsole(*ppf, ppst); + return ppst; } + return ppstTry; } -/* -** Undo the effects of console_prepare(), if any. -*/ -static void SQLITE_CDECL console_restore(void){ - if( console_utf8 && conState.inCodePage!=0 - && conState.hConsoleIn!=INVALID_HANDLE_VALUE ){ - _setmode(_fileno(stdin), conState.infsMode); - SetConsoleCP(conState.inCodePage); - SetConsoleOutputCP(conState.outCodePage); - SetConsoleMode(conState.hConsoleIn, conState.consoleMode); - /* Avoid multiple calls. */ - conState.hConsoleIn = INVALID_HANDLE_VALUE; - conState.consoleMode = 0; - console_utf8 = 0; +SQLITE_INTERNAL_LINKAGE int oPrintfUtf8(const char *zFormat, ...){ + va_list ap; + int rv; + FILE *pfOut; + PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */ +# if CIO_WIN_WC_XLATE + PerStreamTags *ppst = getEmitStreamInfo(1, &pst, &pfOut); +# else + getEmitStreamInfo(1, &pst, &pfOut); +# endif + assert(zFormat!=0); + va_start(ap, zFormat); +# if CIO_WIN_WC_XLATE + if( pstReachesConsole(ppst) ){ + rv = conioVmPrintf(ppst, zFormat, ap); + }else{ +# endif + rv = vfprintf(pfOut, zFormat, ap); +# if CIO_WIN_WC_XLATE } +# endif + va_end(ap); + return rv; } -/* -** Collect input like fgets(...) with special provisions for input -** from the Windows console to get around its strange coding issues. -** Defers to plain fgets() when input is not interactive or when the -** startup option, -utf8, has not been provided or taken effect. -*/ -static char* utf8_fgets(char *buf, int ncmax, FILE *fin){ - if( fin==0 ) fin = stdin; - if( fin==stdin && stdin_is_interactive && console_utf8 ){ -# define SQLITE_IALIM 150 - wchar_t wbuf[SQLITE_IALIM]; - int lend = 0; - int noc = 0; - if( ncmax==0 || conState.stdinEof ) return 0; - buf[0] = 0; - while( nocpf) ) restoreConsoleArb(ppst); + }else{ +# endif + rv = vfprintf(pfO, zFormat, ap); +# if CIO_WIN_WC_XLATE + } +# endif + va_end(ap); + return rv; +} + +SQLITE_INTERNAL_LINKAGE int fPutsUtf8(const char *z, FILE *pfO){ + PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */ +# if CIO_WIN_WC_XLATE + PerStreamTags *ppst = getEmitStreamInfo(0, &pst, &pfO); +# else + getEmitStreamInfo(0, &pst, &pfO); +# endif + assert(z!=0); +# if CIO_WIN_WC_XLATE + if( pstReachesConsole(ppst) ){ + int rv; + maybeSetupAsConsole(ppst, 1); + rv = conZstrEmit(ppst, z, (int)strlen(z)); + if( 0 == isKnownWritable(ppst->pf) ) restoreConsoleArb(ppst); + return rv; + }else { +# endif + return (fputs(z, pfO)<0)? 0 : (int)strlen(z); +# if CIO_WIN_WC_XLATE + } +# endif +} + +SQLITE_INTERNAL_LINKAGE int ePutsUtf8(const char *z){ + FILE *pfErr; + PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */ +# if CIO_WIN_WC_XLATE + PerStreamTags *ppst = getEmitStreamInfo(2, &pst, &pfErr); +# else + getEmitStreamInfo(2, &pst, &pfErr); +# endif + assert(z!=0); +# if CIO_WIN_WC_XLATE + if( pstReachesConsole(ppst) ) return conZstrEmit(ppst, z, (int)strlen(z)); + else { +# endif + return (fputs(z, pfErr)<0)? 0 : (int)strlen(z); +# if CIO_WIN_WC_XLATE + } +# endif +} + +SQLITE_INTERNAL_LINKAGE int oPutsUtf8(const char *z){ + FILE *pfOut; + PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */ +# if CIO_WIN_WC_XLATE + PerStreamTags *ppst = getEmitStreamInfo(1, &pst, &pfOut); +# else + getEmitStreamInfo(1, &pst, &pfOut); +# endif + assert(z!=0); +# if CIO_WIN_WC_XLATE + if( pstReachesConsole(ppst) ) return conZstrEmit(ppst, z, (int)strlen(z)); + else { +# endif + return (fputs(z, pfOut)<0)? 0 : (int)strlen(z); +# if CIO_WIN_WC_XLATE + } +# endif +} + +#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */ + +#if !(defined(SQLITE_CIO_NO_UTF8SCAN) && defined(SQLITE_CIO_NO_TRANSLATE)) +/* Skip over as much z[] input char sequence as is valid UTF-8, +** limited per nAccept char's or whole characters and containing +** no char cn such that ((1<=0 => char count, nAccept<0 => character + */ +SQLITE_INTERNAL_LINKAGE const char* +zSkipValidUtf8(const char *z, int nAccept, long ccm){ + int ng = (nAccept<0)? -nAccept : 0; + const char *pcLimit = (nAccept>=0)? z+nAccept : 0; + assert(z!=0); + while( (pcLimit)? (z= pcLimit ) return z; + else{ + char ct = *zt++; + if( ct==0 || (zt-z)>4 || (ct & 0xC0)!=0x80 ){ + /* Trailing bytes are too few, too many, or invalid. */ + return z; + } + } + } while( ((c <<= 1) & 0x40) == 0x40 ); /* Eat lead byte's count. */ + z = zt; + } + } + return z; +} +#endif /*!(defined(SQLITE_CIO_NO_UTF8SCAN)&&defined(SQLITE_CIO_NO_TRANSLATE))*/ + +#ifndef SQLITE_CIO_NO_TRANSLATE +# ifdef CONSIO_SPUTB +SQLITE_INTERNAL_LINKAGE int +fPutbUtf8(FILE *pfO, const char *cBuf, int nAccept){ + assert(pfO!=0); +# if CIO_WIN_WC_XLATE + PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */ + PerStreamTags *ppst = getEmitStreamInfo(0, &pst, &pfO); + if( pstReachesConsole(ppst) ){ + int rv; + maybeSetupAsConsole(ppst, 1); + rv = conZstrEmit(ppst, cBuf, nAccept); + if( 0 == isKnownWritable(ppst->pf) ) restoreConsoleArb(ppst); + return rv; + }else { +# endif + return (int)fwrite(cBuf, 1, nAccept, pfO); +# if CIO_WIN_WC_XLATE + } +# endif +} +# endif + +SQLITE_INTERNAL_LINKAGE int +oPutbUtf8(const char *cBuf, int nAccept){ + FILE *pfOut; + PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */ +# if CIO_WIN_WC_XLATE + PerStreamTags *ppst = getEmitStreamInfo(1, &pst, &pfOut); +# else + getEmitStreamInfo(1, &pst, &pfOut); +# endif +# if CIO_WIN_WC_XLATE + if( pstReachesConsole(ppst) ){ + return conZstrEmit(ppst, cBuf, nAccept); + }else { +# endif + return (int)fwrite(cBuf, 1, nAccept, pfOut); +# if CIO_WIN_WC_XLATE + } +# endif +} + +# ifdef CONSIO_EPUTB +SQLITE_INTERNAL_LINKAGE int +ePutbUtf8(const char *cBuf, int nAccept){ + FILE *pfErr; + PerStreamTags pst = PST_INITIALIZER; /* for unknown streams */ + PerStreamTags *ppst = getEmitStreamInfo(2, &pst, &pfErr); +# if CIO_WIN_WC_XLATE + if( pstReachesConsole(ppst) ){ + return conZstrEmit(ppst, cBuf, nAccept); + }else { +# endif + return (int)fwrite(cBuf, 1, nAccept, pfErr); +# if CIO_WIN_WC_XLATE + } +# endif +} +# endif /* defined(CONSIO_EPUTB) */ + +SQLITE_INTERNAL_LINKAGE char* fGetsUtf8(char *cBuf, int ncMax, FILE *pfIn){ + if( pfIn==0 ) pfIn = stdin; +# if CIO_WIN_WC_XLATE + if( pfIn == consoleInfo.pstSetup[0].pf + && (consoleInfo.sacSetup & SAC_InConsole)!=0 ){ +# if CIO_WIN_WC_XLATE==1 +# define SHELL_GULP 150 /* Count of WCHARS to be gulped at a time */ + WCHAR wcBuf[SHELL_GULP+1]; + int lend = 0, noc = 0; + if( ncMax > 0 ) cBuf[0] = 0; + while( noc < ncMax-8-1 && !lend ){ /* There is room for at least 2 more characters and a 0-terminator. */ - int na = (ncmax > SQLITE_IALIM*4+1 + noc) - ? SQLITE_IALIM : (ncmax-1 - noc)/4; -# undef SQLITE_IALIM + int na = (ncMax > SHELL_GULP*4+1 + noc)? SHELL_GULP : (ncMax-1 - noc)/4; +# undef SHELL_GULP DWORD nbr = 0; - BOOL bRC = ReadConsoleW(conState.hConsoleIn, wbuf, na, &nbr, 0); + BOOL bRC = ReadConsoleW(consoleInfo.pstSetup[0].hx, wcBuf, na, &nbr, 0); + if( bRC && nbr>0 && (wcBuf[nbr-1]&0xF800)==0xD800 ){ + /* Last WHAR read is first of a UTF-16 surrogate pair. Grab its mate. */ + DWORD nbrx; + bRC &= ReadConsoleW(consoleInfo.pstSetup[0].hx, wcBuf+nbr, 1, &nbrx, 0); + if( bRC ) nbr += nbrx; + } if( !bRC || (noc==0 && nbr==0) ) return 0; if( nbr > 0 ){ - int nmb = WideCharToMultiByte(CP_UTF8,WC_COMPOSITECHECK|WC_DEFAULTCHAR, - wbuf,nbr,0,0,0,0); - if( nmb !=0 && noc+nmb <= ncmax ){ + int nmb = WideCharToMultiByte(CP_UTF8, 0, wcBuf,nbr,0,0,0,0); + if( nmb != 0 && noc+nmb <= ncMax ){ int iseg = noc; - nmb = WideCharToMultiByte(CP_UTF8,WC_COMPOSITECHECK|WC_DEFAULTCHAR, - wbuf,nbr,buf+noc,nmb,0,0); + nmb = WideCharToMultiByte(CP_UTF8, 0, wcBuf,nbr,cBuf+noc,nmb,0,0); noc += nmb; - /* Fixup line-ends as coded by Windows for CR (or "Enter".)*/ + /* Fixup line-ends as coded by Windows for CR (or "Enter".) + ** This is done without regard for any setMode{Text,Binary}() + ** call that might have been done on the interactive input. + */ if( noc > 0 ){ - if( buf[noc-1]=='\n' ){ + if( cBuf[noc-1]=='\n' ){ lend = 1; - if( noc > 1 && buf[noc-2]=='\r' ){ - buf[noc-2] = '\n'; - --noc; - } + if( noc > 1 && cBuf[noc-2]=='\r' ) cBuf[--noc-1] = '\n'; } } - /* Check for ^Z (anywhere in line) too. */ + /* Check for ^Z (anywhere in line) too, to act as EOF. */ while( iseg < noc ){ - if( buf[iseg]==0x1a ){ - conState.stdinEof = 1; + if( cBuf[iseg]=='\x1a' ){ noc = iseg; /* Chop ^Z and anything following. */ + lend = 1; /* Counts as end of line too. */ break; } ++iseg; @@ -730,826 +1221,1148 @@ static char* utf8_fgets(char *buf, int ncmax, FILE *fin){ }else break; } /* If got nothing, (after ^Z chop), must be at end-of-file. */ - if( noc == 0 ) return 0; - buf[noc] = 0; - return buf; + if( noc > 0 ){ + cBuf[noc] = 0; + return cBuf; + }else return 0; +# endif }else{ - return fgets(buf, ncmax, fin); - } -} - -# define fgets(b,n,f) utf8_fgets(b,n,f) -#endif /* SHELL_WIN_UTF8_OPT */ - -/* -** Render output like fprintf(). Except, if the output is going to the -** console and if this is running on a Windows machine, and if the -utf8 -** option is unavailable or (available and inactive), translate the -** output from UTF-8 into MBCS for output through 8-bit stdout stream. -** (With -utf8 active, no translation is needed and must not be done.) -*/ -#if defined(_WIN32) || defined(WIN32) -void utf8_printf(FILE *out, const char *zFormat, ...){ - va_list ap; - va_start(ap, zFormat); - if( stdout_is_console && (out==stdout || out==stderr) -# if SHELL_WIN_UTF8_OPT - && !console_utf8 # endif - ){ - char *z1 = sqlite3_vmprintf(zFormat, ap); - char *z2 = sqlite3_win32_utf8_to_mbcs_v2(z1, 0); - sqlite3_free(z1); - fputs(z2, out); - sqlite3_free(z2); - }else{ - vfprintf(out, zFormat, ap); + return fgets(cBuf, ncMax, pfIn); +# if CIO_WIN_WC_XLATE } - va_end(ap); +# endif } -#elif !defined(utf8_printf) -# define utf8_printf fprintf -#endif +#endif /* !defined(SQLITE_CIO_NO_TRANSLATE) */ -/* -** Render output like fprintf(). This should not be used on anything that -** includes string formatting (e.g. "%s"). -*/ -#if !defined(raw_printf) -# define raw_printf fprintf +#if defined(_MSC_VER) +# pragma warning(default : 4204) #endif -/* Indicate out-of-memory and exit. */ -static void shell_out_of_memory(void){ - raw_printf(stderr,"Error: out of memory\n"); - exit(1); -} +#undef SHELL_INVALID_FILE_PTR -/* Check a pointer to see if it is NULL. If it is NULL, exit with an -** out-of-memory error. -*/ -static void shell_check_oom(const void *p){ - if( p==0 ) shell_out_of_memory(); -} +/************************* End ../ext/consio/console_io.c ********************/ -/* -** Write I/O traces to the following stream. -*/ -#ifdef SQLITE_ENABLE_IOTRACE -static FILE *iotrace = 0; +#ifndef SQLITE_SHELL_FIDDLE + +/* From here onward, fgets() is redirected to the console_io library. */ +# define fgets(b,n,f) fGetsUtf8(b,n,f) +/* + * Define macros for emitting output text in various ways: + * sputz(s, z) => emit 0-terminated string z to given stream s + * sputf(s, f, ...) => emit varargs per format f to given stream s + * oputz(z) => emit 0-terminated string z to default stream + * oputf(f, ...) => emit varargs per format f to default stream + * eputz(z) => emit 0-terminated string z to error stream + * eputf(f, ...) => emit varargs per format f to error stream + * oputb(b, n) => emit char buffer b[0..n-1] to default stream + * + * Note that the default stream is whatever has been last set via: + * setOutputStream(FILE *pf) + * This is normally the stream that CLI normal output goes to. + * For the stand-alone CLI, it is stdout with no .output redirect. + * + * The ?putz(z) forms are required for the Fiddle builds for string literal + * output, in aid of enforcing format string to argument correspondence. + */ +# define sputz(s,z) fPutsUtf8(z,s) +# define sputf fPrintfUtf8 +# define oputz(z) oPutsUtf8(z) +# define oputf oPrintfUtf8 +# define eputz(z) ePutsUtf8(z) +# define eputf ePrintfUtf8 +# define oputb(buf,na) oPutbUtf8(buf,na) + +#else +/* For Fiddle, all console handling and emit redirection is omitted. */ +/* These next 3 macros are for emitting formatted output. When complaints + * from the WASM build are issued for non-formatted output, (when a mere + * string literal is to be emitted, the ?putz(z) forms should be used. + * (This permits compile-time checking of format string / argument mismatch.) + */ +# define oputf(fmt, ...) printf(fmt,__VA_ARGS__) +# define eputf(fmt, ...) fprintf(stderr,fmt,__VA_ARGS__) +# define sputf(fp,fmt, ...) fprintf(fp,fmt,__VA_ARGS__) +/* These next 3 macros are for emitting simple string literals. */ +# define oputz(z) fputs(z,stdout) +# define eputz(z) fputs(z,stderr) +# define sputz(fp,z) fputs(z,fp) +# define oputb(buf,na) fwrite(buf,1,na,stdout) #endif -/* -** This routine works like printf in that its first argument is a -** format string and subsequent arguments are values to be substituted -** in place of % fields. The result of formatting this string -** is written to iotrace. -*/ -#ifdef SQLITE_ENABLE_IOTRACE -static void SQLITE_CDECL iotracePrintf(const char *zFormat, ...){ - va_list ap; - char *z; - if( iotrace==0 ) return; - va_start(ap, zFormat); - z = sqlite3_vmprintf(zFormat, ap); - va_end(ap); - utf8_printf(iotrace, "%s", z); - sqlite3_free(z); +/* True if the timer is enabled */ +static int enableTimer = 0; + +/* A version of strcmp() that works with NULL values */ +static int cli_strcmp(const char *a, const char *b){ + if( a==0 ) a = ""; + if( b==0 ) b = ""; + return strcmp(a,b); +} +static int cli_strncmp(const char *a, const char *b, size_t n){ + if( a==0 ) a = ""; + if( b==0 ) b = ""; + return strncmp(a,b,n); +} + +/* Return the current wall-clock time */ +static sqlite3_int64 timeOfDay(void){ + static sqlite3_vfs *clockVfs = 0; + sqlite3_int64 t; + if( clockVfs==0 ) clockVfs = sqlite3_vfs_find(0); + if( clockVfs==0 ) return 0; /* Never actually happens */ + if( clockVfs->iVersion>=2 && clockVfs->xCurrentTimeInt64!=0 ){ + clockVfs->xCurrentTimeInt64(clockVfs, &t); + }else{ + double r; + clockVfs->xCurrentTime(clockVfs, &r); + t = (sqlite3_int64)(r*86400000.0); + } + return t; } + +#if !defined(_WIN32) && !defined(WIN32) && !defined(__minux) +#include +#include + +/* VxWorks does not support getrusage() as far as we can determine */ +#if defined(_WRS_KERNEL) || defined(__RTP__) +struct rusage { + struct timeval ru_utime; /* user CPU time used */ + struct timeval ru_stime; /* system CPU time used */ +}; +#define getrusage(A,B) memset(B,0,sizeof(*B)) #endif +/* Saved resource information for the beginning of an operation */ +static struct rusage sBegin; /* CPU time at start */ +static sqlite3_int64 iBegin; /* Wall-clock time at start */ + /* -** Output string zUtf to stream pOut as w characters. If w is negative, -** then right-justify the text. W is the width in UTF-8 characters, not -** in bytes. This is different from the %*.*s specification in printf -** since with %*.*s the width is measured in bytes, not characters. +** Begin timing an operation */ -static void utf8_width_print(FILE *pOut, int w, const char *zUtf){ - int i; - int n; - int aw = w<0 ? -w : w; - if( zUtf==0 ) zUtf = ""; - for(i=n=0; zUtf[i]; i++){ - if( (zUtf[i]&0xc0)!=0x80 ){ - n++; - if( n==aw ){ - do{ i++; }while( (zUtf[i]&0xc0)==0x80 ); - break; - } - } - } - if( n>=aw ){ - utf8_printf(pOut, "%.*s", i, zUtf); - }else if( w<0 ){ - utf8_printf(pOut, "%*s%s", aw-n, "", zUtf); - }else{ - utf8_printf(pOut, "%s%*s", zUtf, aw-n, ""); +static void beginTimer(void){ + if( enableTimer ){ + getrusage(RUSAGE_SELF, &sBegin); + iBegin = timeOfDay(); } } +/* Return the difference of two time_structs in seconds */ +static double timeDiff(struct timeval *pStart, struct timeval *pEnd){ + return (pEnd->tv_usec - pStart->tv_usec)*0.000001 + + (double)(pEnd->tv_sec - pStart->tv_sec); +} /* -** Determines if a string is a number of not. +** Print the timing results. */ -static int isNumber(const char *z, int *realnum){ - if( *z=='-' || *z=='+' ) z++; - if( !IsDigit(*z) ){ - return 0; - } - z++; - if( realnum ) *realnum = 0; - while( IsDigit(*z) ){ z++; } - if( *z=='.' ){ - z++; - if( !IsDigit(*z) ) return 0; - while( IsDigit(*z) ){ z++; } - if( realnum ) *realnum = 1; - } - if( *z=='e' || *z=='E' ){ - z++; - if( *z=='+' || *z=='-' ) z++; - if( !IsDigit(*z) ) return 0; - while( IsDigit(*z) ){ z++; } - if( realnum ) *realnum = 1; +static void endTimer(void){ + if( enableTimer ){ + sqlite3_int64 iEnd = timeOfDay(); + struct rusage sEnd; + getrusage(RUSAGE_SELF, &sEnd); + sputf(stdout, "Run Time: real %.3f user %f sys %f\n", + (iEnd - iBegin)*0.001, + timeDiff(&sBegin.ru_utime, &sEnd.ru_utime), + timeDiff(&sBegin.ru_stime, &sEnd.ru_stime)); } - return *z==0; } +#define BEGIN_TIMER beginTimer() +#define END_TIMER endTimer() +#define HAS_TIMER 1 + +#elif (defined(_WIN32) || defined(WIN32)) + +/* Saved resource information for the beginning of an operation */ +static HANDLE hProcess; +static FILETIME ftKernelBegin; +static FILETIME ftUserBegin; +static sqlite3_int64 ftWallBegin; +typedef BOOL (WINAPI *GETPROCTIMES)(HANDLE, LPFILETIME, LPFILETIME, + LPFILETIME, LPFILETIME); +static GETPROCTIMES getProcessTimesAddr = NULL; + /* -** Compute a string length that is limited to what can be stored in -** lower 30 bits of a 32-bit signed integer. +** Check to see if we have timer support. Return 1 if necessary +** support found (or found previously). */ -static int strlen30(const char *z){ - const char *z2 = z; - while( *z2 ){ z2++; } - return 0x3fffffff & (int)(z2 - z); +static int hasTimer(void){ + if( getProcessTimesAddr ){ + return 1; + } else { +#if !SQLITE_OS_WINRT + /* GetProcessTimes() isn't supported in WIN95 and some other Windows + ** versions. See if the version we are running on has it, and if it + ** does, save off a pointer to it and the current process handle. + */ + hProcess = GetCurrentProcess(); + if( hProcess ){ + HINSTANCE hinstLib = LoadLibrary(TEXT("Kernel32.dll")); + if( NULL != hinstLib ){ + getProcessTimesAddr = + (GETPROCTIMES) GetProcAddress(hinstLib, "GetProcessTimes"); + if( NULL != getProcessTimesAddr ){ + return 1; + } + FreeLibrary(hinstLib); + } + } +#endif + } + return 0; } /* -** Return the length of a string in characters. Multibyte UTF8 characters -** count as a single character. +** Begin timing an operation */ -static int strlenChar(const char *z){ - int n = 0; - while( *z ){ - if( (0xc0&*(z++))!=0x80 ) n++; +static void beginTimer(void){ + if( enableTimer && getProcessTimesAddr ){ + FILETIME ftCreation, ftExit; + getProcessTimesAddr(hProcess,&ftCreation,&ftExit, + &ftKernelBegin,&ftUserBegin); + ftWallBegin = timeOfDay(); } - return n; +} + +/* Return the difference of two FILETIME structs in seconds */ +static double timeDiff(FILETIME *pStart, FILETIME *pEnd){ + sqlite_int64 i64Start = *((sqlite_int64 *) pStart); + sqlite_int64 i64End = *((sqlite_int64 *) pEnd); + return (double) ((i64End - i64Start) / 10000000.0); } /* -** Return open FILE * if zFile exists, can be opened for read -** and is an ordinary file or a character stream source. -** Otherwise return 0. +** Print the timing results. */ -static FILE * openChrSource(const char *zFile){ -#ifdef _WIN32 - struct _stat x = {0}; -# define STAT_CHR_SRC(mode) ((mode & (_S_IFCHR|_S_IFIFO|_S_IFREG))!=0) - /* On Windows, open first, then check the stream nature. This order - ** is necessary because _stat() and sibs, when checking a named pipe, - ** effectively break the pipe as its supplier sees it. */ - FILE *rv = fopen(zFile, "rb"); - if( rv==0 ) return 0; - if( _fstat(_fileno(rv), &x) != 0 - || !STAT_CHR_SRC(x.st_mode)){ - fclose(rv); - rv = 0; +static void endTimer(void){ + if( enableTimer && getProcessTimesAddr){ + FILETIME ftCreation, ftExit, ftKernelEnd, ftUserEnd; + sqlite3_int64 ftWallEnd = timeOfDay(); + getProcessTimesAddr(hProcess,&ftCreation,&ftExit,&ftKernelEnd,&ftUserEnd); + sputf(stdout, "Run Time: real %.3f user %f sys %f\n", + (ftWallEnd - ftWallBegin)*0.001, + timeDiff(&ftUserBegin, &ftUserEnd), + timeDiff(&ftKernelBegin, &ftKernelEnd)); } - return rv; +} + +#define BEGIN_TIMER beginTimer() +#define END_TIMER endTimer() +#define HAS_TIMER hasTimer() + #else - struct stat x = {0}; - int rc = stat(zFile, &x); -# define STAT_CHR_SRC(mode) (S_ISREG(mode)||S_ISFIFO(mode)||S_ISCHR(mode)) - if( rc!=0 ) return 0; - if( STAT_CHR_SRC(x.st_mode) ){ - return fopen(zFile, "rb"); - }else{ - return 0; - } +#define BEGIN_TIMER +#define END_TIMER +#define HAS_TIMER 0 #endif -#undef STAT_CHR_SRC -} /* -** This routine reads a line of text from FILE in, stores -** the text in memory obtained from malloc() and returns a pointer -** to the text. NULL is returned at end of file, or if malloc() -** fails. -** -** If zLine is not NULL then it is a malloced buffer returned from -** a previous call to this routine that may be reused. +** Used to prevent warnings about unused parameters */ -static char *local_getline(char *zLine, FILE *in){ - int nLine = zLine==0 ? 0 : 100; - int n = 0; - - while( 1 ){ - if( n+100>nLine ){ - nLine = nLine*2 + 100; - zLine = realloc(zLine, nLine); - shell_check_oom(zLine); - } - if( fgets(&zLine[n], nLine - n, in)==0 ){ - if( n==0 ){ - free(zLine); - return 0; - } - zLine[n] = 0; - break; - } - while( zLine[n] ) n++; - if( n>0 && zLine[n-1]=='\n' ){ - n--; - if( n>0 && zLine[n-1]=='\r' ) n--; - zLine[n] = 0; - break; - } - } -#if defined(_WIN32) || defined(WIN32) - /* For interactive input on Windows systems, without -utf8, - ** translate the multi-byte characterset characters into UTF-8. - ** This is the translation that predates the -utf8 option. */ - if( stdin_is_interactive && in==stdin -# if SHELL_WIN_UTF8_OPT - && !console_utf8 -# endif /* SHELL_WIN_UTF8_OPT */ - ){ - char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0); - if( zTrans ){ - i64 nTrans = strlen(zTrans)+1; - if( nTrans>nLine ){ - zLine = realloc(zLine, nTrans); - shell_check_oom(zLine); - } - memcpy(zLine, zTrans, nTrans); - sqlite3_free(zTrans); - } - } -#endif /* defined(_WIN32) || defined(WIN32) */ - return zLine; -} +#define UNUSED_PARAMETER(x) (void)(x) /* -** Retrieve a single line of input text. -** -** If in==0 then read from standard input and prompt before each line. -** If isContinuation is true, then a continuation prompt is appropriate. -** If isContinuation is zero, then the main prompt should be used. -** -** If zPrior is not NULL then it is a buffer from a prior call to this -** routine that can be reused. -** -** The result is stored in space obtained from malloc() and must either -** be freed by the caller or else passed back into this routine via the -** zPrior argument for reuse. +** Number of elements in an array */ -#ifndef SQLITE_SHELL_FIDDLE -static char *one_input_line(FILE *in, char *zPrior, int isContinuation){ - char *zPrompt; - char *zResult; - if( in!=0 ){ - zResult = local_getline(zPrior, in); - }else{ - zPrompt = isContinuation ? CONTINUATION_PROMPT : mainPrompt; -#if SHELL_USE_LOCAL_GETLINE - printf("%s", zPrompt); - fflush(stdout); - do{ - zResult = local_getline(zPrior, stdin); - zPrior = 0; - /* ^C trap creates a false EOF, so let "interrupt" thread catch up. */ - if( zResult==0 ) sqlite3_sleep(50); - }while( zResult==0 && seenInterrupt>0 ); -#else - free(zPrior); - zResult = shell_readline(zPrompt); - while( zResult==0 ){ - /* ^C trap creates a false EOF, so let "interrupt" thread catch up. */ - sqlite3_sleep(50); - if( seenInterrupt==0 ) break; - zResult = shell_readline(""); - } - if( zResult && *zResult ) shell_add_history(zResult); -#endif - } - return zResult; -} -#endif /* !SQLITE_SHELL_FIDDLE */ +#define ArraySize(X) (int)(sizeof(X)/sizeof(X[0])) /* -** Return the value of a hexadecimal digit. Return -1 if the input -** is not a hex digit. +** If the following flag is set, then command execution stops +** at an error if we are not interactive. */ -static int hexDigitValue(char c){ - if( c>='0' && c<='9' ) return c - '0'; - if( c>='a' && c<='f' ) return c - 'a' + 10; - if( c>='A' && c<='F' ) return c - 'A' + 10; - return -1; -} +static int bail_on_error = 0; /* -** Interpret zArg as an integer value, possibly with suffixes. +** Treat stdin as an interactive input if the following variable +** is true. Otherwise, assume stdin is connected to a file or pipe. */ -static sqlite3_int64 integerValue(const char *zArg){ - sqlite3_int64 v = 0; - static const struct { char *zSuffix; int iMult; } aMult[] = { - { "KiB", 1024 }, - { "MiB", 1024*1024 }, - { "GiB", 1024*1024*1024 }, - { "KB", 1000 }, - { "MB", 1000000 }, - { "GB", 1000000000 }, - { "K", 1000 }, - { "M", 1000000 }, - { "G", 1000000000 }, - }; - int i; - int isNeg = 0; - if( zArg[0]=='-' ){ - isNeg = 1; - zArg++; - }else if( zArg[0]=='+' ){ - zArg++; - } - if( zArg[0]=='0' && zArg[1]=='x' ){ - int x; - zArg += 2; - while( (x = hexDigitValue(zArg[0]))>=0 ){ - v = (v<<4) + x; - zArg++; - } - }else{ - while( IsDigit(zArg[0]) ){ - v = v*10 + zArg[0] - '0'; - zArg++; - } - } - for(i=0; iz); - initText(p); -} +static sqlite3 *globalDb = 0; -/* zIn is either a pointer to a NULL-terminated string in memory obtained -** from malloc(), or a NULL pointer. The string pointed to by zAppend is -** added to zIn, and the result returned in memory obtained from malloc(). -** zIn, if it was not NULL, is freed. -** -** If the third argument, quote, is not '\0', then it is used as a -** quote character for zAppend. +/* +** True if an interrupt (Control-C) has been received. */ -static void appendText(ShellText *p, const char *zAppend, char quote){ - i64 len; - i64 i; - i64 nAppend = strlen30(zAppend); - - len = nAppend+p->n+1; - if( quote ){ - len += 2; - for(i=0; iz==0 || p->n+len>=p->nAlloc ){ - p->nAlloc = p->nAlloc*2 + len + 20; - p->z = realloc(p->z, p->nAlloc); - shell_check_oom(p->z); - } +static volatile int seenInterrupt = 0; - if( quote ){ - char *zCsr = p->z+p->n; - *zCsr++ = quote; - for(i=0; in = (int)(zCsr - p->z); - *zCsr = '\0'; - }else{ - memcpy(p->z+p->n, zAppend, nAppend); - p->n += nAppend; - p->z[p->n] = '\0'; - } -} +/* +** This is the name of our program. It is set in main(), used +** in a number of other places, mostly for error messages. +*/ +static char *Argv0; /* -** Attempt to determine if identifier zName needs to be quoted, either -** because it contains non-alphanumeric characters, or because it is an -** SQLite keyword. Be conservative in this estimate: When in doubt assume -** that quoting is required. -** -** Return '"' if quoting is required. Return 0 if no quoting is required. +** Prompt strings. Initialized in main. Settable with +** .prompt main continue */ -static char quoteChar(const char *zName){ - int i; - if( zName==0 ) return '"'; - if( !isalpha((unsigned char)zName[0]) && zName[0]!='_' ) return '"'; - for(i=0; zName[i]; i++){ - if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ) return '"'; - } - return sqlite3_keyword_check(zName, i) ? '"' : 0; +#define PROMPT_LEN_MAX 20 +/* First line prompt. default: "sqlite> " */ +static char mainPrompt[PROMPT_LEN_MAX]; +/* Continuation prompt. default: " ...> " */ +static char continuePrompt[PROMPT_LEN_MAX]; + +/* This is variant of the standard-library strncpy() routine with the +** one change that the destination string is always zero-terminated, even +** if there is no zero-terminator in the first n-1 characters of the source +** string. +*/ +static char *shell_strncpy(char *dest, const char *src, size_t n){ + size_t i; + for(i=0; iinParenLevel += ni; + if( ni==0 ) p->inParenLevel = 0; + p->zScannerAwaits = 0; +} + +/* Record that a lexeme is opened, or closed with args==0. */ +static void setLexemeOpen(struct DynaPrompt *p, char *s, char c){ + if( s!=0 || c==0 ){ + p->zScannerAwaits = s; + p->acAwait[0] = 0; + }else{ + p->acAwait[0] = c; + p->zScannerAwaits = p->acAwait; } - appendText(&s, ")", 0); - sqlite3_finalize(pStmt); - if( nRow==0 ){ - freeText(&s); - s.z = 0; +} + +/* Upon demand, derive the continuation prompt to display. */ +static char *dynamicContinuePrompt(void){ + if( continuePrompt[0]==0 + || (dynPrompt.zScannerAwaits==0 && dynPrompt.inParenLevel == 0) ){ + return continuePrompt; + }else{ + if( dynPrompt.zScannerAwaits ){ + size_t ncp = strlen(continuePrompt); + size_t ndp = strlen(dynPrompt.zScannerAwaits); + if( ndp > ncp-3 ) return continuePrompt; + strcpy(dynPrompt.dynamicPrompt, dynPrompt.zScannerAwaits); + while( ndp<3 ) dynPrompt.dynamicPrompt[ndp++] = ' '; + shell_strncpy(dynPrompt.dynamicPrompt+3, continuePrompt+3, + PROMPT_LEN_MAX-4); + }else{ + if( dynPrompt.inParenLevel>9 ){ + shell_strncpy(dynPrompt.dynamicPrompt, "(..", 4); + }else if( dynPrompt.inParenLevel<0 ){ + shell_strncpy(dynPrompt.dynamicPrompt, ")x!", 4); + }else{ + shell_strncpy(dynPrompt.dynamicPrompt, "(x.", 4); + dynPrompt.dynamicPrompt[2] = (char)('0'+dynPrompt.inParenLevel); + } + shell_strncpy(dynPrompt.dynamicPrompt+3, continuePrompt+3, + PROMPT_LEN_MAX-4); + } } - return s.z; + return dynPrompt.dynamicPrompt; +} +#endif /* !defined(SQLITE_OMIT_DYNAPROMPT) */ + +/* Indicate out-of-memory and exit. */ +static void shell_out_of_memory(void){ + eputz("Error: out of memory\n"); + exit(1); +} + +/* Check a pointer to see if it is NULL. If it is NULL, exit with an +** out-of-memory error. +*/ +static void shell_check_oom(const void *p){ + if( p==0 ) shell_out_of_memory(); } /* -** SQL function: strtod(X) -** -** Use the C-library strtod() function to convert string X into a double. -** Used for comparing the accuracy of SQLite's internal text-to-float conversion -** routines against the C-library. +** Write I/O traces to the following stream. */ -static void shellStrtod( - sqlite3_context *pCtx, - int nVal, - sqlite3_value **apVal -){ - char *z = (char*)sqlite3_value_text(apVal[0]); - UNUSED_PARAMETER(nVal); - if( z==0 ) return; - sqlite3_result_double(pCtx, strtod(z,0)); +#ifdef SQLITE_ENABLE_IOTRACE +static FILE *iotrace = 0; +#endif + +/* +** This routine works like printf in that its first argument is a +** format string and subsequent arguments are values to be substituted +** in place of % fields. The result of formatting this string +** is written to iotrace. +*/ +#ifdef SQLITE_ENABLE_IOTRACE +static void SQLITE_CDECL iotracePrintf(const char *zFormat, ...){ + va_list ap; + char *z; + if( iotrace==0 ) return; + va_start(ap, zFormat); + z = sqlite3_vmprintf(zFormat, ap); + va_end(ap); + sputf(iotrace, "%s", z); + sqlite3_free(z); } +#endif /* -** SQL function: dtostr(X) -** -** Use the C-library printf() function to convert real value X into a string. -** Used for comparing the accuracy of SQLite's internal float-to-text conversion -** routines against the C-library. +** Output string zUtf to Out stream as w characters. If w is negative, +** then right-justify the text. W is the width in UTF-8 characters, not +** in bytes. This is different from the %*.*s specification in printf +** since with %*.*s the width is measured in bytes, not characters. */ -static void shellDtostr( - sqlite3_context *pCtx, - int nVal, - sqlite3_value **apVal -){ - double r = sqlite3_value_double(apVal[0]); - int n = nVal>=2 ? sqlite3_value_int(apVal[1]) : 26; - char z[400]; - if( n<1 ) n = 1; - if( n>350 ) n = 350; - sprintf(z, "%#+.*e", n, r); - sqlite3_result_text(pCtx, z, -1, SQLITE_TRANSIENT); +static void utf8_width_print(int w, const char *zUtf){ + int i; + int n; + int aw = w<0 ? -w : w; + if( zUtf==0 ) zUtf = ""; + for(i=n=0; zUtf[i]; i++){ + if( (zUtf[i]&0xc0)!=0x80 ){ + n++; + if( n==aw ){ + do{ i++; }while( (zUtf[i]&0xc0)==0x80 ); + break; + } + } + } + if( n>=aw ){ + oputf("%.*s", i, zUtf); + }else if( w<0 ){ + oputf("%*s%s", aw-n, "", zUtf); + }else{ + oputf("%s%*s", zUtf, aw-n, ""); + } } /* -** SQL function: shell_module_schema(X) -** -** Return a fake schema for the table-valued function or eponymous virtual -** table X. +** Determines if a string is a number of not. */ -static void shellModuleSchema( - sqlite3_context *pCtx, - int nVal, - sqlite3_value **apVal -){ - const char *zName; - char *zFake; - UNUSED_PARAMETER(nVal); - zName = (const char*)sqlite3_value_text(apVal[0]); - zFake = zName? shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName) : 0; - if( zFake ){ - sqlite3_result_text(pCtx, sqlite3_mprintf("/* %s */", zFake), - -1, sqlite3_free); - free(zFake); +static int isNumber(const char *z, int *realnum){ + if( *z=='-' || *z=='+' ) z++; + if( !IsDigit(*z) ){ + return 0; + } + z++; + if( realnum ) *realnum = 0; + while( IsDigit(*z) ){ z++; } + if( *z=='.' ){ + z++; + if( !IsDigit(*z) ) return 0; + while( IsDigit(*z) ){ z++; } + if( realnum ) *realnum = 1; + } + if( *z=='e' || *z=='E' ){ + z++; + if( *z=='+' || *z=='-' ) z++; + if( !IsDigit(*z) ) return 0; + while( IsDigit(*z) ){ z++; } + if( realnum ) *realnum = 1; } + return *z==0; } /* -** SQL function: shell_add_schema(S,X) -** -** Add the schema name X to the CREATE statement in S and return the result. -** Examples: -** -** CREATE TABLE t1(x) -> CREATE TABLE xyz.t1(x); -** -** Also works on -** -** CREATE INDEX -** CREATE UNIQUE INDEX -** CREATE VIEW -** CREATE TRIGGER -** CREATE VIRTUAL TABLE -** -** This UDF is used by the .schema command to insert the schema name of -** attached databases into the middle of the sqlite_schema.sql field. +** Compute a string length that is limited to what can be stored in +** lower 30 bits of a 32-bit signed integer. */ -static void shellAddSchemaName( - sqlite3_context *pCtx, - int nVal, - sqlite3_value **apVal -){ - static const char *aPrefix[] = { - "TABLE", - "INDEX", - "UNIQUE INDEX", - "VIEW", - "TRIGGER", - "VIRTUAL TABLE" - }; - int i = 0; - const char *zIn = (const char*)sqlite3_value_text(apVal[0]); - const char *zSchema = (const char*)sqlite3_value_text(apVal[1]); - const char *zName = (const char*)sqlite3_value_text(apVal[2]); - sqlite3 *db = sqlite3_context_db_handle(pCtx); - UNUSED_PARAMETER(nVal); - if( zIn!=0 && cli_strncmp(zIn, "CREATE ", 7)==0 ){ - for(i=0; inLine ){ + nLine = nLine*2 + 100; + zLine = realloc(zLine, nLine); + shell_check_oom(zLine); + } + if( fgets(&zLine[n], nLine - n, in)==0 ){ + if( n==0 ){ + free(zLine); + return 0; + } + zLine[n] = 0; + break; + } + while( zLine[n] ) n++; + if( n>0 && zLine[n-1]=='\n' ){ + n--; + if( n>0 && zLine[n-1]=='\r' ) n--; + zLine[n] = 0; + break; + } + } + return zLine; +} /* -** We need several data types from the Windows SDK header. +** Retrieve a single line of input text. +** +** If in==0 then read from standard input and prompt before each line. +** If isContinuation is true, then a continuation prompt is appropriate. +** If isContinuation is zero, then the main prompt should be used. +** +** If zPrior is not NULL then it is a buffer from a prior call to this +** routine that can be reused. +** +** The result is stored in space obtained from malloc() and must either +** be freed by the caller or else passed back into this routine via the +** zPrior argument for reuse. */ - -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN +#ifndef SQLITE_SHELL_FIDDLE +static char *one_input_line(FILE *in, char *zPrior, int isContinuation){ + char *zPrompt; + char *zResult; + if( in!=0 ){ + zResult = local_getline(zPrior, in); + }else{ + zPrompt = isContinuation ? CONTINUATION_PROMPT : mainPrompt; +#if SHELL_USE_LOCAL_GETLINE + sputz(stdout, zPrompt); + fflush(stdout); + do{ + zResult = local_getline(zPrior, stdin); + zPrior = 0; + /* ^C trap creates a false EOF, so let "interrupt" thread catch up. */ + if( zResult==0 ) sqlite3_sleep(50); + }while( zResult==0 && seenInterrupt>0 ); +#else + free(zPrior); + zResult = shell_readline(zPrompt); + while( zResult==0 ){ + /* ^C trap creates a false EOF, so let "interrupt" thread catch up. */ + sqlite3_sleep(50); + if( seenInterrupt==0 ) break; + zResult = shell_readline(""); + } + if( zResult && *zResult ) shell_add_history(zResult); #endif - -#include "windows.h" + } + return zResult; +} +#endif /* !SQLITE_SHELL_FIDDLE */ /* -** We need several support functions from the SQLite core. +** Return the value of a hexadecimal digit. Return -1 if the input +** is not a hex digit. */ - -/* #include "sqlite3.h" */ +static int hexDigitValue(char c){ + if( c>='0' && c<='9' ) return c - '0'; + if( c>='a' && c<='f' ) return c - 'a' + 10; + if( c>='A' && c<='F' ) return c - 'A' + 10; + return -1; +} /* -** We need several things from the ANSI and MSVCRT headers. +** Interpret zArg as an integer value, possibly with suffixes. */ - -#include -#include -#include -#include -#include -#include -#include +static sqlite3_int64 integerValue(const char *zArg){ + sqlite3_int64 v = 0; + static const struct { char *zSuffix; int iMult; } aMult[] = { + { "KiB", 1024 }, + { "MiB", 1024*1024 }, + { "GiB", 1024*1024*1024 }, + { "KB", 1000 }, + { "MB", 1000000 }, + { "GB", 1000000000 }, + { "K", 1000 }, + { "M", 1000000 }, + { "G", 1000000000 }, + }; + int i; + int isNeg = 0; + if( zArg[0]=='-' ){ + isNeg = 1; + zArg++; + }else if( zArg[0]=='+' ){ + zArg++; + } + if( zArg[0]=='0' && zArg[1]=='x' ){ + int x; + zArg += 2; + while( (x = hexDigitValue(zArg[0]))>=0 ){ + v = (v<<4) + x; + zArg++; + } + }else{ + while( IsDigit(zArg[0]) ){ + v = v*10 + zArg[0] - '0'; + zArg++; + } + } + for(i=0; iz); + initText(p); +} -#ifndef MODE_T_DEFINED - #define MODE_T_DEFINED - typedef unsigned short mode_t; -#endif - -/* -** We may need to provide the "ino_t" type. +/* zIn is either a pointer to a NULL-terminated string in memory obtained +** from malloc(), or a NULL pointer. The string pointed to by zAppend is +** added to zIn, and the result returned in memory obtained from malloc(). +** zIn, if it was not NULL, is freed. +** +** If the third argument, quote, is not '\0', then it is used as a +** quote character for zAppend. */ +static void appendText(ShellText *p, const char *zAppend, char quote){ + i64 len; + i64 i; + i64 nAppend = strlen30(zAppend); -#ifndef INO_T_DEFINED - #define INO_T_DEFINED - typedef unsigned short ino_t; -#endif + len = nAppend+p->n+1; + if( quote ){ + len += 2; + for(i=0; iz==0 || p->n+len>=p->nAlloc ){ + p->nAlloc = p->nAlloc*2 + len + 20; + p->z = realloc(p->z, p->nAlloc); + shell_check_oom(p->z); + } -#ifndef NAME_MAX -# ifdef FILENAME_MAX -# define NAME_MAX (FILENAME_MAX) -# else -# define NAME_MAX (260) -# endif -#endif + if( quote ){ + char *zCsr = p->z+p->n; + *zCsr++ = quote; + for(i=0; in = (int)(zCsr - p->z); + *zCsr = '\0'; + }else{ + memcpy(p->z+p->n, zAppend, nAppend); + p->n += nAppend; + p->z[p->n] = '\0'; + } +} /* -** We need to define "NULL_INTPTR_T" and "BAD_INTPTR_T". +** Attempt to determine if identifier zName needs to be quoted, either +** because it contains non-alphanumeric characters, or because it is an +** SQLite keyword. Be conservative in this estimate: When in doubt assume +** that quoting is required. +** +** Return '"' if quoting is required. Return 0 if no quoting is required. */ - -#ifndef NULL_INTPTR_T -# define NULL_INTPTR_T ((intptr_t)(0)) -#endif - -#ifndef BAD_INTPTR_T -# define BAD_INTPTR_T ((intptr_t)(-1)) -#endif +static char quoteChar(const char *zName){ + int i; + if( zName==0 ) return '"'; + if( !isalpha((unsigned char)zName[0]) && zName[0]!='_' ) return '"'; + for(i=0; zName[i]; i++){ + if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ) return '"'; + } + return sqlite3_keyword_check(zName, i) ? '"' : 0; +} /* -** We need to provide the necessary structures and related types. +** Construct a fake object name and column list to describe the structure +** of the view, virtual table, or table valued function zSchema.zName. */ +static char *shellFakeSchema( + sqlite3 *db, /* The database connection containing the vtab */ + const char *zSchema, /* Schema of the database holding the vtab */ + const char *zName /* The name of the virtual table */ +){ + sqlite3_stmt *pStmt = 0; + char *zSql; + ShellText s; + char cQuote; + char *zDiv = "("; + int nRow = 0; -#ifndef DIRENT_DEFINED -#define DIRENT_DEFINED -typedef struct DIRENT DIRENT; -typedef DIRENT *LPDIRENT; -struct DIRENT { - ino_t d_ino; /* Sequence number, do not use. */ - unsigned d_attributes; /* Win32 file attributes. */ - char d_name[NAME_MAX + 1]; /* Name within the directory. */ -}; -#endif - -#ifndef DIR_DEFINED -#define DIR_DEFINED -typedef struct DIR DIR; -typedef DIR *LPDIR; -struct DIR { - intptr_t d_handle; /* Value returned by "_findfirst". */ - DIRENT d_first; /* DIRENT constructed based on "_findfirst". */ - DIRENT d_next; /* DIRENT constructed based on "_findnext". */ -}; -#endif + zSql = sqlite3_mprintf("PRAGMA \"%w\".table_info=%Q;", + zSchema ? zSchema : "main", zName); + shell_check_oom(zSql); + sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); + sqlite3_free(zSql); + initText(&s); + if( zSchema ){ + cQuote = quoteChar(zSchema); + if( cQuote && sqlite3_stricmp(zSchema,"temp")==0 ) cQuote = 0; + appendText(&s, zSchema, cQuote); + appendText(&s, ".", 0); + } + cQuote = quoteChar(zName); + appendText(&s, zName, cQuote); + while( sqlite3_step(pStmt)==SQLITE_ROW ){ + const char *zCol = (const char*)sqlite3_column_text(pStmt, 1); + nRow++; + appendText(&s, zDiv, 0); + zDiv = ","; + if( zCol==0 ) zCol = ""; + cQuote = quoteChar(zCol); + appendText(&s, zCol, cQuote); + } + appendText(&s, ")", 0); + sqlite3_finalize(pStmt); + if( nRow==0 ){ + freeText(&s); + s.z = 0; + } + return s.z; +} /* -** Provide a macro, for use by the implementation, to determine if a -** particular directory entry should be skipped over when searching for -** the next directory entry that should be returned by the readdir() or -** readdir_r() functions. +** SQL function: strtod(X) +** +** Use the C-library strtod() function to convert string X into a double. +** Used for comparing the accuracy of SQLite's internal text-to-float conversion +** routines against the C-library. */ - -#ifndef is_filtered -# define is_filtered(a) ((((a).attrib)&_A_HIDDEN) || (((a).attrib)&_A_SYSTEM)) -#endif +static void shellStrtod( + sqlite3_context *pCtx, + int nVal, + sqlite3_value **apVal +){ + char *z = (char*)sqlite3_value_text(apVal[0]); + UNUSED_PARAMETER(nVal); + if( z==0 ) return; + sqlite3_result_double(pCtx, strtod(z,0)); +} /* -** Provide the function prototype for the POSIX compatible getenv() -** function. This function is not thread-safe. +** SQL function: dtostr(X) +** +** Use the C-library printf() function to convert real value X into a string. +** Used for comparing the accuracy of SQLite's internal float-to-text conversion +** routines against the C-library. */ +static void shellDtostr( + sqlite3_context *pCtx, + int nVal, + sqlite3_value **apVal +){ + double r = sqlite3_value_double(apVal[0]); + int n = nVal>=2 ? sqlite3_value_int(apVal[1]) : 26; + char z[400]; + if( n<1 ) n = 1; + if( n>350 ) n = 350; + sqlite3_snprintf(sizeof(z), z, "%#+.*e", n, r); + sqlite3_result_text(pCtx, z, -1, SQLITE_TRANSIENT); +} -extern const char *windirent_getenv(const char *name); /* -** Finally, we can provide the function prototypes for the opendir(), -** readdir(), readdir_r(), and closedir() POSIX functions. +** SQL function: shell_module_schema(X) +** +** Return a fake schema for the table-valued function or eponymous virtual +** table X. */ +static void shellModuleSchema( + sqlite3_context *pCtx, + int nVal, + sqlite3_value **apVal +){ + const char *zName; + char *zFake; + UNUSED_PARAMETER(nVal); + zName = (const char*)sqlite3_value_text(apVal[0]); + zFake = zName? shellFakeSchema(sqlite3_context_db_handle(pCtx), 0, zName) : 0; + if( zFake ){ + sqlite3_result_text(pCtx, sqlite3_mprintf("/* %s */", zFake), + -1, sqlite3_free); + free(zFake); + } +} -extern LPDIR opendir(const char *dirname); -extern LPDIRENT readdir(LPDIR dirp); -extern INT readdir_r(LPDIR dirp, LPDIRENT entry, LPDIRENT *result); -extern INT closedir(LPDIR dirp); - -#endif /* defined(WIN32) && defined(_MSC_VER) */ - -/************************* End test_windirent.h ********************/ -/************************* Begin test_windirent.c ******************/ /* -** 2015 November 30 +** SQL function: shell_add_schema(S,X) ** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: +** Add the schema name X to the CREATE statement in S and return the result. +** Examples: ** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. +** CREATE TABLE t1(x) -> CREATE TABLE xyz.t1(x); ** -************************************************************************* -** This file contains code to implement most of the opendir() family of -** POSIX functions on Win32 using the MSVCRT. -*/ - -#if defined(_WIN32) && defined(_MSC_VER) +** Also works on +** +** CREATE INDEX +** CREATE UNIQUE INDEX +** CREATE VIEW +** CREATE TRIGGER +** CREATE VIRTUAL TABLE +** +** This UDF is used by the .schema command to insert the schema name of +** attached databases into the middle of the sqlite_schema.sql field. +*/ +static void shellAddSchemaName( + sqlite3_context *pCtx, + int nVal, + sqlite3_value **apVal +){ + static const char *aPrefix[] = { + "TABLE", + "INDEX", + "UNIQUE INDEX", + "VIEW", + "TRIGGER", + "VIRTUAL TABLE" + }; + int i = 0; + const char *zIn = (const char*)sqlite3_value_text(apVal[0]); + const char *zSchema = (const char*)sqlite3_value_text(apVal[1]); + const char *zName = (const char*)sqlite3_value_text(apVal[2]); + sqlite3 *db = sqlite3_context_db_handle(pCtx); + UNUSED_PARAMETER(nVal); + if( zIn!=0 && cli_strncmp(zIn, "CREATE ", 7)==0 ){ + for(i=0; i +#include +#include +#include +#include +#include +#include + +/* +** We may need several defines that should have been in "sys/stat.h". +*/ + +#ifndef S_ISREG +#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) +#endif + +#ifndef S_ISDIR +#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) +#endif + +#ifndef S_ISLNK +#define S_ISLNK(mode) (0) +#endif + +/* +** We may need to provide the "mode_t" type. +*/ + +#ifndef MODE_T_DEFINED + #define MODE_T_DEFINED + typedef unsigned short mode_t; +#endif + +/* +** We may need to provide the "ino_t" type. +*/ + +#ifndef INO_T_DEFINED + #define INO_T_DEFINED + typedef unsigned short ino_t; +#endif + +/* +** We need to define "NAME_MAX" if it was not present in "limits.h". +*/ + +#ifndef NAME_MAX +# ifdef FILENAME_MAX +# define NAME_MAX (FILENAME_MAX) +# else +# define NAME_MAX (260) +# endif +#endif + +/* +** We need to define "NULL_INTPTR_T" and "BAD_INTPTR_T". +*/ + +#ifndef NULL_INTPTR_T +# define NULL_INTPTR_T ((intptr_t)(0)) +#endif + +#ifndef BAD_INTPTR_T +# define BAD_INTPTR_T ((intptr_t)(-1)) +#endif + +/* +** We need to provide the necessary structures and related types. +*/ + +#ifndef DIRENT_DEFINED +#define DIRENT_DEFINED +typedef struct DIRENT DIRENT; +typedef DIRENT *LPDIRENT; +struct DIRENT { + ino_t d_ino; /* Sequence number, do not use. */ + unsigned d_attributes; /* Win32 file attributes. */ + char d_name[NAME_MAX + 1]; /* Name within the directory. */ +}; +#endif + +#ifndef DIR_DEFINED +#define DIR_DEFINED +typedef struct DIR DIR; +typedef DIR *LPDIR; +struct DIR { + intptr_t d_handle; /* Value returned by "_findfirst". */ + DIRENT d_first; /* DIRENT constructed based on "_findfirst". */ + DIRENT d_next; /* DIRENT constructed based on "_findnext". */ +}; +#endif + +/* +** Provide a macro, for use by the implementation, to determine if a +** particular directory entry should be skipped over when searching for +** the next directory entry that should be returned by the readdir() or +** readdir_r() functions. +*/ + +#ifndef is_filtered +# define is_filtered(a) ((((a).attrib)&_A_HIDDEN) || (((a).attrib)&_A_SYSTEM)) +#endif + +/* +** Provide the function prototype for the POSIX compatible getenv() +** function. This function is not thread-safe. +*/ + +extern const char *windirent_getenv(const char *name); + +/* +** Finally, we can provide the function prototypes for the opendir(), +** readdir(), readdir_r(), and closedir() POSIX functions. +*/ + +extern LPDIR opendir(const char *dirname); +extern LPDIRENT readdir(LPDIR dirp); +extern INT readdir_r(LPDIR dirp, LPDIRENT entry, LPDIRENT *result); +extern INT closedir(LPDIR dirp); + +#endif /* defined(WIN32) && defined(_MSC_VER) */ + +/************************* End test_windirent.h ********************/ +/************************* Begin test_windirent.c ******************/ +/* +** 2015 November 30 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This file contains code to implement most of the opendir() family of +** POSIX functions on Win32 using the MSVCRT. +*/ + +#if defined(_WIN32) && defined(_MSC_VER) /* #include "test_windirent.h" */ /* @@ -4918,16 +5731,20 @@ SQLITE_EXTENSION_INIT1 ** index is ix. The 0th member is given by smBase. The sequence members ** progress per ix increment by smStep. */ -static sqlite3_int64 genSeqMember(sqlite3_int64 smBase, - sqlite3_int64 smStep, - sqlite3_uint64 ix){ - if( ix>=(sqlite3_uint64)LLONG_MAX ){ +static sqlite3_int64 genSeqMember( + sqlite3_int64 smBase, + sqlite3_int64 smStep, + sqlite3_uint64 ix +){ + static const sqlite3_uint64 mxI64 = + ((sqlite3_uint64)0x7fffffff)<<32 | 0xffffffff; + if( ix>=mxI64 ){ /* Get ix into signed i64 range. */ - ix -= (sqlite3_uint64)LLONG_MAX; + ix -= mxI64; /* With 2's complement ALU, this next can be 1 step, but is split into * 2 for UBSAN's satisfaction (and hypothetical 1's complement ALUs.) */ - smBase += (LLONG_MAX/2) * smStep; - smBase += (LLONG_MAX - LLONG_MAX/2) * smStep; + smBase += (mxI64/2) * smStep; + smBase += (mxI64 - mxI64/2) * smStep; } /* Under UBSAN (or on 1's complement machines), must do this last term * in steps to avoid the dreaded (and harmless) signed multiply overlow. */ @@ -5187,13 +6004,13 @@ static int seriesEof(sqlite3_vtab_cursor *cur){ ** parameter. (idxStr is not used in this implementation.) idxNum ** is a bitmask showing which constraints are available: ** -** 1: start=VALUE -** 2: stop=VALUE -** 4: step=VALUE -** -** Also, if bit 8 is set, that means that the series should be output -** in descending order rather than in ascending order. If bit 16 is -** set, then output must appear in ascending order. +** 0x01: start=VALUE +** 0x02: stop=VALUE +** 0x04: step=VALUE +** 0x08: descending order +** 0x10: ascending order +** 0x20: LIMIT VALUE +** 0x40: OFFSET VALUE ** ** This routine should initialize the cursor and position it so that it ** is pointing at the first row, or pointing off the end of the table @@ -5207,26 +6024,44 @@ static int seriesFilter( series_cursor *pCur = (series_cursor *)pVtabCursor; int i = 0; (void)idxStrUnused; - if( idxNum & 1 ){ + if( idxNum & 0x01 ){ pCur->ss.iBase = sqlite3_value_int64(argv[i++]); }else{ pCur->ss.iBase = 0; } - if( idxNum & 2 ){ + if( idxNum & 0x02 ){ pCur->ss.iTerm = sqlite3_value_int64(argv[i++]); }else{ pCur->ss.iTerm = 0xffffffff; } - if( idxNum & 4 ){ + if( idxNum & 0x04 ){ pCur->ss.iStep = sqlite3_value_int64(argv[i++]); if( pCur->ss.iStep==0 ){ pCur->ss.iStep = 1; }else if( pCur->ss.iStep<0 ){ - if( (idxNum & 16)==0 ) idxNum |= 8; + if( (idxNum & 0x10)==0 ) idxNum |= 0x08; } }else{ pCur->ss.iStep = 1; } + if( idxNum & 0x20 ){ + sqlite3_int64 iLimit = sqlite3_value_int64(argv[i++]); + sqlite3_int64 iTerm; + if( idxNum & 0x40 ){ + sqlite3_int64 iOffset = sqlite3_value_int64(argv[i++]); + if( iOffset>0 ){ + pCur->ss.iBase += pCur->ss.iStep*iOffset; + } + } + if( iLimit>=0 ){ + iTerm = pCur->ss.iBase + (iLimit - 1)*pCur->ss.iStep; + if( pCur->ss.iStep<0 ){ + if( iTerm>pCur->ss.iTerm ) pCur->ss.iTerm = iTerm; + }else{ + if( iTermss.iTerm ) pCur->ss.iTerm = iTerm; + } + } + } for(i=0; iss.isReversing = pCur->ss.iStep > 0; }else{ pCur->ss.isReversing = pCur->ss.iStep < 0; @@ -5257,10 +6092,13 @@ static int seriesFilter( ** ** The query plan is represented by bits in idxNum: ** -** (1) start = $value -- constraint exists -** (2) stop = $value -- constraint exists -** (4) step = $value -- constraint exists -** (8) output in descending order +** 0x01 start = $value -- constraint exists +** 0x02 stop = $value -- constraint exists +** 0x04 step = $value -- constraint exists +** 0x08 output is in descending order +** 0x10 output is in ascending order +** 0x20 LIMIT $value -- constraint exists +** 0x40 OFFSET $value -- constraint exists */ static int seriesBestIndex( sqlite3_vtab *pVTab, @@ -5268,10 +6106,12 @@ static int seriesBestIndex( ){ int i, j; /* Loop over constraints */ int idxNum = 0; /* The query plan bitmask */ +#ifndef ZERO_ARGUMENT_GENERATE_SERIES int bStartSeen = 0; /* EQ constraint seen on the START column */ +#endif int unusableMask = 0; /* Mask of unusable constraints */ int nArg = 0; /* Number of arguments that seriesFilter() expects */ - int aIdx[3]; /* Constraints on start, stop, and step */ + int aIdx[5]; /* Constraints on start, stop, step, LIMIT, OFFSET */ const struct sqlite3_index_constraint *pConstraint; /* This implementation assumes that the start, stop, and step columns @@ -5279,28 +6119,54 @@ static int seriesBestIndex( assert( SERIES_COLUMN_STOP == SERIES_COLUMN_START+1 ); assert( SERIES_COLUMN_STEP == SERIES_COLUMN_START+2 ); - aIdx[0] = aIdx[1] = aIdx[2] = -1; + aIdx[0] = aIdx[1] = aIdx[2] = aIdx[3] = aIdx[4] = -1; pConstraint = pIdxInfo->aConstraint; for(i=0; inConstraint; i++, pConstraint++){ int iCol; /* 0 for start, 1 for stop, 2 for step */ int iMask; /* bitmask for those column */ + int op = pConstraint->op; + if( op>=SQLITE_INDEX_CONSTRAINT_LIMIT + && op<=SQLITE_INDEX_CONSTRAINT_OFFSET + ){ + if( pConstraint->usable==0 ){ + /* do nothing */ + }else if( op==SQLITE_INDEX_CONSTRAINT_LIMIT ){ + aIdx[3] = i; + idxNum |= 0x20; + }else{ + assert( op==SQLITE_INDEX_CONSTRAINT_OFFSET ); + aIdx[4] = i; + idxNum |= 0x40; + } + continue; + } if( pConstraint->iColumniColumn - SERIES_COLUMN_START; assert( iCol>=0 && iCol<=2 ); iMask = 1 << iCol; - if( iCol==0 ) bStartSeen = 1; +#ifndef ZERO_ARGUMENT_GENERATE_SERIES + if( iCol==0 && op==SQLITE_INDEX_CONSTRAINT_EQ ){ + bStartSeen = 1; + } +#endif if( pConstraint->usable==0 ){ unusableMask |= iMask; continue; - }else if( pConstraint->op==SQLITE_INDEX_CONSTRAINT_EQ ){ + }else if( op==SQLITE_INDEX_CONSTRAINT_EQ ){ idxNum |= iMask; aIdx[iCol] = i; } } - for(i=0; i<3; i++){ + if( aIdx[3]==0 ){ + /* Ignore OFFSET if LIMIT is omitted */ + idxNum &= ~0x60; + aIdx[4] = 0; + } + for(i=0; i<5; i++){ if( (j = aIdx[i])>=0 ){ pIdxInfo->aConstraintUsage[j].argvIndex = ++nArg; - pIdxInfo->aConstraintUsage[j].omit = !SQLITE_SERIES_CONSTRAINT_VERIFY; + pIdxInfo->aConstraintUsage[j].omit = + !SQLITE_SERIES_CONSTRAINT_VERIFY || i>=3; } } /* The current generate_column() implementation requires at least one @@ -5321,19 +6187,22 @@ static int seriesBestIndex( ** this plan is unusable */ return SQLITE_CONSTRAINT; } - if( (idxNum & 3)==3 ){ + if( (idxNum & 0x03)==0x03 ){ /* Both start= and stop= boundaries are available. This is the ** the preferred case */ pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0)); pIdxInfo->estimatedRows = 1000; if( pIdxInfo->nOrderBy>=1 && pIdxInfo->aOrderBy[0].iColumn==0 ){ if( pIdxInfo->aOrderBy[0].desc ){ - idxNum |= 8; + idxNum |= 0x08; }else{ - idxNum |= 16; + idxNum |= 0x10; } pIdxInfo->orderByConsumed = 1; } + }else if( (idxNum & 0x21)==0x21 ){ + /* We have start= and LIMIT */ + pIdxInfo->estimatedRows = 2500; }else{ /* If either boundary is missing, we have to generate a huge span ** of numbers. Make this case very expensive so that the query @@ -5372,7 +6241,8 @@ static sqlite3_module seriesModule = { 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ @@ -6659,7 +7529,9 @@ static int writeFile( #if !defined(_WIN32) && !defined(WIN32) if( S_ISLNK(mode) ){ const char *zTo = (const char*)sqlite3_value_text(pData); - if( zTo==0 || symlink(zTo, zFile)<0 ) return 1; + if( zTo==0 ) return 1; + unlink(zFile); + if( symlink(zTo, zFile)<0 ) return 1; }else #endif { @@ -6745,13 +7617,19 @@ static int writeFile( return 1; } #else - /* Legacy unix */ - struct timeval times[2]; - times[0].tv_usec = times[1].tv_usec = 0; - times[0].tv_sec = time(0); - times[1].tv_sec = mtime; - if( utimes(zFile, times) ){ - return 1; + /* Legacy unix. + ** + ** Do not use utimes() on a symbolic link - it sees through the link and + ** modifies the timestamps on the target. Or fails if the target does + ** not exist. */ + if( 0==S_ISLNK(mode) ){ + struct timeval times[2]; + times[0].tv_usec = times[1].tv_usec = 0; + times[0].tv_sec = time(0); + times[1].tv_sec = mtime; + if( utimes(zFile, times) ){ + return 1; + } } #endif } @@ -7270,6 +8148,7 @@ static int fsdirRegister(sqlite3 *db){ 0, /* xRelease */ 0, /* xRollbackTo */ 0, /* xShadowName */ + 0 /* xIntegrity */ }; int rc = sqlite3_create_module(db, "fsdir", &fsdirModule, 0); @@ -7790,7 +8669,8 @@ static sqlite3_module completionModule = { 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ @@ -8530,6 +9410,7 @@ SQLITE_EXTENSION_INIT1 #include #include #include +#include #include @@ -10701,7 +11582,8 @@ static int zipfileRegister(sqlite3 *db){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollback */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; int rc = sqlite3_create_module(db, "zipfile" , &zipfileModule, 0); @@ -10819,7 +11701,7 @@ static void sqlarUncompressFunc( sqlite3_value **argv ){ uLong nData; - uLongf sz; + sqlite3_int64 sz; assert( argc==2 ); sz = sqlite3_value_int(argv[1]); @@ -10827,14 +11709,15 @@ static void sqlarUncompressFunc( if( sz<=0 || sz==(nData = sqlite3_value_bytes(argv[0])) ){ sqlite3_result_value(context, argv[0]); }else{ + uLongf szf = sz; const Bytef *pData= sqlite3_value_blob(argv[0]); Bytef *pOut = sqlite3_malloc(sz); if( pOut==0 ){ sqlite3_result_error_nomem(context); - }else if( Z_OK!=uncompress(pOut, &sz, pData, nData) ){ + }else if( Z_OK!=uncompress(pOut, &szf, pData, nData) ){ sqlite3_result_error(context, "error in uncompress()", -1); }else{ - sqlite3_result_blob(context, pOut, sz, SQLITE_TRANSIENT); + sqlite3_result_blob(context, pOut, szf, SQLITE_TRANSIENT); } sqlite3_free(pOut); } @@ -11070,7 +11953,7 @@ void sqlite3_expert_destroy(sqlite3expert*); #endif /* !defined(SQLITE_AMALGAMATION) */ -#ifndef SQLITE_OMIT_VIRTUALTABLE +#ifndef SQLITE_OMIT_VIRTUALTABLE /* typedef sqlite3_int64 i64; */ /* typedef sqlite3_uint64 u64; */ @@ -11224,1868 +12107,3087 @@ static void *idxMalloc(int *pRc, int nByte){ } /* -** Initialize an IdxHash hash table. +** Initialize an IdxHash hash table. +*/ +static void idxHashInit(IdxHash *pHash){ + memset(pHash, 0, sizeof(IdxHash)); +} + +/* +** Reset an IdxHash hash table. +*/ +static void idxHashClear(IdxHash *pHash){ + int i; + for(i=0; iaHash[i]; pEntry; pEntry=pNext){ + pNext = pEntry->pHashNext; + sqlite3_free(pEntry->zVal2); + sqlite3_free(pEntry); + } + } + memset(pHash, 0, sizeof(IdxHash)); +} + +/* +** Return the index of the hash bucket that the string specified by the +** arguments to this function belongs. +*/ +static int idxHashString(const char *z, int n){ + unsigned int ret = 0; + int i; + for(i=0; i=0 ); + for(pEntry=pHash->aHash[iHash]; pEntry; pEntry=pEntry->pHashNext){ + if( STRLEN(pEntry->zKey)==nKey && 0==memcmp(pEntry->zKey, zKey, nKey) ){ + return 1; + } + } + pEntry = idxMalloc(pRc, sizeof(IdxHashEntry) + nKey+1 + nVal+1); + if( pEntry ){ + pEntry->zKey = (char*)&pEntry[1]; + memcpy(pEntry->zKey, zKey, nKey); + if( zVal ){ + pEntry->zVal = &pEntry->zKey[nKey+1]; + memcpy(pEntry->zVal, zVal, nVal); + } + pEntry->pHashNext = pHash->aHash[iHash]; + pHash->aHash[iHash] = pEntry; + + pEntry->pNext = pHash->pFirst; + pHash->pFirst = pEntry; + } + return 0; +} + +/* +** If zKey/nKey is present in the hash table, return a pointer to the +** hash-entry object. +*/ +static IdxHashEntry *idxHashFind(IdxHash *pHash, const char *zKey, int nKey){ + int iHash; + IdxHashEntry *pEntry; + if( nKey<0 ) nKey = STRLEN(zKey); + iHash = idxHashString(zKey, nKey); + assert( iHash>=0 ); + for(pEntry=pHash->aHash[iHash]; pEntry; pEntry=pEntry->pHashNext){ + if( STRLEN(pEntry->zKey)==nKey && 0==memcmp(pEntry->zKey, zKey, nKey) ){ + return pEntry; + } + } + return 0; +} + +/* +** If the hash table contains an entry with a key equal to the string +** passed as the final two arguments to this function, return a pointer +** to the payload string. Otherwise, if zKey/nKey is not present in the +** hash table, return NULL. +*/ +static const char *idxHashSearch(IdxHash *pHash, const char *zKey, int nKey){ + IdxHashEntry *pEntry = idxHashFind(pHash, zKey, nKey); + if( pEntry ) return pEntry->zVal; + return 0; +} + +/* +** Allocate and return a new IdxConstraint object. Set the IdxConstraint.zColl +** variable to point to a copy of nul-terminated string zColl. +*/ +static IdxConstraint *idxNewConstraint(int *pRc, const char *zColl){ + IdxConstraint *pNew; + int nColl = STRLEN(zColl); + + assert( *pRc==SQLITE_OK ); + pNew = (IdxConstraint*)idxMalloc(pRc, sizeof(IdxConstraint) * nColl + 1); + if( pNew ){ + pNew->zColl = (char*)&pNew[1]; + memcpy(pNew->zColl, zColl, nColl+1); + } + return pNew; +} + +/* +** An error associated with database handle db has just occurred. Pass +** the error message to callback function xOut. +*/ +static void idxDatabaseError( + sqlite3 *db, /* Database handle */ + char **pzErrmsg /* Write error here */ +){ + *pzErrmsg = sqlite3_mprintf("%s", sqlite3_errmsg(db)); +} + +/* +** Prepare an SQL statement. +*/ +static int idxPrepareStmt( + sqlite3 *db, /* Database handle to compile against */ + sqlite3_stmt **ppStmt, /* OUT: Compiled SQL statement */ + char **pzErrmsg, /* OUT: sqlite3_malloc()ed error message */ + const char *zSql /* SQL statement to compile */ +){ + int rc = sqlite3_prepare_v2(db, zSql, -1, ppStmt, 0); + if( rc!=SQLITE_OK ){ + *ppStmt = 0; + idxDatabaseError(db, pzErrmsg); + } + return rc; +} + +/* +** Prepare an SQL statement using the results of a printf() formatting. +*/ +static int idxPrintfPrepareStmt( + sqlite3 *db, /* Database handle to compile against */ + sqlite3_stmt **ppStmt, /* OUT: Compiled SQL statement */ + char **pzErrmsg, /* OUT: sqlite3_malloc()ed error message */ + const char *zFmt, /* printf() format of SQL statement */ + ... /* Trailing printf() arguments */ +){ + va_list ap; + int rc; + char *zSql; + va_start(ap, zFmt); + zSql = sqlite3_vmprintf(zFmt, ap); + if( zSql==0 ){ + rc = SQLITE_NOMEM; + }else{ + rc = idxPrepareStmt(db, ppStmt, pzErrmsg, zSql); + sqlite3_free(zSql); + } + va_end(ap); + return rc; +} + + +/************************************************************************* +** Beginning of virtual table implementation. +*/ +typedef struct ExpertVtab ExpertVtab; +struct ExpertVtab { + sqlite3_vtab base; + IdxTable *pTab; + sqlite3expert *pExpert; +}; + +typedef struct ExpertCsr ExpertCsr; +struct ExpertCsr { + sqlite3_vtab_cursor base; + sqlite3_stmt *pData; +}; + +static char *expertDequote(const char *zIn){ + int n = STRLEN(zIn); + char *zRet = sqlite3_malloc(n); + + assert( zIn[0]=='\'' ); + assert( zIn[n-1]=='\'' ); + + if( zRet ){ + int iOut = 0; + int iIn = 0; + for(iIn=1; iIn<(n-1); iIn++){ + if( zIn[iIn]=='\'' ){ + assert( zIn[iIn+1]=='\'' ); + iIn++; + } + zRet[iOut++] = zIn[iIn]; + } + zRet[iOut] = '\0'; + } + + return zRet; +} + +/* +** This function is the implementation of both the xConnect and xCreate +** methods of the r-tree virtual table. +** +** argv[0] -> module name +** argv[1] -> database name +** argv[2] -> table name +** argv[...] -> column names... +*/ +static int expertConnect( + sqlite3 *db, + void *pAux, + int argc, const char *const*argv, + sqlite3_vtab **ppVtab, + char **pzErr +){ + sqlite3expert *pExpert = (sqlite3expert*)pAux; + ExpertVtab *p = 0; + int rc; + + if( argc!=4 ){ + *pzErr = sqlite3_mprintf("internal error!"); + rc = SQLITE_ERROR; + }else{ + char *zCreateTable = expertDequote(argv[3]); + if( zCreateTable ){ + rc = sqlite3_declare_vtab(db, zCreateTable); + if( rc==SQLITE_OK ){ + p = idxMalloc(&rc, sizeof(ExpertVtab)); + } + if( rc==SQLITE_OK ){ + p->pExpert = pExpert; + p->pTab = pExpert->pTable; + assert( sqlite3_stricmp(p->pTab->zName, argv[2])==0 ); + } + sqlite3_free(zCreateTable); + }else{ + rc = SQLITE_NOMEM; + } + } + + *ppVtab = (sqlite3_vtab*)p; + return rc; +} + +static int expertDisconnect(sqlite3_vtab *pVtab){ + ExpertVtab *p = (ExpertVtab*)pVtab; + sqlite3_free(p); + return SQLITE_OK; +} + +static int expertBestIndex(sqlite3_vtab *pVtab, sqlite3_index_info *pIdxInfo){ + ExpertVtab *p = (ExpertVtab*)pVtab; + int rc = SQLITE_OK; + int n = 0; + IdxScan *pScan; + const int opmask = + SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_GT | + SQLITE_INDEX_CONSTRAINT_LT | SQLITE_INDEX_CONSTRAINT_GE | + SQLITE_INDEX_CONSTRAINT_LE; + + pScan = idxMalloc(&rc, sizeof(IdxScan)); + if( pScan ){ + int i; + + /* Link the new scan object into the list */ + pScan->pTab = p->pTab; + pScan->pNextScan = p->pExpert->pScan; + p->pExpert->pScan = pScan; + + /* Add the constraints to the IdxScan object */ + for(i=0; inConstraint; i++){ + struct sqlite3_index_constraint *pCons = &pIdxInfo->aConstraint[i]; + if( pCons->usable + && pCons->iColumn>=0 + && p->pTab->aCol[pCons->iColumn].iPk==0 + && (pCons->op & opmask) + ){ + IdxConstraint *pNew; + const char *zColl = sqlite3_vtab_collation(pIdxInfo, i); + pNew = idxNewConstraint(&rc, zColl); + if( pNew ){ + pNew->iCol = pCons->iColumn; + if( pCons->op==SQLITE_INDEX_CONSTRAINT_EQ ){ + pNew->pNext = pScan->pEq; + pScan->pEq = pNew; + }else{ + pNew->bRange = 1; + pNew->pNext = pScan->pRange; + pScan->pRange = pNew; + } + } + n++; + pIdxInfo->aConstraintUsage[i].argvIndex = n; + } + } + + /* Add the ORDER BY to the IdxScan object */ + for(i=pIdxInfo->nOrderBy-1; i>=0; i--){ + int iCol = pIdxInfo->aOrderBy[i].iColumn; + if( iCol>=0 ){ + IdxConstraint *pNew = idxNewConstraint(&rc, p->pTab->aCol[iCol].zColl); + if( pNew ){ + pNew->iCol = iCol; + pNew->bDesc = pIdxInfo->aOrderBy[i].desc; + pNew->pNext = pScan->pOrder; + pNew->pLink = pScan->pOrder; + pScan->pOrder = pNew; + n++; + } + } + } + } + + pIdxInfo->estimatedCost = 1000000.0 / (n+1); + return rc; +} + +static int expertUpdate( + sqlite3_vtab *pVtab, + int nData, + sqlite3_value **azData, + sqlite_int64 *pRowid +){ + (void)pVtab; + (void)nData; + (void)azData; + (void)pRowid; + return SQLITE_OK; +} + +/* +** Virtual table module xOpen method. +*/ +static int expertOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ + int rc = SQLITE_OK; + ExpertCsr *pCsr; + (void)pVTab; + pCsr = idxMalloc(&rc, sizeof(ExpertCsr)); + *ppCursor = (sqlite3_vtab_cursor*)pCsr; + return rc; +} + +/* +** Virtual table module xClose method. +*/ +static int expertClose(sqlite3_vtab_cursor *cur){ + ExpertCsr *pCsr = (ExpertCsr*)cur; + sqlite3_finalize(pCsr->pData); + sqlite3_free(pCsr); + return SQLITE_OK; +} + +/* +** Virtual table module xEof method. +** +** Return non-zero if the cursor does not currently point to a valid +** record (i.e if the scan has finished), or zero otherwise. */ -static void idxHashInit(IdxHash *pHash){ - memset(pHash, 0, sizeof(IdxHash)); +static int expertEof(sqlite3_vtab_cursor *cur){ + ExpertCsr *pCsr = (ExpertCsr*)cur; + return pCsr->pData==0; } -/* -** Reset an IdxHash hash table. +/* +** Virtual table module xNext method. */ -static void idxHashClear(IdxHash *pHash){ - int i; - for(i=0; iaHash[i]; pEntry; pEntry=pNext){ - pNext = pEntry->pHashNext; - sqlite3_free(pEntry->zVal2); - sqlite3_free(pEntry); - } +static int expertNext(sqlite3_vtab_cursor *cur){ + ExpertCsr *pCsr = (ExpertCsr*)cur; + int rc = SQLITE_OK; + + assert( pCsr->pData ); + rc = sqlite3_step(pCsr->pData); + if( rc!=SQLITE_ROW ){ + rc = sqlite3_finalize(pCsr->pData); + pCsr->pData = 0; + }else{ + rc = SQLITE_OK; } - memset(pHash, 0, sizeof(IdxHash)); + + return rc; } -/* -** Return the index of the hash bucket that the string specified by the -** arguments to this function belongs. +/* +** Virtual table module xRowid method. */ -static int idxHashString(const char *z, int n){ - unsigned int ret = 0; - int i; - for(i=0; ipData, i); + if( pVal ){ + sqlite3_result_value(ctx, pVal); } - return (int)(ret % IDX_HASH_SIZE); + return SQLITE_OK; } -/* -** If zKey is already present in the hash table, return non-zero and do -** nothing. Otherwise, add an entry with key zKey and payload string zVal to -** the hash table passed as the second argument. +/* +** Virtual table module xFilter method. */ -static int idxHashAdd( - int *pRc, - IdxHash *pHash, - const char *zKey, - const char *zVal +static int expertFilter( + sqlite3_vtab_cursor *cur, + int idxNum, const char *idxStr, + int argc, sqlite3_value **argv ){ - int nKey = STRLEN(zKey); - int iHash = idxHashString(zKey, nKey); - int nVal = (zVal ? STRLEN(zVal) : 0); - IdxHashEntry *pEntry; - assert( iHash>=0 ); - for(pEntry=pHash->aHash[iHash]; pEntry; pEntry=pEntry->pHashNext){ - if( STRLEN(pEntry->zKey)==nKey && 0==memcmp(pEntry->zKey, zKey, nKey) ){ - return 1; - } - } - pEntry = idxMalloc(pRc, sizeof(IdxHashEntry) + nKey+1 + nVal+1); - if( pEntry ){ - pEntry->zKey = (char*)&pEntry[1]; - memcpy(pEntry->zKey, zKey, nKey); - if( zVal ){ - pEntry->zVal = &pEntry->zKey[nKey+1]; - memcpy(pEntry->zVal, zVal, nVal); - } - pEntry->pHashNext = pHash->aHash[iHash]; - pHash->aHash[iHash] = pEntry; + ExpertCsr *pCsr = (ExpertCsr*)cur; + ExpertVtab *pVtab = (ExpertVtab*)(cur->pVtab); + sqlite3expert *pExpert = pVtab->pExpert; + int rc; - pEntry->pNext = pHash->pFirst; - pHash->pFirst = pEntry; + (void)idxNum; + (void)idxStr; + (void)argc; + (void)argv; + rc = sqlite3_finalize(pCsr->pData); + pCsr->pData = 0; + if( rc==SQLITE_OK ){ + rc = idxPrintfPrepareStmt(pExpert->db, &pCsr->pData, &pVtab->base.zErrMsg, + "SELECT * FROM main.%Q WHERE sample()", pVtab->pTab->zName + ); } - return 0; -} -/* -** If zKey/nKey is present in the hash table, return a pointer to the -** hash-entry object. -*/ -static IdxHashEntry *idxHashFind(IdxHash *pHash, const char *zKey, int nKey){ - int iHash; - IdxHashEntry *pEntry; - if( nKey<0 ) nKey = STRLEN(zKey); - iHash = idxHashString(zKey, nKey); - assert( iHash>=0 ); - for(pEntry=pHash->aHash[iHash]; pEntry; pEntry=pEntry->pHashNext){ - if( STRLEN(pEntry->zKey)==nKey && 0==memcmp(pEntry->zKey, zKey, nKey) ){ - return pEntry; - } + if( rc==SQLITE_OK ){ + rc = expertNext(cur); } - return 0; + return rc; } +static int idxRegisterVtab(sqlite3expert *p){ + static sqlite3_module expertModule = { + 2, /* iVersion */ + expertConnect, /* xCreate - create a table */ + expertConnect, /* xConnect - connect to an existing table */ + expertBestIndex, /* xBestIndex - Determine search strategy */ + expertDisconnect, /* xDisconnect - Disconnect from a table */ + expertDisconnect, /* xDestroy - Drop a table */ + expertOpen, /* xOpen - open a cursor */ + expertClose, /* xClose - close a cursor */ + expertFilter, /* xFilter - configure scan constraints */ + expertNext, /* xNext - advance a cursor */ + expertEof, /* xEof */ + expertColumn, /* xColumn - read data */ + expertRowid, /* xRowid - read data */ + expertUpdate, /* xUpdate - write data */ + 0, /* xBegin - begin transaction */ + 0, /* xSync - sync transaction */ + 0, /* xCommit - commit transaction */ + 0, /* xRollback - rollback transaction */ + 0, /* xFindFunction - function overloading */ + 0, /* xRename - rename the table */ + 0, /* xSavepoint */ + 0, /* xRelease */ + 0, /* xRollbackTo */ + 0, /* xShadowName */ + 0, /* xIntegrity */ + }; + + return sqlite3_create_module(p->dbv, "expert", &expertModule, (void*)p); +} /* -** If the hash table contains an entry with a key equal to the string -** passed as the final two arguments to this function, return a pointer -** to the payload string. Otherwise, if zKey/nKey is not present in the -** hash table, return NULL. +** End of virtual table implementation. +*************************************************************************/ +/* +** Finalize SQL statement pStmt. If (*pRc) is SQLITE_OK when this function +** is called, set it to the return value of sqlite3_finalize() before +** returning. Otherwise, discard the sqlite3_finalize() return value. */ -static const char *idxHashSearch(IdxHash *pHash, const char *zKey, int nKey){ - IdxHashEntry *pEntry = idxHashFind(pHash, zKey, nKey); - if( pEntry ) return pEntry->zVal; - return 0; +static void idxFinalize(int *pRc, sqlite3_stmt *pStmt){ + int rc = sqlite3_finalize(pStmt); + if( *pRc==SQLITE_OK ) *pRc = rc; } /* -** Allocate and return a new IdxConstraint object. Set the IdxConstraint.zColl -** variable to point to a copy of nul-terminated string zColl. +** Attempt to allocate an IdxTable structure corresponding to table zTab +** in the main database of connection db. If successful, set (*ppOut) to +** point to the new object and return SQLITE_OK. Otherwise, return an +** SQLite error code and set (*ppOut) to NULL. In this case *pzErrmsg may be +** set to point to an error string. +** +** It is the responsibility of the caller to eventually free either the +** IdxTable object or error message using sqlite3_free(). */ -static IdxConstraint *idxNewConstraint(int *pRc, const char *zColl){ - IdxConstraint *pNew; - int nColl = STRLEN(zColl); +static int idxGetTableInfo( + sqlite3 *db, /* Database connection to read details from */ + const char *zTab, /* Table name */ + IdxTable **ppOut, /* OUT: New object (if successful) */ + char **pzErrmsg /* OUT: Error message (if not) */ +){ + sqlite3_stmt *p1 = 0; + int nCol = 0; + int nTab; + int nByte; + IdxTable *pNew = 0; + int rc, rc2; + char *pCsr = 0; + int nPk = 0; + + *ppOut = 0; + if( zTab==0 ) return SQLITE_ERROR; + nTab = STRLEN(zTab); + nByte = sizeof(IdxTable) + nTab + 1; + rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_xinfo=%Q", zTab); + while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){ + const char *zCol = (const char*)sqlite3_column_text(p1, 1); + const char *zColSeq = 0; + if( zCol==0 ){ + rc = SQLITE_ERROR; + break; + } + nByte += 1 + STRLEN(zCol); + rc = sqlite3_table_column_metadata( + db, "main", zTab, zCol, 0, &zColSeq, 0, 0, 0 + ); + if( zColSeq==0 ) zColSeq = "binary"; + nByte += 1 + STRLEN(zColSeq); + nCol++; + nPk += (sqlite3_column_int(p1, 5)>0); + } + rc2 = sqlite3_reset(p1); + if( rc==SQLITE_OK ) rc = rc2; + + nByte += sizeof(IdxColumn) * nCol; + if( rc==SQLITE_OK ){ + pNew = idxMalloc(&rc, nByte); + } + if( rc==SQLITE_OK ){ + pNew->aCol = (IdxColumn*)&pNew[1]; + pNew->nCol = nCol; + pCsr = (char*)&pNew->aCol[nCol]; + } + + nCol = 0; + while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){ + const char *zCol = (const char*)sqlite3_column_text(p1, 1); + const char *zColSeq = 0; + int nCopy; + if( zCol==0 ) continue; + nCopy = STRLEN(zCol) + 1; + pNew->aCol[nCol].zName = pCsr; + pNew->aCol[nCol].iPk = (sqlite3_column_int(p1, 5)==1 && nPk==1); + memcpy(pCsr, zCol, nCopy); + pCsr += nCopy; - assert( *pRc==SQLITE_OK ); - pNew = (IdxConstraint*)idxMalloc(pRc, sizeof(IdxConstraint) * nColl + 1); - if( pNew ){ - pNew->zColl = (char*)&pNew[1]; - memcpy(pNew->zColl, zColl, nColl+1); - } - return pNew; -} + rc = sqlite3_table_column_metadata( + db, "main", zTab, zCol, 0, &zColSeq, 0, 0, 0 + ); + if( rc==SQLITE_OK ){ + if( zColSeq==0 ) zColSeq = "binary"; + nCopy = STRLEN(zColSeq) + 1; + pNew->aCol[nCol].zColl = pCsr; + memcpy(pCsr, zColSeq, nCopy); + pCsr += nCopy; + } -/* -** An error associated with database handle db has just occurred. Pass -** the error message to callback function xOut. -*/ -static void idxDatabaseError( - sqlite3 *db, /* Database handle */ - char **pzErrmsg /* Write error here */ -){ - *pzErrmsg = sqlite3_mprintf("%s", sqlite3_errmsg(db)); -} + nCol++; + } + idxFinalize(&rc, p1); -/* -** Prepare an SQL statement. -*/ -static int idxPrepareStmt( - sqlite3 *db, /* Database handle to compile against */ - sqlite3_stmt **ppStmt, /* OUT: Compiled SQL statement */ - char **pzErrmsg, /* OUT: sqlite3_malloc()ed error message */ - const char *zSql /* SQL statement to compile */ -){ - int rc = sqlite3_prepare_v2(db, zSql, -1, ppStmt, 0); if( rc!=SQLITE_OK ){ - *ppStmt = 0; - idxDatabaseError(db, pzErrmsg); + sqlite3_free(pNew); + pNew = 0; + }else if( ALWAYS(pNew!=0) ){ + pNew->zName = pCsr; + if( ALWAYS(pNew->zName!=0) ) memcpy(pNew->zName, zTab, nTab+1); } + + *ppOut = pNew; return rc; } /* -** Prepare an SQL statement using the results of a printf() formatting. +** This function is a no-op if *pRc is set to anything other than +** SQLITE_OK when it is called. +** +** If *pRc is initially set to SQLITE_OK, then the text specified by +** the printf() style arguments is appended to zIn and the result returned +** in a buffer allocated by sqlite3_malloc(). sqlite3_free() is called on +** zIn before returning. */ -static int idxPrintfPrepareStmt( - sqlite3 *db, /* Database handle to compile against */ - sqlite3_stmt **ppStmt, /* OUT: Compiled SQL statement */ - char **pzErrmsg, /* OUT: sqlite3_malloc()ed error message */ - const char *zFmt, /* printf() format of SQL statement */ - ... /* Trailing printf() arguments */ -){ +static char *idxAppendText(int *pRc, char *zIn, const char *zFmt, ...){ va_list ap; - int rc; - char *zSql; + char *zAppend = 0; + char *zRet = 0; + int nIn = zIn ? STRLEN(zIn) : 0; + int nAppend = 0; va_start(ap, zFmt); - zSql = sqlite3_vmprintf(zFmt, ap); - if( zSql==0 ){ - rc = SQLITE_NOMEM; - }else{ - rc = idxPrepareStmt(db, ppStmt, pzErrmsg, zSql); - sqlite3_free(zSql); + if( *pRc==SQLITE_OK ){ + zAppend = sqlite3_vmprintf(zFmt, ap); + if( zAppend ){ + nAppend = STRLEN(zAppend); + zRet = (char*)sqlite3_malloc(nIn + nAppend + 1); + } + if( zAppend && zRet ){ + if( nIn ) memcpy(zRet, zIn, nIn); + memcpy(&zRet[nIn], zAppend, nAppend+1); + }else{ + sqlite3_free(zRet); + zRet = 0; + *pRc = SQLITE_NOMEM; + } + sqlite3_free(zAppend); + sqlite3_free(zIn); } va_end(ap); - return rc; + return zRet; } - -/************************************************************************* -** Beginning of virtual table implementation. +/* +** Return true if zId must be quoted in order to use it as an SQL +** identifier, or false otherwise. */ -typedef struct ExpertVtab ExpertVtab; -struct ExpertVtab { - sqlite3_vtab base; - IdxTable *pTab; - sqlite3expert *pExpert; -}; +static int idxIdentifierRequiresQuotes(const char *zId){ + int i; + int nId = STRLEN(zId); + + if( sqlite3_keyword_check(zId, nId) ) return 1; -typedef struct ExpertCsr ExpertCsr; -struct ExpertCsr { - sqlite3_vtab_cursor base; - sqlite3_stmt *pData; -}; + for(i=0; zId[i]; i++){ + if( !(zId[i]=='_') + && !(zId[i]>='0' && zId[i]<='9') + && !(zId[i]>='a' && zId[i]<='z') + && !(zId[i]>='A' && zId[i]<='Z') + ){ + return 1; + } + } + return 0; +} -static char *expertDequote(const char *zIn){ - int n = STRLEN(zIn); - char *zRet = sqlite3_malloc(n); +/* +** This function appends an index column definition suitable for constraint +** pCons to the string passed as zIn and returns the result. +*/ +static char *idxAppendColDefn( + int *pRc, /* IN/OUT: Error code */ + char *zIn, /* Column defn accumulated so far */ + IdxTable *pTab, /* Table index will be created on */ + IdxConstraint *pCons +){ + char *zRet = zIn; + IdxColumn *p = &pTab->aCol[pCons->iCol]; + if( zRet ) zRet = idxAppendText(pRc, zRet, ", "); - assert( zIn[0]=='\'' ); - assert( zIn[n-1]=='\'' ); + if( idxIdentifierRequiresQuotes(p->zName) ){ + zRet = idxAppendText(pRc, zRet, "%Q", p->zName); + }else{ + zRet = idxAppendText(pRc, zRet, "%s", p->zName); + } - if( zRet ){ - int iOut = 0; - int iIn = 0; - for(iIn=1; iIn<(n-1); iIn++){ - if( zIn[iIn]=='\'' ){ - assert( zIn[iIn+1]=='\'' ); - iIn++; - } - zRet[iOut++] = zIn[iIn]; + if( sqlite3_stricmp(p->zColl, pCons->zColl) ){ + if( idxIdentifierRequiresQuotes(pCons->zColl) ){ + zRet = idxAppendText(pRc, zRet, " COLLATE %Q", pCons->zColl); + }else{ + zRet = idxAppendText(pRc, zRet, " COLLATE %s", pCons->zColl); } - zRet[iOut] = '\0'; } + if( pCons->bDesc ){ + zRet = idxAppendText(pRc, zRet, " DESC"); + } return zRet; } -/* -** This function is the implementation of both the xConnect and xCreate -** methods of the r-tree virtual table. +/* +** Search database dbm for an index compatible with the one idxCreateFromCons() +** would create from arguments pScan, pEq and pTail. If no error occurs and +** such an index is found, return non-zero. Or, if no such index is found, +** return zero. ** -** argv[0] -> module name -** argv[1] -> database name -** argv[2] -> table name -** argv[...] -> column names... +** If an error occurs, set *pRc to an SQLite error code and return zero. */ -static int expertConnect( - sqlite3 *db, - void *pAux, - int argc, const char *const*argv, - sqlite3_vtab **ppVtab, - char **pzErr +static int idxFindCompatible( + int *pRc, /* OUT: Error code */ + sqlite3* dbm, /* Database to search */ + IdxScan *pScan, /* Scan for table to search for index on */ + IdxConstraint *pEq, /* List of == constraints */ + IdxConstraint *pTail /* List of range constraints */ ){ - sqlite3expert *pExpert = (sqlite3expert*)pAux; - ExpertVtab *p = 0; + const char *zTbl = pScan->pTab->zName; + sqlite3_stmt *pIdxList = 0; + IdxConstraint *pIter; + int nEq = 0; /* Number of elements in pEq */ int rc; - if( argc!=4 ){ - *pzErr = sqlite3_mprintf("internal error!"); - rc = SQLITE_ERROR; - }else{ - char *zCreateTable = expertDequote(argv[3]); - if( zCreateTable ){ - rc = sqlite3_declare_vtab(db, zCreateTable); - if( rc==SQLITE_OK ){ - p = idxMalloc(&rc, sizeof(ExpertVtab)); - } - if( rc==SQLITE_OK ){ - p->pExpert = pExpert; - p->pTab = pExpert->pTable; - assert( sqlite3_stricmp(p->pTab->zName, argv[2])==0 ); + /* Count the elements in list pEq */ + for(pIter=pEq; pIter; pIter=pIter->pLink) nEq++; + + rc = idxPrintfPrepareStmt(dbm, &pIdxList, 0, "PRAGMA index_list=%Q", zTbl); + while( rc==SQLITE_OK && sqlite3_step(pIdxList)==SQLITE_ROW ){ + int bMatch = 1; + IdxConstraint *pT = pTail; + sqlite3_stmt *pInfo = 0; + const char *zIdx = (const char*)sqlite3_column_text(pIdxList, 1); + if( zIdx==0 ) continue; + + /* Zero the IdxConstraint.bFlag values in the pEq list */ + for(pIter=pEq; pIter; pIter=pIter->pLink) pIter->bFlag = 0; + + rc = idxPrintfPrepareStmt(dbm, &pInfo, 0, "PRAGMA index_xInfo=%Q", zIdx); + while( rc==SQLITE_OK && sqlite3_step(pInfo)==SQLITE_ROW ){ + int iIdx = sqlite3_column_int(pInfo, 0); + int iCol = sqlite3_column_int(pInfo, 1); + const char *zColl = (const char*)sqlite3_column_text(pInfo, 4); + + if( iIdxpLink){ + if( pIter->bFlag ) continue; + if( pIter->iCol!=iCol ) continue; + if( sqlite3_stricmp(pIter->zColl, zColl) ) continue; + pIter->bFlag = 1; + break; + } + if( pIter==0 ){ + bMatch = 0; + break; + } + }else{ + if( pT ){ + if( pT->iCol!=iCol || sqlite3_stricmp(pT->zColl, zColl) ){ + bMatch = 0; + break; + } + pT = pT->pLink; + } } - sqlite3_free(zCreateTable); - }else{ - rc = SQLITE_NOMEM; + } + idxFinalize(&rc, pInfo); + + if( rc==SQLITE_OK && bMatch ){ + sqlite3_finalize(pIdxList); + return 1; } } + idxFinalize(&rc, pIdxList); - *ppVtab = (sqlite3_vtab*)p; - return rc; + *pRc = rc; + return 0; } -static int expertDisconnect(sqlite3_vtab *pVtab){ - ExpertVtab *p = (ExpertVtab*)pVtab; - sqlite3_free(p); - return SQLITE_OK; +/* Callback for sqlite3_exec() with query with leading count(*) column. + * The first argument is expected to be an int*, referent to be incremented + * if that leading column is not exactly '0'. + */ +static int countNonzeros(void* pCount, int nc, + char* azResults[], char* azColumns[]){ + (void)azColumns; /* Suppress unused parameter warning */ + if( nc>0 && (azResults[0][0]!='0' || azResults[0][1]!=0) ){ + *((int *)pCount) += 1; + } + return 0; } -static int expertBestIndex(sqlite3_vtab *pVtab, sqlite3_index_info *pIdxInfo){ - ExpertVtab *p = (ExpertVtab*)pVtab; +static int idxCreateFromCons( + sqlite3expert *p, + IdxScan *pScan, + IdxConstraint *pEq, + IdxConstraint *pTail +){ + sqlite3 *dbm = p->dbm; int rc = SQLITE_OK; - int n = 0; - IdxScan *pScan; - const int opmask = - SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_GT | - SQLITE_INDEX_CONSTRAINT_LT | SQLITE_INDEX_CONSTRAINT_GE | - SQLITE_INDEX_CONSTRAINT_LE; - - pScan = idxMalloc(&rc, sizeof(IdxScan)); - if( pScan ){ - int i; + if( (pEq || pTail) && 0==idxFindCompatible(&rc, dbm, pScan, pEq, pTail) ){ + IdxTable *pTab = pScan->pTab; + char *zCols = 0; + char *zIdx = 0; + IdxConstraint *pCons; + unsigned int h = 0; + const char *zFmt; - /* Link the new scan object into the list */ - pScan->pTab = p->pTab; - pScan->pNextScan = p->pExpert->pScan; - p->pExpert->pScan = pScan; + for(pCons=pEq; pCons; pCons=pCons->pLink){ + zCols = idxAppendColDefn(&rc, zCols, pTab, pCons); + } + for(pCons=pTail; pCons; pCons=pCons->pLink){ + zCols = idxAppendColDefn(&rc, zCols, pTab, pCons); + } - /* Add the constraints to the IdxScan object */ - for(i=0; inConstraint; i++){ - struct sqlite3_index_constraint *pCons = &pIdxInfo->aConstraint[i]; - if( pCons->usable - && pCons->iColumn>=0 - && p->pTab->aCol[pCons->iColumn].iPk==0 - && (pCons->op & opmask) - ){ - IdxConstraint *pNew; - const char *zColl = sqlite3_vtab_collation(pIdxInfo, i); - pNew = idxNewConstraint(&rc, zColl); - if( pNew ){ - pNew->iCol = pCons->iColumn; - if( pCons->op==SQLITE_INDEX_CONSTRAINT_EQ ){ - pNew->pNext = pScan->pEq; - pScan->pEq = pNew; + if( rc==SQLITE_OK ){ + /* Hash the list of columns to come up with a name for the index */ + const char *zTable = pScan->pTab->zName; + int quoteTable = idxIdentifierRequiresQuotes(zTable); + char *zName = 0; /* Index name */ + int collisions = 0; + do{ + int i; + char *zFind; + for(i=0; zCols[i]; i++){ + h += ((h<<3) + zCols[i]); + } + sqlite3_free(zName); + zName = sqlite3_mprintf("%s_idx_%08x", zTable, h); + if( zName==0 ) break; + /* Is is unique among table, view and index names? */ + zFmt = "SELECT count(*) FROM sqlite_schema WHERE name=%Q" + " AND type in ('index','table','view')"; + zFind = sqlite3_mprintf(zFmt, zName); + i = 0; + rc = sqlite3_exec(dbm, zFind, countNonzeros, &i, 0); + assert(rc==SQLITE_OK); + sqlite3_free(zFind); + if( i==0 ){ + collisions = 0; + break; + } + ++collisions; + }while( collisions<50 && zName!=0 ); + if( collisions ){ + /* This return means "Gave up trying to find a unique index name." */ + rc = SQLITE_BUSY_TIMEOUT; + }else if( zName==0 ){ + rc = SQLITE_NOMEM; + }else{ + if( quoteTable ){ + zFmt = "CREATE INDEX \"%w\" ON \"%w\"(%s)"; + }else{ + zFmt = "CREATE INDEX %s ON %s(%s)"; + } + zIdx = sqlite3_mprintf(zFmt, zName, zTable, zCols); + if( !zIdx ){ + rc = SQLITE_NOMEM; + }else{ + rc = sqlite3_exec(dbm, zIdx, 0, 0, p->pzErrmsg); + if( rc!=SQLITE_OK ){ + rc = SQLITE_BUSY_TIMEOUT; }else{ - pNew->bRange = 1; - pNew->pNext = pScan->pRange; - pScan->pRange = pNew; + idxHashAdd(&rc, &p->hIdx, zName, zIdx); } } - n++; - pIdxInfo->aConstraintUsage[i].argvIndex = n; + sqlite3_free(zName); + sqlite3_free(zIdx); } } - /* Add the ORDER BY to the IdxScan object */ - for(i=pIdxInfo->nOrderBy-1; i>=0; i--){ - int iCol = pIdxInfo->aOrderBy[i].iColumn; - if( iCol>=0 ){ - IdxConstraint *pNew = idxNewConstraint(&rc, p->pTab->aCol[iCol].zColl); - if( pNew ){ - pNew->iCol = iCol; - pNew->bDesc = pIdxInfo->aOrderBy[i].desc; - pNew->pNext = pScan->pOrder; - pNew->pLink = pScan->pOrder; - pScan->pOrder = pNew; - n++; - } - } - } + sqlite3_free(zCols); } - - pIdxInfo->estimatedCost = 1000000.0 / (n+1); return rc; } -static int expertUpdate( - sqlite3_vtab *pVtab, - int nData, - sqlite3_value **azData, - sqlite_int64 *pRowid -){ - (void)pVtab; - (void)nData; - (void)azData; - (void)pRowid; - return SQLITE_OK; -} - -/* -** Virtual table module xOpen method. +/* +** Return true if list pList (linked by IdxConstraint.pLink) contains +** a constraint compatible with *p. Otherwise return false. */ -static int expertOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ - int rc = SQLITE_OK; - ExpertCsr *pCsr; - (void)pVTab; - pCsr = idxMalloc(&rc, sizeof(ExpertCsr)); - *ppCursor = (sqlite3_vtab_cursor*)pCsr; - return rc; +static int idxFindConstraint(IdxConstraint *pList, IdxConstraint *p){ + IdxConstraint *pCmp; + for(pCmp=pList; pCmp; pCmp=pCmp->pLink){ + if( p->iCol==pCmp->iCol ) return 1; + } + return 0; } -/* -** Virtual table module xClose method. -*/ -static int expertClose(sqlite3_vtab_cursor *cur){ - ExpertCsr *pCsr = (ExpertCsr*)cur; - sqlite3_finalize(pCsr->pData); - sqlite3_free(pCsr); - return SQLITE_OK; -} +static int idxCreateFromWhere( + sqlite3expert *p, + IdxScan *pScan, /* Create indexes for this scan */ + IdxConstraint *pTail /* range/ORDER BY constraints for inclusion */ +){ + IdxConstraint *p1 = 0; + IdxConstraint *pCon; + int rc; -/* -** Virtual table module xEof method. -** -** Return non-zero if the cursor does not currently point to a valid -** record (i.e if the scan has finished), or zero otherwise. -*/ -static int expertEof(sqlite3_vtab_cursor *cur){ - ExpertCsr *pCsr = (ExpertCsr*)cur; - return pCsr->pData==0; + /* Gather up all the == constraints. */ + for(pCon=pScan->pEq; pCon; pCon=pCon->pNext){ + if( !idxFindConstraint(p1, pCon) && !idxFindConstraint(pTail, pCon) ){ + pCon->pLink = p1; + p1 = pCon; + } + } + + /* Create an index using the == constraints collected above. And the + ** range constraint/ORDER BY terms passed in by the caller, if any. */ + rc = idxCreateFromCons(p, pScan, p1, pTail); + + /* If no range/ORDER BY passed by the caller, create a version of the + ** index for each range constraint. */ + if( pTail==0 ){ + for(pCon=pScan->pRange; rc==SQLITE_OK && pCon; pCon=pCon->pNext){ + assert( pCon->pLink==0 ); + if( !idxFindConstraint(p1, pCon) && !idxFindConstraint(pTail, pCon) ){ + rc = idxCreateFromCons(p, pScan, p1, pCon); + } + } + } + + return rc; } -/* -** Virtual table module xNext method. +/* +** Create candidate indexes in database [dbm] based on the data in +** linked-list pScan. */ -static int expertNext(sqlite3_vtab_cursor *cur){ - ExpertCsr *pCsr = (ExpertCsr*)cur; +static int idxCreateCandidates(sqlite3expert *p){ int rc = SQLITE_OK; + IdxScan *pIter; - assert( pCsr->pData ); - rc = sqlite3_step(pCsr->pData); - if( rc!=SQLITE_ROW ){ - rc = sqlite3_finalize(pCsr->pData); - pCsr->pData = 0; - }else{ - rc = SQLITE_OK; + for(pIter=p->pScan; pIter && rc==SQLITE_OK; pIter=pIter->pNextScan){ + rc = idxCreateFromWhere(p, pIter, 0); + if( rc==SQLITE_OK && pIter->pOrder ){ + rc = idxCreateFromWhere(p, pIter, pIter->pOrder); + } } return rc; } -/* -** Virtual table module xRowid method. +/* +** Free all elements of the linked list starting at pConstraint. */ -static int expertRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){ - (void)cur; - *pRowid = 0; - return SQLITE_OK; +static void idxConstraintFree(IdxConstraint *pConstraint){ + IdxConstraint *pNext; + IdxConstraint *p; + + for(p=pConstraint; p; p=pNext){ + pNext = p->pNext; + sqlite3_free(p); + } } -/* -** Virtual table module xColumn method. +/* +** Free all elements of the linked list starting from pScan up until pLast +** (pLast is not freed). */ -static int expertColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){ - ExpertCsr *pCsr = (ExpertCsr*)cur; - sqlite3_value *pVal; - pVal = sqlite3_column_value(pCsr->pData, i); - if( pVal ){ - sqlite3_result_value(ctx, pVal); +static void idxScanFree(IdxScan *pScan, IdxScan *pLast){ + IdxScan *p; + IdxScan *pNext; + for(p=pScan; p!=pLast; p=pNext){ + pNext = p->pNextScan; + idxConstraintFree(p->pOrder); + idxConstraintFree(p->pEq); + idxConstraintFree(p->pRange); + sqlite3_free(p); } - return SQLITE_OK; } -/* -** Virtual table module xFilter method. +/* +** Free all elements of the linked list starting from pStatement up +** until pLast (pLast is not freed). */ -static int expertFilter( - sqlite3_vtab_cursor *cur, - int idxNum, const char *idxStr, - int argc, sqlite3_value **argv -){ - ExpertCsr *pCsr = (ExpertCsr*)cur; - ExpertVtab *pVtab = (ExpertVtab*)(cur->pVtab); - sqlite3expert *pExpert = pVtab->pExpert; - int rc; - - (void)idxNum; - (void)idxStr; - (void)argc; - (void)argv; - rc = sqlite3_finalize(pCsr->pData); - pCsr->pData = 0; - if( rc==SQLITE_OK ){ - rc = idxPrintfPrepareStmt(pExpert->db, &pCsr->pData, &pVtab->base.zErrMsg, - "SELECT * FROM main.%Q WHERE sample()", pVtab->pTab->zName - ); +static void idxStatementFree(IdxStatement *pStatement, IdxStatement *pLast){ + IdxStatement *p; + IdxStatement *pNext; + for(p=pStatement; p!=pLast; p=pNext){ + pNext = p->pNext; + sqlite3_free(p->zEQP); + sqlite3_free(p->zIdx); + sqlite3_free(p); } +} - if( rc==SQLITE_OK ){ - rc = expertNext(cur); +/* +** Free the linked list of IdxTable objects starting at pTab. +*/ +static void idxTableFree(IdxTable *pTab){ + IdxTable *pIter; + IdxTable *pNext; + for(pIter=pTab; pIter; pIter=pNext){ + pNext = pIter->pNext; + sqlite3_free(pIter); } - return rc; } -static int idxRegisterVtab(sqlite3expert *p){ - static sqlite3_module expertModule = { - 2, /* iVersion */ - expertConnect, /* xCreate - create a table */ - expertConnect, /* xConnect - connect to an existing table */ - expertBestIndex, /* xBestIndex - Determine search strategy */ - expertDisconnect, /* xDisconnect - Disconnect from a table */ - expertDisconnect, /* xDestroy - Drop a table */ - expertOpen, /* xOpen - open a cursor */ - expertClose, /* xClose - close a cursor */ - expertFilter, /* xFilter - configure scan constraints */ - expertNext, /* xNext - advance a cursor */ - expertEof, /* xEof */ - expertColumn, /* xColumn - read data */ - expertRowid, /* xRowid - read data */ - expertUpdate, /* xUpdate - write data */ - 0, /* xBegin - begin transaction */ - 0, /* xSync - sync transaction */ - 0, /* xCommit - commit transaction */ - 0, /* xRollback - rollback transaction */ - 0, /* xFindFunction - function overloading */ - 0, /* xRename - rename the table */ - 0, /* xSavepoint */ - 0, /* xRelease */ - 0, /* xRollbackTo */ - 0, /* xShadowName */ - }; - - return sqlite3_create_module(p->dbv, "expert", &expertModule, (void*)p); -} -/* -** End of virtual table implementation. -*************************************************************************/ /* -** Finalize SQL statement pStmt. If (*pRc) is SQLITE_OK when this function -** is called, set it to the return value of sqlite3_finalize() before -** returning. Otherwise, discard the sqlite3_finalize() return value. +** Free the linked list of IdxWrite objects starting at pTab. */ -static void idxFinalize(int *pRc, sqlite3_stmt *pStmt){ - int rc = sqlite3_finalize(pStmt); - if( *pRc==SQLITE_OK ) *pRc = rc; +static void idxWriteFree(IdxWrite *pTab){ + IdxWrite *pIter; + IdxWrite *pNext; + for(pIter=pTab; pIter; pIter=pNext){ + pNext = pIter->pNext; + sqlite3_free(pIter); + } } + + /* -** Attempt to allocate an IdxTable structure corresponding to table zTab -** in the main database of connection db. If successful, set (*ppOut) to -** point to the new object and return SQLITE_OK. Otherwise, return an -** SQLite error code and set (*ppOut) to NULL. In this case *pzErrmsg may be -** set to point to an error string. -** -** It is the responsibility of the caller to eventually free either the -** IdxTable object or error message using sqlite3_free(). +** This function is called after candidate indexes have been created. It +** runs all the queries to see which indexes they prefer, and populates +** IdxStatement.zIdx and IdxStatement.zEQP with the results. */ -static int idxGetTableInfo( - sqlite3 *db, /* Database connection to read details from */ - const char *zTab, /* Table name */ - IdxTable **ppOut, /* OUT: New object (if successful) */ - char **pzErrmsg /* OUT: Error message (if not) */ +static int idxFindIndexes( + sqlite3expert *p, + char **pzErr /* OUT: Error message (sqlite3_malloc) */ ){ - sqlite3_stmt *p1 = 0; - int nCol = 0; - int nTab; - int nByte; - IdxTable *pNew = 0; - int rc, rc2; - char *pCsr = 0; - int nPk = 0; + IdxStatement *pStmt; + sqlite3 *dbm = p->dbm; + int rc = SQLITE_OK; - *ppOut = 0; - if( zTab==0 ) return SQLITE_ERROR; - nTab = STRLEN(zTab); - nByte = sizeof(IdxTable) + nTab + 1; - rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_xinfo=%Q", zTab); - while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){ - const char *zCol = (const char*)sqlite3_column_text(p1, 1); - const char *zColSeq = 0; - if( zCol==0 ){ - rc = SQLITE_ERROR; - break; + IdxHash hIdx; + idxHashInit(&hIdx); + + for(pStmt=p->pStatement; rc==SQLITE_OK && pStmt; pStmt=pStmt->pNext){ + IdxHashEntry *pEntry; + sqlite3_stmt *pExplain = 0; + idxHashClear(&hIdx); + rc = idxPrintfPrepareStmt(dbm, &pExplain, pzErr, + "EXPLAIN QUERY PLAN %s", pStmt->zSql + ); + while( rc==SQLITE_OK && sqlite3_step(pExplain)==SQLITE_ROW ){ + /* int iId = sqlite3_column_int(pExplain, 0); */ + /* int iParent = sqlite3_column_int(pExplain, 1); */ + /* int iNotUsed = sqlite3_column_int(pExplain, 2); */ + const char *zDetail = (const char*)sqlite3_column_text(pExplain, 3); + int nDetail; + int i; + + if( !zDetail ) continue; + nDetail = STRLEN(zDetail); + + for(i=0; ihIdx, zIdx, nIdx); + if( zSql ){ + idxHashAdd(&rc, &hIdx, zSql, 0); + if( rc ) goto find_indexes_out; + } + break; + } + } + + if( zDetail[0]!='-' ){ + pStmt->zEQP = idxAppendText(&rc, pStmt->zEQP, "%s\n", zDetail); + } + } + + for(pEntry=hIdx.pFirst; pEntry; pEntry=pEntry->pNext){ + pStmt->zIdx = idxAppendText(&rc, pStmt->zIdx, "%s;\n", pEntry->zKey); + } + + idxFinalize(&rc, pExplain); + } + + find_indexes_out: + idxHashClear(&hIdx); + return rc; +} + +static int idxAuthCallback( + void *pCtx, + int eOp, + const char *z3, + const char *z4, + const char *zDb, + const char *zTrigger +){ + int rc = SQLITE_OK; + (void)z4; + (void)zTrigger; + if( eOp==SQLITE_INSERT || eOp==SQLITE_UPDATE || eOp==SQLITE_DELETE ){ + if( sqlite3_stricmp(zDb, "main")==0 ){ + sqlite3expert *p = (sqlite3expert*)pCtx; + IdxTable *pTab; + for(pTab=p->pTable; pTab; pTab=pTab->pNext){ + if( 0==sqlite3_stricmp(z3, pTab->zName) ) break; + } + if( pTab ){ + IdxWrite *pWrite; + for(pWrite=p->pWrite; pWrite; pWrite=pWrite->pNext){ + if( pWrite->pTab==pTab && pWrite->eOp==eOp ) break; + } + if( pWrite==0 ){ + pWrite = idxMalloc(&rc, sizeof(IdxWrite)); + if( rc==SQLITE_OK ){ + pWrite->pTab = pTab; + pWrite->eOp = eOp; + pWrite->pNext = p->pWrite; + p->pWrite = pWrite; + } + } + } } - nByte += 1 + STRLEN(zCol); - rc = sqlite3_table_column_metadata( - db, "main", zTab, zCol, 0, &zColSeq, 0, 0, 0 - ); - if( zColSeq==0 ) zColSeq = "binary"; - nByte += 1 + STRLEN(zColSeq); - nCol++; - nPk += (sqlite3_column_int(p1, 5)>0); } - rc2 = sqlite3_reset(p1); - if( rc==SQLITE_OK ) rc = rc2; + return rc; +} - nByte += sizeof(IdxColumn) * nCol; - if( rc==SQLITE_OK ){ - pNew = idxMalloc(&rc, nByte); +static int idxProcessOneTrigger( + sqlite3expert *p, + IdxWrite *pWrite, + char **pzErr +){ + static const char *zInt = UNIQUE_TABLE_NAME; + static const char *zDrop = "DROP TABLE " UNIQUE_TABLE_NAME; + IdxTable *pTab = pWrite->pTab; + const char *zTab = pTab->zName; + const char *zSql = + "SELECT 'CREATE TEMP' || substr(sql, 7) FROM sqlite_schema " + "WHERE tbl_name = %Q AND type IN ('table', 'trigger') " + "ORDER BY type;"; + sqlite3_stmt *pSelect = 0; + int rc = SQLITE_OK; + char *zWrite = 0; + + /* Create the table and its triggers in the temp schema */ + rc = idxPrintfPrepareStmt(p->db, &pSelect, pzErr, zSql, zTab, zTab); + while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSelect) ){ + const char *zCreate = (const char*)sqlite3_column_text(pSelect, 0); + if( zCreate==0 ) continue; + rc = sqlite3_exec(p->dbv, zCreate, 0, 0, pzErr); } + idxFinalize(&rc, pSelect); + + /* Rename the table in the temp schema to zInt */ if( rc==SQLITE_OK ){ - pNew->aCol = (IdxColumn*)&pNew[1]; - pNew->nCol = nCol; - pCsr = (char*)&pNew->aCol[nCol]; + char *z = sqlite3_mprintf("ALTER TABLE temp.%Q RENAME TO %Q", zTab, zInt); + if( z==0 ){ + rc = SQLITE_NOMEM; + }else{ + rc = sqlite3_exec(p->dbv, z, 0, 0, pzErr); + sqlite3_free(z); + } } - nCol = 0; - while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){ - const char *zCol = (const char*)sqlite3_column_text(p1, 1); - const char *zColSeq = 0; - int nCopy; - if( zCol==0 ) continue; - nCopy = STRLEN(zCol) + 1; - pNew->aCol[nCol].zName = pCsr; - pNew->aCol[nCol].iPk = (sqlite3_column_int(p1, 5)==1 && nPk==1); - memcpy(pCsr, zCol, nCopy); - pCsr += nCopy; - - rc = sqlite3_table_column_metadata( - db, "main", zTab, zCol, 0, &zColSeq, 0, 0, 0 - ); - if( rc==SQLITE_OK ){ - if( zColSeq==0 ) zColSeq = "binary"; - nCopy = STRLEN(zColSeq) + 1; - pNew->aCol[nCol].zColl = pCsr; - memcpy(pCsr, zColSeq, nCopy); - pCsr += nCopy; + switch( pWrite->eOp ){ + case SQLITE_INSERT: { + int i; + zWrite = idxAppendText(&rc, zWrite, "INSERT INTO %Q VALUES(", zInt); + for(i=0; inCol; i++){ + zWrite = idxAppendText(&rc, zWrite, "%s?", i==0 ? "" : ", "); + } + zWrite = idxAppendText(&rc, zWrite, ")"); + break; + } + case SQLITE_UPDATE: { + int i; + zWrite = idxAppendText(&rc, zWrite, "UPDATE %Q SET ", zInt); + for(i=0; inCol; i++){ + zWrite = idxAppendText(&rc, zWrite, "%s%Q=?", i==0 ? "" : ", ", + pTab->aCol[i].zName + ); + } + break; + } + default: { + assert( pWrite->eOp==SQLITE_DELETE ); + if( rc==SQLITE_OK ){ + zWrite = sqlite3_mprintf("DELETE FROM %Q", zInt); + if( zWrite==0 ) rc = SQLITE_NOMEM; + } } + } - nCol++; + if( rc==SQLITE_OK ){ + sqlite3_stmt *pX = 0; + rc = sqlite3_prepare_v2(p->dbv, zWrite, -1, &pX, 0); + idxFinalize(&rc, pX); + if( rc!=SQLITE_OK ){ + idxDatabaseError(p->dbv, pzErr); + } } - idxFinalize(&rc, p1); + sqlite3_free(zWrite); - if( rc!=SQLITE_OK ){ - sqlite3_free(pNew); - pNew = 0; - }else if( ALWAYS(pNew!=0) ){ - pNew->zName = pCsr; - if( ALWAYS(pNew->zName!=0) ) memcpy(pNew->zName, zTab, nTab+1); + if( rc==SQLITE_OK ){ + rc = sqlite3_exec(p->dbv, zDrop, 0, 0, pzErr); } - *ppOut = pNew; return rc; } -/* -** This function is a no-op if *pRc is set to anything other than -** SQLITE_OK when it is called. -** -** If *pRc is initially set to SQLITE_OK, then the text specified by -** the printf() style arguments is appended to zIn and the result returned -** in a buffer allocated by sqlite3_malloc(). sqlite3_free() is called on -** zIn before returning. -*/ -static char *idxAppendText(int *pRc, char *zIn, const char *zFmt, ...){ - va_list ap; - char *zAppend = 0; - char *zRet = 0; - int nIn = zIn ? STRLEN(zIn) : 0; - int nAppend = 0; - va_start(ap, zFmt); - if( *pRc==SQLITE_OK ){ - zAppend = sqlite3_vmprintf(zFmt, ap); - if( zAppend ){ - nAppend = STRLEN(zAppend); - zRet = (char*)sqlite3_malloc(nIn + nAppend + 1); - } - if( zAppend && zRet ){ - if( nIn ) memcpy(zRet, zIn, nIn); - memcpy(&zRet[nIn], zAppend, nAppend+1); - }else{ - sqlite3_free(zRet); - zRet = 0; - *pRc = SQLITE_NOMEM; +static int idxProcessTriggers(sqlite3expert *p, char **pzErr){ + int rc = SQLITE_OK; + IdxWrite *pEnd = 0; + IdxWrite *pFirst = p->pWrite; + + while( rc==SQLITE_OK && pFirst!=pEnd ){ + IdxWrite *pIter; + for(pIter=pFirst; rc==SQLITE_OK && pIter!=pEnd; pIter=pIter->pNext){ + rc = idxProcessOneTrigger(p, pIter, pzErr); } - sqlite3_free(zAppend); - sqlite3_free(zIn); + pEnd = pFirst; + pFirst = p->pWrite; } - va_end(ap); - return zRet; + + return rc; } -/* -** Return true if zId must be quoted in order to use it as an SQL -** identifier, or false otherwise. -*/ -static int idxIdentifierRequiresQuotes(const char *zId){ - int i; - int nId = STRLEN(zId); - - if( sqlite3_keyword_check(zId, nId) ) return 1; - for(i=0; zId[i]; i++){ - if( !(zId[i]=='_') - && !(zId[i]>='0' && zId[i]<='9') - && !(zId[i]>='a' && zId[i]<='z') - && !(zId[i]>='A' && zId[i]<='Z') - ){ - return 1; +static int idxCreateVtabSchema(sqlite3expert *p, char **pzErrmsg){ + int rc = idxRegisterVtab(p); + sqlite3_stmt *pSchema = 0; + + /* For each table in the main db schema: + ** + ** 1) Add an entry to the p->pTable list, and + ** 2) Create the equivalent virtual table in dbv. + */ + rc = idxPrepareStmt(p->db, &pSchema, pzErrmsg, + "SELECT type, name, sql, 1 FROM sqlite_schema " + "WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%%' " + " UNION ALL " + "SELECT type, name, sql, 2 FROM sqlite_schema " + "WHERE type = 'trigger'" + " AND tbl_name IN(SELECT name FROM sqlite_schema WHERE type = 'view') " + "ORDER BY 4, 1" + ); + while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSchema) ){ + const char *zType = (const char*)sqlite3_column_text(pSchema, 0); + const char *zName = (const char*)sqlite3_column_text(pSchema, 1); + const char *zSql = (const char*)sqlite3_column_text(pSchema, 2); + + if( zType==0 || zName==0 ) continue; + if( zType[0]=='v' || zType[1]=='r' ){ + if( zSql ) rc = sqlite3_exec(p->dbv, zSql, 0, 0, pzErrmsg); + }else{ + IdxTable *pTab; + rc = idxGetTableInfo(p->db, zName, &pTab, pzErrmsg); + if( rc==SQLITE_OK ){ + int i; + char *zInner = 0; + char *zOuter = 0; + pTab->pNext = p->pTable; + p->pTable = pTab; + + /* The statement the vtab will pass to sqlite3_declare_vtab() */ + zInner = idxAppendText(&rc, 0, "CREATE TABLE x("); + for(i=0; inCol; i++){ + zInner = idxAppendText(&rc, zInner, "%s%Q COLLATE %s", + (i==0 ? "" : ", "), pTab->aCol[i].zName, pTab->aCol[i].zColl + ); + } + zInner = idxAppendText(&rc, zInner, ")"); + + /* The CVT statement to create the vtab */ + zOuter = idxAppendText(&rc, 0, + "CREATE VIRTUAL TABLE %Q USING expert(%Q)", zName, zInner + ); + if( rc==SQLITE_OK ){ + rc = sqlite3_exec(p->dbv, zOuter, 0, 0, pzErrmsg); + } + sqlite3_free(zInner); + sqlite3_free(zOuter); + } } } - return 0; + idxFinalize(&rc, pSchema); + return rc; } -/* -** This function appends an index column definition suitable for constraint -** pCons to the string passed as zIn and returns the result. -*/ -static char *idxAppendColDefn( - int *pRc, /* IN/OUT: Error code */ - char *zIn, /* Column defn accumulated so far */ - IdxTable *pTab, /* Table index will be created on */ - IdxConstraint *pCons +struct IdxSampleCtx { + int iTarget; + double target; /* Target nRet/nRow value */ + double nRow; /* Number of rows seen */ + double nRet; /* Number of rows returned */ +}; + +static void idxSampleFunc( + sqlite3_context *pCtx, + int argc, + sqlite3_value **argv ){ - char *zRet = zIn; - IdxColumn *p = &pTab->aCol[pCons->iCol]; - if( zRet ) zRet = idxAppendText(pRc, zRet, ", "); + struct IdxSampleCtx *p = (struct IdxSampleCtx*)sqlite3_user_data(pCtx); + int bRet; - if( idxIdentifierRequiresQuotes(p->zName) ){ - zRet = idxAppendText(pRc, zRet, "%Q", p->zName); + (void)argv; + assert( argc==0 ); + if( p->nRow==0.0 ){ + bRet = 1; }else{ - zRet = idxAppendText(pRc, zRet, "%s", p->zName); - } - - if( sqlite3_stricmp(p->zColl, pCons->zColl) ){ - if( idxIdentifierRequiresQuotes(pCons->zColl) ){ - zRet = idxAppendText(pRc, zRet, " COLLATE %Q", pCons->zColl); - }else{ - zRet = idxAppendText(pRc, zRet, " COLLATE %s", pCons->zColl); + bRet = (p->nRet / p->nRow) <= p->target; + if( bRet==0 ){ + unsigned short rnd; + sqlite3_randomness(2, (void*)&rnd); + bRet = ((int)rnd % 100) <= p->iTarget; } } - if( pCons->bDesc ){ - zRet = idxAppendText(pRc, zRet, " DESC"); - } - return zRet; + sqlite3_result_int(pCtx, bRet); + p->nRow += 1.0; + p->nRet += (double)bRet; } +struct IdxRemCtx { + int nSlot; + struct IdxRemSlot { + int eType; /* SQLITE_NULL, INTEGER, REAL, TEXT, BLOB */ + i64 iVal; /* SQLITE_INTEGER value */ + double rVal; /* SQLITE_FLOAT value */ + int nByte; /* Bytes of space allocated at z */ + int n; /* Size of buffer z */ + char *z; /* SQLITE_TEXT/BLOB value */ + } aSlot[1]; +}; + /* -** Search database dbm for an index compatible with the one idxCreateFromCons() -** would create from arguments pScan, pEq and pTail. If no error occurs and -** such an index is found, return non-zero. Or, if no such index is found, -** return zero. -** -** If an error occurs, set *pRc to an SQLite error code and return zero. +** Implementation of scalar function rem(). */ -static int idxFindCompatible( - int *pRc, /* OUT: Error code */ - sqlite3* dbm, /* Database to search */ - IdxScan *pScan, /* Scan for table to search for index on */ - IdxConstraint *pEq, /* List of == constraints */ - IdxConstraint *pTail /* List of range constraints */ +static void idxRemFunc( + sqlite3_context *pCtx, + int argc, + sqlite3_value **argv ){ - const char *zTbl = pScan->pTab->zName; - sqlite3_stmt *pIdxList = 0; - IdxConstraint *pIter; - int nEq = 0; /* Number of elements in pEq */ - int rc; + struct IdxRemCtx *p = (struct IdxRemCtx*)sqlite3_user_data(pCtx); + struct IdxRemSlot *pSlot; + int iSlot; + assert( argc==2 ); - /* Count the elements in list pEq */ - for(pIter=pEq; pIter; pIter=pIter->pLink) nEq++; + iSlot = sqlite3_value_int(argv[0]); + assert( iSlot<=p->nSlot ); + pSlot = &p->aSlot[iSlot]; - rc = idxPrintfPrepareStmt(dbm, &pIdxList, 0, "PRAGMA index_list=%Q", zTbl); - while( rc==SQLITE_OK && sqlite3_step(pIdxList)==SQLITE_ROW ){ - int bMatch = 1; - IdxConstraint *pT = pTail; - sqlite3_stmt *pInfo = 0; - const char *zIdx = (const char*)sqlite3_column_text(pIdxList, 1); - if( zIdx==0 ) continue; + switch( pSlot->eType ){ + case SQLITE_NULL: + /* no-op */ + break; - /* Zero the IdxConstraint.bFlag values in the pEq list */ - for(pIter=pEq; pIter; pIter=pIter->pLink) pIter->bFlag = 0; + case SQLITE_INTEGER: + sqlite3_result_int64(pCtx, pSlot->iVal); + break; - rc = idxPrintfPrepareStmt(dbm, &pInfo, 0, "PRAGMA index_xInfo=%Q", zIdx); - while( rc==SQLITE_OK && sqlite3_step(pInfo)==SQLITE_ROW ){ - int iIdx = sqlite3_column_int(pInfo, 0); - int iCol = sqlite3_column_int(pInfo, 1); - const char *zColl = (const char*)sqlite3_column_text(pInfo, 4); + case SQLITE_FLOAT: + sqlite3_result_double(pCtx, pSlot->rVal); + break; - if( iIdxpLink){ - if( pIter->bFlag ) continue; - if( pIter->iCol!=iCol ) continue; - if( sqlite3_stricmp(pIter->zColl, zColl) ) continue; - pIter->bFlag = 1; - break; - } - if( pIter==0 ){ - bMatch = 0; - break; - } - }else{ - if( pT ){ - if( pT->iCol!=iCol || sqlite3_stricmp(pT->zColl, zColl) ){ - bMatch = 0; - break; - } - pT = pT->pLink; - } - } - } - idxFinalize(&rc, pInfo); + case SQLITE_BLOB: + sqlite3_result_blob(pCtx, pSlot->z, pSlot->n, SQLITE_TRANSIENT); + break; - if( rc==SQLITE_OK && bMatch ){ - sqlite3_finalize(pIdxList); - return 1; - } + case SQLITE_TEXT: + sqlite3_result_text(pCtx, pSlot->z, pSlot->n, SQLITE_TRANSIENT); + break; } - idxFinalize(&rc, pIdxList); - - *pRc = rc; - return 0; -} -/* Callback for sqlite3_exec() with query with leading count(*) column. - * The first argument is expected to be an int*, referent to be incremented - * if that leading column is not exactly '0'. - */ -static int countNonzeros(void* pCount, int nc, - char* azResults[], char* azColumns[]){ - (void)azColumns; /* Suppress unused parameter warning */ - if( nc>0 && (azResults[0][0]!='0' || azResults[0][1]!=0) ){ - *((int *)pCount) += 1; - } - return 0; -} + pSlot->eType = sqlite3_value_type(argv[1]); + switch( pSlot->eType ){ + case SQLITE_NULL: + /* no-op */ + break; -static int idxCreateFromCons( - sqlite3expert *p, - IdxScan *pScan, - IdxConstraint *pEq, - IdxConstraint *pTail -){ - sqlite3 *dbm = p->dbm; - int rc = SQLITE_OK; - if( (pEq || pTail) && 0==idxFindCompatible(&rc, dbm, pScan, pEq, pTail) ){ - IdxTable *pTab = pScan->pTab; - char *zCols = 0; - char *zIdx = 0; - IdxConstraint *pCons; - unsigned int h = 0; - const char *zFmt; + case SQLITE_INTEGER: + pSlot->iVal = sqlite3_value_int64(argv[1]); + break; - for(pCons=pEq; pCons; pCons=pCons->pLink){ - zCols = idxAppendColDefn(&rc, zCols, pTab, pCons); - } - for(pCons=pTail; pCons; pCons=pCons->pLink){ - zCols = idxAppendColDefn(&rc, zCols, pTab, pCons); - } + case SQLITE_FLOAT: + pSlot->rVal = sqlite3_value_double(argv[1]); + break; - if( rc==SQLITE_OK ){ - /* Hash the list of columns to come up with a name for the index */ - const char *zTable = pScan->pTab->zName; - int quoteTable = idxIdentifierRequiresQuotes(zTable); - char *zName = 0; /* Index name */ - int collisions = 0; - do{ - int i; - char *zFind; - for(i=0; zCols[i]; i++){ - h += ((h<<3) + zCols[i]); - } - sqlite3_free(zName); - zName = sqlite3_mprintf("%s_idx_%08x", zTable, h); - if( zName==0 ) break; - /* Is is unique among table, view and index names? */ - zFmt = "SELECT count(*) FROM sqlite_schema WHERE name=%Q" - " AND type in ('index','table','view')"; - zFind = sqlite3_mprintf(zFmt, zName); - i = 0; - rc = sqlite3_exec(dbm, zFind, countNonzeros, &i, 0); - assert(rc==SQLITE_OK); - sqlite3_free(zFind); - if( i==0 ){ - collisions = 0; - break; - } - ++collisions; - }while( collisions<50 && zName!=0 ); - if( collisions ){ - /* This return means "Gave up trying to find a unique index name." */ - rc = SQLITE_BUSY_TIMEOUT; - }else if( zName==0 ){ - rc = SQLITE_NOMEM; - }else{ - if( quoteTable ){ - zFmt = "CREATE INDEX \"%w\" ON \"%w\"(%s)"; - }else{ - zFmt = "CREATE INDEX %s ON %s(%s)"; - } - zIdx = sqlite3_mprintf(zFmt, zName, zTable, zCols); - if( !zIdx ){ - rc = SQLITE_NOMEM; - }else{ - rc = sqlite3_exec(dbm, zIdx, 0, 0, p->pzErrmsg); - if( rc!=SQLITE_OK ){ - rc = SQLITE_BUSY_TIMEOUT; - }else{ - idxHashAdd(&rc, &p->hIdx, zName, zIdx); - } + case SQLITE_BLOB: + case SQLITE_TEXT: { + int nByte = sqlite3_value_bytes(argv[1]); + const void *pData = 0; + if( nByte>pSlot->nByte ){ + char *zNew = (char*)sqlite3_realloc(pSlot->z, nByte*2); + if( zNew==0 ){ + sqlite3_result_error_nomem(pCtx); + return; } - sqlite3_free(zName); - sqlite3_free(zIdx); + pSlot->nByte = nByte*2; + pSlot->z = zNew; + } + pSlot->n = nByte; + if( pSlot->eType==SQLITE_BLOB ){ + pData = sqlite3_value_blob(argv[1]); + if( pData ) memcpy(pSlot->z, pData, nByte); + }else{ + pData = sqlite3_value_text(argv[1]); + memcpy(pSlot->z, pData, nByte); } + break; } - - sqlite3_free(zCols); } - return rc; } -/* -** Return true if list pList (linked by IdxConstraint.pLink) contains -** a constraint compatible with *p. Otherwise return false. -*/ -static int idxFindConstraint(IdxConstraint *pList, IdxConstraint *p){ - IdxConstraint *pCmp; - for(pCmp=pList; pCmp; pCmp=pCmp->pLink){ - if( p->iCol==pCmp->iCol ) return 1; +static int idxLargestIndex(sqlite3 *db, int *pnMax, char **pzErr){ + int rc = SQLITE_OK; + const char *zMax = + "SELECT max(i.seqno) FROM " + " sqlite_schema AS s, " + " pragma_index_list(s.name) AS l, " + " pragma_index_info(l.name) AS i " + "WHERE s.type = 'table'"; + sqlite3_stmt *pMax = 0; + + *pnMax = 0; + rc = idxPrepareStmt(db, &pMax, pzErr, zMax); + if( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pMax) ){ + *pnMax = sqlite3_column_int(pMax, 0) + 1; } - return 0; + idxFinalize(&rc, pMax); + + return rc; } -static int idxCreateFromWhere( - sqlite3expert *p, - IdxScan *pScan, /* Create indexes for this scan */ - IdxConstraint *pTail /* range/ORDER BY constraints for inclusion */ +static int idxPopulateOneStat1( + sqlite3expert *p, + sqlite3_stmt *pIndexXInfo, + sqlite3_stmt *pWriteStat, + const char *zTab, + const char *zIdx, + char **pzErr ){ - IdxConstraint *p1 = 0; - IdxConstraint *pCon; - int rc; + char *zCols = 0; + char *zOrder = 0; + char *zQuery = 0; + int nCol = 0; + int i; + sqlite3_stmt *pQuery = 0; + int *aStat = 0; + int rc = SQLITE_OK; - /* Gather up all the == constraints. */ - for(pCon=pScan->pEq; pCon; pCon=pCon->pNext){ - if( !idxFindConstraint(p1, pCon) && !idxFindConstraint(pTail, pCon) ){ - pCon->pLink = p1; - p1 = pCon; + assert( p->iSample>0 ); + + /* Formulate the query text */ + sqlite3_bind_text(pIndexXInfo, 1, zIdx, -1, SQLITE_STATIC); + while( SQLITE_OK==rc && SQLITE_ROW==sqlite3_step(pIndexXInfo) ){ + const char *zComma = zCols==0 ? "" : ", "; + const char *zName = (const char*)sqlite3_column_text(pIndexXInfo, 0); + const char *zColl = (const char*)sqlite3_column_text(pIndexXInfo, 1); + zCols = idxAppendText(&rc, zCols, + "%sx.%Q IS rem(%d, x.%Q) COLLATE %s", zComma, zName, nCol, zName, zColl + ); + zOrder = idxAppendText(&rc, zOrder, "%s%d", zComma, ++nCol); + } + sqlite3_reset(pIndexXInfo); + if( rc==SQLITE_OK ){ + if( p->iSample==100 ){ + zQuery = sqlite3_mprintf( + "SELECT %s FROM %Q x ORDER BY %s", zCols, zTab, zOrder + ); + }else{ + zQuery = sqlite3_mprintf( + "SELECT %s FROM temp."UNIQUE_TABLE_NAME" x ORDER BY %s", zCols, zOrder + ); } } + sqlite3_free(zCols); + sqlite3_free(zOrder); - /* Create an index using the == constraints collected above. And the - ** range constraint/ORDER BY terms passed in by the caller, if any. */ - rc = idxCreateFromCons(p, pScan, p1, pTail); + /* Formulate the query text */ + if( rc==SQLITE_OK ){ + sqlite3 *dbrem = (p->iSample==100 ? p->db : p->dbv); + rc = idxPrepareStmt(dbrem, &pQuery, pzErr, zQuery); + } + sqlite3_free(zQuery); - /* If no range/ORDER BY passed by the caller, create a version of the - ** index for each range constraint. */ - if( pTail==0 ){ - for(pCon=pScan->pRange; rc==SQLITE_OK && pCon; pCon=pCon->pNext){ - assert( pCon->pLink==0 ); - if( !idxFindConstraint(p1, pCon) && !idxFindConstraint(pTail, pCon) ){ - rc = idxCreateFromCons(p, pScan, p1, pCon); + if( rc==SQLITE_OK ){ + aStat = (int*)idxMalloc(&rc, sizeof(int)*(nCol+1)); + } + if( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pQuery) ){ + IdxHashEntry *pEntry; + char *zStat = 0; + for(i=0; i<=nCol; i++) aStat[i] = 1; + while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pQuery) ){ + aStat[0]++; + for(i=0; ihIdx, zIdx, STRLEN(zIdx)); + if( pEntry ){ + assert( pEntry->zVal2==0 ); + pEntry->zVal2 = zStat; + }else{ + sqlite3_free(zStat); + } } + sqlite3_free(aStat); + idxFinalize(&rc, pQuery); + + return rc; +} + +static int idxBuildSampleTable(sqlite3expert *p, const char *zTab){ + int rc; + char *zSql; + + rc = sqlite3_exec(p->dbv,"DROP TABLE IF EXISTS temp."UNIQUE_TABLE_NAME,0,0,0); + if( rc!=SQLITE_OK ) return rc; + + zSql = sqlite3_mprintf( + "CREATE TABLE temp." UNIQUE_TABLE_NAME " AS SELECT * FROM %Q", zTab + ); + if( zSql==0 ) return SQLITE_NOMEM; + rc = sqlite3_exec(p->dbv, zSql, 0, 0, 0); + sqlite3_free(zSql); return rc; } /* -** Create candidate indexes in database [dbm] based on the data in -** linked-list pScan. +** This function is called as part of sqlite3_expert_analyze(). Candidate +** indexes have already been created in database sqlite3expert.dbm, this +** function populates sqlite_stat1 table in the same database. +** +** The stat1 data is generated by querying the */ -static int idxCreateCandidates(sqlite3expert *p){ +static int idxPopulateStat1(sqlite3expert *p, char **pzErr){ int rc = SQLITE_OK; - IdxScan *pIter; + int nMax =0; + struct IdxRemCtx *pCtx = 0; + struct IdxSampleCtx samplectx; + int i; + i64 iPrev = -100000; + sqlite3_stmt *pAllIndex = 0; + sqlite3_stmt *pIndexXInfo = 0; + sqlite3_stmt *pWrite = 0; - for(pIter=p->pScan; pIter && rc==SQLITE_OK; pIter=pIter->pNextScan){ - rc = idxCreateFromWhere(p, pIter, 0); - if( rc==SQLITE_OK && pIter->pOrder ){ - rc = idxCreateFromWhere(p, pIter, pIter->pOrder); + const char *zAllIndex = + "SELECT s.rowid, s.name, l.name FROM " + " sqlite_schema AS s, " + " pragma_index_list(s.name) AS l " + "WHERE s.type = 'table'"; + const char *zIndexXInfo = + "SELECT name, coll FROM pragma_index_xinfo(?) WHERE key"; + const char *zWrite = "INSERT INTO sqlite_stat1 VALUES(?, ?, ?)"; + + /* If iSample==0, no sqlite_stat1 data is required. */ + if( p->iSample==0 ) return SQLITE_OK; + + rc = idxLargestIndex(p->dbm, &nMax, pzErr); + if( nMax<=0 || rc!=SQLITE_OK ) return rc; + + rc = sqlite3_exec(p->dbm, "ANALYZE; PRAGMA writable_schema=1", 0, 0, 0); + + if( rc==SQLITE_OK ){ + int nByte = sizeof(struct IdxRemCtx) + (sizeof(struct IdxRemSlot) * nMax); + pCtx = (struct IdxRemCtx*)idxMalloc(&rc, nByte); + } + + if( rc==SQLITE_OK ){ + sqlite3 *dbrem = (p->iSample==100 ? p->db : p->dbv); + rc = sqlite3_create_function( + dbrem, "rem", 2, SQLITE_UTF8, (void*)pCtx, idxRemFunc, 0, 0 + ); + } + if( rc==SQLITE_OK ){ + rc = sqlite3_create_function( + p->db, "sample", 0, SQLITE_UTF8, (void*)&samplectx, idxSampleFunc, 0, 0 + ); + } + + if( rc==SQLITE_OK ){ + pCtx->nSlot = nMax+1; + rc = idxPrepareStmt(p->dbm, &pAllIndex, pzErr, zAllIndex); + } + if( rc==SQLITE_OK ){ + rc = idxPrepareStmt(p->dbm, &pIndexXInfo, pzErr, zIndexXInfo); + } + if( rc==SQLITE_OK ){ + rc = idxPrepareStmt(p->dbm, &pWrite, pzErr, zWrite); + } + + while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pAllIndex) ){ + i64 iRowid = sqlite3_column_int64(pAllIndex, 0); + const char *zTab = (const char*)sqlite3_column_text(pAllIndex, 1); + const char *zIdx = (const char*)sqlite3_column_text(pAllIndex, 2); + if( zTab==0 || zIdx==0 ) continue; + if( p->iSample<100 && iPrev!=iRowid ){ + samplectx.target = (double)p->iSample / 100.0; + samplectx.iTarget = p->iSample; + samplectx.nRow = 0.0; + samplectx.nRet = 0.0; + rc = idxBuildSampleTable(p, zTab); + if( rc!=SQLITE_OK ) break; + } + rc = idxPopulateOneStat1(p, pIndexXInfo, pWrite, zTab, zIdx, pzErr); + iPrev = iRowid; + } + if( rc==SQLITE_OK && p->iSample<100 ){ + rc = sqlite3_exec(p->dbv, + "DROP TABLE IF EXISTS temp." UNIQUE_TABLE_NAME, 0,0,0 + ); + } + + idxFinalize(&rc, pAllIndex); + idxFinalize(&rc, pIndexXInfo); + idxFinalize(&rc, pWrite); + + if( pCtx ){ + for(i=0; inSlot; i++){ + sqlite3_free(pCtx->aSlot[i].z); } + sqlite3_free(pCtx); + } + + if( rc==SQLITE_OK ){ + rc = sqlite3_exec(p->dbm, "ANALYZE sqlite_schema", 0, 0, 0); } + sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp."UNIQUE_TABLE_NAME,0,0,0); return rc; } /* -** Free all elements of the linked list starting at pConstraint. +** Define and possibly pretend to use a useless collation sequence. +** This pretense allows expert to accept SQL using custom collations. */ -static void idxConstraintFree(IdxConstraint *pConstraint){ - IdxConstraint *pNext; - IdxConstraint *p; - - for(p=pConstraint; p; p=pNext){ - pNext = p->pNext; - sqlite3_free(p); - } +int dummyCompare(void *up1, int up2, const void *up3, int up4, const void *up5){ + (void)up1; + (void)up2; + (void)up3; + (void)up4; + (void)up5; + assert(0); /* VDBE should never be run. */ + return 0; } - -/* -** Free all elements of the linked list starting from pScan up until pLast -** (pLast is not freed). -*/ -static void idxScanFree(IdxScan *pScan, IdxScan *pLast){ - IdxScan *p; - IdxScan *pNext; - for(p=pScan; p!=pLast; p=pNext){ - pNext = p->pNextScan; - idxConstraintFree(p->pOrder); - idxConstraintFree(p->pEq); - idxConstraintFree(p->pRange); - sqlite3_free(p); - } +/* And a callback to register above upon actual need */ +void useDummyCS(void *up1, sqlite3 *db, int etr, const char *zName){ + (void)up1; + sqlite3_create_collation_v2(db, zName, etr, 0, dummyCompare, 0); } +#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) \ + && !defined(SQLITE_OMIT_INTROSPECTION_PRAGMAS) /* -** Free all elements of the linked list starting from pStatement up -** until pLast (pLast is not freed). +** dummy functions for no-op implementation of UDFs during expert's work */ -static void idxStatementFree(IdxStatement *pStatement, IdxStatement *pLast){ - IdxStatement *p; - IdxStatement *pNext; - for(p=pStatement; p!=pLast; p=pNext){ - pNext = p->pNext; - sqlite3_free(p->zEQP); - sqlite3_free(p->zIdx); - sqlite3_free(p); - } +void dummyUDF(sqlite3_context *up1, int up2, sqlite3_value **up3){ + (void)up1; + (void)up2; + (void)up3; + assert(0); /* VDBE should never be run. */ +} +void dummyUDFvalue(sqlite3_context *up1){ + (void)up1; + assert(0); /* VDBE should never be run. */ } /* -** Free the linked list of IdxTable objects starting at pTab. +** Register UDFs from user database with another. */ -static void idxTableFree(IdxTable *pTab){ - IdxTable *pIter; - IdxTable *pNext; - for(pIter=pTab; pIter; pIter=pNext){ - pNext = pIter->pNext; - sqlite3_free(pIter); +int registerUDFs(sqlite3 *dbSrc, sqlite3 *dbDst){ + sqlite3_stmt *pStmt; + int rc = sqlite3_prepare_v2(dbSrc, + "SELECT name,type,enc,narg,flags " + "FROM pragma_function_list() " + "WHERE builtin==0", -1, &pStmt, 0); + if( rc==SQLITE_OK ){ + while( SQLITE_ROW==(rc = sqlite3_step(pStmt)) ){ + int nargs = sqlite3_column_int(pStmt,3); + int flags = sqlite3_column_int(pStmt,4); + const char *name = (char*)sqlite3_column_text(pStmt,0); + const char *type = (char*)sqlite3_column_text(pStmt,1); + const char *enc = (char*)sqlite3_column_text(pStmt,2); + if( name==0 || type==0 || enc==0 ){ + /* no-op. Only happens on OOM */ + }else{ + int ienc = SQLITE_UTF8; + int rcf = SQLITE_ERROR; + if( strcmp(enc,"utf16le")==0 ) ienc = SQLITE_UTF16LE; + else if( strcmp(enc,"utf16be")==0 ) ienc = SQLITE_UTF16BE; + ienc |= (flags & (SQLITE_DETERMINISTIC|SQLITE_DIRECTONLY)); + if( strcmp(type,"w")==0 ){ + rcf = sqlite3_create_window_function(dbDst,name,nargs,ienc,0, + dummyUDF,dummyUDFvalue,0,0,0); + }else if( strcmp(type,"a")==0 ){ + rcf = sqlite3_create_function(dbDst,name,nargs,ienc,0, + 0,dummyUDF,dummyUDFvalue); + }else if( strcmp(type,"s")==0 ){ + rcf = sqlite3_create_function(dbDst,name,nargs,ienc,0, + dummyUDF,0,0); + } + if( rcf!=SQLITE_OK ){ + rc = rcf; + break; + } + } + } + sqlite3_finalize(pStmt); + if( rc==SQLITE_DONE ) rc = SQLITE_OK; } + return rc; } +#endif /* -** Free the linked list of IdxWrite objects starting at pTab. +** Allocate a new sqlite3expert object. */ -static void idxWriteFree(IdxWrite *pTab){ - IdxWrite *pIter; - IdxWrite *pNext; - for(pIter=pTab; pIter; pIter=pNext){ - pNext = pIter->pNext; - sqlite3_free(pIter); - } -} +sqlite3expert *sqlite3_expert_new(sqlite3 *db, char **pzErrmsg){ + int rc = SQLITE_OK; + sqlite3expert *pNew; + pNew = (sqlite3expert*)idxMalloc(&rc, sizeof(sqlite3expert)); + /* Open two in-memory databases to work with. The "vtab database" (dbv) + ** will contain a virtual table corresponding to each real table in + ** the user database schema, and a copy of each view. It is used to + ** collect information regarding the WHERE, ORDER BY and other clauses + ** of the user's query. + */ + if( rc==SQLITE_OK ){ + pNew->db = db; + pNew->iSample = 100; + rc = sqlite3_open(":memory:", &pNew->dbv); + } + if( rc==SQLITE_OK ){ + rc = sqlite3_open(":memory:", &pNew->dbm); + if( rc==SQLITE_OK ){ + sqlite3_db_config(pNew->dbm, SQLITE_DBCONFIG_TRIGGER_EQP, 1, (int*)0); + } + } -/* -** This function is called after candidate indexes have been created. It -** runs all the queries to see which indexes they prefer, and populates -** IdxStatement.zIdx and IdxStatement.zEQP with the results. -*/ -static int idxFindIndexes( - sqlite3expert *p, - char **pzErr /* OUT: Error message (sqlite3_malloc) */ -){ - IdxStatement *pStmt; - sqlite3 *dbm = p->dbm; - int rc = SQLITE_OK; + /* Allow custom collations to be dealt with through prepare. */ + if( rc==SQLITE_OK ) rc = sqlite3_collation_needed(pNew->dbm,0,useDummyCS); + if( rc==SQLITE_OK ) rc = sqlite3_collation_needed(pNew->dbv,0,useDummyCS); - IdxHash hIdx; - idxHashInit(&hIdx); +#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) \ + && !defined(SQLITE_OMIT_INTROSPECTION_PRAGMAS) + /* Register UDFs from database [db] with [dbm] and [dbv]. */ + if( rc==SQLITE_OK ){ + rc = registerUDFs(pNew->db, pNew->dbm); + } + if( rc==SQLITE_OK ){ + rc = registerUDFs(pNew->db, pNew->dbv); + } +#endif - for(pStmt=p->pStatement; rc==SQLITE_OK && pStmt; pStmt=pStmt->pNext){ - IdxHashEntry *pEntry; - sqlite3_stmt *pExplain = 0; - idxHashClear(&hIdx); - rc = idxPrintfPrepareStmt(dbm, &pExplain, pzErr, - "EXPLAIN QUERY PLAN %s", pStmt->zSql + /* Copy the entire schema of database [db] into [dbm]. */ + if( rc==SQLITE_OK ){ + sqlite3_stmt *pSql = 0; + rc = idxPrintfPrepareStmt(pNew->db, &pSql, pzErrmsg, + "SELECT sql FROM sqlite_schema WHERE name NOT LIKE 'sqlite_%%'" + " AND sql NOT LIKE 'CREATE VIRTUAL %%' ORDER BY rowid" ); - while( rc==SQLITE_OK && sqlite3_step(pExplain)==SQLITE_ROW ){ - /* int iId = sqlite3_column_int(pExplain, 0); */ - /* int iParent = sqlite3_column_int(pExplain, 1); */ - /* int iNotUsed = sqlite3_column_int(pExplain, 2); */ - const char *zDetail = (const char*)sqlite3_column_text(pExplain, 3); - int nDetail; - int i; + while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSql) ){ + const char *zSql = (const char*)sqlite3_column_text(pSql, 0); + if( zSql ) rc = sqlite3_exec(pNew->dbm, zSql, 0, 0, pzErrmsg); + } + idxFinalize(&rc, pSql); + } - if( !zDetail ) continue; - nDetail = STRLEN(zDetail); + /* Create the vtab schema */ + if( rc==SQLITE_OK ){ + rc = idxCreateVtabSchema(pNew, pzErrmsg); + } - for(i=0; ihIdx, zIdx, nIdx); - if( zSql ){ - idxHashAdd(&rc, &hIdx, zSql, 0); - if( rc ) goto find_indexes_out; - } - break; - } - } + /* Register the auth callback with dbv */ + if( rc==SQLITE_OK ){ + sqlite3_set_authorizer(pNew->dbv, idxAuthCallback, (void*)pNew); + } - if( zDetail[0]!='-' ){ - pStmt->zEQP = idxAppendText(&rc, pStmt->zEQP, "%s\n", zDetail); - } - } + /* If an error has occurred, free the new object and reutrn NULL. Otherwise, + ** return the new sqlite3expert handle. */ + if( rc!=SQLITE_OK ){ + sqlite3_expert_destroy(pNew); + pNew = 0; + } + return pNew; +} - for(pEntry=hIdx.pFirst; pEntry; pEntry=pEntry->pNext){ - pStmt->zIdx = idxAppendText(&rc, pStmt->zIdx, "%s;\n", pEntry->zKey); +/* +** Configure an sqlite3expert object. +*/ +int sqlite3_expert_config(sqlite3expert *p, int op, ...){ + int rc = SQLITE_OK; + va_list ap; + va_start(ap, op); + switch( op ){ + case EXPERT_CONFIG_SAMPLE: { + int iVal = va_arg(ap, int); + if( iVal<0 ) iVal = 0; + if( iVal>100 ) iVal = 100; + p->iSample = iVal; + break; } - - idxFinalize(&rc, pExplain); + default: + rc = SQLITE_NOTFOUND; + break; } - find_indexes_out: - idxHashClear(&hIdx); + va_end(ap); return rc; } -static int idxAuthCallback( - void *pCtx, - int eOp, - const char *z3, - const char *z4, - const char *zDb, - const char *zTrigger +/* +** Add an SQL statement to the analysis. +*/ +int sqlite3_expert_sql( + sqlite3expert *p, /* From sqlite3_expert_new() */ + const char *zSql, /* SQL statement to add */ + char **pzErr /* OUT: Error message (if any) */ ){ + IdxScan *pScanOrig = p->pScan; + IdxStatement *pStmtOrig = p->pStatement; int rc = SQLITE_OK; - (void)z4; - (void)zTrigger; - if( eOp==SQLITE_INSERT || eOp==SQLITE_UPDATE || eOp==SQLITE_DELETE ){ - if( sqlite3_stricmp(zDb, "main")==0 ){ - sqlite3expert *p = (sqlite3expert*)pCtx; - IdxTable *pTab; - for(pTab=p->pTable; pTab; pTab=pTab->pNext){ - if( 0==sqlite3_stricmp(z3, pTab->zName) ) break; - } - if( pTab ){ - IdxWrite *pWrite; - for(pWrite=p->pWrite; pWrite; pWrite=pWrite->pNext){ - if( pWrite->pTab==pTab && pWrite->eOp==eOp ) break; - } - if( pWrite==0 ){ - pWrite = idxMalloc(&rc, sizeof(IdxWrite)); - if( rc==SQLITE_OK ){ - pWrite->pTab = pTab; - pWrite->eOp = eOp; - pWrite->pNext = p->pWrite; - p->pWrite = pWrite; - } + const char *zStmt = zSql; + + if( p->bRun ) return SQLITE_MISUSE; + + while( rc==SQLITE_OK && zStmt && zStmt[0] ){ + sqlite3_stmt *pStmt = 0; + /* Ensure that the provided statement compiles against user's DB. */ + rc = idxPrepareStmt(p->db, &pStmt, pzErr, zStmt); + if( rc!=SQLITE_OK ) break; + sqlite3_finalize(pStmt); + rc = sqlite3_prepare_v2(p->dbv, zStmt, -1, &pStmt, &zStmt); + if( rc==SQLITE_OK ){ + if( pStmt ){ + IdxStatement *pNew; + const char *z = sqlite3_sql(pStmt); + int n = STRLEN(z); + pNew = (IdxStatement*)idxMalloc(&rc, sizeof(IdxStatement) + n+1); + if( rc==SQLITE_OK ){ + pNew->zSql = (char*)&pNew[1]; + memcpy(pNew->zSql, z, n+1); + pNew->pNext = p->pStatement; + if( p->pStatement ) pNew->iId = p->pStatement->iId+1; + p->pStatement = pNew; } + sqlite3_finalize(pStmt); } + }else{ + idxDatabaseError(p->dbv, pzErr); } } + + if( rc!=SQLITE_OK ){ + idxScanFree(p->pScan, pScanOrig); + idxStatementFree(p->pStatement, pStmtOrig); + p->pScan = pScanOrig; + p->pStatement = pStmtOrig; + } + return rc; } -static int idxProcessOneTrigger( - sqlite3expert *p, - IdxWrite *pWrite, - char **pzErr -){ - static const char *zInt = UNIQUE_TABLE_NAME; - static const char *zDrop = "DROP TABLE " UNIQUE_TABLE_NAME; - IdxTable *pTab = pWrite->pTab; - const char *zTab = pTab->zName; - const char *zSql = - "SELECT 'CREATE TEMP' || substr(sql, 7) FROM sqlite_schema " - "WHERE tbl_name = %Q AND type IN ('table', 'trigger') " - "ORDER BY type;"; - sqlite3_stmt *pSelect = 0; - int rc = SQLITE_OK; - char *zWrite = 0; +int sqlite3_expert_analyze(sqlite3expert *p, char **pzErr){ + int rc; + IdxHashEntry *pEntry; - /* Create the table and its triggers in the temp schema */ - rc = idxPrintfPrepareStmt(p->db, &pSelect, pzErr, zSql, zTab, zTab); - while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSelect) ){ - const char *zCreate = (const char*)sqlite3_column_text(pSelect, 0); - if( zCreate==0 ) continue; - rc = sqlite3_exec(p->dbv, zCreate, 0, 0, pzErr); + /* Do trigger processing to collect any extra IdxScan structures */ + rc = idxProcessTriggers(p, pzErr); + + /* Create candidate indexes within the in-memory database file */ + if( rc==SQLITE_OK ){ + rc = idxCreateCandidates(p); + }else if ( rc==SQLITE_BUSY_TIMEOUT ){ + if( pzErr ) + *pzErr = sqlite3_mprintf("Cannot find a unique index name to propose."); + return rc; } - idxFinalize(&rc, pSelect); - /* Rename the table in the temp schema to zInt */ + /* Generate the stat1 data */ if( rc==SQLITE_OK ){ - char *z = sqlite3_mprintf("ALTER TABLE temp.%Q RENAME TO %Q", zTab, zInt); - if( z==0 ){ - rc = SQLITE_NOMEM; - }else{ - rc = sqlite3_exec(p->dbv, z, 0, 0, pzErr); - sqlite3_free(z); - } + rc = idxPopulateStat1(p, pzErr); } - switch( pWrite->eOp ){ - case SQLITE_INSERT: { - int i; - zWrite = idxAppendText(&rc, zWrite, "INSERT INTO %Q VALUES(", zInt); - for(i=0; inCol; i++){ - zWrite = idxAppendText(&rc, zWrite, "%s?", i==0 ? "" : ", "); - } - zWrite = idxAppendText(&rc, zWrite, ")"); - break; - } - case SQLITE_UPDATE: { - int i; - zWrite = idxAppendText(&rc, zWrite, "UPDATE %Q SET ", zInt); - for(i=0; inCol; i++){ - zWrite = idxAppendText(&rc, zWrite, "%s%Q=?", i==0 ? "" : ", ", - pTab->aCol[i].zName - ); - } - break; - } - default: { - assert( pWrite->eOp==SQLITE_DELETE ); - if( rc==SQLITE_OK ){ - zWrite = sqlite3_mprintf("DELETE FROM %Q", zInt); - if( zWrite==0 ) rc = SQLITE_NOMEM; - } - } + /* Formulate the EXPERT_REPORT_CANDIDATES text */ + for(pEntry=p->hIdx.pFirst; pEntry; pEntry=pEntry->pNext){ + p->zCandidates = idxAppendText(&rc, p->zCandidates, + "%s;%s%s\n", pEntry->zVal, + pEntry->zVal2 ? " -- stat1: " : "", pEntry->zVal2 + ); } + /* Figure out which of the candidate indexes are preferred by the query + ** planner and report the results to the user. */ if( rc==SQLITE_OK ){ - sqlite3_stmt *pX = 0; - rc = sqlite3_prepare_v2(p->dbv, zWrite, -1, &pX, 0); - idxFinalize(&rc, pX); - if( rc!=SQLITE_OK ){ - idxDatabaseError(p->dbv, pzErr); - } + rc = idxFindIndexes(p, pzErr); } - sqlite3_free(zWrite); if( rc==SQLITE_OK ){ - rc = sqlite3_exec(p->dbv, zDrop, 0, 0, pzErr); + p->bRun = 1; } - return rc; } -static int idxProcessTriggers(sqlite3expert *p, char **pzErr){ - int rc = SQLITE_OK; - IdxWrite *pEnd = 0; - IdxWrite *pFirst = p->pWrite; +/* +** Return the total number of statements that have been added to this +** sqlite3expert using sqlite3_expert_sql(). +*/ +int sqlite3_expert_count(sqlite3expert *p){ + int nRet = 0; + if( p->pStatement ) nRet = p->pStatement->iId+1; + return nRet; +} - while( rc==SQLITE_OK && pFirst!=pEnd ){ - IdxWrite *pIter; - for(pIter=pFirst; rc==SQLITE_OK && pIter!=pEnd; pIter=pIter->pNext){ - rc = idxProcessOneTrigger(p, pIter, pzErr); - } - pEnd = pFirst; - pFirst = p->pWrite; +/* +** Return a component of the report. +*/ +const char *sqlite3_expert_report(sqlite3expert *p, int iStmt, int eReport){ + const char *zRet = 0; + IdxStatement *pStmt; + + if( p->bRun==0 ) return 0; + for(pStmt=p->pStatement; pStmt && pStmt->iId!=iStmt; pStmt=pStmt->pNext); + switch( eReport ){ + case EXPERT_REPORT_SQL: + if( pStmt ) zRet = pStmt->zSql; + break; + case EXPERT_REPORT_INDEXES: + if( pStmt ) zRet = pStmt->zIdx; + break; + case EXPERT_REPORT_PLAN: + if( pStmt ) zRet = pStmt->zEQP; + break; + case EXPERT_REPORT_CANDIDATES: + zRet = p->zCandidates; + break; } + return zRet; +} - return rc; +/* +** Free an sqlite3expert object. +*/ +void sqlite3_expert_destroy(sqlite3expert *p){ + if( p ){ + sqlite3_close(p->dbm); + sqlite3_close(p->dbv); + idxScanFree(p->pScan, 0); + idxStatementFree(p->pStatement, 0); + idxTableFree(p->pTable); + idxWriteFree(p->pWrite); + idxHashClear(&p->hIdx); + sqlite3_free(p->zCandidates); + sqlite3_free(p); + } } +#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */ -static int idxCreateVtabSchema(sqlite3expert *p, char **pzErrmsg){ - int rc = idxRegisterVtab(p); - sqlite3_stmt *pSchema = 0; +/************************* End ../ext/expert/sqlite3expert.c ********************/ - /* For each table in the main db schema: - ** - ** 1) Add an entry to the p->pTable list, and - ** 2) Create the equivalent virtual table in dbv. - */ - rc = idxPrepareStmt(p->db, &pSchema, pzErrmsg, - "SELECT type, name, sql, 1 FROM sqlite_schema " - "WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%%' " - " UNION ALL " - "SELECT type, name, sql, 2 FROM sqlite_schema " - "WHERE type = 'trigger'" - " AND tbl_name IN(SELECT name FROM sqlite_schema WHERE type = 'view') " - "ORDER BY 4, 1" - ); - while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSchema) ){ - const char *zType = (const char*)sqlite3_column_text(pSchema, 0); - const char *zName = (const char*)sqlite3_column_text(pSchema, 1); - const char *zSql = (const char*)sqlite3_column_text(pSchema, 2); +/************************* Begin ../ext/intck/sqlite3intck.h ******************/ +/* +** 2024-02-08 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +*/ - if( zType==0 || zName==0 ) continue; - if( zType[0]=='v' || zType[1]=='r' ){ - if( zSql ) rc = sqlite3_exec(p->dbv, zSql, 0, 0, pzErrmsg); - }else{ - IdxTable *pTab; - rc = idxGetTableInfo(p->db, zName, &pTab, pzErrmsg); - if( rc==SQLITE_OK ){ - int i; - char *zInner = 0; - char *zOuter = 0; - pTab->pNext = p->pTable; - p->pTable = pTab; +/* +** Incremental Integrity-Check Extension +** ------------------------------------- +** +** This module contains code to check whether or not an SQLite database +** is well-formed or corrupt. This is the same task as performed by SQLite's +** built-in "PRAGMA integrity_check" command. This module differs from +** "PRAGMA integrity_check" in that: +** +** + It is less thorough - this module does not detect certain types +** of corruption that are detected by the PRAGMA command. However, +** it does detect all kinds of corruption that are likely to cause +** errors in SQLite applications. +** +** + It is slower. Sometimes up to three times slower. +** +** + It allows integrity-check operations to be split into multiple +** transactions, so that the database does not need to be read-locked +** for the duration of the integrity-check. +** +** One way to use the API to run integrity-check on the "main" database +** of handle db is: +** +** int rc = SQLITE_OK; +** sqlite3_intck *p = 0; +** +** sqlite3_intck_open(db, "main", &p); +** while( SQLITE_OK==sqlite3_intck_step(p) ){ +** const char *zMsg = sqlite3_intck_message(p); +** if( zMsg ) printf("corruption: %s\n", zMsg); +** } +** rc = sqlite3_intck_error(p, &zErr); +** if( rc!=SQLITE_OK ){ +** printf("error occured (rc=%d), (errmsg=%s)\n", rc, zErr); +** } +** sqlite3_intck_close(p); +** +** Usually, the sqlite3_intck object opens a read transaction within the +** first call to sqlite3_intck_step() and holds it open until the +** integrity-check is complete. However, if sqlite3_intck_unlock() is +** called, the read transaction is ended and a new read transaction opened +** by the subsequent call to sqlite3_intck_step(). +*/ - /* The statement the vtab will pass to sqlite3_declare_vtab() */ - zInner = idxAppendText(&rc, 0, "CREATE TABLE x("); - for(i=0; inCol; i++){ - zInner = idxAppendText(&rc, zInner, "%s%Q COLLATE %s", - (i==0 ? "" : ", "), pTab->aCol[i].zName, pTab->aCol[i].zColl - ); - } - zInner = idxAppendText(&rc, zInner, ")"); +#ifndef _SQLITE_INTCK_H +#define _SQLITE_INTCK_H - /* The CVT statement to create the vtab */ - zOuter = idxAppendText(&rc, 0, - "CREATE VIRTUAL TABLE %Q USING expert(%Q)", zName, zInner - ); - if( rc==SQLITE_OK ){ - rc = sqlite3_exec(p->dbv, zOuter, 0, 0, pzErrmsg); - } - sqlite3_free(zInner); - sqlite3_free(zOuter); - } - } - } - idxFinalize(&rc, pSchema); - return rc; -} +/* #include "sqlite3.h" */ + +#ifdef __cplusplus +extern "C" { +#endif -struct IdxSampleCtx { - int iTarget; - double target; /* Target nRet/nRow value */ - double nRow; /* Number of rows seen */ - double nRet; /* Number of rows returned */ -}; +/* +** An ongoing incremental integrity-check operation is represented by an +** opaque pointer of the following type. +*/ +typedef struct sqlite3_intck sqlite3_intck; -static void idxSampleFunc( - sqlite3_context *pCtx, - int argc, - sqlite3_value **argv -){ - struct IdxSampleCtx *p = (struct IdxSampleCtx*)sqlite3_user_data(pCtx); - int bRet; +/* +** Open a new incremental integrity-check object. If successful, populate +** output variable (*ppOut) with the new object handle and return SQLITE_OK. +** Or, if an error occurs, set (*ppOut) to NULL and return an SQLite error +** code (e.g. SQLITE_NOMEM). +** +** The integrity-check will be conducted on database zDb (which must be "main", +** "temp", or the name of an attached database) of database handle db. Once +** this function has been called successfully, the caller should not use +** database handle db until the integrity-check object has been destroyed +** using sqlite3_intck_close(). +*/ +int sqlite3_intck_open( + sqlite3 *db, /* Database handle */ + const char *zDb, /* Database name ("main", "temp" etc.) */ + sqlite3_intck **ppOut /* OUT: New sqlite3_intck handle */ +); - (void)argv; - assert( argc==0 ); - if( p->nRow==0.0 ){ - bRet = 1; - }else{ - bRet = (p->nRet / p->nRow) <= p->target; - if( bRet==0 ){ - unsigned short rnd; - sqlite3_randomness(2, (void*)&rnd); - bRet = ((int)rnd % 100) <= p->iTarget; - } - } +/* +** Close and release all resources associated with a handle opened by an +** earlier call to sqlite3_intck_open(). The results of using an +** integrity-check handle after it has been passed to this function are +** undefined. +*/ +void sqlite3_intck_close(sqlite3_intck *pCk); - sqlite3_result_int(pCtx, bRet); - p->nRow += 1.0; - p->nRet += (double)bRet; -} +/* +** Do the next step of the integrity-check operation specified by the handle +** passed as the only argument. This function returns SQLITE_DONE if the +** integrity-check operation is finished, or an SQLite error code if +** an error occurs, or SQLITE_OK if no error occurs but the integrity-check +** is not finished. It is not considered an error if database corruption +** is encountered. +** +** Following a successful call to sqlite3_intck_step() (one that returns +** SQLITE_OK), sqlite3_intck_message() returns a non-NULL value if +** corruption was detected in the db. +** +** If an error occurs and a value other than SQLITE_OK or SQLITE_DONE is +** returned, then the integrity-check handle is placed in an error state. +** In this state all subsequent calls to sqlite3_intck_step() or +** sqlite3_intck_unlock() will immediately return the same error. The +** sqlite3_intck_error() method may be used to obtain an English language +** error message in this case. +*/ +int sqlite3_intck_step(sqlite3_intck *pCk); -struct IdxRemCtx { - int nSlot; - struct IdxRemSlot { - int eType; /* SQLITE_NULL, INTEGER, REAL, TEXT, BLOB */ - i64 iVal; /* SQLITE_INTEGER value */ - double rVal; /* SQLITE_FLOAT value */ - int nByte; /* Bytes of space allocated at z */ - int n; /* Size of buffer z */ - char *z; /* SQLITE_TEXT/BLOB value */ - } aSlot[1]; -}; +/* +** If the previous call to sqlite3_intck_step() encountered corruption +** within the database, then this function returns a pointer to a buffer +** containing a nul-terminated string describing the corruption in +** English. If the previous call to sqlite3_intck_step() did not encounter +** corruption, or if there was no previous call, this function returns +** NULL. +*/ +const char *sqlite3_intck_message(sqlite3_intck *pCk); /* -** Implementation of scalar function rem(). +** Close any read-transaction opened by an earlier call to +** sqlite3_intck_step(). Any subsequent call to sqlite3_intck_step() will +** open a new transaction. Return SQLITE_OK if successful, or an SQLite error +** code otherwise. +** +** If an error occurs, then the integrity-check handle is placed in an error +** state. In this state all subsequent calls to sqlite3_intck_step() or +** sqlite3_intck_unlock() will immediately return the same error. The +** sqlite3_intck_error() method may be used to obtain an English language +** error message in this case. */ -static void idxRemFunc( - sqlite3_context *pCtx, - int argc, - sqlite3_value **argv -){ - struct IdxRemCtx *p = (struct IdxRemCtx*)sqlite3_user_data(pCtx); - struct IdxRemSlot *pSlot; - int iSlot; - assert( argc==2 ); +int sqlite3_intck_unlock(sqlite3_intck *pCk); - iSlot = sqlite3_value_int(argv[0]); - assert( iSlot<=p->nSlot ); - pSlot = &p->aSlot[iSlot]; +/* +** If an error has occurred in an earlier call to sqlite3_intck_step() +** or sqlite3_intck_unlock(), then this method returns the associated +** SQLite error code. Additionally, if pzErr is not NULL, then (*pzErr) +** may be set to point to a nul-terminated string containing an English +** language error message. Or, if no error message is available, to +** NULL. +** +** If no error has occurred within sqlite3_intck_step() or +** sqlite_intck_unlock() calls on the handle passed as the first argument, +** then SQLITE_OK is returned and (*pzErr) set to NULL. +*/ +int sqlite3_intck_error(sqlite3_intck *pCk, const char **pzErr); - switch( pSlot->eType ){ - case SQLITE_NULL: - /* no-op */ - break; +/* +** This API is used for testing only. It returns the full-text of an SQL +** statement used to test object zObj, which may be a table or index. +** The returned buffer is valid until the next call to either this function +** or sqlite3_intck_close() on the same sqlite3_intck handle. +*/ +const char *sqlite3_intck_test_sql(sqlite3_intck *pCk, const char *zObj); - case SQLITE_INTEGER: - sqlite3_result_int64(pCtx, pSlot->iVal); - break; - case SQLITE_FLOAT: - sqlite3_result_double(pCtx, pSlot->rVal); - break; +#ifdef __cplusplus +} /* end of the 'extern "C"' block */ +#endif - case SQLITE_BLOB: - sqlite3_result_blob(pCtx, pSlot->z, pSlot->n, SQLITE_TRANSIENT); - break; +#endif /* ifndef _SQLITE_INTCK_H */ - case SQLITE_TEXT: - sqlite3_result_text(pCtx, pSlot->z, pSlot->n, SQLITE_TRANSIENT); - break; - } +/************************* End ../ext/intck/sqlite3intck.h ********************/ +/************************* Begin ../ext/intck/sqlite3intck.c ******************/ +/* +** 2024-02-08 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +*/ - pSlot->eType = sqlite3_value_type(argv[1]); - switch( pSlot->eType ){ - case SQLITE_NULL: - /* no-op */ - break; +/* #include "sqlite3intck.h" */ +#include +#include - case SQLITE_INTEGER: - pSlot->iVal = sqlite3_value_int64(argv[1]); - break; +#include +#include - case SQLITE_FLOAT: - pSlot->rVal = sqlite3_value_double(argv[1]); - break; +/* +** nKeyVal: +** The number of values that make up the 'key' for the current pCheck +** statement. +** +** rc: +** Error code returned by most recent sqlite3_intck_step() or +** sqlite3_intck_unlock() call. This is set to SQLITE_DONE when +** the integrity-check operation is finished. +** +** zErr: +** If the object has entered the error state, this is the error message. +** Is freed using sqlite3_free() when the object is deleted. +** +** zTestSql: +** The value returned by the most recent call to sqlite3_intck_testsql(). +** Each call to testsql() frees the previous zTestSql value (using +** sqlite3_free()) and replaces it with the new value it will return. +*/ +struct sqlite3_intck { + sqlite3 *db; + const char *zDb; /* Copy of zDb parameter to _open() */ + char *zObj; /* Current object. Or NULL. */ - case SQLITE_BLOB: - case SQLITE_TEXT: { - int nByte = sqlite3_value_bytes(argv[1]); - const void *pData = 0; - if( nByte>pSlot->nByte ){ - char *zNew = (char*)sqlite3_realloc(pSlot->z, nByte*2); - if( zNew==0 ){ - sqlite3_result_error_nomem(pCtx); - return; - } - pSlot->nByte = nByte*2; - pSlot->z = zNew; - } - pSlot->n = nByte; - if( pSlot->eType==SQLITE_BLOB ){ - pData = sqlite3_value_blob(argv[1]); - if( pData ) memcpy(pSlot->z, pData, nByte); - }else{ - pData = sqlite3_value_text(argv[1]); - memcpy(pSlot->z, pData, nByte); - } - break; + sqlite3_stmt *pCheck; /* Current check statement */ + char *zKey; + int nKeyVal; + + char *zMessage; + int bCorruptSchema; + + int rc; /* Error code */ + char *zErr; /* Error message */ + char *zTestSql; /* Returned by sqlite3_intck_test_sql() */ +}; + + +/* +** Some error has occurred while using database p->db. Save the error message +** and error code currently held by the database handle in p->rc and p->zErr. +*/ +static void intckSaveErrmsg(sqlite3_intck *p){ + p->rc = sqlite3_errcode(p->db); + sqlite3_free(p->zErr); + p->zErr = sqlite3_mprintf("%s", sqlite3_errmsg(p->db)); +} + +/* +** If the handle passed as the first argument is already in the error state, +** then this function is a no-op (returns NULL immediately). Otherwise, if an +** error occurs within this function, it leaves an error in said handle. +** +** Otherwise, this function attempts to prepare SQL statement zSql and +** return the resulting statement handle to the user. +*/ +static sqlite3_stmt *intckPrepare(sqlite3_intck *p, const char *zSql){ + sqlite3_stmt *pRet = 0; + if( p->rc==SQLITE_OK ){ + p->rc = sqlite3_prepare_v2(p->db, zSql, -1, &pRet, 0); + if( p->rc!=SQLITE_OK ){ + intckSaveErrmsg(p); + assert( pRet==0 ); } } + return pRet; } -static int idxLargestIndex(sqlite3 *db, int *pnMax, char **pzErr){ - int rc = SQLITE_OK; - const char *zMax = - "SELECT max(i.seqno) FROM " - " sqlite_schema AS s, " - " pragma_index_list(s.name) AS l, " - " pragma_index_info(l.name) AS i " - "WHERE s.type = 'table'"; - sqlite3_stmt *pMax = 0; - - *pnMax = 0; - rc = idxPrepareStmt(db, &pMax, pzErr, zMax); - if( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pMax) ){ - *pnMax = sqlite3_column_int(pMax, 0) + 1; +/* +** If the handle passed as the first argument is already in the error state, +** then this function is a no-op (returns NULL immediately). Otherwise, if an +** error occurs within this function, it leaves an error in said handle. +** +** Otherwise, this function treats argument zFmt as a printf() style format +** string. It formats it according to the trailing arguments and then +** attempts to prepare the results and return the resulting prepared +** statement. +*/ +static sqlite3_stmt *intckPrepareFmt(sqlite3_intck *p, const char *zFmt, ...){ + sqlite3_stmt *pRet = 0; + va_list ap; + char *zSql = 0; + va_start(ap, zFmt); + zSql = sqlite3_vmprintf(zFmt, ap); + if( p->rc==SQLITE_OK && zSql==0 ){ + p->rc = SQLITE_NOMEM; } - idxFinalize(&rc, pMax); - - return rc; + pRet = intckPrepare(p, zSql); + sqlite3_free(zSql); + va_end(ap); + return pRet; } -static int idxPopulateOneStat1( - sqlite3expert *p, - sqlite3_stmt *pIndexXInfo, - sqlite3_stmt *pWriteStat, - const char *zTab, - const char *zIdx, - char **pzErr -){ - char *zCols = 0; - char *zOrder = 0; - char *zQuery = 0; - int nCol = 0; - int i; - sqlite3_stmt *pQuery = 0; - int *aStat = 0; - int rc = SQLITE_OK; +/* +** Finalize SQL statement pStmt. If an error occurs and the handle passed +** as the first argument does not already contain an error, store the +** error in the handle. +*/ +static void intckFinalize(sqlite3_intck *p, sqlite3_stmt *pStmt){ + int rc = sqlite3_finalize(pStmt); + if( p->rc==SQLITE_OK && rc!=SQLITE_OK ){ + intckSaveErrmsg(p); + } +} - assert( p->iSample>0 ); +/* +** If there is already an error in handle p, return it. Otherwise, call +** sqlite3_step() on the statement handle and return that value. +*/ +static int intckStep(sqlite3_intck *p, sqlite3_stmt *pStmt){ + if( p->rc ) return p->rc; + return sqlite3_step(pStmt); +} - /* Formulate the query text */ - sqlite3_bind_text(pIndexXInfo, 1, zIdx, -1, SQLITE_STATIC); - while( SQLITE_OK==rc && SQLITE_ROW==sqlite3_step(pIndexXInfo) ){ - const char *zComma = zCols==0 ? "" : ", "; - const char *zName = (const char*)sqlite3_column_text(pIndexXInfo, 0); - const char *zColl = (const char*)sqlite3_column_text(pIndexXInfo, 1); - zCols = idxAppendText(&rc, zCols, - "%sx.%Q IS rem(%d, x.%Q) COLLATE %s", zComma, zName, nCol, zName, zColl - ); - zOrder = idxAppendText(&rc, zOrder, "%s%d", zComma, ++nCol); - } - sqlite3_reset(pIndexXInfo); - if( rc==SQLITE_OK ){ - if( p->iSample==100 ){ - zQuery = sqlite3_mprintf( - "SELECT %s FROM %Q x ORDER BY %s", zCols, zTab, zOrder - ); - }else{ - zQuery = sqlite3_mprintf( - "SELECT %s FROM temp."UNIQUE_TABLE_NAME" x ORDER BY %s", zCols, zOrder - ); - } - } - sqlite3_free(zCols); - sqlite3_free(zOrder); +/* +** Execute SQL statement zSql. There is no way to obtain any results +** returned by the statement. This function uses the sqlite3_intck error +** code convention. +*/ +static void intckExec(sqlite3_intck *p, const char *zSql){ + sqlite3_stmt *pStmt = 0; + pStmt = intckPrepare(p, zSql); + intckStep(p, pStmt); + intckFinalize(p, pStmt); +} - /* Formulate the query text */ - if( rc==SQLITE_OK ){ - sqlite3 *dbrem = (p->iSample==100 ? p->db : p->dbv); - rc = idxPrepareStmt(dbrem, &pQuery, pzErr, zQuery); +/* +** A wrapper around sqlite3_mprintf() that uses the sqlite3_intck error +** code convention. +*/ +static char *intckMprintf(sqlite3_intck *p, const char *zFmt, ...){ + va_list ap; + char *zRet = 0; + va_start(ap, zFmt); + zRet = sqlite3_vmprintf(zFmt, ap); + if( p->rc==SQLITE_OK ){ + if( zRet==0 ){ + p->rc = SQLITE_NOMEM; + } + }else{ + sqlite3_free(zRet); + zRet = 0; } - sqlite3_free(zQuery); + return zRet; +} - if( rc==SQLITE_OK ){ - aStat = (int*)idxMalloc(&rc, sizeof(int)*(nCol+1)); +/* +** This is used by sqlite3_intck_unlock() to save the vector key value +** required to restart the current pCheck query as a nul-terminated string +** in p->zKey. +*/ +static void intckSaveKey(sqlite3_intck *p){ + int ii; + char *zSql = 0; + sqlite3_stmt *pStmt = 0; + sqlite3_stmt *pXinfo = 0; + const char *zDir = 0; + + assert( p->pCheck ); + assert( p->zKey==0 ); + + pXinfo = intckPrepareFmt(p, + "SELECT group_concat(desc, '') FROM %Q.sqlite_schema s, " + "pragma_index_xinfo(%Q, %Q) " + "WHERE s.type='index' AND s.name=%Q", + p->zDb, p->zObj, p->zDb, p->zObj + ); + if( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pXinfo) ){ + zDir = (const char*)sqlite3_column_text(pXinfo, 0); } - if( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pQuery) ){ - IdxHashEntry *pEntry; - char *zStat = 0; - for(i=0; i<=nCol; i++) aStat[i] = 1; - while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pQuery) ){ - aStat[0]++; - for(i=0; inKeyVal; ii++){ + zSql = intckMprintf(p, "%z%squote(?)", zSql, zSep); + zSep = " || ', ' || "; + } + zSql = intckMprintf(p, "%z || ')'", zSql); + }else{ + + /* Object is an index. */ + assert( p->nKeyVal>1 ); + for(ii=p->nKeyVal; ii>0; ii--){ + int bLastIsDesc = zDir[ii-1]=='1'; + int bLastIsNull = sqlite3_column_type(p->pCheck, ii)==SQLITE_NULL; + const char *zLast = sqlite3_column_name(p->pCheck, ii); + char *zLhs = 0; + char *zRhs = 0; + char *zWhere = 0; + + if( bLastIsNull ){ + if( bLastIsDesc ) continue; + zWhere = intckMprintf(p, "'%s IS NOT NULL'", zLast); + }else{ + const char *zOp = bLastIsDesc ? "<" : ">"; + zWhere = intckMprintf(p, "'%s %s ' || quote(?%d)", zLast, zOp, ii); + } + + if( ii>1 ){ + const char *zLhsSep = ""; + const char *zRhsSep = ""; + int jj; + for(jj=0; jjpCheck,jj+1); + zLhs = intckMprintf(p, "%z%s%s", zLhs, zLhsSep, zAlias); + zRhs = intckMprintf(p, "%z%squote(?%d)", zRhs, zRhsSep, jj+1); + zLhsSep = ","; + zRhsSep = " || ',' || "; + } + + zWhere = intckMprintf(p, + "'(%z) IS (' || %z || ') AND ' || %z", + zLhs, zRhs, zWhere); } - } + zWhere = intckMprintf(p, "'WHERE ' || %z", zWhere); - if( rc==SQLITE_OK ){ - sqlite3_bind_text(pWriteStat, 1, zTab, -1, SQLITE_STATIC); - sqlite3_bind_text(pWriteStat, 2, zIdx, -1, SQLITE_STATIC); - sqlite3_bind_text(pWriteStat, 3, zStat, -1, SQLITE_STATIC); - sqlite3_step(pWriteStat); - rc = sqlite3_reset(pWriteStat); + zSql = intckMprintf(p, "%z%s(quote( %z ) )", + zSql, + (zSql==0 ? "VALUES" : ",\n "), + zWhere + ); } + zSql = intckMprintf(p, + "WITH wc(q) AS (\n%z\n)" + "SELECT 'VALUES' || group_concat('(' || q || ')', ',\n ') FROM wc" + , zSql + ); + } - pEntry = idxHashFind(&p->hIdx, zIdx, STRLEN(zIdx)); - if( pEntry ){ - assert( pEntry->zVal2==0 ); - pEntry->zVal2 = zStat; - }else{ - sqlite3_free(zStat); + pStmt = intckPrepare(p, zSql); + if( p->rc==SQLITE_OK ){ + for(ii=0; iinKeyVal; ii++){ + sqlite3_bind_value(pStmt, ii+1, sqlite3_column_value(p->pCheck, ii+1)); + } + if( SQLITE_ROW==sqlite3_step(pStmt) ){ + p->zKey = intckMprintf(p,"%s",(const char*)sqlite3_column_text(pStmt, 0)); } + intckFinalize(p, pStmt); } - sqlite3_free(aStat); - idxFinalize(&rc, pQuery); - return rc; + sqlite3_free(zSql); + intckFinalize(p, pXinfo); } -static int idxBuildSampleTable(sqlite3expert *p, const char *zTab){ - int rc; - char *zSql; +/* +** Find the next database object (table or index) to check. If successful, +** set sqlite3_intck.zObj to point to a nul-terminated buffer containing +** the object's name before returning. +*/ +static void intckFindObject(sqlite3_intck *p){ + sqlite3_stmt *pStmt = 0; + char *zPrev = p->zObj; + p->zObj = 0; + + assert( p->rc==SQLITE_OK ); + assert( p->pCheck==0 ); + + pStmt = intckPrepareFmt(p, + "WITH tables(table_name) AS (" + " SELECT name" + " FROM %Q.sqlite_schema WHERE (type='table' OR type='index') AND rootpage" + " UNION ALL " + " SELECT 'sqlite_schema'" + ")" + "SELECT table_name FROM tables " + "WHERE ?1 IS NULL OR table_name%s?1 " + "ORDER BY 1" + , p->zDb, (p->zKey ? ">=" : ">") + ); - rc = sqlite3_exec(p->dbv,"DROP TABLE IF EXISTS temp."UNIQUE_TABLE_NAME,0,0,0); - if( rc!=SQLITE_OK ) return rc; + if( p->rc==SQLITE_OK ){ + sqlite3_bind_text(pStmt, 1, zPrev, -1, SQLITE_TRANSIENT); + if( sqlite3_step(pStmt)==SQLITE_ROW ){ + p->zObj = intckMprintf(p,"%s",(const char*)sqlite3_column_text(pStmt, 0)); + } + } + intckFinalize(p, pStmt); - zSql = sqlite3_mprintf( - "CREATE TABLE temp." UNIQUE_TABLE_NAME " AS SELECT * FROM %Q", zTab - ); - if( zSql==0 ) return SQLITE_NOMEM; - rc = sqlite3_exec(p->dbv, zSql, 0, 0, 0); - sqlite3_free(zSql); + /* If this is a new object, ensure the previous key value is cleared. */ + if( sqlite3_stricmp(p->zObj, zPrev) ){ + sqlite3_free(p->zKey); + p->zKey = 0; + } - return rc; + sqlite3_free(zPrev); } /* -** This function is called as part of sqlite3_expert_analyze(). Candidate -** indexes have already been created in database sqlite3expert.dbm, this -** function populates sqlite_stat1 table in the same database. +** Return the size in bytes of the first token in nul-terminated buffer z. +** For the purposes of this call, a token is either: ** -** The stat1 data is generated by querying the +** * a quoted SQL string, +* * a contiguous series of ascii alphabet characters, or +* * any other single byte. */ -static int idxPopulateStat1(sqlite3expert *p, char **pzErr){ - int rc = SQLITE_OK; - int nMax =0; - struct IdxRemCtx *pCtx = 0; - struct IdxSampleCtx samplectx; - int i; - i64 iPrev = -100000; - sqlite3_stmt *pAllIndex = 0; - sqlite3_stmt *pIndexXInfo = 0; - sqlite3_stmt *pWrite = 0; +static int intckGetToken(const char *z){ + char c = z[0]; + int iRet = 1; + if( c=='\'' || c=='"' || c=='`' ){ + while( 1 ){ + if( z[iRet]==c ){ + iRet++; + if( z[iRet]!=c ) break; + } + iRet++; + } + } + else if( c=='[' ){ + while( z[iRet++]!=']' && z[iRet] ); + } + else if( (c>='A' && c<='Z') || (c>='a' && c<='z') ){ + while( (z[iRet]>='A' && z[iRet]<='Z') || (z[iRet]>='a' && z[iRet]<='z') ){ + iRet++; + } + } - const char *zAllIndex = - "SELECT s.rowid, s.name, l.name FROM " - " sqlite_schema AS s, " - " pragma_index_list(s.name) AS l " - "WHERE s.type = 'table'"; - const char *zIndexXInfo = - "SELECT name, coll FROM pragma_index_xinfo(?) WHERE key"; - const char *zWrite = "INSERT INTO sqlite_stat1 VALUES(?, ?, ?)"; + return iRet; +} - /* If iSample==0, no sqlite_stat1 data is required. */ - if( p->iSample==0 ) return SQLITE_OK; +/* +** Return true if argument c is an ascii whitespace character. +*/ +static int intckIsSpace(char c){ + return (c==' ' || c=='\t' || c=='\n' || c=='\r'); +} - rc = idxLargestIndex(p->dbm, &nMax, pzErr); - if( nMax<=0 || rc!=SQLITE_OK ) return rc; +/* +** Argument z points to the text of a CREATE INDEX statement. This function +** identifies the part of the text that contains either the index WHERE +** clause (if iCol<0) or the iCol'th column of the index. +** +** If (iCol<0), the identified fragment does not include the "WHERE" keyword, +** only the expression that follows it. If (iCol>=0) then the identified +** fragment does not include any trailing sort-order keywords - "ASC" or +** "DESC". +** +** If the CREATE INDEX statement does not contain the requested field or +** clause, NULL is returned and (*pnByte) is set to 0. Otherwise, a pointer to +** the identified fragment is returned and output parameter (*pnByte) set +** to its size in bytes. +*/ +static const char *intckParseCreateIndex(const char *z, int iCol, int *pnByte){ + int iOff = 0; + int iThisCol = 0; + int iStart = 0; + int nOpen = 0; - rc = sqlite3_exec(p->dbm, "ANALYZE; PRAGMA writable_schema=1", 0, 0, 0); + const char *zRet = 0; + int nRet = 0; - if( rc==SQLITE_OK ){ - int nByte = sizeof(struct IdxRemCtx) + (sizeof(struct IdxRemSlot) * nMax); - pCtx = (struct IdxRemCtx*)idxMalloc(&rc, nByte); - } + int iEndOfCol = 0; + + /* Skip forward until the first "(" token */ + while( z[iOff]!='(' ){ + iOff += intckGetToken(&z[iOff]); + if( z[iOff]=='\0' ) return 0; + } + assert( z[iOff]=='(' ); + + nOpen = 1; + iOff++; + iStart = iOff; + while( z[iOff] ){ + const char *zToken = &z[iOff]; + int nToken = 0; + + /* Check if this is the end of the current column - either a "," or ")" + ** when nOpen==1. */ + if( nOpen==1 ){ + if( z[iOff]==',' || z[iOff]==')' ){ + if( iCol==iThisCol ){ + int iEnd = iEndOfCol ? iEndOfCol : iOff; + nRet = (iEnd - iStart); + zRet = &z[iStart]; + break; + } + iStart = iOff+1; + while( intckIsSpace(z[iStart]) ) iStart++; + iThisCol++; + } + if( z[iOff]==')' ) break; + } + if( z[iOff]=='(' ) nOpen++; + if( z[iOff]==')' ) nOpen--; + nToken = intckGetToken(zToken); - if( rc==SQLITE_OK ){ - sqlite3 *dbrem = (p->iSample==100 ? p->db : p->dbv); - rc = sqlite3_create_function( - dbrem, "rem", 2, SQLITE_UTF8, (void*)pCtx, idxRemFunc, 0, 0 - ); + if( (nToken==3 && 0==sqlite3_strnicmp(zToken, "ASC", nToken)) + || (nToken==4 && 0==sqlite3_strnicmp(zToken, "DESC", nToken)) + ){ + iEndOfCol = iOff; + }else if( 0==intckIsSpace(zToken[0]) ){ + iEndOfCol = 0; + } + + iOff += nToken; } - if( rc==SQLITE_OK ){ - rc = sqlite3_create_function( - p->db, "sample", 0, SQLITE_UTF8, (void*)&samplectx, idxSampleFunc, 0, 0 - ); + + /* iStart is now the byte offset of 1 byte passed the final ')' in the + ** CREATE INDEX statement. Try to find a WHERE clause to return. */ + while( zRet==0 && z[iOff] ){ + int n = intckGetToken(&z[iOff]); + if( n==5 && 0==sqlite3_strnicmp(&z[iOff], "where", 5) ){ + zRet = &z[iOff+5]; + nRet = (int)strlen(zRet); + } + iOff += n; } - if( rc==SQLITE_OK ){ - pCtx->nSlot = nMax+1; - rc = idxPrepareStmt(p->dbm, &pAllIndex, pzErr, zAllIndex); + /* Trim any whitespace from the start and end of the returned string. */ + if( zRet ){ + while( intckIsSpace(zRet[0]) ){ + nRet--; + zRet++; + } + while( nRet>0 && intckIsSpace(zRet[nRet-1]) ) nRet--; } - if( rc==SQLITE_OK ){ - rc = idxPrepareStmt(p->dbm, &pIndexXInfo, pzErr, zIndexXInfo); + + *pnByte = nRet; + return zRet; +} + +/* +** User-defined SQL function wrapper for intckParseCreateIndex(): +** +** SELECT parse_create_index(, ); +*/ +static void intckParseCreateIndexFunc( + sqlite3_context *pCtx, + int nVal, + sqlite3_value **apVal +){ + const char *zSql = (const char*)sqlite3_value_text(apVal[0]); + int idx = sqlite3_value_int(apVal[1]); + const char *zRes = 0; + int nRes = 0; + + assert( nVal==2 ); + if( zSql ){ + zRes = intckParseCreateIndex(zSql, idx, &nRes); } - if( rc==SQLITE_OK ){ - rc = idxPrepareStmt(p->dbm, &pWrite, pzErr, zWrite); + sqlite3_result_text(pCtx, zRes, nRes, SQLITE_TRANSIENT); +} + +/* +** Return true if sqlite3_intck.db has automatic indexes enabled, false +** otherwise. +*/ +static int intckGetAutoIndex(sqlite3_intck *p){ + int bRet = 0; + sqlite3_stmt *pStmt = 0; + pStmt = intckPrepare(p, "PRAGMA automatic_index"); + if( SQLITE_ROW==intckStep(p, pStmt) ){ + bRet = sqlite3_column_int(pStmt, 0); } + intckFinalize(p, pStmt); + return bRet; +} - while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pAllIndex) ){ - i64 iRowid = sqlite3_column_int64(pAllIndex, 0); - const char *zTab = (const char*)sqlite3_column_text(pAllIndex, 1); - const char *zIdx = (const char*)sqlite3_column_text(pAllIndex, 2); - if( zTab==0 || zIdx==0 ) continue; - if( p->iSample<100 && iPrev!=iRowid ){ - samplectx.target = (double)p->iSample / 100.0; - samplectx.iTarget = p->iSample; - samplectx.nRow = 0.0; - samplectx.nRet = 0.0; - rc = idxBuildSampleTable(p, zTab); - if( rc!=SQLITE_OK ) break; - } - rc = idxPopulateOneStat1(p, pIndexXInfo, pWrite, zTab, zIdx, pzErr); - iPrev = iRowid; +/* +** Return true if zObj is an index, or false otherwise. +*/ +static int intckIsIndex(sqlite3_intck *p, const char *zObj){ + int bRet = 0; + sqlite3_stmt *pStmt = 0; + pStmt = intckPrepareFmt(p, + "SELECT 1 FROM %Q.sqlite_schema WHERE name=%Q AND type='index'", + p->zDb, zObj + ); + if( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ + bRet = 1; } - if( rc==SQLITE_OK && p->iSample<100 ){ - rc = sqlite3_exec(p->dbv, - "DROP TABLE IF EXISTS temp." UNIQUE_TABLE_NAME, 0,0,0 + intckFinalize(p, pStmt); + return bRet; +} + +/* +** Return a pointer to a nul-terminated buffer containing the SQL statement +** used to check database object zObj (a table or index) for corruption. +** If parameter zPrev is not NULL, then it must be a string containing the +** vector key required to restart the check where it left off last time. +** If pnKeyVal is not NULL, then (*pnKeyVal) is set to the number of +** columns in the vector key value for the specified object. +** +** This function uses the sqlite3_intck error code convention. +*/ +static char *intckCheckObjectSql( + sqlite3_intck *p, /* Integrity check object */ + const char *zObj, /* Object (table or index) to scan */ + const char *zPrev, /* Restart key vector, if any */ + int *pnKeyVal /* OUT: Number of key-values for this scan */ +){ + char *zRet = 0; + sqlite3_stmt *pStmt = 0; + int bAutoIndex = 0; + int bIsIndex = 0; + + const char *zCommon = + /* Relation without_rowid also contains just one row. Column "b" is + ** set to true if the table being examined is a WITHOUT ROWID table, + ** or false otherwise. */ + ", without_rowid(b) AS (" + " SELECT EXISTS (" + " SELECT 1 FROM tabname, pragma_index_list(tab, db) AS l" + " WHERE origin='pk' " + " AND NOT EXISTS (SELECT 1 FROM sqlite_schema WHERE name=l.name)" + " )" + ")" + "" + /* Table idx_cols contains 1 row for each column in each index on the + ** table being checked. Columns are: + ** + ** idx_name: Name of the index. + ** idx_ispk: True if this index is the PK of a WITHOUT ROWID table. + ** col_name: Name of indexed column, or NULL for index on expression. + ** col_expr: Indexed expression, including COLLATE clause. + ** col_alias: Alias used for column in 'intck_wrapper' table. + */ + ", idx_cols(idx_name, idx_ispk, col_name, col_expr, col_alias) AS (" + " SELECT l.name, (l.origin=='pk' AND w.b), i.name, COALESCE((" + " SELECT parse_create_index(sql, i.seqno) FROM " + " sqlite_schema WHERE name = l.name" + " ), format('\"%w\"', i.name) || ' COLLATE ' || quote(i.coll))," + " 'c' || row_number() OVER ()" + " FROM " + " tabname t," + " without_rowid w," + " pragma_index_list(t.tab, t.db) l," + " pragma_index_xinfo(l.name) i" + " WHERE i.key" + " UNION ALL" + " SELECT '', 1, '_rowid_', '_rowid_', 'r1' FROM without_rowid WHERE b=0" + ")" + "" + "" + /* + ** For a PK declared as "PRIMARY KEY(a, b) ... WITHOUT ROWID", where + ** the intck_wrapper aliases of "a" and "b" are "c1" and "c2": + ** + ** o_pk: "o.c1, o.c2" + ** i_pk: "i.'a', i.'b'" + ** ... + ** n_pk: 2 + */ + ", tabpk(db, tab, idx, o_pk, i_pk, q_pk, eq_pk, ps_pk, pk_pk, n_pk) AS (" + " WITH pkfields(f, a) AS (" + " SELECT i.col_name, i.col_alias FROM idx_cols i WHERE i.idx_ispk" + " )" + " SELECT t.db, t.tab, t.idx, " + " group_concat(a, ', '), " + " group_concat('i.'||quote(f), ', '), " + " group_concat('quote(o.'||a||')', ' || '','' || '), " + " format('(%s)==(%s)'," + " group_concat('o.'||a, ', '), " + " group_concat(format('\"%w\"', f), ', ')" + " )," + " group_concat('%s', ',')," + " group_concat('quote('||a||')', ', '), " + " count(*)" + " FROM tabname t, pkfields" + ")" + "" + ", idx(name, match_expr, partial, partial_alias, idx_ps, idx_idx) AS (" + " SELECT idx_name," + " format('(%s,%s) IS (%s,%s)', " + " group_concat(i.col_expr, ', '), i_pk," + " group_concat('o.'||i.col_alias, ', '), o_pk" + " ), " + " parse_create_index(" + " (SELECT sql FROM sqlite_schema WHERE name=idx_name), -1" + " )," + " 'cond' || row_number() OVER ()" + " , group_concat('%s', ',')" + " , group_concat('quote('||i.col_alias||')', ', ')" + " FROM tabpk t, " + " without_rowid w," + " idx_cols i" + " WHERE i.idx_ispk==0 " + " GROUP BY idx_name" + ")" + "" + ", wrapper_with(s) AS (" + " SELECT 'intck_wrapper AS (\n SELECT\n ' || (" + " WITH f(a, b) AS (" + " SELECT col_expr, col_alias FROM idx_cols" + " UNION ALL " + " SELECT partial, partial_alias FROM idx WHERE partial IS NOT NULL" + " )" + " SELECT group_concat(format('%s AS %s', a, b), ',\n ') FROM f" + " )" + " || format('\n FROM %Q.%Q ', t.db, t.tab)" + /* If the object being checked is a table, append "NOT INDEXED". + ** Otherwise, append "INDEXED BY ", and then, if the index + ** is a partial index " WHERE ". */ + " || CASE WHEN t.idx IS NULL THEN " + " 'NOT INDEXED'" + " ELSE" + " format('INDEXED BY %Q%s', t.idx, ' WHERE '||i.partial)" + " END" + " || '\n)'" + " FROM tabname t LEFT JOIN idx i ON (i.name=t.idx)" + ")" + "" + ; + + bAutoIndex = intckGetAutoIndex(p); + if( bAutoIndex ) intckExec(p, "PRAGMA automatic_index = 0"); + + bIsIndex = intckIsIndex(p, zObj); + if( bIsIndex ){ + pStmt = intckPrepareFmt(p, + /* Table idxname contains a single row. The first column, "db", contains + ** the name of the db containing the table (e.g. "main") and the second, + ** "tab", the name of the table itself. */ + "WITH tabname(db, tab, idx) AS (" + " SELECT %Q, (SELECT tbl_name FROM %Q.sqlite_schema WHERE name=%Q), %Q " + ")" + "" + ", whereclause(w_c) AS (%s)" + "" + "%s" /* zCommon */ + "" + ", case_statement(c) AS (" + " SELECT " + " 'CASE WHEN (' || group_concat(col_alias, ', ') || ', 1) IS (\n' " + " || ' SELECT ' || group_concat(col_expr, ', ') || ', 1 FROM '" + " || format('%%Q.%%Q NOT INDEXED WHERE %%s\n', t.db, t.tab, p.eq_pk)" + " || ' )\n THEN NULL\n '" + " || 'ELSE format(''surplus entry ('" + " || group_concat('%%s', ',') || ',' || p.ps_pk" + " || ') in index ' || t.idx || ''', ' " + " || group_concat('quote('||i.col_alias||')', ', ') || ', ' || p.pk_pk" + " || ')'" + " || '\n END AS error_message'" + " FROM tabname t, tabpk p, idx_cols i WHERE i.idx_name=t.idx" + ")" + "" + ", thiskey(k, n) AS (" + " SELECT group_concat(i.col_alias, ', ') || ', ' || p.o_pk, " + " count(*) + p.n_pk " + " FROM tabpk p, idx_cols i WHERE i.idx_name=p.idx" + ")" + "" + ", main_select(m, n) AS (" + " SELECT format(" + " 'WITH %%s\n' ||" + " ', idx_checker AS (\n' ||" + " ' SELECT %%s,\n' ||" + " ' %%s\n' || " + " ' FROM intck_wrapper AS o\n' ||" + " ')\n'," + " ww.s, c, t.k" + " ), t.n" + " FROM case_statement, wrapper_with ww, thiskey t" + ")" + + "SELECT m || " + " group_concat('SELECT * FROM idx_checker ' || w_c, ' UNION ALL '), n" + " FROM " + "main_select, whereclause " + , p->zDb, p->zDb, zObj, zObj + , zPrev ? zPrev : "VALUES('')", zCommon + ); + }else{ + pStmt = intckPrepareFmt(p, + /* Table tabname contains a single row. The first column, "db", contains + ** the name of the db containing the table (e.g. "main") and the second, + ** "tab", the name of the table itself. */ + "WITH tabname(db, tab, idx, prev) AS (SELECT %Q, %Q, NULL, %Q)" + "" + "%s" /* zCommon */ + + /* expr(e) contains one row for each index on table zObj. Value e + ** is set to an expression that evaluates to NULL if the required + ** entry is present in the index, or an error message otherwise. */ + ", expr(e, p) AS (" + " SELECT format('CASE WHEN EXISTS \n" + " (SELECT 1 FROM %%Q.%%Q AS i INDEXED BY %%Q WHERE %%s%%s)\n" + " THEN NULL\n" + " ELSE format(''entry (%%s,%%s) missing from index %%s'', %%s, %%s)\n" + " END\n'" + " , t.db, t.tab, i.name, i.match_expr, ' AND (' || partial || ')'," + " i.idx_ps, t.ps_pk, i.name, i.idx_idx, t.pk_pk)," + " CASE WHEN partial IS NULL THEN NULL ELSE i.partial_alias END" + " FROM tabpk t, idx i" + ")" + + ", numbered(ii, cond, e) AS (" + " SELECT 0, 'n.ii=0', 'NULL'" + " UNION ALL " + " SELECT row_number() OVER ()," + " '(n.ii='||row_number() OVER ()||COALESCE(' AND '||p||')', ')'), e" + " FROM expr" + ")" + + ", counter_with(w) AS (" + " SELECT 'WITH intck_counter(ii) AS (\n ' || " + " group_concat('SELECT '||ii, ' UNION ALL\n ') " + " || '\n)' FROM numbered" + ")" + "" + ", case_statement(c) AS (" + " SELECT 'CASE ' || " + " group_concat(format('\n WHEN %%s THEN (%%s)', cond, e), '') ||" + " '\nEND AS error_message'" + " FROM numbered" + ")" + "" + + /* This table contains a single row consisting of a single value - + ** the text of an SQL expression that may be used by the main SQL + ** statement to output an SQL literal that can be used to resume + ** the scan if it is suspended. e.g. for a rowid table, an expression + ** like: + ** + ** format('(%d,%d)', _rowid_, n.ii) + */ + ", thiskey(k, n) AS (" + " SELECT o_pk || ', ii', n_pk+1 FROM tabpk" + ")" + "" + ", whereclause(w_c) AS (" + " SELECT CASE WHEN prev!='' THEN " + " '\nWHERE (' || o_pk ||', n.ii) > ' || prev" + " ELSE ''" + " END" + " FROM tabpk, tabname" + ")" + "" + ", main_select(m, n) AS (" + " SELECT format(" + " '%%s, %%s\nSELECT %%s,\n%%s\nFROM intck_wrapper AS o" + ", intck_counter AS n%%s\nORDER BY %%s', " + " w, ww.s, c, thiskey.k, whereclause.w_c, t.o_pk" + " ), thiskey.n" + " FROM case_statement, tabpk t, counter_with, " + " wrapper_with ww, thiskey, whereclause" + ")" + + "SELECT m, n FROM main_select", + p->zDb, zObj, zPrev, zCommon ); } - idxFinalize(&rc, pAllIndex); - idxFinalize(&rc, pIndexXInfo); - idxFinalize(&rc, pWrite); - - if( pCtx ){ - for(i=0; inSlot; i++){ - sqlite3_free(pCtx->aSlot[i].z); + while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ + zRet = intckMprintf(p, "%s", (const char*)sqlite3_column_text(pStmt, 0)); + if( pnKeyVal ){ + *pnKeyVal = sqlite3_column_int(pStmt, 1); } - sqlite3_free(pCtx); } + intckFinalize(p, pStmt); - if( rc==SQLITE_OK ){ - rc = sqlite3_exec(p->dbm, "ANALYZE sqlite_schema", 0, 0, 0); - } - - sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp."UNIQUE_TABLE_NAME,0,0,0); - return rc; + if( bAutoIndex ) intckExec(p, "PRAGMA automatic_index = 1"); + return zRet; } /* -** Allocate a new sqlite3expert object. +** Open a new integrity-check object. */ -sqlite3expert *sqlite3_expert_new(sqlite3 *db, char **pzErrmsg){ +int sqlite3_intck_open( + sqlite3 *db, /* Database handle to operate on */ + const char *zDbArg, /* "main", "temp" etc. */ + sqlite3_intck **ppOut /* OUT: New integrity-check handle */ +){ + sqlite3_intck *pNew = 0; int rc = SQLITE_OK; - sqlite3expert *pNew; - - pNew = (sqlite3expert*)idxMalloc(&rc, sizeof(sqlite3expert)); + const char *zDb = zDbArg ? zDbArg : "main"; + int nDb = (int)strlen(zDb); - /* Open two in-memory databases to work with. The "vtab database" (dbv) - ** will contain a virtual table corresponding to each real table in - ** the user database schema, and a copy of each view. It is used to - ** collect information regarding the WHERE, ORDER BY and other clauses - ** of the user's query. - */ - if( rc==SQLITE_OK ){ + pNew = (sqlite3_intck*)sqlite3_malloc(sizeof(*pNew) + nDb + 1); + if( pNew==0 ){ + rc = SQLITE_NOMEM; + }else{ + memset(pNew, 0, sizeof(*pNew)); pNew->db = db; - pNew->iSample = 100; - rc = sqlite3_open(":memory:", &pNew->dbv); - } - if( rc==SQLITE_OK ){ - rc = sqlite3_open(":memory:", &pNew->dbm); - if( rc==SQLITE_OK ){ - sqlite3_db_config(pNew->dbm, SQLITE_DBCONFIG_TRIGGER_EQP, 1, (int*)0); - } - } - - - /* Copy the entire schema of database [db] into [dbm]. */ - if( rc==SQLITE_OK ){ - sqlite3_stmt *pSql = 0; - rc = idxPrintfPrepareStmt(pNew->db, &pSql, pzErrmsg, - "SELECT sql FROM sqlite_schema WHERE name NOT LIKE 'sqlite_%%'" - " AND sql NOT LIKE 'CREATE VIRTUAL %%'" + pNew->zDb = (const char*)&pNew[1]; + memcpy(&pNew[1], zDb, nDb+1); + rc = sqlite3_create_function(db, "parse_create_index", + 2, SQLITE_UTF8, 0, intckParseCreateIndexFunc, 0, 0 ); - while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSql) ){ - const char *zSql = (const char*)sqlite3_column_text(pSql, 0); - if( zSql ) rc = sqlite3_exec(pNew->dbm, zSql, 0, 0, pzErrmsg); + if( rc!=SQLITE_OK ){ + sqlite3_intck_close(pNew); + pNew = 0; } - idxFinalize(&rc, pSql); - } - - /* Create the vtab schema */ - if( rc==SQLITE_OK ){ - rc = idxCreateVtabSchema(pNew, pzErrmsg); - } - - /* Register the auth callback with dbv */ - if( rc==SQLITE_OK ){ - sqlite3_set_authorizer(pNew->dbv, idxAuthCallback, (void*)pNew); } - /* If an error has occurred, free the new object and reutrn NULL. Otherwise, - ** return the new sqlite3expert handle. */ - if( rc!=SQLITE_OK ){ - sqlite3_expert_destroy(pNew); - pNew = 0; - } - return pNew; + *ppOut = pNew; + return rc; } /* -** Configure an sqlite3expert object. +** Free the integrity-check object. */ -int sqlite3_expert_config(sqlite3expert *p, int op, ...){ - int rc = SQLITE_OK; - va_list ap; - va_start(ap, op); - switch( op ){ - case EXPERT_CONFIG_SAMPLE: { - int iVal = va_arg(ap, int); - if( iVal<0 ) iVal = 0; - if( iVal>100 ) iVal = 100; - p->iSample = iVal; - break; - } - default: - rc = SQLITE_NOTFOUND; - break; +void sqlite3_intck_close(sqlite3_intck *p){ + if( p ){ + sqlite3_finalize(p->pCheck); + sqlite3_create_function( + p->db, "parse_create_index", 1, SQLITE_UTF8, 0, 0, 0, 0 + ); + sqlite3_free(p->zObj); + sqlite3_free(p->zKey); + sqlite3_free(p->zTestSql); + sqlite3_free(p->zErr); + sqlite3_free(p->zMessage); + sqlite3_free(p); } - - va_end(ap); - return rc; } /* -** Add an SQL statement to the analysis. +** Step the integrity-check object. */ -int sqlite3_expert_sql( - sqlite3expert *p, /* From sqlite3_expert_new() */ - const char *zSql, /* SQL statement to add */ - char **pzErr /* OUT: Error message (if any) */ -){ - IdxScan *pScanOrig = p->pScan; - IdxStatement *pStmtOrig = p->pStatement; - int rc = SQLITE_OK; - const char *zStmt = zSql; +int sqlite3_intck_step(sqlite3_intck *p){ + if( p->rc==SQLITE_OK ){ - if( p->bRun ) return SQLITE_MISUSE; + if( p->zMessage ){ + sqlite3_free(p->zMessage); + p->zMessage = 0; + } - while( rc==SQLITE_OK && zStmt && zStmt[0] ){ - sqlite3_stmt *pStmt = 0; - rc = sqlite3_prepare_v2(p->dbv, zStmt, -1, &pStmt, &zStmt); - if( rc==SQLITE_OK ){ - if( pStmt ){ - IdxStatement *pNew; - const char *z = sqlite3_sql(pStmt); - int n = STRLEN(z); - pNew = (IdxStatement*)idxMalloc(&rc, sizeof(IdxStatement) + n+1); - if( rc==SQLITE_OK ){ - pNew->zSql = (char*)&pNew[1]; - memcpy(pNew->zSql, z, n+1); - pNew->pNext = p->pStatement; - if( p->pStatement ) pNew->iId = p->pStatement->iId+1; - p->pStatement = pNew; + if( p->bCorruptSchema ){ + p->rc = SQLITE_DONE; + }else + if( p->pCheck==0 ){ + intckFindObject(p); + if( p->rc==SQLITE_OK ){ + if( p->zObj ){ + char *zSql = 0; + zSql = intckCheckObjectSql(p, p->zObj, p->zKey, &p->nKeyVal); + p->pCheck = intckPrepare(p, zSql); + sqlite3_free(zSql); + sqlite3_free(p->zKey); + p->zKey = 0; + }else{ + p->rc = SQLITE_DONE; } - sqlite3_finalize(pStmt); + }else if( p->rc==SQLITE_CORRUPT ){ + p->rc = SQLITE_OK; + p->zMessage = intckMprintf(p, "%s", + "corruption found while reading database schema" + ); + p->bCorruptSchema = 1; } - }else{ - idxDatabaseError(p->dbv, pzErr); } - } - if( rc!=SQLITE_OK ){ - idxScanFree(p->pScan, pScanOrig); - idxStatementFree(p->pStatement, pStmtOrig); - p->pScan = pScanOrig; - p->pStatement = pStmtOrig; + if( p->pCheck ){ + assert( p->rc==SQLITE_OK ); + if( sqlite3_step(p->pCheck)==SQLITE_ROW ){ + /* Normal case, do nothing. */ + }else{ + intckFinalize(p, p->pCheck); + p->pCheck = 0; + p->nKeyVal = 0; + if( p->rc==SQLITE_CORRUPT ){ + p->rc = SQLITE_OK; + p->zMessage = intckMprintf(p, + "corruption found while scanning database object %s", p->zObj + ); + } + } + } } - return rc; + return p->rc; } -int sqlite3_expert_analyze(sqlite3expert *p, char **pzErr){ - int rc; - IdxHashEntry *pEntry; - - /* Do trigger processing to collect any extra IdxScan structures */ - rc = idxProcessTriggers(p, pzErr); - - /* Create candidate indexes within the in-memory database file */ - if( rc==SQLITE_OK ){ - rc = idxCreateCandidates(p); - }else if ( rc==SQLITE_BUSY_TIMEOUT ){ - if( pzErr ) - *pzErr = sqlite3_mprintf("Cannot find a unique index name to propose."); - return rc; - } - - /* Generate the stat1 data */ - if( rc==SQLITE_OK ){ - rc = idxPopulateStat1(p, pzErr); - } - - /* Formulate the EXPERT_REPORT_CANDIDATES text */ - for(pEntry=p->hIdx.pFirst; pEntry; pEntry=pEntry->pNext){ - p->zCandidates = idxAppendText(&rc, p->zCandidates, - "%s;%s%s\n", pEntry->zVal, - pEntry->zVal2 ? " -- stat1: " : "", pEntry->zVal2 - ); - } - - /* Figure out which of the candidate indexes are preferred by the query - ** planner and report the results to the user. */ - if( rc==SQLITE_OK ){ - rc = idxFindIndexes(p, pzErr); +/* +** Return a message describing the corruption encountered by the most recent +** call to sqlite3_intck_step(), or NULL if no corruption was encountered. +*/ +const char *sqlite3_intck_message(sqlite3_intck *p){ + assert( p->pCheck==0 || p->zMessage==0 ); + if( p->zMessage ){ + return p->zMessage; } - - if( rc==SQLITE_OK ){ - p->bRun = 1; + if( p->pCheck ){ + return (const char*)sqlite3_column_text(p->pCheck, 0); } - return rc; + return 0; } /* -** Return the total number of statements that have been added to this -** sqlite3expert using sqlite3_expert_sql(). +** Return the error code and message. */ -int sqlite3_expert_count(sqlite3expert *p){ - int nRet = 0; - if( p->pStatement ) nRet = p->pStatement->iId+1; - return nRet; +int sqlite3_intck_error(sqlite3_intck *p, const char **pzErr){ + if( pzErr ) *pzErr = p->zErr; + return (p->rc==SQLITE_DONE ? SQLITE_OK : p->rc); } /* -** Return a component of the report. +** Close any read transaction the integrity-check object is holding open +** on the database. */ -const char *sqlite3_expert_report(sqlite3expert *p, int iStmt, int eReport){ - const char *zRet = 0; - IdxStatement *pStmt; - - if( p->bRun==0 ) return 0; - for(pStmt=p->pStatement; pStmt && pStmt->iId!=iStmt; pStmt=pStmt->pNext); - switch( eReport ){ - case EXPERT_REPORT_SQL: - if( pStmt ) zRet = pStmt->zSql; - break; - case EXPERT_REPORT_INDEXES: - if( pStmt ) zRet = pStmt->zIdx; - break; - case EXPERT_REPORT_PLAN: - if( pStmt ) zRet = pStmt->zEQP; - break; - case EXPERT_REPORT_CANDIDATES: - zRet = p->zCandidates; - break; +int sqlite3_intck_unlock(sqlite3_intck *p){ + if( p->rc==SQLITE_OK && p->pCheck ){ + assert( p->zKey==0 && p->nKeyVal>0 ); + intckSaveKey(p); + intckFinalize(p, p->pCheck); + p->pCheck = 0; } - return zRet; + return p->rc; } /* -** Free an sqlite3expert object. +** Return the SQL statement used to check object zObj. Or, if zObj is +** NULL, the current SQL statement. */ -void sqlite3_expert_destroy(sqlite3expert *p){ - if( p ){ - sqlite3_close(p->dbm); - sqlite3_close(p->dbv); - idxScanFree(p->pScan, 0); - idxStatementFree(p->pStatement, 0); - idxTableFree(p->pTable); - idxWriteFree(p->pWrite); - idxHashClear(&p->hIdx); - sqlite3_free(p->zCandidates); - sqlite3_free(p); +const char *sqlite3_intck_test_sql(sqlite3_intck *p, const char *zObj){ + sqlite3_free(p->zTestSql); + if( zObj ){ + p->zTestSql = intckCheckObjectSql(p, zObj, 0, 0); + }else{ + if( p->zObj ){ + p->zTestSql = intckCheckObjectSql(p, p->zObj, p->zKey, 0); + }else{ + sqlite3_free(p->zTestSql); + p->zTestSql = 0; + } } + return p->zTestSql; } -#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */ - -/************************* End ../ext/expert/sqlite3expert.c ********************/ +/************************* End ../ext/intck/sqlite3intck.c ********************/ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) #define SQLITE_SHELL_HAVE_RECOVER 1 @@ -13437,6 +15539,15 @@ int sqlite3_recover_finish(sqlite3_recover*); typedef struct DbdataTable DbdataTable; typedef struct DbdataCursor DbdataCursor; +typedef struct DbdataBuffer DbdataBuffer; + +/* +** Buffer type. +*/ +struct DbdataBuffer { + u8 *aBuf; + sqlite3_int64 nBuf; +}; /* Cursor object */ struct DbdataCursor { @@ -13453,7 +15564,7 @@ struct DbdataCursor { sqlite3_int64 iRowid; /* Only for the sqlite_dbdata table */ - u8 *pRec; /* Buffer containing current record */ + DbdataBuffer rec; sqlite3_int64 nRec; /* Size of pRec[] in bytes */ sqlite3_int64 nHdr; /* Size of header in bytes */ int iField; /* Current field number */ @@ -13498,6 +15609,31 @@ struct DbdataTable { " schema TEXT HIDDEN" \ ")" +/* +** Ensure the buffer passed as the first argument is at least nMin bytes +** in size. If an error occurs while attempting to resize the buffer, +** SQLITE_NOMEM is returned. Otherwise, SQLITE_OK. +*/ +static int dbdataBufferSize(DbdataBuffer *pBuf, sqlite3_int64 nMin){ + if( nMin>pBuf->nBuf ){ + sqlite3_int64 nNew = nMin+16384; + u8 *aNew = (u8*)sqlite3_realloc64(pBuf->aBuf, nNew); + + if( aNew==0 ) return SQLITE_NOMEM; + pBuf->aBuf = aNew; + pBuf->nBuf = nNew; + } + return SQLITE_OK; +} + +/* +** Release the allocation managed by buffer pBuf. +*/ +static void dbdataBufferFree(DbdataBuffer *pBuf){ + sqlite3_free(pBuf->aBuf); + memset(pBuf, 0, sizeof(*pBuf)); +} + /* ** Connect to an sqlite_dbdata (pAux==0) or sqlite_dbptr (pAux!=0) virtual ** table. @@ -13638,9 +15774,9 @@ static void dbdataResetCursor(DbdataCursor *pCsr){ pCsr->iField = 0; pCsr->bOnePage = 0; sqlite3_free(pCsr->aPage); - sqlite3_free(pCsr->pRec); - pCsr->pRec = 0; + dbdataBufferFree(&pCsr->rec); pCsr->aPage = 0; + pCsr->nRec = 0; } /* @@ -13782,67 +15918,88 @@ static void dbdataValue( u8 *pData, sqlite3_int64 nData ){ - if( eType>=0 && dbdataValueBytes(eType)<=nData ){ - switch( eType ){ - case 0: - case 10: - case 11: - sqlite3_result_null(pCtx); - break; - - case 8: - sqlite3_result_int(pCtx, 0); - break; - case 9: - sqlite3_result_int(pCtx, 1); - break; - - case 1: case 2: case 3: case 4: case 5: case 6: case 7: { - sqlite3_uint64 v = (signed char)pData[0]; - pData++; - switch( eType ){ - case 7: - case 6: v = (v<<16) + (pData[0]<<8) + pData[1]; pData += 2; - case 5: v = (v<<16) + (pData[0]<<8) + pData[1]; pData += 2; - case 4: v = (v<<8) + pData[0]; pData++; - case 3: v = (v<<8) + pData[0]; pData++; - case 2: v = (v<<8) + pData[0]; pData++; - } - - if( eType==7 ){ - double r; - memcpy(&r, &v, sizeof(r)); - sqlite3_result_double(pCtx, r); - }else{ - sqlite3_result_int64(pCtx, (sqlite3_int64)v); + if( eType>=0 ){ + if( dbdataValueBytes(eType)<=nData ){ + switch( eType ){ + case 0: + case 10: + case 11: + sqlite3_result_null(pCtx); + break; + + case 8: + sqlite3_result_int(pCtx, 0); + break; + case 9: + sqlite3_result_int(pCtx, 1); + break; + + case 1: case 2: case 3: case 4: case 5: case 6: case 7: { + sqlite3_uint64 v = (signed char)pData[0]; + pData++; + switch( eType ){ + case 7: + case 6: v = (v<<16) + (pData[0]<<8) + pData[1]; pData += 2; + case 5: v = (v<<16) + (pData[0]<<8) + pData[1]; pData += 2; + case 4: v = (v<<8) + pData[0]; pData++; + case 3: v = (v<<8) + pData[0]; pData++; + case 2: v = (v<<8) + pData[0]; pData++; + } + + if( eType==7 ){ + double r; + memcpy(&r, &v, sizeof(r)); + sqlite3_result_double(pCtx, r); + }else{ + sqlite3_result_int64(pCtx, (sqlite3_int64)v); + } + break; } - break; - } - - default: { - int n = ((eType-12) / 2); - if( eType % 2 ){ - switch( enc ){ -#ifndef SQLITE_OMIT_UTF16 - case SQLITE_UTF16BE: - sqlite3_result_text16be(pCtx, (void*)pData, n, SQLITE_TRANSIENT); - break; - case SQLITE_UTF16LE: - sqlite3_result_text16le(pCtx, (void*)pData, n, SQLITE_TRANSIENT); - break; -#endif - default: - sqlite3_result_text(pCtx, (char*)pData, n, SQLITE_TRANSIENT); - break; + + default: { + int n = ((eType-12) / 2); + if( eType % 2 ){ + switch( enc ){ + #ifndef SQLITE_OMIT_UTF16 + case SQLITE_UTF16BE: + sqlite3_result_text16be(pCtx, (void*)pData, n, SQLITE_TRANSIENT); + break; + case SQLITE_UTF16LE: + sqlite3_result_text16le(pCtx, (void*)pData, n, SQLITE_TRANSIENT); + break; + #endif + default: + sqlite3_result_text(pCtx, (char*)pData, n, SQLITE_TRANSIENT); + break; + } + }else{ + sqlite3_result_blob(pCtx, pData, n, SQLITE_TRANSIENT); } - }else{ - sqlite3_result_blob(pCtx, pData, n, SQLITE_TRANSIENT); } } + }else{ + if( eType==7 ){ + sqlite3_result_double(pCtx, 0.0); + }else if( eType<7 ){ + sqlite3_result_int(pCtx, 0); + }else if( eType%2 ){ + sqlite3_result_text(pCtx, "", 0, SQLITE_STATIC); + }else{ + sqlite3_result_blob(pCtx, "", 0, SQLITE_STATIC); + } } } } +/* This macro is a copy of the MX_CELL() macro in the SQLite core. Given +** a page-size, it returns the maximum number of cells that may be present +** on the page. */ +#define DBDATA_MX_CELL(pgsz) ((pgsz-8)/6) + +/* Maximum number of fields that may appear in a single record. This is +** the "hard-limit", according to comments in sqliteLimit.h. */ +#define DBDATA_MX_FIELD 32676 + /* ** Move an sqlite_dbdata or sqlite_dbptr cursor to the next entry. */ @@ -13871,6 +16028,9 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){ assert( iOff+3+2<=pCsr->nPage ); pCsr->iCell = pTab->bPtr ? -2 : 0; pCsr->nCell = get_uint16(&pCsr->aPage[iOff+3]); + if( pCsr->nCell>DBDATA_MX_CELL(pCsr->nPage) ){ + pCsr->nCell = DBDATA_MX_CELL(pCsr->nPage); + } } if( pTab->bPtr ){ @@ -13888,7 +16048,8 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){ } }else{ /* If there is no record loaded, load it now. */ - if( pCsr->pRec==0 ){ + assert( pCsr->rec.aBuf!=0 || pCsr->nRec==0 ); + if( pCsr->nRec==0 ){ int bHasRowid = 0; int nPointer = 0; sqlite3_int64 nPayload = 0; @@ -13915,22 +16076,24 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){ if( pCsr->iCell>=pCsr->nCell ){ bNextPage = 1; }else{ + int iCellPtr = iOff + 8 + nPointer + pCsr->iCell*2; - iOff += 8 + nPointer + pCsr->iCell*2; - if( iOff>pCsr->nPage ){ + if( iCellPtr>pCsr->nPage ){ bNextPage = 1; }else{ - iOff = get_uint16(&pCsr->aPage[iOff]); + iOff = get_uint16(&pCsr->aPage[iCellPtr]); } /* For an interior node cell, skip past the child-page number */ iOff += nPointer; /* Load the "byte of payload including overflow" field */ - if( bNextPage || iOff>pCsr->nPage ){ + if( bNextPage || iOff>pCsr->nPage || iOff<=iCellPtr ){ bNextPage = 1; }else{ iOff += dbdataGetVarintU32(&pCsr->aPage[iOff], &nPayload); + if( nPayload>0x7fffff00 ) nPayload &= 0x3fff; + if( nPayload==0 ) nPayload = 1; } /* If this is a leaf intkey cell, load the rowid */ @@ -13965,13 +16128,12 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){ /* Allocate space for payload. And a bit more to catch small buffer ** overruns caused by attempting to read a varint or similar from ** near the end of a corrupt record. */ - pCsr->pRec = (u8*)sqlite3_malloc64(nPayload+DBDATA_PADDING_BYTES); - if( pCsr->pRec==0 ) return SQLITE_NOMEM; - memset(pCsr->pRec, 0, nPayload+DBDATA_PADDING_BYTES); - pCsr->nRec = nPayload; + rc = dbdataBufferSize(&pCsr->rec, nPayload+DBDATA_PADDING_BYTES); + if( rc!=SQLITE_OK ) return rc; + assert( nPayload!=0 ); /* Load the nLocal bytes of payload */ - memcpy(pCsr->pRec, &pCsr->aPage[iOff], nLocal); + memcpy(pCsr->rec.aBuf, &pCsr->aPage[iOff], nLocal); iOff += nLocal; /* Load content from overflow pages */ @@ -13989,19 +16151,22 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){ nCopy = U-4; if( nCopy>nRem ) nCopy = nRem; - memcpy(&pCsr->pRec[nPayload-nRem], &aOvfl[4], nCopy); + memcpy(&pCsr->rec.aBuf[nPayload-nRem], &aOvfl[4], nCopy); nRem -= nCopy; pgnoOvfl = get_uint32(aOvfl); sqlite3_free(aOvfl); } + nPayload -= nRem; } + memset(&pCsr->rec.aBuf[nPayload], 0, DBDATA_PADDING_BYTES); + pCsr->nRec = nPayload; - iHdr = dbdataGetVarintU32(pCsr->pRec, &nHdr); + iHdr = dbdataGetVarintU32(pCsr->rec.aBuf, &nHdr); if( nHdr>nPayload ) nHdr = 0; pCsr->nHdr = nHdr; - pCsr->pHdrPtr = &pCsr->pRec[iHdr]; - pCsr->pPtr = &pCsr->pRec[pCsr->nHdr]; + pCsr->pHdrPtr = &pCsr->rec.aBuf[iHdr]; + pCsr->pPtr = &pCsr->rec.aBuf[pCsr->nHdr]; pCsr->iField = (bHasRowid ? -1 : 0); } } @@ -14009,14 +16174,16 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){ pCsr->iField++; if( pCsr->iField>0 ){ sqlite3_int64 iType; - if( pCsr->pHdrPtr>&pCsr->pRec[pCsr->nRec] ){ + if( pCsr->pHdrPtr>=&pCsr->rec.aBuf[pCsr->nRec] + || pCsr->iField>=DBDATA_MX_FIELD + ){ bNextPage = 1; }else{ int szField = 0; pCsr->pHdrPtr += dbdataGetVarintU32(pCsr->pHdrPtr, &iType); szField = dbdataValueBytes(iType); - if( (pCsr->nRec - (pCsr->pPtr - pCsr->pRec))pPtr = &pCsr->pRec[pCsr->nRec]; + if( (pCsr->nRec - (pCsr->pPtr - pCsr->rec.aBuf))pPtr = &pCsr->rec.aBuf[pCsr->nRec]; }else{ pCsr->pPtr += szField; } @@ -14026,20 +16193,18 @@ static int dbdataNext(sqlite3_vtab_cursor *pCursor){ if( bNextPage ){ sqlite3_free(pCsr->aPage); - sqlite3_free(pCsr->pRec); pCsr->aPage = 0; - pCsr->pRec = 0; + pCsr->nRec = 0; if( pCsr->bOnePage ) return SQLITE_OK; pCsr->iPgno++; }else{ - if( pCsr->iField<0 || pCsr->pHdrPtr<&pCsr->pRec[pCsr->nHdr] ){ + if( pCsr->iField<0 || pCsr->pHdrPtr<&pCsr->rec.aBuf[pCsr->nHdr] ){ return SQLITE_OK; } /* Advance to the next cell. The next iteration of the loop will load ** the record and so on. */ - sqlite3_free(pCsr->pRec); - pCsr->pRec = 0; + pCsr->nRec = 0; pCsr->iCell++; } } @@ -14229,12 +16394,12 @@ static int dbdataColumn( case DBDATA_COLUMN_VALUE: { if( pCsr->iField<0 ){ sqlite3_result_int64(ctx, pCsr->iIntkey); - }else if( &pCsr->pRec[pCsr->nRec] >= pCsr->pPtr ){ + }else if( &pCsr->rec.aBuf[pCsr->nRec] >= pCsr->pPtr ){ sqlite3_int64 iType; dbdataGetVarintU32(pCsr->pHdrPtr, &iType); dbdataValue( ctx, pCsr->enc, iType, pCsr->pPtr, - &pCsr->pRec[pCsr->nRec] - pCsr->pPtr + &pCsr->rec.aBuf[pCsr->nRec] - pCsr->pPtr ); } break; @@ -14282,7 +16447,8 @@ static int sqlite3DbdataRegister(sqlite3 *db){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; int rc = sqlite3_create_module(db, "sqlite_dbdata", &dbdata_module, 0); @@ -15496,7 +17662,7 @@ static int recoverWriteSchema1(sqlite3_recover *p){ if( bTable && !bVirtual ){ if( SQLITE_ROW==sqlite3_step(pTblname) ){ const char *zTbl = (const char*)sqlite3_column_text(pTblname, 0); - recoverAddTable(p, zTbl, iRoot); + if( zTbl ) recoverAddTable(p, zTbl, iRoot); } recoverReset(p, pTblname); } @@ -17246,6 +19412,7 @@ struct ShellState { u8 eTraceType; /* SHELL_TRACE_* value for type of trace */ u8 bSafeMode; /* True to prohibit unsafe operations */ u8 bSafeModePersist; /* The long-term value of bSafeMode */ + u8 eRestoreState; /* See comments above doAutoDetectRestore() */ ColModeOpts cmOpts; /* Option values affecting columnar mode output */ unsigned statsOn; /* True to display memory stats before each finalize */ unsigned mEqpLines; /* Mask of vertical lines in the EQP output graph */ @@ -17439,7 +19606,7 @@ static const char *modeDescr[] = { static void shellLog(void *pArg, int iErrCode, const char *zMsg){ ShellState *p = (ShellState*)pArg; if( p->pLog==0 ) return; - utf8_printf(p->pLog, "(%d) %s\n", iErrCode, zMsg); + sputf(p->pLog, "(%d) %s\n", iErrCode, zMsg); fflush(p->pLog); } @@ -17454,9 +19621,9 @@ static void shellPutsFunc( int nVal, sqlite3_value **apVal ){ - ShellState *p = (ShellState*)sqlite3_user_data(pCtx); + /* Unused: (ShellState*)sqlite3_user_data(pCtx); */ (void)nVal; - utf8_printf(p->out, "%s\n", sqlite3_value_text(apVal[0])); + oputf("%s\n", sqlite3_value_text(apVal[0])); sqlite3_result_value(pCtx, apVal[0]); } @@ -17475,8 +19642,7 @@ static void failIfSafeMode( va_start(ap, zErrMsg); zMsg = sqlite3_vmprintf(zErrMsg, ap); va_end(ap); - raw_printf(stderr, "line %d: ", p->lineno); - utf8_printf(stderr, "%s\n", zMsg); + eputf("line %d: %s\n", p->lineno, zMsg); exit(1); } } @@ -17644,7 +19810,7 @@ static void outputModePop(ShellState *p){ /* ** Output the given string as a hex-encoded blob (eg. X'1234' ) */ -static void output_hex_blob(FILE *out, const void *pBlob, int nBlob){ +static void output_hex_blob(const void *pBlob, int nBlob){ int i; unsigned char *aBlob = (unsigned char*)pBlob; @@ -17661,7 +19827,7 @@ static void output_hex_blob(FILE *out, const void *pBlob, int nBlob){ } zStr[i*2] = '\0'; - raw_printf(out,"X'%s'", zStr); + oputf("X'%s'", zStr); sqlite3_free(zStr); } @@ -17691,25 +19857,28 @@ static const char *unused_string( ** ** See also: output_quoted_escaped_string() */ -static void output_quoted_string(FILE *out, const char *z){ +static void output_quoted_string(const char *z){ int i; char c; - setBinaryMode(out, 1); +#ifndef SQLITE_SHELL_FIDDLE + FILE *pfO = setOutputStream(invalidFileStream); + setBinaryMode(pfO, 1); +#endif if( z==0 ) return; for(i=0; (c = z[i])!=0 && c!='\''; i++){} if( c==0 ){ - utf8_printf(out,"'%s'",z); + oputf("'%s'",z); }else{ - raw_printf(out, "'"); + oputz("'"); while( *z ){ for(i=0; (c = z[i])!=0 && c!='\''; i++){} if( c=='\'' ) i++; if( i ){ - utf8_printf(out, "%.*s", i, z); + oputf("%.*s", i, z); z += i; } if( c=='\'' ){ - raw_printf(out, "'"); + oputz("'"); continue; } if( c==0 ){ @@ -17717,9 +19886,13 @@ static void output_quoted_string(FILE *out, const char *z){ } z++; } - raw_printf(out, "'"); + oputz("'"); } - setTextMode(out, 1); +#ifndef SQLITE_SHELL_FIDDLE + setTextMode(pfO, 1); +#else + setTextMode(stdout, 1); +#endif } /* @@ -17731,13 +19904,16 @@ static void output_quoted_string(FILE *out, const char *z){ ** This is like output_quoted_string() but with the addition of the \r\n ** escape mechanism. */ -static void output_quoted_escaped_string(FILE *out, const char *z){ +static void output_quoted_escaped_string(const char *z){ int i; char c; - setBinaryMode(out, 1); +#ifndef SQLITE_SHELL_FIDDLE + FILE *pfO = setOutputStream(invalidFileStream); + setBinaryMode(pfO, 1); +#endif for(i=0; (c = z[i])!=0 && c!='\'' && c!='\n' && c!='\r'; i++){} if( c==0 ){ - utf8_printf(out,"'%s'",z); + oputf("'%s'",z); }else{ const char *zNL = 0; const char *zCR = 0; @@ -17749,23 +19925,23 @@ static void output_quoted_escaped_string(FILE *out, const char *z){ if( z[i]=='\r' ) nCR++; } if( nNL ){ - raw_printf(out, "replace("); + oputz("replace("); zNL = unused_string(z, "\\n", "\\012", zBuf1); } if( nCR ){ - raw_printf(out, "replace("); + oputz("replace("); zCR = unused_string(z, "\\r", "\\015", zBuf2); } - raw_printf(out, "'"); + oputz("'"); while( *z ){ for(i=0; (c = z[i])!=0 && c!='\n' && c!='\r' && c!='\''; i++){} if( c=='\'' ) i++; if( i ){ - utf8_printf(out, "%.*s", i, z); + oputf("%.*s", i, z); z += i; } if( c=='\'' ){ - raw_printf(out, "'"); + oputz("'"); continue; } if( c==0 ){ @@ -17773,93 +19949,139 @@ static void output_quoted_escaped_string(FILE *out, const char *z){ } z++; if( c=='\n' ){ - raw_printf(out, "%s", zNL); + oputz(zNL); continue; } - raw_printf(out, "%s", zCR); + oputz(zCR); } - raw_printf(out, "'"); + oputz("'"); if( nCR ){ - raw_printf(out, ",'%s',char(13))", zCR); + oputf(",'%s',char(13))", zCR); } if( nNL ){ - raw_printf(out, ",'%s',char(10))", zNL); + oputf(",'%s',char(10))", zNL); } } - setTextMode(out, 1); +#ifndef SQLITE_SHELL_FIDDLE + setTextMode(pfO, 1); +#else + setTextMode(stdout, 1); +#endif } +/* +** Find earliest of chars within s specified in zAny. +** With ns == ~0, is like strpbrk(s,zAny) and s must be 0-terminated. +*/ +static const char *anyOfInStr(const char *s, const char *zAny, size_t ns){ + const char *pcFirst = 0; + if( ns == ~(size_t)0 ) ns = strlen(s); + while(*zAny){ + const char *pc = (const char*)memchr(s, *zAny&0xff, ns); + if( pc ){ + pcFirst = pc; + ns = pcFirst - s; + } + ++zAny; + } + return pcFirst; +} /* ** Output the given string as a quoted according to C or TCL quoting rules. */ -static void output_c_string(FILE *out, const char *z){ - unsigned int c; - fputc('"', out); - while( (c = *(z++))!=0 ){ - if( c=='\\' ){ - fputc(c, out); - fputc(c, out); - }else if( c=='"' ){ - fputc('\\', out); - fputc('"', out); - }else if( c=='\t' ){ - fputc('\\', out); - fputc('t', out); - }else if( c=='\n' ){ - fputc('\\', out); - fputc('n', out); - }else if( c=='\r' ){ - fputc('\\', out); - fputc('r', out); +static void output_c_string(const char *z){ + char c; + static const char *zq = "\""; + static long ctrlMask = ~0L; + static const char *zDQBSRO = "\"\\\x7f"; /* double-quote, backslash, rubout */ + char ace[3] = "\\?"; + char cbsSay; + oputz(zq); + while( *z!=0 ){ + const char *pcDQBSRO = anyOfInStr(z, zDQBSRO, ~(size_t)0); + const char *pcPast = zSkipValidUtf8(z, INT_MAX, ctrlMask); + const char *pcEnd = (pcDQBSRO && pcDQBSRO < pcPast)? pcDQBSRO : pcPast; + if( pcEnd > z ) oputb(z, (int)(pcEnd-z)); + if( (c = *pcEnd)==0 ) break; + ++pcEnd; + switch( c ){ + case '\\': case '"': + cbsSay = (char)c; + break; + case '\t': cbsSay = 't'; break; + case '\n': cbsSay = 'n'; break; + case '\r': cbsSay = 'r'; break; + case '\f': cbsSay = 'f'; break; + default: cbsSay = 0; break; + } + if( cbsSay ){ + ace[1] = cbsSay; + oputz(ace); }else if( !isprint(c&0xff) ){ - raw_printf(out, "\\%03o", c&0xff); + oputf("\\%03o", c&0xff); }else{ - fputc(c, out); + ace[1] = (char)c; + oputz(ace+1); } + z = pcEnd; } - fputc('"', out); + oputz(zq); } /* ** Output the given string as a quoted according to JSON quoting rules. */ -static void output_json_string(FILE *out, const char *z, i64 n){ - unsigned int c; +static void output_json_string(const char *z, i64 n){ + char c; + static const char *zq = "\""; + static long ctrlMask = ~0L; + static const char *zDQBS = "\"\\"; + const char *pcLimit; + char ace[3] = "\\?"; + char cbsSay; + if( z==0 ) z = ""; - if( n<0 ) n = strlen(z); - fputc('"', out); - while( n-- ){ + pcLimit = z + ((n<0)? strlen(z) : (size_t)n); + oputz(zq); + while( z < pcLimit ){ + const char *pcDQBS = anyOfInStr(z, zDQBS, pcLimit-z); + const char *pcPast = zSkipValidUtf8(z, (int)(pcLimit-z), ctrlMask); + const char *pcEnd = (pcDQBS && pcDQBS < pcPast)? pcDQBS : pcPast; + if( pcEnd > z ){ + oputb(z, (int)(pcEnd-z)); + z = pcEnd; + } + if( z >= pcLimit ) break; c = *(z++); - if( c=='\\' || c=='"' ){ - fputc('\\', out); - fputc(c, out); + switch( c ){ + case '"': case '\\': + cbsSay = (char)c; + break; + case '\b': cbsSay = 'b'; break; + case '\f': cbsSay = 'f'; break; + case '\n': cbsSay = 'n'; break; + case '\r': cbsSay = 'r'; break; + case '\t': cbsSay = 't'; break; + default: cbsSay = 0; break; + } + if( cbsSay ){ + ace[1] = cbsSay; + oputz(ace); }else if( c<=0x1f ){ - fputc('\\', out); - if( c=='\b' ){ - fputc('b', out); - }else if( c=='\f' ){ - fputc('f', out); - }else if( c=='\n' ){ - fputc('n', out); - }else if( c=='\r' ){ - fputc('r', out); - }else if( c=='\t' ){ - fputc('t', out); - }else{ - raw_printf(out, "u%04x",c); - } + oputf("u%04x", c); }else{ - fputc(c, out); + ace[1] = (char)c; + oputz(ace+1); } } - fputc('"', out); + oputz(zq); } /* ** Output the given string with characters that are special to ** HTML escaped. */ -static void output_html_string(FILE *out, const char *z){ +static void output_html_string(const char *z){ int i; if( z==0 ) z = ""; while( *z ){ @@ -17871,18 +20093,18 @@ static void output_html_string(FILE *out, const char *z){ && z[i]!='\''; i++){} if( i>0 ){ - utf8_printf(out,"%.*s",i,z); + oputf("%.*s",i,z); } if( z[i]=='<' ){ - raw_printf(out,"<"); + oputz("<"); }else if( z[i]=='&' ){ - raw_printf(out,"&"); + oputz("&"); }else if( z[i]=='>' ){ - raw_printf(out,">"); + oputz(">"); }else if( z[i]=='\"' ){ - raw_printf(out,"""); + oputz("""); }else if( z[i]=='\'' ){ - raw_printf(out,"'"); + oputz("'"); }else{ break; } @@ -17920,9 +20142,8 @@ static const char needCsvQuote[] = { ** is only issued if bSep is true. */ static void output_csv(ShellState *p, const char *z, int bSep){ - FILE *out = p->out; if( z==0 ){ - utf8_printf(out,"%s",p->nullValue); + oputf("%s",p->nullValue); }else{ unsigned i; for(i=0; z[i]; i++){ @@ -17934,14 +20155,14 @@ static void output_csv(ShellState *p, const char *z, int bSep){ if( i==0 || strstr(z, p->colSeparator)!=0 ){ char *zQuoted = sqlite3_mprintf("\"%w\"", z); shell_check_oom(zQuoted); - utf8_printf(out, "%s", zQuoted); + oputz(zQuoted); sqlite3_free(zQuoted); }else{ - utf8_printf(out, "%s", z); + oputz(z); } } if( bSep ){ - utf8_printf(p->out, "%s", p->colSeparator); + oputz(p->colSeparator); } } @@ -18049,16 +20270,16 @@ static int shellAuth( az[1] = zA2; az[2] = zA3; az[3] = zA4; - utf8_printf(p->out, "authorizer: %s", azAction[op]); + oputf("authorizer: %s", azAction[op]); for(i=0; i<4; i++){ - raw_printf(p->out, " "); + oputz(" "); if( az[i] ){ - output_c_string(p->out, az[i]); + output_c_string(az[i]); }else{ - raw_printf(p->out, "NULL"); + oputz("NULL"); } } - raw_printf(p->out, "\n"); + oputz("\n"); if( p->bSafeMode ) (void)safeModeAuth(pClientData, op, zA1, zA2, zA3, zA4); return SQLITE_OK; } @@ -18074,7 +20295,7 @@ static int shellAuth( ** sqlite3_complete() returns false, try to terminate the comment before ** printing the result. https://sqlite.org/forum/forumpost/d7be961c5c */ -static void printSchemaLine(FILE *out, const char *z, const char *zTail){ +static void printSchemaLine(const char *z, const char *zTail){ char *zToFree = 0; if( z==0 ) return; if( zTail==0 ) return; @@ -18096,16 +20317,16 @@ static void printSchemaLine(FILE *out, const char *z, const char *zTail){ } } if( sqlite3_strglob("CREATE TABLE ['\"]*", z)==0 ){ - utf8_printf(out, "CREATE TABLE IF NOT EXISTS %s%s", z+13, zTail); + oputf("CREATE TABLE IF NOT EXISTS %s%s", z+13, zTail); }else{ - utf8_printf(out, "%s%s", z, zTail); + oputf("%s%s", z, zTail); } sqlite3_free(zToFree); } -static void printSchemaLineN(FILE *out, char *z, int n, const char *zTail){ +static void printSchemaLineN(char *z, int n, const char *zTail){ char c = z[n]; z[n] = 0; - printSchemaLine(out, z, zTail); + printSchemaLine(z, zTail); z[n] = c; } @@ -18133,7 +20354,7 @@ static void eqp_append(ShellState *p, int iEqpId, int p2, const char *zText){ if( zText==0 ) return; nText = strlen(zText); if( p->autoEQPtest ){ - utf8_printf(p->out, "%d,%d,%s\n", iEqpId, p2, zText); + oputf("%d,%d,%s\n", iEqpId, p2, zText); } pNew = sqlite3_malloc64( sizeof(*pNew) + nText ); shell_check_oom(pNew); @@ -18181,8 +20402,7 @@ static void eqp_render_level(ShellState *p, int iEqpId){ for(pRow = eqp_next_row(p, iEqpId, 0); pRow; pRow = pNext){ pNext = eqp_next_row(p, iEqpId, pRow); z = pRow->zText; - utf8_printf(p->out, "%s%s%s\n", p->sGraph.zPrefix, - pNext ? "|--" : "`--", z); + oputf("%s%s%s\n", p->sGraph.zPrefix, pNext ? "|--" : "`--", z); if( n<(i64)sizeof(p->sGraph.zPrefix)-7 ){ memcpy(&p->sGraph.zPrefix[n], pNext ? "| " : " ", 4); eqp_render_level(p, pRow->iEqpId); @@ -18202,13 +20422,13 @@ static void eqp_render(ShellState *p, i64 nCycle){ eqp_reset(p); return; } - utf8_printf(p->out, "%s\n", pRow->zText+3); + oputf("%s\n", pRow->zText+3); p->sGraph.pRow = pRow->pNext; sqlite3_free(pRow); }else if( nCycle>0 ){ - utf8_printf(p->out, "QUERY PLAN (cycles=%lld [100%%])\n", nCycle); + oputf("QUERY PLAN (cycles=%lld [100%%])\n", nCycle); }else{ - utf8_printf(p->out, "QUERY PLAN\n"); + oputz("QUERY PLAN\n"); } p->sGraph.zPrefix[0] = 0; eqp_render_level(p, 0); @@ -18224,13 +20444,13 @@ static int progress_handler(void *pClientData) { ShellState *p = (ShellState*)pClientData; p->nProgress++; if( p->nProgress>=p->mxProgress && p->mxProgress>0 ){ - raw_printf(p->out, "Progress limit reached (%u)\n", p->nProgress); + oputf("Progress limit reached (%u)\n", p->nProgress); if( p->flgProgress & SHELL_PROGRESS_RESET ) p->nProgress = 0; if( p->flgProgress & SHELL_PROGRESS_ONCE ) p->mxProgress = 0; return 1; } if( (p->flgProgress & SHELL_PROGRESS_QUIET)==0 ){ - raw_printf(p->out, "Progress %u\n", p->nProgress); + oputf("Progress %u\n", p->nProgress); } return 0; } @@ -18239,14 +20459,14 @@ static int progress_handler(void *pClientData) { /* ** Print N dashes */ -static void print_dashes(FILE *out, int N){ +static void print_dashes(int N){ const char zDash[] = "--------------------------------------------------"; const int nDash = sizeof(zDash) - 1; while( N>nDash ){ - fputs(zDash, out); + oputz(zDash); N -= nDash; } - raw_printf(out, "%.*s", N, zDash); + oputf("%.*s", N, zDash); } /* @@ -18259,15 +20479,15 @@ static void print_row_separator( ){ int i; if( nArg>0 ){ - fputs(zSep, p->out); - print_dashes(p->out, p->actualWidth[0]+2); + oputz(zSep); + print_dashes(p->actualWidth[0]+2); for(i=1; iout); - print_dashes(p->out, p->actualWidth[i]+2); + oputz(zSep); + print_dashes(p->actualWidth[i]+2); } - fputs(zSep, p->out); + oputz(zSep); } - fputs("\n", p->out); + oputz("\n"); } /* @@ -18297,10 +20517,10 @@ static int shell_callback( int len = strlen30(azCol[i] ? azCol[i] : ""); if( len>w ) w = len; } - if( p->cnt++>0 ) utf8_printf(p->out, "%s", p->rowSeparator); + if( p->cnt++>0 ) oputz(p->rowSeparator); for(i=0; iout,"%*s = %s%s", w, azCol[i], - azArg[i] ? azArg[i] : p->nullValue, p->rowSeparator); + oputf("%*s = %s%s", w, azCol[i], + azArg[i] ? azArg[i] : p->nullValue, p->rowSeparator); } break; } @@ -18327,12 +20547,12 @@ static int shell_callback( /* If this is the first row seen, print out the headers */ if( p->cnt++==0 ){ for(i=0; iout, aWidth[i], azCol[ aMap[i] ]); - fputs(i==nArg-1 ? "\n" : " ", p->out); + utf8_width_print(aWidth[i], azCol[ aMap[i] ]); + oputz(i==nArg-1 ? "\n" : " "); } for(i=0; iout, aWidth[i]); - fputs(i==nArg-1 ? "\n" : " ", p->out); + print_dashes(aWidth[i]); + oputz(i==nArg-1 ? "\n" : " "); } } @@ -18350,17 +20570,17 @@ static int shell_callback( } if( i==iIndent && p->aiIndent && p->pStmt ){ if( p->iIndentnIndent ){ - utf8_printf(p->out, "%*.s", p->aiIndent[p->iIndent], ""); + oputf("%*.s", p->aiIndent[p->iIndent], ""); } p->iIndent++; } - utf8_width_print(p->out, w, zVal ? zVal : p->nullValue); - fputs(i==nArg-1 ? "\n" : zSep, p->out); + utf8_width_print(w, zVal ? zVal : p->nullValue); + oputz(i==nArg-1 ? "\n" : zSep); } break; } case MODE_Semi: { /* .schema and .fullschema output */ - printSchemaLine(p->out, azArg[0], ";\n"); + printSchemaLine(azArg[0], ";\n"); break; } case MODE_Pretty: { /* .schema and .fullschema with --indent */ @@ -18375,7 +20595,7 @@ static int shell_callback( if( sqlite3_strlike("CREATE VIEW%", azArg[0], 0)==0 || sqlite3_strlike("CREATE TRIG%", azArg[0], 0)==0 ){ - utf8_printf(p->out, "%s;\n", azArg[0]); + oputf("%s;\n", azArg[0]); break; } z = sqlite3_mprintf("%s", azArg[0]); @@ -18408,7 +20628,7 @@ static int shell_callback( }else if( c==')' ){ nParen--; if( nLine>0 && nParen==0 && j>0 ){ - printSchemaLineN(p->out, z, j, "\n"); + printSchemaLineN(z, j, "\n"); j = 0; } } @@ -18417,7 +20637,7 @@ static int shell_callback( && (c=='(' || c=='\n' || (c==',' && !wsToEol(z+i+1))) ){ if( c=='\n' ) j--; - printSchemaLineN(p->out, z, j, "\n "); + printSchemaLineN(z, j, "\n "); j = 0; nLine++; while( IsSpace(z[i+1]) ){ i++; } @@ -18425,64 +20645,59 @@ static int shell_callback( } z[j] = 0; } - printSchemaLine(p->out, z, ";\n"); + printSchemaLine(z, ";\n"); sqlite3_free(z); break; } case MODE_List: { if( p->cnt++==0 && p->showHeader ){ for(i=0; iout,"%s%s",azCol[i], - i==nArg-1 ? p->rowSeparator : p->colSeparator); + oputf("%s%s",azCol[i], i==nArg-1 ? p->rowSeparator : p->colSeparator); } } if( azArg==0 ) break; for(i=0; inullValue; - utf8_printf(p->out, "%s", z); - if( iout, "%s", p->colSeparator); - }else{ - utf8_printf(p->out, "%s", p->rowSeparator); - } + oputz(z); + oputz((icolSeparator : p->rowSeparator); } break; } case MODE_Html: { if( p->cnt++==0 && p->showHeader ){ - raw_printf(p->out,""); + oputz(""); for(i=0; iout,""); - output_html_string(p->out, azCol[i]); - raw_printf(p->out,"\n"); + oputz(""); + output_html_string(azCol[i]); + oputz("\n"); } - raw_printf(p->out,"\n"); + oputz("\n"); } if( azArg==0 ) break; - raw_printf(p->out,""); + oputz(""); for(i=0; iout,""); - output_html_string(p->out, azArg[i] ? azArg[i] : p->nullValue); - raw_printf(p->out,"\n"); + oputz(""); + output_html_string(azArg[i] ? azArg[i] : p->nullValue); + oputz("\n"); } - raw_printf(p->out,"\n"); + oputz("\n"); break; } case MODE_Tcl: { if( p->cnt++==0 && p->showHeader ){ for(i=0; iout,azCol[i] ? azCol[i] : ""); - if(iout, "%s", p->colSeparator); + output_c_string(azCol[i] ? azCol[i] : ""); + if(icolSeparator); } - utf8_printf(p->out, "%s", p->rowSeparator); + oputz(p->rowSeparator); } if( azArg==0 ) break; for(i=0; iout, azArg[i] ? azArg[i] : p->nullValue); - if(iout, "%s", p->colSeparator); + output_c_string(azArg[i] ? azArg[i] : p->nullValue); + if(icolSeparator); } - utf8_printf(p->out, "%s", p->rowSeparator); + oputz(p->rowSeparator); break; } case MODE_Csv: { @@ -18491,57 +20706,57 @@ static int shell_callback( for(i=0; iout, "%s", p->rowSeparator); + oputz(p->rowSeparator); } if( nArg>0 ){ for(i=0; iout, "%s", p->rowSeparator); + oputz(p->rowSeparator); } setTextMode(p->out, 1); break; } case MODE_Insert: { if( azArg==0 ) break; - utf8_printf(p->out,"INSERT INTO %s",p->zDestTable); + oputf("INSERT INTO %s",p->zDestTable); if( p->showHeader ){ - raw_printf(p->out,"("); + oputz("("); for(i=0; i0 ) raw_printf(p->out, ","); + if( i>0 ) oputz(","); if( quoteChar(azCol[i]) ){ char *z = sqlite3_mprintf("\"%w\"", azCol[i]); shell_check_oom(z); - utf8_printf(p->out, "%s", z); + oputz(z); sqlite3_free(z); }else{ - raw_printf(p->out, "%s", azCol[i]); + oputf("%s", azCol[i]); } } - raw_printf(p->out,")"); + oputz(")"); } p->cnt++; for(i=0; iout, i>0 ? "," : " VALUES("); + oputz(i>0 ? "," : " VALUES("); if( (azArg[i]==0) || (aiType && aiType[i]==SQLITE_NULL) ){ - utf8_printf(p->out,"NULL"); + oputz("NULL"); }else if( aiType && aiType[i]==SQLITE_TEXT ){ if( ShellHasFlag(p, SHFLG_Newlines) ){ - output_quoted_string(p->out, azArg[i]); + output_quoted_string(azArg[i]); }else{ - output_quoted_escaped_string(p->out, azArg[i]); + output_quoted_escaped_string(azArg[i]); } }else if( aiType && aiType[i]==SQLITE_INTEGER ){ - utf8_printf(p->out,"%s", azArg[i]); + oputz(azArg[i]); }else if( aiType && aiType[i]==SQLITE_FLOAT ){ char z[50]; double r = sqlite3_column_double(p->pStmt, i); sqlite3_uint64 ur; memcpy(&ur,&r,sizeof(r)); if( ur==0x7ff0000000000000LL ){ - raw_printf(p->out, "9.0e+999"); + oputz("9.0e+999"); }else if( ur==0xfff0000000000000LL ){ - raw_printf(p->out, "-9.0e+999"); + oputz("-9.0e+999"); }else{ sqlite3_int64 ir = (sqlite3_int64)r; if( r==(double)ir ){ @@ -18549,21 +20764,21 @@ static int shell_callback( }else{ sqlite3_snprintf(50,z,"%!.20g", r); } - raw_printf(p->out, "%s", z); + oputz(z); } }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){ const void *pBlob = sqlite3_column_blob(p->pStmt, i); int nBlob = sqlite3_column_bytes(p->pStmt, i); - output_hex_blob(p->out, pBlob, nBlob); + output_hex_blob(pBlob, nBlob); }else if( isNumber(azArg[i], 0) ){ - utf8_printf(p->out,"%s", azArg[i]); + oputz(azArg[i]); }else if( ShellHasFlag(p, SHFLG_Newlines) ){ - output_quoted_string(p->out, azArg[i]); + output_quoted_string(azArg[i]); }else{ - output_quoted_escaped_string(p->out, azArg[i]); + output_quoted_escaped_string(azArg[i]); } } - raw_printf(p->out,");\n"); + oputz(");\n"); break; } case MODE_Json: { @@ -18575,37 +20790,37 @@ static int shell_callback( } p->cnt++; for(i=0; iout, azCol[i], -1); - putc(':', p->out); + output_json_string(azCol[i], -1); + oputz(":"); if( (azArg[i]==0) || (aiType && aiType[i]==SQLITE_NULL) ){ - fputs("null",p->out); + oputz("null"); }else if( aiType && aiType[i]==SQLITE_FLOAT ){ char z[50]; double r = sqlite3_column_double(p->pStmt, i); sqlite3_uint64 ur; memcpy(&ur,&r,sizeof(r)); if( ur==0x7ff0000000000000LL ){ - raw_printf(p->out, "9.0e+999"); + oputz("9.0e+999"); }else if( ur==0xfff0000000000000LL ){ - raw_printf(p->out, "-9.0e+999"); + oputz("-9.0e+999"); }else{ sqlite3_snprintf(50,z,"%!.20g", r); - raw_printf(p->out, "%s", z); + oputz(z); } }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){ const void *pBlob = sqlite3_column_blob(p->pStmt, i); int nBlob = sqlite3_column_bytes(p->pStmt, i); - output_json_string(p->out, pBlob, nBlob); + output_json_string(pBlob, nBlob); }else if( aiType && aiType[i]==SQLITE_TEXT ){ - output_json_string(p->out, azArg[i], -1); + output_json_string(azArg[i], -1); }else{ - utf8_printf(p->out,"%s", azArg[i]); + oputz(azArg[i]); } if( iout); + oputz(","); } } - putc('}', p->out); + oputz("}"); break; } case MODE_Quote: { @@ -18613,7 +20828,7 @@ static int shell_callback( if( p->cnt==0 && p->showHeader ){ for(i=0; i0 ) fputs(p->colSeparator, p->out); - output_quoted_string(p->out, azCol[i]); + output_quoted_string(azCol[i]); } fputs(p->rowSeparator, p->out); } @@ -18621,24 +20836,24 @@ static int shell_callback( for(i=0; i0 ) fputs(p->colSeparator, p->out); if( (azArg[i]==0) || (aiType && aiType[i]==SQLITE_NULL) ){ - utf8_printf(p->out,"NULL"); + oputz("NULL"); }else if( aiType && aiType[i]==SQLITE_TEXT ){ - output_quoted_string(p->out, azArg[i]); + output_quoted_string(azArg[i]); }else if( aiType && aiType[i]==SQLITE_INTEGER ){ - utf8_printf(p->out,"%s", azArg[i]); + oputz(azArg[i]); }else if( aiType && aiType[i]==SQLITE_FLOAT ){ char z[50]; double r = sqlite3_column_double(p->pStmt, i); sqlite3_snprintf(50,z,"%!.20g", r); - raw_printf(p->out, "%s", z); + oputz(z); }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){ const void *pBlob = sqlite3_column_blob(p->pStmt, i); int nBlob = sqlite3_column_bytes(p->pStmt, i); - output_hex_blob(p->out, pBlob, nBlob); + output_hex_blob(pBlob, nBlob); }else if( isNumber(azArg[i], 0) ){ - utf8_printf(p->out,"%s", azArg[i]); + oputz(azArg[i]); }else{ - output_quoted_string(p->out, azArg[i]); + output_quoted_string(azArg[i]); } } fputs(p->rowSeparator, p->out); @@ -18647,17 +20862,17 @@ static int shell_callback( case MODE_Ascii: { if( p->cnt++==0 && p->showHeader ){ for(i=0; i0 ) utf8_printf(p->out, "%s", p->colSeparator); - utf8_printf(p->out,"%s",azCol[i] ? azCol[i] : ""); + if( i>0 ) oputz(p->colSeparator); + oputz(azCol[i] ? azCol[i] : ""); } - utf8_printf(p->out, "%s", p->rowSeparator); + oputz(p->rowSeparator); } if( azArg==0 ) break; for(i=0; i0 ) utf8_printf(p->out, "%s", p->colSeparator); - utf8_printf(p->out,"%s",azArg[i] ? azArg[i] : p->nullValue); + if( i>0 ) oputz(p->colSeparator); + oputz(azArg[i] ? azArg[i] : p->nullValue); } - utf8_printf(p->out, "%s", p->rowSeparator); + oputz(p->rowSeparator); break; } case MODE_EQP: { @@ -18736,7 +20951,7 @@ static void createSelftestTable(ShellState *p){ "DROP TABLE [_shell$self];" ,0,0,&zErrMsg); if( zErrMsg ){ - utf8_printf(stderr, "SELFTEST initialization failure: %s\n", zErrMsg); + eputf("SELFTEST initialization failure: %s\n", zErrMsg); sqlite3_free(zErrMsg); } sqlite3_exec(p->db, "RELEASE selftest_init",0,0,0); @@ -18839,8 +21054,8 @@ static int run_table_dump_query( rc = sqlite3_prepare_v2(p->db, zSelect, -1, &pSelect, 0); if( rc!=SQLITE_OK || !pSelect ){ char *zContext = shell_error_context(zSelect, p->db); - utf8_printf(p->out, "/**** ERROR: (%d) %s *****/\n%s", rc, - sqlite3_errmsg(p->db), zContext); + oputf("/**** ERROR: (%d) %s *****/\n%s", + rc, sqlite3_errmsg(p->db), zContext); sqlite3_free(zContext); if( (rc&0xff)!=SQLITE_CORRUPT ) p->nErr++; return rc; @@ -18849,23 +21064,22 @@ static int run_table_dump_query( nResult = sqlite3_column_count(pSelect); while( rc==SQLITE_ROW ){ z = (const char*)sqlite3_column_text(pSelect, 0); - utf8_printf(p->out, "%s", z); + oputf("%s", z); for(i=1; iout, ",%s", sqlite3_column_text(pSelect, i)); + oputf(",%s", sqlite3_column_text(pSelect, i)); } if( z==0 ) z = ""; while( z[0] && (z[0]!='-' || z[1]!='-') ) z++; if( z[0] ){ - raw_printf(p->out, "\n;\n"); + oputz("\n;\n"); }else{ - raw_printf(p->out, ";\n"); + oputz(";\n"); } rc = sqlite3_step(pSelect); } rc = sqlite3_finalize(pSelect); if( rc!=SQLITE_OK ){ - utf8_printf(p->out, "/**** ERROR: (%d) %s *****/\n", rc, - sqlite3_errmsg(p->db)); + oputf("/**** ERROR: (%d) %s *****/\n", rc, sqlite3_errmsg(p->db)); if( (rc&0xff)!=SQLITE_CORRUPT ) p->nErr++; } return rc; @@ -18901,7 +21115,7 @@ static char *save_err_msg( /* ** Attempt to display I/O stats on Linux using /proc/PID/io */ -static void displayLinuxIoStats(FILE *out){ +static void displayLinuxIoStats(void){ FILE *in; char z[200]; sqlite3_snprintf(sizeof(z), z, "/proc/%d/io", getpid()); @@ -18924,7 +21138,7 @@ static void displayLinuxIoStats(FILE *out){ for(i=0; iout, "%-36s %s\n", zLabel, zLine); + oputf("%-36s %s\n", zLabel, zLine); } /* @@ -18969,30 +21182,28 @@ static int display_stats( ){ int iCur; int iHiwtr; - FILE *out; if( pArg==0 || pArg->out==0 ) return 0; - out = pArg->out; if( pArg->pStmt && pArg->statsOn==2 ){ int nCol, i, x; sqlite3_stmt *pStmt = pArg->pStmt; char z[100]; nCol = sqlite3_column_count(pStmt); - raw_printf(out, "%-36s %d\n", "Number of output columns:", nCol); + oputf("%-36s %d\n", "Number of output columns:", nCol); for(i=0; istatsOn==3 ){ if( pArg->pStmt ){ iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP,bReset); - raw_printf(pArg->out, "VM-steps: %d\n", iCur); + oputf("VM-steps: %d\n", iCur); } return 0; } - displayStatLine(pArg, "Memory Used:", + displayStatLine("Memory Used:", "%lld (max %lld) bytes", SQLITE_STATUS_MEMORY_USED, bReset); - displayStatLine(pArg, "Number of Outstanding Allocations:", + displayStatLine("Number of Outstanding Allocations:", "%lld (max %lld)", SQLITE_STATUS_MALLOC_COUNT, bReset); if( pArg->shellFlgs & SHFLG_Pagecache ){ - displayStatLine(pArg, "Number of Pcache Pages Used:", + displayStatLine("Number of Pcache Pages Used:", "%lld (max %lld) pages", SQLITE_STATUS_PAGECACHE_USED, bReset); } - displayStatLine(pArg, "Number of Pcache Overflow Bytes:", + displayStatLine("Number of Pcache Overflow Bytes:", "%lld (max %lld) bytes", SQLITE_STATUS_PAGECACHE_OVERFLOW, bReset); - displayStatLine(pArg, "Largest Allocation:", + displayStatLine("Largest Allocation:", "%lld bytes", SQLITE_STATUS_MALLOC_SIZE, bReset); - displayStatLine(pArg, "Largest Pcache Allocation:", + displayStatLine("Largest Pcache Allocation:", "%lld bytes", SQLITE_STATUS_PAGECACHE_SIZE, bReset); #ifdef YYTRACKMAXSTACKDEPTH - displayStatLine(pArg, "Deepest Parser Stack:", + displayStatLine("Deepest Parser Stack:", "%lld (max %lld)", SQLITE_STATUS_PARSER_STACK, bReset); #endif @@ -19029,77 +21240,68 @@ static int display_stats( iHiwtr = iCur = -1; sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_USED, &iCur, &iHiwtr, bReset); - raw_printf(pArg->out, - "Lookaside Slots Used: %d (max %d)\n", - iCur, iHiwtr); + oputf("Lookaside Slots Used: %d (max %d)\n", iCur, iHiwtr); sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_HIT, &iCur, &iHiwtr, bReset); - raw_printf(pArg->out, "Successful lookaside attempts: %d\n", - iHiwtr); + oputf("Successful lookaside attempts: %d\n", iHiwtr); sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE, &iCur, &iHiwtr, bReset); - raw_printf(pArg->out, "Lookaside failures due to size: %d\n", - iHiwtr); + oputf("Lookaside failures due to size: %d\n", iHiwtr); sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL, &iCur, &iHiwtr, bReset); - raw_printf(pArg->out, "Lookaside failures due to OOM: %d\n", - iHiwtr); + oputf("Lookaside failures due to OOM: %d\n", iHiwtr); } iHiwtr = iCur = -1; sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_USED, &iCur, &iHiwtr, bReset); - raw_printf(pArg->out, "Pager Heap Usage: %d bytes\n", - iCur); + oputf("Pager Heap Usage: %d bytes\n", iCur); iHiwtr = iCur = -1; sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_HIT, &iCur, &iHiwtr, 1); - raw_printf(pArg->out, "Page cache hits: %d\n", iCur); + oputf("Page cache hits: %d\n", iCur); iHiwtr = iCur = -1; sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_MISS, &iCur, &iHiwtr, 1); - raw_printf(pArg->out, "Page cache misses: %d\n", iCur); + oputf("Page cache misses: %d\n", iCur); iHiwtr = iCur = -1; sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_WRITE, &iCur, &iHiwtr, 1); - raw_printf(pArg->out, "Page cache writes: %d\n", iCur); + oputf("Page cache writes: %d\n", iCur); iHiwtr = iCur = -1; sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_SPILL, &iCur, &iHiwtr, 1); - raw_printf(pArg->out, "Page cache spills: %d\n", iCur); + oputf("Page cache spills: %d\n", iCur); iHiwtr = iCur = -1; sqlite3_db_status(db, SQLITE_DBSTATUS_SCHEMA_USED, &iCur, &iHiwtr, bReset); - raw_printf(pArg->out, "Schema Heap Usage: %d bytes\n", - iCur); + oputf("Schema Heap Usage: %d bytes\n", iCur); iHiwtr = iCur = -1; sqlite3_db_status(db, SQLITE_DBSTATUS_STMT_USED, &iCur, &iHiwtr, bReset); - raw_printf(pArg->out, "Statement Heap/Lookaside Usage: %d bytes\n", - iCur); + oputf("Statement Heap/Lookaside Usage: %d bytes\n", iCur); } if( pArg->pStmt ){ int iHit, iMiss; iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP, bReset); - raw_printf(pArg->out, "Fullscan Steps: %d\n", iCur); + oputf("Fullscan Steps: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset); - raw_printf(pArg->out, "Sort Operations: %d\n", iCur); + oputf("Sort Operations: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX,bReset); - raw_printf(pArg->out, "Autoindex Inserts: %d\n", iCur); + oputf("Autoindex Inserts: %d\n", iCur); iHit = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FILTER_HIT, bReset); iMiss = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FILTER_MISS, bReset); if( iHit || iMiss ){ - raw_printf(pArg->out, "Bloom filter bypass taken: %d/%d\n", - iHit, iHit+iMiss); + oputf("Bloom filter bypass taken: %d/%d\n", iHit, iHit+iMiss); } iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset); - raw_printf(pArg->out, "Virtual Machine Steps: %d\n", iCur); + oputf("Virtual Machine Steps: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_REPREPARE,bReset); - raw_printf(pArg->out, "Reprepare operations: %d\n", iCur); + oputf("Reprepare operations: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_RUN, bReset); - raw_printf(pArg->out, "Number of times run: %d\n", iCur); + oputf("Number of times run: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_MEMUSED, bReset); - raw_printf(pArg->out, "Memory used by prepared stmt: %d\n", iCur); + oputf("Memory used by prepared stmt: %d\n", iCur); } #ifdef __linux__ - displayLinuxIoStats(pArg->out); + displayLinuxIoStats(); #endif /* Do not remove this machine readable comment: extra-stats-output-here */ @@ -19154,7 +21356,7 @@ static void display_explain_scanstats( if( sqlite3_stmt_scanstatus_v2(p,ii,SQLITE_SCANSTAT_EXPLAIN,f,(void*)&z) ){ break; } - n = strlen(z) + scanStatsHeight(p, ii)*3; + n = (int)strlen(z) + scanStatsHeight(p, ii)*3; if( n>nWidth ) nWidth = n; } nWidth += 4; @@ -19166,12 +21368,12 @@ static void display_explain_scanstats( i64 nCycle = 0; int iId = 0; int iPid = 0; - const char *z = 0; + const char *zo = 0; const char *zName = 0; char *zText = 0; double rEst = 0.0; - if( sqlite3_stmt_scanstatus_v2(p,ii,SQLITE_SCANSTAT_EXPLAIN,f,(void*)&z) ){ + if( sqlite3_stmt_scanstatus_v2(p,ii,SQLITE_SCANSTAT_EXPLAIN,f,(void*)&zo) ){ break; } sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_EST,f,(void*)&rEst); @@ -19182,7 +21384,7 @@ static void display_explain_scanstats( sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_PARENTID,f,(void*)&iPid); sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NAME,f,(void*)&zName); - zText = sqlite3_mprintf("%s", z); + zText = sqlite3_mprintf("%s", zo); if( nCycle>=0 || nLoop>=0 || nRow>=0 ){ char *z = 0; if( nCycle>=0 && nTotal>0 ){ @@ -19334,7 +21536,7 @@ static void display_scanstats( UNUSED_PARAMETER(pArg); #else if( pArg->scanstatsOn==3 ){ - const char *zSql = + const char *zSql = " SELECT addr, opcode, p1, p2, p3, p4, p5, comment, nexec," " round(ncycle*100.0 / (sum(ncycle) OVER ()), 2)||'%' AS cycles" " FROM bytecode(?)"; @@ -19480,17 +21682,17 @@ static void bind_prepared_stmt(ShellState *pArg, sqlite3_stmt *pStmt){ /* Draw horizontal line N characters long using unicode box ** characters */ -static void print_box_line(FILE *out, int N){ +static void print_box_line(int N){ const char zDash[] = BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24 BOX_24; const int nDash = sizeof(zDash) - 1; N *= 3; while( N>nDash ){ - utf8_printf(out, zDash); + oputz(zDash); N -= nDash; } - utf8_printf(out, "%.*s", N, zDash); + oputf("%.*s", N, zDash); } /* @@ -19505,15 +21707,15 @@ static void print_box_row_separator( ){ int i; if( nArg>0 ){ - utf8_printf(p->out, "%s", zSep1); - print_box_line(p->out, p->actualWidth[0]+2); + oputz(zSep1); + print_box_line(p->actualWidth[0]+2); for(i=1; iout, "%s", zSep2); - print_box_line(p->out, p->actualWidth[i]+2); + oputz(zSep2); + print_box_line(p->actualWidth[i]+2); } - utf8_printf(p->out, "%s", zSep3); + oputz(zSep3); } - fputs("\n", p->out); + oputz("\n"); } /* @@ -19682,6 +21884,7 @@ static void exec_prepared_stmt_columnar( rc = sqlite3_step(pStmt); if( rc!=SQLITE_ROW ) return; nColumn = sqlite3_column_count(pStmt); + if( nColumn==0 ) goto columnar_end; nAlloc = nColumn*4; if( nAlloc<=0 ) nAlloc = 1; azData = sqlite3_malloc64( nAlloc*sizeof(char*) ); @@ -19767,7 +21970,6 @@ static void exec_prepared_stmt_columnar( if( n>p->actualWidth[j] ) p->actualWidth[j] = n; } if( seenInterrupt ) goto columnar_end; - if( nColumn==0 ) goto columnar_end; switch( p->cMode ){ case MODE_Column: { colSep = " "; @@ -19776,11 +21978,11 @@ static void exec_prepared_stmt_columnar( for(i=0; iactualWidth[i]; if( p->colWidth[i]<0 ) w = -w; - utf8_width_print(p->out, w, azData[i]); + utf8_width_print(w, azData[i]); fputs(i==nColumn-1?"\n":" ", p->out); } for(i=0; iout, p->actualWidth[i]); + print_dashes(p->actualWidth[i]); fputs(i==nColumn-1?"\n":" ", p->out); } } @@ -19794,8 +21996,8 @@ static void exec_prepared_stmt_columnar( for(i=0; iactualWidth[i]; n = strlenChar(azData[i]); - utf8_printf(p->out, "%*s%s%*s", (w-n)/2, "", azData[i], (w-n+1)/2, ""); - fputs(i==nColumn-1?" |\n":" | ", p->out); + oputf("%*s%s%*s", (w-n)/2, "", azData[i], (w-n+1)/2, ""); + oputz(i==nColumn-1?" |\n":" | "); } print_row_separator(p, nColumn, "+"); break; @@ -19807,8 +22009,8 @@ static void exec_prepared_stmt_columnar( for(i=0; iactualWidth[i]; n = strlenChar(azData[i]); - utf8_printf(p->out, "%*s%s%*s", (w-n)/2, "", azData[i], (w-n+1)/2, ""); - fputs(i==nColumn-1?" |\n":" | ", p->out); + oputf("%*s%s%*s", (w-n)/2, "", azData[i], (w-n+1)/2, ""); + oputz(i==nColumn-1?" |\n":" | "); } print_row_separator(p, nColumn, "|"); break; @@ -19817,13 +22019,13 @@ static void exec_prepared_stmt_columnar( colSep = " " BOX_13 " "; rowSep = " " BOX_13 "\n"; print_box_row_separator(p, nColumn, BOX_23, BOX_234, BOX_34); - utf8_printf(p->out, BOX_13 " "); + oputz(BOX_13 " "); for(i=0; iactualWidth[i]; n = strlenChar(azData[i]); - utf8_printf(p->out, "%*s%s%*s%s", - (w-n)/2, "", azData[i], (w-n+1)/2, "", - i==nColumn-1?" "BOX_13"\n":" "BOX_13" "); + oputf("%*s%s%*s%s", + (w-n)/2, "", azData[i], (w-n+1)/2, "", + i==nColumn-1?" "BOX_13"\n":" "BOX_13" "); } print_box_row_separator(p, nColumn, BOX_123, BOX_1234, BOX_134); break; @@ -19831,28 +22033,28 @@ static void exec_prepared_stmt_columnar( } for(i=nColumn, j=0; icMode!=MODE_Column ){ - utf8_printf(p->out, "%s", p->cMode==MODE_Box?BOX_13" ":"| "); + oputz(p->cMode==MODE_Box?BOX_13" ":"| "); } z = azData[i]; if( z==0 ) z = p->nullValue; w = p->actualWidth[j]; if( p->colWidth[j]<0 ) w = -w; - utf8_width_print(p->out, w, z); + utf8_width_print(w, z); if( j==nColumn-1 ){ - utf8_printf(p->out, "%s", rowSep); + oputz(rowSep); if( bMultiLineRowExists && abRowDiv[i/nColumn-1] && i+1cMode==MODE_Table ){ print_row_separator(p, nColumn, "+"); }else if( p->cMode==MODE_Box ){ print_box_row_separator(p, nColumn, BOX_123, BOX_1234, BOX_134); }else if( p->cMode==MODE_Column ){ - raw_printf(p->out, "\n"); + oputz("\n"); } } j = -1; if( seenInterrupt ) goto columnar_end; }else{ - utf8_printf(p->out, "%s", colSep); + oputz(colSep); } } if( p->cMode==MODE_Table ){ @@ -19862,7 +22064,7 @@ static void exec_prepared_stmt_columnar( } columnar_end: if( seenInterrupt ){ - utf8_printf(p->out, "Interrupt\n"); + oputz("Interrupt\n"); } nData = (nRow+1)*nColumn; for(i=0; iout; int bVerbose = pState->expert.bVerbose; rc = sqlite3_expert_analyze(p, pzErr); @@ -20011,8 +22212,8 @@ static int expertFinish( if( bVerbose ){ const char *zCand = sqlite3_expert_report(p,0,EXPERT_REPORT_CANDIDATES); - raw_printf(out, "-- Candidates -----------------------------\n"); - raw_printf(out, "%s\n", zCand); + oputz("-- Candidates -----------------------------\n"); + oputf("%s\n", zCand); } for(i=0; i=2 && 0==cli_strncmp(z, "-sample", n) ){ if( i==(nArg-1) ){ - raw_printf(stderr, "option requires an argument: %s\n", z); + eputf("option requires an argument: %s\n", z); rc = SQLITE_ERROR; }else{ iSample = (int)integerValue(azArg[++i]); if( iSample<0 || iSample>100 ){ - raw_printf(stderr, "value out of range: %s\n", azArg[i]); + eputf("value out of range: %s\n", azArg[i]); rc = SQLITE_ERROR; } } } else{ - raw_printf(stderr, "unknown option: %s\n", z); + eputf("unknown option: %s\n", z); rc = SQLITE_ERROR; } } @@ -20078,8 +22279,7 @@ static int expertDotCommand( if( rc==SQLITE_OK ){ pState->expert.pExpert = sqlite3_expert_new(pState->db, &zErr); if( pState->expert.pExpert==0 ){ - raw_printf(stderr, "sqlite3_expert_new: %s\n", - zErr ? zErr : "out of memory"); + eputf("sqlite3_expert_new: %s\n", zErr ? zErr : "out of memory"); rc = SQLITE_ERROR; }else{ sqlite3_expert_config( @@ -20406,9 +22606,9 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azNotUsed){ noSys = (p->shellFlgs & SHFLG_DumpNoSys)!=0; if( cli_strcmp(zTable, "sqlite_sequence")==0 && !noSys ){ - if( !dataOnly ) raw_printf(p->out, "DELETE FROM sqlite_sequence;\n"); + if( !dataOnly ) oputz("DELETE FROM sqlite_sequence;\n"); }else if( sqlite3_strglob("sqlite_stat?", zTable)==0 && !noSys ){ - if( !dataOnly ) raw_printf(p->out, "ANALYZE sqlite_schema;\n"); + if( !dataOnly ) oputz("ANALYZE sqlite_schema;\n"); }else if( cli_strncmp(zTable, "sqlite_", 7)==0 ){ return 0; }else if( dataOnly ){ @@ -20416,7 +22616,7 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azNotUsed){ }else if( cli_strncmp(zSql, "CREATE VIRTUAL TABLE", 20)==0 ){ char *zIns; if( !p->writableSchema ){ - raw_printf(p->out, "PRAGMA writable_schema=ON;\n"); + oputz("PRAGMA writable_schema=ON;\n"); p->writableSchema = 1; } zIns = sqlite3_mprintf( @@ -20424,11 +22624,11 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azNotUsed){ "VALUES('table','%q','%q',0,'%q');", zTable, zTable, zSql); shell_check_oom(zIns); - utf8_printf(p->out, "%s\n", zIns); + oputf("%s\n", zIns); sqlite3_free(zIns); return 0; }else{ - printSchemaLine(p->out, zSql, ";\n"); + printSchemaLine(zSql, ";\n"); } if( cli_strcmp(zType, "table")==0 ){ @@ -20486,7 +22686,7 @@ static int dump_callback(void *pArg, int nArg, char **azArg, char **azNotUsed){ p->mode = p->cMode = MODE_Insert; rc = shell_exec(p, sSelect.z, 0); if( (rc&0xff)==SQLITE_CORRUPT ){ - raw_printf(p->out, "/****** CORRUPTION ERROR *******/\n"); + oputz("/****** CORRUPTION ERROR *******/\n"); toggleSelectOrder(p->db); shell_exec(p, sSelect.z, 0); toggleSelectOrder(p->db); @@ -20517,9 +22717,9 @@ static int run_schema_dump_query( if( rc==SQLITE_CORRUPT ){ char *zQ2; int len = strlen30(zQuery); - raw_printf(p->out, "/****** CORRUPTION ERROR *******/\n"); + oputz("/****** CORRUPTION ERROR *******/\n"); if( zErr ){ - utf8_printf(p->out, "/****** %s ******/\n", zErr); + oputf("/****** %s ******/\n", zErr); sqlite3_free(zErr); zErr = 0; } @@ -20528,7 +22728,7 @@ static int run_schema_dump_query( sqlite3_snprintf(len+100, zQ2, "%s ORDER BY rowid DESC", zQuery); rc = sqlite3_exec(p->db, zQ2, dump_callback, p, &zErr); if( rc ){ - utf8_printf(p->out, "/****** ERROR: %s ******/\n", zErr); + oputf("/****** ERROR: %s ******/\n", zErr); }else{ rc = SQLITE_CORRUPT; } @@ -20652,6 +22852,7 @@ static const char *(azHelp[]) = { ".indexes ?TABLE? Show names of indexes", " If TABLE is specified, only show indexes for", " tables matching TABLE using the LIKE operator.", + ".intck ?STEPS_PER_UNLOCK? Run an incremental integrity check on the db", #ifdef SQLITE_ENABLE_IOTRACE ",iotrace FILE Enable I/O diagnostic logging to FILE", #endif @@ -20884,10 +23085,10 @@ static int showHelp(FILE *out, const char *zPattern){ } if( ((hw^hh)&HH_Undoc)==0 ){ if( (hh&HH_Summary)!=0 ){ - utf8_printf(out, ".%s\n", azHelp[i]+1); + sputf(out, ".%s\n", azHelp[i]+1); ++n; }else if( (hw&HW_SummaryOnly)==0 ){ - utf8_printf(out, "%s\n", azHelp[i]); + sputf(out, "%s\n", azHelp[i]); } } } @@ -20897,7 +23098,7 @@ static int showHelp(FILE *out, const char *zPattern){ shell_check_oom(zPat); for(i=0; i65536 || (pgsz & (pgsz-1))!=0 ){ - utf8_printf(stderr, "invalid pagesize\n"); + eputz("invalid pagesize\n"); goto readHexDb_error; } for(nLine++; fgets(zLine, sizeof(zLine), in)!=0; nLine++){ @@ -21166,7 +23367,7 @@ static unsigned char *readHexDb(ShellState *p, int *pnData){ p->lineno = nLine; } sqlite3_free(a); - utf8_printf(stderr,"Error on line %d of --hexdb input\n", nLine); + eputf("Error on line %d of --hexdb input\n", nLine); return 0; } #endif /* SQLITE_OMIT_DESERIALIZE */ @@ -21240,26 +23441,23 @@ static void open_db(ShellState *p, int openFlags){ break; } } - globalDb = p->db; if( p->db==0 || SQLITE_OK!=sqlite3_errcode(p->db) ){ - utf8_printf(stderr,"Error: unable to open database \"%s\": %s\n", - zDbFilename, sqlite3_errmsg(p->db)); + eputf("Error: unable to open database \"%s\": %s\n", + zDbFilename, sqlite3_errmsg(p->db)); if( (openFlags & OPEN_DB_KEEPALIVE)==0 ){ exit(1); } sqlite3_close(p->db); sqlite3_open(":memory:", &p->db); if( p->db==0 || SQLITE_OK!=sqlite3_errcode(p->db) ){ - utf8_printf(stderr, - "Also: unable to open substitute in-memory database.\n" - ); + eputz("Also: unable to open substitute in-memory database.\n"); exit(1); }else{ - utf8_printf(stderr, - "Notice: using substitute in-memory database instead of \"%s\"\n", - zDbFilename); + eputf("Notice: using substitute in-memory database instead of \"%s\"\n", + zDbFilename); } } + globalDb = p->db; sqlite3_db_config(p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, (int)0, (int*)0); /* Reflect the use or absence of --unsafe-testing invocation. */ @@ -21364,7 +23562,7 @@ static void open_db(ShellState *p, int openFlags){ SQLITE_DESERIALIZE_RESIZEABLE | SQLITE_DESERIALIZE_FREEONCLOSE); if( rc ){ - utf8_printf(stderr, "Error: sqlite3_deserialize() returns %d\n", rc); + eputf("Error: sqlite3_deserialize() returns %d\n", rc); } if( p->szMax>0 ){ sqlite3_file_control(p->db, "main", SQLITE_FCNTL_SIZE_LIMIT, &p->szMax); @@ -21388,8 +23586,7 @@ static void open_db(ShellState *p, int openFlags){ void close_db(sqlite3 *db){ int rc = sqlite3_close(db); if( rc ){ - utf8_printf(stderr, "Error: sqlite3_close() returns %d: %s\n", - rc, sqlite3_errmsg(db)); + eputf("Error: sqlite3_close() returns %d: %s\n", rc, sqlite3_errmsg(db)); } } @@ -21550,8 +23747,7 @@ static int booleanValue(const char *zArg){ if( sqlite3_stricmp(zArg, "off")==0 || sqlite3_stricmp(zArg,"no")==0 ){ return 0; } - utf8_printf(stderr, "ERROR: Not a boolean value: \"%s\". Assuming \"no\".\n", - zArg); + eputf("ERROR: Not a boolean value: \"%s\". Assuming \"no\".\n", zArg); return 0; } @@ -21589,7 +23785,7 @@ static FILE *output_file_open(const char *zFile, int bTextMode){ }else{ f = fopen(zFile, bTextMode ? "w" : "wb"); if( f==0 ){ - utf8_printf(stderr, "Error: cannot open \"%s\"\n", zFile); + eputf("Error: cannot open \"%s\"\n", zFile); } } return f; @@ -21611,7 +23807,7 @@ static int sql_trace_callback( i64 nSql; if( p->traceOut==0 ) return 0; if( mType==SQLITE_TRACE_CLOSE ){ - utf8_printf(p->traceOut, "-- closing database connection\n"); + sputz(p->traceOut, "-- closing database connection\n"); return 0; } if( mType!=SQLITE_TRACE_ROW && pX!=0 && ((const char*)pX)[0]=='-' ){ @@ -21642,12 +23838,12 @@ static int sql_trace_callback( switch( mType ){ case SQLITE_TRACE_ROW: case SQLITE_TRACE_STMT: { - utf8_printf(p->traceOut, "%.*s;\n", (int)nSql, zSql); + sputf(p->traceOut, "%.*s;\n", (int)nSql, zSql); break; } case SQLITE_TRACE_PROFILE: { sqlite3_int64 nNanosec = pX ? *(sqlite3_int64*)pX : 0; - utf8_printf(p->traceOut, "%.*s; -- %lld ns\n", (int)nSql, zSql, nNanosec); + sputf(p->traceOut, "%.*s; -- %lld ns\n", (int)nSql, zSql, nNanosec); break; } } @@ -21754,12 +23950,11 @@ static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){ break; } if( pc==cQuote && c!='\r' ){ - utf8_printf(stderr, "%s:%d: unescaped %c character\n", - p->zFile, p->nLine, cQuote); + eputf("%s:%d: unescaped %c character\n", p->zFile, p->nLine, cQuote); } if( c==EOF ){ - utf8_printf(stderr, "%s:%d: unterminated %c-quoted field\n", - p->zFile, startLine, cQuote); + eputf("%s:%d: unterminated %c-quoted field\n", + p->zFile, startLine, cQuote); p->cTerm = c; break; } @@ -21857,9 +24052,8 @@ static void tryToCloneData( shell_check_oom(zQuery); rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0); if( rc ){ - utf8_printf(stderr, "Error %d: %s on [%s]\n", - sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db), - zQuery); + eputf("Error %d: %s on [%s]\n", + sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db), zQuery); goto end_data_xfer; } n = sqlite3_column_count(pQuery); @@ -21875,9 +24069,8 @@ static void tryToCloneData( memcpy(zInsert+i, ");", 3); rc = sqlite3_prepare_v2(newDb, zInsert, -1, &pInsert, 0); if( rc ){ - utf8_printf(stderr, "Error %d: %s on [%s]\n", - sqlite3_extended_errcode(newDb), sqlite3_errmsg(newDb), - zInsert); + eputf("Error %d: %s on [%s]\n", + sqlite3_extended_errcode(newDb), sqlite3_errmsg(newDb), zInsert); goto end_data_xfer; } for(k=0; k<2; k++){ @@ -21912,8 +24105,8 @@ static void tryToCloneData( } /* End for */ rc = sqlite3_step(pInsert); if( rc!=SQLITE_OK && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){ - utf8_printf(stderr, "Error %d: %s\n", sqlite3_extended_errcode(newDb), - sqlite3_errmsg(newDb)); + eputf("Error %d: %s\n", + sqlite3_extended_errcode(newDb), sqlite3_errmsg(newDb)); } sqlite3_reset(pInsert); cnt++; @@ -21930,7 +24123,7 @@ static void tryToCloneData( shell_check_oom(zQuery); rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0); if( rc ){ - utf8_printf(stderr, "Warning: cannot step \"%s\" backwards", zTable); + eputf("Warning: cannot step \"%s\" backwards", zTable); break; } } /* End for(k=0...) */ @@ -21967,9 +24160,8 @@ static void tryToCloneSchema( shell_check_oom(zQuery); rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0); if( rc ){ - utf8_printf(stderr, "Error: (%d) %s on [%s]\n", - sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db), - zQuery); + eputf("Error: (%d) %s on [%s]\n", sqlite3_extended_errcode(p->db), + sqlite3_errmsg(p->db), zQuery); goto end_schema_xfer; } while( (rc = sqlite3_step(pQuery))==SQLITE_ROW ){ @@ -21977,10 +24169,10 @@ static void tryToCloneSchema( zSql = sqlite3_column_text(pQuery, 1); if( zName==0 || zSql==0 ) continue; if( sqlite3_stricmp((char*)zName, "sqlite_sequence")!=0 ){ - printf("%s... ", zName); fflush(stdout); + sputf(stdout, "%s... ", zName); fflush(stdout); sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg); if( zErrMsg ){ - utf8_printf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql); + eputf("Error: %s\nSQL: [%s]\n", zErrMsg, zSql); sqlite3_free(zErrMsg); zErrMsg = 0; } @@ -21988,7 +24180,7 @@ static void tryToCloneSchema( if( xForEach ){ xForEach(p, newDb, (const char*)zName); } - printf("done\n"); + sputz(stdout, "done\n"); } if( rc!=SQLITE_DONE ){ sqlite3_finalize(pQuery); @@ -21998,9 +24190,8 @@ static void tryToCloneSchema( shell_check_oom(zQuery); rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0); if( rc ){ - utf8_printf(stderr, "Error: (%d) %s on [%s]\n", - sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db), - zQuery); + eputf("Error: (%d) %s on [%s]\n", + sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db), zQuery); goto end_schema_xfer; } while( sqlite3_step(pQuery)==SQLITE_ROW ){ @@ -22008,17 +24199,17 @@ static void tryToCloneSchema( zSql = sqlite3_column_text(pQuery, 1); if( zName==0 || zSql==0 ) continue; if( sqlite3_stricmp((char*)zName, "sqlite_sequence")==0 ) continue; - printf("%s... ", zName); fflush(stdout); + sputf(stdout, "%s... ", zName); fflush(stdout); sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg); if( zErrMsg ){ - utf8_printf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql); + eputf("Error: %s\nSQL: [%s]\n", zErrMsg, zSql); sqlite3_free(zErrMsg); zErrMsg = 0; } if( xForEach ){ xForEach(p, newDb, (const char*)zName); } - printf("done\n"); + sputz(stdout, "done\n"); } } end_schema_xfer: @@ -22035,13 +24226,12 @@ static void tryToClone(ShellState *p, const char *zNewDb){ int rc; sqlite3 *newDb = 0; if( access(zNewDb,0)==0 ){ - utf8_printf(stderr, "File \"%s\" already exists.\n", zNewDb); + eputf("File \"%s\" already exists.\n", zNewDb); return; } rc = sqlite3_open(zNewDb, &newDb); if( rc ){ - utf8_printf(stderr, "Cannot create output database: %s\n", - sqlite3_errmsg(newDb)); + eputf("Cannot create output database: %s\n", sqlite3_errmsg(newDb)); }else{ sqlite3_exec(p->db, "PRAGMA writable_schema=ON;", 0, 0, 0); sqlite3_exec(newDb, "BEGIN EXCLUSIVE;", 0, 0, 0); @@ -22053,6 +24243,18 @@ static void tryToClone(ShellState *p, const char *zNewDb){ close_db(newDb); } +#ifndef SQLITE_SHELL_FIDDLE +/* +** Change the output stream (file or pipe or console) to something else. +*/ +static void output_redir(ShellState *p, FILE *pfNew){ + if( p->out != stdout ) eputz("Output already redirected.\n"); + else{ + p->out = pfNew; + setOutputStream(pfNew); + } +} + /* ** Change the output file back to stdout. ** @@ -22080,7 +24282,7 @@ static void output_reset(ShellState *p){ char *zCmd; zCmd = sqlite3_mprintf("%s %s", zXdgOpenCmd, p->zTempFile); if( system(zCmd) ){ - utf8_printf(stderr, "Failed: [%s]\n", zCmd); + eputf("Failed: [%s]\n", zCmd); }else{ /* Give the start/open/xdg-open command some time to get ** going before we continue, and potential delete the @@ -22095,7 +24297,12 @@ static void output_reset(ShellState *p){ } p->outfile[0] = 0; p->out = stdout; + setOutputStream(stdout); } +#else +# define output_redir(SS,pfO) +# define output_reset(SS) +#endif /* ** Run an SQL command and return the single integer result. @@ -22166,7 +24373,7 @@ static int shell_dbinfo_command(ShellState *p, int nArg, char **azArg){ "SELECT data FROM sqlite_dbpage(?1) WHERE pgno=1", -1, &pStmt, 0); if( rc ){ - utf8_printf(stderr, "error: %s\n", sqlite3_errmsg(p->db)); + eputf("error: %s\n", sqlite3_errmsg(p->db)); sqlite3_finalize(pStmt); return 1; } @@ -22179,28 +24386,28 @@ static int shell_dbinfo_command(ShellState *p, int nArg, char **azArg){ memcpy(aHdr, pb, 100); sqlite3_finalize(pStmt); }else{ - raw_printf(stderr, "unable to read database header\n"); + eputz("unable to read database header\n"); sqlite3_finalize(pStmt); return 1; } i = get2byteInt(aHdr+16); if( i==1 ) i = 65536; - utf8_printf(p->out, "%-20s %d\n", "database page size:", i); - utf8_printf(p->out, "%-20s %d\n", "write format:", aHdr[18]); - utf8_printf(p->out, "%-20s %d\n", "read format:", aHdr[19]); - utf8_printf(p->out, "%-20s %d\n", "reserved bytes:", aHdr[20]); + oputf("%-20s %d\n", "database page size:", i); + oputf("%-20s %d\n", "write format:", aHdr[18]); + oputf("%-20s %d\n", "read format:", aHdr[19]); + oputf("%-20s %d\n", "reserved bytes:", aHdr[20]); for(i=0; iout, "%-20s %u", aField[i].zName, val); + oputf("%-20s %u", aField[i].zName, val); switch( ofst ){ case 56: { - if( val==1 ) raw_printf(p->out, " (utf8)"); - if( val==2 ) raw_printf(p->out, " (utf16le)"); - if( val==3 ) raw_printf(p->out, " (utf16be)"); + if( val==1 ) oputz(" (utf8)"); + if( val==2 ) oputz(" (utf16le)"); + if( val==3 ) oputz(" (utf16be)"); } } - raw_printf(p->out, "\n"); + oputz("\n"); } if( zDb==0 ){ zSchemaTab = sqlite3_mprintf("main.sqlite_schema"); @@ -22213,11 +24420,11 @@ static int shell_dbinfo_command(ShellState *p, int nArg, char **azArg){ char *zSql = sqlite3_mprintf(aQuery[i].zSql, zSchemaTab); int val = db_int(p->db, zSql); sqlite3_free(zSql); - utf8_printf(p->out, "%-20s %d\n", aQuery[i].zName, val); + oputf("%-20s %d\n", aQuery[i].zName, val); } sqlite3_free(zSchemaTab); sqlite3_file_control(p->db, zDb, SQLITE_FCNTL_DATA_VERSION, &iDataVersion); - utf8_printf(p->out, "%-20s %u\n", "data version", iDataVersion); + oputf("%-20s %u\n", "data version", iDataVersion); return 0; } #endif /* SQLITE_SHELL_HAVE_RECOVER */ @@ -22227,7 +24434,7 @@ static int shell_dbinfo_command(ShellState *p, int nArg, char **azArg){ */ static int shellDatabaseError(sqlite3 *db){ const char *zErr = sqlite3_errmsg(db); - utf8_printf(stderr, "Error: %s\n", zErr); + eputf("Error: %s\n", zErr); return 1; } @@ -22462,7 +24669,6 @@ static int lintFkeyIndexes( int nArg /* Number of entries in azArg[] */ ){ sqlite3 *db = pState->db; /* Database handle to query "main" db of */ - FILE *out = pState->out; /* Stream to write non-error output to */ int bVerbose = 0; /* If -verbose is present */ int bGroupByParent = 0; /* If -groupbyparent is present */ int i; /* To iterate through azArg[] */ @@ -22544,9 +24750,7 @@ static int lintFkeyIndexes( zIndent = " "; } else{ - raw_printf(stderr, "Usage: %s %s ?-verbose? ?-groupbyparent?\n", - azArg[0], azArg[1] - ); + eputf("Usage: %s %s ?-verbose? ?-groupbyparent?\n", azArg[0], azArg[1]); return SQLITE_ERROR; } } @@ -22590,23 +24794,23 @@ static int lintFkeyIndexes( if( rc!=SQLITE_OK ) break; if( res<0 ){ - raw_printf(stderr, "Error: internal error"); + eputz("Error: internal error"); break; }else{ if( bGroupByParent && (bVerbose || res==0) && (zPrev==0 || sqlite3_stricmp(zParent, zPrev)) ){ - raw_printf(out, "-- Parent table %s\n", zParent); + oputf("-- Parent table %s\n", zParent); sqlite3_free(zPrev); zPrev = sqlite3_mprintf("%s", zParent); } if( res==0 ){ - raw_printf(out, "%s%s --> %s\n", zIndent, zCI, zTarget); + oputf("%s%s --> %s\n", zIndent, zCI, zTarget); }else if( bVerbose ){ - raw_printf(out, "%s/* no extra indexes required for %s -> %s */\n", - zIndent, zFrom, zTarget + oputf("%s/* no extra indexes required for %s -> %s */\n", + zIndent, zFrom, zTarget ); } } @@ -22614,16 +24818,16 @@ static int lintFkeyIndexes( sqlite3_free(zPrev); if( rc!=SQLITE_OK ){ - raw_printf(stderr, "%s\n", sqlite3_errmsg(db)); + eputf("%s\n", sqlite3_errmsg(db)); } rc2 = sqlite3_finalize(pSql); if( rc==SQLITE_OK && rc2!=SQLITE_OK ){ rc = rc2; - raw_printf(stderr, "%s\n", sqlite3_errmsg(db)); + eputf("%s\n", sqlite3_errmsg(db)); } }else{ - raw_printf(stderr, "%s\n", sqlite3_errmsg(db)); + eputf("%s\n", sqlite3_errmsg(db)); } return rc; @@ -22643,13 +24847,12 @@ static int lintDotCommand( return lintFkeyIndexes(pState, azArg, nArg); usage: - raw_printf(stderr, "Usage %s sub-command ?switches...?\n", azArg[0]); - raw_printf(stderr, "Where sub-commands are:\n"); - raw_printf(stderr, " fkey-indexes\n"); + eputf("Usage %s sub-command ?switches...?\n", azArg[0]); + eputz("Where sub-commands are:\n"); + eputz(" fkey-indexes\n"); return SQLITE_ERROR; } -#if !defined SQLITE_OMIT_VIRTUALTABLE static void shellPrepare( sqlite3 *db, int *pRc, @@ -22660,9 +24863,7 @@ static void shellPrepare( if( *pRc==SQLITE_OK ){ int rc = sqlite3_prepare_v2(db, zSql, -1, ppStmt, 0); if( rc!=SQLITE_OK ){ - raw_printf(stderr, "sql error: %s (%d)\n", - sqlite3_errmsg(db), sqlite3_errcode(db) - ); + eputf("sql error: %s (%d)\n", sqlite3_errmsg(db), sqlite3_errcode(db)); *pRc = rc; } } @@ -22670,12 +24871,8 @@ static void shellPrepare( /* ** Create a prepared statement using printf-style arguments for the SQL. -** -** This routine is could be marked "static". But it is not always used, -** depending on compile-time options. By omitting the "static", we avoid -** nuisance compiler warnings about "defined but not used". */ -void shellPreparePrintf( +static void shellPreparePrintf( sqlite3 *db, int *pRc, sqlite3_stmt **ppStmt, @@ -22698,13 +24895,10 @@ void shellPreparePrintf( } } -/* Finalize the prepared statement created using shellPreparePrintf(). -** -** This routine is could be marked "static". But it is not always used, -** depending on compile-time options. By omitting the "static", we avoid -** nuisance compiler warnings about "defined but not used". +/* +** Finalize the prepared statement created using shellPreparePrintf(). */ -void shellFinalize( +static void shellFinalize( int *pRc, sqlite3_stmt *pStmt ){ @@ -22713,13 +24907,14 @@ void shellFinalize( int rc = sqlite3_finalize(pStmt); if( *pRc==SQLITE_OK ){ if( rc!=SQLITE_OK ){ - raw_printf(stderr, "SQL error: %s\n", sqlite3_errmsg(db)); + eputf("SQL error: %s\n", sqlite3_errmsg(db)); } *pRc = rc; } } } +#if !defined SQLITE_OMIT_VIRTUALTABLE /* Reset the prepared statement created using shellPreparePrintf(). ** ** This routine is could be marked "static". But it is not always used, @@ -22734,7 +24929,7 @@ void shellReset( if( *pRc==SQLITE_OK ){ if( rc!=SQLITE_OK ){ sqlite3 *db = sqlite3_db_handle(pStmt); - raw_printf(stderr, "SQL error: %s\n", sqlite3_errmsg(db)); + eputf("SQL error: %s\n", sqlite3_errmsg(db)); } *pRc = rc; } @@ -22784,11 +24979,11 @@ static int arErrorMsg(ArCommand *pAr, const char *zFmt, ...){ va_start(ap, zFmt); z = sqlite3_vmprintf(zFmt, ap); va_end(ap); - utf8_printf(stderr, "Error: %s\n", z); + eputf("Error: %s\n", z); if( pAr->fromCmdLine ){ - utf8_printf(stderr, "Use \"-A\" for more help\n"); + eputz("Use \"-A\" for more help\n"); }else{ - utf8_printf(stderr, "Use \".archive --help\" for more help\n"); + eputz("Use \".archive --help\" for more help\n"); } sqlite3_free(z); return SQLITE_ERROR; @@ -22888,7 +25083,7 @@ static int arParseCommand( struct ArSwitch *pEnd = &aSwitch[nSwitch]; if( nArg<=1 ){ - utf8_printf(stderr, "Wrong number of arguments. Usage:\n"); + eputz("Wrong number of arguments. Usage:\n"); return arUsage(stderr); }else{ char *z = azArg[1]; @@ -22994,7 +25189,7 @@ static int arParseCommand( } } if( pAr->eCmd==0 ){ - utf8_printf(stderr, "Required argument missing. Usage:\n"); + eputz("Required argument missing. Usage:\n"); return arUsage(stderr); } return SQLITE_OK; @@ -23037,7 +25232,7 @@ static int arCheckEntries(ArCommand *pAr){ } shellReset(&rc, pTest); if( rc==SQLITE_OK && bOk==0 ){ - utf8_printf(stderr, "not found in archive: %s\n", z); + eputf("not found in archive: %s\n", z); rc = SQLITE_ERROR; } } @@ -23104,18 +25299,15 @@ static int arListCommand(ArCommand *pAr){ shellPreparePrintf(pAr->db, &rc, &pSql, zSql, azCols[pAr->bVerbose], pAr->zSrcTable, zWhere); if( pAr->bDryRun ){ - utf8_printf(pAr->p->out, "%s\n", sqlite3_sql(pSql)); + oputf("%s\n", sqlite3_sql(pSql)); }else{ while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSql) ){ if( pAr->bVerbose ){ - utf8_printf(pAr->p->out, "%s % 10d %s %s\n", - sqlite3_column_text(pSql, 0), - sqlite3_column_int(pSql, 1), - sqlite3_column_text(pSql, 2), - sqlite3_column_text(pSql, 3) - ); + oputf("%s % 10d %s %s\n", + sqlite3_column_text(pSql, 0), sqlite3_column_int(pSql, 1), + sqlite3_column_text(pSql, 2),sqlite3_column_text(pSql, 3)); }else{ - utf8_printf(pAr->p->out, "%s\n", sqlite3_column_text(pSql, 0)); + oputf("%s\n", sqlite3_column_text(pSql, 0)); } } } @@ -23124,7 +25316,6 @@ static int arListCommand(ArCommand *pAr){ return rc; } - /* ** Implementation of .ar "Remove" command. */ @@ -23143,7 +25334,7 @@ static int arRemoveCommand(ArCommand *pAr){ zSql = sqlite3_mprintf("DELETE FROM %s WHERE %s;", pAr->zSrcTable, zWhere); if( pAr->bDryRun ){ - utf8_printf(pAr->p->out, "%s\n", zSql); + oputf("%s\n", zSql); }else{ char *zErr = 0; rc = sqlite3_exec(pAr->db, "SAVEPOINT ar;", 0, 0, 0); @@ -23156,7 +25347,7 @@ static int arRemoveCommand(ArCommand *pAr){ } } if( zErr ){ - utf8_printf(stdout, "ERROR: %s\n", zErr); + sputf(stdout, "ERROR: %s\n", zErr); /* stdout? */ sqlite3_free(zErr); } } @@ -23220,11 +25411,11 @@ static int arExtractCommand(ArCommand *pAr){ j = sqlite3_bind_parameter_index(pSql, "$dirOnly"); sqlite3_bind_int(pSql, j, i); if( pAr->bDryRun ){ - utf8_printf(pAr->p->out, "%s\n", sqlite3_sql(pSql)); + oputf("%s\n", sqlite3_sql(pSql)); }else{ while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSql) ){ if( i==0 && pAr->bVerbose ){ - utf8_printf(pAr->p->out, "%s\n", sqlite3_column_text(pSql, 0)); + oputf("%s\n", sqlite3_column_text(pSql, 0)); } } } @@ -23244,13 +25435,13 @@ static int arExtractCommand(ArCommand *pAr){ static int arExecSql(ArCommand *pAr, const char *zSql){ int rc; if( pAr->bDryRun ){ - utf8_printf(pAr->p->out, "%s\n", zSql); + oputf("%s\n", zSql); rc = SQLITE_OK; }else{ char *zErr = 0; rc = sqlite3_exec(pAr->db, zSql, 0, 0, &zErr); if( zErr ){ - utf8_printf(stdout, "ERROR: %s\n", zErr); + sputf(stdout, "ERROR: %s\n", zErr); sqlite3_free(zErr); } } @@ -23425,15 +25616,13 @@ static int arDotCommand( } cmd.db = 0; if( cmd.bDryRun ){ - utf8_printf(pState->out, "-- open database '%s'%s\n", cmd.zFile, - eDbType==SHELL_OPEN_APPENDVFS ? " using 'apndvfs'" : ""); + oputf("-- open database '%s'%s\n", cmd.zFile, + eDbType==SHELL_OPEN_APPENDVFS ? " using 'apndvfs'" : ""); } rc = sqlite3_open_v2(cmd.zFile, &cmd.db, flags, eDbType==SHELL_OPEN_APPENDVFS ? "apndvfs" : 0); if( rc!=SQLITE_OK ){ - utf8_printf(stderr, "cannot open file: %s (%s)\n", - cmd.zFile, sqlite3_errmsg(cmd.db) - ); + eputf("cannot open file: %s (%s)\n", cmd.zFile, sqlite3_errmsg(cmd.db)); goto end_ar_command; } sqlite3_fileio_init(cmd.db, 0, 0); @@ -23446,7 +25635,7 @@ static int arDotCommand( if( cmd.eCmd!=AR_CMD_CREATE && sqlite3_table_column_metadata(cmd.db,0,"sqlar","name",0,0,0,0,0) ){ - utf8_printf(stderr, "database does not contain an 'sqlar' table\n"); + eputz("database does not contain an 'sqlar' table\n"); rc = SQLITE_ERROR; goto end_ar_command; } @@ -23504,7 +25693,7 @@ static int arDotCommand( */ static int recoverSqlCb(void *pCtx, const char *zSql){ ShellState *pState = (ShellState*)pCtx; - utf8_printf(pState->out, "%s;\n", zSql); + sputf(pState->out, "%s;\n", zSql); return SQLITE_OK; } @@ -23547,7 +25736,7 @@ static int recoverDatabaseCmd(ShellState *pState, int nArg, char **azArg){ bRowids = 0; } else{ - utf8_printf(stderr, "unexpected option: %s\n", azArg[i]); + eputf("unexpected option: %s\n", azArg[i]); showHelp(pState->out, azArg[0]); return 1; } @@ -23566,13 +25755,47 @@ static int recoverDatabaseCmd(ShellState *pState, int nArg, char **azArg){ if( sqlite3_recover_errcode(p)!=SQLITE_OK ){ const char *zErr = sqlite3_recover_errmsg(p); int errCode = sqlite3_recover_errcode(p); - raw_printf(stderr, "sql error: %s (%d)\n", zErr, errCode); + eputf("sql error: %s (%d)\n", zErr, errCode); } rc = sqlite3_recover_finish(p); return rc; } #endif /* SQLITE_SHELL_HAVE_RECOVER */ +/* +** Implementation of ".intck STEPS_PER_UNLOCK" command. +*/ +static int intckDatabaseCmd(ShellState *pState, i64 nStepPerUnlock){ + sqlite3_intck *p = 0; + int rc = SQLITE_OK; + + rc = sqlite3_intck_open(pState->db, "main", &p); + if( rc==SQLITE_OK ){ + i64 nStep = 0; + i64 nError = 0; + const char *zErr = 0; + while( SQLITE_OK==sqlite3_intck_step(p) ){ + const char *zMsg = sqlite3_intck_message(p); + if( zMsg ){ + oputf("%s\n", zMsg); + nError++; + } + nStep++; + if( nStepPerUnlock && (nStep % nStepPerUnlock)==0 ){ + sqlite3_intck_unlock(p); + } + } + rc = sqlite3_intck_error(p, &zErr); + if( zErr ){ + eputf("%s\n", zErr); + } + sqlite3_intck_close(p); + + oputf("%lld steps, %lld errors\n", nStep, nError); + } + + return rc; +} /* * zAutoColumn(zCol, &db, ?) => Maybe init db, add column zCol to it. @@ -23591,7 +25814,7 @@ static int recoverDatabaseCmd(ShellState *pState, int nArg, char **azArg){ #define rc_err_oom_die(rc) \ if( rc==SQLITE_NOMEM ) shell_check_oom(0); \ else if(!(rc==SQLITE_OK||rc==SQLITE_DONE)) \ - fprintf(stderr,"E:%d\n",rc), assert(0) + eputf("E:%d\n",rc), assert(0) #else static void rc_err_oom_die(int rc){ if( rc==SQLITE_NOMEM ) shell_check_oom(0); @@ -23731,6 +25954,7 @@ FROM (\ sqlite3_exec(*pDb,"drop table if exists ColNames;" "drop view if exists RepeatedNames;",0,0,0); #endif +#undef SHELL_COLFIX_DB rc = sqlite3_exec(*pDb, zTabMake, 0, 0, 0); rc_err_oom_die(rc); } @@ -23791,6 +26015,69 @@ FROM (\ } } +/* +** Check if the sqlite_schema table contains one or more virtual tables. If +** parameter zLike is not NULL, then it is an SQL expression that the +** sqlite_schema row must also match. If one or more such rows are found, +** print the following warning to the output: +** +** WARNING: Script requires that SQLITE_DBCONFIG_DEFENSIVE be disabled +*/ +static int outputDumpWarning(ShellState *p, const char *zLike){ + int rc = SQLITE_OK; + sqlite3_stmt *pStmt = 0; + shellPreparePrintf(p->db, &rc, &pStmt, + "SELECT 1 FROM sqlite_schema o WHERE " + "sql LIKE 'CREATE VIRTUAL TABLE%%' AND %s", zLike ? zLike : "true" + ); + if( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){ + oputz("/* WARNING: " + "Script requires that SQLITE_DBCONFIG_DEFENSIVE be disabled */\n" + ); + } + shellFinalize(&rc, pStmt); + return rc; +} + +/* +** Fault-Simulator state and logic. +*/ +static struct { + int iId; /* ID that triggers a simulated fault. -1 means "any" */ + int iErr; /* The error code to return on a fault */ + int iCnt; /* Trigger the fault only if iCnt is already zero */ + int iInterval; /* Reset iCnt to this value after each fault */ + int eVerbose; /* When to print output */ + int nHit; /* Number of hits seen so far */ + int nRepeat; /* Turn off after this many hits. 0 for never */ + int nSkip; /* Skip this many before first fault */ +} faultsim_state = {-1, 0, 0, 0, 0, 0, 0, 0}; + +/* +** This is the fault-sim callback +*/ +static int faultsim_callback(int iArg){ + if( faultsim_state.iId>0 && faultsim_state.iId!=iArg ){ + return SQLITE_OK; + } + if( faultsim_state.iCnt ){ + if( faultsim_state.iCnt>0 ) faultsim_state.iCnt--; + if( faultsim_state.eVerbose>=2 ){ + oputf("FAULT-SIM id=%d no-fault (cnt=%d)\n", iArg, faultsim_state.iCnt); + } + return SQLITE_OK; + } + if( faultsim_state.eVerbose>=1 ){ + oputf("FAULT-SIM id=%d returns %d\n", iArg, faultsim_state.iErr); + } + faultsim_state.iCnt = faultsim_state.iInterval; + faultsim_state.nHit++; + if( faultsim_state.nRepeat>0 && faultsim_state.nRepeat<=faultsim_state.nHit ){ + faultsim_state.iCnt = -1; + } + return faultsim_state.iErr; +} + /* ** If an input line begins with "." then invoke this routine to ** process that line. @@ -23830,7 +26117,6 @@ static int do_meta_command(char *zLine, ShellState *p){ azArg[nArg++] = &zLine[h]; while( zLine[h] && !IsSpace(zLine[h]) ){ h++; } if( zLine[h] ) zLine[h++] = 0; - resolve_backslashes(azArg[nArg-1]); } } azArg[nArg] = 0; @@ -23845,7 +26131,7 @@ static int do_meta_command(char *zLine, ShellState *p){ #ifndef SQLITE_OMIT_AUTHORIZATION if( c=='a' && cli_strncmp(azArg[0], "auth", n)==0 ){ if( nArg!=2 ){ - raw_printf(stderr, "Usage: .auth ON|OFF\n"); + eputz("Usage: .auth ON|OFF\n"); rc = 1; goto meta_command_exit; } @@ -23892,7 +26178,7 @@ static int do_meta_command(char *zLine, ShellState *p){ bAsync = 1; }else { - utf8_printf(stderr, "unknown option: %s\n", azArg[j]); + eputf("unknown option: %s\n", azArg[j]); return 1; } }else if( zDestFile==0 ){ @@ -23901,19 +26187,19 @@ static int do_meta_command(char *zLine, ShellState *p){ zDb = zDestFile; zDestFile = azArg[j]; }else{ - raw_printf(stderr, "Usage: .backup ?DB? ?OPTIONS? FILENAME\n"); + eputz("Usage: .backup ?DB? ?OPTIONS? FILENAME\n"); return 1; } } if( zDestFile==0 ){ - raw_printf(stderr, "missing FILENAME argument on .backup\n"); + eputz("missing FILENAME argument on .backup\n"); return 1; } if( zDb==0 ) zDb = "main"; rc = sqlite3_open_v2(zDestFile, &pDest, SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE, zVfs); if( rc!=SQLITE_OK ){ - utf8_printf(stderr, "Error: cannot open \"%s\"\n", zDestFile); + eputf("Error: cannot open \"%s\"\n", zDestFile); close_db(pDest); return 1; } @@ -23924,7 +26210,7 @@ static int do_meta_command(char *zLine, ShellState *p){ open_db(p, 0); pBackup = sqlite3_backup_init(pDest, "main", p->db, zDb); if( pBackup==0 ){ - utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(pDest)); + eputf("Error: %s\n", sqlite3_errmsg(pDest)); close_db(pDest); return 1; } @@ -23933,7 +26219,7 @@ static int do_meta_command(char *zLine, ShellState *p){ if( rc==SQLITE_DONE ){ rc = 0; }else{ - utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(pDest)); + eputf("Error: %s\n", sqlite3_errmsg(pDest)); rc = 1; } close_db(pDest); @@ -23944,7 +26230,7 @@ static int do_meta_command(char *zLine, ShellState *p){ if( nArg==2 ){ bail_on_error = booleanValue(azArg[1]); }else{ - raw_printf(stderr, "Usage: .bail on|off\n"); + eputz("Usage: .bail on|off\n"); rc = 1; } }else @@ -23958,9 +26244,8 @@ static int do_meta_command(char *zLine, ShellState *p){ setTextMode(p->out, 1); } }else{ - raw_printf(stderr, "The \".binary\" command is deprecated." - " Use \".crnl\" instead.\n"); - raw_printf(stderr, "Usage: .binary on|off\n"); + eputz("The \".binary\" command is deprecated. Use \".crnl\" instead.\n" + "Usage: .binary on|off\n"); rc = 1; } }else @@ -23984,11 +26269,11 @@ static int do_meta_command(char *zLine, ShellState *p){ rc = chdir(azArg[1]); #endif if( rc ){ - utf8_printf(stderr, "Cannot change to directory \"%s\"\n", azArg[1]); + eputf("Cannot change to directory \"%s\"\n", azArg[1]); rc = 1; } }else{ - raw_printf(stderr, "Usage: .cd DIRECTORY\n"); + eputz("Usage: .cd DIRECTORY\n"); rc = 1; } }else @@ -23998,7 +26283,7 @@ static int do_meta_command(char *zLine, ShellState *p){ if( nArg==2 ){ setOrClearFlag(p, SHFLG_CountChanges, azArg[1]); }else{ - raw_printf(stderr, "Usage: .changes on|off\n"); + eputz("Usage: .changes on|off\n"); rc = 1; } }else @@ -24012,17 +26297,16 @@ static int do_meta_command(char *zLine, ShellState *p){ char *zRes = 0; output_reset(p); if( nArg!=2 ){ - raw_printf(stderr, "Usage: .check GLOB-PATTERN\n"); + eputz("Usage: .check GLOB-PATTERN\n"); rc = 2; }else if( (zRes = readFile("testcase-out.txt", 0))==0 ){ rc = 2; }else if( testcase_glob(azArg[1],zRes)==0 ){ - utf8_printf(stderr, - "testcase-%s FAILED\n Expected: [%s]\n Got: [%s]\n", - p->zTestcase, azArg[1], zRes); + eputf("testcase-%s FAILED\n Expected: [%s]\n Got: [%s]\n", + p->zTestcase, azArg[1], zRes); rc = 1; }else{ - utf8_printf(stdout, "testcase-%s ok\n", p->zTestcase); + oputf("testcase-%s ok\n", p->zTestcase); p->nCheck++; } sqlite3_free(zRes); @@ -24035,7 +26319,7 @@ static int do_meta_command(char *zLine, ShellState *p){ if( nArg==2 ){ tryToClone(p, azArg[1]); }else{ - raw_printf(stderr, "Usage: .clone FILENAME\n"); + eputz("Usage: .clone FILENAME\n"); rc = 1; } }else @@ -24055,9 +26339,9 @@ static int do_meta_command(char *zLine, ShellState *p){ zFile = "(temporary-file)"; } if( p->pAuxDb == &p->aAuxDb[i] ){ - utf8_printf(stdout, "ACTIVE %d: %s\n", i, zFile); + sputf(stdout, "ACTIVE %d: %s\n", i, zFile); }else if( p->aAuxDb[i].db!=0 ){ - utf8_printf(stdout, " %d: %s\n", i, zFile); + sputf(stdout, " %d: %s\n", i, zFile); } } }else if( nArg==2 && IsDigit(azArg[1][0]) && azArg[1][1]==0 ){ @@ -24074,7 +26358,7 @@ static int do_meta_command(char *zLine, ShellState *p){ if( i<0 || i>=ArraySize(p->aAuxDb) ){ /* No-op */ }else if( p->pAuxDb == &p->aAuxDb[i] ){ - raw_printf(stderr, "cannot close the active database connection\n"); + eputz("cannot close the active database connection\n"); rc = 1; }else if( p->aAuxDb[i].db ){ session_close_all(p, i); @@ -24082,7 +26366,7 @@ static int do_meta_command(char *zLine, ShellState *p){ p->aAuxDb[i].db = 0; } }else{ - raw_printf(stderr, "Usage: .connection [close] [CONNECTION-NUMBER]\n"); + eputz("Usage: .connection [close] [CONNECTION-NUMBER]\n"); rc = 1; } }else @@ -24096,9 +26380,9 @@ static int do_meta_command(char *zLine, ShellState *p){ } }else{ #if !defined(_WIN32) && !defined(WIN32) - raw_printf(stderr, "The \".crnl\" is a no-op on non-Windows machines.\n"); + eputz("The \".crnl\" is a no-op on non-Windows machines.\n"); #endif - raw_printf(stderr, "Usage: .crnl on|off\n"); + eputz("Usage: .crnl on|off\n"); rc = 1; } }else @@ -24111,7 +26395,7 @@ static int do_meta_command(char *zLine, ShellState *p){ open_db(p, 0); rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0); if( rc ){ - utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(p->db)); + eputf("Error: %s\n", sqlite3_errmsg(p->db)); rc = 1; }else{ while( sqlite3_step(pStmt)==SQLITE_ROW ){ @@ -24130,11 +26414,9 @@ static int do_meta_command(char *zLine, ShellState *p){ int eTxn = sqlite3_txn_state(p->db, azName[i*2]); int bRdonly = sqlite3_db_readonly(p->db, azName[i*2]); const char *z = azName[i*2+1]; - utf8_printf(p->out, "%s: %s %s%s\n", - azName[i*2], - z && z[0] ? z : "\"\"", - bRdonly ? "r/o" : "r/w", - eTxn==SQLITE_TXN_NONE ? "" : + oputf("%s: %s %s%s\n", + azName[i*2], z && z[0] ? z : "\"\"", bRdonly ? "r/o" : "r/w", + eTxn==SQLITE_TXN_NONE ? "" : eTxn==SQLITE_TXN_READ ? " read-txn" : " write-txn"); free(azName[i*2]); free(azName[i*2+1]); @@ -24174,12 +26456,12 @@ static int do_meta_command(char *zLine, ShellState *p){ sqlite3_db_config(p->db, aDbConfig[ii].op, booleanValue(azArg[2]), 0); } sqlite3_db_config(p->db, aDbConfig[ii].op, -1, &v); - utf8_printf(p->out, "%19s %s\n", aDbConfig[ii].zName, v ? "on" : "off"); + oputf("%19s %s\n", aDbConfig[ii].zName, v ? "on" : "off"); if( nArg>1 ) break; } if( nArg>1 && ii==ArraySize(aDbConfig) ){ - utf8_printf(stderr, "Error: unknown dbconfig \"%s\"\n", azArg[1]); - utf8_printf(stderr, "Enter \".dbconfig\" with no arguments for a list\n"); + eputf("Error: unknown dbconfig \"%s\"\n", azArg[1]); + eputz("Enter \".dbconfig\" with no arguments for a list\n"); } }else @@ -24209,8 +26491,8 @@ static int do_meta_command(char *zLine, ShellState *p){ if( z[0]=='-' ) z++; if( cli_strcmp(z,"preserve-rowids")==0 ){ #ifdef SQLITE_OMIT_VIRTUALTABLE - raw_printf(stderr, "The --preserve-rowids option is not compatible" - " with SQLITE_OMIT_VIRTUALTABLE\n"); + eputz("The --preserve-rowids option is not compatible" + " with SQLITE_OMIT_VIRTUALTABLE\n"); rc = 1; sqlite3_free(zLike); goto meta_command_exit; @@ -24228,7 +26510,7 @@ static int do_meta_command(char *zLine, ShellState *p){ ShellSetFlag(p, SHFLG_DumpNoSys); }else { - raw_printf(stderr, "Unknown option \"%s\" on \".dump\"\n", azArg[i]); + eputf("Unknown option \"%s\" on \".dump\"\n", azArg[i]); rc = 1; sqlite3_free(zLike); goto meta_command_exit; @@ -24258,12 +26540,13 @@ static int do_meta_command(char *zLine, ShellState *p){ open_db(p, 0); + outputDumpWarning(p, zLike); if( (p->shellFlgs & SHFLG_DumpDataOnly)==0 ){ /* When playing back a "dump", the content might appear in an order ** which causes immediate foreign key constraints to be violated. ** So disable foreign-key constraint enforcement to prevent problems. */ - raw_printf(p->out, "PRAGMA foreign_keys=OFF;\n"); - raw_printf(p->out, "BEGIN TRANSACTION;\n"); + oputz("PRAGMA foreign_keys=OFF;\n"); + oputz("BEGIN TRANSACTION;\n"); } p->writableSchema = 0; p->showHeader = 0; @@ -24286,7 +26569,8 @@ static int do_meta_command(char *zLine, ShellState *p){ zSql = sqlite3_mprintf( "SELECT sql FROM sqlite_schema AS o " "WHERE (%s) AND sql NOT NULL" - " AND type IN ('index','trigger','view')", + " AND type IN ('index','trigger','view') " + "ORDER BY type COLLATE NOCASE DESC", zLike ); run_table_dump_query(p, zSql); @@ -24294,13 +26578,13 @@ static int do_meta_command(char *zLine, ShellState *p){ } sqlite3_free(zLike); if( p->writableSchema ){ - raw_printf(p->out, "PRAGMA writable_schema=OFF;\n"); + oputz("PRAGMA writable_schema=OFF;\n"); p->writableSchema = 0; } sqlite3_exec(p->db, "PRAGMA writable_schema=OFF;", 0, 0, 0); sqlite3_exec(p->db, "RELEASE dump;", 0, 0, 0); if( (p->shellFlgs & SHFLG_DumpDataOnly)==0 ){ - raw_printf(p->out, p->nErr?"ROLLBACK; -- due to errors\n":"COMMIT;\n"); + oputz(p->nErr?"ROLLBACK; -- due to errors\n":"COMMIT;\n"); } p->showHeader = savedShowHeader; p->shellFlgs = savedShellFlags; @@ -24310,7 +26594,7 @@ static int do_meta_command(char *zLine, ShellState *p){ if( nArg==2 ){ setOrClearFlag(p, SHFLG_Echo, azArg[1]); }else{ - raw_printf(stderr, "Usage: .echo on|off\n"); + eputz("Usage: .echo on|off\n"); rc = 1; } }else @@ -24341,7 +26625,7 @@ static int do_meta_command(char *zLine, ShellState *p){ p->autoEQP = (u8)booleanValue(azArg[1]); } }else{ - raw_printf(stderr, "Usage: .eqp off|on|trace|trigger|full\n"); + eputz("Usage: .eqp off|on|trace|trigger|full\n"); rc = 1; } }else @@ -24380,9 +26664,8 @@ static int do_meta_command(char *zLine, ShellState *p){ #ifndef SQLITE_OMIT_VIRTUALTABLE if( c=='e' && cli_strncmp(azArg[0], "expert", n)==0 ){ if( p->bSafeMode ){ - raw_printf(stderr, - "Cannot run experimental commands such as \"%s\" in safe mode\n", - azArg[0]); + eputf("Cannot run experimental commands such as \"%s\" in safe mode\n", + azArg[0]); rc = 1; }else{ open_db(p, 0); @@ -24438,10 +26721,9 @@ static int do_meta_command(char *zLine, ShellState *p){ /* --help lists all file-controls */ if( cli_strcmp(zCmd,"help")==0 ){ - utf8_printf(p->out, "Available file-controls:\n"); + oputz("Available file-controls:\n"); for(i=0; iout, " .filectrl %s %s\n", - aCtrl[i].zCtrlName, aCtrl[i].zUsage); + oputf(" .filectrl %s %s\n", aCtrl[i].zCtrlName, aCtrl[i].zUsage); } rc = 1; goto meta_command_exit; @@ -24456,16 +26738,16 @@ static int do_meta_command(char *zLine, ShellState *p){ filectrl = aCtrl[i].ctrlCode; iCtrl = i; }else{ - utf8_printf(stderr, "Error: ambiguous file-control: \"%s\"\n" - "Use \".filectrl --help\" for help\n", zCmd); + eputf("Error: ambiguous file-control: \"%s\"\n" + "Use \".filectrl --help\" for help\n", zCmd); rc = 1; goto meta_command_exit; } } } if( filectrl<0 ){ - utf8_printf(stderr,"Error: unknown file-control: %s\n" - "Use \".filectrl --help\" for help\n", zCmd); + eputf("Error: unknown file-control: %s\n" + "Use \".filectrl --help\" for help\n", zCmd); }else{ switch(filectrl){ case SQLITE_FCNTL_SIZE_LIMIT: { @@ -24508,7 +26790,7 @@ static int do_meta_command(char *zLine, ShellState *p){ if( nArg!=2 ) break; sqlite3_file_control(p->db, zSchema, filectrl, &z); if( z ){ - utf8_printf(p->out, "%s\n", z); + oputf("%s\n", z); sqlite3_free(z); } isOk = 2; @@ -24522,19 +26804,19 @@ static int do_meta_command(char *zLine, ShellState *p){ } x = -1; sqlite3_file_control(p->db, zSchema, filectrl, &x); - utf8_printf(p->out,"%d\n", x); + oputf("%d\n", x); isOk = 2; break; } } } if( isOk==0 && iCtrl>=0 ){ - utf8_printf(p->out, "Usage: .filectrl %s %s\n", zCmd,aCtrl[iCtrl].zUsage); + oputf("Usage: .filectrl %s %s\n", zCmd,aCtrl[iCtrl].zUsage); rc = 1; }else if( isOk==1 ){ char zBuf[100]; sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", iRes); - raw_printf(p->out, "%s\n", zBuf); + oputf("%s\n", zBuf); } }else @@ -24549,7 +26831,7 @@ static int do_meta_command(char *zLine, ShellState *p){ nArg = 1; } if( nArg!=1 ){ - raw_printf(stderr, "Usage: .fullschema ?--indent?\n"); + eputz("Usage: .fullschema ?--indent?\n"); rc = 1; goto meta_command_exit; } @@ -24569,19 +26851,21 @@ static int do_meta_command(char *zLine, ShellState *p){ "SELECT rowid FROM sqlite_schema" " WHERE name GLOB 'sqlite_stat[134]'", -1, &pStmt, 0); - doStats = sqlite3_step(pStmt)==SQLITE_ROW; - sqlite3_finalize(pStmt); + if( rc==SQLITE_OK ){ + doStats = sqlite3_step(pStmt)==SQLITE_ROW; + sqlite3_finalize(pStmt); + } } if( doStats==0 ){ - raw_printf(p->out, "/* No STAT tables available */\n"); + oputz("/* No STAT tables available */\n"); }else{ - raw_printf(p->out, "ANALYZE sqlite_schema;\n"); + oputz("ANALYZE sqlite_schema;\n"); data.cMode = data.mode = MODE_Insert; data.zDestTable = "sqlite_stat1"; shell_exec(&data, "SELECT * FROM sqlite_stat1", 0); data.zDestTable = "sqlite_stat4"; shell_exec(&data, "SELECT * FROM sqlite_stat4", 0); - raw_printf(p->out, "ANALYZE sqlite_schema;\n"); + oputz("ANALYZE sqlite_schema;\n"); } }else @@ -24590,7 +26874,7 @@ static int do_meta_command(char *zLine, ShellState *p){ p->showHeader = booleanValue(azArg[1]); p->shellFlgs |= SHFLG_HeaderSet; }else{ - raw_printf(stderr, "Usage: .headers on|off\n"); + eputz("Usage: .headers on|off\n"); rc = 1; } }else @@ -24599,7 +26883,7 @@ static int do_meta_command(char *zLine, ShellState *p){ if( nArg>=2 ){ n = showHelp(p->out, azArg[1]); if( n==0 ){ - utf8_printf(p->out, "Nothing matches '%s'\n", azArg[1]); + oputf("Nothing matches '%s'\n", azArg[1]); } }else{ showHelp(p->out, 0); @@ -24609,16 +26893,15 @@ static int do_meta_command(char *zLine, ShellState *p){ #ifndef SQLITE_SHELL_FIDDLE if( c=='i' && cli_strncmp(azArg[0], "import", n)==0 ){ char *zTable = 0; /* Insert data into this table */ - char *zSchema = 0; /* within this schema (may default to "main") */ + char *zSchema = 0; /* Schema of zTable */ char *zFile = 0; /* Name of file to extra content from */ sqlite3_stmt *pStmt = NULL; /* A statement */ int nCol; /* Number of columns in the table */ - int nByte; /* Number of bytes in an SQL string */ + i64 nByte; /* Number of bytes in an SQL string */ int i, j; /* Loop counters */ int needCommit; /* True to COMMIT or ROLLBACK at end */ int nSep; /* Number of bytes in p->colSeparator[] */ - char *zSql; /* An SQL statement */ - char *zFullTabName; /* Table name with schema if applicable */ + char *zSql = 0; /* An SQL statement */ ImportCtx sCtx; /* Reader context */ char *(SQLITE_CDECL *xRead)(ImportCtx*); /* Func to read one value */ int eVerbose = 0; /* Larger for more console output */ @@ -24643,7 +26926,7 @@ static int do_meta_command(char *zLine, ShellState *p){ }else if( zTable==0 ){ zTable = z; }else{ - utf8_printf(p->out, "ERROR: extra argument: \"%s\". Usage:\n", z); + oputf("ERROR: extra argument: \"%s\". Usage:\n", z); showHelp(p->out, "import"); goto meta_command_exit; } @@ -24664,14 +26947,14 @@ static int do_meta_command(char *zLine, ShellState *p){ xRead = csv_read_one_field; useOutputMode = 0; }else{ - utf8_printf(p->out, "ERROR: unknown option: \"%s\". Usage:\n", z); + oputf("ERROR: unknown option: \"%s\". Usage:\n", z); showHelp(p->out, "import"); goto meta_command_exit; } } if( zTable==0 ){ - utf8_printf(p->out, "ERROR: missing %s argument. Usage:\n", - zFile==0 ? "FILE" : "TABLE"); + oputf("ERROR: missing %s argument. Usage:\n", + zFile==0 ? "FILE" : "TABLE"); showHelp(p->out, "import"); goto meta_command_exit; } @@ -24682,20 +26965,17 @@ static int do_meta_command(char *zLine, ShellState *p){ ** the column and row separator characters from the output mode. */ nSep = strlen30(p->colSeparator); if( nSep==0 ){ - raw_printf(stderr, - "Error: non-null column separator required for import\n"); + eputz("Error: non-null column separator required for import\n"); goto meta_command_exit; } if( nSep>1 ){ - raw_printf(stderr, - "Error: multi-character column separators not allowed" + eputz("Error: multi-character column separators not allowed" " for import\n"); goto meta_command_exit; } nSep = strlen30(p->rowSeparator); if( nSep==0 ){ - raw_printf(stderr, - "Error: non-null row separator required for import\n"); + eputz("Error: non-null row separator required for import\n"); goto meta_command_exit; } if( nSep==2 && p->mode==MODE_Csv @@ -24709,8 +26989,8 @@ static int do_meta_command(char *zLine, ShellState *p){ nSep = strlen30(p->rowSeparator); } if( nSep>1 ){ - raw_printf(stderr, "Error: multi-character row separators not allowed" - " for import\n"); + eputz("Error: multi-character row separators not allowed" + " for import\n"); goto meta_command_exit; } sCtx.cColSep = (u8)p->colSeparator[0]; @@ -24720,7 +27000,7 @@ static int do_meta_command(char *zLine, ShellState *p){ sCtx.nLine = 1; if( sCtx.zFile[0]=='|' ){ #ifdef SQLITE_OMIT_POPEN - raw_printf(stderr, "Error: pipes are not supported in this OS\n"); + eputz("Error: pipes are not supported in this OS\n"); goto meta_command_exit; #else sCtx.in = popen(sCtx.zFile+1, "r"); @@ -24732,19 +27012,19 @@ static int do_meta_command(char *zLine, ShellState *p){ sCtx.xCloser = fclose; } if( sCtx.in==0 ){ - utf8_printf(stderr, "Error: cannot open \"%s\"\n", zFile); + eputf("Error: cannot open \"%s\"\n", zFile); goto meta_command_exit; } if( eVerbose>=2 || (eVerbose>=1 && useOutputMode) ){ char zSep[2]; zSep[1] = 0; zSep[0] = sCtx.cColSep; - utf8_printf(p->out, "Column separator "); - output_c_string(p->out, zSep); - utf8_printf(p->out, ", row separator "); + oputz("Column separator "); + output_c_string(zSep); + oputz(", row separator "); zSep[0] = sCtx.cRowSep; - output_c_string(p->out, zSep); - utf8_printf(p->out, "\n"); + output_c_string(zSep); + oputz("\n"); } sCtx.z = sqlite3_malloc64(120); if( sCtx.z==0 ){ @@ -24755,66 +27035,72 @@ static int do_meta_command(char *zLine, ShellState *p){ while( (nSkip--)>0 ){ while( xRead(&sCtx) && sCtx.cTerm==sCtx.cColSep ){} } - if( zSchema!=0 ){ - zFullTabName = sqlite3_mprintf("\"%w\".\"%w\"", zSchema, zTable); - }else{ - zFullTabName = sqlite3_mprintf("\"%w\"", zTable); - } - zSql = sqlite3_mprintf("SELECT * FROM %s", zFullTabName); - if( zSql==0 || zFullTabName==0 ){ - import_cleanup(&sCtx); - shell_out_of_memory(); - } - nByte = strlen30(zSql); - rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); import_append_char(&sCtx, 0); /* To ensure sCtx.z is allocated */ - if( rc && sqlite3_strglob("no such table: *", sqlite3_errmsg(p->db))==0 ){ + if( sqlite3_table_column_metadata(p->db, zSchema, zTable,0,0,0,0,0,0) ){ + /* Table does not exist. Create it. */ sqlite3 *dbCols = 0; char *zRenames = 0; char *zColDefs; - zCreate = sqlite3_mprintf("CREATE TABLE %s", zFullTabName); + zCreate = sqlite3_mprintf("CREATE TABLE \"%w\".\"%w\"", + zSchema ? zSchema : "main", zTable); while( xRead(&sCtx) ){ zAutoColumn(sCtx.z, &dbCols, 0); if( sCtx.cTerm!=sCtx.cColSep ) break; } zColDefs = zAutoColumn(0, &dbCols, &zRenames); if( zRenames!=0 ){ - utf8_printf((stdin_is_interactive && p->in==stdin)? p->out : stderr, - "Columns renamed during .import %s due to duplicates:\n" - "%s\n", sCtx.zFile, zRenames); + sputf((stdin_is_interactive && p->in==stdin)? p->out : stderr, + "Columns renamed during .import %s due to duplicates:\n" + "%s\n", sCtx.zFile, zRenames); sqlite3_free(zRenames); } assert(dbCols==0); if( zColDefs==0 ){ - utf8_printf(stderr,"%s: empty file\n", sCtx.zFile); - import_fail: - sqlite3_free(zCreate); - sqlite3_free(zSql); - sqlite3_free(zFullTabName); + eputf("%s: empty file\n", sCtx.zFile); import_cleanup(&sCtx); rc = 1; goto meta_command_exit; } zCreate = sqlite3_mprintf("%z%z\n", zCreate, zColDefs); + if( zCreate==0 ){ + import_cleanup(&sCtx); + shell_out_of_memory(); + } if( eVerbose>=1 ){ - utf8_printf(p->out, "%s\n", zCreate); + oputf("%s\n", zCreate); } rc = sqlite3_exec(p->db, zCreate, 0, 0, 0); - if( rc ){ - utf8_printf(stderr, "%s failed:\n%s\n", zCreate, sqlite3_errmsg(p->db)); - goto import_fail; - } sqlite3_free(zCreate); zCreate = 0; - rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); + if( rc ){ + eputf("%s failed:\n%s\n", zCreate, sqlite3_errmsg(p->db)); + import_cleanup(&sCtx); + rc = 1; + goto meta_command_exit; + } + } + zSql = sqlite3_mprintf("SELECT count(*) FROM pragma_table_info(%Q,%Q);", + zTable, zSchema); + if( zSql==0 ){ + import_cleanup(&sCtx); + shell_out_of_memory(); } + nByte = strlen(zSql); + rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); + sqlite3_free(zSql); + zSql = 0; if( rc ){ if (pStmt) sqlite3_finalize(pStmt); - utf8_printf(stderr,"Error: %s\n", sqlite3_errmsg(p->db)); - goto import_fail; + eputf("Error: %s\n", sqlite3_errmsg(p->db)); + import_cleanup(&sCtx); + rc = 1; + goto meta_command_exit; + } + if( sqlite3_step(pStmt)==SQLITE_ROW ){ + nCol = sqlite3_column_int(pStmt, 0); + }else{ + nCol = 0; } - sqlite3_free(zSql); - nCol = sqlite3_column_count(pStmt); sqlite3_finalize(pStmt); pStmt = 0; if( nCol==0 ) return 0; /* no columns, no error */ @@ -24823,7 +27109,12 @@ static int do_meta_command(char *zLine, ShellState *p){ import_cleanup(&sCtx); shell_out_of_memory(); } - sqlite3_snprintf(nByte+20, zSql, "INSERT INTO %s VALUES(?", zFullTabName); + if( zSchema ){ + sqlite3_snprintf(nByte+20, zSql, "INSERT INTO \"%w\".\"%w\" VALUES(?", + zSchema, zTable); + }else{ + sqlite3_snprintf(nByte+20, zSql, "INSERT INTO \"%w\" VALUES(?", zTable); + } j = strlen30(zSql); for(i=1; i=2 ){ - utf8_printf(p->out, "Insert using: %s\n", zSql); + oputf("Insert using: %s\n", zSql); } rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); + sqlite3_free(zSql); + zSql = 0; if( rc ){ - utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(p->db)); + eputf("Error: %s\n", sqlite3_errmsg(p->db)); if (pStmt) sqlite3_finalize(pStmt); - goto import_fail; + import_cleanup(&sCtx); + rc = 1; + goto meta_command_exit; } - sqlite3_free(zSql); - sqlite3_free(zFullTabName); needCommit = sqlite3_get_autocommit(p->db); if( needCommit ) sqlite3_exec(p->db, "BEGIN", 0, 0, 0); do{ @@ -24859,11 +27152,19 @@ static int do_meta_command(char *zLine, ShellState *p){ ** the remaining columns. */ if( p->mode==MODE_Ascii && (z==0 || z[0]==0) && i==0 ) break; + /* + ** For CSV mode, per RFC 4180, accept EOF in lieu of final + ** record terminator but only for last field of multi-field row. + ** (If there are too few fields, it's not valid CSV anyway.) + */ + if( z==0 && (xRead==csv_read_one_field) && i==nCol-1 && i>0 ){ + z = ""; + } sqlite3_bind_text(pStmt, i+1, z, -1, SQLITE_TRANSIENT); if( i=nCol ){ sqlite3_step(pStmt); rc = sqlite3_reset(pStmt); if( rc!=SQLITE_OK ){ - utf8_printf(stderr, "%s:%d: INSERT failed: %s\n", sCtx.zFile, - startLine, sqlite3_errmsg(p->db)); + eputf("%s:%d: INSERT failed: %s\n", + sCtx.zFile, startLine, sqlite3_errmsg(p->db)); sCtx.nErr++; }else{ sCtx.nRow++; @@ -24894,9 +27194,8 @@ static int do_meta_command(char *zLine, ShellState *p){ sqlite3_finalize(pStmt); if( needCommit ) sqlite3_exec(p->db, "COMMIT", 0, 0, 0); if( eVerbose>0 ){ - utf8_printf(p->out, - "Added %d rows with %d errors using %d lines of input\n", - sCtx.nRow, sCtx.nErr, sCtx.nLine-1); + oputf("Added %d rows with %d errors using %d lines of input\n", + sCtx.nRow, sCtx.nErr, sCtx.nLine-1); } }else #endif /* !defined(SQLITE_SHELL_FIDDLE) */ @@ -24911,14 +27210,14 @@ static int do_meta_command(char *zLine, ShellState *p){ int lenPK = 0; /* Length of the PRIMARY KEY string for isWO tables */ int i; if( !ShellHasFlag(p,SHFLG_TestingMode) ){ - utf8_printf(stderr, ".%s unavailable without --unsafe-testing\n", - "imposter"); + eputf(".%s unavailable without --unsafe-testing\n", + "imposter"); rc = 1; goto meta_command_exit; } if( !(nArg==3 || (nArg==2 && sqlite3_stricmp(azArg[1],"off")==0)) ){ - utf8_printf(stderr, "Usage: .imposter INDEX IMPOSTER\n" - " .imposter off\n"); + eputz("Usage: .imposter INDEX IMPOSTER\n" + " .imposter off\n"); /* Also allowed, but not documented: ** ** .imposter TABLE IMPOSTER @@ -24977,7 +27276,7 @@ static int do_meta_command(char *zLine, ShellState *p){ } sqlite3_finalize(pStmt); if( i==0 || tnum==0 ){ - utf8_printf(stderr, "no such index: \"%s\"\n", azArg[1]); + eputf("no such index: \"%s\"\n", azArg[1]); rc = 1; sqlite3_free(zCollist); goto meta_command_exit; @@ -24992,22 +27291,35 @@ static int do_meta_command(char *zLine, ShellState *p){ rc = sqlite3_exec(p->db, zSql, 0, 0, 0); sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->db, "main", 0, 0); if( rc ){ - utf8_printf(stderr, "Error in [%s]: %s\n", zSql, sqlite3_errmsg(p->db)); + eputf("Error in [%s]: %s\n", zSql, sqlite3_errmsg(p->db)); }else{ - utf8_printf(stdout, "%s;\n", zSql); - raw_printf(stdout, - "WARNING: writing to an imposter table will corrupt the \"%s\" %s!\n", - azArg[1], isWO ? "table" : "index" - ); + sputf(stdout, "%s;\n", zSql); + sputf(stdout, "WARNING: writing to an imposter table will corrupt" + " the \"%s\" %s!\n", azArg[1], isWO ? "table" : "index"); } }else{ - raw_printf(stderr, "SQLITE_TESTCTRL_IMPOSTER returns %d\n", rc); + eputf("SQLITE_TESTCTRL_IMPOSTER returns %d\n", rc); rc = 1; } sqlite3_free(zSql); }else #endif /* !defined(SQLITE_OMIT_TEST_CONTROL) */ + if( c=='i' && cli_strncmp(azArg[0], "intck", n)==0 ){ + i64 iArg = 0; + if( nArg==2 ){ + iArg = integerValue(azArg[1]); + if( iArg==0 ) iArg = -1; + } + if( (nArg!=1 && nArg!=2) || iArg<0 ){ + eputf("%s","Usage: .intck STEPS_PER_UNLOCK\n"); + rc = 1; + goto meta_command_exit; + } + open_db(p, 0); + rc = intckDatabaseCmd(p, iArg); + }else + #ifdef SQLITE_ENABLE_IOTRACE if( c=='i' && cli_strncmp(azArg[0], "iotrace", n)==0 ){ SQLITE_API extern void (SQLITE_CDECL *sqlite3IoTrace)(const char*, ...); @@ -25021,7 +27333,7 @@ static int do_meta_command(char *zLine, ShellState *p){ }else{ iotrace = fopen(azArg[1], "w"); if( iotrace==0 ){ - utf8_printf(stderr, "Error: cannot open \"%s\"\n", azArg[1]); + eputf("Error: cannot open \"%s\"\n", azArg[1]); sqlite3IoTrace = 0; rc = 1; }else{ @@ -25053,11 +27365,11 @@ static int do_meta_command(char *zLine, ShellState *p){ open_db(p, 0); if( nArg==1 ){ for(i=0; idb, aLimit[i].limitCode, -1)); + sputf(stdout, "%20s %d\n", aLimit[i].zLimitName, + sqlite3_limit(p->db, aLimit[i].limitCode, -1)); } }else if( nArg>3 ){ - raw_printf(stderr, "Usage: .limit NAME ?NEW-VALUE?\n"); + eputz("Usage: .limit NAME ?NEW-VALUE?\n"); rc = 1; goto meta_command_exit; }else{ @@ -25068,16 +27380,16 @@ static int do_meta_command(char *zLine, ShellState *p){ if( iLimit<0 ){ iLimit = i; }else{ - utf8_printf(stderr, "ambiguous limit: \"%s\"\n", azArg[1]); + eputf("ambiguous limit: \"%s\"\n", azArg[1]); rc = 1; goto meta_command_exit; } } } if( iLimit<0 ){ - utf8_printf(stderr, "unknown limit: \"%s\"\n" - "enter \".limits\" with no arguments for a list.\n", - azArg[1]); + eputf("unknown limit: \"%s\"\n" + "enter \".limits\" with no arguments for a list.\n", + azArg[1]); rc = 1; goto meta_command_exit; } @@ -25085,8 +27397,8 @@ static int do_meta_command(char *zLine, ShellState *p){ sqlite3_limit(p->db, aLimit[iLimit].limitCode, (int)integerValue(azArg[2])); } - printf("%20s %d\n", aLimit[iLimit].zLimitName, - sqlite3_limit(p->db, aLimit[iLimit].limitCode, -1)); + sputf(stdout, "%20s %d\n", aLimit[iLimit].zLimitName, + sqlite3_limit(p->db, aLimit[iLimit].limitCode, -1)); } }else @@ -25102,7 +27414,7 @@ static int do_meta_command(char *zLine, ShellState *p){ failIfSafeMode(p, "cannot run .load in safe mode"); if( nArg<2 || azArg[1][0]==0 ){ /* Must have a non-empty FILE. (Will not load self.) */ - raw_printf(stderr, "Usage: .load FILE ?ENTRYPOINT?\n"); + eputz("Usage: .load FILE ?ENTRYPOINT?\n"); rc = 1; goto meta_command_exit; } @@ -25111,7 +27423,7 @@ static int do_meta_command(char *zLine, ShellState *p){ open_db(p, 0); rc = sqlite3_load_extension(p->db, zFile, zProc, &zErrMsg); if( rc!=SQLITE_OK ){ - utf8_printf(stderr, "Error: %s\n", zErrMsg); + eputf("Error: %s\n", zErrMsg); sqlite3_free(zErrMsg); rc = 1; } @@ -25120,7 +27432,7 @@ static int do_meta_command(char *zLine, ShellState *p){ if( c=='l' && cli_strncmp(azArg[0], "log", n)==0 ){ if( nArg!=2 ){ - raw_printf(stderr, "Usage: .log FILENAME\n"); + eputz("Usage: .log FILENAME\n"); rc = 1; }else{ const char *zFile = azArg[1]; @@ -25128,8 +27440,8 @@ static int do_meta_command(char *zLine, ShellState *p){ && cli_strcmp(zFile,"on")!=0 && cli_strcmp(zFile,"off")!=0 ){ - raw_printf(stdout, "cannot set .log to anything other " - "than \"on\" or \"off\"\n"); + sputz(stdout, "cannot set .log to anything other" + " than \"on\" or \"off\"\n"); zFile = "off"; } output_file_close(p->pLog); @@ -25168,17 +27480,17 @@ static int do_meta_command(char *zLine, ShellState *p){ }else if( zTabname==0 ){ zTabname = z; }else if( z[0]=='-' ){ - utf8_printf(stderr, "unknown option: %s\n", z); - utf8_printf(stderr, "options:\n" - " --noquote\n" - " --quote\n" - " --wordwrap on/off\n" - " --wrap N\n" - " --ww\n"); + eputf("unknown option: %s\n", z); + eputz("options:\n" + " --noquote\n" + " --quote\n" + " --wordwrap on/off\n" + " --wrap N\n" + " --ww\n"); rc = 1; goto meta_command_exit; }else{ - utf8_printf(stderr, "extra argument: \"%s\"\n", z); + eputf("extra argument: \"%s\"\n", z); rc = 1; goto meta_command_exit; } @@ -25187,14 +27499,12 @@ static int do_meta_command(char *zLine, ShellState *p){ if( p->mode==MODE_Column || (p->mode>=MODE_Markdown && p->mode<=MODE_Box) ){ - raw_printf - (p->out, - "current output mode: %s --wrap %d --wordwrap %s --%squote\n", - modeDescr[p->mode], p->cmOpts.iWrap, - p->cmOpts.bWordWrap ? "on" : "off", - p->cmOpts.bQuote ? "" : "no"); + oputf("current output mode: %s --wrap %d --wordwrap %s --%squote\n", + modeDescr[p->mode], p->cmOpts.iWrap, + p->cmOpts.bWordWrap ? "on" : "off", + p->cmOpts.bQuote ? "" : "no"); }else{ - raw_printf(p->out, "current output mode: %s\n", modeDescr[p->mode]); + oputf("current output mode: %s\n", modeDescr[p->mode]); } zMode = modeDescr[p->mode]; } @@ -25253,9 +27563,9 @@ static int do_meta_command(char *zLine, ShellState *p){ }else if( cli_strncmp(zMode,"json",n2)==0 ){ p->mode = MODE_Json; }else{ - raw_printf(stderr, "Error: mode should be one of: " - "ascii box column csv html insert json line list markdown " - "qbox quote table tabs tcl\n"); + eputz("Error: mode should be one of: " + "ascii box column csv html insert json line list markdown " + "qbox quote table tabs tcl\n"); rc = 1; } p->cMode = p->mode; @@ -25264,11 +27574,11 @@ static int do_meta_command(char *zLine, ShellState *p){ #ifndef SQLITE_SHELL_FIDDLE if( c=='n' && cli_strcmp(azArg[0], "nonce")==0 ){ if( nArg!=2 ){ - raw_printf(stderr, "Usage: .nonce NONCE\n"); + eputz("Usage: .nonce NONCE\n"); rc = 1; }else if( p->zNonce==0 || cli_strcmp(azArg[1],p->zNonce)!=0 ){ - raw_printf(stderr, "line %d: incorrect nonce: \"%s\"\n", - p->lineno, azArg[1]); + eputf("line %d: incorrect nonce: \"%s\"\n", + p->lineno, azArg[1]); exit(1); }else{ p->bSafeMode = 0; @@ -25283,7 +27593,7 @@ static int do_meta_command(char *zLine, ShellState *p){ sqlite3_snprintf(sizeof(p->nullValue), p->nullValue, "%.*s", (int)ArraySize(p->nullValue)-1, azArg[1]); }else{ - raw_printf(stderr, "Usage: .nullvalue STRING\n"); + eputz("Usage: .nullvalue STRING\n"); rc = 1; } }else @@ -25322,11 +27632,11 @@ static int do_meta_command(char *zLine, ShellState *p){ }else #endif /* !SQLITE_SHELL_FIDDLE */ if( z[0]=='-' ){ - utf8_printf(stderr, "unknown option: %s\n", z); + eputf("unknown option: %s\n", z); rc = 1; goto meta_command_exit; }else if( zFN ){ - utf8_printf(stderr, "extra argument: \"%s\"\n", z); + eputf("extra argument: \"%s\"\n", z); rc = 1; goto meta_command_exit; }else{ @@ -25368,7 +27678,7 @@ static int do_meta_command(char *zLine, ShellState *p){ p->pAuxDb->zDbFilename = zNewFilename; open_db(p, OPEN_DB_KEEPALIVE); if( p->db==0 ){ - utf8_printf(stderr, "Error: cannot open '%s'\n", zNewFilename); + eputf("Error: cannot open '%s'\n", zNewFilename); sqlite3_free(zNewFilename); }else{ p->pAuxDb->zFreeOnClose = zNewFilename; @@ -25392,9 +27702,9 @@ static int do_meta_command(char *zLine, ShellState *p){ int i; int eMode = 0; int bOnce = 0; /* 0: .output, 1: .once, 2: .excel */ - unsigned char zBOM[4]; /* Byte-order mark to using if --bom is present */ + static const char *zBomUtf8 = "\xef\xbb\xbf"; + const char *zBom = 0; - zBOM[0] = 0; failIfSafeMode(p, "cannot run .%s in safe mode", azArg[0]); if( c=='e' ){ eMode = 'x'; @@ -25407,17 +27717,13 @@ static int do_meta_command(char *zLine, ShellState *p){ if( z[0]=='-' ){ if( z[1]=='-' ) z++; if( cli_strcmp(z,"-bom")==0 ){ - zBOM[0] = 0xef; - zBOM[1] = 0xbb; - zBOM[2] = 0xbf; - zBOM[3] = 0; + zBom = zBomUtf8; }else if( c!='e' && cli_strcmp(z,"-x")==0 ){ eMode = 'x'; /* spreadsheet */ }else if( c!='e' && cli_strcmp(z,"-e")==0 ){ eMode = 'e'; /* text editor */ }else{ - utf8_printf(p->out, "ERROR: unknown option: \"%s\". Usage:\n", - azArg[i]); + oputf("ERROR: unknown option: \"%s\". Usage:\n", azArg[i]); showHelp(p->out, azArg[0]); rc = 1; goto meta_command_exit; @@ -25429,8 +27735,7 @@ static int do_meta_command(char *zLine, ShellState *p){ break; } }else{ - utf8_printf(p->out,"ERROR: extra parameter: \"%s\". Usage:\n", - azArg[i]); + oputf("ERROR: extra parameter: \"%s\". Usage:\n", azArg[i]); showHelp(p->out, azArg[0]); rc = 1; sqlite3_free(zFile); @@ -25469,30 +27774,30 @@ static int do_meta_command(char *zLine, ShellState *p){ shell_check_oom(zFile); if( zFile[0]=='|' ){ #ifdef SQLITE_OMIT_POPEN - raw_printf(stderr, "Error: pipes are not supported in this OS\n"); + eputz("Error: pipes are not supported in this OS\n"); rc = 1; - p->out = stdout; + output_redir(p, stdout); #else - p->out = popen(zFile + 1, "w"); - if( p->out==0 ){ - utf8_printf(stderr,"Error: cannot open pipe \"%s\"\n", zFile + 1); - p->out = stdout; + FILE *pfPipe = popen(zFile + 1, "w"); + if( pfPipe==0 ){ + eputf("Error: cannot open pipe \"%s\"\n", zFile + 1); rc = 1; }else{ - if( zBOM[0] ) fwrite(zBOM, 1, 3, p->out); + output_redir(p, pfPipe); + if( zBom ) oputz(zBom); sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile); } #endif }else{ - p->out = output_file_open(zFile, bTxtMode); - if( p->out==0 ){ + FILE *pfFile = output_file_open(zFile, bTxtMode); + if( pfFile==0 ){ if( cli_strcmp(zFile,"off")!=0 ){ - utf8_printf(stderr,"Error: cannot write to \"%s\"\n", zFile); + eputf("Error: cannot write to \"%s\"\n", zFile); } - p->out = stdout; rc = 1; } else { - if( zBOM[0] ) fwrite(zBOM, 1, 3, p->out); + output_redir(p, pfFile); + if( zBom ) oputz(zBom); sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", zFile); } } @@ -25533,8 +27838,8 @@ static int do_meta_command(char *zLine, ShellState *p){ "SELECT key, quote(value) " "FROM temp.sqlite_parameters;", -1, &pStmt, 0); while( rx==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){ - utf8_printf(p->out, "%-*s %s\n", len, sqlite3_column_text(pStmt,0), - sqlite3_column_text(pStmt,1)); + oputf("%-*s %s\n", len, sqlite3_column_text(pStmt,0), + sqlite3_column_text(pStmt,1)); } sqlite3_finalize(pStmt); } @@ -25578,7 +27883,7 @@ static int do_meta_command(char *zLine, ShellState *p){ rx = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); sqlite3_free(zSql); if( rx!=SQLITE_OK ){ - utf8_printf(p->out, "Error: %s\n", sqlite3_errmsg(p->db)); + oputf("Error: %s\n", sqlite3_errmsg(p->db)); sqlite3_finalize(pStmt); pStmt = 0; rc = 1; @@ -25607,10 +27912,10 @@ static int do_meta_command(char *zLine, ShellState *p){ if( c=='p' && n>=3 && cli_strncmp(azArg[0], "print", n)==0 ){ int i; for(i=1; i1 ) raw_printf(p->out, " "); - utf8_printf(p->out, "%s", azArg[i]); + if( i>1 ) oputz(" "); + oputz(azArg[i]); } - raw_printf(p->out, "\n"); + oputz("\n"); }else #ifndef SQLITE_OMIT_PROGRESS_CALLBACK @@ -25639,7 +27944,7 @@ static int do_meta_command(char *zLine, ShellState *p){ } if( cli_strcmp(z,"limit")==0 ){ if( i+1>=nArg ){ - utf8_printf(stderr, "Error: missing argument on --limit\n"); + eputz("Error: missing argument on --limit\n"); rc = 1; goto meta_command_exit; }else{ @@ -25647,7 +27952,7 @@ static int do_meta_command(char *zLine, ShellState *p){ } continue; } - utf8_printf(stderr, "Error: unknown option: \"%s\"\n", azArg[i]); + eputf("Error: unknown option: \"%s\"\n", azArg[i]); rc = 1; goto meta_command_exit; }else{ @@ -25680,19 +27985,19 @@ static int do_meta_command(char *zLine, ShellState *p){ int savedLineno = p->lineno; failIfSafeMode(p, "cannot run .read in safe mode"); if( nArg!=2 ){ - raw_printf(stderr, "Usage: .read FILE\n"); + eputz("Usage: .read FILE\n"); rc = 1; goto meta_command_exit; } if( azArg[1][0]=='|' ){ #ifdef SQLITE_OMIT_POPEN - raw_printf(stderr, "Error: pipes are not supported in this OS\n"); + eputz("Error: pipes are not supported in this OS\n"); rc = 1; p->out = stdout; #else p->in = popen(azArg[1]+1, "r"); if( p->in==0 ){ - utf8_printf(stderr, "Error: cannot open \"%s\"\n", azArg[1]); + eputf("Error: cannot open \"%s\"\n", azArg[1]); rc = 1; }else{ rc = process_input(p); @@ -25700,7 +28005,7 @@ static int do_meta_command(char *zLine, ShellState *p){ } #endif }else if( (p->in = openChrSource(azArg[1]))==0 ){ - utf8_printf(stderr,"Error: cannot open \"%s\"\n", azArg[1]); + eputf("Error: cannot open \"%s\"\n", azArg[1]); rc = 1; }else{ rc = process_input(p); @@ -25727,20 +28032,20 @@ static int do_meta_command(char *zLine, ShellState *p){ zSrcFile = azArg[2]; zDb = azArg[1]; }else{ - raw_printf(stderr, "Usage: .restore ?DB? FILE\n"); + eputz("Usage: .restore ?DB? FILE\n"); rc = 1; goto meta_command_exit; } rc = sqlite3_open(zSrcFile, &pSrc); if( rc!=SQLITE_OK ){ - utf8_printf(stderr, "Error: cannot open \"%s\"\n", zSrcFile); + eputf("Error: cannot open \"%s\"\n", zSrcFile); close_db(pSrc); return 1; } open_db(p, 0); pBackup = sqlite3_backup_init(p->db, zDb, pSrc, "main"); if( pBackup==0 ){ - utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(p->db)); + eputf("Error: %s\n", sqlite3_errmsg(p->db)); close_db(pSrc); return 1; } @@ -25755,10 +28060,10 @@ static int do_meta_command(char *zLine, ShellState *p){ if( rc==SQLITE_DONE ){ rc = 0; }else if( rc==SQLITE_BUSY || rc==SQLITE_LOCKED ){ - raw_printf(stderr, "Error: source database is busy\n"); + eputz("Error: source database is busy\n"); rc = 1; }else{ - utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(p->db)); + eputf("Error: %s\n", sqlite3_errmsg(p->db)); rc = 1; } close_db(pSrc); @@ -25779,11 +28084,15 @@ static int do_meta_command(char *zLine, ShellState *p){ sqlite3_db_config( p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, p->scanstatsOn, (int*)0 ); -#ifndef SQLITE_ENABLE_STMT_SCANSTATUS - raw_printf(stderr, "Warning: .scanstats not available in this build.\n"); +#if !defined(SQLITE_ENABLE_STMT_SCANSTATUS) + eputz("Warning: .scanstats not available in this build.\n"); +#elif !defined(SQLITE_ENABLE_BYTECODE_VTAB) + if( p->scanstatsOn==3 ){ + eputz("Warning: \".scanstats vm\" not available in this build.\n"); + } #endif }else{ - raw_printf(stderr, "Usage: .scanstats on|off|est\n"); + eputz("Usage: .scanstats on|off|est\n"); rc = 1; } }else @@ -25812,14 +28121,13 @@ static int do_meta_command(char *zLine, ShellState *p){ }else if( optionMatch(azArg[ii],"nosys") ){ bNoSystemTabs = 1; }else if( azArg[ii][0]=='-' ){ - utf8_printf(stderr, "Unknown option: \"%s\"\n", azArg[ii]); + eputf("Unknown option: \"%s\"\n", azArg[ii]); rc = 1; goto meta_command_exit; }else if( zName==0 ){ zName = azArg[ii]; }else{ - raw_printf(stderr, - "Usage: .schema ?--indent? ?--nosys? ?LIKE-PATTERN?\n"); + eputz("Usage: .schema ?--indent? ?--nosys? ?LIKE-PATTERN?\n"); rc = 1; goto meta_command_exit; } @@ -25852,7 +28160,7 @@ static int do_meta_command(char *zLine, ShellState *p){ rc = sqlite3_prepare_v2(p->db, "SELECT name FROM pragma_database_list", -1, &pStmt, 0); if( rc ){ - utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(p->db)); + eputf("Error: %s\n", sqlite3_errmsg(p->db)); sqlite3_finalize(pStmt); rc = 1; goto meta_command_exit; @@ -25914,18 +28222,18 @@ static int do_meta_command(char *zLine, ShellState *p){ appendText(&sSelect, "sql IS NOT NULL" " ORDER BY snum, rowid", 0); if( bDebug ){ - utf8_printf(p->out, "SQL: %s;\n", sSelect.z); + oputf("SQL: %s;\n", sSelect.z); }else{ rc = sqlite3_exec(p->db, sSelect.z, callback, &data, &zErrMsg); } freeText(&sSelect); } if( zErrMsg ){ - utf8_printf(stderr,"Error: %s\n", zErrMsg); + eputf("Error: %s\n", zErrMsg); sqlite3_free(zErrMsg); rc = 1; }else if( rc != SQLITE_OK ){ - raw_printf(stderr,"Error: querying schema information\n"); + eputz("Error: querying schema information\n"); rc = 1; }else{ rc = 0; @@ -25971,11 +28279,11 @@ static int do_meta_command(char *zLine, ShellState *p){ if( nCmd!=2 ) goto session_syntax_error; if( pSession->p==0 ){ session_not_open: - raw_printf(stderr, "ERROR: No sessions are open\n"); + eputz("ERROR: No sessions are open\n"); }else{ rc = sqlite3session_attach(pSession->p, azCmd[1]); if( rc ){ - raw_printf(stderr, "ERROR: sqlite3session_attach() returns %d\n", rc); + eputf("ERROR: sqlite3session_attach() returns %d\n",rc); rc = 0; } } @@ -25994,8 +28302,8 @@ static int do_meta_command(char *zLine, ShellState *p){ if( pSession->p==0 ) goto session_not_open; out = fopen(azCmd[1], "wb"); if( out==0 ){ - utf8_printf(stderr, "ERROR: cannot open \"%s\" for writing\n", - azCmd[1]); + eputf("ERROR: cannot open \"%s\" for writing\n", + azCmd[1]); }else{ int szChng; void *pChng; @@ -26005,13 +28313,12 @@ static int do_meta_command(char *zLine, ShellState *p){ rc = sqlite3session_patchset(pSession->p, &szChng, &pChng); } if( rc ){ - printf("Error: error code %d\n", rc); + sputf(stdout, "Error: error code %d\n", rc); rc = 0; } if( pChng && fwrite(pChng, szChng, 1, out)!=1 ){ - raw_printf(stderr, "ERROR: Failed to write entire %d-byte output\n", - szChng); + eputf("ERROR: Failed to write entire %d-byte output\n", szChng); } sqlite3_free(pChng); fclose(out); @@ -26038,8 +28345,7 @@ static int do_meta_command(char *zLine, ShellState *p){ ii = nCmd==1 ? -1 : booleanValue(azCmd[1]); if( pAuxDb->nSession ){ ii = sqlite3session_enable(pSession->p, ii); - utf8_printf(p->out, "session %s enable flag = %d\n", - pSession->zName, ii); + oputf("session %s enable flag = %d\n", pSession->zName, ii); } }else @@ -26056,10 +28362,7 @@ static int do_meta_command(char *zLine, ShellState *p){ sqlite3_free(pSession->azFilter); nByte = sizeof(pSession->azFilter[0])*(nCmd-1); pSession->azFilter = sqlite3_malloc( nByte ); - if( pSession->azFilter==0 ){ - raw_printf(stderr, "Error: out or memory\n"); - exit(1); - } + shell_check_oom( pSession->azFilter ); for(ii=1; iiazFilter[ii-1] = sqlite3_mprintf("%s", azCmd[ii]); shell_check_oom(x); @@ -26077,8 +28380,7 @@ static int do_meta_command(char *zLine, ShellState *p){ ii = nCmd==1 ? -1 : booleanValue(azCmd[1]); if( pAuxDb->nSession ){ ii = sqlite3session_indirect(pSession->p, ii); - utf8_printf(p->out, "session %s indirect flag = %d\n", - pSession->zName, ii); + oputf("session %s indirect flag = %d\n", pSession->zName, ii); } }else @@ -26090,8 +28392,7 @@ static int do_meta_command(char *zLine, ShellState *p){ if( nCmd!=1 ) goto session_syntax_error; if( pAuxDb->nSession ){ ii = sqlite3session_isempty(pSession->p); - utf8_printf(p->out, "session %s isempty flag = %d\n", - pSession->zName, ii); + oputf("session %s isempty flag = %d\n", pSession->zName, ii); } }else @@ -26100,7 +28401,7 @@ static int do_meta_command(char *zLine, ShellState *p){ */ if( cli_strcmp(azCmd[0],"list")==0 ){ for(i=0; inSession; i++){ - utf8_printf(p->out, "%d %s\n", i, pAuxDb->aSession[i].zName); + oputf("%d %s\n", i, pAuxDb->aSession[i].zName); } }else @@ -26115,19 +28416,18 @@ static int do_meta_command(char *zLine, ShellState *p){ if( zName[0]==0 ) goto session_syntax_error; for(i=0; inSession; i++){ if( cli_strcmp(pAuxDb->aSession[i].zName,zName)==0 ){ - utf8_printf(stderr, "Session \"%s\" already exists\n", zName); + eputf("Session \"%s\" already exists\n", zName); goto meta_command_exit; } } if( pAuxDb->nSession>=ArraySize(pAuxDb->aSession) ){ - raw_printf(stderr, - "Maximum of %d sessions\n", ArraySize(pAuxDb->aSession)); + eputf("Maximum of %d sessions\n", ArraySize(pAuxDb->aSession)); goto meta_command_exit; } pSession = &pAuxDb->aSession[pAuxDb->nSession]; rc = sqlite3session_create(p->db, azCmd[1], &pSession->p); if( rc ){ - raw_printf(stderr, "Cannot open session: error code=%d\n", rc); + eputf("Cannot open session: error code=%d\n", rc); rc = 0; goto meta_command_exit; } @@ -26151,7 +28451,7 @@ static int do_meta_command(char *zLine, ShellState *p){ int i, v; for(i=1; iout, "%s: %d 0x%x\n", azArg[i], v, v); + oputf("%s: %d 0x%x\n", azArg[i], v, v); } } if( cli_strncmp(azArg[0]+9, "integer", n-9)==0 ){ @@ -26160,7 +28460,7 @@ static int do_meta_command(char *zLine, ShellState *p){ char zBuf[200]; v = integerValue(azArg[i]); sqlite3_snprintf(sizeof(zBuf),zBuf,"%s: %lld 0x%llx\n", azArg[i],v,v); - utf8_printf(p->out, "%s", zBuf); + oputz(zBuf); } } }else @@ -26187,9 +28487,8 @@ static int do_meta_command(char *zLine, ShellState *p){ bVerbose++; }else { - utf8_printf(stderr, "Unknown option \"%s\" on \"%s\"\n", - azArg[i], azArg[0]); - raw_printf(stderr, "Should be one of: --init -v\n"); + eputf("Unknown option \"%s\" on \"%s\"\n", azArg[i], azArg[0]); + eputz("Should be one of: --init -v\n"); rc = 1; goto meta_command_exit; } @@ -26218,7 +28517,7 @@ static int do_meta_command(char *zLine, ShellState *p){ -1, &pStmt, 0); } if( rc ){ - raw_printf(stderr, "Error querying the selftest table\n"); + eputz("Error querying the selftest table\n"); rc = 1; sqlite3_finalize(pStmt); goto meta_command_exit; @@ -26234,10 +28533,10 @@ static int do_meta_command(char *zLine, ShellState *p){ if( zAns==0 ) continue; k = 0; if( bVerbose>0 ){ - printf("%d: %s %s\n", tno, zOp, zSql); + sputf(stdout, "%d: %s %s\n", tno, zOp, zSql); } if( cli_strcmp(zOp,"memo")==0 ){ - utf8_printf(p->out, "%s\n", zSql); + oputf("%s\n", zSql); }else if( cli_strcmp(zOp,"run")==0 ){ char *zErrMsg = 0; @@ -26246,23 +28545,22 @@ static int do_meta_command(char *zLine, ShellState *p){ rc = sqlite3_exec(p->db, zSql, captureOutputCallback, &str, &zErrMsg); nTest++; if( bVerbose ){ - utf8_printf(p->out, "Result: %s\n", str.z); + oputf("Result: %s\n", str.z); } if( rc || zErrMsg ){ nErr++; rc = 1; - utf8_printf(p->out, "%d: error-code-%d: %s\n", tno, rc, zErrMsg); + oputf("%d: error-code-%d: %s\n", tno, rc, zErrMsg); sqlite3_free(zErrMsg); }else if( cli_strcmp(zAns,str.z)!=0 ){ nErr++; rc = 1; - utf8_printf(p->out, "%d: Expected: [%s]\n", tno, zAns); - utf8_printf(p->out, "%d: Got: [%s]\n", tno, str.z); + oputf("%d: Expected: [%s]\n", tno, zAns); + oputf("%d: Got: [%s]\n", tno, str.z); } - }else - { - utf8_printf(stderr, - "Unknown operation \"%s\" on selftest line %d\n", zOp, tno); + } + else{ + eputf("Unknown operation \"%s\" on selftest line %d\n", zOp, tno); rc = 1; break; } @@ -26270,12 +28568,12 @@ static int do_meta_command(char *zLine, ShellState *p){ sqlite3_finalize(pStmt); } /* End loop over k */ freeText(&str); - utf8_printf(p->out, "%d errors out of %d tests\n", nErr, nTest); + oputf("%d errors out of %d tests\n", nErr, nTest); }else if( c=='s' && cli_strncmp(azArg[0], "separator", n)==0 ){ if( nArg<2 || nArg>3 ){ - raw_printf(stderr, "Usage: .separator COL ?ROW?\n"); + eputz("Usage: .separator COL ?ROW?\n"); rc = 1; } if( nArg>=2 ){ @@ -26318,14 +28616,13 @@ static int do_meta_command(char *zLine, ShellState *p){ bDebug = 1; }else { - utf8_printf(stderr, "Unknown option \"%s\" on \"%s\"\n", - azArg[i], azArg[0]); + eputf("Unknown option \"%s\" on \"%s\"\n", azArg[i], azArg[0]); showHelp(p->out, azArg[0]); rc = 1; goto meta_command_exit; } }else if( zLike ){ - raw_printf(stderr, "Usage: .sha3sum ?OPTIONS? ?LIKE-PATTERN?\n"); + eputz("Usage: .sha3sum ?OPTIONS? ?LIKE-PATTERN?\n"); rc = 1; goto meta_command_exit; }else{ @@ -26397,7 +28694,7 @@ static int do_meta_command(char *zLine, ShellState *p){ freeText(&sQuery); freeText(&sSql); if( bDebug ){ - utf8_printf(p->out, "%s\n", zSql); + oputf("%s\n", zSql); }else{ shell_exec(p, zSql, 0); } @@ -26427,7 +28724,7 @@ static int do_meta_command(char *zLine, ShellState *p){ "' OR ') as query, tname from tabcols group by tname)" , zRevText); shell_check_oom(zRevText); - if( bDebug ) utf8_printf(p->out, "%s\n", zRevText); + if( bDebug ) oputf("%s\n", zRevText); lrc = sqlite3_prepare_v2(p->db, zRevText, -1, &pStmt, 0); if( lrc!=SQLITE_OK ){ /* assert(lrc==SQLITE_NOMEM); // might also be SQLITE_ERROR if the @@ -26440,7 +28737,7 @@ static int do_meta_command(char *zLine, ShellState *p){ const char *zGenQuery = (char*)sqlite3_column_text(pStmt,0); sqlite3_stmt *pCheckStmt; lrc = sqlite3_prepare_v2(p->db, zGenQuery, -1, &pCheckStmt, 0); - if( bDebug ) utf8_printf(p->out, "%s\n", zGenQuery); + if( bDebug ) oputf("%s\n", zGenQuery); if( lrc!=SQLITE_OK ){ rc = 1; }else{ @@ -26448,9 +28745,8 @@ static int do_meta_command(char *zLine, ShellState *p){ double countIrreversible = sqlite3_column_double(pCheckStmt, 0); if( countIrreversible>0 ){ int sz = (int)(countIrreversible + 0.5); - utf8_printf(stderr, - "Digest includes %d invalidly encoded text field%s.\n", - sz, (sz>1)? "s": ""); + eputf("Digest includes %d invalidly encoded text field%s.\n", + sz, (sz>1)? "s": ""); } } sqlite3_finalize(pCheckStmt); @@ -26458,7 +28754,7 @@ static int do_meta_command(char *zLine, ShellState *p){ sqlite3_finalize(pStmt); } } - if( rc ) utf8_printf(stderr, ".sha3sum failed.\n"); + if( rc ) eputz(".sha3sum failed.\n"); sqlite3_free(zRevText); } #endif /* !defined(*_OMIT_SCHEMA_PRAGMAS) && !defined(*_OMIT_VIRTUALTABLE) */ @@ -26474,7 +28770,7 @@ static int do_meta_command(char *zLine, ShellState *p){ int i, x; failIfSafeMode(p, "cannot run .%s in safe mode", azArg[0]); if( nArg<2 ){ - raw_printf(stderr, "Usage: .system COMMAND\n"); + eputz("Usage: .system COMMAND\n"); rc = 1; goto meta_command_exit; } @@ -26483,9 +28779,11 @@ static int do_meta_command(char *zLine, ShellState *p){ zCmd = sqlite3_mprintf(strchr(azArg[i],' ')==0?"%z %s":"%z \"%s\"", zCmd, azArg[i]); } + consoleRestore(); x = zCmd!=0 ? system(zCmd) : 1; + consoleRenewSetup(); sqlite3_free(zCmd); - if( x ) raw_printf(stderr, "System command returns %d\n", x); + if( x ) eputf("System command returns %d\n", x); }else #endif /* !defined(SQLITE_NOHAVE_SYSTEM) && !defined(SQLITE_SHELL_FIDDLE) */ @@ -26494,52 +28792,51 @@ static int do_meta_command(char *zLine, ShellState *p){ const char *zOut; int i; if( nArg!=1 ){ - raw_printf(stderr, "Usage: .show\n"); + eputz("Usage: .show\n"); rc = 1; goto meta_command_exit; } - utf8_printf(p->out, "%12.12s: %s\n","echo", - azBool[ShellHasFlag(p, SHFLG_Echo)]); - utf8_printf(p->out, "%12.12s: %s\n","eqp", azBool[p->autoEQP&3]); - utf8_printf(p->out, "%12.12s: %s\n","explain", - p->mode==MODE_Explain ? "on" : p->autoExplain ? "auto" : "off"); - utf8_printf(p->out,"%12.12s: %s\n","headers", azBool[p->showHeader!=0]); + oputf("%12.12s: %s\n","echo", + azBool[ShellHasFlag(p, SHFLG_Echo)]); + oputf("%12.12s: %s\n","eqp", azBool[p->autoEQP&3]); + oputf("%12.12s: %s\n","explain", + p->mode==MODE_Explain ? "on" : p->autoExplain ? "auto" : "off"); + oputf("%12.12s: %s\n","headers", azBool[p->showHeader!=0]); if( p->mode==MODE_Column || (p->mode>=MODE_Markdown && p->mode<=MODE_Box) ){ - utf8_printf - (p->out, "%12.12s: %s --wrap %d --wordwrap %s --%squote\n", "mode", - modeDescr[p->mode], p->cmOpts.iWrap, - p->cmOpts.bWordWrap ? "on" : "off", - p->cmOpts.bQuote ? "" : "no"); + oputf("%12.12s: %s --wrap %d --wordwrap %s --%squote\n", "mode", + modeDescr[p->mode], p->cmOpts.iWrap, + p->cmOpts.bWordWrap ? "on" : "off", + p->cmOpts.bQuote ? "" : "no"); }else{ - utf8_printf(p->out, "%12.12s: %s\n","mode", modeDescr[p->mode]); - } - utf8_printf(p->out, "%12.12s: ", "nullvalue"); - output_c_string(p->out, p->nullValue); - raw_printf(p->out, "\n"); - utf8_printf(p->out,"%12.12s: %s\n","output", - strlen30(p->outfile) ? p->outfile : "stdout"); - utf8_printf(p->out,"%12.12s: ", "colseparator"); - output_c_string(p->out, p->colSeparator); - raw_printf(p->out, "\n"); - utf8_printf(p->out,"%12.12s: ", "rowseparator"); - output_c_string(p->out, p->rowSeparator); - raw_printf(p->out, "\n"); + oputf("%12.12s: %s\n","mode", modeDescr[p->mode]); + } + oputf("%12.12s: ", "nullvalue"); + output_c_string(p->nullValue); + oputz("\n"); + oputf("%12.12s: %s\n","output", + strlen30(p->outfile) ? p->outfile : "stdout"); + oputf("%12.12s: ", "colseparator"); + output_c_string(p->colSeparator); + oputz("\n"); + oputf("%12.12s: ", "rowseparator"); + output_c_string(p->rowSeparator); + oputz("\n"); switch( p->statsOn ){ case 0: zOut = "off"; break; default: zOut = "on"; break; case 2: zOut = "stmt"; break; case 3: zOut = "vmstep"; break; } - utf8_printf(p->out, "%12.12s: %s\n","stats", zOut); - utf8_printf(p->out, "%12.12s: ", "width"); + oputf("%12.12s: %s\n","stats", zOut); + oputf("%12.12s: ", "width"); for (i=0;inWidth;i++) { - raw_printf(p->out, "%d ", p->colWidth[i]); + oputf("%d ", p->colWidth[i]); } - raw_printf(p->out, "\n"); - utf8_printf(p->out, "%12.12s: %s\n", "filename", - p->pAuxDb->zDbFilename ? p->pAuxDb->zDbFilename : ""); + oputz("\n"); + oputf("%12.12s: %s\n", "filename", + p->pAuxDb->zDbFilename ? p->pAuxDb->zDbFilename : ""); }else if( c=='s' && cli_strncmp(azArg[0], "stats", n)==0 ){ @@ -26554,7 +28851,7 @@ static int do_meta_command(char *zLine, ShellState *p){ }else if( nArg==1 ){ display_stats(p->db, p, 0); }else{ - raw_printf(stderr, "Usage: .stats ?on|off|stmt|vmstep?\n"); + eputz("Usage: .stats ?on|off|stmt|vmstep?\n"); rc = 1; } }else @@ -26580,7 +28877,7 @@ static int do_meta_command(char *zLine, ShellState *p){ /* It is an historical accident that the .indexes command shows an error ** when called with the wrong number of arguments whereas the .tables ** command does not. */ - raw_printf(stderr, "Usage: .indexes ?LIKE-PATTERN?\n"); + eputz("Usage: .indexes ?LIKE-PATTERN?\n"); rc = 1; sqlite3_finalize(pStmt); goto meta_command_exit; @@ -26656,10 +28953,9 @@ static int do_meta_command(char *zLine, ShellState *p){ for(i=0; iout, "%s%-*s", zSp, maxlen, - azResult[j] ? azResult[j]:""); + oputf("%s%-*s", zSp, maxlen, azResult[j] ? azResult[j]:""); } - raw_printf(p->out, "\n"); + oputz("\n"); } } @@ -26673,7 +28969,7 @@ static int do_meta_command(char *zLine, ShellState *p){ output_reset(p); p->out = output_file_open("testcase-out.txt", 0); if( p->out==0 ){ - raw_printf(stderr, "Error: cannot open 'testcase-out.txt'\n"); + eputz("Error: cannot open 'testcase-out.txt'\n"); } if( nArg>=2 ){ sqlite3_snprintf(sizeof(p->zTestcase), p->zTestcase, "%s", azArg[1]); @@ -26697,9 +28993,11 @@ static int do_meta_command(char *zLine, ShellState *p){ /*{"bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, 1, "" },*/ {"byteorder", SQLITE_TESTCTRL_BYTEORDER, 0, "" }, {"extra_schema_checks",SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS,0,"BOOLEAN" }, - /*{"fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, 1,"" },*/ + {"fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, 1,"args..." }, + {"fk_no_action", SQLITE_TESTCTRL_FK_NO_ACTION, 0, "BOOLEAN" }, {"imposter", SQLITE_TESTCTRL_IMPOSTER,1,"SCHEMA ON/OFF ROOTPAGE"}, {"internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS,0,"" }, + {"json_selfcheck", SQLITE_TESTCTRL_JSON_SELFCHECK ,0,"BOOLEAN" }, {"localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,0,"BOOLEAN" }, {"never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT,1, "BOOLEAN" }, {"optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS,0,"DISABLE-MASK" }, @@ -26713,7 +29011,7 @@ static int do_meta_command(char *zLine, ShellState *p){ {"seek_count", SQLITE_TESTCTRL_SEEK_COUNT, 0, "" }, {"sorter_mmap", SQLITE_TESTCTRL_SORTER_MMAP, 0, "NMAX" }, {"tune", SQLITE_TESTCTRL_TUNE, 1, "ID VALUE" }, - {"uselongdouble", SQLITE_TESTCTRL_USELONGDOUBLE,0,"?BOOLEAN|\"default\"?"}, + {"uselongdouble", SQLITE_TESTCTRL_USELONGDOUBLE,0,"?BOOLEAN|\"default\"?"}, }; int testctrl = -1; int iCtrl = -1; @@ -26733,11 +29031,11 @@ static int do_meta_command(char *zLine, ShellState *p){ /* --help lists all test-controls */ if( cli_strcmp(zCmd,"help")==0 ){ - utf8_printf(p->out, "Available test-controls:\n"); + oputz("Available test-controls:\n"); for(i=0; iout, " .testctrl %s %s\n", - aCtrl[i].zCtrlName, aCtrl[i].zUsage); + oputf(" .testctrl %s %s\n", + aCtrl[i].zCtrlName, aCtrl[i].zUsage); } rc = 1; goto meta_command_exit; @@ -26753,21 +29051,22 @@ static int do_meta_command(char *zLine, ShellState *p){ testctrl = aCtrl[i].ctrlCode; iCtrl = i; }else{ - utf8_printf(stderr, "Error: ambiguous test-control: \"%s\"\n" - "Use \".testctrl --help\" for help\n", zCmd); + eputf("Error: ambiguous test-control: \"%s\"\n" + "Use \".testctrl --help\" for help\n", zCmd); rc = 1; goto meta_command_exit; } } } if( testctrl<0 ){ - utf8_printf(stderr,"Error: unknown test-control: %s\n" - "Use \".testctrl --help\" for help\n", zCmd); + eputf("Error: unknown test-control: %s\n" + "Use \".testctrl --help\" for help\n", zCmd); }else{ switch(testctrl){ /* sqlite3_test_control(int, db, int) */ case SQLITE_TESTCTRL_OPTIMIZATIONS: + case SQLITE_TESTCTRL_FK_NO_ACTION: if( nArg==3 ){ unsigned int opt = (unsigned int)strtol(azArg[2], 0, 0); rc2 = sqlite3_test_control(testctrl, p->db, opt); @@ -26801,7 +29100,7 @@ static int do_meta_command(char *zLine, ShellState *p){ sqlite3 *db; if( ii==0 && cli_strcmp(azArg[2],"random")==0 ){ sqlite3_randomness(sizeof(ii),&ii); - printf("-- random seed: %d\n", ii); + sputf(stdout, "-- random seed: %d\n", ii); } if( nArg==3 ){ db = 0; @@ -26869,7 +29168,7 @@ static int do_meta_command(char *zLine, ShellState *p){ case SQLITE_TESTCTRL_SEEK_COUNT: { u64 x = 0; rc2 = sqlite3_test_control(testctrl, p->db, &x); - utf8_printf(p->out, "%llu\n", x); + oputf("%llu\n", x); isOk = 3; break; } @@ -26900,11 +29199,11 @@ static int do_meta_command(char *zLine, ShellState *p){ int val = 0; rc2 = sqlite3_test_control(testctrl, -id, &val); if( rc2!=SQLITE_OK ) break; - if( id>1 ) utf8_printf(p->out, " "); - utf8_printf(p->out, "%d: %d", id, val); + if( id>1 ) oputz(" "); + oputf("%d: %d", id, val); id++; } - if( id>1 ) utf8_printf(p->out, "\n"); + if( id>1 ) oputz("\n"); isOk = 3; } break; @@ -26917,15 +29216,95 @@ static int do_meta_command(char *zLine, ShellState *p){ isOk = 3; } break; + case SQLITE_TESTCTRL_JSON_SELFCHECK: + if( nArg==2 ){ + rc2 = -1; + isOk = 1; + }else{ + rc2 = booleanValue(azArg[2]); + isOk = 3; + } + sqlite3_test_control(testctrl, &rc2); + break; + case SQLITE_TESTCTRL_FAULT_INSTALL: { + int kk; + int bShowHelp = nArg<=2; + isOk = 3; + for(kk=2; kk0 ) faultsim_state.eVerbose--; + }else if( cli_strcmp(z,"-id")==0 && kk+1=0 ){ - utf8_printf(p->out, "Usage: .testctrl %s %s\n", zCmd,aCtrl[iCtrl].zUsage); + oputf("Usage: .testctrl %s %s\n", zCmd,aCtrl[iCtrl].zUsage); rc = 1; }else if( isOk==1 ){ - raw_printf(p->out, "%d\n", rc2); + oputf("%d\n", rc2); }else if( isOk==2 ){ - raw_printf(p->out, "0x%08x\n", rc2); + oputf("0x%08x\n", rc2); } }else #endif /* !defined(SQLITE_UNTESTABLE) */ @@ -26939,11 +29318,11 @@ static int do_meta_command(char *zLine, ShellState *p){ if( nArg==2 ){ enableTimer = booleanValue(azArg[1]); if( enableTimer && !HAS_TIMER ){ - raw_printf(stderr, "Error: timer not available on this system.\n"); + eputz("Error: timer not available on this system.\n"); enableTimer = 0; } }else{ - raw_printf(stderr, "Usage: .timer on|off\n"); + eputz("Usage: .timer on|off\n"); rc = 1; } }else @@ -26980,7 +29359,7 @@ static int do_meta_command(char *zLine, ShellState *p){ mType |= SQLITE_TRACE_CLOSE; } else { - raw_printf(stderr, "Unknown option \"%s\" on \".trace\"\n", z); + eputf("Unknown option \"%s\" on \".trace\"\n", z); rc = 1; goto meta_command_exit; } @@ -27004,7 +29383,7 @@ static int do_meta_command(char *zLine, ShellState *p){ int lenOpt; char *zOpt; if( nArg<2 ){ - raw_printf(stderr, "Usage: .unmodule [--allexcept] NAME ...\n"); + eputz("Usage: .unmodule [--allexcept] NAME ...\n"); rc = 1; goto meta_command_exit; } @@ -27026,60 +29405,60 @@ static int do_meta_command(char *zLine, ShellState *p){ #if SQLITE_USER_AUTHENTICATION if( c=='u' && cli_strncmp(azArg[0], "user", n)==0 ){ if( nArg<2 ){ - raw_printf(stderr, "Usage: .user SUBCOMMAND ...\n"); + eputz("Usage: .user SUBCOMMAND ...\n"); rc = 1; goto meta_command_exit; } open_db(p, 0); if( cli_strcmp(azArg[1],"login")==0 ){ if( nArg!=4 ){ - raw_printf(stderr, "Usage: .user login USER PASSWORD\n"); + eputz("Usage: .user login USER PASSWORD\n"); rc = 1; goto meta_command_exit; } rc = sqlite3_user_authenticate(p->db, azArg[2], azArg[3], strlen30(azArg[3])); if( rc ){ - utf8_printf(stderr, "Authentication failed for user %s\n", azArg[2]); + eputf("Authentication failed for user %s\n", azArg[2]); rc = 1; } }else if( cli_strcmp(azArg[1],"add")==0 ){ if( nArg!=5 ){ - raw_printf(stderr, "Usage: .user add USER PASSWORD ISADMIN\n"); + eputz("Usage: .user add USER PASSWORD ISADMIN\n"); rc = 1; goto meta_command_exit; } rc = sqlite3_user_add(p->db, azArg[2], azArg[3], strlen30(azArg[3]), booleanValue(azArg[4])); if( rc ){ - raw_printf(stderr, "User-Add failed: %d\n", rc); + eputf("User-Add failed: %d\n", rc); rc = 1; } }else if( cli_strcmp(azArg[1],"edit")==0 ){ if( nArg!=5 ){ - raw_printf(stderr, "Usage: .user edit USER PASSWORD ISADMIN\n"); + eputz("Usage: .user edit USER PASSWORD ISADMIN\n"); rc = 1; goto meta_command_exit; } rc = sqlite3_user_change(p->db, azArg[2], azArg[3], strlen30(azArg[3]), booleanValue(azArg[4])); if( rc ){ - raw_printf(stderr, "User-Edit failed: %d\n", rc); + eputf("User-Edit failed: %d\n", rc); rc = 1; } }else if( cli_strcmp(azArg[1],"delete")==0 ){ if( nArg!=3 ){ - raw_printf(stderr, "Usage: .user delete USER\n"); + eputz("Usage: .user delete USER\n"); rc = 1; goto meta_command_exit; } rc = sqlite3_user_delete(p->db, azArg[2]); if( rc ){ - raw_printf(stderr, "User-Delete failed: %d\n", rc); + eputf("User-Delete failed: %d\n", rc); rc = 1; } }else{ - raw_printf(stderr, "Usage: .user login|add|edit|delete ...\n"); + eputz("Usage: .user login|add|edit|delete ...\n"); rc = 1; goto meta_command_exit; } @@ -27088,21 +29467,21 @@ static int do_meta_command(char *zLine, ShellState *p){ if( c=='v' && cli_strncmp(azArg[0], "version", n)==0 ){ char *zPtrSz = sizeof(void*)==8 ? "64-bit" : "32-bit"; - utf8_printf(p->out, "SQLite %s %s\n" /*extra-version-info*/, - sqlite3_libversion(), sqlite3_sourceid()); + oputf("SQLite %s %s\n" /*extra-version-info*/, + sqlite3_libversion(), sqlite3_sourceid()); #if SQLITE_HAVE_ZLIB - utf8_printf(p->out, "zlib version %s\n", zlibVersion()); + oputf("zlib version %s\n", zlibVersion()); #endif #define CTIMEOPT_VAL_(opt) #opt #define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt) #if defined(__clang__) && defined(__clang_major__) - utf8_printf(p->out, "clang-" CTIMEOPT_VAL(__clang_major__) "." - CTIMEOPT_VAL(__clang_minor__) "." - CTIMEOPT_VAL(__clang_patchlevel__) " (%s)\n", zPtrSz); + oputf("clang-" CTIMEOPT_VAL(__clang_major__) "." + CTIMEOPT_VAL(__clang_minor__) "." + CTIMEOPT_VAL(__clang_patchlevel__) " (%s)\n", zPtrSz); #elif defined(_MSC_VER) - utf8_printf(p->out, "msvc-" CTIMEOPT_VAL(_MSC_VER) " (%s)\n", zPtrSz); + oputf("msvc-" CTIMEOPT_VAL(_MSC_VER) " (%s)\n", zPtrSz); #elif defined(__GNUC__) && defined(__VERSION__) - utf8_printf(p->out, "gcc-" __VERSION__ " (%s)\n", zPtrSz); + oputf("gcc-" __VERSION__ " (%s)\n", zPtrSz); #endif }else @@ -27112,10 +29491,10 @@ static int do_meta_command(char *zLine, ShellState *p){ if( p->db ){ sqlite3_file_control(p->db, zDbName, SQLITE_FCNTL_VFS_POINTER, &pVfs); if( pVfs ){ - utf8_printf(p->out, "vfs.zName = \"%s\"\n", pVfs->zName); - raw_printf(p->out, "vfs.iVersion = %d\n", pVfs->iVersion); - raw_printf(p->out, "vfs.szOsFile = %d\n", pVfs->szOsFile); - raw_printf(p->out, "vfs.mxPathname = %d\n", pVfs->mxPathname); + oputf("vfs.zName = \"%s\"\n", pVfs->zName); + oputf("vfs.iVersion = %d\n", pVfs->iVersion); + oputf("vfs.szOsFile = %d\n", pVfs->szOsFile); + oputf("vfs.mxPathname = %d\n", pVfs->mxPathname); } } }else @@ -27127,13 +29506,13 @@ static int do_meta_command(char *zLine, ShellState *p){ sqlite3_file_control(p->db, "main", SQLITE_FCNTL_VFS_POINTER, &pCurrent); } for(pVfs=sqlite3_vfs_find(0); pVfs; pVfs=pVfs->pNext){ - utf8_printf(p->out, "vfs.zName = \"%s\"%s\n", pVfs->zName, - pVfs==pCurrent ? " <--- CURRENT" : ""); - raw_printf(p->out, "vfs.iVersion = %d\n", pVfs->iVersion); - raw_printf(p->out, "vfs.szOsFile = %d\n", pVfs->szOsFile); - raw_printf(p->out, "vfs.mxPathname = %d\n", pVfs->mxPathname); + oputf("vfs.zName = \"%s\"%s\n", pVfs->zName, + pVfs==pCurrent ? " <--- CURRENT" : ""); + oputf("vfs.iVersion = %d\n", pVfs->iVersion); + oputf("vfs.szOsFile = %d\n", pVfs->szOsFile); + oputf("vfs.mxPathname = %d\n", pVfs->mxPathname); if( pVfs->pNext ){ - raw_printf(p->out, "-----------------------------------\n"); + oputz("-----------------------------------\n"); } } }else @@ -27144,7 +29523,7 @@ static int do_meta_command(char *zLine, ShellState *p){ if( p->db ){ sqlite3_file_control(p->db, zDbName, SQLITE_FCNTL_VFSNAME, &zVfsName); if( zVfsName ){ - utf8_printf(p->out, "%s\n", zVfsName); + oputf("%s\n", zVfsName); sqlite3_free(zVfsName); } } @@ -27168,8 +29547,8 @@ static int do_meta_command(char *zLine, ShellState *p){ }else { - utf8_printf(stderr, "Error: unknown command or invalid arguments: " - " \"%s\". Enter \".help\" for help\n", azArg[0]); + eputf("Error: unknown command or invalid arguments: " + " \"%s\". Enter \".help\" for help\n", azArg[0]); rc = 1; } @@ -27323,6 +29702,88 @@ static int line_is_complete(char *zSql, int nSql){ return rc; } +/* +** This function is called after processing each line of SQL in the +** runOneSqlLine() function. Its purpose is to detect scenarios where +** defensive mode should be automatically turned off. Specifically, when +** +** 1. The first line of input is "PRAGMA foreign_keys=OFF;", +** 2. The second line of input is "BEGIN TRANSACTION;", +** 3. The database is empty, and +** 4. The shell is not running in --safe mode. +** +** The implementation uses the ShellState.eRestoreState to maintain state: +** +** 0: Have not seen any SQL. +** 1: Have seen "PRAGMA foreign_keys=OFF;". +** 2-6: Currently running .dump transaction. If the "2" bit is set, +** disable DEFENSIVE when done. If "4" is set, disable DQS_DDL. +** 7: Nothing left to do. This function becomes a no-op. +*/ +static int doAutoDetectRestore(ShellState *p, const char *zSql){ + int rc = SQLITE_OK; + + if( p->eRestoreState<7 ){ + switch( p->eRestoreState ){ + case 0: { + const char *zExpect = "PRAGMA foreign_keys=OFF;"; + assert( strlen(zExpect)==24 ); + if( p->bSafeMode==0 && memcmp(zSql, zExpect, 25)==0 ){ + p->eRestoreState = 1; + }else{ + p->eRestoreState = 7; + } + break; + }; + + case 1: { + int bIsDump = 0; + const char *zExpect = "BEGIN TRANSACTION;"; + assert( strlen(zExpect)==18 ); + if( memcmp(zSql, zExpect, 19)==0 ){ + /* Now check if the database is empty. */ + const char *zQuery = "SELECT 1 FROM sqlite_schema LIMIT 1"; + sqlite3_stmt *pStmt = 0; + + bIsDump = 1; + shellPrepare(p->db, &rc, zQuery, &pStmt); + if( rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW ){ + bIsDump = 0; + } + shellFinalize(&rc, pStmt); + } + if( bIsDump && rc==SQLITE_OK ){ + int bDefense = 0; + int bDqsDdl = 0; + sqlite3_db_config(p->db, SQLITE_DBCONFIG_DEFENSIVE, -1, &bDefense); + sqlite3_db_config(p->db, SQLITE_DBCONFIG_DQS_DDL, -1, &bDqsDdl); + sqlite3_db_config(p->db, SQLITE_DBCONFIG_DEFENSIVE, 0, 0); + sqlite3_db_config(p->db, SQLITE_DBCONFIG_DQS_DDL, 1, 0); + p->eRestoreState = (bDefense ? 2 : 0) + (bDqsDdl ? 4 : 0); + }else{ + p->eRestoreState = 7; + } + break; + } + + default: { + if( sqlite3_get_autocommit(p->db) ){ + if( (p->eRestoreState & 2) ){ + sqlite3_db_config(p->db, SQLITE_DBCONFIG_DEFENSIVE, 1, 0); + } + if( (p->eRestoreState & 4) ){ + sqlite3_db_config(p->db, SQLITE_DBCONFIG_DQS_DDL, 0, 0); + } + p->eRestoreState = 7; + } + break; + } + } + } + + return rc; +} + /* ** Run a single line of SQL. Return the number of errors. */ @@ -27359,7 +29820,7 @@ static int runOneSqlLine(ShellState *p, char *zSql, FILE *in, int startline){ }else{ sqlite3_snprintf(sizeof(zPrefix), zPrefix, "%s:", zErrorType); } - utf8_printf(stderr, "%s %s\n", zPrefix, zErrorTail); + eputf("%s %s\n", zPrefix, zErrorTail); sqlite3_free(zErrMsg); zErrMsg = 0; return 1; @@ -27368,13 +29829,15 @@ static int runOneSqlLine(ShellState *p, char *zSql, FILE *in, int startline){ sqlite3_snprintf(sizeof(zLineBuf), zLineBuf, "changes: %lld total_changes: %lld", sqlite3_changes64(p->db), sqlite3_total_changes64(p->db)); - raw_printf(p->out, "%s\n", zLineBuf); + oputf("%s\n", zLineBuf); } + + if( doAutoDetectRestore(p, zSql) ) return 1; return 0; } static void echo_group_input(ShellState *p, const char *zDo){ - if( ShellHasFlag(p, SHFLG_Echo) ) utf8_printf(p->out, "%s\n", zDo); + if( ShellHasFlag(p, SHFLG_Echo) ) oputf("%s\n", zDo); } #ifdef SQLITE_SHELL_FIDDLE @@ -27432,8 +29895,8 @@ static int process_input(ShellState *p){ if( p->inputNesting==MAX_INPUT_NESTING ){ /* This will be more informative in a later version. */ - utf8_printf(stderr,"Input nesting limit (%d) reached at line %d." - " Check recursion.\n", MAX_INPUT_NESTING, p->lineno); + eputf("Input nesting limit (%d) reached at line %d." + " Check recursion.\n", MAX_INPUT_NESTING, p->lineno); return 1; } ++p->inputNesting; @@ -27444,7 +29907,7 @@ static int process_input(ShellState *p){ zLine = one_input_line(p->in, zLine, nSql>0); if( zLine==0 ){ /* End of input */ - if( p->in==0 && stdin_is_interactive ) printf("\n"); + if( p->in==0 && stdin_is_interactive ) oputz("\n"); break; } if( seenInterrupt ){ @@ -27654,8 +30117,8 @@ static void process_sqliterc( if( sqliterc == NULL ){ home_dir = find_home_dir(0); if( home_dir==0 ){ - raw_printf(stderr, "-- warning: cannot find home directory;" - " cannot read ~/.sqliterc\n"); + eputz("-- warning: cannot find home directory;" + " cannot read ~/.sqliterc\n"); return; } zBuf = sqlite3_mprintf("%s/.sqliterc",home_dir); @@ -27665,12 +30128,12 @@ static void process_sqliterc( p->in = fopen(sqliterc,"rb"); if( p->in ){ if( stdin_is_interactive ){ - utf8_printf(stderr,"-- Loading resources from %s\n",sqliterc); + eputf("-- Loading resources from %s\n", sqliterc); } if( process_input(p) && bail_on_error ) exit(1); fclose(p->in); }else if( sqliterc_override!=0 ){ - utf8_printf(stderr,"cannot open: \"%s\"\n", sqliterc); + eputf("cannot open: \"%s\"\n", sqliterc); if( bail_on_error ) exit(1); } p->in = inSaved; @@ -27722,6 +30185,7 @@ static const char zOptions[] = " -newline SEP set output row separator. Default: '\\n'\n" " -nofollow refuse to open symbolic links to database files\n" " -nonce STRING set the safe-mode escape nonce\n" + " -no-rowid-in-view Disable rowid-in-view using sqlite3_config()\n" " -nullvalue TEXT set text string for NULL values. Default ''\n" " -pagecache SIZE N use N slots of SZ bytes each for page cache memory\n" " -pcachetrace trace all page cache operations\n" @@ -27736,9 +30200,6 @@ static const char zOptions[] = " -table set output mode to 'table'\n" " -tabs set output mode to 'tabs'\n" " -unsafe-testing allow unsafe commands and modes for testing\n" -#if SHELL_WIN_UTF8_OPT - " -utf8 setup interactive console code page for UTF-8\n" -#endif " -version show SQLite version\n" " -vfs NAME use NAME as the default VFS\n" #ifdef SQLITE_ENABLE_VFSTRACE @@ -27749,16 +30210,15 @@ static const char zOptions[] = #endif ; static void usage(int showDetail){ - utf8_printf(stderr, - "Usage: %s [OPTIONS] [FILENAME [SQL]]\n" - "FILENAME is the name of an SQLite database. A new database is created\n" - "if the file does not previously exist. Defaults to :memory:.\n", Argv0); + eputf("Usage: %s [OPTIONS] [FILENAME [SQL]]\n" + "FILENAME is the name of an SQLite database. A new database is created\n" + "if the file does not previously exist. Defaults to :memory:.\n", Argv0); if( showDetail ){ - utf8_printf(stderr, "OPTIONS include:\n%s", zOptions); + eputf("OPTIONS include:\n%s", zOptions); }else{ - raw_printf(stderr, "Use the -help option for additional information\n"); + eputz("Use the -help option for additional information\n"); } - exit(1); + exit(0); } /* @@ -27767,8 +30227,8 @@ static void usage(int showDetail){ */ static void verify_uninitialized(void){ if( sqlite3_config(-1)==SQLITE_MISUSE ){ - utf8_printf(stdout, "WARNING: attempt to configure SQLite after" - " initialization.\n"); + sputz(stdout, "WARNING: attempt to configure SQLite after" + " initialization.\n"); } } @@ -27797,7 +30257,7 @@ static void main_init(ShellState *data) { /* ** Output text to the console in a font that attracts extra attention. */ -#ifdef _WIN32 +#if defined(_WIN32) || defined(WIN32) static void printBold(const char *zText){ #if !SQLITE_OS_WINRT HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE); @@ -27807,14 +30267,14 @@ static void printBold(const char *zText){ FOREGROUND_RED|FOREGROUND_INTENSITY ); #endif - printf("%s", zText); + sputz(stdout, zText); #if !SQLITE_OS_WINRT SetConsoleTextAttribute(out, defaultScreenInfo.wAttributes); #endif } #else static void printBold(const char *zText){ - printf("\033[1m%s\033[0m", zText); + sputf(stdout, "\033[1m%s\033[0m", zText); } #endif @@ -27824,15 +30284,14 @@ static void printBold(const char *zText){ */ static char *cmdline_option_value(int argc, char **argv, int i){ if( i==argc ){ - utf8_printf(stderr, "%s: Error: missing argument to %s\n", - argv[0], argv[argc-1]); + eputf("%s: Error: missing argument to %s\n", argv[0], argv[argc-1]); exit(1); } return argv[i]; } static void sayAbnormalExit(void){ - if( seenInterrupt ) fprintf(stderr, "Program interrupted.\n"); + if( seenInterrupt ) eputz("Program interrupted.\n"); } #ifndef SQLITE_SHELL_IS_UTF8 @@ -27862,6 +30321,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ # define data shellState #else ShellState data; + StreamsAreConsole consStreams = SAC_NoConsole; #endif const char *zInitFile = 0; int i; @@ -27883,11 +30343,10 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ stdout_is_console = 1; data.wasm.zDefaultDbName = "/fiddle.sqlite3"; #else - stdin_is_interactive = isatty(0); - stdout_is_console = isatty(1); -#endif -#if SHELL_WIN_UTF8_OPT - atexit(console_restore); /* Needs revision for CLI as library call */ + consStreams = consoleClassifySetup(stdin, stdout, stderr); + stdin_is_interactive = (consStreams & SAC_InConsole)!=0; + stdout_is_console = (consStreams & SAC_OutConsole)!=0; + atexit(consoleRestore); #endif atexit(sayAbnormalExit); #ifdef SQLITE_DEBUG @@ -27896,9 +30355,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ #if !defined(_WIN32_WCE) if( getenv("SQLITE_DEBUG_BREAK") ){ if( isatty(0) && isatty(2) ){ - fprintf(stderr, - "attach debugger to process %d and press any key to continue.\n", - GETPID()); + eputf("attach debugger to process %d and press any key to continue.\n", + GETPID()); fgetc(stdin); }else{ #if defined(_WIN32) || defined(WIN32) @@ -27918,14 +30376,14 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ signal(SIGINT, interrupt_handler); #elif (defined(_WIN32) || defined(WIN32)) && !defined(_WIN32_WCE) if( !SetConsoleCtrlHandler(ConsoleCtrlHandler, TRUE) ){ - fprintf(stderr, "No ^C handler.\n"); + eputz("No ^C handler.\n"); } #endif #if USE_SYSTEM_SQLITE+0!=1 if( cli_strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,60)!=0 ){ - utf8_printf(stderr, "SQLite header and source version mismatch\n%s\n%s\n", - sqlite3_sourceid(), SQLITE_SOURCE_ID); + eputf("SQLite header and source version mismatch\n%s\n%s\n", + sqlite3_sourceid(), SQLITE_SOURCE_ID); exit(1); } #endif @@ -27974,8 +30432,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ /* Do an initial pass through the command-line argument to locate ** the name of the database file, the name of the initialization file, - ** the size of the alternative malloc heap, - ** and the first command to execute. + ** the size of the alternative malloc heap, options affecting commands + ** or SQL run from the command line, and the first command to execute. */ #ifndef SQLITE_SHELL_FIDDLE verify_uninitialized(); @@ -28009,12 +30467,19 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ (void)cmdline_option_value(argc, argv, ++i); }else if( cli_strcmp(z,"-init")==0 ){ zInitFile = cmdline_option_value(argc, argv, ++i); + }else if( cli_strcmp(z,"-interactive")==0 ){ }else if( cli_strcmp(z,"-batch")==0 ){ /* Need to check for batch mode here to so we can avoid printing ** informational messages (like from process_sqliterc) before ** we do the actual processing of arguments later in a second pass. */ stdin_is_interactive = 0; + }else if( cli_strcmp(z,"-utf8")==0 ){ + }else if( cli_strcmp(z,"-no-utf8")==0 ){ + }else if( cli_strcmp(z,"-no-rowid-in-view")==0 ){ + int val = 0; + sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW, &val); + assert( val==0 ); }else if( cli_strcmp(z,"-heap")==0 ){ #if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5) const char *zSize; @@ -28149,7 +30614,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ if( pVfs ){ sqlite3_vfs_register(pVfs, 1); }else{ - utf8_printf(stderr, "no such VFS: \"%s\"\n", zVfs); + eputf("no such VFS: \"%s\"\n", zVfs); exit(1); } } @@ -28159,7 +30624,7 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ data.pAuxDb->zDbFilename = ":memory:"; warnInmemoryDb = argc==1; #else - utf8_printf(stderr,"%s: Error: no database filename specified\n", Argv0); + eputf("%s: Error: no database filename specified\n", Argv0); return 1; #endif } @@ -28276,17 +30741,22 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ }else if( cli_strcmp(z,"-bail")==0 ){ /* No-op. The bail_on_error flag should already be set. */ }else if( cli_strcmp(z,"-version")==0 ){ - printf("%s %s (%d-bit)\n", sqlite3_libversion(), sqlite3_sourceid(), - 8*(int)sizeof(char*)); + sputf(stdout, "%s %s (%d-bit)\n", + sqlite3_libversion(), sqlite3_sourceid(), 8*(int)sizeof(char*)); return 0; }else if( cli_strcmp(z,"-interactive")==0 ){ + /* Need to check for interactive override here to so that it can + ** affect console setup (for Windows only) and testing thereof. + */ stdin_is_interactive = 1; }else if( cli_strcmp(z,"-batch")==0 ){ - stdin_is_interactive = 0; + /* already handled */ }else if( cli_strcmp(z,"-utf8")==0 ){ -#if SHELL_WIN_UTF8_OPT - console_utf8 = 1; -#endif /* SHELL_WIN_UTF8_OPT */ + /* already handled */ + }else if( cli_strcmp(z,"-no-utf8")==0 ){ + /* already handled */ + }else if( cli_strcmp(z,"-no-rowid-in-view")==0 ){ + /* already handled */ }else if( cli_strcmp(z,"-heap")==0 ){ i++; }else if( cli_strcmp(z,"-pagecache")==0 ){ @@ -28333,18 +30803,18 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ open_db(&data, 0); rc = shell_exec(&data, z, &zErrMsg); if( zErrMsg!=0 ){ - utf8_printf(stderr,"Error: %s\n", zErrMsg); + eputf("Error: %s\n", zErrMsg); if( bail_on_error ) return rc!=0 ? rc : 1; }else if( rc!=0 ){ - utf8_printf(stderr,"Error: unable to process SQL \"%s\"\n", z); + eputf("Error: unable to process SQL \"%s\"\n", z); if( bail_on_error ) return rc; } } #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) }else if( cli_strncmp(z, "-A", 2)==0 ){ if( nCmd>0 ){ - utf8_printf(stderr, "Error: cannot mix regular SQL or dot-commands" - " with \"%s\"\n", z); + eputf("Error: cannot mix regular SQL or dot-commands" + " with \"%s\"\n", z); return 1; } open_db(&data, OPEN_DB_ZIPFILE); @@ -28362,20 +30832,12 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ }else if( cli_strcmp(z,"-unsafe-testing")==0 ){ /* Acted upon in first pass. */ }else{ - utf8_printf(stderr,"%s: Error: unknown option: %s\n", Argv0, z); - raw_printf(stderr,"Use -help for a list of options.\n"); + eputf("%s: Error: unknown option: %s\n", Argv0, z); + eputz("Use -help for a list of options.\n"); return 1; } data.cMode = data.mode; } -#if SHELL_WIN_UTF8_OPT - if( console_utf8 && stdin_is_interactive ){ - console_prepare(); - }else{ - setBinaryMode(stdin, 0); - console_utf8 = 0; - } -#endif if( !readStdin ){ /* Run all arguments that do not begin with '-' as if they were separate @@ -28395,9 +30857,9 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ rc = shell_exec(&data, azCmd[i], &zErrMsg); if( zErrMsg || rc ){ if( zErrMsg!=0 ){ - utf8_printf(stderr,"Error: %s\n", zErrMsg); + eputf("Error: %s\n", zErrMsg); }else{ - utf8_printf(stderr,"Error: unable to process SQL: %s\n", azCmd[i]); + eputf("Error: unable to process SQL: %s\n", azCmd[i]); } sqlite3_free(zErrMsg); free(azCmd); @@ -28412,16 +30874,19 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ char *zHome; char *zHistory; int nHistory; - printf( - "SQLite version %s %.19s\n" /*extra-version-info*/ - "Enter \".help\" for usage hints.\n", - sqlite3_libversion(), sqlite3_sourceid() - ); +#if CIO_WIN_WC_XLATE +# define SHELL_CIO_CHAR_SET (stdout_is_console? " (UTF-16 console I/O)" : "") +#else +# define SHELL_CIO_CHAR_SET "" +#endif + sputf(stdout, "SQLite version %s %.19s%s\n" /*extra-version-info*/ + "Enter \".help\" for usage hints.\n", + sqlite3_libversion(), sqlite3_sourceid(), SHELL_CIO_CHAR_SET); if( warnInmemoryDb ){ - printf("Connected to a "); + sputz(stdout, "Connected to a "); printBold("transient in-memory database"); - printf(".\nUse \".open FILENAME\" to reopen on a " - "persistent database.\n"); + sputz(stdout, ".\nUse \".open FILENAME\" to reopen on a" + " persistent database.\n"); } zHistory = getenv("SQLITE_HISTORY"); if( zHistory ){ @@ -28453,6 +30918,11 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ #ifndef SQLITE_SHELL_FIDDLE /* In WASM mode we have to leave the db state in place so that ** client code can "push" SQL into it after this call returns. */ +#ifndef SQLITE_OMIT_VIRTUALTABLE + if( data.expert.pExpert ){ + expertFinish(&data, 1, 0); + } +#endif free(azCmd); set_table_name(&data, 0); if( data.db ){ @@ -28481,8 +30951,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ memset(&data, 0, sizeof(data)); #ifdef SQLITE_DEBUG if( sqlite3_memory_used()>mem_main_enter ){ - utf8_printf(stderr, "Memory leaked: %u bytes\n", - (unsigned int)(sqlite3_memory_used()-mem_main_enter)); + eputf("Memory leaked: %u bytes\n", + (unsigned int)(sqlite3_memory_used()-mem_main_enter)); } #endif #endif /* !SQLITE_SHELL_FIDDLE */ @@ -28519,7 +30989,7 @@ sqlite3_vfs * fiddle_db_vfs(const char *zDbName){ /* Only for emcc experimentation purposes. */ sqlite3 * fiddle_db_arg(sqlite3 *arg){ - printf("fiddle_db_arg(%p)\n", (const void*)arg); + oputf("fiddle_db_arg(%p)\n", (const void*)arg); return arg; } @@ -28545,12 +31015,22 @@ const char * fiddle_db_filename(const char * zDbName){ /* ** Completely wipes out the contents of the currently-opened database -** but leaves its storage intact for reuse. +** but leaves its storage intact for reuse. If any transactions are +** active, they are forcibly rolled back. */ void fiddle_reset_db(void){ if( globalDb ){ - int rc = sqlite3_db_config(globalDb, SQLITE_DBCONFIG_RESET_DATABASE, 1, 0); - if( 0==rc ) rc = sqlite3_exec(globalDb, "VACUUM", 0, 0, 0); + int rc; + while( sqlite3_txn_state(globalDb,0)>0 ){ + /* + ** Resolve problem reported in + ** https://sqlite.org/forum/forumpost/0b41a25d65 + */ + oputz("Rolling back in-progress transaction.\n"); + sqlite3_exec(globalDb,"ROLLBACK", 0, 0, 0); + } + rc = sqlite3_db_config(globalDb, SQLITE_DBCONFIG_RESET_DATABASE, 1, 0); + if( 0==rc ) sqlite3_exec(globalDb, "VACUUM", 0, 0, 0); sqlite3_db_config(globalDb, SQLITE_DBCONFIG_RESET_DATABASE, 0, 0); } } diff --git a/src/sqlite/SQLite-3.43.1/sqlite3.1 b/src/sqlite/SQLite-3.46.0/sqlite3.1 similarity index 100% rename from src/sqlite/SQLite-3.43.1/sqlite3.1 rename to src/sqlite/SQLite-3.46.0/sqlite3.1 diff --git a/src/sqlite/SQLite-3.43.1/sqlite3.c b/src/sqlite/SQLite-3.46.0/sqlite3.c similarity index 94% rename from src/sqlite/SQLite-3.43.1/sqlite3.c rename to src/sqlite/SQLite-3.46.0/sqlite3.c index 1884b0823..eaa24a131 100644 --- a/src/sqlite/SQLite-3.43.1/sqlite3.c +++ b/src/sqlite/SQLite-3.46.0/sqlite3.c @@ -1,6 +1,6 @@ /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.43.1. By combining all the individual C code files into this +** version 3.46.0. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -18,7 +18,7 @@ ** separate file. This file contains only code for the core SQLite library. ** ** The content in this amalgamation comes from Fossil check-in -** d3a40c05c49e1a49264912b1a05bc2143ac. +** 96c92aba00c8375bc32fafcdf12429c58bd8. */ #define SQLITE_CORE 1 #define SQLITE_AMALGAMATION 1 @@ -459,9 +459,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.43.1" -#define SQLITE_VERSION_NUMBER 3043001 -#define SQLITE_SOURCE_ID "2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0" +#define SQLITE_VERSION "3.46.0" +#define SQLITE_VERSION_NUMBER 3046000 +#define SQLITE_SOURCE_ID "2024-05-23 13:25:27 96c92aba00c8375bc32fafcdf12429c58bd8aabfcadab6683e35bbb9cdebf19e" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -733,6 +733,8 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**); ** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running. **
  • The application must not modify the SQL statement text passed into ** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running. +**
  • The application must not dereference the arrays or string pointers +** passed as the 3rd and 4th callback parameters after it returns. ** */ SQLITE_API int sqlite3_exec( @@ -1075,11 +1077,11 @@ struct sqlite3_file { ** ** xLock() upgrades the database file lock. In other words, xLock() moves the ** database file lock in the direction NONE toward EXCLUSIVE. The argument to -** xLock() is always on of SHARED, RESERVED, PENDING, or EXCLUSIVE, never +** xLock() is always one of SHARED, RESERVED, PENDING, or EXCLUSIVE, never ** SQLITE_LOCK_NONE. If the database file lock is already at or above the ** requested lock, then the call to xLock() is a no-op. ** xUnlock() downgrades the database file lock to either SHARED or NONE. -* If the lock is already at or below the requested lock state, then the call +** If the lock is already at or below the requested lock state, then the call ** to xUnlock() is a no-op. ** The xCheckReservedLock() method checks whether any database connection, ** either in this process or in some other process, is holding a RESERVED, @@ -2440,7 +2442,7 @@ struct sqlite3_mem_methods { ** is stored in each sorted record and the required column values loaded ** from the database as records are returned in sorted order. The default ** value for this option is to never use this optimization. Specifying a -** negative value for this option restores the default behaviour. +** negative value for this option restores the default behavior. ** This option is only available if SQLite is compiled with the ** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option. ** @@ -2454,6 +2456,22 @@ struct sqlite3_mem_methods { ** configuration setting is never used, then the default maximum is determined ** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that ** compile-time option is not set, then the default maximum is 1073741824. +** +** [[SQLITE_CONFIG_ROWID_IN_VIEW]] +**
    SQLITE_CONFIG_ROWID_IN_VIEW +**
    The SQLITE_CONFIG_ROWID_IN_VIEW option enables or disables the ability +** for VIEWs to have a ROWID. The capability can only be enabled if SQLite is +** compiled with -DSQLITE_ALLOW_ROWID_IN_VIEW, in which case the capability +** defaults to on. This configuration option queries the current setting or +** changes the setting to off or on. The argument is a pointer to an integer. +** If that integer initially holds a value of 1, then the ability for VIEWs to +** have ROWIDs is activated. If the integer initially holds zero, then the +** ability is deactivated. Any other initial value for the integer leaves the +** setting unchanged. After changes, if any, the integer is written with +** a 1 or 0, if the ability for VIEWs to have ROWIDs is on or off. If SQLite +** is compiled without -DSQLITE_ALLOW_ROWID_IN_VIEW (which is the usual and +** recommended case) then the integer is always filled with zero, regardless +** if its initial value. ** */ #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ @@ -2485,6 +2503,7 @@ struct sqlite3_mem_methods { #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */ #define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */ #define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */ +#define SQLITE_CONFIG_ROWID_IN_VIEW 30 /* int* */ /* ** CAPI3REF: Database Connection Configuration Options @@ -2615,7 +2634,7 @@ struct sqlite3_mem_methods { ** database handle, SQLite checks if this will mean that there are now no ** connections at all to the database. If so, it performs a checkpoint ** operation before closing the connection. This option may be used to -** override this behaviour. The first parameter passed to this operation +** override this behavior. The first parameter passed to this operation ** is an integer - positive to disable checkpoints-on-close, or zero (the ** default) to enable them, and negative to leave the setting unchanged. ** The second parameter is a pointer to an integer @@ -3599,8 +3618,8 @@ SQLITE_API int sqlite3_set_authorizer( #define SQLITE_RECURSIVE 33 /* NULL NULL */ /* -** CAPI3REF: Tracing And Profiling Functions -** METHOD: sqlite3 +** CAPI3REF: Deprecated Tracing And Profiling Functions +** DEPRECATED ** ** These routines are deprecated. Use the [sqlite3_trace_v2()] interface ** instead of the routines described here. @@ -4267,14 +4286,17 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename); ** ** ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language -** text that describes the error, as either UTF-8 or UTF-16 respectively. +** text that describes the error, as either UTF-8 or UTF-16 respectively, +** or NULL if no error message is available. +** (See how SQLite handles [invalid UTF] for exceptions to this rule.) ** ^(Memory to hold the error message string is managed internally. ** The application does not need to worry about freeing the result. ** However, the error string might be overwritten or deallocated by ** subsequent calls to other SQLite interface functions.)^ ** -** ^The sqlite3_errstr() interface returns the English-language text -** that describes the [result code], as UTF-8. +** ^The sqlite3_errstr(E) interface returns the English-language text +** that describes the [result code] E, as UTF-8, or NULL if E is not an +** result code for which a text error message is available. ** ^(Memory to hold the error message string is managed internally ** and must not be freed by the application)^. ** @@ -5638,6 +5660,7 @@ SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt); */ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); + /* ** CAPI3REF: Create Or Redefine SQL Functions ** KEYWORDS: {function creation routines} @@ -5884,13 +5907,27 @@ SQLITE_API int sqlite3_create_window_function( **
    ** ** [[SQLITE_SUBTYPE]]
    SQLITE_SUBTYPE
    -** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call +** The SQLITE_SUBTYPE flag indicates to SQLite that a function might call ** [sqlite3_value_subtype()] to inspect the sub-types of its arguments. -** Specifying this flag makes no difference for scalar or aggregate user -** functions. However, if it is not specified for a user-defined window -** function, then any sub-types belonging to arguments passed to the window -** function may be discarded before the window function is called (i.e. -** sqlite3_value_subtype() will always return 0). +** This flag instructs SQLite to omit some corner-case optimizations that +** might disrupt the operation of the [sqlite3_value_subtype()] function, +** causing it to return zero rather than the correct subtype(). +** SQL functions that invokes [sqlite3_value_subtype()] should have this +** property. If the SQLITE_SUBTYPE property is omitted, then the return +** value from [sqlite3_value_subtype()] might sometimes be zero even though +** a non-zero subtype was specified by the function argument expression. +** +** [[SQLITE_RESULT_SUBTYPE]]
    SQLITE_RESULT_SUBTYPE
    +** The SQLITE_RESULT_SUBTYPE flag indicates to SQLite that a function might call +** [sqlite3_result_subtype()] to cause a sub-type to be associated with its +** result. +** Every function that invokes [sqlite3_result_subtype()] should have this +** property. If it does not, then the call to [sqlite3_result_subtype()] +** might become a no-op if the function is used as term in an +** [expression index]. On the other hand, SQL functions that never invoke +** [sqlite3_result_subtype()] should avoid setting this property, as the +** purpose of this property is to disable certain optimizations that are +** incompatible with subtypes. **
    ** */ @@ -5898,6 +5935,7 @@ SQLITE_API int sqlite3_create_window_function( #define SQLITE_DIRECTONLY 0x000080000 #define SQLITE_SUBTYPE 0x000100000 #define SQLITE_INNOCUOUS 0x000200000 +#define SQLITE_RESULT_SUBTYPE 0x001000000 /* ** CAPI3REF: Deprecated Functions @@ -6094,6 +6132,12 @@ SQLITE_API int sqlite3_value_encoding(sqlite3_value*); ** information can be used to pass a limited amount of context from ** one SQL function to another. Use the [sqlite3_result_subtype()] ** routine to set the subtype for the return value of an SQL function. +** +** Every [application-defined SQL function] that invoke this interface +** should include the [SQLITE_SUBTYPE] property in the text +** encoding argument when the function is [sqlite3_create_function|registered]. +** If the [SQLITE_SUBTYPE] property is omitted, then sqlite3_value_subtype() +** might return zero instead of the upstream subtype in some corner cases. */ SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*); @@ -6192,48 +6236,56 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); ** METHOD: sqlite3_context ** ** These functions may be used by (non-aggregate) SQL functions to -** associate metadata with argument values. If the same value is passed to -** multiple invocations of the same SQL function during query execution, under -** some circumstances the associated metadata may be preserved. An example -** of where this might be useful is in a regular-expression matching -** function. The compiled version of the regular expression can be stored as -** metadata associated with the pattern string. +** associate auxiliary data with argument values. If the same argument +** value is passed to multiple invocations of the same SQL function during +** query execution, under some circumstances the associated auxiliary data +** might be preserved. An example of where this might be useful is in a +** regular-expression matching function. The compiled version of the regular +** expression can be stored as auxiliary data associated with the pattern string. ** Then as long as the pattern string remains the same, ** the compiled regular expression can be reused on multiple ** invocations of the same function. ** -** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the metadata +** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the auxiliary data ** associated by the sqlite3_set_auxdata(C,N,P,X) function with the Nth argument ** value to the application-defined function. ^N is zero for the left-most -** function argument. ^If there is no metadata +** function argument. ^If there is no auxiliary data ** associated with the function argument, the sqlite3_get_auxdata(C,N) interface ** returns a NULL pointer. ** -** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th -** argument of the application-defined function. ^Subsequent +** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as auxiliary data for the +** N-th argument of the application-defined function. ^Subsequent ** calls to sqlite3_get_auxdata(C,N) return P from the most recent -** sqlite3_set_auxdata(C,N,P,X) call if the metadata is still valid or -** NULL if the metadata has been discarded. +** sqlite3_set_auxdata(C,N,P,X) call if the auxiliary data is still valid or +** NULL if the auxiliary data has been discarded. ** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL, ** SQLite will invoke the destructor function X with parameter P exactly -** once, when the metadata is discarded. -** SQLite is free to discard the metadata at any time, including:
      +** once, when the auxiliary data is discarded. +** SQLite is free to discard the auxiliary data at any time, including:
        **
      • ^(when the corresponding function parameter changes)^, or **
      • ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the ** SQL statement)^, or **
      • ^(when sqlite3_set_auxdata() is invoked again on the same ** parameter)^, or **
      • ^(during the original sqlite3_set_auxdata() call when a memory -** allocation error occurs.)^
      +** allocation error occurs.)^ +**
    • ^(during the original sqlite3_set_auxdata() call if the function +** is evaluated during query planning instead of during query execution, +** as sometimes happens with [SQLITE_ENABLE_STAT4].)^
    ** -** Note the last bullet in particular. The destructor X in +** Note the last two bullets in particular. The destructor X in ** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the ** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata() ** should be called near the end of the function implementation and the ** function implementation should not make any use of P after -** sqlite3_set_auxdata() has been called. -** -** ^(In practice, metadata is preserved between function calls for +** sqlite3_set_auxdata() has been called. Furthermore, a call to +** sqlite3_get_auxdata() that occurs immediately after a corresponding call +** to sqlite3_set_auxdata() might still return NULL if an out-of-memory +** condition occurred during the sqlite3_set_auxdata() call or if the +** function is being evaluated during query planning rather than during +** query execution. +** +** ^(In practice, auxiliary data is preserved between function calls for ** function parameters that are compile-time constants, including literal ** values and [parameters] and expressions composed from the same.)^ ** @@ -6243,10 +6295,67 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); ** ** These routines must be called from the same thread in which ** the SQL function is running. +** +** See also: [sqlite3_get_clientdata()] and [sqlite3_set_clientdata()]. */ SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N); SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*)); +/* +** CAPI3REF: Database Connection Client Data +** METHOD: sqlite3 +** +** These functions are used to associate one or more named pointers +** with a [database connection]. +** A call to sqlite3_set_clientdata(D,N,P,X) causes the pointer P +** to be attached to [database connection] D using name N. Subsequent +** calls to sqlite3_get_clientdata(D,N) will return a copy of pointer P +** or a NULL pointer if there were no prior calls to +** sqlite3_set_clientdata() with the same values of D and N. +** Names are compared using strcmp() and are thus case sensitive. +** +** If P and X are both non-NULL, then the destructor X is invoked with +** argument P on the first of the following occurrences: +**
      +**
    • An out-of-memory error occurs during the call to +** sqlite3_set_clientdata() which attempts to register pointer P. +**
    • A subsequent call to sqlite3_set_clientdata(D,N,P,X) is made +** with the same D and N parameters. +**
    • The database connection closes. SQLite does not make any guarantees +** about the order in which destructors are called, only that all +** destructors will be called exactly once at some point during the +** database connection closing process. +**
    +** +** SQLite does not do anything with client data other than invoke +** destructors on the client data at the appropriate time. The intended +** use for client data is to provide a mechanism for wrapper libraries +** to store additional information about an SQLite database connection. +** +** There is no limit (other than available memory) on the number of different +** client data pointers (with different names) that can be attached to a +** single database connection. However, the implementation is optimized +** for the case of having only one or two different client data names. +** Applications and wrapper libraries are discouraged from using more than +** one client data name each. +** +** There is no way to enumerate the client data pointers +** associated with a database connection. The N parameter can be thought +** of as a secret key such that only code that knows the secret key is able +** to access the associated data. +** +** Security Warning: These interfaces should not be exposed in scripting +** languages or in other circumstances where it might be possible for an +** an attacker to invoke them. Any agent that can invoke these interfaces +** can probably also take control of the process. +** +** Database connection client data is only available for SQLite +** version 3.44.0 ([dateof:3.44.0]) and later. +** +** See also: [sqlite3_set_auxdata()] and [sqlite3_get_auxdata()]. +*/ +SQLITE_API void *sqlite3_get_clientdata(sqlite3*,const char*); +SQLITE_API int sqlite3_set_clientdata(sqlite3*, const char*, void*, void(*)(void*)); /* ** CAPI3REF: Constants Defining Special Destructor Behavior @@ -6448,6 +6557,20 @@ SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n); ** higher order bits are discarded. ** The number of subtype bytes preserved by SQLite might increase ** in future releases of SQLite. +** +** Every [application-defined SQL function] that invokes this interface +** should include the [SQLITE_RESULT_SUBTYPE] property in its +** text encoding argument when the SQL function is +** [sqlite3_create_function|registered]. If the [SQLITE_RESULT_SUBTYPE] +** property is omitted from the function that invokes sqlite3_result_subtype(), +** then in some cases the sqlite3_result_subtype() might fail to set +** the result subtype. +** +** If SQLite is compiled with -DSQLITE_STRICT_SUBTYPE=1, then any +** SQL function that invokes the sqlite3_result_subtype() interface +** and that does not have the SQLITE_RESULT_SUBTYPE property will raise +** an error. Future versions of SQLite might enable -DSQLITE_STRICT_SUBTYPE=1 +** by default. */ SQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int); @@ -6879,7 +7002,7 @@ SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName); SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema); /* -** CAPI3REF: Allowed return values from [sqlite3_txn_state()] +** CAPI3REF: Allowed return values from sqlite3_txn_state() ** KEYWORDS: {transaction state} ** ** These constants define the current transaction state of a database file. @@ -7011,7 +7134,7 @@ SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); ** ^Each call to the sqlite3_autovacuum_pages() interface overrides all ** previous invocations for that database connection. ^If the callback ** argument (C) to sqlite3_autovacuum_pages(D,C,P,X) is a NULL pointer, -** then the autovacuum steps callback is cancelled. The return value +** then the autovacuum steps callback is canceled. The return value ** from sqlite3_autovacuum_pages() is normally SQLITE_OK, but might ** be some other error code if something goes wrong. The current ** implementation will only return SQLITE_OK or SQLITE_MISUSE, but other @@ -7077,6 +7200,12 @@ SQLITE_API int sqlite3_autovacuum_pages( ** The exceptions defined in this paragraph might change in a future ** release of SQLite. ** +** Whether the update hook is invoked before or after the +** corresponding change is currently unspecified and may differ +** depending on the type of change. Do not rely on the order of the +** hook call with regards to the final result of the operation which +** triggers the hook. +** ** The update hook implementation must not do anything that will modify ** the database connection that invoked the update hook. Any actions ** to modify the database connection must be deferred until after the @@ -7530,6 +7659,10 @@ struct sqlite3_module { /* The methods above are in versions 1 and 2 of the sqlite_module object. ** Those below are for version 3 and greater. */ int (*xShadowName)(const char*); + /* The methods above are in versions 1 through 3 of the sqlite_module object. + ** Those below are for version 4 and greater. */ + int (*xIntegrity)(sqlite3_vtab *pVTab, const char *zSchema, + const char *zTabName, int mFlags, char **pzErr); }; /* @@ -8017,7 +8150,7 @@ SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); ** code is returned and the transaction rolled back. ** ** Calling this function with an argument that is not a NULL pointer or an -** open blob handle results in undefined behaviour. ^Calling this routine +** open blob handle results in undefined behavior. ^Calling this routine ** with a null pointer (such as would be returned by a failed call to ** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function ** is passed a valid open blob handle, the values returned by the @@ -8244,9 +8377,11 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*); ** ** ^(Some systems (for example, Windows 95) do not support the operation ** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try() -** will always return SQLITE_BUSY. The SQLite core only ever uses -** sqlite3_mutex_try() as an optimization so this is acceptable -** behavior.)^ +** will always return SQLITE_BUSY. In most cases the SQLite core only uses +** sqlite3_mutex_try() as an optimization, so this is acceptable +** behavior. The exceptions are unix builds that set the +** SQLITE_ENABLE_SETLK_TIMEOUT build option. In that case a working +** sqlite3_mutex_try() is required.)^ ** ** ^The sqlite3_mutex_leave() routine exits a mutex that was ** previously entered by the same thread. The behavior @@ -8497,6 +8632,7 @@ SQLITE_API int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_PRNG_SAVE 5 #define SQLITE_TESTCTRL_PRNG_RESTORE 6 #define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */ +#define SQLITE_TESTCTRL_FK_NO_ACTION 7 #define SQLITE_TESTCTRL_BITVEC_TEST 8 #define SQLITE_TESTCTRL_FAULT_INSTALL 9 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 @@ -8504,6 +8640,7 @@ SQLITE_API int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_ASSERT 12 #define SQLITE_TESTCTRL_ALWAYS 13 #define SQLITE_TESTCTRL_RESERVE 14 /* NOT USED */ +#define SQLITE_TESTCTRL_JSON_SELFCHECK 14 #define SQLITE_TESTCTRL_OPTIMIZATIONS 15 #define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */ #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */ @@ -8539,7 +8676,7 @@ SQLITE_API int sqlite3_test_control(int op, ...); ** The sqlite3_keyword_count() interface returns the number of distinct ** keywords understood by SQLite. ** -** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and +** The sqlite3_keyword_name(N,Z,L) interface finds the 0-based N-th keyword and ** makes *Z point to that keyword expressed as UTF8 and writes the number ** of bytes in the keyword into *L. The string that *Z points to is not ** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns @@ -9558,8 +9695,8 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); ** blocked connection already has a registered unlock-notify callback, ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is ** called with a NULL pointer as its second argument, then any existing -** unlock-notify callback is cancelled. ^The blocked connections -** unlock-notify callback may also be cancelled by closing the blocked +** unlock-notify callback is canceled. ^The blocked connections +** unlock-notify callback may also be canceled by closing the blocked ** connection using [sqlite3_close()]. ** ** The unlock-notify callback is not reentrant. If an application invokes @@ -10118,24 +10255,45 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int); **
  • ** ^(If the sqlite3_vtab_distinct() interface returns 2, that means ** that the query planner does not need the rows returned in any particular -** order, as long as rows with the same values in all "aOrderBy" columns -** are adjacent.)^ ^(Furthermore, only a single row for each particular -** combination of values in the columns identified by the "aOrderBy" field -** needs to be returned.)^ ^It is always ok for two or more rows with the same -** values in all "aOrderBy" columns to be returned, as long as all such rows -** are adjacent. ^The virtual table may, if it chooses, omit extra rows -** that have the same value for all columns identified by "aOrderBy". -** ^However omitting the extra rows is optional. +** order, as long as rows with the same values in all columns identified +** by "aOrderBy" are adjacent.)^ ^(Furthermore, when two or more rows +** contain the same values for all columns identified by "colUsed", all but +** one such row may optionally be omitted from the result.)^ +** The virtual table is not required to omit rows that are duplicates +** over the "colUsed" columns, but if the virtual table can do that without +** too much extra effort, it could potentially help the query to run faster. ** This mode is used for a DISTINCT query. **

  • -** ^(If the sqlite3_vtab_distinct() interface returns 3, that means -** that the query planner needs only distinct rows but it does need the -** rows to be sorted.)^ ^The virtual table implementation is free to omit -** rows that are identical in all aOrderBy columns, if it wants to, but -** it is not required to omit any rows. This mode is used for queries +** ^(If the sqlite3_vtab_distinct() interface returns 3, that means the +** virtual table must return rows in the order defined by "aOrderBy" as +** if the sqlite3_vtab_distinct() interface had returned 0. However if +** two or more rows in the result have the same values for all columns +** identified by "colUsed", then all but one such row may optionally be +** omitted.)^ Like when the return value is 2, the virtual table +** is not required to omit rows that are duplicates over the "colUsed" +** columns, but if the virtual table can do that without +** too much extra effort, it could potentially help the query to run faster. +** This mode is used for queries ** that have both DISTINCT and ORDER BY clauses. ** ** +**

    The following table summarizes the conditions under which the +** virtual table is allowed to set the "orderByConsumed" flag based on +** the value returned by sqlite3_vtab_distinct(). This table is a +** restatement of the previous four paragraphs: +** +** +** +**
    sqlite3_vtab_distinct() return value +** Rows are returned in aOrderBy order +** Rows with the same value in all aOrderBy columns are adjacent +** Duplicates over all colUsed columns may be omitted +**
    0yesyesno +**
    1noyesno +**
    2noyesyes +**
    3yesyesyes +**
    +** ** ^For the purposes of comparing virtual table output values to see if the ** values are same value for sorting purposes, two NULL values are considered ** to be the same. In other words, the comparison operator is "IS" @@ -10862,6 +11020,13 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c ** SQLITE_SERIALIZE_NOCOPY bit is set but no contiguous copy ** of the database exists. ** +** After the call, if the SQLITE_SERIALIZE_NOCOPY bit had been set, +** the returned buffer content will remain accessible and unchanged +** until either the next write operation on the connection or when +** the connection is closed, and applications must not modify the +** buffer. If the bit had been clear, the returned buffer will not +** be accessed by SQLite after the call. +** ** A call to sqlite3_serialize(D,S,P,F) might return NULL even if the ** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory ** allocation error occurs. @@ -10910,6 +11075,9 @@ SQLITE_API unsigned char *sqlite3_serialize( ** SQLite will try to increase the buffer size using sqlite3_realloc64() ** if writes on the database cause it to grow larger than M bytes. ** +** Applications must not modify the buffer P or invalidate it before +** the database connection D is closed. +** ** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the ** database is currently in a read transaction or is involved in a backup ** operation. @@ -10918,6 +11086,13 @@ SQLITE_API unsigned char *sqlite3_serialize( ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the ** function returns SQLITE_ERROR. ** +** The deserialized database should not be in [WAL mode]. If the database +** is in WAL mode, then any attempt to use the database file will result +** in an [SQLITE_CANTOPEN] error. The application can set the +** [file format version numbers] (bytes 18 and 19) of the input database P +** to 0x01 prior to invoking sqlite3_deserialize(D,S,P,N,M,F) to force the +** database file into rollback mode and work around this limitation. +** ** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the ** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then ** [sqlite3_free()] is invoked on argument P prior to returning. @@ -11990,6 +12165,18 @@ SQLITE_API int sqlite3changeset_concat( ); +/* +** CAPI3REF: Upgrade the Schema of a Changeset/Patchset +*/ +SQLITE_API int sqlite3changeset_upgrade( + sqlite3 *db, + const char *zDb, + int nIn, const void *pIn, /* Input changeset */ + int *pnOut, void **ppOut /* OUT: Inverse of input */ +); + + + /* ** CAPI3REF: Changegroup Handle ** @@ -12036,6 +12223,38 @@ typedef struct sqlite3_changegroup sqlite3_changegroup; */ SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp); +/* +** CAPI3REF: Add a Schema to a Changegroup +** METHOD: sqlite3_changegroup_schema +** +** This method may be used to optionally enforce the rule that the changesets +** added to the changegroup handle must match the schema of database zDb +** ("main", "temp", or the name of an attached database). If +** sqlite3changegroup_add() is called to add a changeset that is not compatible +** with the configured schema, SQLITE_SCHEMA is returned and the changegroup +** object is left in an undefined state. +** +** A changeset schema is considered compatible with the database schema in +** the same way as for sqlite3changeset_apply(). Specifically, for each +** table in the changeset, there exists a database table with: +** +**

      +**
    • The name identified by the changeset, and +**
    • at least as many columns as recorded in the changeset, and +**
    • the primary key columns in the same position as recorded in +** the changeset. +**
    +** +** The output of the changegroup object always has the same schema as the +** database nominated using this function. In cases where changesets passed +** to sqlite3changegroup_add() have fewer columns than the corresponding table +** in the database schema, these are filled in using the default column +** values from the database schema. This makes it possible to combined +** changesets that have different numbers of columns for a single table +** within a changegroup, provided that they are otherwise compatible. +*/ +SQLITE_API int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const char *zDb); + /* ** CAPI3REF: Add A Changeset To A Changegroup ** METHOD: sqlite3_changegroup @@ -12104,16 +12323,45 @@ SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp); ** If the new changeset contains changes to a table that is already present ** in the changegroup, then the number of columns and the position of the ** primary key columns for the table must be consistent. If this is not the -** case, this function fails with SQLITE_SCHEMA. If the input changeset -** appears to be corrupt and the corruption is detected, SQLITE_CORRUPT is -** returned. Or, if an out-of-memory condition occurs during processing, this -** function returns SQLITE_NOMEM. In all cases, if an error occurs the state -** of the final contents of the changegroup is undefined. +** case, this function fails with SQLITE_SCHEMA. Except, if the changegroup +** object has been configured with a database schema using the +** sqlite3changegroup_schema() API, then it is possible to combine changesets +** with different numbers of columns for a single table, provided that +** they are otherwise compatible. ** -** If no error occurs, SQLITE_OK is returned. +** If the input changeset appears to be corrupt and the corruption is +** detected, SQLITE_CORRUPT is returned. Or, if an out-of-memory condition +** occurs during processing, this function returns SQLITE_NOMEM. +** +** In all cases, if an error occurs the state of the final contents of the +** changegroup is undefined. If no error occurs, SQLITE_OK is returned. */ SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); +/* +** CAPI3REF: Add A Single Change To A Changegroup +** METHOD: sqlite3_changegroup +** +** This function adds the single change currently indicated by the iterator +** passed as the second argument to the changegroup object. The rules for +** adding the change are just as described for [sqlite3changegroup_add()]. +** +** If the change is successfully added to the changegroup, SQLITE_OK is +** returned. Otherwise, an SQLite error code is returned. +** +** The iterator must point to a valid entry when this function is called. +** If it does not, SQLITE_ERROR is returned and no change is added to the +** changegroup. Additionally, the iterator must not have been opened with +** the SQLITE_CHANGESETAPPLY_INVERT flag. In this case SQLITE_ERROR is also +** returned. +*/ +SQLITE_API int sqlite3changegroup_add_change( + sqlite3_changegroup*, + sqlite3_changeset_iter* +); + + + /* ** CAPI3REF: Obtain A Composite Changeset From A Changegroup ** METHOD: sqlite3_changegroup @@ -12375,10 +12623,17 @@ SQLITE_API int sqlite3changeset_apply_v2( **
  • an insert change if all fields of the conflicting row match ** the row being inserted. ** +** +**
    SQLITE_CHANGESETAPPLY_FKNOACTION
    +** If this flag it set, then all foreign key constraints in the target +** database behave as if they were declared with "ON UPDATE NO ACTION ON +** DELETE NO ACTION", even if they are actually CASCADE, RESTRICT, SET NULL +** or SET DEFAULT. */ #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001 #define SQLITE_CHANGESETAPPLY_INVERT 0x0002 #define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004 +#define SQLITE_CHANGESETAPPLY_FKNOACTION 0x0008 /* ** CAPI3REF: Constants Passed To The Conflict Handler @@ -12911,8 +13166,8 @@ struct Fts5PhraseIter { ** EXTENSION API FUNCTIONS ** ** xUserData(pFts): -** Return a copy of the context pointer the extension function was -** registered with. +** Return a copy of the pUserData pointer passed to the xCreateFunction() +** API when the extension function was registered. ** ** xColumnTotalSize(pFts, iCol, pnToken): ** If parameter iCol is less than zero, set output variable *pnToken @@ -12944,8 +13199,11 @@ struct Fts5PhraseIter { ** created with the "columnsize=0" option. ** ** xColumnText: -** This function attempts to retrieve the text of column iCol of the -** current document. If successful, (*pz) is set to point to a buffer +** If parameter iCol is less than zero, or greater than or equal to the +** number of columns in the table, SQLITE_RANGE is returned. +** +** Otherwise, this function attempts to retrieve the text of column iCol of +** the current document. If successful, (*pz) is set to point to a buffer ** containing the text in utf-8 encoding, (*pn) is set to the size in bytes ** (not characters) of the buffer and SQLITE_OK is returned. Otherwise, ** if an error occurs, an SQLite error code is returned and the final values @@ -12955,8 +13213,10 @@ struct Fts5PhraseIter { ** Returns the number of phrases in the current query expression. ** ** xPhraseSize: -** Returns the number of tokens in phrase iPhrase of the query. Phrases -** are numbered starting from zero. +** If parameter iCol is less than zero, or greater than or equal to the +** number of phrases in the current query, as returned by xPhraseCount, +** 0 is returned. Otherwise, this function returns the number of tokens in +** phrase iPhrase of the query. Phrases are numbered starting from zero. ** ** xInstCount: ** Set *pnInst to the total number of occurrences of all phrases within @@ -12972,12 +13232,13 @@ struct Fts5PhraseIter { ** Query for the details of phrase match iIdx within the current row. ** Phrase matches are numbered starting from zero, so the iIdx argument ** should be greater than or equal to zero and smaller than the value -** output by xInstCount(). +** output by xInstCount(). If iIdx is less than zero or greater than +** or equal to the value returned by xInstCount(), SQLITE_RANGE is returned. ** -** Usually, output parameter *piPhrase is set to the phrase number, *piCol +** Otherwise, output parameter *piPhrase is set to the phrase number, *piCol ** to the column in which it occurs and *piOff the token offset of the -** first token of the phrase. Returns SQLITE_OK if successful, or an error -** code (i.e. SQLITE_NOMEM) if an error occurs. +** first token of the phrase. SQLITE_OK is returned if successful, or an +** error code (i.e. SQLITE_NOMEM) if an error occurs. ** ** This API can be quite slow if used with an FTS5 table created with the ** "detail=none" or "detail=column" option. @@ -13003,6 +13264,10 @@ struct Fts5PhraseIter { ** Invoking Api.xUserData() returns a copy of the pointer passed as ** the third argument to pUserData. ** +** If parameter iPhrase is less than zero, or greater than or equal to +** the number of phrases in the query, as returned by xPhraseCount(), +** this function returns SQLITE_RANGE. +** ** If the callback function returns any value other than SQLITE_OK, the ** query is abandoned and the xQueryPhrase function returns immediately. ** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK. @@ -13117,9 +13382,42 @@ struct Fts5PhraseIter { ** ** xPhraseNextColumn() ** See xPhraseFirstColumn above. +** +** xQueryToken(pFts5, iPhrase, iToken, ppToken, pnToken) +** This is used to access token iToken of phrase iPhrase of the current +** query. Before returning, output parameter *ppToken is set to point +** to a buffer containing the requested token, and *pnToken to the +** size of this buffer in bytes. +** +** If iPhrase or iToken are less than zero, or if iPhrase is greater than +** or equal to the number of phrases in the query as reported by +** xPhraseCount(), or if iToken is equal to or greater than the number of +** tokens in the phrase, SQLITE_RANGE is returned and *ppToken and *pnToken + are both zeroed. +** +** The output text is not a copy of the query text that specified the +** token. It is the output of the tokenizer module. For tokendata=1 +** tables, this includes any embedded 0x00 and trailing data. +** +** xInstToken(pFts5, iIdx, iToken, ppToken, pnToken) +** This is used to access token iToken of phrase hit iIdx within the +** current row. If iIdx is less than zero or greater than or equal to the +** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise, +** output variable (*ppToken) is set to point to a buffer containing the +** matching document token, and (*pnToken) to the size of that buffer in +** bytes. This API is not available if the specified token matches a +** prefix query term. In that case both output variables are always set +** to 0. +** +** The output text is not a copy of the document text that was tokenized. +** It is the output of the tokenizer module. For tokendata=1 tables, this +** includes any embedded 0x00 and trailing data. +** +** This API can be quite slow if used with an FTS5 table created with the +** "detail=none" or "detail=column" option. */ struct Fts5ExtensionApi { - int iVersion; /* Currently always set to 2 */ + int iVersion; /* Currently always set to 3 */ void *(*xUserData)(Fts5Context*); @@ -13154,6 +13452,13 @@ struct Fts5ExtensionApi { int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*); void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol); + + /* Below this point are iVersion>=3 only */ + int (*xQueryToken)(Fts5Context*, + int iPhrase, int iToken, + const char **ppToken, int *pnToken + ); + int (*xInstToken)(Fts5Context*, int iIdx, int iToken, const char**, int*); }; /* @@ -13640,7 +13945,7 @@ struct fts5_api { ** max_page_count macro. */ #ifndef SQLITE_MAX_PAGE_COUNT -# define SQLITE_MAX_PAGE_COUNT 1073741823 +# define SQLITE_MAX_PAGE_COUNT 0xfffffffe /* 4294967294 */ #endif /* @@ -13769,6 +14074,29 @@ struct fts5_api { # endif #endif +/* +** Enable SQLITE_USE_SEH by default on MSVC builds. Only omit +** SEH support if the -DSQLITE_OMIT_SEH option is given. +*/ +#if defined(_MSC_VER) && !defined(SQLITE_OMIT_SEH) +# define SQLITE_USE_SEH 1 +#else +# undef SQLITE_USE_SEH +#endif + +/* +** Enable SQLITE_DIRECT_OVERFLOW_READ, unless the build explicitly +** disables it using -DSQLITE_DIRECT_OVERFLOW_READ=0 +*/ +#if defined(SQLITE_DIRECT_OVERFLOW_READ) && SQLITE_DIRECT_OVERFLOW_READ+1==1 + /* Disable if -DSQLITE_DIRECT_OVERFLOW_READ=0 */ +# undef SQLITE_DIRECT_OVERFLOW_READ +#else + /* In all other cases, enable */ +# define SQLITE_DIRECT_OVERFLOW_READ 1 +#endif + + /* ** The SQLITE_THREADSAFE macro must be defined as 0, 1, or 2. ** 0 means mutexes are permanently disable and the library is never @@ -14037,6 +14365,8 @@ struct fts5_api { # define SQLITE_OMIT_ALTERTABLE #endif +#define SQLITE_DIGIT_SEPARATOR '_' + /* ** Return true (non-zero) if the input is an integer that is too large ** to fit in 32-bits. This macro is used inside of various testcase() @@ -14329,8 +14659,8 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*); #define TK_TRUEFALSE 170 #define TK_ISNOT 171 #define TK_FUNCTION 172 -#define TK_UMINUS 173 -#define TK_UPLUS 174 +#define TK_UPLUS 173 +#define TK_UMINUS 174 #define TK_TRUTH 175 #define TK_REGISTER 176 #define TK_VECTOR 177 @@ -14339,8 +14669,9 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*); #define TK_ASTERISK 180 #define TK_SPAN 181 #define TK_ERROR 182 -#define TK_SPACE 183 -#define TK_ILLEGAL 184 +#define TK_QNUMBER 183 +#define TK_SPACE 184 +#define TK_ILLEGAL 185 /************** End of parse.h ***********************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ @@ -14602,7 +14933,7 @@ typedef INT16_TYPE LogEst; # define SQLITE_PTRSIZE __SIZEOF_POINTER__ # elif defined(i386) || defined(__i386__) || defined(_M_IX86) || \ defined(_M_ARM) || defined(__arm__) || defined(__x86) || \ - (defined(__APPLE__) && defined(__POWERPC__)) || \ + (defined(__APPLE__) && defined(__ppc__)) || \ (defined(__TOS_AIX__) && !defined(__64BIT__)) # define SQLITE_PTRSIZE 4 # else @@ -14662,16 +14993,33 @@ typedef INT16_TYPE LogEst; ** using C-preprocessor macros. If that is unsuccessful, or if ** -DSQLITE_BYTEORDER=0 is set, then byte-order is determined ** at run-time. +** +** If you are building SQLite on some obscure platform for which the +** following ifdef magic does not work, you can always include either: +** +** -DSQLITE_BYTEORDER=1234 +** +** or +** +** -DSQLITE_BYTEORDER=4321 +** +** to cause the build to work for little-endian or big-endian processors, +** respectively. */ -#ifndef SQLITE_BYTEORDER -# if defined(i386) || defined(__i386__) || defined(_M_IX86) || \ +#ifndef SQLITE_BYTEORDER /* Replicate changes at tag-20230904a */ +# if defined(__BYTE_ORDER__) && __BYTE_ORDER__==__ORDER_BIG_ENDIAN__ +# define SQLITE_BYTEORDER 4321 +# elif defined(__BYTE_ORDER__) && __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__ +# define SQLITE_BYTEORDER 1234 +# elif defined(__BIG_ENDIAN__) && __BIG_ENDIAN__==1 +# define SQLITE_BYTEORDER 4321 +# elif defined(i386) || defined(__i386__) || defined(_M_IX86) || \ defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \ defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) -# define SQLITE_BYTEORDER 1234 -# elif defined(sparc) || defined(__ppc__) || \ - defined(__ARMEB__) || defined(__AARCH64EB__) -# define SQLITE_BYTEORDER 4321 +# define SQLITE_BYTEORDER 1234 +# elif defined(sparc) || defined(__ARMEB__) || defined(__AARCH64EB__) +# define SQLITE_BYTEORDER 4321 # else # define SQLITE_BYTEORDER 0 # endif @@ -14822,6 +15170,7 @@ SQLITE_PRIVATE u32 sqlite3TreeTrace; ** 0x00010000 Beginning of DELETE/INSERT/UPDATE processing ** 0x00020000 Transform DISTINCT into GROUP BY ** 0x00040000 SELECT tree dump after all code has been generated +** 0x00080000 NOT NULL strength reduction */ /* @@ -14852,7 +15201,7 @@ SQLITE_PRIVATE u32 sqlite3WhereTrace; ** 0x00000010 Display sqlite3_index_info xBestIndex calls ** 0x00000020 Range an equality scan metrics ** 0x00000040 IN operator decisions -** 0x00000080 WhereLoop cost adjustements +** 0x00000080 WhereLoop cost adjustments ** 0x00000100 ** 0x00000200 Covering index decisions ** 0x00000400 OR optimization @@ -14995,6 +15344,7 @@ typedef struct Column Column; typedef struct Cte Cte; typedef struct CteUse CteUse; typedef struct Db Db; +typedef struct DbClientData DbClientData; typedef struct DbFixer DbFixer; typedef struct Schema Schema; typedef struct Expr Expr; @@ -15633,7 +15983,7 @@ SQLITE_PRIVATE sqlite3_file *sqlite3PagerJrnlFile(Pager*); SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager*); SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager*); SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager*); -SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *, int, int, int *); +SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *, int, int, u64*); SQLITE_PRIVATE void sqlite3PagerClearCache(Pager*); SQLITE_PRIVATE int sqlite3SectorSize(sqlite3_file *); @@ -16000,6 +16350,7 @@ SQLITE_PRIVATE int sqlite3BtreeIntegrityCheck( sqlite3 *db, /* Database connection that is running the check */ Btree *p, /* The btree to be checked */ Pgno *aRoot, /* An array of root pages numbers for individual trees */ + sqlite3_value *aCnt, /* OUT: entry counts for each btree in aRoot[] */ int nRoot, /* Number of entries in aRoot[] */ int mxErr, /* Stop reporting errors after this many */ int *pnErr, /* OUT: Write number of errors seen to this variable */ @@ -16220,6 +16571,7 @@ typedef struct VdbeOpList VdbeOpList; #define P4_INT64 (-13) /* P4 is a 64-bit signed integer */ #define P4_INTARRAY (-14) /* P4 is a vector of 32-bit integers */ #define P4_FUNCCTX (-15) /* P4 is a pointer to an sqlite3_context object */ +#define P4_TABLEREF (-16) /* Like P4_TABLE, but reference counted */ /* Error message codes for OP_Halt */ #define P5_ConstraintNotNull 1 @@ -16269,12 +16621,12 @@ typedef struct VdbeOpList VdbeOpList; #define OP_Vacuum 5 #define OP_VFilter 6 /* jump, synopsis: iplan=r[P3] zplan='P4' */ #define OP_VUpdate 7 /* synopsis: data=r[P3@P2] */ -#define OP_Init 8 /* jump, synopsis: Start at P2 */ +#define OP_Init 8 /* jump0, synopsis: Start at P2 */ #define OP_Goto 9 /* jump */ #define OP_Gosub 10 /* jump */ -#define OP_InitCoroutine 11 /* jump */ -#define OP_Yield 12 /* jump */ -#define OP_MustBeInt 13 /* jump */ +#define OP_InitCoroutine 11 /* jump0 */ +#define OP_Yield 12 /* jump0 */ +#define OP_MustBeInt 13 /* jump0 */ #define OP_Jump 14 /* jump */ #define OP_Once 15 /* jump */ #define OP_If 16 /* jump */ @@ -16282,22 +16634,22 @@ typedef struct VdbeOpList VdbeOpList; #define OP_IsType 18 /* jump, synopsis: if typeof(P1.P3) in P5 goto P2 */ #define OP_Not 19 /* same as TK_NOT, synopsis: r[P2]= !r[P1] */ #define OP_IfNullRow 20 /* jump, synopsis: if P1.nullRow then r[P3]=NULL, goto P2 */ -#define OP_SeekLT 21 /* jump, synopsis: key=r[P3@P4] */ -#define OP_SeekLE 22 /* jump, synopsis: key=r[P3@P4] */ -#define OP_SeekGE 23 /* jump, synopsis: key=r[P3@P4] */ -#define OP_SeekGT 24 /* jump, synopsis: key=r[P3@P4] */ +#define OP_SeekLT 21 /* jump0, synopsis: key=r[P3@P4] */ +#define OP_SeekLE 22 /* jump0, synopsis: key=r[P3@P4] */ +#define OP_SeekGE 23 /* jump0, synopsis: key=r[P3@P4] */ +#define OP_SeekGT 24 /* jump0, synopsis: key=r[P3@P4] */ #define OP_IfNotOpen 25 /* jump, synopsis: if( !csr[P1] ) goto P2 */ #define OP_IfNoHope 26 /* jump, synopsis: key=r[P3@P4] */ #define OP_NoConflict 27 /* jump, synopsis: key=r[P3@P4] */ #define OP_NotFound 28 /* jump, synopsis: key=r[P3@P4] */ #define OP_Found 29 /* jump, synopsis: key=r[P3@P4] */ -#define OP_SeekRowid 30 /* jump, synopsis: intkey=r[P3] */ +#define OP_SeekRowid 30 /* jump0, synopsis: intkey=r[P3] */ #define OP_NotExists 31 /* jump, synopsis: intkey=r[P3] */ -#define OP_Last 32 /* jump */ -#define OP_IfSmaller 33 /* jump */ +#define OP_Last 32 /* jump0 */ +#define OP_IfSizeBetween 33 /* jump */ #define OP_SorterSort 34 /* jump */ #define OP_Sort 35 /* jump */ -#define OP_Rewind 36 /* jump */ +#define OP_Rewind 36 /* jump0 */ #define OP_SorterNext 37 /* jump */ #define OP_Prev 38 /* jump */ #define OP_Next 39 /* jump */ @@ -16309,7 +16661,7 @@ typedef struct VdbeOpList VdbeOpList; #define OP_IdxGE 45 /* jump, synopsis: key=r[P3@P4] */ #define OP_RowSetRead 46 /* jump, synopsis: r[P3]=rowset(P1) */ #define OP_RowSetTest 47 /* jump, synopsis: if r[P3] in rowset(P1) goto P2 */ -#define OP_Program 48 /* jump */ +#define OP_Program 48 /* jump0 */ #define OP_FkIfZero 49 /* jump, synopsis: if fkctr[P1]==0 goto P2 */ #define OP_IsNull 50 /* jump, same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */ #define OP_NotNull 51 /* jump, same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */ @@ -16339,7 +16691,7 @@ typedef struct VdbeOpList VdbeOpList; #define OP_Null 75 /* synopsis: r[P2..P3]=NULL */ #define OP_SoftNull 76 /* synopsis: r[P1]=NULL */ #define OP_Blob 77 /* synopsis: r[P2]=P4 (len=P1) */ -#define OP_Variable 78 /* synopsis: r[P2]=parameter(P1,P4) */ +#define OP_Variable 78 /* synopsis: r[P2]=parameter(P1) */ #define OP_Move 79 /* synopsis: r[P2@P3]=r[P1@P3] */ #define OP_Copy 80 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ #define OP_SCopy 81 /* synopsis: r[P2]=r[P1] */ @@ -16435,19 +16787,22 @@ typedef struct VdbeOpList VdbeOpList; #define OP_VCreate 171 #define OP_VDestroy 172 #define OP_VOpen 173 -#define OP_VInitIn 174 /* synopsis: r[P2]=ValueList(P1,P3) */ -#define OP_VColumn 175 /* synopsis: r[P3]=vcolumn(P2) */ -#define OP_VRename 176 -#define OP_Pagecount 177 -#define OP_MaxPgcnt 178 -#define OP_ClrSubtype 179 /* synopsis: r[P1].subtype = 0 */ -#define OP_FilterAdd 180 /* synopsis: filter(P1) += key(P3@P4) */ -#define OP_Trace 181 -#define OP_CursorHint 182 -#define OP_ReleaseReg 183 /* synopsis: release r[P1@P2] mask P3 */ -#define OP_Noop 184 -#define OP_Explain 185 -#define OP_Abortable 186 +#define OP_VCheck 174 +#define OP_VInitIn 175 /* synopsis: r[P2]=ValueList(P1,P3) */ +#define OP_VColumn 176 /* synopsis: r[P3]=vcolumn(P2) */ +#define OP_VRename 177 +#define OP_Pagecount 178 +#define OP_MaxPgcnt 179 +#define OP_ClrSubtype 180 /* synopsis: r[P1].subtype = 0 */ +#define OP_GetSubtype 181 /* synopsis: r[P2] = r[P1].subtype */ +#define OP_SetSubtype 182 /* synopsis: r[P2].subtype = r[P1] */ +#define OP_FilterAdd 183 /* synopsis: filter(P1) += key(P3@P4) */ +#define OP_Trace 184 +#define OP_CursorHint 185 +#define OP_ReleaseReg 186 /* synopsis: release r[P1@P2] mask P3 */ +#define OP_Noop 187 +#define OP_Explain 188 +#define OP_Abortable 189 /* Properties such as "out2" or "jump" that are specified in ** comments following the "case" for each opcode in the vdbe.c @@ -16460,14 +16815,15 @@ typedef struct VdbeOpList VdbeOpList; #define OPFLG_OUT2 0x10 /* out2: P2 is an output */ #define OPFLG_OUT3 0x20 /* out3: P3 is an output */ #define OPFLG_NCYCLE 0x40 /* ncycle:Cycles count against P1 */ +#define OPFLG_JUMP0 0x80 /* jump0: P2 might be zero */ #define OPFLG_INITIALIZER {\ /* 0 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x41, 0x00,\ -/* 8 */ 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x01, 0x01,\ -/* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0x49, 0x49, 0x49,\ -/* 24 */ 0x49, 0x01, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,\ -/* 32 */ 0x41, 0x01, 0x41, 0x41, 0x41, 0x01, 0x41, 0x41,\ +/* 8 */ 0x81, 0x01, 0x01, 0x81, 0x83, 0x83, 0x01, 0x01,\ +/* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0xc9, 0xc9, 0xc9,\ +/* 24 */ 0xc9, 0x01, 0x49, 0x49, 0x49, 0x49, 0xc9, 0x49,\ +/* 32 */ 0xc1, 0x01, 0x41, 0x41, 0xc1, 0x01, 0x41, 0x41,\ /* 40 */ 0x41, 0x41, 0x41, 0x26, 0x26, 0x41, 0x23, 0x0b,\ -/* 48 */ 0x01, 0x01, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ +/* 48 */ 0x81, 0x01, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ /* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x03, 0x03, 0x01, 0x41,\ /* 64 */ 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10,\ /* 72 */ 0x10, 0x10, 0x00, 0x10, 0x00, 0x10, 0x10, 0x00,\ @@ -16482,9 +16838,9 @@ typedef struct VdbeOpList VdbeOpList; /* 144 */ 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,\ /* 152 */ 0x00, 0x10, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04,\ /* 160 */ 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ -/* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x50, 0x40,\ -/* 176 */ 0x00, 0x10, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00,\ -/* 184 */ 0x00, 0x00, 0x00,} +/* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x10, 0x50,\ +/* 176 */ 0x40, 0x00, 0x10, 0x10, 0x02, 0x12, 0x12, 0x00,\ +/* 184 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,} /* The resolve3P2Values() routine is able to run faster if it knows ** the value of the largest JUMP opcode. The smaller the maximum @@ -16627,6 +16983,8 @@ SQLITE_PRIVATE RecordCompare sqlite3VdbeFindCompare(UnpackedRecord*); SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *); SQLITE_PRIVATE int sqlite3VdbeHasSubProgram(Vdbe*); +SQLITE_PRIVATE void sqlite3MemSetArrayInt64(sqlite3_value *aMem, int iIdx, i64 val); + SQLITE_PRIVATE int sqlite3NotPureFunc(sqlite3_context*); #ifdef SQLITE_ENABLE_BYTECODE_VTAB SQLITE_PRIVATE int sqlite3VdbeBytecodeVtabInit(sqlite3*); @@ -17214,6 +17572,10 @@ struct FuncDefHash { }; #define SQLITE_FUNC_HASH(C,L) (((C)+(L))%SQLITE_FUNC_HASH_SZ) +#if defined(SQLITE_USER_AUTHENTICATION) +# warning "The SQLITE_USER_AUTHENTICATION extension is deprecated. \ + See ext/userauth/user-auth.txt for details." +#endif #ifdef SQLITE_USER_AUTHENTICATION /* ** Information held in the "sqlite3" database connection object and used @@ -17393,6 +17755,7 @@ struct sqlite3 { i64 nDeferredCons; /* Net deferred constraints this transaction. */ i64 nDeferredImmCons; /* Net deferred immediate constraints */ int *pnBytesFreed; /* If not NULL, increment this in DbFree() */ + DbClientData *pDbData; /* sqlite3_set_clientdata() content */ #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY /* The following variables are all protected by the STATIC_MAIN ** mutex, not by sqlite3.mutex. They are used by code in notify.c. @@ -17475,6 +17838,7 @@ struct sqlite3 { /* the count using a callback. */ #define SQLITE_CorruptRdOnly HI(0x00002) /* Prohibit writes due to error */ #define SQLITE_ReadUncommit HI(0x00004) /* READ UNCOMMITTED in shared-cache */ +#define SQLITE_FkNoAction HI(0x00008) /* Treat all FK as NO ACTION */ /* Flags used only if debugging */ #ifdef SQLITE_DEBUG @@ -17515,7 +17879,7 @@ struct sqlite3 { #define SQLITE_CursorHints 0x00000400 /* Add OP_CursorHint opcodes */ #define SQLITE_Stat4 0x00000800 /* Use STAT4 data */ /* TH3 expects this value ^^^^^^^^^^ to be 0x0000800. Don't change it */ -#define SQLITE_PushDown 0x00001000 /* The push-down optimization */ +#define SQLITE_PushDown 0x00001000 /* WHERE-clause push-down opt */ #define SQLITE_SimplifyJoin 0x00002000 /* Convert LEFT JOIN to JOIN */ #define SQLITE_SkipScan 0x00004000 /* Skip-scans */ #define SQLITE_PropagateConst 0x00008000 /* The constant propagation opt */ @@ -17643,14 +18007,15 @@ struct FuncDestructor { #define SQLITE_FUNC_SLOCHNG 0x2000 /* "Slow Change". Value constant during a ** single query - might change over time */ #define SQLITE_FUNC_TEST 0x4000 /* Built-in testing functions */ -/* 0x8000 -- available for reuse */ +#define SQLITE_FUNC_RUNONLY 0x8000 /* Cannot be used by valueFromFunction */ #define SQLITE_FUNC_WINDOW 0x00010000 /* Built-in window-only function */ #define SQLITE_FUNC_INTERNAL 0x00040000 /* For use by NestedParse() only */ #define SQLITE_FUNC_DIRECT 0x00080000 /* Not for use in TRIGGERs or VIEWs */ -#define SQLITE_FUNC_SUBTYPE 0x00100000 /* Result likely to have sub-type */ +/* SQLITE_SUBTYPE 0x00100000 // Consumer of subtypes */ #define SQLITE_FUNC_UNSAFE 0x00200000 /* Function has side effects */ #define SQLITE_FUNC_INLINE 0x00400000 /* Functions implemented in-line */ #define SQLITE_FUNC_BUILTIN 0x00800000 /* This is a built-in function */ +/* SQLITE_RESULT_SUBTYPE 0x01000000 // Generator of subtypes */ #define SQLITE_FUNC_ANYORDER 0x08000000 /* count/min/max aggregate */ /* Identifier numbers for each in-line function */ @@ -17742,10 +18107,11 @@ struct FuncDestructor { #define MFUNCTION(zName, nArg, xPtr, xFunc) \ {nArg, SQLITE_FUNC_BUILTIN|SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \ xPtr, 0, xFunc, 0, 0, 0, #zName, {0} } -#define JFUNCTION(zName, nArg, iArg, xFunc) \ - {nArg, SQLITE_FUNC_BUILTIN|SQLITE_DETERMINISTIC|\ - SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \ - SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} } +#define JFUNCTION(zName, nArg, bUseCache, bWS, bRS, bJsonB, iArg, xFunc) \ + {nArg, SQLITE_FUNC_BUILTIN|SQLITE_DETERMINISTIC|SQLITE_FUNC_CONSTANT|\ + SQLITE_UTF8|((bUseCache)*SQLITE_FUNC_RUNONLY)|\ + ((bRS)*SQLITE_SUBTYPE)|((bWS)*SQLITE_RESULT_SUBTYPE), \ + SQLITE_INT_TO_PTR(iArg|((bJsonB)*JSON_BLOB)),0,xFunc,0, 0, 0, #zName, {0} } #define INLINE_FUNC(zName, nArg, iArg, mFlags) \ {nArg, SQLITE_FUNC_BUILTIN|\ SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \ @@ -18086,8 +18452,7 @@ struct Table { #define TF_HasStored 0x00000040 /* Has one or more STORED columns */ #define TF_HasGenerated 0x00000060 /* Combo: HasVirtual + HasStored */ #define TF_WithoutRowid 0x00000080 /* No rowid. PRIMARY KEY is the key */ -#define TF_StatsUsed 0x00000100 /* Query planner decisions affected by - ** Index.aiRowLogEst[] values */ +#define TF_MaybeReanalyze 0x00000100 /* Maybe run ANALYZE on this table */ #define TF_NoVisibleRowid 0x00000200 /* No user-visible "rowid" column */ #define TF_OOOHidden 0x00000400 /* Out-of-Order hidden columns */ #define TF_HasNotNull 0x00000800 /* Contains NOT NULL constraints */ @@ -18143,6 +18508,15 @@ struct Table { #define HasRowid(X) (((X)->tabFlags & TF_WithoutRowid)==0) #define VisibleRowid(X) (((X)->tabFlags & TF_NoVisibleRowid)==0) +/* Macro is true if the SQLITE_ALLOW_ROWID_IN_VIEW (mis-)feature is +** available. By default, this macro is false +*/ +#ifndef SQLITE_ALLOW_ROWID_IN_VIEW +# define ViewCanHaveRowid 0 +#else +# define ViewCanHaveRowid (sqlite3Config.mNoVisibleRowid==0) +#endif + /* ** Each foreign key constraint is an instance of the following structure. ** @@ -18380,6 +18754,7 @@ struct Index { unsigned isCovering:1; /* True if this is a covering index */ unsigned noSkipScan:1; /* Do not try to use skip-scan if true */ unsigned hasStat1:1; /* aiRowLogEst values come from sqlite_stat1 */ + unsigned bLowQual:1; /* sqlite_stat1 says this is a low-quality index */ unsigned bNoQuery:1; /* Do not use this index to optimize queries */ unsigned bAscKeyBug:1; /* True if the bba7b69f9849b5bf bug applies */ unsigned bHasVCol:1; /* Index references one or more VIRTUAL columns */ @@ -18490,6 +18865,10 @@ struct AggInfo { FuncDef *pFunc; /* The aggregate function implementation */ int iDistinct; /* Ephemeral table used to enforce DISTINCT */ int iDistAddr; /* Address of OP_OpenEphemeral */ + int iOBTab; /* Ephemeral table to implement ORDER BY */ + u8 bOBPayload; /* iOBTab has payload columns separate from key */ + u8 bOBUnique; /* Enforce uniqueness on iOBTab keys */ + u8 bUseSubtype; /* Transfer subtype info through sorter */ } *aFunc; int nFunc; /* Number of entries in aFunc[] */ u32 selId; /* Select to which this AggInfo belongs */ @@ -18674,7 +19053,7 @@ struct Expr { #define EP_Reduced 0x004000 /* Expr struct EXPR_REDUCEDSIZE bytes only */ #define EP_Win 0x008000 /* Contains window functions */ #define EP_TokenOnly 0x010000 /* Expr struct EXPR_TOKENONLYSIZE bytes only */ - /* 0x020000 // Available for reuse */ +#define EP_FullSize 0x020000 /* Expr structure must remain full sized */ #define EP_IfNullRow 0x040000 /* The TK_IF_NULL_ROW opcode */ #define EP_Unlikely 0x080000 /* unlikely() or likelihood() function */ #define EP_ConstFunc 0x100000 /* A SQLITE_FUNC_CONSTANT or _SLOCHNG function */ @@ -18704,6 +19083,7 @@ struct Expr { #define ExprClearProperty(E,P) (E)->flags&=~(P) #define ExprAlwaysTrue(E) (((E)->flags&(EP_OuterON|EP_IsTrue))==EP_IsTrue) #define ExprAlwaysFalse(E) (((E)->flags&(EP_OuterON|EP_IsFalse))==EP_IsFalse) +#define ExprIsFullSize(E) (((E)->flags&(EP_Reduced|EP_TokenOnly))==0) /* Macros used to ensure that the correct members of unions are accessed ** in Expr. @@ -18821,6 +19201,7 @@ struct ExprList { #define ENAME_NAME 0 /* The AS clause of a result set */ #define ENAME_SPAN 1 /* Complete text of the result set expression */ #define ENAME_TAB 2 /* "DB.TABLE.NAME" for the result set */ +#define ENAME_ROWID 3 /* "DB.TABLE._rowid_" for * expansion of rowid */ /* ** An instance of this structure can hold a simple list of identifiers, @@ -18871,10 +19252,12 @@ struct IdList { ** ** Union member validity: ** -** u1.zIndexedBy fg.isIndexedBy && !fg.isTabFunc -** u1.pFuncArg fg.isTabFunc && !fg.isIndexedBy -** u2.pIBIndex fg.isIndexedBy && !fg.isCte -** u2.pCteUse fg.isCte && !fg.isIndexedBy +** u1.zIndexedBy fg.isIndexedBy && !fg.isTabFunc +** u1.pFuncArg fg.isTabFunc && !fg.isIndexedBy +** u1.nRow !fg.isTabFunc && !fg.isIndexedBy +** +** u2.pIBIndex fg.isIndexedBy && !fg.isCte +** u2.pCteUse fg.isCte && !fg.isIndexedBy */ struct SrcItem { Schema *pSchema; /* Schema to which this item is fixed */ @@ -18902,6 +19285,7 @@ struct SrcItem { unsigned isOn :1; /* u3.pOn was once valid and non-NULL */ unsigned isSynthUsing :1; /* u3.pUsing is synthesized from NATURAL */ unsigned isNestedFrom :1; /* pSelect is a SF_NestedFrom subquery */ + unsigned rowidUsed :1; /* The ROWID of this table is referenced */ } fg; int iCursor; /* The VDBE cursor number used to access this table */ union { @@ -18912,6 +19296,7 @@ struct SrcItem { union { char *zIndexedBy; /* Identifier from "INDEXED BY " clause */ ExprList *pFuncArg; /* Arguments to table-valued-function */ + u32 nRow; /* Number of rows in a VALUES clause */ } u1; union { Index *pIBIndex; /* Index structure corresponding to u1.zIndexedBy */ @@ -19021,6 +19406,7 @@ struct NameContext { int nRef; /* Number of names resolved by this context */ int nNcErr; /* Number of errors encountered while resolving names */ int ncFlags; /* Zero or more NC_* flags defined below */ + u32 nNestedSelect; /* Number of nested selects using this NC */ Select *pWinSelect; /* SELECT statement for any window functions */ }; @@ -19054,6 +19440,7 @@ struct NameContext { #define NC_InAggFunc 0x020000 /* True if analyzing arguments to an agg func */ #define NC_FromDDL 0x040000 /* SQL text comes from sqlite_schema */ #define NC_NoSelect 0x080000 /* Do not descend into sub-selects */ +#define NC_Where 0x100000 /* Processing WHERE clause of a SELECT */ #define NC_OrderAgg 0x8000000 /* Has an aggregate other than count/min/max */ /* @@ -19077,6 +19464,7 @@ struct Upsert { Expr *pUpsertWhere; /* WHERE clause for the ON CONFLICT UPDATE */ Upsert *pNextUpsert; /* Next ON CONFLICT clause in the list */ u8 isDoUpdate; /* True for DO UPDATE. False for DO NOTHING */ + u8 isDup; /* True if 2nd or later with same pUpsertIdx */ /* Above this point is the parse tree for the ON CONFLICT clauses. ** The next group of fields stores intermediate data. */ void *pToFree; /* Free memory when deleting the Upsert object */ @@ -19166,11 +19554,12 @@ struct Select { #define SF_View 0x0200000 /* SELECT statement is a view */ #define SF_NoopOrderBy 0x0400000 /* ORDER BY is ignored for this query */ #define SF_UFSrcCheck 0x0800000 /* Check pSrc as required by UPDATE...FROM */ -#define SF_PushDown 0x1000000 /* SELECT has be modified by push-down opt */ +#define SF_PushDown 0x1000000 /* Modified by WHERE-clause push-down opt */ #define SF_MultiPart 0x2000000 /* Has multiple incompatible PARTITIONs */ #define SF_CopyCte 0x4000000 /* SELECT statement is a copy of a CTE */ #define SF_OrderByReqd 0x8000000 /* The ORDER BY clause may not be omitted */ #define SF_UpdateFrom 0x10000000 /* Query originates with UPDATE FROM */ +#define SF_Correlated 0x20000000 /* True if references the outer context */ /* True if S exists and has SF_NestedFrom */ #define IsNestedFrom(S) ((S)!=0 && ((S)->selFlags&SF_NestedFrom)!=0) @@ -19410,6 +19799,7 @@ struct Parse { u8 disableLookaside; /* Number of times lookaside has been disabled */ u8 prepFlags; /* SQLITE_PREPARE_* flags */ u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */ + u8 bHasWith; /* True if statement contains WITH */ #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST) u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */ #endif @@ -19429,6 +19819,7 @@ struct Parse { int *aLabel; /* Space to hold the labels */ ExprList *pConstExpr;/* Constant expressions */ IndexedExpr *pIdxEpr;/* List of expressions used by active indexes */ + IndexedExpr *pIdxPartExpr; /* Exprs constrained by index WHERE clauses */ Token constraintName;/* Name of the constraint currently being parsed */ yDbMask writeMask; /* Start a write transaction on these databases */ yDbMask cookieMask; /* Bitmask of schema verified databases */ @@ -19700,6 +20091,7 @@ struct Returning { int iRetCur; /* Transient table holding RETURNING results */ int nRetCol; /* Number of in pReturnEL after expansion */ int iRetReg; /* Register array for holding a row of RETURNING */ + char zName[40]; /* Name of trigger: "sqlite_returning_%p" */ }; /* @@ -19735,6 +20127,9 @@ struct sqlite3_str { ** ** 3. Make a (read-only) copy of a read-only RCStr string using ** sqlite3RCStrRef(). +** +** "String" is in the name, but an RCStr object can also be used to hold +** binary data. */ struct RCStr { u64 nRCRef; /* Number of references */ @@ -19793,6 +20188,9 @@ struct Sqlite3Config { u8 bSmallMalloc; /* Avoid large memory allocations if true */ u8 bExtraSchemaChecks; /* Verify type,name,tbl_name in schema */ u8 bUseLongDouble; /* Make use of long double */ +#ifdef SQLITE_DEBUG + u8 bJsonSelfcheck; /* Double-check JSON parsing */ +#endif int mxStrlen; /* Maximum string length */ int neverCorrupt; /* Database is always well-formed */ int szLookaside; /* Default lookaside buffer size */ @@ -19839,6 +20237,11 @@ struct Sqlite3Config { #endif #ifndef SQLITE_UNTESTABLE int (*xTestCallback)(int); /* Invoked by sqlite3FaultSim() */ +#endif +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + u32 mNoVisibleRowid; /* TF_NoVisibleRowid if the ROWID_IN_VIEW + ** feature is disabled. 0 if rowids can + ** occur in views. */ #endif int bLocaltimeFault; /* True to fail localtime() calls */ int (*xAltLocaltime)(const void*,void*); /* Alternative localtime() routine */ @@ -20000,6 +20403,16 @@ struct CteUse { }; +/* Client data associated with sqlite3_set_clientdata() and +** sqlite3_get_clientdata(). +*/ +struct DbClientData { + DbClientData *pNext; /* Next in a linked list */ + void *pData; /* The data */ + void (*xDestructor)(void*); /* Destructor. Might be NULL */ + char zName[1]; /* Name of this client data. MUST BE LAST */ +}; + #ifdef SQLITE_DEBUG /* ** An instance of the TreeView object is used for printing the content of @@ -20066,6 +20479,9 @@ struct Window { ** due to the SQLITE_SUBTYPE flag */ }; +SQLITE_PRIVATE Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow); +SQLITE_PRIVATE void sqlite3MultiValuesEnd(Parse *pParse, Select *pVal); + #ifndef SQLITE_OMIT_WINDOWFUNC SQLITE_PRIVATE void sqlite3WindowDelete(sqlite3*, Window*); SQLITE_PRIVATE void sqlite3WindowUnlinkFromSelect(Window*); @@ -20285,10 +20701,13 @@ SQLITE_PRIVATE void sqlite3MutexWarnOnContention(sqlite3_mutex*); # define EXP754 (((u64)0x7ff)<<52) # define MAN754 ((((u64)1)<<52)-1) # define IsNaN(X) (((X)&EXP754)==EXP754 && ((X)&MAN754)!=0) +# define IsOvfl(X) (((X)&EXP754)==EXP754) SQLITE_PRIVATE int sqlite3IsNaN(double); +SQLITE_PRIVATE int sqlite3IsOverflow(double); #else -# define IsNaN(X) 0 -# define sqlite3IsNaN(X) 0 +# define IsNaN(X) 0 +# define sqlite3IsNaN(X) 0 +# define sqlite3IsOVerflow(X) 0 #endif /* @@ -20380,6 +20799,7 @@ SQLITE_PRIVATE int sqlite3ErrorToParser(sqlite3*,int); SQLITE_PRIVATE void sqlite3Dequote(char*); SQLITE_PRIVATE void sqlite3DequoteExpr(Expr*); SQLITE_PRIVATE void sqlite3DequoteToken(Token*); +SQLITE_PRIVATE void sqlite3DequoteNumber(Parse*, Expr*); SQLITE_PRIVATE void sqlite3TokenInit(Token*,char*); SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char*, int); SQLITE_PRIVATE int sqlite3RunParser(Parse*, const char*); @@ -20404,10 +20824,13 @@ SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse*, Expr*, Select*); SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse*,Expr*, Expr*); SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr*); SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, const Token*, int); +SQLITE_PRIVATE void sqlite3ExprAddFunctionOrderBy(Parse*,Expr*,ExprList*); +SQLITE_PRIVATE void sqlite3ExprOrderByAggregateError(Parse*,Expr*); SQLITE_PRIVATE void sqlite3ExprFunctionUsable(Parse*,const Expr*,const FuncDef*); SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32); SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*); -SQLITE_PRIVATE void sqlite3ExprDeferredDelete(Parse*, Expr*); +SQLITE_PRIVATE void sqlite3ExprDeleteGeneric(sqlite3*,void*); +SQLITE_PRIVATE int sqlite3ExprDeferredDelete(Parse*, Expr*); SQLITE_PRIVATE void sqlite3ExprUnmapAndDelete(Parse*, Expr*); SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*); SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*); @@ -20416,6 +20839,7 @@ SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList*,int,int); SQLITE_PRIVATE void sqlite3ExprListSetName(Parse*,ExprList*,const Token*,int); SQLITE_PRIVATE void sqlite3ExprListSetSpan(Parse*,ExprList*,const char*,const char*); SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3*, ExprList*); +SQLITE_PRIVATE void sqlite3ExprListDeleteGeneric(sqlite3*,void*); SQLITE_PRIVATE u32 sqlite3ExprListFlags(const ExprList*); SQLITE_PRIVATE int sqlite3IndexHasDuplicateRootPage(Index*); SQLITE_PRIVATE int sqlite3Init(sqlite3*, char**); @@ -20506,6 +20930,7 @@ SQLITE_PRIVATE int sqlite3DbMaskAllZero(yDbMask); SQLITE_PRIVATE void sqlite3DropTable(Parse*, SrcList*, int, int); SQLITE_PRIVATE void sqlite3CodeDropTable(Parse*, Table*, int, int); SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3*, Table*); +SQLITE_PRIVATE void sqlite3DeleteTableGeneric(sqlite3*, void*); SQLITE_PRIVATE void sqlite3FreeIndex(sqlite3*, Index*); #ifndef SQLITE_OMIT_AUTOINCREMENT SQLITE_PRIVATE void sqlite3AutoincrementBegin(Parse *pParse); @@ -20542,6 +20967,7 @@ SQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*); SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*, Expr*,ExprList*,u32,Expr*); SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*); +SQLITE_PRIVATE void sqlite3SelectDeleteGeneric(sqlite3*,void*); SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*); SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, Trigger*); SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int); @@ -20627,12 +21053,10 @@ SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3*); SQLITE_PRIVATE u32 sqlite3IsTrueOrFalse(const char*); SQLITE_PRIVATE int sqlite3ExprIdToTrueFalse(Expr*); SQLITE_PRIVATE int sqlite3ExprTruthValue(const Expr*); -SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*); -SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*); +SQLITE_PRIVATE int sqlite3ExprIsConstant(Parse*,Expr*); SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*, u8); SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse*, Expr*, ExprList*); -SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr*,int); -SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(Expr*,const SrcList*,int); +SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint(Expr*,const SrcList*,int,int); #ifdef SQLITE_ENABLE_CURSOR_HINTS SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr*); #endif @@ -20640,6 +21064,7 @@ SQLITE_PRIVATE int sqlite3ExprIsInteger(const Expr*, int*); SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr*); SQLITE_PRIVATE int sqlite3ExprNeedsNoAffinityChange(const Expr*, char); SQLITE_PRIVATE int sqlite3IsRowid(const char*); +SQLITE_PRIVATE const char *sqlite3RowidAlias(Table *pTab); SQLITE_PRIVATE void sqlite3GenerateRowDelete( Parse*,Table*,Trigger*,int,int,int,i16,u8,u8,u8,int); SQLITE_PRIVATE void sqlite3GenerateRowIndexDelete(Parse*, Table*, int, int, int*, int); @@ -20767,6 +21192,7 @@ SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar); #endif SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte); SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**); +SQLITE_PRIVATE int sqlite3Utf8ReadLimited(const u8*, int, u32*); SQLITE_PRIVATE LogEst sqlite3LogEst(u64); SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst,LogEst); SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double); @@ -20815,7 +21241,9 @@ SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3*, int, const char*,...); SQLITE_PRIVATE void sqlite3Error(sqlite3*,int); SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3*); SQLITE_PRIVATE void sqlite3SystemError(sqlite3*,int); +#if !defined(SQLITE_OMIT_BLOB_LITERAL) SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n); +#endif SQLITE_PRIVATE u8 sqlite3HexToInt(int h); SQLITE_PRIVATE int sqlite3TwoPartName(Parse *, Token *, Token *, Token **); @@ -20911,7 +21339,8 @@ SQLITE_PRIVATE int sqlite3MatchEName( const struct ExprList_item*, const char*, const char*, - const char* + const char*, + int* ); SQLITE_PRIVATE Bitmask sqlite3ExprColUsed(Expr*); SQLITE_PRIVATE u8 sqlite3StrIHash(const char*); @@ -20968,7 +21397,7 @@ SQLITE_PRIVATE int sqlite3ApiExit(sqlite3 *db, int); SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *); SQLITE_PRIVATE char *sqlite3RCStrRef(char*); -SQLITE_PRIVATE void sqlite3RCStrUnref(char*); +SQLITE_PRIVATE void sqlite3RCStrUnref(void*); SQLITE_PRIVATE char *sqlite3RCStrNew(u64); SQLITE_PRIVATE char *sqlite3RCStrResize(char*,u64); @@ -21112,6 +21541,7 @@ SQLITE_PRIVATE Cte *sqlite3CteNew(Parse*,Token*,ExprList*,Select*,u8); SQLITE_PRIVATE void sqlite3CteDelete(sqlite3*,Cte*); SQLITE_PRIVATE With *sqlite3WithAdd(Parse*,With*,Cte*); SQLITE_PRIVATE void sqlite3WithDelete(sqlite3*,With*); +SQLITE_PRIVATE void sqlite3WithDeleteGeneric(sqlite3*,void*); SQLITE_PRIVATE With *sqlite3WithPush(Parse*, With*, u8); #else # define sqlite3CteNew(P,T,E,S) ((void*)0) @@ -21124,7 +21554,7 @@ SQLITE_PRIVATE With *sqlite3WithPush(Parse*, With*, u8); SQLITE_PRIVATE Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*,Upsert*); SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3*,Upsert*); SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3*,Upsert*); -SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget(Parse*,SrcList*,Upsert*); +SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget(Parse*,SrcList*,Upsert*,Upsert*); SQLITE_PRIVATE void sqlite3UpsertDoUpdate(Parse*,Upsert*,Table*,Index*,int); SQLITE_PRIVATE Upsert *sqlite3UpsertOfIndex(Upsert*,Index*); SQLITE_PRIVATE int sqlite3UpsertNextIsIPK(Upsert*); @@ -21514,6 +21944,9 @@ static const char * const sqlite3azCompileOpt[] = { "ALLOW_COVERING_INDEX_SCAN=" CTIMEOPT_VAL(SQLITE_ALLOW_COVERING_INDEX_SCAN), # endif #endif +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + "ALLOW_ROWID_IN_VIEW", +#endif #ifdef SQLITE_ALLOW_URI_AUTHORITY "ALLOW_URI_AUTHORITY", #endif @@ -21804,6 +22237,9 @@ static const char * const sqlite3azCompileOpt[] = { #ifdef SQLITE_EXPLAIN_ESTIMATED_ROWS "EXPLAIN_ESTIMATED_ROWS", #endif +#ifdef SQLITE_EXTRA_AUTOEXT + "EXTRA_AUTOEXT=" CTIMEOPT_VAL(SQLITE_EXTRA_AUTOEXT), +#endif #ifdef SQLITE_EXTRA_IFNULLROW "EXTRA_IFNULLROW", #endif @@ -22085,6 +22521,9 @@ static const char * const sqlite3azCompileOpt[] = { #ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS "OMIT_SCHEMA_VERSION_PRAGMAS", #endif +#ifdef SQLITE_OMIT_SEH + "OMIT_SEH", +#endif #ifdef SQLITE_OMIT_SHARED_CACHE "OMIT_SHARED_CACHE", #endif @@ -22483,6 +22922,9 @@ SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = { 0, /* bSmallMalloc */ 1, /* bExtraSchemaChecks */ sizeof(LONGDOUBLE_TYPE)>8, /* bUseLongDouble */ +#ifdef SQLITE_DEBUG + 0, /* bJsonSelfcheck */ +#endif 0x7ffffffe, /* mxStrlen */ 0, /* neverCorrupt */ SQLITE_DEFAULT_LOOKASIDE, /* szLookaside, nLookaside */ @@ -22524,6 +22966,9 @@ SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = { #endif #ifndef SQLITE_UNTESTABLE 0, /* xTestCallback */ +#endif +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + 0, /* mNoVisibleRowid. 0 == allow rowid-in-view */ #endif 0, /* bLocaltimeFault */ 0, /* xAltLocaltime */ @@ -23735,7 +24180,7 @@ SQLITE_API int sqlite3_db_status( case SQLITE_DBSTATUS_CACHE_MISS: case SQLITE_DBSTATUS_CACHE_WRITE:{ int i; - int nRet = 0; + u64 nRet = 0; assert( SQLITE_DBSTATUS_CACHE_MISS==SQLITE_DBSTATUS_CACHE_HIT+1 ); assert( SQLITE_DBSTATUS_CACHE_WRITE==SQLITE_DBSTATUS_CACHE_HIT+2 ); @@ -23748,7 +24193,7 @@ SQLITE_API int sqlite3_db_status( *pHighwater = 0; /* IMP: R-42420-56072 */ /* IMP: R-54100-20147 */ /* IMP: R-29431-39229 */ - *pCurrent = nRet; + *pCurrent = (int)nRet & 0x7fffffff; break; } @@ -23845,13 +24290,14 @@ struct DateTime { int tz; /* Timezone offset in minutes */ double s; /* Seconds */ char validJD; /* True (1) if iJD is valid */ - char rawS; /* Raw numeric value stored in s */ char validYMD; /* True (1) if Y,M,D are valid */ char validHMS; /* True (1) if h,m,s are valid */ - char validTZ; /* True (1) if tz is valid */ - char tzSet; /* Timezone was set explicitly */ - char isError; /* An overflow has occurred */ - char useSubsec; /* Display subsecond precision */ + char nFloor; /* Days to implement "floor" */ + unsigned rawS : 1; /* Raw numeric value stored in s */ + unsigned isError : 1; /* An overflow has occurred */ + unsigned useSubsec : 1; /* Display subsecond precision */ + unsigned isUtc : 1; /* Time is known to be UTC */ + unsigned isLocal : 1; /* Time is known to be localtime */ }; @@ -23949,6 +24395,8 @@ static int parseTimezone(const char *zDate, DateTime *p){ sgn = +1; }else if( c=='Z' || c=='z' ){ zDate++; + p->isLocal = 0; + p->isUtc = 1; goto zulu_time; }else{ return c!=0; @@ -23961,7 +24409,6 @@ static int parseTimezone(const char *zDate, DateTime *p){ p->tz = sgn*(nMn + nHr*60); zulu_time: while( sqlite3Isspace(*zDate) ){ zDate++; } - p->tzSet = 1; return *zDate!=0; } @@ -24005,7 +24452,6 @@ static int parseHhMmSs(const char *zDate, DateTime *p){ p->m = m; p->s = s + ms; if( parseTimezone(zDate, p) ) return 1; - p->validTZ = (p->tz!=0)?1:0; return 0; } @@ -24052,15 +24498,40 @@ static void computeJD(DateTime *p){ p->validJD = 1; if( p->validHMS ){ p->iJD += p->h*3600000 + p->m*60000 + (sqlite3_int64)(p->s*1000 + 0.5); - if( p->validTZ ){ + if( p->tz ){ p->iJD -= p->tz*60000; p->validYMD = 0; p->validHMS = 0; - p->validTZ = 0; + p->tz = 0; + p->isUtc = 1; + p->isLocal = 0; } } } +/* +** Given the YYYY-MM-DD information current in p, determine if there +** is day-of-month overflow and set nFloor to the number of days that +** would need to be subtracted from the date in order to bring the +** date back to the end of the month. +*/ +static void computeFloor(DateTime *p){ + assert( p->validYMD || p->isError ); + assert( p->D>=0 && p->D<=31 ); + assert( p->M>=0 && p->M<=12 ); + if( p->D<=28 ){ + p->nFloor = 0; + }else if( (1<M) & 0x15aa ){ + p->nFloor = 0; + }else if( p->M!=2 ){ + p->nFloor = (p->D==31); + }else if( p->Y%4!=0 || (p->Y%100==0 && p->Y%400!=0) ){ + p->nFloor = p->D - 28; + }else{ + p->nFloor = p->D - 29; + } +} + /* ** Parse dates of the form ** @@ -24099,12 +24570,16 @@ static int parseYyyyMmDd(const char *zDate, DateTime *p){ p->Y = neg ? -Y : Y; p->M = M; p->D = D; - if( p->validTZ ){ + computeFloor(p); + if( p->tz ){ computeJD(p); } return 0; } + +static void clearYMD_HMS_TZ(DateTime *p); /* Forward declaration */ + /* ** Set the time to the current time reported by the VFS. ** @@ -24114,6 +24589,9 @@ static int setDateTimeToCurrent(sqlite3_context *context, DateTime *p){ p->iJD = sqlite3StmtCurrentTime(context); if( p->iJD>0 ){ p->validJD = 1; + p->isUtc = 1; + p->isLocal = 0; + clearYMD_HMS_TZ(p); return 0; }else{ return 1; @@ -24252,7 +24730,7 @@ static void computeYMD_HMS(DateTime *p){ static void clearYMD_HMS_TZ(DateTime *p){ p->validYMD = 0; p->validHMS = 0; - p->validTZ = 0; + p->tz = 0; } #ifndef SQLITE_OMIT_LOCALTIME @@ -24384,7 +24862,7 @@ static int toLocaltime( p->validHMS = 1; p->validJD = 0; p->rawS = 0; - p->validTZ = 0; + p->tz = 0; p->isError = 0; return SQLITE_OK; } @@ -24404,12 +24882,12 @@ static const struct { float rLimit; /* Maximum NNN value for this transform */ float rXform; /* Constant used for this transform */ } aXformType[] = { - { 6, "second", 4.6427e+14, 1.0 }, - { 6, "minute", 7.7379e+12, 60.0 }, - { 4, "hour", 1.2897e+11, 3600.0 }, - { 3, "day", 5373485.0, 86400.0 }, - { 5, "month", 176546.0, 2592000.0 }, - { 4, "year", 14713.0, 31536000.0 }, + /* 0 */ { 6, "second", 4.6427e+14, 1.0 }, + /* 1 */ { 6, "minute", 7.7379e+12, 60.0 }, + /* 2 */ { 4, "hour", 1.2897e+11, 3600.0 }, + /* 3 */ { 3, "day", 5373485.0, 86400.0 }, + /* 4 */ { 5, "month", 176546.0, 30.0*86400.0 }, + /* 5 */ { 4, "year", 14713.0, 365.0*86400.0 }, }; /* @@ -24441,14 +24919,20 @@ static void autoAdjustDate(DateTime *p){ ** NNN.NNNN seconds ** NNN months ** NNN years +** +/-YYYY-MM-DD HH:MM:SS.SSS +** ceiling +** floor ** start of month ** start of year ** start of week ** start of day ** weekday N ** unixepoch +** auto ** localtime ** utc +** subsec +** subsecond ** ** Return 0 on success and 1 if there is any kind of error. If the error ** is in a system call (i.e. localtime()), then an error message is written @@ -24479,6 +24963,37 @@ static int parseModifier( } break; } + case 'c': { + /* + ** ceiling + ** + ** Resolve day-of-month overflow by rolling forward into the next + ** month. As this is the default action, this modifier is really + ** a no-op that is only included for symmetry. See "floor". + */ + if( sqlite3_stricmp(z, "ceiling")==0 ){ + computeJD(p); + clearYMD_HMS_TZ(p); + rc = 0; + p->nFloor = 0; + } + break; + } + case 'f': { + /* + ** floor + ** + ** Resolve day-of-month overflow by rolling back to the end of the + ** previous month. + */ + if( sqlite3_stricmp(z, "floor")==0 ){ + computeJD(p); + p->iJD -= p->nFloor*86400000; + clearYMD_HMS_TZ(p); + rc = 0; + } + break; + } case 'j': { /* ** julianday @@ -24505,7 +25020,9 @@ static int parseModifier( ** show local time. */ if( sqlite3_stricmp(z, "localtime")==0 && sqlite3NotPureFunc(pCtx) ){ - rc = toLocaltime(p, pCtx); + rc = p->isLocal ? SQLITE_OK : toLocaltime(p, pCtx); + p->isUtc = 0; + p->isLocal = 1; } break; } @@ -24530,7 +25047,7 @@ static int parseModifier( } #ifndef SQLITE_OMIT_LOCALTIME else if( sqlite3_stricmp(z, "utc")==0 && sqlite3NotPureFunc(pCtx) ){ - if( p->tzSet==0 ){ + if( p->isUtc==0 ){ i64 iOrigJD; /* Original localtime */ i64 iGuess; /* Guess at the corresponding utc time */ int cnt = 0; /* Safety to prevent infinite loop */ @@ -24553,7 +25070,8 @@ static int parseModifier( memset(p, 0, sizeof(*p)); p->iJD = iGuess; p->validJD = 1; - p->tzSet = 1; + p->isUtc = 1; + p->isLocal = 0; } rc = SQLITE_OK; } @@ -24573,7 +25091,7 @@ static int parseModifier( && r>=0.0 && r<7.0 && (n=(int)r)==r ){ sqlite3_int64 Z; computeYMD_HMS(p); - p->validTZ = 0; + p->tz = 0; p->validJD = 0; computeJD(p); Z = ((p->iJD + 129600000)/86400000) % 7; @@ -24613,7 +25131,7 @@ static int parseModifier( p->h = p->m = 0; p->s = 0.0; p->rawS = 0; - p->validTZ = 0; + p->tz = 0; p->validJD = 0; if( sqlite3_stricmp(z,"month")==0 ){ p->D = 1; @@ -24684,6 +25202,7 @@ static int parseModifier( x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12; p->Y += x; p->M -= x*12; + computeFloor(p); computeJD(p); p->validHMS = 0; p->validYMD = 0; @@ -24730,11 +25249,12 @@ static int parseModifier( z += n; while( sqlite3Isspace(*z) ) z++; n = sqlite3Strlen30(z); - if( n>10 || n<3 ) break; + if( n<3 || n>10 ) break; if( sqlite3UpperToLower[(u8)z[n-1]]=='s' ) n--; computeJD(p); assert( rc==1 ); rRounder = r<0 ? -0.5 : +0.5; + p->nFloor = 0; for(i=0; iM += (int)r; x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12; p->Y += x; p->M -= x*12; + computeFloor(p); p->validJD = 0; r -= (int)r; break; } case 5: { /* Special processing to add years */ int y = (int)r; - assert( strcmp(aXformType[i].zName,"year")==0 ); + assert( strcmp(aXformType[5].zName,"year")==0 ); computeYMD_HMS(p); + assert( p->M>=0 && p->M<=12 ); p->Y += y; + computeFloor(p); p->validJD = 0; r -= (int)r; break; @@ -24817,6 +25340,12 @@ static int isDate( } computeJD(p); if( p->isError || !validJulianDay(p->iJD) ) return 1; + if( argc==1 && p->validYMD && p->D>28 ){ + /* Make sure a YYYY-MM-DD is normalized. + ** Example: 2023-02-31 -> 2023-03-03 */ + assert( p->validJD ); + p->validYMD = 0; + } return 0; } @@ -25004,22 +25533,83 @@ static void dateFunc( } } +/* +** Compute the number of days after the most recent January 1. +** +** In other words, compute the zero-based day number for the +** current year: +** +** Jan01 = 0, Jan02 = 1, ..., Jan31 = 30, Feb01 = 31, ... +** Dec31 = 364 or 365. +*/ +static int daysAfterJan01(DateTime *pDate){ + DateTime jan01 = *pDate; + assert( jan01.validYMD ); + assert( jan01.validHMS ); + assert( pDate->validJD ); + jan01.validJD = 0; + jan01.M = 1; + jan01.D = 1; + computeJD(&jan01); + return (int)((pDate->iJD-jan01.iJD+43200000)/86400000); +} + +/* +** Return the number of days after the most recent Monday. +** +** In other words, return the day of the week according +** to this code: +** +** 0=Monday, 1=Tuesday, 2=Wednesday, ..., 6=Sunday. +*/ +static int daysAfterMonday(DateTime *pDate){ + assert( pDate->validJD ); + return (int)((pDate->iJD+43200000)/86400000) % 7; +} + +/* +** Return the number of days after the most recent Sunday. +** +** In other words, return the day of the week according +** to this code: +** +** 0=Sunday, 1=Monday, 2=Tues, ..., 6=Saturday +*/ +static int daysAfterSunday(DateTime *pDate){ + assert( pDate->validJD ); + return (int)((pDate->iJD+129600000)/86400000) % 7; +} + /* ** strftime( FORMAT, TIMESTRING, MOD, MOD, ...) ** ** Return a string described by FORMAT. Conversions as follows: ** -** %d day of month +** %d day of month 01-31 +** %e day of month 1-31 ** %f ** fractional seconds SS.SSS +** %F ISO date. YYYY-MM-DD +** %G ISO year corresponding to %V 0000-9999. +** %g 2-digit ISO year corresponding to %V 00-99 ** %H hour 00-24 -** %j day of year 000-366 +** %k hour 0-24 (leading zero converted to space) +** %I hour 01-12 +** %j day of year 001-366 ** %J ** julian day number +** %l hour 1-12 (leading zero converted to space) ** %m month 01-12 ** %M minute 00-59 +** %p "am" or "pm" +** %P "AM" or "PM" +** %R time as HH:MM ** %s seconds since 1970-01-01 ** %S seconds 00-59 -** %w day of week 0-6 Sunday==0 -** %W week of year 00-53 +** %T time as HH:MM:SS +** %u day of week 1-7 Monday==1, Sunday==7 +** %w day of week 0-6 Sunday==0, Monday==1 +** %U week of year 00-53 (First Sunday is start of week 01) +** %V week of year 01-53 (First week containing Thursday is week 01) +** %W week of year 00-53 (First Monday is start of week 01) ** %Y year 0000-9999 ** %% % */ @@ -25044,44 +25634,61 @@ static void strftimeFunc( computeJD(&x); computeYMD_HMS(&x); for(i=j=0; zFmt[i]; i++){ + char cf; if( zFmt[i]!='%' ) continue; if( j59.999 ) s = 59.999; sqlite3_str_appendf(&sRes, "%06.3f", s); break; } - case 'H': { - sqlite3_str_appendf(&sRes, "%02d", x.h); + case 'F': { + sqlite3_str_appendf(&sRes, "%04d-%02d-%02d", x.Y, x.M, x.D); break; } - case 'W': /* Fall thru */ - case 'j': { - int nDay; /* Number of days since 1st day of year */ + case 'G': /* Fall thru */ + case 'g': { DateTime y = x; - y.validJD = 0; - y.M = 1; - y.D = 1; - computeJD(&y); - nDay = (int)((x.iJD-y.iJD+43200000)/86400000); - if( zFmt[i]=='W' ){ - int wd; /* 0=Monday, 1=Tuesday, ... 6=Sunday */ - wd = (int)(((x.iJD+43200000)/86400000)%7); - sqlite3_str_appendf(&sRes,"%02d",(nDay+7-wd)/7); + assert( y.validJD ); + /* Move y so that it is the Thursday in the same week as x */ + y.iJD += (3 - daysAfterMonday(&x))*86400000; + y.validYMD = 0; + computeYMD(&y); + if( cf=='g' ){ + sqlite3_str_appendf(&sRes, "%02d", y.Y%100); }else{ - sqlite3_str_appendf(&sRes,"%03d",nDay+1); + sqlite3_str_appendf(&sRes, "%04d", y.Y); } break; } - case 'J': { + case 'H': + case 'k': { + sqlite3_str_appendf(&sRes, cf=='H' ? "%02d" : "%2d", x.h); + break; + } + case 'I': /* Fall thru */ + case 'l': { + int h = x.h; + if( h>12 ) h -= 12; + if( h==0 ) h = 12; + sqlite3_str_appendf(&sRes, cf=='I' ? "%02d" : "%2d", h); + break; + } + case 'j': { /* Day of year. Jan01==1, Jan02==2, and so forth */ + sqlite3_str_appendf(&sRes,"%03d",daysAfterJan01(&x)+1); + break; + } + case 'J': { /* Julian day number. (Non-standard) */ sqlite3_str_appendf(&sRes,"%.16g",x.iJD/86400000.0); break; } @@ -25093,6 +25700,19 @@ static void strftimeFunc( sqlite3_str_appendf(&sRes,"%02d",x.m); break; } + case 'p': /* Fall thru */ + case 'P': { + if( x.h>=12 ){ + sqlite3_str_append(&sRes, cf=='p' ? "PM" : "pm", 2); + }else{ + sqlite3_str_append(&sRes, cf=='p' ? "AM" : "am", 2); + } + break; + } + case 'R': { + sqlite3_str_appendf(&sRes, "%02d:%02d", x.h, x.m); + break; + } case 's': { if( x.useSubsec ){ sqlite3_str_appendf(&sRes,"%.3f", @@ -25107,9 +25727,35 @@ static void strftimeFunc( sqlite3_str_appendf(&sRes,"%02d",(int)x.s); break; } - case 'w': { - sqlite3_str_appendchar(&sRes, 1, - (char)(((x.iJD+129600000)/86400000) % 7) + '0'); + case 'T': { + sqlite3_str_appendf(&sRes,"%02d:%02d:%02d", x.h, x.m, (int)x.s); + break; + } + case 'u': /* Day of week. 1 to 7. Monday==1, Sunday==7 */ + case 'w': { /* Day of week. 0 to 6. Sunday==0, Monday==1 */ + char c = (char)daysAfterSunday(&x) + '0'; + if( c=='0' && cf=='u' ) c = '7'; + sqlite3_str_appendchar(&sRes, 1, c); + break; + } + case 'U': { /* Week num. 00-53. First Sun of the year is week 01 */ + sqlite3_str_appendf(&sRes,"%02d", + (daysAfterJan01(&x)-daysAfterSunday(&x)+7)/7); + break; + } + case 'V': { /* Week num. 01-53. First week with a Thur is week 01 */ + DateTime y = x; + /* Adjust y so that is the Thursday in the same week as x */ + assert( y.validJD ); + y.iJD += (3 - daysAfterMonday(&x))*86400000; + y.validYMD = 0; + computeYMD(&y); + sqlite3_str_appendf(&sRes,"%02d", daysAfterJan01(&y)/7+1); + break; + } + case 'W': { /* Week num. 00-53. First Mon of the year is week 01 */ + sqlite3_str_appendf(&sRes,"%02d", + (daysAfterJan01(&x)-daysAfterMonday(&x)+7)/7); break; } case 'Y': { @@ -25258,9 +25904,7 @@ static void timediffFunc( d1.iJD = d2.iJD - d1.iJD; d1.iJD += (u64)1486995408 * (u64)100000; } - d1.validYMD = 0; - d1.validHMS = 0; - d1.validTZ = 0; + clearYMD_HMS_TZ(&d1); computeYMD_HMS(&d1); sqlite3StrAccumInit(&sRes, 0, 0, 0, 100); sqlite3_str_appendf(&sRes, "%c%04d-%02d-%02d %02d:%02d:%06.3f", @@ -25329,6 +25973,36 @@ static void currentTimeFunc( } #endif +#if !defined(SQLITE_OMIT_DATETIME_FUNCS) && defined(SQLITE_DEBUG) +/* +** datedebug(...) +** +** This routine returns JSON that describes the internal DateTime object. +** Used for debugging and testing only. Subject to change. +*/ +static void datedebugFunc( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + DateTime x; + if( isDate(context, argc, argv, &x)==0 ){ + char *zJson; + zJson = sqlite3_mprintf( + "{iJD:%lld,Y:%d,M:%d,D:%d,h:%d,m:%d,tz:%d," + "s:%.3f,validJD:%d,validYMS:%d,validHMS:%d," + "nFloor:%d,rawS:%d,isError:%d,useSubsec:%d," + "isUtc:%d,isLocal:%d}", + x.iJD, x.Y, x.M, x.D, x.h, x.m, x.tz, + x.s, x.validJD, x.validYMD, x.validHMS, + x.nFloor, x.rawS, x.isError, x.useSubsec, + x.isUtc, x.isLocal); + sqlite3_result_text(context, zJson, -1, sqlite3_free); + } +} +#endif /* !SQLITE_OMIT_DATETIME_FUNCS && SQLITE_DEBUG */ + + /* ** This function registered all of the above C functions as SQL ** functions. This should be the only routine in this file with @@ -25344,6 +26018,9 @@ SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void){ PURE_DATE(datetime, -1, 0, 0, datetimeFunc ), PURE_DATE(strftime, -1, 0, 0, strftimeFunc ), PURE_DATE(timediff, 2, 0, 0, timediffFunc ), +#ifdef SQLITE_DEBUG + PURE_DATE(datedebug, -1, 0, 0, datedebugFunc ), +#endif DFUNCTION(current_time, 0, 0, 0, ctimeFunc ), DFUNCTION(current_timestamp, 0, 0, 0, ctimestampFunc), DFUNCTION(current_date, 0, 0, 0, cdateFunc ), @@ -28198,7 +28875,7 @@ static void checkMutexFree(sqlite3_mutex *p){ assert( SQLITE_MUTEX_FAST<2 ); assert( SQLITE_MUTEX_WARNONCONTENTION<2 ); -#if SQLITE_ENABLE_API_ARMOR +#ifdef SQLITE_ENABLE_API_ARMOR if( ((CheckMutex*)p)->iType<2 ) #endif { @@ -28870,7 +29547,7 @@ static sqlite3_mutex *pthreadMutexAlloc(int iType){ */ static void pthreadMutexFree(sqlite3_mutex *p){ assert( p->nRef==0 ); -#if SQLITE_ENABLE_API_ARMOR +#ifdef SQLITE_ENABLE_API_ARMOR if( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE ) #endif { @@ -29223,7 +29900,7 @@ SQLITE_PRIVATE void sqlite3MemoryBarrier(void){ SQLITE_MEMORY_BARRIER; #elif defined(__GNUC__) __sync_synchronize(); -#elif MSVC_VERSION>=1300 +#elif MSVC_VERSION>=1400 _ReadWriteBarrier(); #elif defined(MemoryBarrier) MemoryBarrier(); @@ -29759,6 +30436,24 @@ static void sqlite3MallocAlarm(int nByte){ sqlite3_mutex_enter(mem0.mutex); } +#ifdef SQLITE_DEBUG +/* +** This routine is called whenever an out-of-memory condition is seen, +** It's only purpose to to serve as a breakpoint for gdb or similar +** code debuggers when working on out-of-memory conditions, for example +** caused by PRAGMA hard_heap_limit=N. +*/ +static SQLITE_NOINLINE void test_oom_breakpoint(u64 n){ + static u64 nOomFault = 0; + nOomFault += n; + /* The assert() is never reached in a human lifetime. It is here mostly + ** to prevent code optimizers from optimizing out this function. */ + assert( (nOomFault>>32) < 0xffffffff ); +} +#else +# define test_oom_breakpoint(X) /* No-op for production builds */ +#endif + /* ** Do a memory allocation with statistics and alarms. Assume the ** lock is already held. @@ -29785,6 +30480,7 @@ static void mallocWithAlarm(int n, void **pp){ if( mem0.hardLimit ){ nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED); if( nUsed >= mem0.hardLimit - nFull ){ + test_oom_breakpoint(1); *pp = 0; return; } @@ -30073,6 +30769,7 @@ SQLITE_PRIVATE void *sqlite3Realloc(void *pOld, u64 nBytes){ sqlite3MallocAlarm(nDiff); if( mem0.hardLimit>0 && nUsed >= mem0.hardLimit - nDiff ){ sqlite3_mutex_leave(mem0.mutex); + test_oom_breakpoint(1); return 0; } } @@ -30434,7 +31131,7 @@ SQLITE_PRIVATE int sqlite3ApiExit(sqlite3* db, int rc){ if( db->mallocFailed || rc ){ return apiHandleError(db, rc); } - return rc & db->errMask; + return 0; } /************** End of malloc.c **********************************************/ @@ -30939,6 +31636,7 @@ SQLITE_API void sqlite3_str_vappendf( if( xtype==etFLOAT ){ iRound = -precision; }else if( xtype==etGENERIC ){ + if( precision==0 ) precision = 1; iRound = precision; }else{ iRound = precision+1; @@ -30974,13 +31672,14 @@ SQLITE_API void sqlite3_str_vappendf( } exp = s.iDP-1; - if( xtype==etGENERIC && precision>0 ) precision--; /* ** If the field type is etGENERIC, then convert to either etEXP ** or etFLOAT, as appropriate. */ if( xtype==etGENERIC ){ + assert( precision>0 ); + precision--; flag_rtz = !flag_alternateform; if( exp<-4 || exp>precision ){ xtype = etEXP; @@ -31296,9 +31995,13 @@ SQLITE_API void sqlite3_str_vappendf( sqlite3_str_appendall(pAccum, pItem->zAlias); }else{ Select *pSel = pItem->pSelect; - assert( pSel!=0 ); + assert( pSel!=0 ); /* Because of tag-20240424-1 */ if( pSel->selFlags & SF_NestedFrom ){ sqlite3_str_appendf(pAccum, "(join-%u)", pSel->selId); + }else if( pSel->selFlags & SF_MultiValue ){ + assert( !pItem->fg.isTabFunc && !pItem->fg.isIndexedBy ); + sqlite3_str_appendf(pAccum, "%u-ROW VALUES CLAUSE", + pItem->u1.nRow); }else{ sqlite3_str_appendf(pAccum, "(subquery-%u)", pSel->selId); } @@ -31810,7 +32513,7 @@ SQLITE_API void sqlite3_str_appendf(StrAccum *p, const char *zFormat, ...){ /***************************************************************************** -** Reference counted string storage +** Reference counted string/blob storage *****************************************************************************/ /* @@ -31830,7 +32533,7 @@ SQLITE_PRIVATE char *sqlite3RCStrRef(char *z){ ** Decrease the reference count by one. Free the string when the ** reference count reaches zero. */ -SQLITE_PRIVATE void sqlite3RCStrUnref(char *z){ +SQLITE_PRIVATE void sqlite3RCStrUnref(void *z){ RCStr *p = (RCStr*)z; assert( p!=0 ); p--; @@ -32075,8 +32778,10 @@ SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc) x.printfFlags |= SQLITE_PRINTF_INTERNAL; sqlite3_str_appendf(&x, "{%d:*} %!S", pItem->iCursor, pItem); if( pItem->pTab ){ - sqlite3_str_appendf(&x, " tab=%Q nCol=%d ptr=%p used=%llx", - pItem->pTab->zName, pItem->pTab->nCol, pItem->pTab, pItem->colUsed); + sqlite3_str_appendf(&x, " tab=%Q nCol=%d ptr=%p used=%llx%s", + pItem->pTab->zName, pItem->pTab->nCol, pItem->pTab, + pItem->colUsed, + pItem->fg.rowidUsed ? "+rowid" : ""); } if( (pItem->fg.jointype & (JT_LEFT|JT_RIGHT))==(JT_LEFT|JT_RIGHT) ){ sqlite3_str_appendf(&x, " FULL-OUTER-JOIN"); @@ -32116,12 +32821,14 @@ SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc) sqlite3TreeViewIdList(pView, pItem->u3.pUsing, (--n)>0, "USING"); } if( pItem->pSelect ){ + sqlite3TreeViewPush(&pView, i+1nSrc); if( pItem->pTab ){ Table *pTab = pItem->pTab; sqlite3TreeViewColumnList(pView, pTab->aCol, pTab->nCol, 1); } assert( (int)pItem->fg.isNestedFrom == IsNestedFrom(pItem->pSelect) ); sqlite3TreeViewSelect(pView, pItem->pSelect, (--n)>0); + sqlite3TreeViewPop(&pView); } if( pItem->fg.isTabFunc ){ sqlite3TreeViewExprList(pView, pItem->u1.pFuncArg, 0, "func-args:"); @@ -32225,7 +32932,7 @@ SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 m sqlite3TreeViewItem(pView, "LIMIT", (n--)>0); sqlite3TreeViewExpr(pView, p->pLimit->pLeft, p->pLimit->pRight!=0); if( p->pLimit->pRight ){ - sqlite3TreeViewItem(pView, "OFFSET", (n--)>0); + sqlite3TreeViewItem(pView, "OFFSET", 0); sqlite3TreeViewExpr(pView, p->pLimit->pRight, 0); sqlite3TreeViewPop(&pView); } @@ -32293,6 +33000,7 @@ SQLITE_PRIVATE void sqlite3TreeViewWindow(TreeView *pView, const Window *pWin, u sqlite3TreeViewItem(pView, "FILTER", 1); sqlite3TreeViewExpr(pView, pWin->pFilter, 0); sqlite3TreeViewPop(&pView); + if( pWin->eFrmType==TK_FILTER ) return; } sqlite3TreeViewPush(&pView, more); if( pWin->zName ){ @@ -32302,7 +33010,7 @@ SQLITE_PRIVATE void sqlite3TreeViewWindow(TreeView *pView, const Window *pWin, u } if( pWin->zBase ) nElement++; if( pWin->pOrderBy ) nElement++; - if( pWin->eFrmType ) nElement++; + if( pWin->eFrmType!=0 && pWin->eFrmType!=TK_FILTER ) nElement++; if( pWin->eExclude ) nElement++; if( pWin->zBase ){ sqlite3TreeViewPush(&pView, (--nElement)>0); @@ -32315,7 +33023,7 @@ SQLITE_PRIVATE void sqlite3TreeViewWindow(TreeView *pView, const Window *pWin, u if( pWin->pOrderBy ){ sqlite3TreeViewExprList(pView, pWin->pOrderBy, (--nElement)>0, "ORDER-BY"); } - if( pWin->eFrmType ){ + if( pWin->eFrmType!=0 && pWin->eFrmType!=TK_FILTER ){ char zBuf[30]; const char *zFrmType = "ROWS"; if( pWin->eFrmType==TK_RANGE ) zFrmType = "RANGE"; @@ -32563,7 +33271,7 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m assert( ExprUseXList(pExpr) ); pFarg = pExpr->x.pList; #ifndef SQLITE_OMIT_WINDOWFUNC - pWin = ExprHasProperty(pExpr, EP_WinFunc) ? pExpr->y.pWin : 0; + pWin = IsWindowFunc(pExpr) ? pExpr->y.pWin : 0; #else pWin = 0; #endif @@ -32589,7 +33297,13 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m sqlite3TreeViewLine(pView, "FUNCTION %Q%s", pExpr->u.zToken, zFlgs); } if( pFarg ){ - sqlite3TreeViewExprList(pView, pFarg, pWin!=0, 0); + sqlite3TreeViewExprList(pView, pFarg, pWin!=0 || pExpr->pLeft, 0); + if( pExpr->pLeft ){ + Expr *pOB = pExpr->pLeft; + assert( pOB->op==TK_ORDER ); + assert( ExprUseXList(pOB) ); + sqlite3TreeViewExprList(pView, pOB->x.pList, pWin!=0, "ORDERBY"); + } } #ifndef SQLITE_OMIT_WINDOWFUNC if( pWin ){ @@ -32598,6 +33312,10 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m #endif break; } + case TK_ORDER: { + sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, "ORDERBY"); + break; + } #ifndef SQLITE_OMIT_SUBQUERY case TK_EXISTS: { assert( ExprUseXSelect(pExpr) ); @@ -32651,7 +33369,7 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m assert( pExpr->x.pList->nExpr==2 ); pY = pExpr->x.pList->a[0].pExpr; pZ = pExpr->x.pList->a[1].pExpr; - sqlite3TreeViewLine(pView, "BETWEEN"); + sqlite3TreeViewLine(pView, "BETWEEN%s", zFlgs); sqlite3TreeViewExpr(pView, pX, 1); sqlite3TreeViewExpr(pView, pY, 1); sqlite3TreeViewExpr(pView, pZ, 0); @@ -33786,7 +34504,38 @@ SQLITE_PRIVATE u32 sqlite3Utf8Read( return c; } - +/* +** Read a single UTF8 character out of buffer z[], but reading no +** more than n characters from the buffer. z[] is not zero-terminated. +** +** Return the number of bytes used to construct the character. +** +** Invalid UTF8 might generate a strange result. No effort is made +** to detect invalid UTF8. +** +** At most 4 bytes will be read out of z[]. The return value will always +** be between 1 and 4. +*/ +SQLITE_PRIVATE int sqlite3Utf8ReadLimited( + const u8 *z, + int n, + u32 *piOut +){ + u32 c; + int i = 1; + assert( n>0 ); + c = z[0]; + if( c>=0xc0 ){ + c = sqlite3Utf8Trans1[c-0xc0]; + if( n>4 ) n = 4; + while( irc = SQLITE_INTERRUPT; } #ifndef SQLITE_OMIT_PROGRESS_CALLBACK - if( db->xProgress && (++p->nProgressSteps)>=db->nProgressOps ){ - if( db->xProgress(db->pProgressArg) ){ - p->nErr++; - p->rc = SQLITE_INTERRUPT; + if( db->xProgress ){ + if( p->rc==SQLITE_INTERRUPT ){ + p->nProgressSteps = 0; + }else if( (++p->nProgressSteps)>=db->nProgressOps ){ + if( db->xProgress(db->pProgressArg) ){ + p->nErr++; + p->rc = SQLITE_INTERRUPT; + } + p->nProgressSteps = 0; } - p->nProgressSteps = 0; } #endif } @@ -34467,6 +35233,44 @@ SQLITE_PRIVATE void sqlite3DequoteExpr(Expr *p){ sqlite3Dequote(p->u.zToken); } +/* +** Expression p is a QNUMBER (quoted number). Dequote the value in p->u.zToken +** and set the type to INTEGER or FLOAT. "Quoted" integers or floats are those +** that contain '_' characters that must be removed before further processing. +*/ +SQLITE_PRIVATE void sqlite3DequoteNumber(Parse *pParse, Expr *p){ + assert( p!=0 || pParse->db->mallocFailed ); + if( p ){ + const char *pIn = p->u.zToken; + char *pOut = p->u.zToken; + int bHex = (pIn[0]=='0' && (pIn[1]=='x' || pIn[1]=='X')); + int iValue; + assert( p->op==TK_QNUMBER ); + p->op = TK_INTEGER; + do { + if( *pIn!=SQLITE_DIGIT_SEPARATOR ){ + *pOut++ = *pIn; + if( *pIn=='e' || *pIn=='E' || *pIn=='.' ) p->op = TK_FLOAT; + }else{ + if( (bHex==0 && (!sqlite3Isdigit(pIn[-1]) || !sqlite3Isdigit(pIn[1]))) + || (bHex==1 && (!sqlite3Isxdigit(pIn[-1]) || !sqlite3Isxdigit(pIn[1]))) + ){ + sqlite3ErrorMsg(pParse, "unrecognized token: \"%s\"", p->u.zToken); + } + } + }while( *pIn++ ); + if( bHex ) p->op = TK_INTEGER; + + /* tag-20240227-a: If after dequoting, the number is an integer that + ** fits in 32 bits, then it must be converted into EP_IntValue. Other + ** parts of the code expect this. See also tag-20240227-b. */ + if( p->op==TK_INTEGER && sqlite3GetInt32(p->u.zToken, &iValue) ){ + p->u.iValue = iValue; + p->flags |= EP_IntValue; + } + } +} + /* ** If the input token p is quoted, try to adjust the token to remove ** the quotes. This is not always possible: @@ -34783,6 +35587,9 @@ SQLITE_PRIVATE int sqlite3AtoF(const char *z, double *pResult, int length, u8 en u64 s2; rr[0] = (double)s; s2 = (u64)rr[0]; +#if defined(_MSC_VER) && _MSC_VER<1700 + if( s2==0x8000000000000000LL ){ s2 = 2*(u64)(0.5*rr[0]); } +#endif rr[1] = s>=s2 ? (double)(s - s2) : -(double)(s2 - s); if( e>0 ){ while( e>=100 ){ @@ -35185,29 +35992,29 @@ SQLITE_PRIVATE void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRou double rr[2]; rr[0] = r; rr[1] = 0.0; - if( rr[0]>1.84e+19 ){ - while( rr[0]>1.84e+119 ){ + if( rr[0]>9.223372036854774784e+18 ){ + while( rr[0]>9.223372036854774784e+118 ){ exp += 100; dekkerMul2(rr, 1.0e-100, -1.99918998026028836196e-117); } - while( rr[0]>1.84e+29 ){ + while( rr[0]>9.223372036854774784e+28 ){ exp += 10; dekkerMul2(rr, 1.0e-10, -3.6432197315497741579e-27); } - while( rr[0]>1.84e+19 ){ + while( rr[0]>9.223372036854774784e+18 ){ exp += 1; dekkerMul2(rr, 1.0e-01, -5.5511151231257827021e-18); } }else{ - while( rr[0]<1.84e-82 ){ + while( rr[0]<9.223372036854774784e-83 ){ exp -= 100; dekkerMul2(rr, 1.0e+100, -1.5902891109759918046e+83); } - while( rr[0]<1.84e+08 ){ + while( rr[0]<9.223372036854774784e+07 ){ exp -= 10; dekkerMul2(rr, 1.0e+10, 0.0); } - while( rr[0]<1.84e+18 ){ + while( rr[0]<9.22337203685477478e+17 ){ exp -= 1; dekkerMul2(rr, 1.0e+01, 0.0); } @@ -35225,7 +36032,7 @@ SQLITE_PRIVATE void sqlite3FpDecode(FpDecode *p, double r, int iRound, int mxRou assert( p->n>0 ); assert( p->nzBuf) ); p->iDP = p->n + exp; - if( iRound<0 ){ + if( iRound<=0 ){ iRound = p->iDP - iRound; if( iRound==0 && p->zBuf[i+1]>='5' ){ iRound = 1; @@ -35523,121 +36330,32 @@ SQLITE_PRIVATE u8 sqlite3GetVarint(const unsigned char *p, u64 *v){ ** this function assumes the single-byte case has already been handled. */ SQLITE_PRIVATE u8 sqlite3GetVarint32(const unsigned char *p, u32 *v){ - u32 a,b; + u64 v64; + u8 n; - /* The 1-byte case. Overwhelmingly the most common. Handled inline - ** by the getVarin32() macro */ - a = *p; - /* a: p0 (unmasked) */ -#ifndef getVarint32 - if (!(a&0x80)) - { - /* Values between 0 and 127 */ - *v = a; - return 1; - } -#endif + /* Assume that the single-byte case has already been handled by + ** the getVarint32() macro */ + assert( (p[0] & 0x80)!=0 ); - /* The 2-byte case */ - p++; - b = *p; - /* b: p1 (unmasked) */ - if (!(b&0x80)) - { - /* Values between 128 and 16383 */ - a &= 0x7f; - a = a<<7; - *v = a | b; + if( (p[1] & 0x80)==0 ){ + /* This is the two-byte case */ + *v = ((p[0]&0x7f)<<7) | p[1]; return 2; } - - /* The 3-byte case */ - p++; - a = a<<14; - a |= *p; - /* a: p0<<14 | p2 (unmasked) */ - if (!(a&0x80)) - { - /* Values between 16384 and 2097151 */ - a &= (0x7f<<14)|(0x7f); - b &= 0x7f; - b = b<<7; - *v = a | b; + if( (p[2] & 0x80)==0 ){ + /* This is the three-byte case */ + *v = ((p[0]&0x7f)<<14) | ((p[1]&0x7f)<<7) | p[2]; return 3; } - - /* A 32-bit varint is used to store size information in btrees. - ** Objects are rarely larger than 2MiB limit of a 3-byte varint. - ** A 3-byte varint is sufficient, for example, to record the size - ** of a 1048569-byte BLOB or string. - ** - ** We only unroll the first 1-, 2-, and 3- byte cases. The very - ** rare larger cases can be handled by the slower 64-bit varint - ** routine. - */ -#if 1 - { - u64 v64; - u8 n; - - n = sqlite3GetVarint(p-2, &v64); - assert( n>3 && n<=9 ); - if( (v64 & SQLITE_MAX_U32)!=v64 ){ - *v = 0xffffffff; - }else{ - *v = (u32)v64; - } - return n; - } - -#else - /* For following code (kept for historical record only) shows an - ** unrolling for the 3- and 4-byte varint cases. This code is - ** slightly faster, but it is also larger and much harder to test. - */ - p++; - b = b<<14; - b |= *p; - /* b: p1<<14 | p3 (unmasked) */ - if (!(b&0x80)) - { - /* Values between 2097152 and 268435455 */ - b &= (0x7f<<14)|(0x7f); - a &= (0x7f<<14)|(0x7f); - a = a<<7; - *v = a | b; - return 4; - } - - p++; - a = a<<14; - a |= *p; - /* a: p0<<28 | p2<<14 | p4 (unmasked) */ - if (!(a&0x80)) - { - /* Values between 268435456 and 34359738367 */ - a &= SLOT_4_2_0; - b &= SLOT_4_2_0; - b = b<<7; - *v = a | b; - return 5; - } - - /* We can only reach this point when reading a corrupt database - ** file. In that case we are not in any hurry. Use the (relatively - ** slow) general-purpose sqlite3GetVarint() routine to extract the - ** value. */ - { - u64 v64; - u8 n; - - p -= 4; - n = sqlite3GetVarint(p, &v64); - assert( n>5 && n<=9 ); + /* four or more bytes */ + n = sqlite3GetVarint(p, &v64); + assert( n>3 && n<=9 ); + if( (v64 & SQLITE_MAX_U32)!=v64 ){ + *v = 0xffffffff; + }else{ *v = (u32)v64; - return n; } -#endif + return n; } /* @@ -36492,7 +37210,7 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ /* 30 */ "SeekRowid" OpHelp("intkey=r[P3]"), /* 31 */ "NotExists" OpHelp("intkey=r[P3]"), /* 32 */ "Last" OpHelp(""), - /* 33 */ "IfSmaller" OpHelp(""), + /* 33 */ "IfSizeBetween" OpHelp(""), /* 34 */ "SorterSort" OpHelp(""), /* 35 */ "Sort" OpHelp(""), /* 36 */ "Rewind" OpHelp(""), @@ -36537,7 +37255,7 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ /* 75 */ "Null" OpHelp("r[P2..P3]=NULL"), /* 76 */ "SoftNull" OpHelp("r[P1]=NULL"), /* 77 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), - /* 78 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), + /* 78 */ "Variable" OpHelp("r[P2]=parameter(P1)"), /* 79 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), /* 80 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), /* 81 */ "SCopy" OpHelp("r[P2]=r[P1]"), @@ -36633,19 +37351,22 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ /* 171 */ "VCreate" OpHelp(""), /* 172 */ "VDestroy" OpHelp(""), /* 173 */ "VOpen" OpHelp(""), - /* 174 */ "VInitIn" OpHelp("r[P2]=ValueList(P1,P3)"), - /* 175 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), - /* 176 */ "VRename" OpHelp(""), - /* 177 */ "Pagecount" OpHelp(""), - /* 178 */ "MaxPgcnt" OpHelp(""), - /* 179 */ "ClrSubtype" OpHelp("r[P1].subtype = 0"), - /* 180 */ "FilterAdd" OpHelp("filter(P1) += key(P3@P4)"), - /* 181 */ "Trace" OpHelp(""), - /* 182 */ "CursorHint" OpHelp(""), - /* 183 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"), - /* 184 */ "Noop" OpHelp(""), - /* 185 */ "Explain" OpHelp(""), - /* 186 */ "Abortable" OpHelp(""), + /* 174 */ "VCheck" OpHelp(""), + /* 175 */ "VInitIn" OpHelp("r[P2]=ValueList(P1,P3)"), + /* 176 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), + /* 177 */ "VRename" OpHelp(""), + /* 178 */ "Pagecount" OpHelp(""), + /* 179 */ "MaxPgcnt" OpHelp(""), + /* 180 */ "ClrSubtype" OpHelp("r[P1].subtype = 0"), + /* 181 */ "GetSubtype" OpHelp("r[P2] = r[P1].subtype"), + /* 182 */ "SetSubtype" OpHelp("r[P2].subtype = r[P1]"), + /* 183 */ "FilterAdd" OpHelp("filter(P1) += key(P3@P4)"), + /* 184 */ "Trace" OpHelp(""), + /* 185 */ "CursorHint" OpHelp(""), + /* 186 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"), + /* 187 */ "Noop" OpHelp(""), + /* 188 */ "Explain" OpHelp(""), + /* 189 */ "Abortable" OpHelp(""), }; return azName[i]; } @@ -38932,8 +39653,12 @@ static int unixLogErrorAtLine( ** available, the error message will often be an empty string. Not a ** huge problem. Incorrectly concluding that the GNU version is available ** could lead to a segfault though. + ** + ** Forum post 3f13857fa4062301 reports that the Android SDK may use + ** int-type return, depending on its version. */ -#if defined(STRERROR_R_CHAR_P) || defined(__USE_GNU) +#if (defined(STRERROR_R_CHAR_P) || defined(__USE_GNU)) \ + && !defined(ANDROID) && !defined(__ANDROID__) zErr = # endif strerror_r(iErrno, aErr, sizeof(aErr)-1); @@ -40787,9 +41512,6 @@ static int afpUnlock(sqlite3_file *id, int eFileLock) { unixInodeInfo *pInode; afpLockingContext *context = (afpLockingContext *) pFile->lockingContext; int skipShared = 0; -#ifdef SQLITE_TEST - int h = pFile->h; -#endif assert( pFile ); OSTRACE(("UNLOCK %d %d was %d(%d,%d) pid=%d (afp)\n", pFile->h, eFileLock, @@ -40805,9 +41527,6 @@ static int afpUnlock(sqlite3_file *id, int eFileLock) { assert( pInode->nShared!=0 ); if( pFile->eFileLock>SHARED_LOCK ){ assert( pInode->eFileLock==pFile->eFileLock ); - SimulateIOErrorBenign(1); - SimulateIOError( h=(-1) ) - SimulateIOErrorBenign(0); #ifdef SQLITE_DEBUG /* When reducing a lock such that other processes can start @@ -40856,9 +41575,6 @@ static int afpUnlock(sqlite3_file *id, int eFileLock) { unsigned long long sharedLockByte = SHARED_FIRST+pInode->sharedByte; pInode->nShared--; if( pInode->nShared==0 ){ - SimulateIOErrorBenign(1); - SimulateIOError( h=(-1) ) - SimulateIOErrorBenign(0); if( !skipShared ){ rc = afpSetLock(context->dbPath, pFile, sharedLockByte, 1, 0); } @@ -41700,7 +42416,13 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){ #ifdef SQLITE_ENABLE_SETLK_TIMEOUT case SQLITE_FCNTL_LOCK_TIMEOUT: { int iOld = pFile->iBusyTimeout; +#if SQLITE_ENABLE_SETLK_TIMEOUT==1 pFile->iBusyTimeout = *(int*)pArg; +#elif SQLITE_ENABLE_SETLK_TIMEOUT==2 + pFile->iBusyTimeout = !!(*(int*)pArg); +#else +# error "SQLITE_ENABLE_SETLK_TIMEOUT must be set to 1 or 2" +#endif *(int*)pArg = iOld; return SQLITE_OK; } @@ -41953,6 +42675,25 @@ static int unixGetpagesize(void){ ** Either unixShmNode.pShmMutex must be held or unixShmNode.nRef==0 and ** unixMutexHeld() is true when reading or writing any other field ** in this structure. +** +** aLock[SQLITE_SHM_NLOCK]: +** This array records the various locks held by clients on each of the +** SQLITE_SHM_NLOCK slots. If the aLock[] entry is set to 0, then no +** locks are held by the process on this slot. If it is set to -1, then +** some client holds an EXCLUSIVE lock on the locking slot. If the aLock[] +** value is set to a positive value, then it is the number of shared +** locks currently held on the slot. +** +** aMutex[SQLITE_SHM_NLOCK]: +** Normally, when SQLITE_ENABLE_SETLK_TIMEOUT is not defined, mutex +** pShmMutex is used to protect the aLock[] array and the right to +** call fcntl() on unixShmNode.hShm to obtain or release locks. +** +** If SQLITE_ENABLE_SETLK_TIMEOUT is defined though, we use an array +** of mutexes - one for each locking slot. To read or write locking +** slot aLock[iSlot], the caller must hold the corresponding mutex +** aMutex[iSlot]. Similarly, to call fcntl() to obtain or release a +** lock corresponding to slot iSlot, mutex aMutex[iSlot] must be held. */ struct unixShmNode { unixInodeInfo *pInode; /* unixInodeInfo that owns this SHM node */ @@ -41966,10 +42707,11 @@ struct unixShmNode { char **apRegion; /* Array of mapped shared-memory regions */ int nRef; /* Number of unixShm objects pointing to this */ unixShm *pFirst; /* All unixShm objects pointing to this */ +#ifdef SQLITE_ENABLE_SETLK_TIMEOUT + sqlite3_mutex *aMutex[SQLITE_SHM_NLOCK]; +#endif int aLock[SQLITE_SHM_NLOCK]; /* # shared locks on slot, -1==excl lock */ #ifdef SQLITE_DEBUG - u8 exclMask; /* Mask of exclusive locks held */ - u8 sharedMask; /* Mask of shared locks held */ u8 nextShmId; /* Next available unixShm.id value */ #endif }; @@ -42052,16 +42794,35 @@ static int unixShmSystemLock( struct flock f; /* The posix advisory locking structure */ int rc = SQLITE_OK; /* Result code form fcntl() */ - /* Access to the unixShmNode object is serialized by the caller */ pShmNode = pFile->pInode->pShmNode; - assert( pShmNode->nRef==0 || sqlite3_mutex_held(pShmNode->pShmMutex) ); - assert( pShmNode->nRef>0 || unixMutexHeld() ); + + /* Assert that the parameters are within expected range and that the + ** correct mutex or mutexes are held. */ + assert( pShmNode->nRef>=0 ); + assert( (ofst==UNIX_SHM_DMS && n==1) + || (ofst>=UNIX_SHM_BASE && ofst+n<=(UNIX_SHM_BASE+SQLITE_SHM_NLOCK)) + ); + if( ofst==UNIX_SHM_DMS ){ + assert( pShmNode->nRef>0 || unixMutexHeld() ); + assert( pShmNode->nRef==0 || sqlite3_mutex_held(pShmNode->pShmMutex) ); + }else{ +#ifdef SQLITE_ENABLE_SETLK_TIMEOUT + int ii; + for(ii=ofst-UNIX_SHM_BASE; iiaMutex[ii]) ); + } +#else + assert( sqlite3_mutex_held(pShmNode->pShmMutex) ); + assert( pShmNode->nRef>0 ); +#endif + } /* Shared locks never span more than one byte */ assert( n==1 || lockType!=F_RDLCK ); /* Locks are within range */ assert( n>=1 && n<=SQLITE_SHM_NLOCK ); + assert( ofst>=UNIX_SHM_BASE && ofst<=(UNIX_SHM_DMS+SQLITE_SHM_NLOCK) ); if( pShmNode->hShm>=0 ){ int res; @@ -42072,7 +42833,7 @@ static int unixShmSystemLock( f.l_len = n; res = osSetPosixAdvisoryLock(pShmNode->hShm, &f, pFile); if( res==-1 ){ -#ifdef SQLITE_ENABLE_SETLK_TIMEOUT +#if defined(SQLITE_ENABLE_SETLK_TIMEOUT) && SQLITE_ENABLE_SETLK_TIMEOUT==1 rc = (pFile->iBusyTimeout ? SQLITE_BUSY_TIMEOUT : SQLITE_BUSY); #else rc = SQLITE_BUSY; @@ -42080,39 +42841,28 @@ static int unixShmSystemLock( } } - /* Update the global lock state and do debug tracing */ + /* Do debug tracing */ #ifdef SQLITE_DEBUG - { u16 mask; OSTRACE(("SHM-LOCK ")); - mask = ofst>31 ? 0xffff : (1<<(ofst+n)) - (1<exclMask &= ~mask; - pShmNode->sharedMask &= ~mask; + OSTRACE(("unlock %d..%d ok\n", ofst, ofst+n-1)); }else if( lockType==F_RDLCK ){ - OSTRACE(("read-lock %d ok", ofst)); - pShmNode->exclMask &= ~mask; - pShmNode->sharedMask |= mask; + OSTRACE(("read-lock %d..%d ok\n", ofst, ofst+n-1)); }else{ assert( lockType==F_WRLCK ); - OSTRACE(("write-lock %d ok", ofst)); - pShmNode->exclMask |= mask; - pShmNode->sharedMask &= ~mask; + OSTRACE(("write-lock %d..%d ok\n", ofst, ofst+n-1)); } }else{ if( lockType==F_UNLCK ){ - OSTRACE(("unlock %d failed", ofst)); + OSTRACE(("unlock %d..%d failed\n", ofst, ofst+n-1)); }else if( lockType==F_RDLCK ){ - OSTRACE(("read-lock failed")); + OSTRACE(("read-lock %d..%d failed\n", ofst, ofst+n-1)); }else{ assert( lockType==F_WRLCK ); - OSTRACE(("write-lock %d failed", ofst)); + OSTRACE(("write-lock %d..%d failed\n", ofst, ofst+n-1)); } } - OSTRACE((" - afterwards %03x,%03x\n", - pShmNode->sharedMask, pShmNode->exclMask)); - } #endif return rc; @@ -42149,6 +42899,11 @@ static void unixShmPurge(unixFile *pFd){ int i; assert( p->pInode==pFd->pInode ); sqlite3_mutex_free(p->pShmMutex); +#ifdef SQLITE_ENABLE_SETLK_TIMEOUT + for(i=0; iaMutex[i]); + } +#endif for(i=0; inRegion; i+=nShmPerMap){ if( p->hShm>=0 ){ osMunmap(p->apRegion[i], p->szRegion); @@ -42208,7 +42963,20 @@ static int unixLockSharedMemory(unixFile *pDbFd, unixShmNode *pShmNode){ pShmNode->isUnlocked = 1; rc = SQLITE_READONLY_CANTINIT; }else{ +#ifdef SQLITE_ENABLE_SETLK_TIMEOUT + /* Do not use a blocking lock here. If the lock cannot be obtained + ** immediately, it means some other connection is truncating the + ** *-shm file. And after it has done so, it will not release its + ** lock, but only downgrade it to a shared lock. So no point in + ** blocking here. The call below to obtain the shared DMS lock may + ** use a blocking lock. */ + int iSaveTimeout = pDbFd->iBusyTimeout; + pDbFd->iBusyTimeout = 0; +#endif rc = unixShmSystemLock(pDbFd, F_WRLCK, UNIX_SHM_DMS, 1); +#ifdef SQLITE_ENABLE_SETLK_TIMEOUT + pDbFd->iBusyTimeout = iSaveTimeout; +#endif /* The first connection to attach must truncate the -shm file. We ** truncate to 3 bytes (an arbitrary small number, less than the ** -shm header size) rather than 0 as a system debugging aid, to @@ -42329,6 +43097,18 @@ static int unixOpenSharedMemory(unixFile *pDbFd){ rc = SQLITE_NOMEM_BKPT; goto shm_open_err; } +#ifdef SQLITE_ENABLE_SETLK_TIMEOUT + { + int ii; + for(ii=0; iiaMutex[ii] = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST); + if( pShmNode->aMutex[ii]==0 ){ + rc = SQLITE_NOMEM_BKPT; + goto shm_open_err; + } + } + } +#endif } if( pInode->bProcessLock==0 ){ @@ -42550,9 +43330,11 @@ static int unixShmMap( */ #ifdef SQLITE_DEBUG static int assertLockingArrayOk(unixShmNode *pShmNode){ +#ifdef SQLITE_ENABLE_SETLK_TIMEOUT + return 1; +#else unixShm *pX; int aLock[SQLITE_SHM_NLOCK]; - assert( sqlite3_mutex_held(pShmNode->pShmMutex) ); memset(aLock, 0, sizeof(aLock)); for(pX=pShmNode->pFirst; pX; pX=pX->pNext){ @@ -42570,13 +43352,14 @@ static int assertLockingArrayOk(unixShmNode *pShmNode){ assert( 0==memcmp(pShmNode->aLock, aLock, sizeof(aLock)) ); return (memcmp(pShmNode->aLock, aLock, sizeof(aLock))==0); +#endif } #endif /* ** Change the lock state for a shared-memory segment. ** -** Note that the relationship between SHAREd and EXCLUSIVE locks is a little +** Note that the relationship between SHARED and EXCLUSIVE locks is a little ** different here than in posix. In xShmLock(), one can go from unlocked ** to shared and back or from unlocked to exclusive and back. But one may ** not go from shared to exclusive or from exclusive to shared. @@ -42591,7 +43374,7 @@ static int unixShmLock( unixShm *p; /* The shared memory being locked */ unixShmNode *pShmNode; /* The underlying file iNode */ int rc = SQLITE_OK; /* Result code */ - u16 mask; /* Mask of locks to take or release */ + u16 mask = (1<<(ofst+n)) - (1<pShm; @@ -42626,88 +43409,151 @@ static int unixShmLock( ** It is not permitted to block on the RECOVER lock. */ #ifdef SQLITE_ENABLE_SETLK_TIMEOUT - assert( (flags & SQLITE_SHM_UNLOCK) || pDbFd->iBusyTimeout==0 || ( - (ofst!=2) /* not RECOVER */ - && (ofst!=1 || (p->exclMask|p->sharedMask)==0) - && (ofst!=0 || (p->exclMask|p->sharedMask)<3) - && (ofst<3 || (p->exclMask|p->sharedMask)<(1<exclMask|p->sharedMask); + assert( (flags & SQLITE_SHM_UNLOCK) || pDbFd->iBusyTimeout==0 || ( + (ofst!=2) /* not RECOVER */ + && (ofst!=1 || lockMask==0 || lockMask==2) + && (ofst!=0 || lockMask<3) + && (ofst<3 || lockMask<(1<1 || mask==(1<pShmMutex); - assert( assertLockingArrayOk(pShmNode) ); - if( flags & SQLITE_SHM_UNLOCK ){ - if( (p->exclMask|p->sharedMask) & mask ){ - int ii; - int bUnlock = 1; + /* Check if there is any work to do. There are three cases: + ** + ** a) An unlock operation where there are locks to unlock, + ** b) An shared lock where the requested lock is not already held + ** c) An exclusive lock where the requested lock is not already held + ** + ** The SQLite core never requests an exclusive lock that it already holds. + ** This is assert()ed below. + */ + assert( flags!=(SQLITE_SHM_EXCLUSIVE|SQLITE_SHM_LOCK) + || 0==(p->exclMask & mask) + ); + if( ((flags & SQLITE_SHM_UNLOCK) && ((p->exclMask|p->sharedMask) & mask)) + || (flags==(SQLITE_SHM_SHARED|SQLITE_SHM_LOCK) && 0==(p->sharedMask & mask)) + || (flags==(SQLITE_SHM_EXCLUSIVE|SQLITE_SHM_LOCK)) + ){ - for(ii=ofst; ii((p->sharedMask & (1<aMutex[iMutex]); + if( rc!=SQLITE_OK ) goto leave_shmnode_mutexes; + }else{ + sqlite3_mutex_enter(pShmNode->aMutex[iMutex]); } + } +#else + sqlite3_mutex_enter(pShmNode->pShmMutex); +#endif - if( bUnlock ){ - rc = unixShmSystemLock(pDbFd, F_UNLCK, ofst+UNIX_SHM_BASE, n); - if( rc==SQLITE_OK ){ - memset(&aLock[ofst], 0, sizeof(int)*n); + if( ALWAYS(rc==SQLITE_OK) ){ + if( flags & SQLITE_SHM_UNLOCK ){ + /* Case (a) - unlock. */ + int bUnlock = 1; + assert( (p->exclMask & p->sharedMask)==0 ); + assert( !(flags & SQLITE_SHM_EXCLUSIVE) || (p->exclMask & mask)==mask ); + assert( !(flags & SQLITE_SHM_SHARED) || (p->sharedMask & mask)==mask ); + + /* If this is a SHARED lock being unlocked, it is possible that other + ** clients within this process are holding the same SHARED lock. In + ** this case, set bUnlock to 0 so that the posix lock is not removed + ** from the file-descriptor below. */ + if( flags & SQLITE_SHM_SHARED ){ + assert( n==1 ); + assert( aLock[ofst]>=1 ); + if( aLock[ofst]>1 ){ + bUnlock = 0; + aLock[ofst]--; + p->sharedMask &= ~mask; + } } - }else if( ALWAYS(p->sharedMask & (1<1 ); - aLock[ofst]--; - } - /* Undo the local locks */ - if( rc==SQLITE_OK ){ - p->exclMask &= ~mask; - p->sharedMask &= ~mask; - } - } - }else if( flags & SQLITE_SHM_SHARED ){ - assert( n==1 ); - assert( (p->exclMask & (1<sharedMask & mask)==0 ){ - if( aLock[ofst]<0 ){ - rc = SQLITE_BUSY; - }else if( aLock[ofst]==0 ){ - rc = unixShmSystemLock(pDbFd, F_RDLCK, ofst+UNIX_SHM_BASE, n); - } + if( bUnlock ){ + rc = unixShmSystemLock(pDbFd, F_UNLCK, ofst+UNIX_SHM_BASE, n); + if( rc==SQLITE_OK ){ + memset(&aLock[ofst], 0, sizeof(int)*n); + p->sharedMask &= ~mask; + p->exclMask &= ~mask; + } + } + }else if( flags & SQLITE_SHM_SHARED ){ + /* Case (b) - a shared lock. */ - /* Get the local shared locks */ - if( rc==SQLITE_OK ){ - p->sharedMask |= mask; - aLock[ofst]++; - } - } - }else{ - /* Make sure no sibling connections hold locks that will block this - ** lock. If any do, return SQLITE_BUSY right away. */ - int ii; - for(ii=ofst; iisharedMask & mask)==0 ); - if( ALWAYS((p->exclMask & (1<sharedMask |= mask; + aLock[ofst]++; + } + }else{ + /* Case (c) - an exclusive lock. */ + int ii; + + assert( flags==(SQLITE_SHM_LOCK|SQLITE_SHM_EXCLUSIVE) ); assert( (p->sharedMask & mask)==0 ); - p->exclMask |= mask; + assert( (p->exclMask & mask)==0 ); + + /* Make sure no sibling connections hold locks that will block this + ** lock. If any do, return SQLITE_BUSY right away. */ for(ii=ofst; iiexclMask |= mask; + for(ii=ofst; ii=ofst; iMutex--){ + sqlite3_mutex_leave(pShmNode->aMutex[iMutex]); + } +#else + sqlite3_mutex_leave(pShmNode->pShmMutex); +#endif } - assert( assertLockingArrayOk(pShmNode) ); - sqlite3_mutex_leave(pShmNode->pShmMutex); + OSTRACE(("SHM-LOCK shmid-%d, pid-%d got %03x,%03x\n", p->id, osGetpid(0), p->sharedMask, p->exclMask)); return rc; @@ -42957,11 +43803,16 @@ static int unixFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){ #if SQLITE_MAX_MMAP_SIZE>0 if( pFd->mmapSizeMax>0 ){ + /* Ensure that there is always at least a 256 byte buffer of addressable + ** memory following the returned page. If the database is corrupt, + ** SQLite may overread the page slightly (in practice only a few bytes, + ** but 256 is safe, round, number). */ + const int nEofBuffer = 256; if( pFd->pMapRegion==0 ){ int rc = unixMapfile(pFd, -1); if( rc!=SQLITE_OK ) return rc; } - if( pFd->mmapSize >= iOff+nAmt ){ + if( pFd->mmapSize >= (iOff+nAmt+nEofBuffer) ){ *pp = &((u8 *)pFd->pMapRegion)[iOff]; pFd->nFetchOut++; } @@ -43905,12 +44756,19 @@ static int unixOpen( rc = SQLITE_READONLY_DIRECTORY; }else if( errno!=EISDIR && isReadWrite ){ /* Failed to open the file for read/write access. Try read-only. */ + UnixUnusedFd *pReadonly = 0; flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE); openFlags &= ~(O_RDWR|O_CREAT); flags |= SQLITE_OPEN_READONLY; openFlags |= O_RDONLY; isReadonly = 1; - fd = robust_open(zName, openFlags, openMode); + pReadonly = findReusableFd(zName, flags); + if( pReadonly ){ + fd = pReadonly->fd; + sqlite3_free(pReadonly); + }else{ + fd = robust_open(zName, openFlags, openMode); + } } } if( fd<0 ){ @@ -50314,6 +51172,11 @@ static int winFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){ #if SQLITE_MAX_MMAP_SIZE>0 if( pFd->mmapSizeMax>0 ){ + /* Ensure that there is always at least a 256 byte buffer of addressable + ** memory following the returned page. If the database is corrupt, + ** SQLite may overread the page slightly (in practice only a few bytes, + ** but 256 is safe, round, number). */ + const int nEofBuffer = 256; if( pFd->pMapRegion==0 ){ int rc = winMapfile(pFd, -1); if( rc!=SQLITE_OK ){ @@ -50322,7 +51185,7 @@ static int winFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){ return rc; } } - if( pFd->mmapSize >= iOff+nAmt ){ + if( pFd->mmapSize >= (iOff+nAmt+nEofBuffer) ){ assert( pFd->pMapRegion!=0 ); *pp = &((u8 *)pFd->pMapRegion)[iOff]; pFd->nFetchOut++; @@ -52801,6 +53664,14 @@ SQLITE_API unsigned char *sqlite3_serialize( pOut = 0; }else{ sz = sqlite3_column_int64(pStmt, 0)*szPage; + if( sz==0 ){ + sqlite3_reset(pStmt); + sqlite3_exec(db, "BEGIN IMMEDIATE; COMMIT;", 0, 0, 0); + rc = sqlite3_step(pStmt); + if( rc==SQLITE_ROW ){ + sz = sqlite3_column_int64(pStmt, 0)*szPage; + } + } if( piSize ) *piSize = sz; if( mFlags & SQLITE_SERIALIZE_NOCOPY ){ pOut = 0; @@ -56925,7 +57796,7 @@ struct Pager { char *zJournal; /* Name of the journal file */ int (*xBusyHandler)(void*); /* Function to call when busy */ void *pBusyHandlerArg; /* Context argument for xBusyHandler */ - int aStat[4]; /* Total cache hits, misses, writes, spills */ + u32 aStat[4]; /* Total cache hits, misses, writes, spills */ #ifdef SQLITE_TEST int nRead; /* Database pages read */ #endif @@ -57055,9 +57926,8 @@ SQLITE_PRIVATE int sqlite3PagerDirectReadOk(Pager *pPager, Pgno pgno){ #ifndef SQLITE_OMIT_WAL if( pPager->pWal ){ u32 iRead = 0; - int rc; - rc = sqlite3WalFindFrame(pPager->pWal, pgno, &iRead); - return (rc==SQLITE_OK && iRead==0); + (void)sqlite3WalFindFrame(pPager->pWal, pgno, &iRead); + return iRead==0; } #endif return 1; @@ -57729,9 +58599,32 @@ static int writeJournalHdr(Pager *pPager){ memset(zHeader, 0, sizeof(aJournalMagic)+4); } + + /* The random check-hash initializer */ - sqlite3_randomness(sizeof(pPager->cksumInit), &pPager->cksumInit); + if( pPager->journalMode!=PAGER_JOURNALMODE_MEMORY ){ + sqlite3_randomness(sizeof(pPager->cksumInit), &pPager->cksumInit); + } +#ifdef SQLITE_DEBUG + else{ + /* The Pager.cksumInit variable is usually randomized above to protect + ** against there being existing records in the journal file. This is + ** dangerous, as following a crash they may be mistaken for records + ** written by the current transaction and rolled back into the database + ** file, causing corruption. The following assert statements verify + ** that this is not required in "journal_mode=memory" mode, as in that + ** case the journal file is always 0 bytes in size at this point. + ** It is advantageous to avoid the sqlite3_randomness() call if possible + ** as it takes the global PRNG mutex. */ + i64 sz = 0; + sqlite3OsFileSize(pPager->jfd, &sz); + assert( sz==0 ); + assert( pPager->journalOff==journalHdrOffset(pPager) ); + assert( sqlite3JournalIsInMemory(pPager->jfd) ); + } +#endif put32bits(&zHeader[sizeof(aJournalMagic)+4], pPager->cksumInit); + /* The initial database size */ put32bits(&zHeader[sizeof(aJournalMagic)+8], pPager->dbOrigSize); /* The assumed sector size for this process */ @@ -58375,6 +59268,9 @@ static int pager_end_transaction(Pager *pPager, int hasSuper, int bCommit){ return (rc==SQLITE_OK?rc2:rc); } +/* Forward reference */ +static int pager_playback(Pager *pPager, int isHot); + /* ** Execute a rollback if a transaction is active and unlock the ** database file. @@ -58403,6 +59299,21 @@ static void pagerUnlockAndRollback(Pager *pPager){ assert( pPager->eState==PAGER_READER ); pager_end_transaction(pPager, 0, 0); } + }else if( pPager->eState==PAGER_ERROR + && pPager->journalMode==PAGER_JOURNALMODE_MEMORY + && isOpen(pPager->jfd) + ){ + /* Special case for a ROLLBACK due to I/O error with an in-memory + ** journal: We have to rollback immediately, before the journal is + ** closed, because once it is closed, all content is forgotten. */ + int errCode = pPager->errCode; + u8 eLock = pPager->eLock; + pPager->eState = PAGER_OPEN; + pPager->errCode = SQLITE_OK; + pPager->eLock = EXCLUSIVE_LOCK; + pager_playback(pPager, 1); + pPager->errCode = errCode; + pPager->eLock = eLock; } pager_unlock(pPager); } @@ -61258,10 +62169,13 @@ SQLITE_PRIVATE int sqlite3PagerOpen( */ SQLITE_API sqlite3_file *sqlite3_database_file_object(const char *zName){ Pager *pPager; + const char *p; while( zName[-1]!=0 || zName[-2]!=0 || zName[-3]!=0 || zName[-4]!=0 ){ zName--; } - pPager = *(Pager**)(zName - 4 - sizeof(Pager*)); + p = zName - 4 - sizeof(Pager*); + assert( EIGHT_BYTE_ALIGNMENT(p) ); + pPager = *(Pager**)p; return pPager->fd; } @@ -61895,8 +62809,20 @@ SQLITE_PRIVATE int sqlite3PagerGet( DbPage **ppPage, /* Write a pointer to the page here */ int flags /* PAGER_GET_XXX flags */ ){ - /* printf("PAGE %u\n", pgno); fflush(stdout); */ +#if 0 /* Trace page fetch by setting to 1 */ + int rc; + printf("PAGE %u\n", pgno); + fflush(stdout); + rc = pPager->xGet(pPager, pgno, ppPage, flags); + if( rc ){ + printf("PAGE %u failed with 0x%02x\n", pgno, rc); + fflush(stdout); + } + return rc; +#else + /* Normal, high-speed version of sqlite3PagerGet() */ return pPager->xGet(pPager, pgno, ppPage, flags); +#endif } /* @@ -62772,6 +63698,13 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne( rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_BEGIN_ATOMIC_WRITE, 0); if( rc==SQLITE_OK ){ rc = pager_write_pagelist(pPager, pList); + if( rc==SQLITE_OK && pPager->dbSize>pPager->dbFileSize ){ + char *pTmp = pPager->pTmpSpace; + int szPage = (int)pPager->pageSize; + memset(pTmp, 0, szPage); + rc = sqlite3OsWrite(pPager->fd, pTmp, szPage, + ((i64)pPager->dbSize*pPager->pageSize)-szPage); + } if( rc==SQLITE_OK ){ rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, 0); } @@ -63006,11 +63939,11 @@ SQLITE_PRIVATE int *sqlite3PagerStats(Pager *pPager){ a[3] = pPager->eState==PAGER_OPEN ? -1 : (int) pPager->dbSize; a[4] = pPager->eState; a[5] = pPager->errCode; - a[6] = pPager->aStat[PAGER_STAT_HIT]; - a[7] = pPager->aStat[PAGER_STAT_MISS]; + a[6] = (int)pPager->aStat[PAGER_STAT_HIT] & 0x7fffffff; + a[7] = (int)pPager->aStat[PAGER_STAT_MISS] & 0x7fffffff; a[8] = 0; /* Used to be pPager->nOvfl */ a[9] = pPager->nRead; - a[10] = pPager->aStat[PAGER_STAT_WRITE]; + a[10] = (int)pPager->aStat[PAGER_STAT_WRITE] & 0x7fffffff; return a; } #endif @@ -63026,7 +63959,7 @@ SQLITE_PRIVATE int *sqlite3PagerStats(Pager *pPager){ ** reset parameter is non-zero, the cache hit or miss count is zeroed before ** returning. */ -SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *pPager, int eStat, int reset, int *pnVal){ +SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *pPager, int eStat, int reset, u64 *pnVal){ assert( eStat==SQLITE_DBSTATUS_CACHE_HIT || eStat==SQLITE_DBSTATUS_CACHE_MISS @@ -63262,7 +64195,7 @@ SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager *pPager){ ** This will be either the rollback journal or the WAL file. */ SQLITE_PRIVATE sqlite3_file *sqlite3PagerJrnlFile(Pager *pPager){ -#if SQLITE_OMIT_WAL +#ifdef SQLITE_OMIT_WAL return pPager->jfd; #else return pPager->pWal ? sqlite3WalFile(pPager->pWal) : pPager->jfd; @@ -63583,7 +64516,7 @@ SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){ } assert( state==pPager->eState ); } - }else if( eMode==PAGER_JOURNALMODE_OFF ){ + }else if( eMode==PAGER_JOURNALMODE_OFF || eMode==PAGER_JOURNALMODE_MEMORY ){ sqlite3OsClose(pPager->jfd); } } @@ -63966,7 +64899,7 @@ SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager){ } #endif -#ifdef SQLITE_USE_SEH +#if defined(SQLITE_USE_SEH) && !defined(SQLITE_OMIT_WAL) SQLITE_PRIVATE int sqlite3PagerWalSystemErrno(Pager *pPager){ return sqlite3WalSystemErrno(pPager->pWal); } @@ -65982,6 +66915,19 @@ static int walIteratorInit(Wal *pWal, u32 nBackfill, WalIterator **pp){ } #ifdef SQLITE_ENABLE_SETLK_TIMEOUT + + +/* +** Attempt to enable blocking locks that block for nMs ms. Return 1 if +** blocking locks are successfully enabled, or 0 otherwise. +*/ +static int walEnableBlockingMs(Wal *pWal, int nMs){ + int rc = sqlite3OsFileControl( + pWal->pDbFd, SQLITE_FCNTL_LOCK_TIMEOUT, (void*)&nMs + ); + return (rc==SQLITE_OK); +} + /* ** Attempt to enable blocking locks. Blocking locks are enabled only if (a) ** they are supported by the VFS, and (b) the database handle is configured @@ -65993,11 +66939,7 @@ static int walEnableBlocking(Wal *pWal){ if( pWal->db ){ int tmout = pWal->db->busyTimeout; if( tmout ){ - int rc; - rc = sqlite3OsFileControl( - pWal->pDbFd, SQLITE_FCNTL_LOCK_TIMEOUT, (void*)&tmout - ); - res = (rc==SQLITE_OK); + res = walEnableBlockingMs(pWal, tmout); } } return res; @@ -66046,20 +66988,10 @@ SQLITE_PRIVATE void sqlite3WalDb(Wal *pWal, sqlite3 *db){ pWal->db = db; } -/* -** Take an exclusive WRITE lock. Blocking if so configured. -*/ -static int walLockWriter(Wal *pWal){ - int rc; - walEnableBlocking(pWal); - rc = walLockExclusive(pWal, WAL_WRITE_LOCK, 1); - walDisableBlocking(pWal); - return rc; -} #else # define walEnableBlocking(x) 0 # define walDisableBlocking(x) -# define walLockWriter(pWal) walLockExclusive((pWal), WAL_WRITE_LOCK, 1) +# define walEnableBlockingMs(pWal, ms) 0 # define sqlite3WalDb(pWal, db) #endif /* ifdef SQLITE_ENABLE_SETLK_TIMEOUT */ @@ -66660,7 +67592,9 @@ static int walIndexReadHdr(Wal *pWal, int *pChanged){ } }else{ int bWriteLock = pWal->writeLock; - if( bWriteLock || SQLITE_OK==(rc = walLockWriter(pWal)) ){ + if( bWriteLock + || SQLITE_OK==(rc = walLockExclusive(pWal, WAL_WRITE_LOCK, 1)) + ){ pWal->writeLock = 1; if( SQLITE_OK==(rc = walIndexPage(pWal, 0, &page0)) ){ badHdr = walIndexTryHdr(pWal, pChanged); @@ -66668,7 +67602,8 @@ static int walIndexReadHdr(Wal *pWal, int *pChanged){ /* If the wal-index header is still malformed even while holding ** a WRITE lock, it can only mean that the header is corrupted and ** needs to be reconstructed. So run recovery to do exactly that. - */ + ** Disable blocking locks first. */ + walDisableBlocking(pWal); rc = walIndexRecover(pWal); *pChanged = 1; } @@ -66878,6 +67813,37 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){ return rc; } +/* +** The final argument passed to walTryBeginRead() is of type (int*). The +** caller should invoke walTryBeginRead as follows: +** +** int cnt = 0; +** do { +** rc = walTryBeginRead(..., &cnt); +** }while( rc==WAL_RETRY ); +** +** The final value of "cnt" is of no use to the caller. It is used by +** the implementation of walTryBeginRead() as follows: +** +** + Each time walTryBeginRead() is called, it is incremented. Once +** it reaches WAL_RETRY_PROTOCOL_LIMIT - indicating that walTryBeginRead() +** has many times been invoked and failed with WAL_RETRY - walTryBeginRead() +** returns SQLITE_PROTOCOL. +** +** + If SQLITE_ENABLE_SETLK_TIMEOUT is defined and walTryBeginRead() failed +** because a blocking lock timed out (SQLITE_BUSY_TIMEOUT from the OS +** layer), the WAL_RETRY_BLOCKED_MASK bit is set in "cnt". In this case +** the next invocation of walTryBeginRead() may omit an expected call to +** sqlite3OsSleep(). There has already been a delay when the previous call +** waited on a lock. +*/ +#define WAL_RETRY_PROTOCOL_LIMIT 100 +#ifdef SQLITE_ENABLE_SETLK_TIMEOUT +# define WAL_RETRY_BLOCKED_MASK 0x10000000 +#else +# define WAL_RETRY_BLOCKED_MASK 0 +#endif + /* ** Attempt to start a read transaction. This might fail due to a race or ** other transient condition. When that happens, it returns WAL_RETRY to @@ -66928,13 +67894,16 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){ ** so it takes care to hold an exclusive lock on the corresponding ** WAL_READ_LOCK() while changing values. */ -static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){ +static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int *pCnt){ volatile WalCkptInfo *pInfo; /* Checkpoint information in wal-index */ u32 mxReadMark; /* Largest aReadMark[] value */ int mxI; /* Index of largest aReadMark[] value */ int i; /* Loop counter */ int rc = SQLITE_OK; /* Return code */ u32 mxFrame; /* Wal frame to lock to */ +#ifdef SQLITE_ENABLE_SETLK_TIMEOUT + int nBlockTmout = 0; +#endif assert( pWal->readLock<0 ); /* Not currently locked */ @@ -66958,14 +67927,34 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){ ** so that on the 100th (and last) RETRY we delay for 323 milliseconds. ** The total delay time before giving up is less than 10 seconds. */ - if( cnt>5 ){ + (*pCnt)++; + if( *pCnt>5 ){ int nDelay = 1; /* Pause time in microseconds */ - if( cnt>100 ){ + int cnt = (*pCnt & ~WAL_RETRY_BLOCKED_MASK); + if( cnt>WAL_RETRY_PROTOCOL_LIMIT ){ VVA_ONLY( pWal->lockError = 1; ) return SQLITE_PROTOCOL; } - if( cnt>=10 ) nDelay = (cnt-9)*(cnt-9)*39; + if( *pCnt>=10 ) nDelay = (cnt-9)*(cnt-9)*39; +#ifdef SQLITE_ENABLE_SETLK_TIMEOUT + /* In SQLITE_ENABLE_SETLK_TIMEOUT builds, configure the file-descriptor + ** to block for locks for approximately nDelay us. This affects three + ** locks: (a) the shared lock taken on the DMS slot in os_unix.c (if + ** using os_unix.c), (b) the WRITER lock taken in walIndexReadHdr() if the + ** first attempted read fails, and (c) the shared lock taken on the + ** read-mark. + ** + ** If the previous call failed due to an SQLITE_BUSY_TIMEOUT error, + ** then sleep for the minimum of 1us. The previous call already provided + ** an extra delay while it was blocking on the lock. + */ + nBlockTmout = (nDelay+998) / 1000; + if( !useWal && walEnableBlockingMs(pWal, nBlockTmout) ){ + if( *pCnt & WAL_RETRY_BLOCKED_MASK ) nDelay = 1; + } +#endif sqlite3OsSleep(pWal->pVfs, nDelay); + *pCnt &= ~WAL_RETRY_BLOCKED_MASK; } if( !useWal ){ @@ -66973,6 +67962,13 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){ if( pWal->bShmUnreliable==0 ){ rc = walIndexReadHdr(pWal, pChanged); } +#ifdef SQLITE_ENABLE_SETLK_TIMEOUT + walDisableBlocking(pWal); + if( rc==SQLITE_BUSY_TIMEOUT ){ + rc = SQLITE_BUSY; + *pCnt |= WAL_RETRY_BLOCKED_MASK; + } +#endif if( rc==SQLITE_BUSY ){ /* If there is not a recovery running in another thread or process ** then convert BUSY errors to WAL_RETRY. If recovery is known to @@ -67087,9 +68083,19 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){ return rc==SQLITE_BUSY ? WAL_RETRY : SQLITE_READONLY_CANTINIT; } + (void)walEnableBlockingMs(pWal, nBlockTmout); rc = walLockShared(pWal, WAL_READ_LOCK(mxI)); + walDisableBlocking(pWal); if( rc ){ - return rc==SQLITE_BUSY ? WAL_RETRY : rc; +#ifdef SQLITE_ENABLE_SETLK_TIMEOUT + if( rc==SQLITE_BUSY_TIMEOUT ){ + *pCnt |= WAL_RETRY_BLOCKED_MASK; + } +#else + assert( rc!=SQLITE_BUSY_TIMEOUT ); +#endif + assert( (rc&0xFF)!=SQLITE_BUSY||rc==SQLITE_BUSY||rc==SQLITE_BUSY_TIMEOUT ); + return (rc&0xFF)==SQLITE_BUSY ? WAL_RETRY : rc; } /* Now that the read-lock has been obtained, check that neither the ** value in the aReadMark[] array or the contents of the wal-index @@ -67277,7 +68283,7 @@ static int walBeginReadTransaction(Wal *pWal, int *pChanged){ #endif do{ - rc = walTryBeginRead(pWal, pChanged, 0, ++cnt); + rc = walTryBeginRead(pWal, pChanged, 0, &cnt); }while( rc==WAL_RETRY ); testcase( (rc&0xff)==SQLITE_BUSY ); testcase( (rc&0xff)==SQLITE_IOERR ); @@ -67458,6 +68464,7 @@ static int walFindFrame( iRead = iFrame; } if( (nCollide--)==0 ){ + *piRead = 0; return SQLITE_CORRUPT_BKPT; } iKey = walNextHash(iKey); @@ -67761,7 +68768,7 @@ static int walRestartLog(Wal *pWal){ cnt = 0; do{ int notUsed; - rc = walTryBeginRead(pWal, ¬Used, 1, ++cnt); + rc = walTryBeginRead(pWal, ¬Used, 1, &cnt); }while( rc==WAL_RETRY ); assert( (rc&0xff)!=SQLITE_BUSY ); /* BUSY not possible when useWal==1 */ testcase( (rc&0xff)==SQLITE_IOERR ); @@ -68182,10 +69189,9 @@ SQLITE_PRIVATE int sqlite3WalCheckpoint( if( pWal->readOnly ) return SQLITE_READONLY; WALTRACE(("WAL%p: checkpoint begins\n", pWal)); - /* Enable blocking locks, if possible. If blocking locks are successfully - ** enabled, set xBusy2=0 so that the busy-handler is never invoked. */ + /* Enable blocking locks, if possible. */ sqlite3WalDb(pWal, db); - (void)walEnableBlocking(pWal); + if( xBusy2 ) (void)walEnableBlocking(pWal); /* IMPLEMENTATION-OF: R-62028-47212 All calls obtain an exclusive ** "checkpoint" lock on the database file. @@ -68226,9 +69232,14 @@ SQLITE_PRIVATE int sqlite3WalCheckpoint( /* Read the wal-index header. */ SEH_TRY { if( rc==SQLITE_OK ){ + /* For a passive checkpoint, do not re-enable blocking locks after + ** reading the wal-index header. A passive checkpoint should not block + ** or invoke the busy handler. The only lock such a checkpoint may + ** attempt to obtain is a lock on a read-slot, and it should give up + ** immediately and do a partial checkpoint if it cannot obtain it. */ walDisableBlocking(pWal); rc = walIndexReadHdr(pWal, &isChanged); - (void)walEnableBlocking(pWal); + if( eMode2!=SQLITE_CHECKPOINT_PASSIVE ) (void)walEnableBlocking(pWal); if( isChanged && pWal->pDbFd->pMethods->iVersion>=3 ){ sqlite3OsUnfetch(pWal->pDbFd, 0, 0); } @@ -68565,7 +69576,7 @@ SQLITE_PRIVATE sqlite3_file *sqlite3WalFile(Wal *pWal){ ** 22 1 Min embedded payload fraction (must be 32) ** 23 1 Min leaf payload fraction (must be 32) ** 24 4 File change counter -** 28 4 Reserved for future use +** 28 4 The size of the database in pages ** 32 4 First freelist page ** 36 4 Number of freelist pages in the file ** 40 60 15 4-byte meta values passed to higher layers @@ -69196,7 +70207,7 @@ struct IntegrityCk { BtShared *pBt; /* The tree being checked out */ Pager *pPager; /* The associated pager. Also accessible by pBt->pPager */ u8 *aPgRef; /* 1 bit per page in the db (see above) */ - Pgno nPage; /* Number of pages in the database */ + Pgno nCkPage; /* Pages in the database. 0 for partial check */ int mxErr; /* Stop accumulating errors when this reaches zero */ int nErr; /* Number of messages written to zErrMsg so far */ int rc; /* SQLITE_OK, SQLITE_NOMEM, or SQLITE_INTERRUPT */ @@ -69208,6 +70219,7 @@ struct IntegrityCk { StrAccum errMsg; /* Accumulate the error message text here */ u32 *heap; /* Min-heap used for analyzing cell coverage */ sqlite3 *db; /* Database connection running the check */ + i64 nRow; /* Number of rows visited in current tree */ }; /* @@ -69529,7 +70541,6 @@ SQLITE_PRIVATE void sqlite3BtreeLeaveCursor(BtCursor *pCur){ /************** End of btmutex.c *********************************************/ /************** Begin file btree.c *******************************************/ - /* ** 2004 April 6 ** @@ -69683,8 +70694,47 @@ int corruptPageError(int lineno, MemPage *p){ # define SQLITE_CORRUPT_PAGE(pMemPage) SQLITE_CORRUPT_PGNO(pMemPage->pgno) #endif +/* Default value for SHARED_LOCK_TRACE macro if shared-cache is disabled +** or if the lock tracking is disabled. This is always the value for +** release builds. +*/ +#define SHARED_LOCK_TRACE(X,MSG,TAB,TYPE) /*no-op*/ + #ifndef SQLITE_OMIT_SHARED_CACHE +#if 0 +/* ^---- Change to 1 and recompile to enable shared-lock tracing +** for debugging purposes. +** +** Print all shared-cache locks on a BtShared. Debugging use only. +*/ +static void sharedLockTrace( + BtShared *pBt, + const char *zMsg, + int iRoot, + int eLockType +){ + BtLock *pLock; + if( iRoot>0 ){ + printf("%s-%p %u%s:", zMsg, pBt, iRoot, eLockType==READ_LOCK?"R":"W"); + }else{ + printf("%s-%p:", zMsg, pBt); + } + for(pLock=pBt->pLock; pLock; pLock=pLock->pNext){ + printf(" %p/%u%s", pLock->pBtree, pLock->iTable, + pLock->eLock==READ_LOCK ? "R" : "W"); + while( pLock->pNext && pLock->pBtree==pLock->pNext->pBtree ){ + pLock = pLock->pNext; + printf(",%u%s", pLock->iTable, pLock->eLock==READ_LOCK ? "R" : "W"); + } + } + printf("\n"); + fflush(stdout); +} +#undef SHARED_LOCK_TRACE +#define SHARED_LOCK_TRACE(X,MSG,TAB,TYPE) sharedLockTrace(X,MSG,TAB,TYPE) +#endif /* Shared-lock tracing */ + #ifdef SQLITE_DEBUG /* **** This function is only used as part of an assert() statement. *** @@ -69761,6 +70811,8 @@ static int hasSharedCacheTableLock( iTab = iRoot; } + SHARED_LOCK_TRACE(pBtree->pBt,"hasLock",iRoot,eLockType); + /* Search for the required lock. Either a write-lock on root-page iTab, a ** write-lock on the schema table, or (if the client is reading) a ** read-lock on iTab will suffice. Return 1 if any of these are found. */ @@ -69894,6 +70946,8 @@ static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){ BtLock *pLock = 0; BtLock *pIter; + SHARED_LOCK_TRACE(pBt,"setLock", iTable, eLock); + assert( sqlite3BtreeHoldsMutex(p) ); assert( eLock==READ_LOCK || eLock==WRITE_LOCK ); assert( p->db!=0 ); @@ -69961,6 +71015,8 @@ static void clearAllSharedCacheTableLocks(Btree *p){ assert( p->sharable || 0==*ppIter ); assert( p->inTrans>0 ); + SHARED_LOCK_TRACE(pBt, "clearAllLocks", 0, 0); + while( *ppIter ){ BtLock *pLock = *ppIter; assert( (pBt->btsFlags & BTS_EXCLUSIVE)==0 || pBt->pWriter==pLock->pBtree ); @@ -69999,6 +71055,9 @@ static void clearAllSharedCacheTableLocks(Btree *p){ */ static void downgradeAllSharedCacheTableLocks(Btree *p){ BtShared *pBt = p->pBt; + + SHARED_LOCK_TRACE(pBt, "downgradeLocks", 0, 0); + if( pBt->pWriter==p ){ BtLock *pLock; pBt->pWriter = 0; @@ -74612,9 +75671,12 @@ static int accessPayload( if( pCur->aOverflow==0 || nOvfl*(int)sizeof(Pgno) > sqlite3MallocSize(pCur->aOverflow) ){ - Pgno *aNew = (Pgno*)sqlite3Realloc( - pCur->aOverflow, nOvfl*2*sizeof(Pgno) - ); + Pgno *aNew; + if( sqlite3FaultSim(413) ){ + aNew = 0; + }else{ + aNew = (Pgno*)sqlite3Realloc(pCur->aOverflow, nOvfl*2*sizeof(Pgno)); + } if( aNew==0 ){ return SQLITE_NOMEM_BKPT; }else{ @@ -74624,6 +75686,12 @@ static int accessPayload( memset(pCur->aOverflow, 0, nOvfl*sizeof(Pgno)); pCur->curFlags |= BTCF_ValidOvfl; }else{ + /* Sanity check the validity of the overflow page cache */ + assert( pCur->aOverflow[0]==nextPage + || pCur->aOverflow[0]==0 + || CORRUPT_DB ); + assert( pCur->aOverflow[0]!=0 || pCur->aOverflow[offset/ovflSize]==0 ); + /* If the overflow page-list cache has been allocated and the ** entry for the first required overflow page is valid, skip ** directly to it. @@ -74693,7 +75761,6 @@ static int accessPayload( assert( aWrite>=pBufStart ); /* due to (6) */ memcpy(aSave, aWrite, 4); rc = sqlite3OsRead(fd, aWrite, a+4, (i64)pBt->pageSize*(nextPage-1)); - if( rc && nextPage>pBt->nPage ) rc = SQLITE_CORRUPT_BKPT; nextPage = get4byte(aWrite); memcpy(aWrite, aSave, 4); }else @@ -75106,6 +76173,23 @@ SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor *pCur, int *pRes){ return rc; } +#ifdef SQLITE_DEBUG +/* The cursors is CURSOR_VALID and has BTCF_AtLast set. Verify that +** this flags are true for a consistent database. +** +** This routine is is called from within assert() statements only. +** It is an internal verification routine and does not appear in production +** builds. +*/ +static int cursorIsAtLastEntry(BtCursor *pCur){ + int ii; + for(ii=0; iiiPage; ii++){ + if( pCur->aiIdx[ii]!=pCur->apPage[ii]->nCell ) return 0; + } + return pCur->ix==pCur->pPage->nCell-1 && pCur->pPage->leaf!=0; +} +#endif + /* Move the cursor to the last entry in the table. Return SQLITE_OK ** on success. Set *pRes to 0 if the cursor actually points to something ** or set *pRes to 1 if the table is empty. @@ -75134,18 +76218,7 @@ SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor *pCur, int *pRes){ /* If the cursor already points to the last entry, this is a no-op. */ if( CURSOR_VALID==pCur->eState && (pCur->curFlags & BTCF_AtLast)!=0 ){ -#ifdef SQLITE_DEBUG - /* This block serves to assert() that the cursor really does point - ** to the last entry in the b-tree. */ - int ii; - for(ii=0; iiiPage; ii++){ - assert( pCur->aiIdx[ii]==pCur->apPage[ii]->nCell ); - } - assert( pCur->ix==pCur->pPage->nCell-1 || CORRUPT_DB ); - testcase( pCur->ix!=pCur->pPage->nCell-1 ); - /* ^-- dbsqlfuzz b92b72e4de80b5140c30ab71372ca719b8feb618 */ - assert( pCur->pPage->leaf ); -#endif + assert( cursorIsAtLastEntry(pCur) || CORRUPT_DB ); *pRes = 0; return SQLITE_OK; } @@ -75198,6 +76271,7 @@ SQLITE_PRIVATE int sqlite3BtreeTableMoveto( } if( pCur->info.nKeycurFlags & BTCF_AtLast)!=0 ){ + assert( cursorIsAtLastEntry(pCur) || CORRUPT_DB ); *pRes = -1; return SQLITE_OK; } @@ -75664,10 +76738,10 @@ SQLITE_PRIVATE i64 sqlite3BtreeRowCountEst(BtCursor *pCur){ assert( cursorOwnsBtShared(pCur) ); assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); - /* Currently this interface is only called by the OP_IfSmaller - ** opcode, and it that case the cursor will always be valid and - ** will always point to a leaf node. */ - if( NEVER(pCur->eState!=CURSOR_VALID) ) return -1; + /* Currently this interface is only called by the OP_IfSizeBetween + ** opcode and the OP_Count opcode with P3=1. In either case, + ** the cursor will always be valid unless the btree is empty. */ + if( pCur->eState!=CURSOR_VALID ) return 0; if( NEVER(pCur->pPage->leaf==0) ) return -1; n = pCur->pPage->nCell; @@ -75813,7 +76887,10 @@ static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur){ } pPage = pCur->pPage; - assert( pPage->isInit ); + if( sqlite3FaultSim(412) ) pPage->isInit = 0; + if( !pPage->isInit ){ + return SQLITE_CORRUPT_BKPT; + } if( !pPage->leaf ){ int idx = pCur->ix; rc = moveToChild(pCur, get4byte(findCell(pPage, idx))); @@ -76486,7 +77563,10 @@ static int fillInCell( n = nHeader + nPayload; testcase( n==3 ); testcase( n==4 ); - if( n<4 ) n = 4; + if( n<4 ){ + n = 4; + pPayload[nPayload] = 0; + } *pnSize = n; assert( nSrc<=nPayload ); testcase( nSrcapEnd[] */ u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */ + assert( nCell>0 ); assert( i(u32)usableSize) ){ j = 0; } + if( j>(u32)usableSize ){ j = 0; } memcpy(&pTmp[j], &aData[j], usableSize - j); for(k=0; ALWAYS(kixNx[k]<=i; k++){} @@ -77330,6 +78411,7 @@ static int editPage( return SQLITE_OK; editpage_fail: /* Unable to edit this page. Rebuild it from scratch instead. */ + if( nNew<1 ) return SQLITE_CORRUPT_BKPT; populateCellCache(pCArray, iNew, nNew); return rebuildPage(pCArray, iNew, nNew, pPg); } @@ -77790,7 +78872,7 @@ static int balance_nonroot( ** table-interior, index-leaf, or index-interior). */ if( pOld->aData[0]!=apOld[0]->aData[0] ){ - rc = SQLITE_CORRUPT_BKPT; + rc = SQLITE_CORRUPT_PAGE(pOld); goto balance_cleanup; } @@ -77814,7 +78896,7 @@ static int balance_nonroot( memset(&b.szCell[b.nCell], 0, sizeof(b.szCell[0])*(limit+pOld->nOverflow)); if( pOld->nOverflow>0 ){ if( NEVER(limitaiOvfl[0]) ){ - rc = SQLITE_CORRUPT_BKPT; + rc = SQLITE_CORRUPT_PAGE(pOld); goto balance_cleanup; } limit = pOld->aiOvfl[0]; @@ -78457,7 +79539,7 @@ static int anotherValidCursor(BtCursor *pCur){ && pOther->eState==CURSOR_VALID && pOther->pPage==pCur->pPage ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pCur->pPage); } } return SQLITE_OK; @@ -78517,7 +79599,7 @@ static int balance(BtCursor *pCur){ /* The page being written is not a root page, and there is currently ** more than one reference to it. This only happens if the page is one ** of its own ancestor pages. Corruption. */ - rc = SQLITE_CORRUPT_BKPT; + rc = SQLITE_CORRUPT_PAGE(pPage); }else{ MemPage * const pParent = pCur->apPage[iPage-1]; int const iIdx = pCur->aiIdx[iPage-1]; @@ -78681,7 +79763,7 @@ static SQLITE_NOINLINE int btreeOverwriteOverflowCell( rc = btreeGetPage(pBt, ovflPgno, &pPage, 0); if( rc ) return rc; if( sqlite3PagerPageRefcount(pPage->pDbPage)!=1 || pPage->isInit ){ - rc = SQLITE_CORRUPT_BKPT; + rc = SQLITE_CORRUPT_PAGE(pPage); }else{ if( iOffset+ovflPageSize<(u32)nTotal ){ ovflPgno = get4byte(pPage->aData); @@ -78709,7 +79791,7 @@ static int btreeOverwriteCell(BtCursor *pCur, const BtreePayload *pX){ if( pCur->info.pPayload + pCur->info.nLocal > pPage->aDataEnd || pCur->info.pPayload < pPage->aData + pPage->cellOffset ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pPage); } if( pCur->info.nLocal==nTotal ){ /* The entire cell is local */ @@ -78790,7 +79872,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( ** Which can only happen if the SQLITE_NoSchemaError flag was set when ** the schema was loaded. This cannot be asserted though, as a user might ** set the flag, load the schema, and then unset the flag. */ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PGNO(pCur->pgnoRoot); } } @@ -78913,7 +79995,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( if( pPage->nFree<0 ){ if( NEVER(pCur->eState>CURSOR_INVALID) ){ /* ^^^^^--- due to the moveToRoot() call above */ - rc = SQLITE_CORRUPT_BKPT; + rc = SQLITE_CORRUPT_PAGE(pPage); }else{ rc = btreeComputeFreeSpace(pPage); } @@ -78930,7 +80012,10 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( if( flags & BTREE_PREFORMAT ){ rc = SQLITE_OK; szNew = p->pBt->nPreformatSize; - if( szNew<4 ) szNew = 4; + if( szNew<4 ){ + szNew = 4; + newCell[3] = 0; + } if( ISAUTOVACUUM(p->pBt) && szNew>pPage->maxLocal ){ CellInfo info; pPage->xParseCell(pPage, newCell, &info); @@ -78952,7 +80037,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( CellInfo info; assert( idx>=0 ); if( idx>=pPage->nCell ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pPage); } rc = sqlite3PagerWrite(pPage->pDbPage); if( rc ){ @@ -78979,10 +80064,10 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( ** necessary to add the PTRMAP_OVERFLOW1 pointer-map entry. */ assert( rc==SQLITE_OK ); /* clearCell never fails when nLocal==nPayload */ if( oldCell < pPage->aData+pPage->hdrOffset+10 ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pPage); } if( oldCell+szNew > pPage->aDataEnd ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pPage); } memcpy(oldCell, newCell, szNew); return SQLITE_OK; @@ -78992,7 +80077,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( }else if( loc<0 && pPage->nCell>0 ){ assert( pPage->leaf ); idx = ++pCur->ix; - pCur->curFlags &= ~BTCF_ValidNKey; + pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl); }else{ assert( pPage->leaf ); } @@ -79022,7 +80107,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( */ if( pPage->nOverflow ){ assert( rc==SQLITE_OK ); - pCur->curFlags &= ~(BTCF_ValidNKey); + pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl); rc = balance(pCur); /* Must make sure nOverflow is reset to zero even if the balance() @@ -79084,7 +80169,7 @@ SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 nIn = pSrc->info.nLocal; aIn = pSrc->info.pPayload; if( aIn+nIn>pSrc->pPage->aDataEnd ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pSrc->pPage); } nRem = pSrc->info.nPayload; if( nIn==nRem && nInpPage->maxLocal ){ @@ -79109,7 +80194,7 @@ SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 if( nRem>nIn ){ if( aIn+nIn+4>pSrc->pPage->aDataEnd ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pSrc->pPage); } ovflIn = get4byte(&pSrc->info.pPayload[nIn]); } @@ -79205,7 +80290,7 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ assert( rc!=SQLITE_OK || CORRUPT_DB || pCur->eState==CURSOR_VALID ); if( rc || pCur->eState!=CURSOR_VALID ) return rc; }else{ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PGNO(pCur->pgnoRoot); } } assert( pCur->eState==CURSOR_VALID ); @@ -79214,14 +80299,14 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ iCellIdx = pCur->ix; pPage = pCur->pPage; if( pPage->nCell<=iCellIdx ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pPage); } pCell = findCell(pPage, iCellIdx); if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pPage); } if( pCell<&pPage->aCellIdx[pPage->nCell] ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PAGE(pPage); } /* If the BTREE_SAVEPOSITION bit is on, then the cursor position must @@ -79312,7 +80397,7 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ n = pCur->pPage->pgno; } pCell = findCell(pLeaf, pLeaf->nCell-1); - if( pCell<&pLeaf->aData[4] ) return SQLITE_CORRUPT_BKPT; + if( pCell<&pLeaf->aData[4] ) return SQLITE_CORRUPT_PAGE(pLeaf); nCell = pLeaf->xCellSize(pLeaf, pCell); assert( MX_CELL_SIZE(pBt) >= nCell ); pTmp = pBt->pTmpSpace; @@ -79428,7 +80513,7 @@ static int btreeCreateTable(Btree *p, Pgno *piTable, int createTabFlags){ */ sqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &pgnoRoot); if( pgnoRoot>btreePagecount(pBt) ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PGNO(pgnoRoot); } pgnoRoot++; @@ -79476,7 +80561,7 @@ static int btreeCreateTable(Btree *p, Pgno *piTable, int createTabFlags){ } rc = ptrmapGet(pBt, pgnoRoot, &eType, &iPtrPage); if( eType==PTRMAP_ROOTPAGE || eType==PTRMAP_FREEPAGE ){ - rc = SQLITE_CORRUPT_BKPT; + rc = SQLITE_CORRUPT_PGNO(pgnoRoot); } if( rc!=SQLITE_OK ){ releasePage(pRoot); @@ -79566,14 +80651,14 @@ static int clearDatabasePage( assert( sqlite3_mutex_held(pBt->mutex) ); if( pgno>btreePagecount(pBt) ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PGNO(pgno); } rc = getAndInitPage(pBt, pgno, &pPage, 0); if( rc ) return rc; if( (pBt->openFlags & BTREE_SINGLE)==0 && sqlite3PagerPageRefcount(pPage->pDbPage) != (1 + (pgno==1)) ){ - rc = SQLITE_CORRUPT_BKPT; + rc = SQLITE_CORRUPT_PAGE(pPage); goto cleardatabasepage_out; } hdr = pPage->hdrOffset; @@ -79677,7 +80762,7 @@ static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){ assert( p->inTrans==TRANS_WRITE ); assert( iTable>=2 ); if( iTable>btreePagecount(pBt) ){ - return SQLITE_CORRUPT_BKPT; + return SQLITE_CORRUPT_PGNO(iTable); } rc = sqlite3BtreeClearTable(p, iTable, 0); @@ -79989,7 +81074,8 @@ static void checkAppendMsg( ** corresponds to page iPg is already set. */ static int getPageReferenced(IntegrityCk *pCheck, Pgno iPg){ - assert( iPg<=pCheck->nPage && sizeof(pCheck->aPgRef[0])==1 ); + assert( pCheck->aPgRef!=0 ); + assert( iPg<=pCheck->nCkPage && sizeof(pCheck->aPgRef[0])==1 ); return (pCheck->aPgRef[iPg/8] & (1 << (iPg & 0x07))); } @@ -79997,7 +81083,8 @@ static int getPageReferenced(IntegrityCk *pCheck, Pgno iPg){ ** Set the bit in the IntegrityCk.aPgRef[] array that corresponds to page iPg. */ static void setPageReferenced(IntegrityCk *pCheck, Pgno iPg){ - assert( iPg<=pCheck->nPage && sizeof(pCheck->aPgRef[0])==1 ); + assert( pCheck->aPgRef!=0 ); + assert( iPg<=pCheck->nCkPage && sizeof(pCheck->aPgRef[0])==1 ); pCheck->aPgRef[iPg/8] |= (1 << (iPg & 0x07)); } @@ -80011,7 +81098,7 @@ static void setPageReferenced(IntegrityCk *pCheck, Pgno iPg){ ** Also check that the page number is in bounds. */ static int checkRef(IntegrityCk *pCheck, Pgno iPage){ - if( iPage>pCheck->nPage || iPage==0 ){ + if( iPage>pCheck->nCkPage || iPage==0 ){ checkAppendMsg(pCheck, "invalid page number %u", iPage); return 1; } @@ -80238,6 +81325,7 @@ static int checkTreePage( if( (rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0 ){ checkAppendMsg(pCheck, "unable to get the page. error code=%d", rc); + if( rc==SQLITE_IOERR_NOMEM ) pCheck->rc = SQLITE_NOMEM; goto end_of_check; } @@ -80268,6 +81356,9 @@ static int checkTreePage( ** number of cells on the page. */ nCell = get2byte(&data[hdr+3]); assert( pPage->nCell==nCell ); + if( pPage->leaf || pPage->intKey==0 ){ + pCheck->nRow += nCell; + } /* EVIDENCE-OF: R-23882-45353 The cell pointer array of a b-tree page ** immediately follows the b-tree page header. */ @@ -80379,6 +81470,7 @@ static int checkTreePage( btreeHeapInsert(heap, (pc<<16)|(pc+size-1)); } } + assert( heap!=0 ); /* Add the freeblocks to the min-heap ** ** EVIDENCE-OF: R-20690-50594 The second field of the b-tree page header @@ -80478,6 +81570,7 @@ SQLITE_PRIVATE int sqlite3BtreeIntegrityCheck( sqlite3 *db, /* Database connection that is running the check */ Btree *p, /* The btree to be checked */ Pgno *aRoot, /* An array of root pages numbers for individual trees */ + Mem *aCnt, /* Memory cells to write counts for each tree to */ int nRoot, /* Number of entries in aRoot[] */ int mxErr, /* Stop reporting errors after this many */ int *pnErr, /* OUT: Write number of errors seen to this variable */ @@ -80491,7 +81584,9 @@ SQLITE_PRIVATE int sqlite3BtreeIntegrityCheck( int bPartial = 0; /* True if not checking all btrees */ int bCkFreelist = 1; /* True to scan the freelist */ VVA_ONLY( int nRef ); + assert( nRoot>0 ); + assert( aCnt!=0 ); /* aRoot[0]==0 means this is a partial check */ if( aRoot[0]==0 ){ @@ -80508,15 +81603,15 @@ SQLITE_PRIVATE int sqlite3BtreeIntegrityCheck( sCheck.db = db; sCheck.pBt = pBt; sCheck.pPager = pBt->pPager; - sCheck.nPage = btreePagecount(sCheck.pBt); + sCheck.nCkPage = btreePagecount(sCheck.pBt); sCheck.mxErr = mxErr; sqlite3StrAccumInit(&sCheck.errMsg, 0, zErr, sizeof(zErr), SQLITE_MAX_LENGTH); sCheck.errMsg.printfFlags = SQLITE_PRINTF_INTERNAL; - if( sCheck.nPage==0 ){ + if( sCheck.nCkPage==0 ){ goto integrity_ck_cleanup; } - sCheck.aPgRef = sqlite3MallocZero((sCheck.nPage / 8)+ 1); + sCheck.aPgRef = sqlite3MallocZero((sCheck.nCkPage / 8)+ 1); if( !sCheck.aPgRef ){ checkOom(&sCheck); goto integrity_ck_cleanup; @@ -80528,7 +81623,7 @@ SQLITE_PRIVATE int sqlite3BtreeIntegrityCheck( } i = PENDING_BYTE_PAGE(pBt); - if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i); + if( i<=sCheck.nCkPage ) setPageReferenced(&sCheck, i); /* Check the integrity of the freelist */ @@ -80564,22 +81659,25 @@ SQLITE_PRIVATE int sqlite3BtreeIntegrityCheck( testcase( pBt->db->flags & SQLITE_CellSizeCk ); pBt->db->flags &= ~(u64)SQLITE_CellSizeCk; for(i=0; (int)iautoVacuum && aRoot[i]>1 && !bPartial ){ - checkPtrmap(&sCheck, aRoot[i], PTRMAP_ROOTPAGE, 0); - } + if( pBt->autoVacuum && aRoot[i]>1 && !bPartial ){ + checkPtrmap(&sCheck, aRoot[i], PTRMAP_ROOTPAGE, 0); + } #endif - sCheck.v0 = aRoot[i]; - checkTreePage(&sCheck, aRoot[i], ¬Used, LARGEST_INT64); + sCheck.v0 = aRoot[i]; + checkTreePage(&sCheck, aRoot[i], ¬Used, LARGEST_INT64); + } + sqlite3MemSetArrayInt64(aCnt, i, sCheck.nRow); } pBt->db->flags = savedDbFlags; /* Make sure every page in the file is referenced */ if( !bPartial ){ - for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){ + for(i=1; i<=sCheck.nCkPage && sCheck.mxErr; i++){ #ifdef SQLITE_OMIT_AUTOVACUUM if( getPageReferenced(&sCheck, i)==0 ){ checkAppendMsg(&sCheck, "Page %u: never used", i); @@ -82020,7 +83118,7 @@ SQLITE_PRIVATE void sqlite3VdbeMemZeroTerminateIfAble(Mem *pMem){ pMem->flags |= MEM_Term; return; } - if( pMem->xDel==(void(*)(void*))sqlite3RCStrUnref ){ + if( pMem->xDel==sqlite3RCStrUnref ){ /* Blindly assume that all RCStr objects are zero-terminated */ pMem->flags |= MEM_Term; return; @@ -82627,6 +83725,13 @@ SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){ } } +/* +** Set the iIdx'th entry of array aMem[] to contain integer value val. +*/ +SQLITE_PRIVATE void sqlite3MemSetArrayInt64(sqlite3_value *aMem, int iIdx, i64 val){ + sqlite3VdbeMemSetInt64(&aMem[iIdx], val); +} + /* A no-op destructor */ SQLITE_PRIVATE void sqlite3NoopDestructor(void *p){ UNUSED_PARAMETER(p); } @@ -83199,7 +84304,7 @@ static int valueFromFunction( #endif assert( pFunc ); if( (pFunc->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG))==0 - || (pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL) + || (pFunc->funcFlags & (SQLITE_FUNC_NEEDCOLL|SQLITE_FUNC_RUNONLY))!=0 ){ return SQLITE_OK; } @@ -83315,14 +84420,20 @@ static int valueFromExpr( } /* Handle negative integers in a single step. This is needed in the - ** case when the value is -9223372036854775808. - */ - if( op==TK_UMINUS - && (pExpr->pLeft->op==TK_INTEGER || pExpr->pLeft->op==TK_FLOAT) ){ - pExpr = pExpr->pLeft; - op = pExpr->op; - negInt = -1; - zNeg = "-"; + ** case when the value is -9223372036854775808. Except - do not do this + ** for hexadecimal literals. */ + if( op==TK_UMINUS ){ + Expr *pLeft = pExpr->pLeft; + if( (pLeft->op==TK_INTEGER || pLeft->op==TK_FLOAT) ){ + if( ExprHasProperty(pLeft, EP_IntValue) + || pLeft->u.zToken[0]!='0' || (pLeft->u.zToken[1] & ~0x20)!='X' + ){ + pExpr = pLeft; + op = pExpr->op; + negInt = -1; + zNeg = "-"; + } + } } if( op==TK_STRING || op==TK_FLOAT || op==TK_INTEGER ){ @@ -83331,12 +84442,26 @@ static int valueFromExpr( if( ExprHasProperty(pExpr, EP_IntValue) ){ sqlite3VdbeMemSetInt64(pVal, (i64)pExpr->u.iValue*negInt); }else{ - zVal = sqlite3MPrintf(db, "%s%s", zNeg, pExpr->u.zToken); - if( zVal==0 ) goto no_mem; - sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC); + i64 iVal; + if( op==TK_INTEGER && 0==sqlite3DecOrHexToI64(pExpr->u.zToken, &iVal) ){ + sqlite3VdbeMemSetInt64(pVal, iVal*negInt); + }else{ + zVal = sqlite3MPrintf(db, "%s%s", zNeg, pExpr->u.zToken); + if( zVal==0 ) goto no_mem; + sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC); + } } - if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_BLOB ){ - sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8); + if( affinity==SQLITE_AFF_BLOB ){ + if( op==TK_FLOAT ){ + assert( pVal && pVal->z && pVal->flags==(MEM_Str|MEM_Term) ); + sqlite3AtoF(pVal->z, &pVal->u.r, pVal->n, SQLITE_UTF8); + pVal->flags = MEM_Real; + }else if( op==TK_INTEGER ){ + /* This case is required by -9223372036854775808 and other strings + ** that look like integers but cannot be handled by the + ** sqlite3DecOrHexToI64() call above. */ + sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8); + } }else{ sqlite3ValueApplyAffinity(pVal, affinity, SQLITE_UTF8); } @@ -83400,6 +84525,7 @@ static int valueFromExpr( if( pVal ){ pVal->flags = MEM_Int; pVal->u.i = pExpr->u.zToken[4]==0; + sqlite3ValueApplyAffinity(pVal, affinity, enc); } } @@ -83605,17 +84731,17 @@ SQLITE_PRIVATE int sqlite3Stat4Column( sqlite3_value **ppVal /* OUT: Extracted value */ ){ u32 t = 0; /* a column type code */ - int nHdr; /* Size of the header in the record */ - int iHdr; /* Next unread header byte */ - int iField; /* Next unread data byte */ - int szField = 0; /* Size of the current data field */ + u32 nHdr; /* Size of the header in the record */ + u32 iHdr; /* Next unread header byte */ + i64 iField; /* Next unread data byte */ + u32 szField = 0; /* Size of the current data field */ int i; /* Column index */ u8 *a = (u8*)pRec; /* Typecast byte array */ Mem *pMem = *ppVal; /* Write result into this Mem object */ assert( iCol>0 ); iHdr = getVarint32(a, nHdr); - if( nHdr>nRec || iHdr>=nHdr ) return SQLITE_CORRUPT_BKPT; + if( nHdr>(u32)nRec || iHdr>=nHdr ) return SQLITE_CORRUPT_BKPT; iField = nHdr; for(i=0; i<=iCol; i++){ iHdr += getVarint32(&a[iHdr], t); @@ -83922,10 +85048,11 @@ static int growOpArray(Vdbe *v, int nOp){ ** sqlite3CantopenError(lineno) */ static void test_addop_breakpoint(int pc, Op *pOp){ - static int n = 0; + static u64 n = 0; (void)pc; (void)pOp; n++; + if( n==LARGEST_UINT64 ) abort(); /* so that n is used, preventing a warning */ } #endif @@ -84649,6 +85776,15 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){ assert( aLabel!=0 ); /* True because of tag-20230419-1 */ pOp->p2 = aLabel[ADDR(pOp->p2)]; } + + /* OPFLG_JUMP opcodes never have P2==0, though OPFLG_JUMP0 opcodes + ** might */ + assert( pOp->p2>0 + || (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP0)!=0 ); + + /* Jumps never go off the end of the bytecode array */ + assert( pOp->p2nOp + || (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP)==0 ); break; } } @@ -84713,6 +85849,10 @@ SQLITE_PRIVATE void sqlite3VdbeNoJumpsOutsideSubrtn( int iDest = pOp->p2; /* Jump destination */ if( iDest==0 ) continue; if( pOp->opcode==OP_Gosub ) continue; + if( pOp->p3==20230325 && pOp->opcode==OP_NotNull ){ + /* This is a deliberately taken illegal branch. tag-20230325-2 */ + continue; + } if( iDest<0 ){ int j = ADDR(iDest); assert( j>=0 ); @@ -85106,6 +86246,10 @@ static void freeP4(sqlite3 *db, int p4type, void *p4){ if( db->pnBytesFreed==0 ) sqlite3VtabUnlock((VTable *)p4); break; } + case P4_TABLEREF: { + if( db->pnBytesFreed==0 ) sqlite3DeleteTable(db, (Table*)p4); + break; + } } } @@ -85233,7 +86377,7 @@ static void SQLITE_NOINLINE vdbeChangeP4Full( int n ){ if( pOp->p4type ){ - freeP4(p->db, pOp->p4type, pOp->p4.p); + assert( pOp->p4type > P4_FREE_IF_LE ); pOp->p4type = 0; pOp->p4.p = 0; } @@ -87048,7 +88192,7 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ /* Check for immediate foreign key violations. */ if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){ - sqlite3VdbeCheckFk(p, 0); + (void)sqlite3VdbeCheckFk(p, 0); } /* If the auto-commit flag is set and this is the only active writer @@ -87762,6 +88906,23 @@ static void serialGet( pMem->flags = IsNaN(x) ? MEM_Null : MEM_Real; } } +static int serialGet7( + const unsigned char *buf, /* Buffer to deserialize from */ + Mem *pMem /* Memory cell to write value into */ +){ + u64 x = FOUR_BYTE_UINT(buf); + u32 y = FOUR_BYTE_UINT(buf+4); + x = (x<<32) + y; + assert( sizeof(x)==8 && sizeof(pMem->u.r)==8 ); + swapMixedEndianFloat(x); + memcpy(&pMem->u.r, &x, sizeof(x)); + if( IsNaN(x) ){ + pMem->flags = MEM_Null; + return 1; + } + pMem->flags = MEM_Real; + return 0; +} SQLITE_PRIVATE void sqlite3VdbeSerialGet( const unsigned char *buf, /* Buffer to deserialize from */ u32 serial_type, /* Serial type to deserialize */ @@ -88172,32 +89333,44 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3BlobCompare(const Mem *pB1, const Mem return n1 - n2; } +/* The following two functions are used only within testcase() to prove +** test coverage. These functions do no exist for production builds. +** We must use separate SQLITE_NOINLINE functions here, since otherwise +** optimizer code movement causes gcov to become very confused. +*/ +#if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_DEBUG) +static int SQLITE_NOINLINE doubleLt(double a, double b){ return a8 ){ + if( sqlite3IsNaN(r) ){ + /* SQLite considers NaN to be a NULL. And all integer values are greater + ** than NULL */ + return 1; + } + if( sqlite3Config.bUseLongDouble ){ LONGDOUBLE_TYPE x = (LONGDOUBLE_TYPE)i; testcase( xr ); testcase( x==r ); - if( xr ) return +1; /*NO_TEST*/ /* work around bugs in gcov */ - return 0; /*NO_TEST*/ /* work around bugs in gcov */ + return (xr); }else{ i64 y; - double s; if( r<-9223372036854775808.0 ) return +1; if( r>=9223372036854775808.0 ) return -1; y = (i64)r; if( iy ) return +1; - s = (double)i; - if( sr ) return +1; - return 0; + testcase( doubleLt(((double)i),r) ); + testcase( doubleLt(r,((double)i)) ); + testcase( doubleEq(r,((double)i)) ); + return (((double)i)r); } } @@ -88427,7 +89600,7 @@ SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip( }else if( serial_type==0 ){ rc = -1; }else if( serial_type==7 ){ - sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1); + serialGet7(&aKey1[d1], &mem1); rc = -sqlite3IntFloatCompare(pRhs->u.i, mem1.u.r); }else{ i64 lhs = vdbeRecordDecodeInt(serial_type, &aKey1[d1]); @@ -88452,14 +89625,18 @@ SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip( }else if( serial_type==0 ){ rc = -1; }else{ - sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1); if( serial_type==7 ){ - if( mem1.u.ru.r ){ + if( serialGet7(&aKey1[d1], &mem1) ){ + rc = -1; /* mem1 is a NaN */ + }else if( mem1.u.ru.r ){ rc = -1; }else if( mem1.u.r>pRhs->u.r ){ rc = +1; + }else{ + assert( rc==0 ); } }else{ + sqlite3VdbeSerialGet(&aKey1[d1], serial_type, &mem1); rc = sqlite3IntFloatCompare(mem1.u.i, pRhs->u.r); } } @@ -88529,7 +89706,14 @@ SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip( /* RHS is null */ else{ serial_type = aKey1[idx1]; - rc = (serial_type!=0 && serial_type!=10); + if( serial_type==0 + || serial_type==10 + || (serial_type==7 && serialGet7(&aKey1[d1], &mem1)!=0) + ){ + assert( rc==0 ); + }else{ + rc = 1; + } } if( rc!=0 ){ @@ -89342,7 +90526,15 @@ SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt *pStmt){ int rc = SQLITE_OK; Vdbe *p = (Vdbe*)pStmt; #if SQLITE_THREADSAFE - sqlite3_mutex *mutex = ((Vdbe*)pStmt)->db->mutex; + sqlite3_mutex *mutex; +#endif +#ifdef SQLITE_ENABLE_API_ARMOR + if( pStmt==0 ){ + return SQLITE_MISUSE_BKPT; + } +#endif +#if SQLITE_THREADSAFE + mutex = p->db->mutex; #endif sqlite3_mutex_enter(mutex); for(i=0; inVar; i++){ @@ -89565,7 +90757,7 @@ SQLITE_API void sqlite3_value_free(sqlite3_value *pOld){ ** is too big or if an OOM occurs. ** ** The invokeValueDestructor(P,X) routine invokes destructor function X() -** on value P is not going to be used and need to be destroyed. +** on value P if P is not going to be used and need to be destroyed. */ static void setResultStrOrError( sqlite3_context *pCtx, /* Function context */ @@ -89595,7 +90787,7 @@ static void setResultStrOrError( static int invokeValueDestructor( const void *p, /* Value to destroy */ void (*xDel)(void*), /* The destructor */ - sqlite3_context *pCtx /* Set a SQLITE_TOOBIG error if no NULL */ + sqlite3_context *pCtx /* Set a SQLITE_TOOBIG error if not NULL */ ){ assert( xDel!=SQLITE_DYNAMIC ); if( xDel==0 ){ @@ -89605,7 +90797,14 @@ static int invokeValueDestructor( }else{ xDel((void*)p); } +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx!=0 ){ + sqlite3_result_error_toobig(pCtx); + } +#else + assert( pCtx!=0 ); sqlite3_result_error_toobig(pCtx); +#endif return SQLITE_TOOBIG; } SQLITE_API void sqlite3_result_blob( @@ -89614,6 +90813,12 @@ SQLITE_API void sqlite3_result_blob( int n, void (*xDel)(void *) ){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 || n<0 ){ + invokeValueDestructor(z, xDel, pCtx); + return; + } +#endif assert( n>=0 ); assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); setResultStrOrError(pCtx, z, n, 0, xDel); @@ -89624,8 +90829,14 @@ SQLITE_API void sqlite3_result_blob64( sqlite3_uint64 n, void (*xDel)(void *) ){ - assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); assert( xDel!=SQLITE_DYNAMIC ); +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ){ + invokeValueDestructor(z, xDel, 0); + return; + } +#endif + assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); if( n>0x7fffffff ){ (void)invokeValueDestructor(z, xDel, pCtx); }else{ @@ -89633,30 +90844,48 @@ SQLITE_API void sqlite3_result_blob64( } } SQLITE_API void sqlite3_result_double(sqlite3_context *pCtx, double rVal){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); sqlite3VdbeMemSetDouble(pCtx->pOut, rVal); } SQLITE_API void sqlite3_result_error(sqlite3_context *pCtx, const char *z, int n){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); pCtx->isError = SQLITE_ERROR; sqlite3VdbeMemSetStr(pCtx->pOut, z, n, SQLITE_UTF8, SQLITE_TRANSIENT); } #ifndef SQLITE_OMIT_UTF16 SQLITE_API void sqlite3_result_error16(sqlite3_context *pCtx, const void *z, int n){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); pCtx->isError = SQLITE_ERROR; sqlite3VdbeMemSetStr(pCtx->pOut, z, n, SQLITE_UTF16NATIVE, SQLITE_TRANSIENT); } #endif SQLITE_API void sqlite3_result_int(sqlite3_context *pCtx, int iVal){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); sqlite3VdbeMemSetInt64(pCtx->pOut, (i64)iVal); } SQLITE_API void sqlite3_result_int64(sqlite3_context *pCtx, i64 iVal){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); sqlite3VdbeMemSetInt64(pCtx->pOut, iVal); } SQLITE_API void sqlite3_result_null(sqlite3_context *pCtx){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); sqlite3VdbeMemSetNull(pCtx->pOut); } @@ -89666,14 +90895,37 @@ SQLITE_API void sqlite3_result_pointer( const char *zPType, void (*xDestructor)(void*) ){ - Mem *pOut = pCtx->pOut; + Mem *pOut; +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ){ + invokeValueDestructor(pPtr, xDestructor, 0); + return; + } +#endif + pOut = pCtx->pOut; assert( sqlite3_mutex_held(pOut->db->mutex) ); sqlite3VdbeMemRelease(pOut); pOut->flags = MEM_Null; sqlite3VdbeMemSetPointer(pOut, pPtr, zPType, xDestructor); } SQLITE_API void sqlite3_result_subtype(sqlite3_context *pCtx, unsigned int eSubtype){ - Mem *pOut = pCtx->pOut; + Mem *pOut; +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif +#if defined(SQLITE_STRICT_SUBTYPE) && SQLITE_STRICT_SUBTYPE+0!=0 + if( pCtx->pFunc!=0 + && (pCtx->pFunc->funcFlags & SQLITE_RESULT_SUBTYPE)==0 + ){ + char zErr[200]; + sqlite3_snprintf(sizeof(zErr), zErr, + "misuse of sqlite3_result_subtype() by %s()", + pCtx->pFunc->zName); + sqlite3_result_error(pCtx, zErr, -1); + return; + } +#endif /* SQLITE_STRICT_SUBTYPE */ + pOut = pCtx->pOut; assert( sqlite3_mutex_held(pOut->db->mutex) ); pOut->eSubtype = eSubtype & 0xff; pOut->flags |= MEM_Subtype; @@ -89684,6 +90936,12 @@ SQLITE_API void sqlite3_result_text( int n, void (*xDel)(void *) ){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ){ + invokeValueDestructor(z, xDel, 0); + return; + } +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); setResultStrOrError(pCtx, z, n, SQLITE_UTF8, xDel); } @@ -89694,6 +90952,12 @@ SQLITE_API void sqlite3_result_text64( void (*xDel)(void *), unsigned char enc ){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ){ + invokeValueDestructor(z, xDel, 0); + return; + } +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); assert( xDel!=SQLITE_DYNAMIC ); if( enc!=SQLITE_UTF8 ){ @@ -89737,7 +91001,16 @@ SQLITE_API void sqlite3_result_text16le( } #endif /* SQLITE_OMIT_UTF16 */ SQLITE_API void sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){ - Mem *pOut = pCtx->pOut; + Mem *pOut; + +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; + if( pValue==0 ){ + sqlite3_result_null(pCtx); + return; + } +#endif + pOut = pCtx->pOut; assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); sqlite3VdbeMemCopy(pOut, pValue); sqlite3VdbeChangeEncoding(pOut, pCtx->enc); @@ -89749,7 +91022,12 @@ SQLITE_API void sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){ sqlite3_result_zeroblob64(pCtx, n>0 ? n : 0); } SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context *pCtx, u64 n){ - Mem *pOut = pCtx->pOut; + Mem *pOut; + +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return SQLITE_MISUSE_BKPT; +#endif + pOut = pCtx->pOut; assert( sqlite3_mutex_held(pOut->db->mutex) ); if( n>(u64)pOut->db->aLimit[SQLITE_LIMIT_LENGTH] ){ sqlite3_result_error_toobig(pCtx); @@ -89763,6 +91041,9 @@ SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context *pCtx, u64 n){ #endif } SQLITE_API void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif pCtx->isError = errCode ? errCode : -1; #ifdef SQLITE_DEBUG if( pCtx->pVdbe ) pCtx->pVdbe->rcApp = errCode; @@ -89775,6 +91056,9 @@ SQLITE_API void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){ /* Force an SQLITE_TOOBIG error. */ SQLITE_API void sqlite3_result_error_toobig(sqlite3_context *pCtx){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); pCtx->isError = SQLITE_TOOBIG; sqlite3VdbeMemSetStr(pCtx->pOut, "string or blob too big", -1, @@ -89783,6 +91067,9 @@ SQLITE_API void sqlite3_result_error_toobig(sqlite3_context *pCtx){ /* An SQLITE_NOMEM error. */ SQLITE_API void sqlite3_result_error_nomem(sqlite3_context *pCtx){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); sqlite3VdbeMemSetNull(pCtx->pOut); pCtx->isError = SQLITE_NOMEM_BKPT; @@ -90035,6 +91322,9 @@ SQLITE_API int sqlite3_step(sqlite3_stmt *pStmt){ ** pointer to it. */ SQLITE_API void *sqlite3_user_data(sqlite3_context *p){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( p==0 ) return 0; +#endif assert( p && p->pFunc ); return p->pFunc->pUserData; } @@ -90050,7 +91340,11 @@ SQLITE_API void *sqlite3_user_data(sqlite3_context *p){ ** application defined function. */ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context *p){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( p==0 ) return 0; +#else assert( p && p->pOut ); +#endif return p->pOut->db; } @@ -90069,7 +91363,11 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context *p){ ** value, as a signal to the xUpdate routine that the column is unchanged. */ SQLITE_API int sqlite3_vtab_nochange(sqlite3_context *p){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( p==0 ) return 0; +#else assert( p ); +#endif return sqlite3_value_nochange(p->pOut); } @@ -90097,7 +91395,7 @@ static int valueFromValueList( ValueList *pRhs; *ppOut = 0; - if( pVal==0 ) return SQLITE_MISUSE; + if( pVal==0 ) return SQLITE_MISUSE_BKPT; if( (pVal->flags & MEM_Dyn)==0 || pVal->xDel!=sqlite3VdbeValueListFree ){ return SQLITE_ERROR; }else{ @@ -90228,6 +91526,9 @@ SQLITE_API void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){ SQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){ AuxData *pAuxData; +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return 0; +#endif assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); #if SQLITE_ENABLE_STAT4 if( pCtx->pVdbe==0 ) return 0; @@ -90260,8 +91561,12 @@ SQLITE_API void sqlite3_set_auxdata( void (*xDelete)(void*) ){ AuxData *pAuxData; - Vdbe *pVdbe = pCtx->pVdbe; + Vdbe *pVdbe; +#ifdef SQLITE_ENABLE_API_ARMOR + if( pCtx==0 ) return; +#endif + pVdbe= pCtx->pVdbe; assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); #ifdef SQLITE_ENABLE_STAT4 if( pVdbe==0 ) goto failed; @@ -90698,7 +92003,7 @@ static int vdbeUnbind(Vdbe *p, unsigned int i){ } sqlite3_mutex_enter(p->db->mutex); if( p->eVdbeState!=VDBE_READY_STATE ){ - sqlite3Error(p->db, SQLITE_MISUSE); + sqlite3Error(p->db, SQLITE_MISUSE_BKPT); sqlite3_mutex_leave(p->db->mutex); sqlite3_log(SQLITE_MISUSE, "bind on a busy prepared statement: [%s]", p->zSql); @@ -90927,6 +92232,9 @@ SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt *pStmt, int i, int n){ SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt *pStmt, int i, sqlite3_uint64 n){ int rc; Vdbe *p = (Vdbe *)pStmt; +#ifdef SQLITE_ENABLE_API_ARMOR + if( p==0 ) return SQLITE_MISUSE_BKPT; +#endif sqlite3_mutex_enter(p->db->mutex); if( n>(u64)p->db->aLimit[SQLITE_LIMIT_LENGTH] ){ rc = SQLITE_TOOBIG; @@ -91053,6 +92361,9 @@ SQLITE_API int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt){ SQLITE_API int sqlite3_stmt_explain(sqlite3_stmt *pStmt, int eMode){ Vdbe *v = (Vdbe*)pStmt; int rc; +#ifdef SQLITE_ENABLE_API_ARMOR + if( pStmt==0 ) return SQLITE_MISUSE_BKPT; +#endif sqlite3_mutex_enter(v->db->mutex); if( ((int)v->explain)==eMode ){ rc = SQLITE_OK; @@ -91219,10 +92530,16 @@ static UnpackedRecord *vdbeUnpackRecord( ** a field of the row currently being updated or deleted. */ SQLITE_API int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppValue){ - PreUpdate *p = db->pPreUpdate; + PreUpdate *p; Mem *pMem; int rc = SQLITE_OK; +#ifdef SQLITE_ENABLE_API_ARMOR + if( db==0 || ppValue==0 ){ + return SQLITE_MISUSE_BKPT; + } +#endif + p = db->pPreUpdate; /* Test that this call is being made from within an SQLITE_DELETE or ** SQLITE_UPDATE pre-update callback, and that iIdx is within range. */ if( !p || p->op==SQLITE_INSERT ){ @@ -91283,7 +92600,12 @@ SQLITE_API int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppVa ** the number of columns in the row being updated, deleted or inserted. */ SQLITE_API int sqlite3_preupdate_count(sqlite3 *db){ - PreUpdate *p = db->pPreUpdate; + PreUpdate *p; +#ifdef SQLITE_ENABLE_API_ARMOR + p = db!=0 ? db->pPreUpdate : 0; +#else + p = db->pPreUpdate; +#endif return (p ? p->keyinfo.nKeyField : 0); } #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */ @@ -91301,7 +92623,12 @@ SQLITE_API int sqlite3_preupdate_count(sqlite3 *db){ ** or SET DEFAULT action is considered a trigger. */ SQLITE_API int sqlite3_preupdate_depth(sqlite3 *db){ - PreUpdate *p = db->pPreUpdate; + PreUpdate *p; +#ifdef SQLITE_ENABLE_API_ARMOR + p = db!=0 ? db->pPreUpdate : 0; +#else + p = db->pPreUpdate; +#endif return (p ? p->v->nFrame : 0); } #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */ @@ -91312,7 +92639,12 @@ SQLITE_API int sqlite3_preupdate_depth(sqlite3 *db){ ** only. */ SQLITE_API int sqlite3_preupdate_blobwrite(sqlite3 *db){ - PreUpdate *p = db->pPreUpdate; + PreUpdate *p; +#ifdef SQLITE_ENABLE_API_ARMOR + p = db!=0 ? db->pPreUpdate : 0; +#else + p = db->pPreUpdate; +#endif return (p ? p->iBlobWrite : -1); } #endif @@ -91323,10 +92655,16 @@ SQLITE_API int sqlite3_preupdate_blobwrite(sqlite3 *db){ ** a field of the row currently being updated or inserted. */ SQLITE_API int sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_value **ppValue){ - PreUpdate *p = db->pPreUpdate; + PreUpdate *p; int rc = SQLITE_OK; Mem *pMem; +#ifdef SQLITE_ENABLE_API_ARMOR + if( db==0 || ppValue==0 ){ + return SQLITE_MISUSE_BKPT; + } +#endif + p = db->pPreUpdate; if( !p || p->op==SQLITE_DELETE ){ rc = SQLITE_MISUSE_BKPT; goto preupdate_new_out; @@ -91405,11 +92743,20 @@ SQLITE_API int sqlite3_stmt_scanstatus_v2( void *pOut /* OUT: Write the answer here */ ){ Vdbe *p = (Vdbe*)pStmt; - VdbeOp *aOp = p->aOp; - int nOp = p->nOp; + VdbeOp *aOp; + int nOp; ScanStatus *pScan = 0; int idx; +#ifdef SQLITE_ENABLE_API_ARMOR + if( p==0 || pOut==0 + || iScanStatusOpSQLITE_SCANSTAT_NCYCLE ){ + return 1; + } +#endif + aOp = p->aOp; + nOp = p->nOp; if( p->pFrame ){ VdbeFrame *pFrame; for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent); @@ -91431,7 +92778,6 @@ SQLITE_API int sqlite3_stmt_scanstatus_v2( } if( flags & SQLITE_SCANSTAT_COMPLEX ){ idx = iScan; - pScan = &p->aScan[idx]; }else{ /* If the COMPLEX flag is clear, then this function must ignore any ** ScanStatus structures with ScanStatus.addrLoop set to 0. */ @@ -91444,6 +92790,8 @@ SQLITE_API int sqlite3_stmt_scanstatus_v2( } } if( idx>=p->nScan ) return 1; + assert( pScan==0 || pScan==&p->aScan[idx] ); + pScan = &p->aScan[idx]; switch( iScanStatusOp ){ case SQLITE_SCANSTAT_NLOOP: { @@ -91556,7 +92904,7 @@ SQLITE_API int sqlite3_stmt_scanstatus( SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt *pStmt){ Vdbe *p = (Vdbe*)pStmt; int ii; - for(ii=0; iinOp; ii++){ + for(ii=0; p!=0 && iinOp; ii++){ Op *pOp = &p->aOp[ii]; pOp->nExec = 0; pOp->nCycle = 0; @@ -91895,11 +93243,12 @@ SQLITE_API int sqlite3_found_count = 0; ** sqlite3CantopenError(lineno) */ static void test_trace_breakpoint(int pc, Op *pOp, Vdbe *v){ - static int n = 0; + static u64 n = 0; (void)pc; (void)pOp; (void)v; n++; + if( n==LARGEST_UINT64 ) abort(); /* So that n is used, preventing a warning */ } #endif @@ -92525,11 +93874,11 @@ static SQLITE_NOINLINE int vdbeColumnFromOverflow( sqlite3RCStrRef(pBuf); if( t&1 ){ rc = sqlite3VdbeMemSetStr(pDest, pBuf, len, encoding, - (void(*)(void*))sqlite3RCStrUnref); + sqlite3RCStrUnref); pDest->flags |= MEM_Term; }else{ rc = sqlite3VdbeMemSetStr(pDest, pBuf, len, 0, - (void(*)(void*))sqlite3RCStrUnref); + sqlite3RCStrUnref); } }else{ rc = sqlite3VdbeMemFromBtree(pC->uc.pCursor, iOffset, len, pDest); @@ -92891,7 +94240,7 @@ case OP_Return: { /* in1 */ ** ** See also: EndCoroutine */ -case OP_InitCoroutine: { /* jump */ +case OP_InitCoroutine: { /* jump0 */ assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) ); assert( pOp->p2>=0 && pOp->p2nOp ); assert( pOp->p3>=0 && pOp->p3nOp ); @@ -92914,7 +94263,9 @@ case OP_InitCoroutine: { /* jump */ ** ** The instruction at the address in register P1 is a Yield. ** Jump to the P2 parameter of that Yield. -** After the jump, register P1 becomes undefined. +** After the jump, the value register P1 is left with a value +** such that subsequent OP_Yields go back to the this same +** OP_EndCoroutine instruction. ** ** See also: InitCoroutine */ @@ -92926,8 +94277,8 @@ case OP_EndCoroutine: { /* in1 */ pCaller = &aOp[pIn1->u.i]; assert( pCaller->opcode==OP_Yield ); assert( pCaller->p2>=0 && pCaller->p2nOp ); + pIn1->u.i = (int)(pOp - p->aOp) - 1; pOp = &aOp[pCaller->p2 - 1]; - pIn1->flags = MEM_Undefined; break; } @@ -92944,7 +94295,7 @@ case OP_EndCoroutine: { /* in1 */ ** ** See also: InitCoroutine */ -case OP_Yield: { /* in1, jump */ +case OP_Yield: { /* in1, jump0 */ int pcDest; pIn1 = &aMem[pOp->p1]; assert( VdbeMemDynamic(pIn1)==0 ); @@ -93274,19 +94625,15 @@ case OP_Blob: { /* out2 */ break; } -/* Opcode: Variable P1 P2 * P4 * -** Synopsis: r[P2]=parameter(P1,P4) +/* Opcode: Variable P1 P2 * * * +** Synopsis: r[P2]=parameter(P1) ** ** Transfer the values of bound parameter P1 into register P2 -** -** If the parameter is named, then its name appears in P4. -** The P4 value is used by sqlite3_bind_parameter_name(). */ case OP_Variable: { /* out2 */ Mem *pVar; /* Value being transferred */ assert( pOp->p1>0 && pOp->p1<=p->nVar ); - assert( pOp->p4.z==0 || pOp->p4.z==sqlite3VListNumToName(p->pVList,pOp->p1) ); pVar = &p->aVar[pOp->p1 - 1]; if( sqlite3VdbeMemTooBig(pVar) ){ goto too_big; @@ -93796,7 +95143,7 @@ case OP_AddImm: { /* in1 */ pIn1 = &aMem[pOp->p1]; memAboutToChange(p, pIn1); sqlite3VdbeMemIntegerify(pIn1); - pIn1->u.i += pOp->p2; + *(u64*)&pIn1->u.i += (u64)pOp->p2; break; } @@ -93807,7 +95154,7 @@ case OP_AddImm: { /* in1 */ ** without data loss, then jump immediately to P2, or if P2==0 ** raise an SQLITE_MISMATCH exception. */ -case OP_MustBeInt: { /* jump, in1 */ +case OP_MustBeInt: { /* jump0, in1 */ pIn1 = &aMem[pOp->p1]; if( (pIn1->flags & MEM_Int)==0 ){ applyAffinity(pIn1, SQLITE_AFF_NUMERIC, encoding); @@ -93848,7 +95195,7 @@ case OP_RealAffinity: { /* in1 */ } #endif -#ifndef SQLITE_OMIT_CAST +#if !defined(SQLITE_OMIT_CAST) && !defined(SQLITE_OMIT_ANALYZE) /* Opcode: Cast P1 P2 * * * ** Synopsis: affinity(r[P1]) ** @@ -94063,7 +95410,9 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */ } } }else if( affinity==SQLITE_AFF_TEXT && ((flags1 | flags3) & MEM_Str)!=0 ){ - if( (flags1 & MEM_Str)==0 && (flags1&(MEM_Int|MEM_Real|MEM_IntReal))!=0 ){ + if( (flags1 & MEM_Str)!=0 ){ + pIn1->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal); + }else if( (flags1&(MEM_Int|MEM_Real|MEM_IntReal))!=0 ){ testcase( pIn1->flags & MEM_Int ); testcase( pIn1->flags & MEM_Real ); testcase( pIn1->flags & MEM_IntReal ); @@ -94072,7 +95421,9 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */ flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask); if( NEVER(pIn1==pIn3) ) flags3 = flags1 | MEM_Str; } - if( (flags3 & MEM_Str)==0 && (flags3&(MEM_Int|MEM_Real|MEM_IntReal))!=0 ){ + if( (flags3 & MEM_Str)!=0 ){ + pIn3->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal); + }else if( (flags3&(MEM_Int|MEM_Real|MEM_IntReal))!=0 ){ testcase( pIn3->flags & MEM_Int ); testcase( pIn3->flags & MEM_Real ); testcase( pIn3->flags & MEM_IntReal ); @@ -95404,7 +96755,6 @@ case OP_MakeRecord: { /* NULL value. No change in zPayload */ }else{ u64 v; - u32 i; if( serial_type==7 ){ assert( sizeof(v)==sizeof(pRec->u.r) ); memcpy(&v, &pRec->u.r, sizeof(v)); @@ -95412,12 +96762,22 @@ case OP_MakeRecord: { }else{ v = pRec->u.i; } - len = i = sqlite3SmallTypeSizes[serial_type]; - assert( i>0 ); - while( 1 /*exit-by-break*/ ){ - zPayload[--i] = (u8)(v&0xFF); - if( i==0 ) break; - v >>= 8; + len = sqlite3SmallTypeSizes[serial_type]; + assert( len>=1 && len<=8 && len!=5 && len!=7 ); + switch( len ){ + default: zPayload[7] = (u8)(v&0xff); v >>= 8; + zPayload[6] = (u8)(v&0xff); v >>= 8; + /* no break */ deliberate_fall_through + case 6: zPayload[5] = (u8)(v&0xff); v >>= 8; + zPayload[4] = (u8)(v&0xff); v >>= 8; + /* no break */ deliberate_fall_through + case 4: zPayload[3] = (u8)(v&0xff); v >>= 8; + /* no break */ deliberate_fall_through + case 3: zPayload[2] = (u8)(v&0xff); v >>= 8; + /* no break */ deliberate_fall_through + case 2: zPayload[1] = (u8)(v&0xff); v >>= 8; + /* no break */ deliberate_fall_through + case 1: zPayload[0] = (u8)(v&0xff); } zPayload += len; } @@ -96335,7 +97695,8 @@ case OP_SequenceTest: { ** is the only cursor opcode that works with a pseudo-table. ** ** P3 is the number of fields in the records that will be stored by -** the pseudo-table. +** the pseudo-table. If P2 is 0 or negative then the pseudo-cursor +** will return NULL for every column. */ case OP_OpenPseudo: { VdbeCursor *pCx; @@ -96478,10 +97839,10 @@ case OP_ColumnsUsed: { ** ** See also: Found, NotFound, SeekGt, SeekGe, SeekLt */ -case OP_SeekLT: /* jump, in3, group, ncycle */ -case OP_SeekLE: /* jump, in3, group, ncycle */ -case OP_SeekGE: /* jump, in3, group, ncycle */ -case OP_SeekGT: { /* jump, in3, group, ncycle */ +case OP_SeekLT: /* jump0, in3, group, ncycle */ +case OP_SeekLE: /* jump0, in3, group, ncycle */ +case OP_SeekGE: /* jump0, in3, group, ncycle */ +case OP_SeekGT: { /* jump0, in3, group, ncycle */ int res; /* Comparison result */ int oc; /* Opcode */ VdbeCursor *pC; /* The cursor to seek */ @@ -97148,7 +98509,7 @@ case OP_Found: { /* jump, in3, ncycle */ ** ** See also: Found, NotFound, NoConflict, SeekRowid */ -case OP_SeekRowid: { /* jump, in3, ncycle */ +case OP_SeekRowid: { /* jump0, in3, ncycle */ VdbeCursor *pC; BtCursor *pCrsr; int res; @@ -97534,8 +98895,13 @@ case OP_RowCell: { ** the "primary" delete. The others are all on OPFLAG_FORDELETE ** cursors or else are marked with the AUXDELETE flag. ** -** If the OPFLAG_NCHANGE flag of P2 (NB: P2 not P5) is set, then the row -** change count is incremented (otherwise not). +** If the OPFLAG_NCHANGE (0x01) flag of P2 (NB: P2 not P5) is set, then +** the row change count is incremented (otherwise not). +** +** If the OPFLAG_ISNOOP (0x40) flag of P2 (not P5!) is set, then the +** pre-update-hook for deletes is run, but the btree is otherwise unchanged. +** This happens when the OP_Delete is to be shortly followed by an OP_Insert +** with the same key, causing the btree entry to be overwritten. ** ** P1 must not be pseudo-table. It has to be a real table with ** multiple rows. @@ -97902,7 +99268,7 @@ case OP_NullRow: { ** configured to use Prev, not Next. */ case OP_SeekEnd: /* ncycle */ -case OP_Last: { /* jump, ncycle */ +case OP_Last: { /* jump0, ncycle */ VdbeCursor *pC; BtCursor *pCrsr; int res; @@ -97936,28 +99302,38 @@ case OP_Last: { /* jump, ncycle */ break; } -/* Opcode: IfSmaller P1 P2 P3 * * +/* Opcode: IfSizeBetween P1 P2 P3 P4 * ** -** Estimate the number of rows in the table P1. Jump to P2 if that -** estimate is less than approximately 2**(0.1*P3). +** Let N be the approximate number of rows in the table or index +** with cursor P1 and let X be 10*log2(N) if N is positive or -1 +** if N is zero. +** +** Jump to P2 if X is in between P3 and P4, inclusive. */ -case OP_IfSmaller: { /* jump */ +case OP_IfSizeBetween: { /* jump */ VdbeCursor *pC; BtCursor *pCrsr; int res; i64 sz; assert( pOp->p1>=0 && pOp->p1nCursor ); + assert( pOp->p4type==P4_INT32 ); + assert( pOp->p3>=-1 && pOp->p3<=640*2 ); + assert( pOp->p4.i>=-1 && pOp->p4.i<=640*2 ); pC = p->apCsr[pOp->p1]; assert( pC!=0 ); pCrsr = pC->uc.pCursor; assert( pCrsr ); rc = sqlite3BtreeFirst(pCrsr, &res); if( rc ) goto abort_due_to_error; - if( res==0 ){ + if( res!=0 ){ + sz = -1; /* -Infinity encoding */ + }else{ sz = sqlite3BtreeRowCountEst(pCrsr); - if( ALWAYS(sz>=0) && sqlite3LogEst((u64)sz)p3 ) res = 1; + assert( sz>0 ); + sz = sqlite3LogEst((u64)sz); } + res = sz>=pOp->p3 && sz<=pOp->p4.i; VdbeBranchTaken(res!=0,2); if( res ) goto jump_to_p2; break; @@ -98010,7 +99386,7 @@ case OP_Sort: { /* jump ncycle */ ** from the beginning toward the end. In other words, the cursor is ** configured to use Next, not Prev. */ -case OP_Rewind: { /* jump, ncycle */ +case OP_Rewind: { /* jump0, ncycle */ VdbeCursor *pC; BtCursor *pCrsr; int res; @@ -98657,16 +100033,57 @@ case OP_CreateBtree: { /* out2 */ break; } -/* Opcode: SqlExec * * * P4 * +/* Opcode: SqlExec P1 P2 * P4 * ** ** Run the SQL statement or statements specified in the P4 string. +** +** The P1 parameter is a bitmask of options: +** +** 0x0001 Disable Auth and Trace callbacks while the statements +** in P4 are running. +** +** 0x0002 Set db->nAnalysisLimit to P2 while the statements in +** P4 are running. +** */ case OP_SqlExec: { + char *zErr; +#ifndef SQLITE_OMIT_AUTHORIZATION + sqlite3_xauth xAuth; +#endif + u8 mTrace; + int savedAnalysisLimit; + sqlite3VdbeIncrWriteCounter(p, 0); db->nSqlExec++; - rc = sqlite3_exec(db, pOp->p4.z, 0, 0, 0); + zErr = 0; +#ifndef SQLITE_OMIT_AUTHORIZATION + xAuth = db->xAuth; +#endif + mTrace = db->mTrace; + savedAnalysisLimit = db->nAnalysisLimit; + if( pOp->p1 & 0x0001 ){ +#ifndef SQLITE_OMIT_AUTHORIZATION + db->xAuth = 0; +#endif + db->mTrace = 0; + } + if( pOp->p1 & 0x0002 ){ + db->nAnalysisLimit = pOp->p2; + } + rc = sqlite3_exec(db, pOp->p4.z, 0, 0, &zErr); db->nSqlExec--; - if( rc ) goto abort_due_to_error; +#ifndef SQLITE_OMIT_AUTHORIZATION + db->xAuth = xAuth; +#endif + db->mTrace = mTrace; + db->nAnalysisLimit = savedAnalysisLimit; + if( zErr || rc ){ + sqlite3VdbeError(p, "%s", zErr); + sqlite3_free(zErr); + if( rc==SQLITE_NOMEM ) goto no_mem; + goto abort_due_to_error; + } break; } @@ -98812,11 +100229,11 @@ case OP_DropTrigger: { /* Opcode: IntegrityCk P1 P2 P3 P4 P5 ** ** Do an analysis of the currently open database. Store in -** register P1 the text of an error message describing any problems. -** If no problems are found, store a NULL in register P1. +** register (P1+1) the text of an error message describing any problems. +** If no problems are found, store a NULL in register (P1+1). ** -** The register P3 contains one less than the maximum number of allowed errors. -** At most reg(P3) errors will be reported. +** The register (P1) contains one less than the maximum number of allowed +** errors. At most reg(P1) errors will be reported. ** In other words, the analysis stops as soon as reg(P1) errors are ** seen. Reg(P1) is updated with the number of errors remaining. ** @@ -98836,19 +100253,21 @@ case OP_IntegrityCk: { Mem *pnErr; /* Register keeping track of errors remaining */ assert( p->bIsReader ); + assert( pOp->p4type==P4_INTARRAY ); nRoot = pOp->p2; aRoot = pOp->p4.ai; assert( nRoot>0 ); + assert( aRoot!=0 ); assert( aRoot[0]==(Pgno)nRoot ); - assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) ); - pnErr = &aMem[pOp->p3]; + assert( pOp->p1>0 && (pOp->p1+1)<=(p->nMem+1 - p->nCursor) ); + pnErr = &aMem[pOp->p1]; assert( (pnErr->flags & MEM_Int)!=0 ); assert( (pnErr->flags & (MEM_Str|MEM_Blob))==0 ); - pIn1 = &aMem[pOp->p1]; + pIn1 = &aMem[pOp->p1+1]; assert( pOp->p5nDb ); assert( DbMaskTest(p->btreeMask, pOp->p5) ); - rc = sqlite3BtreeIntegrityCheck(db, db->aDb[pOp->p5].pBt, &aRoot[1], nRoot, - (int)pnErr->u.i+1, &nErr, &z); + rc = sqlite3BtreeIntegrityCheck(db, db->aDb[pOp->p5].pBt, &aRoot[1], + &aMem[pOp->p3], nRoot, (int)pnErr->u.i+1, &nErr, &z); sqlite3VdbeMemSetNull(pIn1); if( nErr==0 ){ assert( z==0 ); @@ -98975,7 +100394,9 @@ case OP_RowSetTest: { /* jump, in1, in3 */ ** P1 contains the address of the memory cell that contains the first memory ** cell in an array of values used as arguments to the sub-program. P2 ** contains the address to jump to if the sub-program throws an IGNORE -** exception using the RAISE() function. Register P3 contains the address +** exception using the RAISE() function. P2 might be zero, if there is +** no possibility that an IGNORE exception will be raised. +** Register P3 contains the address ** of a memory cell in this (the parent) VM that is used to allocate the ** memory required by the sub-vdbe at runtime. ** @@ -98983,7 +100404,7 @@ case OP_RowSetTest: { /* jump, in1, in3 */ ** ** If P5 is non-zero, then recursive program invocation is enabled. */ -case OP_Program: { /* jump */ +case OP_Program: { /* jump0 */ int nMem; /* Number of memory registers for sub-program */ int nByte; /* Bytes of runtime space required for sub-program */ Mem *pRt; /* Register to allocate runtime space */ @@ -99887,6 +101308,52 @@ case OP_VOpen: { /* ncycle */ } #endif /* SQLITE_OMIT_VIRTUALTABLE */ +#ifndef SQLITE_OMIT_VIRTUALTABLE +/* Opcode: VCheck P1 P2 P3 P4 * +** +** P4 is a pointer to a Table object that is a virtual table in schema P1 +** that supports the xIntegrity() method. This opcode runs the xIntegrity() +** method for that virtual table, using P3 as the integer argument. If +** an error is reported back, the table name is prepended to the error +** message and that message is stored in P2. If no errors are seen, +** register P2 is set to NULL. +*/ +case OP_VCheck: { /* out2 */ + Table *pTab; + sqlite3_vtab *pVtab; + const sqlite3_module *pModule; + char *zErr = 0; + + pOut = &aMem[pOp->p2]; + sqlite3VdbeMemSetNull(pOut); /* Innocent until proven guilty */ + assert( pOp->p4type==P4_TABLEREF ); + pTab = pOp->p4.pTab; + assert( pTab!=0 ); + assert( pTab->nTabRef>0 ); + assert( IsVirtual(pTab) ); + if( pTab->u.vtab.p==0 ) break; + pVtab = pTab->u.vtab.p->pVtab; + assert( pVtab!=0 ); + pModule = pVtab->pModule; + assert( pModule!=0 ); + assert( pModule->iVersion>=4 ); + assert( pModule->xIntegrity!=0 ); + sqlite3VtabLock(pTab->u.vtab.p); + assert( pOp->p1>=0 && pOp->p1nDb ); + rc = pModule->xIntegrity(pVtab, db->aDb[pOp->p1].zDbSName, pTab->zName, + pOp->p3, &zErr); + sqlite3VtabUnlock(pTab->u.vtab.p); + if( rc ){ + sqlite3_free(zErr); + goto abort_due_to_error; + } + if( zErr ){ + sqlite3VdbeMemSetStr(pOut, zErr, -1, SQLITE_UTF8, sqlite3_free); + } + break; +} +#endif /* SQLITE_OMIT_VIRTUALTABLE */ + #ifndef SQLITE_OMIT_VIRTUALTABLE /* Opcode: VInitIn P1 P2 P3 * * ** Synopsis: r[P2]=ValueList(P1,P3) @@ -100000,6 +101467,7 @@ case OP_VColumn: { /* ncycle */ const sqlite3_module *pModule; Mem *pDest; sqlite3_context sContext; + FuncDef nullFunc; VdbeCursor *pCur = p->apCsr[pOp->p1]; assert( pCur!=0 ); @@ -100017,6 +101485,9 @@ case OP_VColumn: { /* ncycle */ memset(&sContext, 0, sizeof(sContext)); sContext.pOut = pDest; sContext.enc = encoding; + nullFunc.pUserData = 0; + nullFunc.funcFlags = SQLITE_RESULT_SUBTYPE; + sContext.pFunc = &nullFunc; assert( pOp->p5==OPFLAG_NOCHNG || pOp->p5==0 ); if( pOp->p5 & OPFLAG_NOCHNG ){ sqlite3VdbeMemSetNull(pDest); @@ -100349,6 +101820,42 @@ case OP_ClrSubtype: { /* in1 */ break; } +/* Opcode: GetSubtype P1 P2 * * * +** Synopsis: r[P2] = r[P1].subtype +** +** Extract the subtype value from register P1 and write that subtype +** into register P2. If P1 has no subtype, then P1 gets a NULL. +*/ +case OP_GetSubtype: { /* in1 out2 */ + pIn1 = &aMem[pOp->p1]; + pOut = &aMem[pOp->p2]; + if( pIn1->flags & MEM_Subtype ){ + sqlite3VdbeMemSetInt64(pOut, pIn1->eSubtype); + }else{ + sqlite3VdbeMemSetNull(pOut); + } + break; +} + +/* Opcode: SetSubtype P1 P2 * * * +** Synopsis: r[P2].subtype = r[P1] +** +** Set the subtype value of register P2 to the integer from register P1. +** If P1 is NULL, clear the subtype from p2. +*/ +case OP_SetSubtype: { /* in1 out2 */ + pIn1 = &aMem[pOp->p1]; + pOut = &aMem[pOp->p2]; + if( pIn1->flags & MEM_Null ){ + pOut->flags &= ~MEM_Subtype; + }else{ + assert( pIn1->flags & MEM_Int ); + pOut->flags |= MEM_Subtype; + pOut->eSubtype = (u8)(pIn1->u.i & 0xff); + } + break; +} + /* Opcode: FilterAdd P1 * P3 P4 * ** Synopsis: filter(P1) += key(P3@P4) ** @@ -100446,7 +101953,7 @@ case OP_Filter: { /* jump */ ** error is encountered. */ case OP_Trace: -case OP_Init: { /* jump */ +case OP_Init: { /* jump0 */ int i; #ifndef SQLITE_OMIT_TRACE char *zTrace; @@ -100833,8 +102340,7 @@ static int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){ /* Set the value of register r[1] in the SQL statement to integer iRow. ** This is done directly as a performance optimization */ - v->aMem[1].flags = MEM_Int; - v->aMem[1].u.i = iRow; + sqlite3VdbeMemSetInt64(&v->aMem[1], iRow); /* If the statement has been run before (and is paused at the OP_ResultRow) ** then back it up to the point where it does the OP_NotExists. This could @@ -100917,7 +102423,7 @@ SQLITE_API int sqlite3_blob_open( #endif *ppBlob = 0; #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) || zTable==0 ){ + if( !sqlite3SafetyCheckOk(db) || zTable==0 || zColumn==0 ){ return SQLITE_MISUSE_BKPT; } #endif @@ -101479,7 +102985,7 @@ struct SorterFile { struct SorterList { SorterRecord *pList; /* Linked list of records */ u8 *aMemory; /* If non-NULL, bulk memory to hold pList */ - int szPMA; /* Size of pList as PMA in bytes */ + i64 szPMA; /* Size of pList as PMA in bytes */ }; /* @@ -101588,10 +103094,10 @@ typedef int (*SorterCompare)(SortSubtask*,int*,const void*,int,const void*,int); struct SortSubtask { SQLiteThread *pThread; /* Background thread, if any */ int bDone; /* Set if thread is finished but not joined */ + int nPMA; /* Number of PMAs currently in file */ VdbeSorter *pSorter; /* Sorter that owns this sub-task */ UnpackedRecord *pUnpacked; /* Space to unpack a record */ SorterList list; /* List for thread to write to a PMA */ - int nPMA; /* Number of PMAs currently in file */ SorterCompare xCompare; /* Compare function to use */ SorterFile file; /* Temp file for level-0 PMAs */ SorterFile file2; /* Space for other PMAs */ @@ -103065,8 +104571,8 @@ SQLITE_PRIVATE int sqlite3VdbeSorterWrite( int rc = SQLITE_OK; /* Return Code */ SorterRecord *pNew; /* New list element */ int bFlush; /* True to flush contents of memory to PMA */ - int nReq; /* Bytes of memory required */ - int nPMA; /* Bytes of PMA space required */ + i64 nReq; /* Bytes of memory required */ + i64 nPMA; /* Bytes of PMA space required */ int t; /* serial type of first record field */ assert( pCsr->eCurType==CURTYPE_SORTER ); @@ -104348,10 +105854,10 @@ static int bytecodevtabColumn( #ifdef SQLITE_ENABLE_STMT_SCANSTATUS case 9: /* nexec */ - sqlite3_result_int(ctx, pOp->nExec); + sqlite3_result_int64(ctx, pOp->nExec); break; case 10: /* ncycle */ - sqlite3_result_int(ctx, pOp->nCycle); + sqlite3_result_int64(ctx, pOp->nCycle); break; #else case 9: /* nexec */ @@ -104490,7 +105996,8 @@ static sqlite3_module bytecodevtabModule = { /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0, - /* xShadowName */ 0 + /* xShadowName */ 0, + /* xIntegrity */ 0 }; @@ -105294,6 +106801,8 @@ static void resolveAlias( assert( iCol>=0 && iColnExpr ); pOrig = pEList->a[iCol].pExpr; assert( pOrig!=0 ); + assert( !ExprHasProperty(pExpr, EP_Reduced|EP_TokenOnly) ); + if( pExpr->pAggInfo ) return; db = pParse->db; pDup = sqlite3ExprDup(db, pOrig, 0); if( db->mallocFailed ){ @@ -105319,21 +106828,36 @@ static void resolveAlias( } /* -** Subqueries stores the original database, table and column names for their -** result sets in ExprList.a[].zSpan, in the form "DATABASE.TABLE.COLUMN". -** Check to see if the zSpan given to this routine matches the zDb, zTab, -** and zCol. If any of zDb, zTab, and zCol are NULL then those fields will -** match anything. +** Subqueries store the original database, table and column names for their +** result sets in ExprList.a[].zSpan, in the form "DATABASE.TABLE.COLUMN", +** and mark the expression-list item by setting ExprList.a[].fg.eEName +** to ENAME_TAB. +** +** Check to see if the zSpan/eEName of the expression-list item passed to this +** routine matches the zDb, zTab, and zCol. If any of zDb, zTab, and zCol are +** NULL then those fields will match anything. Return true if there is a match, +** or false otherwise. +** +** SF_NestedFrom subqueries also store an entry for the implicit rowid (or +** _rowid_, or oid) column by setting ExprList.a[].fg.eEName to ENAME_ROWID, +** and setting zSpan to "DATABASE.TABLE.". This type of pItem +** argument matches if zCol is a rowid alias. If it is not NULL, (*pbRowid) +** is set to 1 if there is this kind of match. */ SQLITE_PRIVATE int sqlite3MatchEName( const struct ExprList_item *pItem, const char *zCol, const char *zTab, - const char *zDb + const char *zDb, + int *pbRowid ){ int n; const char *zSpan; - if( pItem->fg.eEName!=ENAME_TAB ) return 0; + int eEName = pItem->fg.eEName; + if( eEName!=ENAME_TAB && (eEName!=ENAME_ROWID || NEVER(pbRowid==0)) ){ + return 0; + } + assert( pbRowid==0 || *pbRowid==0 ); zSpan = pItem->zEName; for(n=0; ALWAYS(zSpan[n]) && zSpan[n]!='.'; n++){} if( zDb && (sqlite3StrNICmp(zSpan, zDb, n)!=0 || zDb[n]!=0) ){ @@ -105345,9 +106869,11 @@ SQLITE_PRIVATE int sqlite3MatchEName( return 0; } zSpan += n+1; - if( zCol && sqlite3StrICmp(zSpan, zCol)!=0 ){ - return 0; + if( zCol ){ + if( eEName==ENAME_TAB && sqlite3StrICmp(zSpan, zCol)!=0 ) return 0; + if( eEName==ENAME_ROWID && sqlite3IsRowid(zCol)==0 ) return 0; } + if( eEName==ENAME_ROWID ) *pbRowid = 1; return 1; } @@ -105380,6 +106906,7 @@ SQLITE_PRIVATE Bitmask sqlite3ExprColUsed(Expr *pExpr){ assert( ExprUseYTab(pExpr) ); pExTab = pExpr->y.pTab; assert( pExTab!=0 ); + assert( n < pExTab->nCol ); if( (pExTab->tabFlags & TF_HasGenerated)!=0 && (pExTab->aCol[n].colFlags & COLFLAG_GENERATED)!=0 ){ @@ -105474,13 +107001,13 @@ static int lookupName( Parse *pParse, /* The parsing context */ const char *zDb, /* Name of the database containing table, or NULL */ const char *zTab, /* Name of table containing column, or NULL */ - const char *zCol, /* Name of the column. */ + const Expr *pRight, /* Name of the column. */ NameContext *pNC, /* The name context used to resolve the name */ Expr *pExpr /* Make this EXPR node point to the selected column */ ){ int i, j; /* Loop counters */ int cnt = 0; /* Number of matching column names */ - int cntTab = 0; /* Number of matching table names */ + int cntTab = 0; /* Number of potential "rowid" matches */ int nSubquery = 0; /* How many levels of subquery */ sqlite3 *db = pParse->db; /* The database connection */ SrcItem *pItem; /* Use for looping over pSrcList items */ @@ -105491,6 +107018,7 @@ static int lookupName( Table *pTab = 0; /* Table holding the row */ Column *pCol; /* A column of pTab */ ExprList *pFJMatch = 0; /* Matches for FULL JOIN .. USING */ + const char *zCol = pRight->u.zToken; assert( pNC ); /* the name context cannot be NULL. */ assert( zCol ); /* The Z in X.Y.Z cannot be NULL */ @@ -105557,39 +107085,49 @@ static int lookupName( assert( pEList!=0 ); assert( pEList->nExpr==pTab->nCol ); for(j=0; jnExpr; j++){ - if( !sqlite3MatchEName(&pEList->a[j], zCol, zTab, zDb) ){ + int bRowid = 0; /* True if possible rowid match */ + if( !sqlite3MatchEName(&pEList->a[j], zCol, zTab, zDb, &bRowid) ){ continue; } - if( cnt>0 ){ - if( pItem->fg.isUsing==0 - || sqlite3IdListIndex(pItem->u3.pUsing, zCol)<0 - ){ - /* Two or more tables have the same column name which is - ** not joined by USING. This is an error. Signal as much - ** by clearing pFJMatch and letting cnt go above 1. */ - sqlite3ExprListDelete(db, pFJMatch); - pFJMatch = 0; - }else - if( (pItem->fg.jointype & JT_RIGHT)==0 ){ - /* An INNER or LEFT JOIN. Use the left-most table */ - continue; - }else - if( (pItem->fg.jointype & JT_LEFT)==0 ){ - /* A RIGHT JOIN. Use the right-most table */ - cnt = 0; - sqlite3ExprListDelete(db, pFJMatch); - pFJMatch = 0; - }else{ - /* For a FULL JOIN, we must construct a coalesce() func */ - extendFJMatch(pParse, &pFJMatch, pMatch, pExpr->iColumn); + if( bRowid==0 ){ + if( cnt>0 ){ + if( pItem->fg.isUsing==0 + || sqlite3IdListIndex(pItem->u3.pUsing, zCol)<0 + ){ + /* Two or more tables have the same column name which is + ** not joined by USING. This is an error. Signal as much + ** by clearing pFJMatch and letting cnt go above 1. */ + sqlite3ExprListDelete(db, pFJMatch); + pFJMatch = 0; + }else + if( (pItem->fg.jointype & JT_RIGHT)==0 ){ + /* An INNER or LEFT JOIN. Use the left-most table */ + continue; + }else + if( (pItem->fg.jointype & JT_LEFT)==0 ){ + /* A RIGHT JOIN. Use the right-most table */ + cnt = 0; + sqlite3ExprListDelete(db, pFJMatch); + pFJMatch = 0; + }else{ + /* For a FULL JOIN, we must construct a coalesce() func */ + extendFJMatch(pParse, &pFJMatch, pMatch, pExpr->iColumn); + } } + cnt++; + hit = 1; + }else if( cnt>0 ){ + /* This is a potential rowid match, but there has already been + ** a real match found. So this can be ignored. */ + continue; } - cnt++; - cntTab = 2; + cntTab++; pMatch = pItem; pExpr->iColumn = j; pEList->a[j].fg.bUsed = 1; - hit = 1; + + /* rowid cannot be part of a USING clause - assert() this. */ + assert( bRowid==0 || pEList->a[j].fg.bUsingTerm==0 ); if( pEList->a[j].fg.bUsingTerm ) break; } if( hit || zTab==0 ) continue; @@ -105653,8 +107191,37 @@ static int lookupName( } } if( 0==cnt && VisibleRowid(pTab) ){ + /* pTab is a potential ROWID match. Keep track of it and match + ** the ROWID later if that seems appropriate. (Search for "cntTab" + ** to find related code.) Only allow a ROWID match if there is + ** a single ROWID match candidate. + */ +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + /* In SQLITE_ALLOW_ROWID_IN_VIEW mode, allow a ROWID match + ** if there is a single VIEW candidate or if there is a single + ** non-VIEW candidate plus multiple VIEW candidates. In other + ** words non-VIEW candidate terms take precedence over VIEWs. + */ + if( cntTab==0 + || (cntTab==1 + && ALWAYS(pMatch!=0) + && ALWAYS(pMatch->pTab!=0) + && (pMatch->pTab->tabFlags & TF_Ephemeral)!=0 + && (pTab->tabFlags & TF_Ephemeral)==0) + ){ + cntTab = 1; + pMatch = pItem; + }else{ + cntTab++; + } +#else + /* The (much more common) non-SQLITE_ALLOW_ROWID_IN_VIEW case is + ** simpler since we require exactly one candidate, which will + ** always be a non-VIEW + */ cntTab++; pMatch = pItem; +#endif } } if( pMatch ){ @@ -105683,7 +107250,8 @@ static int lookupName( if( pParse->bReturning ){ if( (pNC->ncFlags & NC_UBaseReg)!=0 && ALWAYS(zTab==0 - || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0) + || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0 + || isValidSchemaTableName(zTab, pParse->pTriggerTab, 0)) ){ pExpr->iTable = op!=TK_DELETE; pTab = pParse->pTriggerTab; @@ -105780,14 +107348,19 @@ static int lookupName( ** Perhaps the name is a reference to the ROWID */ if( cnt==0 - && cntTab==1 + && cntTab>=1 && pMatch && (pNC->ncFlags & (NC_IdxExpr|NC_GenCol))==0 && sqlite3IsRowid(zCol) - && ALWAYS(VisibleRowid(pMatch->pTab)) + && ALWAYS(VisibleRowid(pMatch->pTab) || pMatch->fg.isNestedFrom) ){ - cnt = 1; - pExpr->iColumn = -1; + cnt = cntTab; +#if SQLITE_ALLOW_ROWID_IN_VIEW+0==2 + if( pMatch->pTab!=0 && IsView(pMatch->pTab) ){ + eNewExprOp = TK_NULL; + } +#endif + if( pMatch->fg.isNestedFrom==0 ) pExpr->iColumn = -1; pExpr->affExpr = SQLITE_AFF_INTEGER; } @@ -105940,12 +107513,17 @@ static int lookupName( sqlite3ErrorMsg(pParse, "%s: %s.%s.%s", zErr, zDb, zTab, zCol); }else if( zTab ){ sqlite3ErrorMsg(pParse, "%s: %s.%s", zErr, zTab, zCol); + }else if( cnt==0 && ExprHasProperty(pRight,EP_DblQuoted) ){ + sqlite3ErrorMsg(pParse, "%s: \"%s\" - should this be a" + " string literal in single-quotes?", + zErr, zCol); }else{ sqlite3ErrorMsg(pParse, "%s: %s", zErr, zCol); } sqlite3RecordErrorOffsetOfExpr(pParse->db, pExpr); pParse->checkSchema = 1; pTopNC->nNcErr++; + eNewExprOp = TK_NULL; } assert( pFJMatch==0 ); @@ -105972,8 +107550,12 @@ static int lookupName( ** If a generated column is referenced, set bits for every column ** of the table. */ - if( pExpr->iColumn>=0 && pMatch!=0 ){ - pMatch->colUsed |= sqlite3ExprColUsed(pExpr); + if( pMatch ){ + if( pExpr->iColumn>=0 ){ + pMatch->colUsed |= sqlite3ExprColUsed(pExpr); + }else{ + pMatch->fg.rowidUsed = 1; + } } pExpr->op = eNewExprOp; @@ -106150,6 +107732,19 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ ** resolved. This prevents "column" from being counted as having been ** referenced, which might prevent a SELECT from being erroneously ** marked as correlated. + ** + ** 2024-03-28: Beware of aggregates. A bare column of aggregated table + ** can still evaluate to NULL even though it is marked as NOT NULL. + ** Example: + ** + ** CREATE TABLE t1(a INT NOT NULL); + ** SELECT a, a IS NULL, a IS NOT NULL, count(*) FROM t1; + ** + ** The "a IS NULL" and "a IS NOT NULL" expressions cannot be optimized + ** here because at the time this case is hit, we do not yet know whether + ** or not t1 is being aggregated. We have to assume the worst and omit + ** the optimization. The only time it is safe to apply this optimization + ** is within the WHERE clause. */ case TK_NOTNULL: case TK_ISNULL: { @@ -106160,19 +107755,36 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ anRef[i] = p->nRef; } sqlite3WalkExpr(pWalker, pExpr->pLeft); - if( 0==sqlite3ExprCanBeNull(pExpr->pLeft) && !IN_RENAME_OBJECT ){ - testcase( ExprHasProperty(pExpr, EP_OuterON) ); - assert( !ExprHasProperty(pExpr, EP_IntValue) ); - pExpr->u.iValue = (pExpr->op==TK_NOTNULL); - pExpr->flags |= EP_IntValue; - pExpr->op = TK_INTEGER; + if( IN_RENAME_OBJECT ) return WRC_Prune; + if( sqlite3ExprCanBeNull(pExpr->pLeft) ){ + /* The expression can be NULL. So the optimization does not apply */ + return WRC_Prune; + } - for(i=0, p=pNC; p && ipNext, i++){ - p->nRef = anRef[i]; + for(i=0, p=pNC; p; p=p->pNext, i++){ + if( (p->ncFlags & NC_Where)==0 ){ + return WRC_Prune; /* Not in a WHERE clause. Unsafe to optimize. */ } - sqlite3ExprDelete(pParse->db, pExpr->pLeft); - pExpr->pLeft = 0; } + testcase( ExprHasProperty(pExpr, EP_OuterON) ); + assert( !ExprHasProperty(pExpr, EP_IntValue) ); +#if TREETRACE_ENABLED + if( sqlite3TreeTrace & 0x80000 ){ + sqlite3DebugPrintf( + "NOT NULL strength reduction converts the following to %d:\n", + pExpr->op==TK_NOTNULL + ); + sqlite3ShowExpr(pExpr); + } +#endif /* TREETRACE_ENABLED */ + pExpr->u.iValue = (pExpr->op==TK_NOTNULL); + pExpr->flags |= EP_IntValue; + pExpr->op = TK_INTEGER; + for(i=0, p=pNC; p && ipNext, i++){ + p->nRef = anRef[i]; + } + sqlite3ExprDelete(pParse->db, pExpr->pLeft); + pExpr->pLeft = 0; return WRC_Prune; } @@ -106186,7 +107798,6 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ */ case TK_ID: case TK_DOT: { - const char *zColumn; const char *zTable; const char *zDb; Expr *pRight; @@ -106195,7 +107806,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ zDb = 0; zTable = 0; assert( !ExprHasProperty(pExpr, EP_IntValue) ); - zColumn = pExpr->u.zToken; + pRight = pExpr; }else{ Expr *pLeft = pExpr->pLeft; testcase( pNC->ncFlags & NC_IdxExpr ); @@ -106214,14 +107825,13 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ } assert( ExprUseUToken(pLeft) && ExprUseUToken(pRight) ); zTable = pLeft->u.zToken; - zColumn = pRight->u.zToken; assert( ExprUseYTab(pExpr) ); if( IN_RENAME_OBJECT ){ sqlite3RenameTokenRemap(pParse, (void*)pExpr, (void*)pRight); sqlite3RenameTokenRemap(pParse, (void*)&pExpr->y.pTab, (void*)pLeft); } } - return lookupName(pParse, zDb, zTable, zColumn, pNC, pExpr); + return lookupName(pParse, zDb, zTable, pRight, pNC, pExpr); } /* Resolve function names @@ -106240,6 +107850,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ Window *pWin = (IsWindowFunc(pExpr) ? pExpr->y.pWin : 0); #endif assert( !ExprHasProperty(pExpr, EP_xIsSelect|EP_IntValue) ); + assert( pExpr->pLeft==0 || pExpr->pLeft->op==TK_ORDER ); zId = pExpr->u.zToken; pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0); if( pDef==0 ){ @@ -106381,6 +107992,10 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ pNC->nNcErr++; } #endif + else if( is_agg==0 && pExpr->pLeft ){ + sqlite3ExprOrderByAggregateError(pParse, pExpr); + pNC->nNcErr++; + } if( is_agg ){ /* Window functions may not be arguments of aggregate functions. ** Or arguments of other window functions. But aggregate functions @@ -106392,13 +108007,16 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ #endif } } -#ifndef SQLITE_OMIT_WINDOWFUNC - else if( ExprHasProperty(pExpr, EP_WinFunc) ){ + else if( ExprHasProperty(pExpr, EP_WinFunc) || pExpr->pLeft ){ is_agg = 1; } -#endif sqlite3WalkExprList(pWalker, pList); if( is_agg ){ + if( pExpr->pLeft ){ + assert( pExpr->pLeft->op==TK_ORDER ); + assert( ExprUseXList(pExpr->pLeft) ); + sqlite3WalkExprList(pWalker, pExpr->pLeft->x.pList); + } #ifndef SQLITE_OMIT_WINDOWFUNC if( pWin ){ Select *pSel = pNC->pWinSelect; @@ -106427,11 +108045,12 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ while( pNC2 && sqlite3ReferencesSrcList(pParse, pExpr, pNC2->pSrcList)==0 ){ - pExpr->op2++; + pExpr->op2 += (1 + pNC2->nNestedSelect); pNC2 = pNC2->pNext; } assert( pDef!=0 || IN_RENAME_OBJECT ); if( pNC2 && pDef ){ + pExpr->op2 += pNC2->nNestedSelect; assert( SQLITE_FUNC_MINMAX==NC_MinMaxAgg ); assert( SQLITE_FUNC_ANYORDER==NC_OrderAgg ); testcase( (pDef->funcFlags & SQLITE_FUNC_MINMAX)!=0 ); @@ -106460,6 +108079,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ testcase( pNC->ncFlags & NC_PartIdx ); testcase( pNC->ncFlags & NC_IdxExpr ); testcase( pNC->ncFlags & NC_GenCol ); + assert( pExpr->x.pSelect ); if( pNC->ncFlags & NC_SelfRef ){ notValidImpl(pParse, pNC, "subqueries", pExpr, pExpr); }else{ @@ -106468,6 +108088,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ assert( pNC->nRef>=nRef ); if( nRef!=pNC->nRef ){ ExprSetProperty(pExpr, EP_VarSelect); + pExpr->x.pSelect->selFlags |= SF_Correlated; } pNC->ncFlags |= NC_Subquery; } @@ -106962,10 +108583,8 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ while( p ){ assert( (p->selFlags & SF_Expanded)!=0 ); assert( (p->selFlags & SF_Resolved)==0 ); - assert( db->suppressErr==0 ); /* SF_Resolved not set if errors suppressed */ p->selFlags |= SF_Resolved; - /* Resolve the expressions in the LIMIT and OFFSET clauses. These ** are not allowed to refer to any names, so pass an empty NameContext. */ @@ -106992,8 +108611,10 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ /* Recursively resolve names in all subqueries in the FROM clause */ + if( pOuterNC ) pOuterNC->nNestedSelect++; for(i=0; ipSrc->nSrc; i++){ SrcItem *pItem = &p->pSrc->a[i]; + assert( pItem->zName!=0 || pItem->pSelect!=0 );/* Test of tag-20240424-1*/ if( pItem->pSelect && (pItem->pSelect->selFlags & SF_Resolved)==0 ){ int nRef = pOuterNC ? pOuterNC->nRef : 0; const char *zSavedContext = pParse->zAuthContext; @@ -107016,6 +108637,9 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ } } } + if( pOuterNC && ALWAYS(pOuterNC->nNestedSelect>0) ){ + pOuterNC->nNestedSelect--; + } /* Set up the local name-context to pass to sqlite3ResolveExprNames() to ** resolve the result-set expression list. @@ -107059,7 +108683,9 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ } if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort; } + sNC.ncFlags |= NC_Where; if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort; + sNC.ncFlags &= ~NC_Where; /* Resolve names in table-valued-function arguments */ for(i=0; ipSrc->nSrc; i++){ @@ -107598,9 +109224,10 @@ SQLITE_PRIVATE Expr *sqlite3ExprSkipCollateAndLikely(Expr *pExpr){ assert( pExpr->x.pList->nExpr>0 ); assert( pExpr->op==TK_FUNCTION ); pExpr = pExpr->x.pList->a[0].pExpr; - }else{ - assert( pExpr->op==TK_COLLATE ); + }else if( pExpr->op==TK_COLLATE ){ pExpr = pExpr->pLeft; + }else{ + break; } } return pExpr; @@ -107971,6 +109598,7 @@ SQLITE_PRIVATE Expr *sqlite3ExprForVectorField( */ pRet = sqlite3PExpr(pParse, TK_SELECT_COLUMN, 0, 0); if( pRet ){ + ExprSetProperty(pRet, EP_FullSize); pRet->iTable = nField; pRet->iColumn = iField; pRet->pLeft = pVector; @@ -108293,11 +109921,12 @@ SQLITE_PRIVATE void sqlite3ExprSetErrorOffset(Expr *pExpr, int iOfst){ ** appear to be quoted. If the quotes were of the form "..." (double-quotes) ** then the EP_DblQuoted flag is set on the expression node. ** -** Special case: If op==TK_INTEGER and pToken points to a string that -** can be translated into a 32-bit integer, then the token is not -** stored in u.zToken. Instead, the integer values is written -** into u.iValue and the EP_IntValue flag is set. No extra storage +** Special case (tag-20240227-a): If op==TK_INTEGER and pToken points to +** a string that can be translated into a 32-bit integer, then the token is +** not stored in u.zToken. Instead, the integer values is written +** into u.iValue and the EP_IntValue flag is set. No extra storage ** is allocated to hold the integer text and the dequote flag is ignored. +** See also tag-20240227-b. */ SQLITE_PRIVATE Expr *sqlite3ExprAlloc( sqlite3 *db, /* Handle for sqlite3DbMallocRawNN() */ @@ -108313,7 +109942,7 @@ SQLITE_PRIVATE Expr *sqlite3ExprAlloc( if( pToken ){ if( op!=TK_INTEGER || pToken->z==0 || sqlite3GetInt32(pToken->z, &iValue)==0 ){ - nExtra = pToken->n+1; + nExtra = pToken->n+1; /* tag-20240227-a */ assert( iValue>=0 ); } } @@ -108561,6 +110190,67 @@ SQLITE_PRIVATE Expr *sqlite3ExprFunction( return pNew; } +/* +** Report an error when attempting to use an ORDER BY clause within +** the arguments of a non-aggregate function. +*/ +SQLITE_PRIVATE void sqlite3ExprOrderByAggregateError(Parse *pParse, Expr *p){ + sqlite3ErrorMsg(pParse, + "ORDER BY may not be used with non-aggregate %#T()", p + ); +} + +/* +** Attach an ORDER BY clause to a function call. +** +** functionname( arguments ORDER BY sortlist ) +** \_____________________/ \______/ +** pExpr pOrderBy +** +** The ORDER BY clause is inserted into a new Expr node of type TK_ORDER +** and added to the Expr.pLeft field of the parent TK_FUNCTION node. +*/ +SQLITE_PRIVATE void sqlite3ExprAddFunctionOrderBy( + Parse *pParse, /* Parsing context */ + Expr *pExpr, /* The function call to which ORDER BY is to be added */ + ExprList *pOrderBy /* The ORDER BY clause to add */ +){ + Expr *pOB; + sqlite3 *db = pParse->db; + if( NEVER(pOrderBy==0) ){ + assert( db->mallocFailed ); + return; + } + if( pExpr==0 ){ + assert( db->mallocFailed ); + sqlite3ExprListDelete(db, pOrderBy); + return; + } + assert( pExpr->op==TK_FUNCTION ); + assert( pExpr->pLeft==0 ); + assert( ExprUseXList(pExpr) ); + if( pExpr->x.pList==0 || NEVER(pExpr->x.pList->nExpr==0) ){ + /* Ignore ORDER BY on zero-argument aggregates */ + sqlite3ParserAddCleanup(pParse, sqlite3ExprListDeleteGeneric, pOrderBy); + return; + } + if( IsWindowFunc(pExpr) ){ + sqlite3ExprOrderByAggregateError(pParse, pExpr); + sqlite3ExprListDelete(db, pOrderBy); + return; + } + + pOB = sqlite3ExprAlloc(db, TK_ORDER, 0, 0); + if( pOB==0 ){ + sqlite3ExprListDelete(db, pOrderBy); + return; + } + pOB->x.pList = pOrderBy; + assert( ExprUseXList(pOB) ); + pExpr->pLeft = pOB; + ExprSetProperty(pOB, EP_FullSize); +} + /* ** Check to see if a function is usable according to current access ** rules: @@ -108684,6 +110374,7 @@ SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){ assert( p!=0 ); assert( db!=0 ); +exprDeleteRestart: assert( !ExprUseUValue(p) || p->u.iValue>=0 ); assert( !ExprUseYWin(p) || !ExprUseYSub(p) ); assert( !ExprUseYWin(p) || p->y.pWin!=0 || db->mallocFailed ); @@ -108699,7 +110390,6 @@ static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){ if( !ExprHasProperty(p, (EP_TokenOnly|EP_Leaf)) ){ /* The Expr.x union is never used at the same time as Expr.pRight */ assert( (ExprUseXList(p) && p->x.pList==0) || p->pRight==0 ); - if( p->pLeft && p->op!=TK_SELECT_COLUMN ) sqlite3ExprDeleteNN(db, p->pLeft); if( p->pRight ){ assert( !ExprHasProperty(p, EP_WinFunc) ); sqlite3ExprDeleteNN(db, p->pRight); @@ -108714,6 +110404,19 @@ static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){ } #endif } + if( p->pLeft && p->op!=TK_SELECT_COLUMN ){ + Expr *pLeft = p->pLeft; + if( !ExprHasProperty(p, EP_Static) + && !ExprHasProperty(pLeft, EP_Static) + ){ + /* Avoid unnecessary recursion on unary operators */ + sqlite3DbNNFreeNN(db, p); + p = pLeft; + goto exprDeleteRestart; + }else{ + sqlite3ExprDeleteNN(db, pLeft); + } + } } if( !ExprHasProperty(p, EP_Static) ){ sqlite3DbNNFreeNN(db, p); @@ -108722,6 +110425,9 @@ static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){ SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3 *db, Expr *p){ if( p ) sqlite3ExprDeleteNN(db, p); } +SQLITE_PRIVATE void sqlite3ExprDeleteGeneric(sqlite3 *db, void *p){ + if( ALWAYS(p) ) sqlite3ExprDeleteNN(db, (Expr*)p); +} /* ** Clear both elements of an OnOrUsing object @@ -108743,13 +110449,11 @@ SQLITE_PRIVATE void sqlite3ClearOnOrUsing(sqlite3 *db, OnOrUsing *p){ ** ** The pExpr might be deleted immediately on an OOM error. ** -** The deferred delete is (currently) implemented by adding the -** pExpr to the pParse->pConstExpr list with a register number of 0. +** Return 0 if the delete was successfully deferred. Return non-zero +** if the delete happened immediately because of an OOM. */ -SQLITE_PRIVATE void sqlite3ExprDeferredDelete(Parse *pParse, Expr *pExpr){ - sqlite3ParserAddCleanup(pParse, - (void(*)(sqlite3*,void*))sqlite3ExprDelete, - pExpr); +SQLITE_PRIVATE int sqlite3ExprDeferredDelete(Parse *pParse, Expr *pExpr){ + return 0==sqlite3ParserAddCleanup(pParse, sqlite3ExprDeleteGeneric, pExpr); } /* Invoke sqlite3RenameExprUnmap() and sqlite3ExprDelete() on the @@ -108814,11 +110518,7 @@ static int dupedExprStructSize(const Expr *p, int flags){ assert( flags==EXPRDUP_REDUCE || flags==0 ); /* Only one flag value allowed */ assert( EXPR_FULLSIZE<=0xfff ); assert( (0xfff & (EP_Reduced|EP_TokenOnly))==0 ); - if( 0==flags || p->op==TK_SELECT_COLUMN -#ifndef SQLITE_OMIT_WINDOWFUNC - || ExprHasProperty(p, EP_WinFunc) -#endif - ){ + if( 0==flags || ExprHasProperty(p, EP_FullSize) ){ nSize = EXPR_FULLSIZE; }else{ assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) ); @@ -108849,56 +110549,93 @@ static int dupedExprNodeSize(const Expr *p, int flags){ /* ** Return the number of bytes required to create a duplicate of the -** expression passed as the first argument. The second argument is a -** mask containing EXPRDUP_XXX flags. +** expression passed as the first argument. ** ** The value returned includes space to create a copy of the Expr struct ** itself and the buffer referred to by Expr.u.zToken, if any. ** -** If the EXPRDUP_REDUCE flag is set, then the return value includes -** space to duplicate all Expr nodes in the tree formed by Expr.pLeft -** and Expr.pRight variables (but not for any structures pointed to or -** descended from the Expr.x.pList or Expr.x.pSelect variables). +** The return value includes space to duplicate all Expr nodes in the +** tree formed by Expr.pLeft and Expr.pRight, but not any other +** substructure such as Expr.x.pList, Expr.x.pSelect, and Expr.y.pWin. */ -static int dupedExprSize(const Expr *p, int flags){ - int nByte = 0; - if( p ){ - nByte = dupedExprNodeSize(p, flags); - if( flags&EXPRDUP_REDUCE ){ - nByte += dupedExprSize(p->pLeft, flags) + dupedExprSize(p->pRight, flags); - } - } +static int dupedExprSize(const Expr *p){ + int nByte; + assert( p!=0 ); + nByte = dupedExprNodeSize(p, EXPRDUP_REDUCE); + if( p->pLeft ) nByte += dupedExprSize(p->pLeft); + if( p->pRight ) nByte += dupedExprSize(p->pRight); + assert( nByte==ROUND8(nByte) ); return nByte; } /* -** This function is similar to sqlite3ExprDup(), except that if pzBuffer -** is not NULL then *pzBuffer is assumed to point to a buffer large enough -** to store the copy of expression p, the copies of p->u.zToken -** (if applicable), and the copies of the p->pLeft and p->pRight expressions, -** if any. Before returning, *pzBuffer is set to the first byte past the -** portion of the buffer copied into by this function. +** An EdupBuf is a memory allocation used to stored multiple Expr objects +** together with their Expr.zToken content. This is used to help implement +** compression while doing sqlite3ExprDup(). The top-level Expr does the +** allocation for itself and many of its decendents, then passes an instance +** of the structure down into exprDup() so that they decendents can have +** access to that memory. */ -static Expr *exprDup(sqlite3 *db, const Expr *p, int dupFlags, u8 **pzBuffer){ +typedef struct EdupBuf EdupBuf; +struct EdupBuf { + u8 *zAlloc; /* Memory space available for storage */ +#ifdef SQLITE_DEBUG + u8 *zEnd; /* First byte past the end of memory */ +#endif +}; + +/* +** This function is similar to sqlite3ExprDup(), except that if pEdupBuf +** is not NULL then it points to memory that can be used to store a copy +** of the input Expr p together with its p->u.zToken (if any). pEdupBuf +** is updated with the new buffer tail prior to returning. +*/ +static Expr *exprDup( + sqlite3 *db, /* Database connection (for memory allocation) */ + const Expr *p, /* Expr tree to be duplicated */ + int dupFlags, /* EXPRDUP_REDUCE for compression. 0 if not */ + EdupBuf *pEdupBuf /* Preallocated storage space, or NULL */ +){ Expr *pNew; /* Value to return */ - u8 *zAlloc; /* Memory space from which to build Expr object */ + EdupBuf sEdupBuf; /* Memory space from which to build Expr object */ u32 staticFlag; /* EP_Static if space not obtained from malloc */ + int nToken = -1; /* Space needed for p->u.zToken. -1 means unknown */ assert( db!=0 ); assert( p ); assert( dupFlags==0 || dupFlags==EXPRDUP_REDUCE ); - assert( pzBuffer==0 || dupFlags==EXPRDUP_REDUCE ); + assert( pEdupBuf==0 || dupFlags==EXPRDUP_REDUCE ); /* Figure out where to write the new Expr structure. */ - if( pzBuffer ){ - zAlloc = *pzBuffer; + if( pEdupBuf ){ + sEdupBuf.zAlloc = pEdupBuf->zAlloc; +#ifdef SQLITE_DEBUG + sEdupBuf.zEnd = pEdupBuf->zEnd; +#endif staticFlag = EP_Static; - assert( zAlloc!=0 ); + assert( sEdupBuf.zAlloc!=0 ); + assert( dupFlags==EXPRDUP_REDUCE ); }else{ - zAlloc = sqlite3DbMallocRawNN(db, dupedExprSize(p, dupFlags)); + int nAlloc; + if( dupFlags ){ + nAlloc = dupedExprSize(p); + }else if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){ + nToken = sqlite3Strlen30NN(p->u.zToken)+1; + nAlloc = ROUND8(EXPR_FULLSIZE + nToken); + }else{ + nToken = 0; + nAlloc = ROUND8(EXPR_FULLSIZE); + } + assert( nAlloc==ROUND8(nAlloc) ); + sEdupBuf.zAlloc = sqlite3DbMallocRawNN(db, nAlloc); +#ifdef SQLITE_DEBUG + sEdupBuf.zEnd = sEdupBuf.zAlloc ? sEdupBuf.zAlloc+nAlloc : 0; +#endif + staticFlag = 0; } - pNew = (Expr *)zAlloc; + pNew = (Expr *)sEdupBuf.zAlloc; + assert( EIGHT_BYTE_ALIGNMENT(pNew) ); if( pNew ){ /* Set nNewSize to the size allocated for the structure pointed to @@ -108907,22 +110644,27 @@ static Expr *exprDup(sqlite3 *db, const Expr *p, int dupFlags, u8 **pzBuffer){ ** by the copy of the p->u.zToken string (if any). */ const unsigned nStructSize = dupedExprStructSize(p, dupFlags); - const int nNewSize = nStructSize & 0xfff; - int nToken; - if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){ - nToken = sqlite3Strlen30(p->u.zToken) + 1; - }else{ - nToken = 0; + int nNewSize = nStructSize & 0xfff; + if( nToken<0 ){ + if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){ + nToken = sqlite3Strlen30(p->u.zToken) + 1; + }else{ + nToken = 0; + } } if( dupFlags ){ + assert( (int)(sEdupBuf.zEnd - sEdupBuf.zAlloc) >= nNewSize+nToken ); assert( ExprHasProperty(p, EP_Reduced)==0 ); - memcpy(zAlloc, p, nNewSize); + memcpy(sEdupBuf.zAlloc, p, nNewSize); }else{ u32 nSize = (u32)exprStructSize(p); - memcpy(zAlloc, p, nSize); + assert( (int)(sEdupBuf.zEnd - sEdupBuf.zAlloc) >= + (int)EXPR_FULLSIZE+nToken ); + memcpy(sEdupBuf.zAlloc, p, nSize); if( nSizeu.zToken string, if any. */ - if( nToken ){ - char *zToken = pNew->u.zToken = (char*)&zAlloc[nNewSize]; + assert( nToken>=0 ); + if( nToken>0 ){ + char *zToken = pNew->u.zToken = (char*)&sEdupBuf.zAlloc[nNewSize]; memcpy(zToken, p->u.zToken, nToken); + nNewSize += nToken; } + sEdupBuf.zAlloc += ROUND8(nNewSize); + + if( ((p->flags|pNew->flags)&(EP_TokenOnly|EP_Leaf))==0 ){ - if( 0==((p->flags|pNew->flags) & (EP_TokenOnly|EP_Leaf)) ){ /* Fill in the pNew->x.pSelect or pNew->x.pList member. */ if( ExprUseXSelect(p) ){ pNew->x.pSelect = sqlite3SelectDup(db, p->x.pSelect, dupFlags); }else{ - pNew->x.pList = sqlite3ExprListDup(db, p->x.pList, dupFlags); + pNew->x.pList = sqlite3ExprListDup(db, p->x.pList, + p->op!=TK_ORDER ? dupFlags : 0); } - } - /* Fill in pNew->pLeft and pNew->pRight. */ - if( ExprHasProperty(pNew, EP_Reduced|EP_TokenOnly|EP_WinFunc) ){ - zAlloc += dupedExprNodeSize(p, dupFlags); - if( !ExprHasProperty(pNew, EP_TokenOnly|EP_Leaf) ){ - pNew->pLeft = p->pLeft ? - exprDup(db, p->pLeft, EXPRDUP_REDUCE, &zAlloc) : 0; - pNew->pRight = p->pRight ? - exprDup(db, p->pRight, EXPRDUP_REDUCE, &zAlloc) : 0; - } #ifndef SQLITE_OMIT_WINDOWFUNC if( ExprHasProperty(p, EP_WinFunc) ){ pNew->y.pWin = sqlite3WindowDup(db, pNew, p->y.pWin); assert( ExprHasProperty(pNew, EP_WinFunc) ); } #endif /* SQLITE_OMIT_WINDOWFUNC */ - if( pzBuffer ){ - *pzBuffer = zAlloc; - } - }else{ - if( !ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){ - if( pNew->op==TK_SELECT_COLUMN ){ + + /* Fill in pNew->pLeft and pNew->pRight. */ + if( dupFlags ){ + if( p->op==TK_SELECT_COLUMN ){ + pNew->pLeft = p->pLeft; + assert( p->pRight==0 + || p->pRight==p->pLeft + || ExprHasProperty(p->pLeft, EP_Subquery) ); + }else{ + pNew->pLeft = p->pLeft ? + exprDup(db, p->pLeft, EXPRDUP_REDUCE, &sEdupBuf) : 0; + } + pNew->pRight = p->pRight ? + exprDup(db, p->pRight, EXPRDUP_REDUCE, &sEdupBuf) : 0; + }else{ + if( p->op==TK_SELECT_COLUMN ){ pNew->pLeft = p->pLeft; - assert( p->pRight==0 || p->pRight==p->pLeft - || ExprHasProperty(p->pLeft, EP_Subquery) ); + assert( p->pRight==0 + || p->pRight==p->pLeft + || ExprHasProperty(p->pLeft, EP_Subquery) ); }else{ pNew->pLeft = sqlite3ExprDup(db, p->pLeft, 0); } @@ -108980,6 +110728,8 @@ static Expr *exprDup(sqlite3 *db, const Expr *p, int dupFlags, u8 **pzBuffer){ } } } + if( pEdupBuf ) memcpy(pEdupBuf, &sEdupBuf, sizeof(sEdupBuf)); + assert( sEdupBuf.zAlloc <= sEdupBuf.zEnd ); return pNew; } @@ -109139,17 +110889,19 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3 *db, const SrcList *p, int fla pNewItem->iCursor = pOldItem->iCursor; pNewItem->addrFillSub = pOldItem->addrFillSub; pNewItem->regReturn = pOldItem->regReturn; + pNewItem->regResult = pOldItem->regResult; if( pNewItem->fg.isIndexedBy ){ pNewItem->u1.zIndexedBy = sqlite3DbStrDup(db, pOldItem->u1.zIndexedBy); + }else if( pNewItem->fg.isTabFunc ){ + pNewItem->u1.pFuncArg = + sqlite3ExprListDup(db, pOldItem->u1.pFuncArg, flags); + }else{ + pNewItem->u1.nRow = pOldItem->u1.nRow; } pNewItem->u2 = pOldItem->u2; if( pNewItem->fg.isCte ){ pNewItem->u2.pCteUse->nUse++; } - if( pNewItem->fg.isTabFunc ){ - pNewItem->u1.pFuncArg = - sqlite3ExprListDup(db, pOldItem->u1.pFuncArg, flags); - } pTab = pNewItem->pTab = pOldItem->pTab; if( pTab ){ pTab->nTabRef++; @@ -109244,11 +110996,7 @@ SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, const Select *p, int flags) ** initially NULL, then create a new expression list. ** ** The pList argument must be either NULL or a pointer to an ExprList -** obtained from a prior call to sqlite3ExprListAppend(). This routine -** may not be used with an ExprList obtained from sqlite3ExprListDup(). -** Reason: This routine assumes that the number of slots in pList->a[] -** is a power of two. That is true for sqlite3ExprListAppend() returns -** but is not necessarily true from the return value of sqlite3ExprListDup(). +** obtained from a prior call to sqlite3ExprListAppend(). ** ** If a memory allocation error occurs, the entire list is freed and ** NULL is returned. If non-NULL is returned, then it is guaranteed @@ -109513,6 +111261,9 @@ static SQLITE_NOINLINE void exprListDeleteNN(sqlite3 *db, ExprList *pList){ SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3 *db, ExprList *pList){ if( pList ) exprListDeleteNN(db, pList); } +SQLITE_PRIVATE void sqlite3ExprListDeleteGeneric(sqlite3 *db, void *pList){ + if( ALWAYS(pList) ) exprListDeleteNN(db, (ExprList*)pList); +} /* ** Return the bitwise-OR of all Expr.flags fields in the given @@ -109616,6 +111367,54 @@ SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr *pExpr){ return pExpr; } +/* +** pExpr is a TK_FUNCTION node. Try to determine whether or not the +** function is a constant function. A function is constant if all of +** the following are true: +** +** (1) It is a scalar function (not an aggregate or window function) +** (2) It has either the SQLITE_FUNC_CONSTANT or SQLITE_FUNC_SLOCHNG +** property. +** (3) All of its arguments are constants +** +** This routine sets pWalker->eCode to 0 if pExpr is not a constant. +** It makes no changes to pWalker->eCode if pExpr is constant. In +** every case, it returns WRC_Abort. +** +** Called as a service subroutine from exprNodeIsConstant(). +*/ +static SQLITE_NOINLINE int exprNodeIsConstantFunction( + Walker *pWalker, + Expr *pExpr +){ + int n; /* Number of arguments */ + ExprList *pList; /* List of arguments */ + FuncDef *pDef; /* The function */ + sqlite3 *db; /* The database */ + + assert( pExpr->op==TK_FUNCTION ); + if( ExprHasProperty(pExpr, EP_TokenOnly) + || (pList = pExpr->x.pList)==0 + ){; + n = 0; + }else{ + n = pList->nExpr; + sqlite3WalkExprList(pWalker, pList); + if( pWalker->eCode==0 ) return WRC_Abort; + } + db = pWalker->pParse->db; + pDef = sqlite3FindFunction(db, pExpr->u.zToken, n, ENC(db), 0); + if( pDef==0 + || pDef->xFinalize!=0 + || (pDef->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG))==0 + || ExprHasProperty(pExpr, EP_WinFunc) + ){ + pWalker->eCode = 0; + return WRC_Abort; + } + return WRC_Prune; +} + /* ** These routines are Walker callbacks used to check expressions to @@ -109644,6 +111443,7 @@ SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr *pExpr){ ** malformed schema error. */ static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){ + assert( pWalker->eCode>0 ); /* If pWalker->eCode is 2 then any term of the expression that comes from ** the ON or USING clauses of an outer join disqualifies the expression @@ -109663,6 +111463,8 @@ static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){ ){ if( pWalker->eCode==5 ) ExprSetProperty(pExpr, EP_FromDDL); return WRC_Continue; + }else if( pWalker->pParse ){ + return exprNodeIsConstantFunction(pWalker, pExpr); }else{ pWalker->eCode = 0; return WRC_Abort; @@ -109691,9 +111493,11 @@ static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){ case TK_IF_NULL_ROW: case TK_REGISTER: case TK_DOT: + case TK_RAISE: testcase( pExpr->op==TK_REGISTER ); testcase( pExpr->op==TK_IF_NULL_ROW ); testcase( pExpr->op==TK_DOT ); + testcase( pExpr->op==TK_RAISE ); pWalker->eCode = 0; return WRC_Abort; case TK_VARIABLE: @@ -109715,15 +111519,15 @@ static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){ return WRC_Continue; } } -static int exprIsConst(Expr *p, int initFlag, int iCur){ +static int exprIsConst(Parse *pParse, Expr *p, int initFlag){ Walker w; w.eCode = initFlag; + w.pParse = pParse; w.xExprCallback = exprNodeIsConstant; w.xSelectCallback = sqlite3SelectWalkFail; #ifdef SQLITE_DEBUG w.xSelectCallback2 = sqlite3SelectWalkAssert2; #endif - w.u.iCur = iCur; sqlite3WalkExpr(&w, p); return w.eCode; } @@ -109735,9 +111539,15 @@ static int exprIsConst(Expr *p, int initFlag, int iCur){ ** For the purposes of this function, a double-quoted string (ex: "abc") ** is considered a variable but a single-quoted string (ex: 'abc') is ** a constant. +** +** The pParse parameter may be NULL. But if it is NULL, there is no way +** to determine if function calls are constant or not, and hence all +** function calls will be considered to be non-constant. If pParse is +** not NULL, then a function call might be constant, depending on the +** function and on its parameters. */ -SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){ - return exprIsConst(p, 1, 0); +SQLITE_PRIVATE int sqlite3ExprIsConstant(Parse *pParse, Expr *p){ + return exprIsConst(pParse, p, 1); } /* @@ -109753,8 +111563,24 @@ SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){ ** can be added to the pParse->pConstExpr list and evaluated once when ** the prepared statement starts up. See sqlite3ExprCodeRunJustOnce(). */ -SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){ - return exprIsConst(p, 2, 0); +static int sqlite3ExprIsConstantNotJoin(Parse *pParse, Expr *p){ + return exprIsConst(pParse, p, 2); +} + +/* +** This routine examines sub-SELECT statements as an expression is being +** walked as part of sqlite3ExprIsTableConstant(). Sub-SELECTs are considered +** constant as long as they are uncorrelated - meaning that they do not +** contain any terms from outer contexts. +*/ +static int exprSelectWalkTableConstant(Walker *pWalker, Select *pSelect){ + assert( pSelect!=0 ); + assert( pWalker->eCode==3 || pWalker->eCode==0 ); + if( (pSelect->selFlags & SF_Correlated)!=0 ){ + pWalker->eCode = 0; + return WRC_Abort; + } + return WRC_Prune; } /* @@ -109762,9 +111588,26 @@ SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){ ** for any single row of the table with cursor iCur. In other words, the ** expression must not refer to any non-deterministic function nor any ** table other than iCur. +** +** Consider uncorrelated subqueries to be constants if the bAllowSubq +** parameter is true. */ -SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){ - return exprIsConst(p, 3, iCur); +static int sqlite3ExprIsTableConstant(Expr *p, int iCur, int bAllowSubq){ + Walker w; + w.eCode = 3; + w.pParse = 0; + w.xExprCallback = exprNodeIsConstant; + if( bAllowSubq ){ + w.xSelectCallback = exprSelectWalkTableConstant; + }else{ + w.xSelectCallback = sqlite3SelectWalkFail; +#ifdef SQLITE_DEBUG + w.xSelectCallback2 = sqlite3SelectWalkAssert2; +#endif + } + w.u.iCur = iCur; + sqlite3WalkExpr(&w, p); + return w.eCode; } /* @@ -109782,7 +111625,10 @@ SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){ ** ** (1) pExpr cannot refer to any table other than pSrc->iCursor. ** -** (2) pExpr cannot use subqueries or non-deterministic functions. +** (2a) pExpr cannot use subqueries unless the bAllowSubq parameter is +** true and the subquery is non-correlated +** +** (2b) pExpr cannot use non-deterministic functions. ** ** (3) pSrc cannot be part of the left operand for a RIGHT JOIN. ** (Is there some way to relax this constraint?) @@ -109811,7 +111657,8 @@ SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){ SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint( Expr *pExpr, /* The constraint */ const SrcList *pSrcList, /* Complete FROM clause */ - int iSrc /* Which element of pSrcList to use */ + int iSrc, /* Which element of pSrcList to use */ + int bAllowSubq /* Allow non-correlated subqueries */ ){ const SrcItem *pSrc = &pSrcList->a[iSrc]; if( pSrc->fg.jointype & JT_LTORJ ){ @@ -109836,7 +111683,8 @@ SQLITE_PRIVATE int sqlite3ExprIsSingleTableConstraint( } } } - return sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor); /* rules (1), (2) */ + /* Rules (1), (2a), and (2b) handled by the following: */ + return sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor, bAllowSubq); } @@ -109921,7 +111769,7 @@ SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse *pParse, Expr *p, ExprLi */ SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr *p, u8 isInit){ assert( isInit==0 || isInit==1 ); - return exprIsConst(p, 4+isInit, 0); + return exprIsConst(0, p, 4+isInit); } #ifdef SQLITE_ENABLE_CURSOR_HINTS @@ -110011,10 +111859,14 @@ SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr *p){ return 0; case TK_COLUMN: assert( ExprUseYTab(p) ); - return ExprHasProperty(p, EP_CanBeNull) || - p->y.pTab==0 || /* Reference to column of index on expression */ - (p->iColumn>=0 + return ExprHasProperty(p, EP_CanBeNull) + || NEVER(p->y.pTab==0) /* Reference to column of index on expr */ +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + || (p->iColumn==XN_ROWID && IsView(p->y.pTab)) +#endif + || (p->iColumn>=0 && p->y.pTab->aCol!=0 /* Possible due to prior error */ + && ALWAYS(p->iColumny.pTab->nCol) && p->y.pTab->aCol[p->iColumn].notNull==0); default: return 1; @@ -110074,6 +111926,27 @@ SQLITE_PRIVATE int sqlite3IsRowid(const char *z){ return 0; } +/* +** Return a pointer to a buffer containing a usable rowid alias for table +** pTab. An alias is usable if there is not an explicit user-defined column +** of the same name. +*/ +SQLITE_PRIVATE const char *sqlite3RowidAlias(Table *pTab){ + const char *azOpt[] = {"_ROWID_", "ROWID", "OID"}; + int ii; + assert( VisibleRowid(pTab) ); + for(ii=0; iinCol; iCol++){ + if( sqlite3_stricmp(azOpt[ii], pTab->aCol[iCol].zCnName)==0 ) break; + } + if( iCol==pTab->nCol ){ + return azOpt[ii]; + } + } + return 0; +} + /* ** pX is the RHS of an IN operator. If pX is a SELECT statement ** that can be simplified to a direct table access, then return @@ -110144,13 +112017,13 @@ static void sqlite3SetHasNullFlag(Vdbe *v, int iCur, int regHasNull){ ** The argument is an IN operator with a list (not a subquery) on the ** right-hand side. Return TRUE if that list is constant. */ -static int sqlite3InRhsIsConstant(Expr *pIn){ +static int sqlite3InRhsIsConstant(Parse *pParse, Expr *pIn){ Expr *pLHS; int res; assert( !ExprHasProperty(pIn, EP_xIsSelect) ); pLHS = pIn->pLeft; pIn->pLeft = 0; - res = sqlite3ExprIsConstant(pIn); + res = sqlite3ExprIsConstant(pParse, pIn); pIn->pLeft = pLHS; return res; } @@ -110419,7 +112292,7 @@ SQLITE_PRIVATE int sqlite3FindInIndex( if( eType==0 && (inFlags & IN_INDEX_NOOP_OK) && ExprUseXList(pX) - && (!sqlite3InRhsIsConstant(pX) || pX->x.pList->nExpr<=2) + && (!sqlite3InRhsIsConstant(pParse,pX) || pX->x.pList->nExpr<=2) ){ pParse->nTab--; /* Back out the allocation of the unused cursor */ iTab = -1; /* Cursor is not allocated */ @@ -110702,7 +112575,7 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN( ** this code only executes once. Because for a non-constant ** expression we need to rerun this code each time. */ - if( addrOnce && !sqlite3ExprIsConstant(pE2) ){ + if( addrOnce && !sqlite3ExprIsConstant(pParse, pE2) ){ sqlite3VdbeChangeToNoop(v, addrOnce-1); sqlite3VdbeChangeToNoop(v, addrOnce); ExprClearProperty(pExpr, EP_Subrtn); @@ -111611,6 +113484,41 @@ static SQLITE_NOINLINE int sqlite3IndexedExprLookup( } +/* +** Expresion pExpr is guaranteed to be a TK_COLUMN or equivalent. This +** function checks the Parse.pIdxPartExpr list to see if this column +** can be replaced with a constant value. If so, it generates code to +** put the constant value in a register (ideally, but not necessarily, +** register iTarget) and returns the register number. +** +** Or, if the TK_COLUMN cannot be replaced by a constant, zero is +** returned. +*/ +static int exprPartidxExprLookup(Parse *pParse, Expr *pExpr, int iTarget){ + IndexedExpr *p; + for(p=pParse->pIdxPartExpr; p; p=p->pIENext){ + if( pExpr->iColumn==p->iIdxCol && pExpr->iTable==p->iDataCur ){ + Vdbe *v = pParse->pVdbe; + int addr = 0; + int ret; + + if( p->bMaybeNullRow ){ + addr = sqlite3VdbeAddOp1(v, OP_IfNullRow, p->iIdxCur); + } + ret = sqlite3ExprCodeTarget(pParse, p->pExpr, iTarget); + sqlite3VdbeAddOp4(pParse->pVdbe, OP_Affinity, ret, 1, 0, + (const char*)&p->aff, 1); + if( addr ){ + sqlite3VdbeJumpHere(v, addr); + sqlite3VdbeChangeP3(v, addr, ret); + } + return ret; + } + } + return 0; +} + + /* ** Generate code into the current Vdbe to evaluate the given ** expression. Attempt to store the results in register "target". @@ -111647,6 +113555,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target) assert( !ExprHasVVAProperty(pExpr,EP_Immutable) ); op = pExpr->op; } + assert( op!=TK_ORDER ); switch( op ){ case TK_AGG_COLUMN: { AggInfo *pAggInfo = pExpr->pAggInfo; @@ -111660,7 +113569,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target) #ifdef SQLITE_VDBE_COVERAGE /* Verify that the OP_Null above is exercised by tests ** tag-20230325-2 */ - sqlite3VdbeAddOp2(v, OP_NotNull, target, 1); + sqlite3VdbeAddOp3(v, OP_NotNull, target, 1, 20230325); VdbeCoverageNeverTaken(v); #endif break; @@ -111768,6 +113677,11 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target) iTab = pParse->iSelfTab - 1; } } + else if( pParse->pIdxPartExpr + && 0!=(r1 = exprPartidxExprLookup(pParse, pExpr, target)) + ){ + return r1; + } assert( ExprUseYTab(pExpr) ); assert( pExpr->y.pTab!=0 ); iReg = sqlite3ExprCodeGetColumn(pParse, pExpr->y.pTab, @@ -111825,12 +113739,6 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target) assert( pExpr->u.zToken!=0 ); assert( pExpr->u.zToken[0]!=0 ); sqlite3VdbeAddOp2(v, OP_Variable, pExpr->iColumn, target); - if( pExpr->u.zToken[1]!=0 ){ - const char *z = sqlite3VListNumToName(pParse->pVList, pExpr->iColumn); - assert( pExpr->u.zToken[0]=='?' || (z && !strcmp(pExpr->u.zToken, z)) ); - pParse->pVList[0] = 0; /* Indicate VList may no longer be enlarged */ - sqlite3VdbeAppendP4(v, (char*)z, P4_STATIC); - } return target; } case TK_REGISTER: { @@ -112004,7 +113912,9 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target) } #endif - if( ConstFactorOk(pParse) && sqlite3ExprIsConstantNotJoin(pExpr) ){ + if( ConstFactorOk(pParse) + && sqlite3ExprIsConstantNotJoin(pParse,pExpr) + ){ /* SQL functions can be expensive. So try to avoid running them ** multiple times if we know they always give the same result */ return sqlite3ExprCodeRunJustOnce(pParse, pExpr, -1); @@ -112035,7 +113945,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target) } for(i=0; ia[i].pExpr) ){ + if( i<32 && sqlite3ExprIsConstant(pParse, pFarg->a[i].pExpr) ){ testcase( i==31 ); constMask |= MASKBIT32(i); } @@ -112177,8 +114087,9 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target) if( !ExprHasProperty(pExpr, EP_Collate) ){ /* A TK_COLLATE Expr node without the EP_Collate tag is a so-called ** "SOFT-COLLATE" that is added to constraints that are pushed down - ** from outer queries into sub-queries by the push-down optimization. - ** Clear subtypes as subtypes may not cross a subquery boundary. + ** from outer queries into sub-queries by the WHERE-clause push-down + ** optimization. Clear subtypes as subtypes may not cross a subquery + ** boundary. */ assert( pExpr->pLeft ); sqlite3ExprCode(pParse, pExpr->pLeft, target); @@ -112428,7 +114339,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target) ** once. If no functions are involved, then factor the code out and put it at ** the end of the prepared statement in the initialization section. ** -** If regDest>=0 then the result is always stored in that register and the +** If regDest>0 then the result is always stored in that register and the ** result is not reusable. If regDest<0 then this routine is free to ** store the value wherever it wants. The register where the expression ** is stored is returned. When regDest<0, two identical expressions might @@ -112443,6 +114354,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeRunJustOnce( ){ ExprList *p; assert( ConstFactorOk(pParse) ); + assert( regDest!=0 ); p = pParse->pConstExpr; if( regDest<0 && p ){ struct ExprList_item *pItem; @@ -112501,7 +114413,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse *pParse, Expr *pExpr, int *pReg){ if( ConstFactorOk(pParse) && ALWAYS(pExpr!=0) && pExpr->op!=TK_REGISTER - && sqlite3ExprIsConstantNotJoin(pExpr) + && sqlite3ExprIsConstantNotJoin(pParse, pExpr) ){ *pReg = 0; r2 = sqlite3ExprCodeRunJustOnce(pParse, pExpr, -1); @@ -112533,8 +114445,10 @@ SQLITE_PRIVATE void sqlite3ExprCode(Parse *pParse, Expr *pExpr, int target){ inReg = sqlite3ExprCodeTarget(pParse, pExpr, target); if( inReg!=target ){ u8 op; - if( ALWAYS(pExpr) - && (ExprHasProperty(pExpr,EP_Subquery) || pExpr->op==TK_REGISTER) + Expr *pX = sqlite3ExprSkipCollateAndLikely(pExpr); + testcase( pX!=pExpr ); + if( ALWAYS(pX) + && (ExprHasProperty(pX,EP_Subquery) || pX->op==TK_REGISTER) ){ op = OP_Copy; }else{ @@ -112563,7 +114477,7 @@ SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse *pParse, Expr *pExpr, int target){ ** might choose to code the expression at initialization time. */ SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse *pParse, Expr *pExpr, int target){ - if( pParse->okConstFactor && sqlite3ExprIsConstantNotJoin(pExpr) ){ + if( pParse->okConstFactor && sqlite3ExprIsConstantNotJoin(pParse,pExpr) ){ sqlite3ExprCodeRunJustOnce(pParse, pExpr, target); }else{ sqlite3ExprCodeCopy(pParse, pExpr, target); @@ -112622,7 +114536,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeExprList( sqlite3VdbeAddOp2(v, copyOp, j+srcReg-1, target+i); } }else if( (flags & SQLITE_ECEL_FACTOR)!=0 - && sqlite3ExprIsConstantNotJoin(pExpr) + && sqlite3ExprIsConstantNotJoin(pParse,pExpr) ){ sqlite3ExprCodeRunJustOnce(pParse, pExpr, target+i); }else{ @@ -113254,8 +115168,8 @@ SQLITE_PRIVATE int sqlite3ExprListCompare(const ExprList *pA, const ExprList *pB */ SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr *pA,Expr *pB, int iTab){ return sqlite3ExprCompare(0, - sqlite3ExprSkipCollateAndLikely(pA), - sqlite3ExprSkipCollateAndLikely(pB), + sqlite3ExprSkipCollate(pA), + sqlite3ExprSkipCollate(pB), iTab); } @@ -113727,6 +115641,12 @@ SQLITE_PRIVATE int sqlite3ReferencesSrcList(Parse *pParse, Expr *pExpr, SrcList assert( pExpr->op==TK_AGG_FUNCTION ); assert( ExprUseXList(pExpr) ); sqlite3WalkExprList(&w, pExpr->x.pList); + if( pExpr->pLeft ){ + assert( pExpr->pLeft->op==TK_ORDER ); + assert( ExprUseXList(pExpr->pLeft) ); + assert( pExpr->pLeft->x.pList!=0 ); + sqlite3WalkExprList(&w, pExpr->pLeft->x.pList); + } #ifndef SQLITE_OMIT_WINDOWFUNC if( ExprHasProperty(pExpr, EP_WinFunc) ){ sqlite3WalkExpr(&w, pExpr->y.pWin->pFilter); @@ -113767,9 +115687,8 @@ static int agginfoPersistExprCb(Walker *pWalker, Expr *pExpr){ && pAggInfo->aCol[iAgg].pCExpr==pExpr ){ pExpr = sqlite3ExprDup(db, pExpr, 0); - if( pExpr ){ + if( pExpr && !sqlite3ExprDeferredDelete(pParse, pExpr) ){ pAggInfo->aCol[iAgg].pCExpr = pExpr; - sqlite3ExprDeferredDelete(pParse, pExpr); } } }else{ @@ -113778,9 +115697,8 @@ static int agginfoPersistExprCb(Walker *pWalker, Expr *pExpr){ && pAggInfo->aFunc[iAgg].pFExpr==pExpr ){ pExpr = sqlite3ExprDup(db, pExpr, 0); - if( pExpr ){ + if( pExpr && !sqlite3ExprDeferredDelete(pParse, pExpr) ){ pAggInfo->aFunc[iAgg].pFExpr = pExpr; - sqlite3ExprDeferredDelete(pParse, pExpr); } } } @@ -113974,13 +115892,14 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ case TK_AGG_FUNCTION: { if( (pNC->ncFlags & NC_InAggFunc)==0 && pWalker->walkerDepth==pExpr->op2 + && pExpr->pAggInfo==0 ){ /* Check to see if pExpr is a duplicate of another aggregate ** function that is already in the pAggInfo structure */ struct AggInfo_func *pItem = pAggInfo->aFunc; for(i=0; inFunc; i++, pItem++){ - if( pItem->pFExpr==pExpr ) break; + if( NEVER(pItem->pFExpr==pExpr) ) break; if( sqlite3ExprCompare(0, pItem->pFExpr, pExpr, -1)==0 ){ break; } @@ -113991,14 +115910,44 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ u8 enc = ENC(pParse->db); i = addAggInfoFunc(pParse->db, pAggInfo); if( i>=0 ){ + int nArg; assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); pItem = &pAggInfo->aFunc[i]; pItem->pFExpr = pExpr; assert( ExprUseUToken(pExpr) ); + nArg = pExpr->x.pList ? pExpr->x.pList->nExpr : 0; pItem->pFunc = sqlite3FindFunction(pParse->db, - pExpr->u.zToken, - pExpr->x.pList ? pExpr->x.pList->nExpr : 0, enc, 0); - if( pExpr->flags & EP_Distinct ){ + pExpr->u.zToken, nArg, enc, 0); + assert( pItem->bOBUnique==0 ); + if( pExpr->pLeft + && (pItem->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL)==0 + ){ + /* The NEEDCOLL test above causes any ORDER BY clause on + ** aggregate min() or max() to be ignored. */ + ExprList *pOBList; + assert( nArg>0 ); + assert( pExpr->pLeft->op==TK_ORDER ); + assert( ExprUseXList(pExpr->pLeft) ); + pItem->iOBTab = pParse->nTab++; + pOBList = pExpr->pLeft->x.pList; + assert( pOBList->nExpr>0 ); + assert( pItem->bOBUnique==0 ); + if( pOBList->nExpr==1 + && nArg==1 + && sqlite3ExprCompare(0,pOBList->a[0].pExpr, + pExpr->x.pList->a[0].pExpr,0)==0 + ){ + pItem->bOBPayload = 0; + pItem->bOBUnique = ExprHasProperty(pExpr, EP_Distinct); + }else{ + pItem->bOBPayload = 1; + } + pItem->bUseSubtype = + (pItem->pFunc->funcFlags & SQLITE_SUBTYPE)!=0; + }else{ + pItem->iOBTab = -1; + } + if( ExprHasProperty(pExpr, EP_Distinct) && !pItem->bOBUnique ){ pItem->iDistinct = pParse->nTab++; }else{ pItem->iDistinct = -1; @@ -114634,14 +116583,19 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ /* Verify that constraints are still satisfied */ if( pNew->pCheck!=0 || (pCol->notNull && (pCol->colFlags & COLFLAG_GENERATED)!=0) + || (pTab->tabFlags & TF_Strict)!=0 ){ sqlite3NestedParse(pParse, "SELECT CASE WHEN quick_check GLOB 'CHECK*'" " THEN raise(ABORT,'CHECK constraint failed')" + " WHEN quick_check GLOB 'non-* value in*'" + " THEN raise(ABORT,'type mismatch on DEFAULT')" " ELSE raise(ABORT,'NOT NULL constraint failed')" " END" " FROM pragma_quick_check(%Q,%Q)" - " WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*'", + " WHERE quick_check GLOB 'CHECK*'" + " OR quick_check GLOB 'NULL*'" + " OR quick_check GLOB 'non-* value in*'", zTab, zDb ); } @@ -116445,7 +118399,12 @@ SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, const T if( i==pTab->iPKey ){ sqlite3VdbeAddOp2(v, OP_Null, 0, regOut); }else{ + char aff = pTab->aCol[i].affinity; + if( aff==SQLITE_AFF_REAL ){ + pTab->aCol[i].affinity = SQLITE_AFF_NUMERIC; + } sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, i, regOut); + pTab->aCol[i].affinity = aff; } nField++; } @@ -116756,9 +118715,9 @@ static void openStatTable( typedef struct StatAccum StatAccum; typedef struct StatSample StatSample; struct StatSample { - tRowcnt *anEq; /* sqlite_stat4.nEq */ tRowcnt *anDLt; /* sqlite_stat4.nDLt */ #ifdef SQLITE_ENABLE_STAT4 + tRowcnt *anEq; /* sqlite_stat4.nEq */ tRowcnt *anLt; /* sqlite_stat4.nLt */ union { i64 iRowid; /* Rowid in main table of the key */ @@ -116916,9 +118875,9 @@ static void statInit( /* Allocate the space required for the StatAccum object */ n = sizeof(*p) - + sizeof(tRowcnt)*nColUp /* StatAccum.anEq */ - + sizeof(tRowcnt)*nColUp; /* StatAccum.anDLt */ + + sizeof(tRowcnt)*nColUp; /* StatAccum.anDLt */ #ifdef SQLITE_ENABLE_STAT4 + n += sizeof(tRowcnt)*nColUp; /* StatAccum.anEq */ if( mxSample ){ n += sizeof(tRowcnt)*nColUp /* StatAccum.anLt */ + sizeof(StatSample)*(nCol+mxSample) /* StatAccum.aBest[], a[] */ @@ -116939,9 +118898,9 @@ static void statInit( p->nKeyCol = nKeyCol; p->nSkipAhead = 0; p->current.anDLt = (tRowcnt*)&p[1]; - p->current.anEq = &p->current.anDLt[nColUp]; #ifdef SQLITE_ENABLE_STAT4 + p->current.anEq = &p->current.anDLt[nColUp]; p->mxSample = p->nLimit==0 ? mxSample : 0; if( mxSample ){ u8 *pSpace; /* Allocated space not yet assigned */ @@ -117208,7 +119167,9 @@ static void statPush( if( p->nRow==0 ){ /* This is the first call to this function. Do initialization. */ +#ifdef SQLITE_ENABLE_STAT4 for(i=0; inCol; i++) p->current.anEq[i] = 1; +#endif }else{ /* Second and subsequent calls get processed here */ #ifdef SQLITE_ENABLE_STAT4 @@ -117217,15 +119178,17 @@ static void statPush( /* Update anDLt[], anLt[] and anEq[] to reflect the values that apply ** to the current row of the index. */ +#ifdef SQLITE_ENABLE_STAT4 for(i=0; icurrent.anEq[i]++; } +#endif for(i=iChng; inCol; i++){ p->current.anDLt[i]++; #ifdef SQLITE_ENABLE_STAT4 if( p->mxSample ) p->current.anLt[i] += p->current.anEq[i]; -#endif p->current.anEq[i] = 1; +#endif } } @@ -117359,7 +119322,9 @@ static void statGet( u64 iVal = (p->nRow + nDistinct - 1) / nDistinct; if( iVal==2 && p->nRow*10 <= nDistinct*11 ) iVal = 1; sqlite3_str_appendf(&sStat, " %llu", iVal); - assert( p->current.anEq[i] ); +#ifdef SQLITE_ENABLE_STAT4 + assert( p->current.anEq[i] || p->nRow==0 ); +#endif } sqlite3ResultStrAccum(context, &sStat); } @@ -117543,7 +119508,7 @@ static void analyzeOneTable( for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ int nCol; /* Number of columns in pIdx. "N" */ - int addrRewind; /* Address of "OP_Rewind iIdxCur" */ + int addrGotoEnd; /* Address of "OP_Rewind iIdxCur" */ int addrNextRow; /* Address of "next_row:" */ const char *zIdxName; /* Name of the index */ int nColTest; /* Number of columns to test for changes */ @@ -117567,9 +119532,14 @@ static void analyzeOneTable( /* ** Pseudo-code for loop that calls stat_push(): ** - ** Rewind csr - ** if eof(csr) goto end_of_scan; ** regChng = 0 + ** Rewind csr + ** if eof(csr){ + ** stat_init() with count = 0; + ** goto end_of_scan; + ** } + ** count() + ** stat_init() ** goto chng_addr_0; ** ** next_row: @@ -117608,41 +119578,36 @@ static void analyzeOneTable( sqlite3VdbeSetP4KeyInfo(pParse, pIdx); VdbeComment((v, "%s", pIdx->zName)); - /* Invoke the stat_init() function. The arguments are: + /* Implementation of the following: ** + ** regChng = 0 + ** Rewind csr + ** if eof(csr){ + ** stat_init() with count = 0; + ** goto end_of_scan; + ** } + ** count() + ** stat_init() + ** goto chng_addr_0; + */ + assert( regTemp2==regStat+4 ); + sqlite3VdbeAddOp2(v, OP_Integer, db->nAnalysisLimit, regTemp2); + + /* Arguments to stat_init(): ** (1) the number of columns in the index including the rowid ** (or for a WITHOUT ROWID table, the number of PK columns), ** (2) the number of columns in the key without the rowid/pk - ** (3) estimated number of rows in the index, - */ + ** (3) estimated number of rows in the index. */ sqlite3VdbeAddOp2(v, OP_Integer, nCol, regStat+1); assert( regRowid==regStat+2 ); sqlite3VdbeAddOp2(v, OP_Integer, pIdx->nKeyCol, regRowid); -#ifdef SQLITE_ENABLE_STAT4 - if( OptimizationEnabled(db, SQLITE_Stat4) ){ - sqlite3VdbeAddOp2(v, OP_Count, iIdxCur, regTemp); - addrRewind = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur); - VdbeCoverage(v); - }else -#endif - { - addrRewind = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur); - VdbeCoverage(v); - sqlite3VdbeAddOp3(v, OP_Count, iIdxCur, regTemp, 1); - } - assert( regTemp2==regStat+4 ); - sqlite3VdbeAddOp2(v, OP_Integer, db->nAnalysisLimit, regTemp2); + sqlite3VdbeAddOp3(v, OP_Count, iIdxCur, regTemp, + OptimizationDisabled(db, SQLITE_Stat4)); sqlite3VdbeAddFunctionCall(pParse, 0, regStat+1, regStat, 4, &statInitFuncdef, 0); + addrGotoEnd = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur); + VdbeCoverage(v); - /* Implementation of the following: - ** - ** Rewind csr - ** if eof(csr) goto end_of_scan; - ** regChng = 0 - ** goto next_push_0; - ** - */ sqlite3VdbeAddOp2(v, OP_Integer, 0, regChng); addrNextRow = sqlite3VdbeCurrentAddr(v); @@ -117749,6 +119714,12 @@ static void analyzeOneTable( } /* Add the entry to the stat1 table. */ + if( pIdx->pPartIdxWhere ){ + /* Partial indexes might get a zero-entry in sqlite_stat1. But + ** an empty table is omitted from sqlite_stat1. */ + sqlite3VdbeJumpHere(v, addrGotoEnd); + addrGotoEnd = 0; + } callStatGet(pParse, regStat, STAT_GET_STAT1, regStat1); assert( "BBB"[0]==SQLITE_AFF_TEXT ); sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regTemp, "BBB", 0); @@ -117772,6 +119743,13 @@ static void analyzeOneTable( int addrIsNull; u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound; + /* No STAT4 data is generated if the number of rows is zero */ + if( addrGotoEnd==0 ){ + sqlite3VdbeAddOp2(v, OP_Cast, regStat1, SQLITE_AFF_INTEGER); + addrGotoEnd = sqlite3VdbeAddOp1(v, OP_IfNot, regStat1); + VdbeCoverage(v); + } + if( doOnce ){ int mxCol = nCol; Index *pX; @@ -117824,7 +119802,7 @@ static void analyzeOneTable( #endif /* SQLITE_ENABLE_STAT4 */ /* End of analysis */ - sqlite3VdbeJumpHere(v, addrRewind); + if( addrGotoEnd ) sqlite3VdbeJumpHere(v, addrGotoEnd); } @@ -118048,6 +120026,16 @@ static void decodeIntArray( while( z[0]!=0 && z[0]!=' ' ) z++; while( z[0]==' ' ) z++; } + + /* Set the bLowQual flag if the peak number of rows obtained + ** from a full equality match is so large that a full table scan + ** seems likely to be faster than using the index. + */ + if( aLog[0] > 66 /* Index has more than 100 rows */ + && aLog[0] <= aLog[nOut-1] /* And only a single value seen */ + ){ + pIndex->bLowQual = 1; + } } } @@ -119563,7 +121551,7 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ } sqlite3VdbeAddOp0(v, OP_Halt); -#if SQLITE_USER_AUTHENTICATION +#if SQLITE_USER_AUTHENTICATION && !defined(SQLITE_OMIT_SHARED_CACHE) if( pParse->nTableLock>0 && db->init.busy==0 ){ sqlite3UserAuthInit(db); if( db->auth.authLevelpAinc ) sqlite3AutoincrementBegin(pParse); - /* Code constant expressions that where factored out of inner loops. - ** - ** The pConstExpr list might also contain expressions that we simply - ** want to keep around until the Parse object is deleted. Such - ** expressions have iConstExprReg==0. Do not generate code for - ** those expressions, of course. + /* Code constant expressions that were factored out of inner loops. */ if( pParse->pConstExpr ){ ExprList *pEL = pParse->pConstExpr; pParse->okConstFactor = 0; for(i=0; inExpr; i++){ - int iReg = pEL->a[i].u.iConstExprReg; - sqlite3ExprCode(pParse, pEL->a[i].pExpr, iReg); + assert( pEL->a[i].u.iConstExprReg>0 ); + sqlite3ExprCode(pParse, pEL->a[i].pExpr, pEL->a[i].u.iConstExprReg); } } @@ -120099,7 +122082,7 @@ SQLITE_PRIVATE void sqlite3ColumnSetExpr( */ SQLITE_PRIVATE Expr *sqlite3ColumnExpr(Table *pTab, Column *pCol){ if( pCol->iDflt==0 ) return 0; - if( NEVER(!IsOrdinaryTable(pTab)) ) return 0; + if( !IsOrdinaryTable(pTab) ) return 0; if( NEVER(pTab->u.tab.pDfltList==0) ) return 0; if( NEVER(pTab->u.tab.pDfltList->nExpriDflt) ) return 0; return pTab->u.tab.pDfltList->a[pCol->iDflt-1].pExpr; @@ -120252,6 +122235,9 @@ SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3 *db, Table *pTable){ if( db->pnBytesFreed==0 && (--pTable->nTabRef)>0 ) return; deleteTable(db, pTable); } +SQLITE_PRIVATE void sqlite3DeleteTableGeneric(sqlite3 *db, void *pTable){ + sqlite3DeleteTable(db, (Table*)pTable); +} /* @@ -120786,20 +122772,14 @@ SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){ } #endif -/* -** Name of the special TEMP trigger used to implement RETURNING. The -** name begins with "sqlite_" so that it is guaranteed not to collide -** with any application-generated triggers. -*/ -#define RETURNING_TRIGGER_NAME "sqlite_returning" - /* ** Clean up the data structures associated with the RETURNING clause. */ -static void sqlite3DeleteReturning(sqlite3 *db, Returning *pRet){ +static void sqlite3DeleteReturning(sqlite3 *db, void *pArg){ + Returning *pRet = (Returning*)pArg; Hash *pHash; pHash = &(db->aDb[1].pSchema->trigHash); - sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, 0); + sqlite3HashInsert(pHash, pRet->zName, 0); sqlite3ExprListDelete(db, pRet->pReturnEL); sqlite3DbFree(db, pRet); } @@ -120838,11 +122818,12 @@ SQLITE_PRIVATE void sqlite3AddReturning(Parse *pParse, ExprList *pList){ pParse->u1.pReturning = pRet; pRet->pParse = pParse; pRet->pReturnEL = pList; - sqlite3ParserAddCleanup(pParse, - (void(*)(sqlite3*,void*))sqlite3DeleteReturning, pRet); + sqlite3ParserAddCleanup(pParse, sqlite3DeleteReturning, pRet); testcase( pParse->earlyCleanup ); if( db->mallocFailed ) return; - pRet->retTrig.zName = RETURNING_TRIGGER_NAME; + sqlite3_snprintf(sizeof(pRet->zName), pRet->zName, + "sqlite_returning_%p", pParse); + pRet->retTrig.zName = pRet->zName; pRet->retTrig.op = TK_RETURNING; pRet->retTrig.tr_tm = TRIGGER_AFTER; pRet->retTrig.bReturning = 1; @@ -120853,9 +122834,9 @@ SQLITE_PRIVATE void sqlite3AddReturning(Parse *pParse, ExprList *pList){ pRet->retTStep.pTrig = &pRet->retTrig; pRet->retTStep.pExprList = pList; pHash = &(db->aDb[1].pSchema->trigHash); - assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0 + assert( sqlite3HashFind(pHash, pRet->zName)==0 || pParse->nErr || pParse->ifNotExists ); - if( sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, &pRet->retTrig) + if( sqlite3HashInsert(pHash, pRet->zName, &pRet->retTrig) ==&pRet->retTrig ){ sqlite3OomFault(db); } @@ -121036,7 +123017,8 @@ SQLITE_PRIVATE char sqlite3AffinityType(const char *zIn, Column *pCol){ assert( zIn!=0 ); while( zIn[0] ){ - h = (h<<8) + sqlite3UpperToLower[(*zIn)&0xff]; + u8 x = *(u8*)zIn; + h = (h<<8) + sqlite3UpperToLower[x]; zIn++; if( h==(('c'<<24)+('h'<<16)+('a'<<8)+'r') ){ /* CHAR */ aff = SQLITE_AFF_TEXT; @@ -122208,20 +124190,20 @@ SQLITE_PRIVATE void sqlite3EndTable( int regRowid; /* Rowid of the next row to insert */ int addrInsLoop; /* Top of the loop for inserting rows */ Table *pSelTab; /* A table that describes the SELECT results */ + int iCsr; /* Write cursor on the new table */ if( IN_SPECIAL_PARSE ){ pParse->rc = SQLITE_ERROR; pParse->nErr++; return; } + iCsr = pParse->nTab++; regYield = ++pParse->nMem; regRec = ++pParse->nMem; regRowid = ++pParse->nMem; - assert(pParse->nTab==1); sqlite3MayAbort(pParse); - sqlite3VdbeAddOp3(v, OP_OpenWrite, 1, pParse->regRoot, iDb); + sqlite3VdbeAddOp3(v, OP_OpenWrite, iCsr, pParse->regRoot, iDb); sqlite3VdbeChangeP5(v, OPFLAG_P2ISREG); - pParse->nTab = 2; addrTop = sqlite3VdbeCurrentAddr(v) + 1; sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop); if( pParse->nErr ) return; @@ -122242,11 +124224,11 @@ SQLITE_PRIVATE void sqlite3EndTable( VdbeCoverage(v); sqlite3VdbeAddOp3(v, OP_MakeRecord, dest.iSdst, dest.nSdst, regRec); sqlite3TableAffinity(v, p, 0); - sqlite3VdbeAddOp2(v, OP_NewRowid, 1, regRowid); - sqlite3VdbeAddOp3(v, OP_Insert, 1, regRec, regRowid); + sqlite3VdbeAddOp2(v, OP_NewRowid, iCsr, regRowid); + sqlite3VdbeAddOp3(v, OP_Insert, iCsr, regRec, regRowid); sqlite3VdbeGoto(v, addrInsLoop); sqlite3VdbeJumpHere(v, addrInsLoop); - sqlite3VdbeAddOp1(v, OP_Close, 1); + sqlite3VdbeAddOp1(v, OP_Close, iCsr); } /* Compute the complete text of the CREATE statement */ @@ -122299,6 +124281,14 @@ SQLITE_PRIVATE void sqlite3EndTable( /* Reparse everything to update our internal data structures */ sqlite3VdbeAddParseSchemaOp(v, iDb, sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName),0); + + /* Test for cycles in generated columns and illegal expressions + ** in CHECK constraints and in DEFAULT clauses. */ + if( p->tabFlags & TF_HasGenerated ){ + sqlite3VdbeAddOp4(v, OP_SqlExec, 0x0001, 0, 0, + sqlite3MPrintf(db, "SELECT*FROM\"%w\".\"%w\"", + db->aDb[iDb].zDbSName, p->zName), P4_DYNAMIC); + } } /* Add the table to the in-memory representation of the database. @@ -122375,9 +124365,12 @@ SQLITE_PRIVATE void sqlite3CreateView( ** on a view, even though views do not have rowids. The following flag ** setting fixes this problem. But the fix can be disabled by compiling ** with -DSQLITE_ALLOW_ROWID_IN_VIEW in case there are legacy apps that - ** depend upon the old buggy behavior. */ -#ifndef SQLITE_ALLOW_ROWID_IN_VIEW - p->tabFlags |= TF_NoVisibleRowid; + ** depend upon the old buggy behavior. The ability can also be toggled + ** using sqlite3_config(SQLITE_CONFIG_ROWID_IN_VIEW,...) */ +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + p->tabFlags |= sqlite3Config.mNoVisibleRowid; /* Optional. Allow by default */ +#else + p->tabFlags |= TF_NoVisibleRowid; /* Never allow rowid in view */ #endif sqlite3TwoPartName(pParse, pName1, pName2, &pName); @@ -124890,7 +126883,7 @@ SQLITE_PRIVATE void sqlite3Reindex(Parse *pParse, Token *pName1, Token *pName2){ if( iDb<0 ) return; z = sqlite3NameFromToken(db, pObjName); if( z==0 ) return; - zDb = db->aDb[iDb].zDbSName; + zDb = pName2->n ? db->aDb[iDb].zDbSName : 0; pTab = sqlite3FindTable(db, z, zDb); if( pTab ){ reindexTable(pParse, pTab, 0); @@ -124900,6 +126893,7 @@ SQLITE_PRIVATE void sqlite3Reindex(Parse *pParse, Token *pName1, Token *pName2){ pIndex = sqlite3FindIndex(db, z, zDb); sqlite3DbFree(db, z); if( pIndex ){ + iDb = sqlite3SchemaToIndex(db, pIndex->pTable->pSchema); sqlite3BeginWriteOperation(pParse, 0, iDb); sqlite3RefillIndex(pParse, pIndex, -1); return; @@ -125065,6 +127059,9 @@ SQLITE_PRIVATE void sqlite3WithDelete(sqlite3 *db, With *pWith){ sqlite3DbFree(db, pWith); } } +SQLITE_PRIVATE void sqlite3WithDeleteGeneric(sqlite3 *db, void *pWith){ + sqlite3WithDelete(db, (With*)pWith); +} #endif /* !defined(SQLITE_OMIT_CTE) */ /************** End of build.c ***********************************************/ @@ -127746,13 +129743,13 @@ SQLITE_PRIVATE void sqlite3QuoteValue(StrAccum *pStr, sqlite3_value *pValue){ double r1, r2; const char *zVal; r1 = sqlite3_value_double(pValue); - sqlite3_str_appendf(pStr, "%!.15g", r1); + sqlite3_str_appendf(pStr, "%!0.15g", r1); zVal = sqlite3_str_value(pStr); if( zVal ){ sqlite3AtoF(zVal, &r2, pStr->nChar, SQLITE_UTF8); if( r1!=r2 ){ sqlite3_str_reset(pStr); - sqlite3_str_appendf(pStr, "%!.20e", r1); + sqlite3_str_appendf(pStr, "%!0.20e", r1); } } break; @@ -127901,7 +129898,8 @@ static void hexFunc( *(z++) = hexdigits[c&0xf]; } *z = 0; - sqlite3_result_text(context, zHex, n*2, sqlite3_free); + sqlite3_result_text64(context, zHex, (u64)(z-zHex), + sqlite3_free, SQLITE_UTF8); } } @@ -128053,7 +130051,7 @@ static void replaceFunc( } if( zPattern[0]==0 ){ assert( sqlite3_value_type(argv[1])!=SQLITE_NULL ); - sqlite3_result_value(context, argv[0]); + sqlite3_result_text(context, (const char*)zStr, nStr, SQLITE_TRANSIENT); return; } nPattern = sqlite3_value_bytes(argv[1]); @@ -128195,6 +130193,81 @@ static void trimFunc( sqlite3_result_text(context, (char*)zIn, nIn, SQLITE_TRANSIENT); } +/* The core implementation of the CONCAT(...) and CONCAT_WS(SEP,...) +** functions. +** +** Return a string value that is the concatenation of all non-null +** entries in argv[]. Use zSep as the separator. +*/ +static void concatFuncCore( + sqlite3_context *context, + int argc, + sqlite3_value **argv, + int nSep, + const char *zSep +){ + i64 j, k, n = 0; + int i; + char *z; + for(i=0; i0 ){ + const char *v = (const char*)sqlite3_value_text(argv[i]); + if( v!=0 ){ + if( j>0 && nSep>0 ){ + memcpy(&z[j], zSep, nSep); + j += nSep; + } + memcpy(&z[j], v, k); + j += k; + } + } + } + z[j] = 0; + assert( j<=n ); + sqlite3_result_text64(context, z, j, sqlite3_free, SQLITE_UTF8); +} + +/* +** The CONCAT(...) function. Generate a string result that is the +** concatentation of all non-null arguments. +*/ +static void concatFunc( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + concatFuncCore(context, argc, argv, 0, ""); +} + +/* +** The CONCAT_WS(separator, ...) function. +** +** Generate a string that is the concatenation of 2nd through the Nth +** argument. Use the first argument (which must be non-NULL) as the +** separator. +*/ +static void concatwsFunc( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + int nSep = sqlite3_value_bytes(argv[0]); + const char *zSep = (const char*)sqlite3_value_text(argv[0]); + if( zSep==0 ) return; + concatFuncCore(context, argc-1, argv+1, nSep, zSep); +} + #ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION /* @@ -128461,7 +130534,7 @@ static void sumFinalize(sqlite3_context *context){ if( p->approx ){ if( p->ovrfl ){ sqlite3_result_error(context,"integer overflow",-1); - }else if( !sqlite3IsNaN(p->rErr) ){ + }else if( !sqlite3IsOverflow(p->rErr) ){ sqlite3_result_double(context, p->rSum+p->rErr); }else{ sqlite3_result_double(context, p->rSum); @@ -128478,7 +130551,7 @@ static void avgFinalize(sqlite3_context *context){ double r; if( p->approx ){ r = p->rSum; - if( !sqlite3IsNaN(p->rErr) ) r += p->rErr; + if( !sqlite3IsOverflow(p->rErr) ) r += p->rErr; }else{ r = (double)(p->iSum); } @@ -128492,7 +130565,7 @@ static void totalFinalize(sqlite3_context *context){ if( p ){ if( p->approx ){ r = p->rSum; - if( !sqlite3IsNaN(p->rErr) ) r += p->rErr; + if( !sqlite3IsOverflow(p->rErr) ) r += p->rErr; }else{ r = (double)(p->iSum); } @@ -128616,6 +130689,7 @@ static void minMaxFinalize(sqlite3_context *context){ /* ** group_concat(EXPR, ?SEPARATOR?) +** string_agg(EXPR, SEPARATOR) ** ** The SEPARATOR goes before the EXPR string. This is tragic. The ** groupConcatInverse() implementation would have been easier if the @@ -129206,6 +131280,11 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){ FUNCTION(hex, 1, 0, 0, hexFunc ), FUNCTION(unhex, 1, 0, 0, unhexFunc ), FUNCTION(unhex, 2, 0, 0, unhexFunc ), + FUNCTION(concat, -1, 0, 0, concatFunc ), + FUNCTION(concat, 0, 0, 0, 0 ), + FUNCTION(concat_ws, -1, 0, 0, concatwsFunc ), + FUNCTION(concat_ws, 0, 0, 0, 0 ), + FUNCTION(concat_ws, 1, 0, 0, 0 ), INLINE_FUNC(ifnull, 2, INLINEFUNC_coalesce, 0 ), VFUNCTION(random, 0, 0, 0, randomFunc ), VFUNCTION(randomblob, 1, 0, 0, randomBlob ), @@ -129235,6 +131314,8 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){ groupConcatFinalize, groupConcatValue, groupConcatInverse, 0), WAGGREGATE(group_concat, 2, 0, 0, groupConcatStep, groupConcatFinalize, groupConcatValue, groupConcatInverse, 0), + WAGGREGATE(string_agg, 2, 0, 0, groupConcatStep, + groupConcatFinalize, groupConcatValue, groupConcatInverse, 0), LIKEFUNC(glob, 2, &globInfo, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE), #ifdef SQLITE_CASE_SENSITIVE_LIKE @@ -130177,6 +132258,7 @@ static int isSetNullAction(Parse *pParse, FKey *pFKey){ if( (p==pFKey->apTrigger[0] && pFKey->aAction[0]==OE_SetNull) || (p==pFKey->apTrigger[1] && pFKey->aAction[1]==OE_SetNull) ){ + assert( (pTop->db->flags & SQLITE_FkNoAction)==0 ); return 1; } } @@ -130371,6 +132453,8 @@ SQLITE_PRIVATE void sqlite3FkCheck( } if( regOld!=0 ){ int eAction = pFKey->aAction[aChange!=0]; + if( (db->flags & SQLITE_FkNoAction) ) eAction = OE_None; + fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regOld, 1); /* If this is a deferred FK constraint, or a CASCADE or SET NULL ** action applies, then any foreign key violations caused by @@ -130486,7 +132570,11 @@ SQLITE_PRIVATE int sqlite3FkRequired( /* Check if any parent key columns are being modified. */ for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){ if( fkParentIsModified(pTab, p, aChange, chngRowid) ){ - if( p->aAction[1]!=OE_None ) return 2; + if( (pParse->db->flags & SQLITE_FkNoAction)==0 + && p->aAction[1]!=OE_None + ){ + return 2; + } bHaveFK = 1; } } @@ -130536,6 +132624,7 @@ static Trigger *fkActionTrigger( int iAction = (pChanges!=0); /* 1 for UPDATE, 0 for DELETE */ action = pFKey->aAction[iAction]; + if( (db->flags & SQLITE_FkNoAction) ) action = OE_None; if( action==OE_Restrict && (db->flags & SQLITE_DeferFKs) ){ return 0; } @@ -131373,6 +133462,195 @@ SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse){ # define autoIncStep(A,B,C) #endif /* SQLITE_OMIT_AUTOINCREMENT */ +/* +** If argument pVal is a Select object returned by an sqlite3MultiValues() +** that was able to use the co-routine optimization, finish coding the +** co-routine. +*/ +SQLITE_PRIVATE void sqlite3MultiValuesEnd(Parse *pParse, Select *pVal){ + if( ALWAYS(pVal) && pVal->pSrc->nSrc>0 ){ + SrcItem *pItem = &pVal->pSrc->a[0]; + sqlite3VdbeEndCoroutine(pParse->pVdbe, pItem->regReturn); + sqlite3VdbeJumpHere(pParse->pVdbe, pItem->addrFillSub - 1); + } +} + +/* +** Return true if all expressions in the expression-list passed as the +** only argument are constant. +*/ +static int exprListIsConstant(Parse *pParse, ExprList *pRow){ + int ii; + for(ii=0; iinExpr; ii++){ + if( 0==sqlite3ExprIsConstant(pParse, pRow->a[ii].pExpr) ) return 0; + } + return 1; +} + +/* +** Return true if all expressions in the expression-list passed as the +** only argument are both constant and have no affinity. +*/ +static int exprListIsNoAffinity(Parse *pParse, ExprList *pRow){ + int ii; + if( exprListIsConstant(pParse,pRow)==0 ) return 0; + for(ii=0; iinExpr; ii++){ + Expr *pExpr = pRow->a[ii].pExpr; + assert( pExpr->op!=TK_RAISE ); + assert( pExpr->affExpr==0 ); + if( 0!=sqlite3ExprAffinity(pExpr) ) return 0; + } + return 1; + +} + +/* +** This function is called by the parser for the second and subsequent +** rows of a multi-row VALUES clause. Argument pLeft is the part of +** the VALUES clause already parsed, argument pRow is the vector of values +** for the new row. The Select object returned represents the complete +** VALUES clause, including the new row. +** +** There are two ways in which this may be achieved - by incremental +** coding of a co-routine (the "co-routine" method) or by returning a +** Select object equivalent to the following (the "UNION ALL" method): +** +** "pLeft UNION ALL SELECT pRow" +** +** If the VALUES clause contains a lot of rows, this compound Select +** object may consume a lot of memory. +** +** When the co-routine method is used, each row that will be returned +** by the VALUES clause is coded into part of a co-routine as it is +** passed to this function. The returned Select object is equivalent to: +** +** SELECT * FROM ( +** Select object to read co-routine +** ) +** +** The co-routine method is used in most cases. Exceptions are: +** +** a) If the current statement has a WITH clause. This is to avoid +** statements like: +** +** WITH cte AS ( VALUES('x'), ('y') ... ) +** SELECT * FROM cte AS a, cte AS b; +** +** This will not work, as the co-routine uses a hard-coded register +** for its OP_Yield instructions, and so it is not possible for two +** cursors to iterate through it concurrently. +** +** b) The schema is currently being parsed (i.e. the VALUES clause is part +** of a schema item like a VIEW or TRIGGER). In this case there is no VM +** being generated when parsing is taking place, and so generating +** a co-routine is not possible. +** +** c) There are non-constant expressions in the VALUES clause (e.g. +** the VALUES clause is part of a correlated sub-query). +** +** d) One or more of the values in the first row of the VALUES clause +** has an affinity (i.e. is a CAST expression). This causes problems +** because the complex rules SQLite uses (see function +** sqlite3SubqueryColumnTypes() in select.c) to determine the effective +** affinity of such a column for all rows require access to all values in +** the column simultaneously. +*/ +SQLITE_PRIVATE Select *sqlite3MultiValues(Parse *pParse, Select *pLeft, ExprList *pRow){ + + if( pParse->bHasWith /* condition (a) above */ + || pParse->db->init.busy /* condition (b) above */ + || exprListIsConstant(pParse,pRow)==0 /* condition (c) above */ + || (pLeft->pSrc->nSrc==0 && + exprListIsNoAffinity(pParse,pLeft->pEList)==0) /* condition (d) above */ + || IN_SPECIAL_PARSE + ){ + /* The co-routine method cannot be used. Fall back to UNION ALL. */ + Select *pSelect = 0; + int f = SF_Values | SF_MultiValue; + if( pLeft->pSrc->nSrc ){ + sqlite3MultiValuesEnd(pParse, pLeft); + f = SF_Values; + }else if( pLeft->pPrior ){ + /* In this case set the SF_MultiValue flag only if it was set on pLeft */ + f = (f & pLeft->selFlags); + } + pSelect = sqlite3SelectNew(pParse, pRow, 0, 0, 0, 0, 0, f, 0); + pLeft->selFlags &= ~SF_MultiValue; + if( pSelect ){ + pSelect->op = TK_ALL; + pSelect->pPrior = pLeft; + pLeft = pSelect; + } + }else{ + SrcItem *p = 0; /* SrcItem that reads from co-routine */ + + if( pLeft->pSrc->nSrc==0 ){ + /* Co-routine has not yet been started and the special Select object + ** that accesses the co-routine has not yet been created. This block + ** does both those things. */ + Vdbe *v = sqlite3GetVdbe(pParse); + Select *pRet = sqlite3SelectNew(pParse, 0, 0, 0, 0, 0, 0, 0, 0); + + /* Ensure the database schema has been read. This is to ensure we have + ** the correct text encoding. */ + if( (pParse->db->mDbFlags & DBFLAG_SchemaKnownOk)==0 ){ + sqlite3ReadSchema(pParse); + } + + if( pRet ){ + SelectDest dest; + pRet->pSrc->nSrc = 1; + pRet->pPrior = pLeft->pPrior; + pRet->op = pLeft->op; + pLeft->pPrior = 0; + pLeft->op = TK_SELECT; + assert( pLeft->pNext==0 ); + assert( pRet->pNext==0 ); + p = &pRet->pSrc->a[0]; + p->pSelect = pLeft; + p->fg.viaCoroutine = 1; + p->addrFillSub = sqlite3VdbeCurrentAddr(v) + 1; + p->regReturn = ++pParse->nMem; + p->iCursor = -1; + p->u1.nRow = 2; + sqlite3VdbeAddOp3(v,OP_InitCoroutine,p->regReturn,0,p->addrFillSub); + sqlite3SelectDestInit(&dest, SRT_Coroutine, p->regReturn); + + /* Allocate registers for the output of the co-routine. Do so so + ** that there are two unused registers immediately before those + ** used by the co-routine. This allows the code in sqlite3Insert() + ** to use these registers directly, instead of copying the output + ** of the co-routine to a separate array for processing. */ + dest.iSdst = pParse->nMem + 3; + dest.nSdst = pLeft->pEList->nExpr; + pParse->nMem += 2 + dest.nSdst; + + pLeft->selFlags |= SF_MultiValue; + sqlite3Select(pParse, pLeft, &dest); + p->regResult = dest.iSdst; + assert( pParse->nErr || dest.iSdst>0 ); + pLeft = pRet; + } + }else{ + p = &pLeft->pSrc->a[0]; + assert( !p->fg.isTabFunc && !p->fg.isIndexedBy ); + p->u1.nRow++; + } + + if( pParse->nErr==0 ){ + assert( p!=0 ); + if( p->pSelect->pEList->nExpr!=pRow->nExpr ){ + sqlite3SelectWrongNumTermsError(pParse, p->pSelect); + }else{ + sqlite3ExprCodeExprList(pParse, pRow, p->regResult, 0, 0); + sqlite3VdbeAddOp1(pParse->pVdbe, OP_Yield, p->regReturn); + } + } + sqlite3ExprListDelete(pParse->db, pRow); + } + + return pLeft; +} /* Forward declaration */ static int xferOptimization( @@ -131709,25 +133987,40 @@ SQLITE_PRIVATE void sqlite3Insert( if( pSelect ){ /* Data is coming from a SELECT or from a multi-row VALUES clause. ** Generate a co-routine to run the SELECT. */ - int regYield; /* Register holding co-routine entry-point */ - int addrTop; /* Top of the co-routine */ int rc; /* Result code */ - regYield = ++pParse->nMem; - addrTop = sqlite3VdbeCurrentAddr(v) + 1; - sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop); - sqlite3SelectDestInit(&dest, SRT_Coroutine, regYield); - dest.iSdst = bIdListInOrder ? regData : 0; - dest.nSdst = pTab->nCol; - rc = sqlite3Select(pParse, pSelect, &dest); - regFromSelect = dest.iSdst; - assert( db->pParse==pParse ); - if( rc || pParse->nErr ) goto insert_cleanup; - assert( db->mallocFailed==0 ); - sqlite3VdbeEndCoroutine(v, regYield); - sqlite3VdbeJumpHere(v, addrTop - 1); /* label B: */ - assert( pSelect->pEList ); - nColumn = pSelect->pEList->nExpr; + if( pSelect->pSrc->nSrc==1 + && pSelect->pSrc->a[0].fg.viaCoroutine + && pSelect->pPrior==0 + ){ + SrcItem *pItem = &pSelect->pSrc->a[0]; + dest.iSDParm = pItem->regReturn; + regFromSelect = pItem->regResult; + nColumn = pItem->pSelect->pEList->nExpr; + ExplainQueryPlan((pParse, 0, "SCAN %S", pItem)); + if( bIdListInOrder && nColumn==pTab->nCol ){ + regData = regFromSelect; + regRowid = regData - 1; + regIns = regRowid - (IsVirtual(pTab) ? 1 : 0); + } + }else{ + int addrTop; /* Top of the co-routine */ + int regYield = ++pParse->nMem; + addrTop = sqlite3VdbeCurrentAddr(v) + 1; + sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop); + sqlite3SelectDestInit(&dest, SRT_Coroutine, regYield); + dest.iSdst = bIdListInOrder ? regData : 0; + dest.nSdst = pTab->nCol; + rc = sqlite3Select(pParse, pSelect, &dest); + regFromSelect = dest.iSdst; + assert( db->pParse==pParse ); + if( rc || pParse->nErr ) goto insert_cleanup; + assert( db->mallocFailed==0 ); + sqlite3VdbeEndCoroutine(v, regYield); + sqlite3VdbeJumpHere(v, addrTop - 1); /* label B: */ + assert( pSelect->pEList ); + nColumn = pSelect->pEList->nExpr; + } /* Set useTempTable to TRUE if the result of the SELECT statement ** should be written into a temporary table (template 4). Set to @@ -131882,7 +134175,7 @@ SQLITE_PRIVATE void sqlite3Insert( pNx->iDataCur = iDataCur; pNx->iIdxCur = iIdxCur; if( pNx->pUpsertTarget ){ - if( sqlite3UpsertAnalyzeTarget(pParse, pTabList, pNx) ){ + if( sqlite3UpsertAnalyzeTarget(pParse, pTabList, pNx, pUpsert) ){ goto insert_cleanup; } } @@ -133774,7 +136067,10 @@ static int xferOptimization( } } #ifndef SQLITE_OMIT_CHECK - if( pDest->pCheck && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) ){ + if( pDest->pCheck + && (db->mDbFlags & DBFLAG_Vacuum)==0 + && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) + ){ return 0; /* Tables have different CHECK constraints. Ticket #2252 */ } #endif @@ -134491,6 +136787,9 @@ struct sqlite3_api_routines { int (*is_interrupted)(sqlite3*); /* Version 3.43.0 and later */ int (*stmt_explain)(sqlite3_stmt*,int); + /* Version 3.44.0 and later */ + void *(*get_clientdata)(sqlite3*,const char*); + int (*set_clientdata)(sqlite3*, const char*, void*, void(*)(void*)); }; /* @@ -134821,6 +137120,9 @@ typedef int (*sqlite3_loadext_entry)( #define sqlite3_is_interrupted sqlite3_api->is_interrupted /* Version 3.43.0 and later */ #define sqlite3_stmt_explain sqlite3_api->stmt_explain +/* Version 3.44.0 and later */ +#define sqlite3_get_clientdata sqlite3_api->get_clientdata +#define sqlite3_set_clientdata sqlite3_api->set_clientdata #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) @@ -135339,7 +137641,10 @@ static const sqlite3_api_routines sqlite3Apis = { /* Version 3.41.0 and later */ sqlite3_is_interrupted, /* Version 3.43.0 and later */ - sqlite3_stmt_explain + sqlite3_stmt_explain, + /* Version 3.44.0 and later */ + sqlite3_get_clientdata, + sqlite3_set_clientdata }; /* True if x is the directory separator character @@ -135555,6 +137860,9 @@ SQLITE_PRIVATE void sqlite3CloseExtensions(sqlite3 *db){ ** default so as not to open security holes in older applications. */ SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; +#endif sqlite3_mutex_enter(db->mutex); if( onoff ){ db->flags |= SQLITE_LoadExtension|SQLITE_LoadExtFunc; @@ -135604,6 +137912,9 @@ SQLITE_API int sqlite3_auto_extension( void (*xInit)(void) ){ int rc = SQLITE_OK; +#ifdef SQLITE_ENABLE_API_ARMOR + if( xInit==0 ) return SQLITE_MISUSE_BKPT; +#endif #ifndef SQLITE_OMIT_AUTOINIT rc = sqlite3_initialize(); if( rc ){ @@ -135656,6 +137967,9 @@ SQLITE_API int sqlite3_cancel_auto_extension( int i; int n = 0; wsdAutoextInit; +#ifdef SQLITE_ENABLE_API_ARMOR + if( xInit==0 ) return 0; +#endif sqlite3_mutex_enter(mutex); for(i=(int)wsdAutoext.nExt-1; i>=0; i--){ if( wsdAutoext.aExt[i]==xInit ){ @@ -136431,6 +138745,34 @@ static const PragmaName aPragmaName[] = { /************** End of pragma.h **********************************************/ /************** Continuing where we left off in pragma.c *********************/ +/* +** When the 0x10 bit of PRAGMA optimize is set, any ANALYZE commands +** will be run with an analysis_limit set to the lessor of the value of +** the following macro or to the actual analysis_limit if it is non-zero, +** in order to prevent PRAGMA optimize from running for too long. +** +** The value of 2000 is chosen emperically so that the worst-case run-time +** for PRAGMA optimize does not exceed 100 milliseconds against a variety +** of test databases on a RaspberryPI-4 compiled using -Os and without +** -DSQLITE_DEBUG. Of course, your mileage may vary. For the purpose of +** this paragraph, "worst-case" means that ANALYZE ends up being +** run on every table in the database. The worst case typically only +** happens if PRAGMA optimize is run on a database file for which ANALYZE +** has not been previously run and the 0x10000 flag is included so that +** all tables are analyzed. The usual case for PRAGMA optimize is that +** no ANALYZE commands will be run at all, or if any ANALYZE happens it +** will be against a single table, so that expected timing for PRAGMA +** optimize on a PI-4 is more like 1 millisecond or less with the 0x10000 +** flag or less than 100 microseconds without the 0x10000 flag. +** +** An analysis limit of 2000 is almost always sufficient for the query +** planner to fully characterize an index. The additional accuracy from +** a larger analysis is not usually helpful. +*/ +#ifndef SQLITE_DEFAULT_OPTIMIZE_LIMIT +# define SQLITE_DEFAULT_OPTIMIZE_LIMIT 2000 +#endif + /* ** Interpret the given string as a safety level. Return 0 for OFF, ** 1 for ON or NORMAL, 2 for FULL, and 3 for EXTRA. Return 1 for an empty or @@ -137525,7 +139867,11 @@ SQLITE_PRIVATE void sqlite3Pragma( #endif if( sqlite3GetBoolean(zRight, 0) ){ - db->flags |= mask; + if( (mask & SQLITE_WriteSchema)==0 + || (db->flags & SQLITE_Defensive)==0 + ){ + db->flags |= mask; + } }else{ db->flags &= ~mask; if( mask==SQLITE_DeferFKs ) db->nDeferredImmCons = 0; @@ -138072,7 +140418,7 @@ SQLITE_PRIVATE void sqlite3Pragma( /* Set the maximum error count */ mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX; if( zRight ){ - if( sqlite3GetInt32(zRight, &mxErr) ){ + if( sqlite3GetInt32(pValue->z, &mxErr) ){ if( mxErr<=0 ){ mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX; } @@ -138089,7 +140435,6 @@ SQLITE_PRIVATE void sqlite3Pragma( Hash *pTbls; /* Set of all tables in the schema */ int *aRoot; /* Array of root page numbers of all btrees */ int cnt = 0; /* Number of entries in aRoot[] */ - int mxIdx = 0; /* Maximum number of indexes for any table */ if( OMIT_TEMPDB && i==1 ) continue; if( iDb>=0 && i!=iDb ) continue; @@ -138111,7 +140456,6 @@ SQLITE_PRIVATE void sqlite3Pragma( if( pObjTab && pObjTab!=pTab ) continue; if( HasRowid(pTab) ) cnt++; for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ cnt++; } - if( nIdx>mxIdx ) mxIdx = nIdx; } if( cnt==0 ) continue; if( pObjTab ) cnt++; @@ -138131,11 +140475,11 @@ SQLITE_PRIVATE void sqlite3Pragma( aRoot[0] = cnt; /* Make sure sufficient number of registers have been allocated */ - sqlite3TouchRegister(pParse, 8+mxIdx); + sqlite3TouchRegister(pParse, 8+cnt); sqlite3ClearTempRegCache(pParse); /* Do the b-tree integrity checks */ - sqlite3VdbeAddOp4(v, OP_IntegrityCk, 2, cnt, 1, (char*)aRoot,P4_INTARRAY); + sqlite3VdbeAddOp4(v, OP_IntegrityCk, 1, cnt, 8, (char*)aRoot,P4_INTARRAY); sqlite3VdbeChangeP5(v, (u8)i); addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2); VdbeCoverage(v); sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, @@ -138145,6 +140489,36 @@ SQLITE_PRIVATE void sqlite3Pragma( integrityCheckResultRow(v); sqlite3VdbeJumpHere(v, addr); + /* Check that the indexes all have the right number of rows */ + cnt = pObjTab ? 1 : 0; + sqlite3VdbeLoadString(v, 2, "wrong # of entries in index "); + for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){ + int iTab = 0; + Table *pTab = sqliteHashData(x); + Index *pIdx; + if( pObjTab && pObjTab!=pTab ) continue; + if( HasRowid(pTab) ){ + iTab = cnt++; + }else{ + iTab = cnt; + for(pIdx=pTab->pIndex; ALWAYS(pIdx); pIdx=pIdx->pNext){ + if( IsPrimaryKeyIndex(pIdx) ) break; + iTab++; + } + } + for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ + if( pIdx->pPartIdxWhere==0 ){ + addr = sqlite3VdbeAddOp3(v, OP_Eq, 8+cnt, 0, 8+iTab); + VdbeCoverageNeverNull(v); + sqlite3VdbeLoadString(v, 4, pIdx->zName); + sqlite3VdbeAddOp3(v, OP_Concat, 4, 2, 3); + integrityCheckResultRow(v); + sqlite3VdbeJumpHere(v, addr); + } + cnt++; + } + } + /* Make sure all the indices are constructed correctly. */ for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){ @@ -138158,8 +140532,8 @@ SQLITE_PRIVATE void sqlite3Pragma( int r2; /* Previous key for WITHOUT ROWID tables */ int mxCol; /* Maximum non-virtual column number */ - if( !IsOrdinaryTable(pTab) ) continue; if( pObjTab && pObjTab!=pTab ) continue; + if( !IsOrdinaryTable(pTab) ) continue; if( isQuick || HasRowid(pTab) ){ pPk = 0; r2 = 0; @@ -138294,6 +140668,7 @@ SQLITE_PRIVATE void sqlite3Pragma( ** is REAL, we have to load the actual data using OP_Column ** to reliably determine if the value is a NULL. */ sqlite3VdbeAddOp3(v, OP_Column, p1, p3, 3); + sqlite3ColumnDefault(v, pTab, j, 3); jmp3 = sqlite3VdbeAddOp2(v, OP_NotNull, 3, labelOk); VdbeCoverage(v); } @@ -138467,23 +140842,43 @@ SQLITE_PRIVATE void sqlite3Pragma( } sqlite3VdbeAddOp2(v, OP_Next, iDataCur, loopTop); VdbeCoverage(v); sqlite3VdbeJumpHere(v, loopTop-1); - if( !isQuick ){ - sqlite3VdbeLoadString(v, 2, "wrong # of entries in index "); - for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){ - if( pPk==pIdx ) continue; - sqlite3VdbeAddOp2(v, OP_Count, iIdxCur+j, 3); - addr = sqlite3VdbeAddOp3(v, OP_Eq, 8+j, 0, 3); VdbeCoverage(v); - sqlite3VdbeChangeP5(v, SQLITE_NOTNULL); - sqlite3VdbeLoadString(v, 4, pIdx->zName); - sqlite3VdbeAddOp3(v, OP_Concat, 4, 2, 3); - integrityCheckResultRow(v); - sqlite3VdbeJumpHere(v, addr); - } - if( pPk ){ - sqlite3ReleaseTempRange(pParse, r2, pPk->nKeyCol); - } + if( pPk ){ + assert( !isQuick ); + sqlite3ReleaseTempRange(pParse, r2, pPk->nKeyCol); } } + +#ifndef SQLITE_OMIT_VIRTUALTABLE + /* Second pass to invoke the xIntegrity method on all virtual + ** tables. + */ + for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){ + Table *pTab = sqliteHashData(x); + sqlite3_vtab *pVTab; + int a1; + if( pObjTab && pObjTab!=pTab ) continue; + if( IsOrdinaryTable(pTab) ) continue; + if( !IsVirtual(pTab) ) continue; + if( pTab->nCol<=0 ){ + const char *zMod = pTab->u.vtab.azArg[0]; + if( sqlite3HashFind(&db->aModule, zMod)==0 ) continue; + } + sqlite3ViewGetColumnNames(pParse, pTab); + if( pTab->u.vtab.p==0 ) continue; + pVTab = pTab->u.vtab.p->pVtab; + if( NEVER(pVTab==0) ) continue; + if( NEVER(pVTab->pModule==0) ) continue; + if( pVTab->pModule->iVersion<4 ) continue; + if( pVTab->pModule->xIntegrity==0 ) continue; + sqlite3VdbeAddOp3(v, OP_VCheck, i, 3, isQuick); + pTab->nTabRef++; + sqlite3VdbeAppendP4(v, pTab, P4_TABLEREF); + a1 = sqlite3VdbeAddOp1(v, OP_IsNull, 3); VdbeCoverage(v); + integrityCheckResultRow(v); + sqlite3VdbeJumpHere(v, a1); + continue; + } +#endif } { static const int iLn = VDBE_OFFSET_LINENO(2); @@ -138747,44 +141142,63 @@ SQLITE_PRIVATE void sqlite3Pragma( ** ** The optional argument is a bitmask of optimizations to perform: ** - ** 0x0001 Debugging mode. Do not actually perform any optimizations - ** but instead return one line of text for each optimization - ** that would have been done. Off by default. + ** 0x00001 Debugging mode. Do not actually perform any optimizations + ** but instead return one line of text for each optimization + ** that would have been done. Off by default. ** - ** 0x0002 Run ANALYZE on tables that might benefit. On by default. - ** See below for additional information. + ** 0x00002 Run ANALYZE on tables that might benefit. On by default. + ** See below for additional information. ** - ** 0x0004 (Not yet implemented) Record usage and performance - ** information from the current session in the - ** database file so that it will be available to "optimize" - ** pragmas run by future database connections. + ** 0x00010 Run all ANALYZE operations using an analysis_limit that + ** is the lessor of the current analysis_limit and the + ** SQLITE_DEFAULT_OPTIMIZE_LIMIT compile-time option. + ** The default value of SQLITE_DEFAULT_OPTIMIZE_LIMIT is + ** currently (2024-02-19) set to 2000, which is such that + ** the worst case run-time for PRAGMA optimize on a 100MB + ** database will usually be less than 100 milliseconds on + ** a RaspberryPI-4 class machine. On by default. ** - ** 0x0008 (Not yet implemented) Create indexes that might have - ** been helpful to recent queries + ** 0x10000 Look at tables to see if they need to be reanalyzed + ** due to growth or shrinkage even if they have not been + ** queried during the current connection. Off by default. ** - ** The default MASK is and always shall be 0xfffe. 0xfffe means perform all - ** of the optimizations listed above except Debug Mode, including new - ** optimizations that have not yet been invented. If new optimizations are - ** ever added that should be off by default, those off-by-default - ** optimizations will have bitmasks of 0x10000 or larger. + ** The default MASK is and always shall be 0x0fffe. In the current + ** implementation, the default mask only covers the 0x00002 optimization, + ** though additional optimizations that are covered by 0x0fffe might be + ** added in the future. Optimizations that are off by default and must + ** be explicitly requested have masks of 0x10000 or greater. ** ** DETERMINATION OF WHEN TO RUN ANALYZE ** ** In the current implementation, a table is analyzed if only if all of ** the following are true: ** - ** (1) MASK bit 0x02 is set. + ** (1) MASK bit 0x00002 is set. + ** + ** (2) The table is an ordinary table, not a virtual table or view. ** - ** (2) The query planner used sqlite_stat1-style statistics for one or - ** more indexes of the table at some point during the lifetime of - ** the current connection. + ** (3) The table name does not begin with "sqlite_". ** - ** (3) One or more indexes of the table are currently unanalyzed OR - ** the number of rows in the table has increased by 25 times or more - ** since the last time ANALYZE was run. + ** (4) One or more of the following is true: + ** (4a) The 0x10000 MASK bit is set. + ** (4b) One or more indexes on the table lacks an entry + ** in the sqlite_stat1 table. + ** (4c) The query planner used sqlite_stat1-style statistics for one + ** or more indexes of the table at some point during the lifetime + ** of the current connection. + ** + ** (5) One or more of the following is true: + ** (5a) One or more indexes on the table lacks an entry + ** in the sqlite_stat1 table. (Same as 4a) + ** (5b) The number of rows in the table has increased or decreased by + ** 10-fold. In other words, the current size of the table is + ** 10 times larger than the size in sqlite_stat1 or else the + ** current size is less than 1/10th the size in sqlite_stat1. ** ** The rules for when tables are analyzed are likely to change in - ** future releases. + ** future releases. Future versions of SQLite might accept a string + ** literal argument to this pragma that contains a mnemonic description + ** of the options rather than a bitmap. */ case PragTyp_OPTIMIZE: { int iDbLast; /* Loop termination point for the schema loop */ @@ -138796,6 +141210,10 @@ SQLITE_PRIVATE void sqlite3Pragma( LogEst szThreshold; /* Size threshold above which reanalysis needed */ char *zSubSql; /* SQL statement for the OP_SqlExec opcode */ u32 opMask; /* Mask of operations to perform */ + int nLimit; /* Analysis limit to use */ + int nCheck = 0; /* Number of tables to be optimized */ + int nBtree = 0; /* Number of btrees to scan */ + int nIndex; /* Number of indexes on the current table */ if( zRight ){ opMask = (u32)sqlite3Atoi(zRight); @@ -138803,6 +141221,14 @@ SQLITE_PRIVATE void sqlite3Pragma( }else{ opMask = 0xfffe; } + if( (opMask & 0x10)==0 ){ + nLimit = 0; + }else if( db->nAnalysisLimit>0 + && db->nAnalysisLimitnTab++; for(iDbLast = zDb?iDb:db->nDb-1; iDb<=iDbLast; iDb++){ if( iDb==1 ) continue; @@ -138811,23 +141237,61 @@ SQLITE_PRIVATE void sqlite3Pragma( for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){ pTab = (Table*)sqliteHashData(k); - /* If table pTab has not been used in a way that would benefit from - ** having analysis statistics during the current session, then skip it. - ** This also has the effect of skipping virtual tables and views */ - if( (pTab->tabFlags & TF_StatsUsed)==0 ) continue; + /* This only works for ordinary tables */ + if( !IsOrdinaryTable(pTab) ) continue; + + /* Do not scan system tables */ + if( 0==sqlite3StrNICmp(pTab->zName, "sqlite_", 7) ) continue; - /* Reanalyze if the table is 25 times larger than the last analysis */ - szThreshold = pTab->nRowLogEst + 46; assert( sqlite3LogEst(25)==46 ); + /* Find the size of the table as last recorded in sqlite_stat1. + ** If any index is unanalyzed, then the threshold is -1 to + ** indicate a new, unanalyzed index + */ + szThreshold = pTab->nRowLogEst; + nIndex = 0; for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ + nIndex++; if( !pIdx->hasStat1 ){ - szThreshold = 0; /* Always analyze if any index lacks statistics */ - break; + szThreshold = -1; /* Always analyze if any index lacks statistics */ } } - if( szThreshold ){ - sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead); - sqlite3VdbeAddOp3(v, OP_IfSmaller, iTabCur, - sqlite3VdbeCurrentAddr(v)+2+(opMask&1), szThreshold); + + /* If table pTab has not been used in a way that would benefit from + ** having analysis statistics during the current session, then skip it, + ** unless the 0x10000 MASK bit is set. */ + if( (pTab->tabFlags & TF_MaybeReanalyze)!=0 ){ + /* Check for size change if stat1 has been used for a query */ + }else if( opMask & 0x10000 ){ + /* Check for size change if 0x10000 is set */ + }else if( pTab->pIndex!=0 && szThreshold<0 ){ + /* Do analysis if unanalyzed indexes exists */ + }else{ + /* Otherwise, we can skip this table */ + continue; + } + + nCheck++; + if( nCheck==2 ){ + /* If ANALYZE might be invoked two or more times, hold a write + ** transaction for efficiency */ + sqlite3BeginWriteOperation(pParse, 0, iDb); + } + nBtree += nIndex+1; + + /* Reanalyze if the table is 10 times larger or smaller than + ** the last analysis. Unconditional reanalysis if there are + ** unanalyzed indexes. */ + sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead); + if( szThreshold>=0 ){ + const LogEst iRange = 33; /* 10x size change */ + sqlite3VdbeAddOp4Int(v, OP_IfSizeBetween, iTabCur, + sqlite3VdbeCurrentAddr(v)+2+(opMask&1), + szThreshold>=iRange ? szThreshold-iRange : -1, + szThreshold+iRange); + VdbeCoverage(v); + }else{ + sqlite3VdbeAddOp2(v, OP_Rewind, iTabCur, + sqlite3VdbeCurrentAddr(v)+2+(opMask&1)); VdbeCoverage(v); } zSubSql = sqlite3MPrintf(db, "ANALYZE \"%w\".\"%w\"", @@ -138837,11 +141301,27 @@ SQLITE_PRIVATE void sqlite3Pragma( sqlite3VdbeAddOp4(v, OP_String8, 0, r1, 0, zSubSql, P4_DYNAMIC); sqlite3VdbeAddOp2(v, OP_ResultRow, r1, 1); }else{ - sqlite3VdbeAddOp4(v, OP_SqlExec, 0, 0, 0, zSubSql, P4_DYNAMIC); + sqlite3VdbeAddOp4(v, OP_SqlExec, nLimit ? 0x02 : 00, nLimit, 0, + zSubSql, P4_DYNAMIC); } } } sqlite3VdbeAddOp0(v, OP_Expire); + + /* In a schema with a large number of tables and indexes, scale back + ** the analysis_limit to avoid excess run-time in the worst case. + */ + if( !db->mallocFailed && nLimit>0 && nBtree>100 ){ + int iAddr, iEnd; + VdbeOp *aOp; + nLimit = 100*nLimit/nBtree; + if( nLimit<100 ) nLimit = 100; + aOp = sqlite3VdbeGetOp(v, 0); + iEnd = sqlite3VdbeCurrentAddr(v); + for(iAddr=0; iAddrnConstraint; i++, pConstraint++){ - if( pConstraint->usable==0 ) continue; - if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue; if( pConstraint->iColumn < pTab->iHidden ) continue; + if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue; + if( pConstraint->usable==0 ) return SQLITE_CONSTRAINT; j = pConstraint->iColumn - pTab->iHidden; assert( j < 2 ); seen[j] = i+1; @@ -139120,12 +141600,13 @@ static int pragmaVtabBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ j = seen[0]-1; pIdxInfo->aConstraintUsage[j].argvIndex = 1; pIdxInfo->aConstraintUsage[j].omit = 1; - if( seen[1]==0 ) return SQLITE_OK; pIdxInfo->estimatedCost = (double)20; pIdxInfo->estimatedRows = 20; - j = seen[1]-1; - pIdxInfo->aConstraintUsage[j].argvIndex = 2; - pIdxInfo->aConstraintUsage[j].omit = 1; + if( seen[1] ){ + j = seen[1]-1; + pIdxInfo->aConstraintUsage[j].argvIndex = 2; + pIdxInfo->aConstraintUsage[j].omit = 1; + } return SQLITE_OK; } @@ -139145,6 +141626,7 @@ static void pragmaVtabCursorClear(PragmaVtabCursor *pCsr){ int i; sqlite3_finalize(pCsr->pPragma); pCsr->pPragma = 0; + pCsr->iRowid = 0; for(i=0; iazArg); i++){ sqlite3_free(pCsr->azArg[i]); pCsr->azArg[i] = 0; @@ -139285,7 +141767,8 @@ static const sqlite3_module pragmaVtabModule = { 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; /* @@ -139909,8 +142392,6 @@ SQLITE_PRIVATE void sqlite3ParseObjectReset(Parse *pParse){ db->lookaside.sz = db->lookaside.bDisable ? 0 : db->lookaside.szTrue; assert( pParse->db->pParse==pParse ); db->pParse = pParse->pOuterParse; - pParse->db = 0; - pParse->disableLookaside = 0; } /* @@ -139946,7 +142427,13 @@ SQLITE_PRIVATE void *sqlite3ParserAddCleanup( void (*xCleanup)(sqlite3*,void*), /* The cleanup routine */ void *pPtr /* Pointer to object to be cleaned up */ ){ - ParseCleanup *pCleanup = sqlite3DbMallocRaw(pParse->db, sizeof(*pCleanup)); + ParseCleanup *pCleanup; + if( sqlite3FaultSim(300) ){ + pCleanup = 0; + sqlite3OomFault(pParse->db); + }else{ + pCleanup = sqlite3DbMallocRaw(pParse->db, sizeof(*pCleanup)); + } if( pCleanup ){ pCleanup->pNext = pParse->pCleanup; pParse->pCleanup = pCleanup; @@ -140181,6 +142668,7 @@ static int sqlite3LockAndPrepare( assert( (rc&db->errMask)==rc ); db->busyHandler.nBusy = 0; sqlite3_mutex_leave(db->mutex); + assert( rc==SQLITE_OK || (*ppStmt)==0 ); return rc; } @@ -140578,6 +143066,9 @@ SQLITE_PRIVATE Select *sqlite3SelectNew( SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3 *db, Select *p){ if( OK_IF_ALWAYS_TRUE(p) ) clearSelect(db, p, 1); } +SQLITE_PRIVATE void sqlite3SelectDeleteGeneric(sqlite3 *db, void *p){ + if( ALWAYS(p) ) clearSelect(db, (Select*)p, 1); +} /* ** Return a pointer to the right-most SELECT statement in a compound. @@ -140848,6 +143339,7 @@ static void unsetJoinExpr(Expr *p, int iTable, int nullable){ } if( p->op==TK_FUNCTION ){ assert( ExprUseXList(p) ); + assert( p->pLeft==0 ); if( p->x.pList ){ int i; for(i=0; ix.pList->nExpr; i++){ @@ -142063,9 +144555,16 @@ static void generateSortTail( int addrExplain; /* Address of OP_Explain instruction */ #endif - ExplainQueryPlan2(addrExplain, (pParse, 0, - "USE TEMP B-TREE FOR %sORDER BY", pSort->nOBSat>0?"RIGHT PART OF ":"") - ); + nKey = pOrderBy->nExpr - pSort->nOBSat; + if( pSort->nOBSat==0 || nKey==1 ){ + ExplainQueryPlan2(addrExplain, (pParse, 0, + "USE TEMP B-TREE FOR %sORDER BY", pSort->nOBSat?"LAST TERM OF ":"" + )); + }else{ + ExplainQueryPlan2(addrExplain, (pParse, 0, + "USE TEMP B-TREE FOR LAST %d TERMS OF ORDER BY", nKey + )); + } sqlite3VdbeScanStatusRange(v, addrExplain,pSort->addrPush,pSort->addrPushEnd); sqlite3VdbeScanStatusCounters(v, addrExplain, addrExplain, pSort->addrPush); @@ -142103,7 +144602,6 @@ static void generateSortTail( regRow = sqlite3GetTempRange(pParse, nColumn); } } - nKey = pOrderBy->nExpr - pSort->nOBSat; if( pSort->sortFlags & SORTFLAG_UseSorter ){ int regSortOut = ++pParse->nMem; iSortTab = pParse->nTab++; @@ -142343,11 +144841,7 @@ static const char *columnTypeImpl( ** data for the result-set column of the sub-select. */ if( iColpEList->nExpr -#ifdef SQLITE_ALLOW_ROWID_IN_VIEW - && iCol>=0 -#else - && ALWAYS(iCol>=0) -#endif + && (!ViewCanHaveRowid || iCol>=0) ){ /* If iCol is less than zero, then the expression requests the ** rowid of the sub-select or view. This expression is legal (see @@ -142723,17 +145217,22 @@ SQLITE_PRIVATE void sqlite3SubqueryColumnTypes( for(i=0, pCol=pTab->aCol; inCol; i++, pCol++){ const char *zType; i64 n; + int m = 0; + Select *pS2 = pSelect; pTab->tabFlags |= (pCol->colFlags & COLFLAG_NOINSERT); p = a[i].pExpr; /* pCol->szEst = ... // Column size est for SELECT tables never used */ pCol->affinity = sqlite3ExprAffinity(p); + while( pCol->affinity<=SQLITE_AFF_NONE && pS2->pNext!=0 ){ + m |= sqlite3ExprDataType(pS2->pEList->a[i].pExpr); + pS2 = pS2->pNext; + pCol->affinity = sqlite3ExprAffinity(pS2->pEList->a[i].pExpr); + } if( pCol->affinity<=SQLITE_AFF_NONE ){ pCol->affinity = aff; } - if( pCol->affinity>=SQLITE_AFF_TEXT && pSelect->pNext ){ - int m = 0; - Select *pS2; - for(m=0, pS2=pSelect->pNext; pS2; pS2=pS2->pNext){ + if( pCol->affinity>=SQLITE_AFF_TEXT && (pS2->pNext || pS2!=pSelect) ){ + for(pS2=pS2->pNext; pS2; pS2=pS2->pNext){ m |= sqlite3ExprDataType(pS2->pEList->a[i].pExpr); } if( pCol->affinity==SQLITE_AFF_TEXT && (m&0x01)!=0 ){ @@ -142763,12 +145262,12 @@ SQLITE_PRIVATE void sqlite3SubqueryColumnTypes( } } if( zType ){ - i64 m = sqlite3Strlen30(zType); + const i64 k = sqlite3Strlen30(zType); n = sqlite3Strlen30(pCol->zCnName); - pCol->zCnName = sqlite3DbReallocOrFree(db, pCol->zCnName, n+m+2); + pCol->zCnName = sqlite3DbReallocOrFree(db, pCol->zCnName, n+k+2); pCol->colFlags &= ~(COLFLAG_HASTYPE|COLFLAG_HASCOLL); if( pCol->zCnName ){ - memcpy(&pCol->zCnName[n+1], zType, m+1); + memcpy(&pCol->zCnName[n+1], zType, k+1); pCol->colFlags |= COLFLAG_HASTYPE; } } @@ -143596,9 +146095,7 @@ static int multiSelect( pDest->iSdst = dest.iSdst; pDest->nSdst = dest.nSdst; if( pDelete ){ - sqlite3ParserAddCleanup(pParse, - (void(*)(sqlite3*,void*))sqlite3SelectDelete, - pDelete); + sqlite3ParserAddCleanup(pParse, sqlite3SelectDeleteGeneric, pDelete); } return rc; } @@ -144149,8 +146646,7 @@ static int multiSelectOrderBy( /* Make arrangements to free the 2nd and subsequent arms of the compound ** after the parse has finished */ if( pSplit->pPrior ){ - sqlite3ParserAddCleanup(pParse, - (void(*)(sqlite3*,void*))sqlite3SelectDelete, pSplit->pPrior); + sqlite3ParserAddCleanup(pParse, sqlite3SelectDeleteGeneric, pSplit->pPrior); } pSplit->pPrior = pPrior; pPrior->pNext = pSplit; @@ -144971,9 +147467,7 @@ static int flattenSubquery( Table *pTabToDel = pSubitem->pTab; if( pTabToDel->nTabRef==1 ){ Parse *pToplevel = sqlite3ParseToplevel(pParse); - sqlite3ParserAddCleanup(pToplevel, - (void(*)(sqlite3*,void*))sqlite3DeleteTable, - pTabToDel); + sqlite3ParserAddCleanup(pToplevel, sqlite3DeleteTableGeneric, pTabToDel); testcase( pToplevel->earlyCleanup ); }else{ pTabToDel->nTabRef--; @@ -145170,7 +147664,7 @@ static void constInsert( ){ int i; assert( pColumn->op==TK_COLUMN ); - assert( sqlite3ExprIsConstant(pValue) ); + assert( sqlite3ExprIsConstant(pConst->pParse, pValue) ); if( ExprHasProperty(pColumn, EP_FixedCol) ) return; if( sqlite3ExprAffinity(pValue)!=0 ) return; @@ -145228,10 +147722,10 @@ static void findConstInWhere(WhereConst *pConst, Expr *pExpr){ pLeft = pExpr->pLeft; assert( pRight!=0 ); assert( pLeft!=0 ); - if( pRight->op==TK_COLUMN && sqlite3ExprIsConstant(pLeft) ){ + if( pRight->op==TK_COLUMN && sqlite3ExprIsConstant(pConst->pParse, pLeft) ){ constInsert(pConst,pRight,pLeft,pExpr); } - if( pLeft->op==TK_COLUMN && sqlite3ExprIsConstant(pRight) ){ + if( pLeft->op==TK_COLUMN && sqlite3ExprIsConstant(pConst->pParse, pRight) ){ constInsert(pConst,pLeft,pRight,pExpr); } } @@ -145452,6 +147946,18 @@ static int pushDownWindowCheck(Parse *pParse, Select *pSubq, Expr *pExpr){ ** The hope is that the terms added to the inner query will make it more ** efficient. ** +** NAME AMBIGUITY +** +** This optimization is called the "WHERE-clause push-down optimization". +** +** Do not confuse this optimization with another unrelated optimization +** with a similar name: The "MySQL push-down optimization" causes WHERE +** clause terms that can be evaluated using only the index and without +** reference to the table are run first, so that if they are false, +** unnecessary table seeks are avoided. +** +** RULES +** ** Do not attempt this optimization if: ** ** (1) (** This restriction was removed on 2017-09-29. We used to @@ -145517,15 +148023,19 @@ static int pushDownWindowCheck(Parse *pParse, Select *pSubq, Expr *pExpr){ ** (9c) There is a RIGHT JOIN (or FULL JOIN) in between the ON/USING ** clause and the subquery. ** -** Without this restriction, the push-down optimization might move -** the ON/USING filter expression from the left side of a RIGHT JOIN -** over to the right side, which leads to incorrect answers. See -** also restriction (6) in sqlite3ExprIsSingleTableConstraint(). +** Without this restriction, the WHERE-clause push-down optimization +** might move the ON/USING filter expression from the left side of a +** RIGHT JOIN over to the right side, which leads to incorrect answers. +** See also restriction (6) in sqlite3ExprIsSingleTableConstraint(). ** ** (10) The inner query is not the right-hand table of a RIGHT JOIN. ** ** (11) The subquery is not a VALUES clause ** +** (12) The WHERE clause is not "rowid ISNULL" or the equivalent. This +** case only comes up if SQLite is compiled using +** SQLITE_ALLOW_ROWID_IN_VIEW. +** ** Return 0 if no changes are made and non-zero if one or more WHERE clause ** terms are duplicated into the subquery. */ @@ -145636,7 +148146,19 @@ static int pushDownWhereTerms( } #endif - if( sqlite3ExprIsSingleTableConstraint(pWhere, pSrcList, iSrc) ){ +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + if( ViewCanHaveRowid && (pWhere->op==TK_ISNULL || pWhere->op==TK_NOTNULL) ){ + Expr *pLeft = pWhere->pLeft; + if( ALWAYS(pLeft) + && pLeft->op==TK_COLUMN + && pLeft->iColumn < 0 + ){ + return 0; /* Restriction (12) */ + } + } +#endif + + if( sqlite3ExprIsSingleTableConstraint(pWhere, pSrcList, iSrc, 1) ){ nChng++; pSubq->selFlags |= SF_PushDown; while( pSubq ){ @@ -146020,8 +148542,7 @@ static struct Cte *searchWith( SQLITE_PRIVATE With *sqlite3WithPush(Parse *pParse, With *pWith, u8 bFree){ if( pWith ){ if( bFree ){ - pWith = (With*)sqlite3ParserAddCleanup(pParse, - (void(*)(sqlite3*,void*))sqlite3WithDelete, + pWith = (With*)sqlite3ParserAddCleanup(pParse, sqlite3WithDeleteGeneric, pWith); if( pWith==0 ) return 0; } @@ -146264,12 +148785,14 @@ SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse *pParse, SrcItem *pFrom){ while( pSel->pPrior ){ pSel = pSel->pPrior; } sqlite3ColumnsFromExprList(pParse, pSel->pEList,&pTab->nCol,&pTab->aCol); pTab->iPKey = -1; + pTab->eTabType = TABTYP_VIEW; pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) ); #ifndef SQLITE_ALLOW_ROWID_IN_VIEW /* The usual case - do not allow ROWID on a subquery */ pTab->tabFlags |= TF_Ephemeral | TF_NoVisibleRowid; #else - pTab->tabFlags |= TF_Ephemeral; /* Legacy compatibility mode */ + /* Legacy compatibility mode */ + pTab->tabFlags |= TF_Ephemeral | sqlite3Config.mNoVisibleRowid; #endif return pParse->nErr ? SQLITE_ERROR : SQLITE_OK; } @@ -146508,6 +149031,7 @@ static int selectExpander(Walker *pWalker, Select *p){ char *zTName = 0; /* text of name of TABLE */ int iErrOfst; if( pE->op==TK_DOT ){ + assert( (selFlags & SF_NestedFrom)==0 ); assert( pE->pLeft!=0 ); assert( !ExprHasProperty(pE->pLeft, EP_IntValue) ); zTName = pE->pLeft->u.zToken; @@ -146518,6 +149042,7 @@ static int selectExpander(Walker *pWalker, Select *p){ iErrOfst = pE->w.iOfst; } for(i=0, pFrom=pTabList->a; inSrc; i++, pFrom++){ + int nAdd; /* Number of cols including rowid */ Table *pTab = pFrom->pTab; /* Table for this data source */ ExprList *pNestedFrom; /* Result-set of a nested FROM clause */ char *zTabName; /* AS name for this data source */ @@ -146535,6 +149060,7 @@ static int selectExpander(Walker *pWalker, Select *p){ pNestedFrom = pFrom->pSelect->pEList; assert( pNestedFrom!=0 ); assert( pNestedFrom->nExpr==pTab->nCol ); + assert( VisibleRowid(pTab)==0 || ViewCanHaveRowid ); }else{ if( zTName && sqlite3StrICmp(zTName, zTabName)!=0 ){ continue; @@ -146565,33 +149091,49 @@ static int selectExpander(Walker *pWalker, Select *p){ }else{ pUsing = 0; } - for(j=0; jnCol; j++){ - char *zName = pTab->aCol[j].zCnName; + + nAdd = pTab->nCol; + if( VisibleRowid(pTab) && (selFlags & SF_NestedFrom)!=0 ) nAdd++; + for(j=0; ja[j], 0, zTName, 0)==0 - ){ - continue; - } + if( j==pTab->nCol ){ + zName = sqlite3RowidAlias(pTab); + if( zName==0 ) continue; + }else{ + zName = pTab->aCol[j].zCnName; - /* If a column is marked as 'hidden', omit it from the expanded - ** result-set list unless the SELECT has the SF_IncludeHidden - ** bit set. - */ - if( (p->selFlags & SF_IncludeHidden)==0 - && IsHiddenColumn(&pTab->aCol[j]) - ){ - continue; - } - if( (pTab->aCol[j].colFlags & COLFLAG_NOEXPAND)!=0 - && zTName==0 - && (selFlags & (SF_NestedFrom))==0 - ){ - continue; + /* If pTab is actually an SF_NestedFrom sub-select, do not + ** expand any ENAME_ROWID columns. */ + if( pNestedFrom && pNestedFrom->a[j].fg.eEName==ENAME_ROWID ){ + continue; + } + + if( zTName + && pNestedFrom + && sqlite3MatchEName(&pNestedFrom->a[j], 0, zTName, 0, 0)==0 + ){ + continue; + } + + /* If a column is marked as 'hidden', omit it from the expanded + ** result-set list unless the SELECT has the SF_IncludeHidden + ** bit set. + */ + if( (p->selFlags & SF_IncludeHidden)==0 + && IsHiddenColumn(&pTab->aCol[j]) + ){ + continue; + } + if( (pTab->aCol[j].colFlags & COLFLAG_NOEXPAND)!=0 + && zTName==0 + && (selFlags & (SF_NestedFrom))==0 + ){ + continue; + } } + assert( zName ); tableSeen = 1; if( i>0 && zTName==0 && (selFlags & SF_NestedFrom)==0 ){ @@ -146633,7 +149175,8 @@ static int selectExpander(Walker *pWalker, Select *p){ pX = &pNew->a[pNew->nExpr-1]; assert( pX->zEName==0 ); if( (selFlags & SF_NestedFrom)!=0 && !IN_RENAME_OBJECT ){ - if( pNestedFrom ){ + if( pNestedFrom && (!ViewCanHaveRowid || jnExpr) ){ + assert( jnExpr ); pX->zEName = sqlite3DbStrDup(db, pNestedFrom->a[j].zEName); testcase( pX->zEName==0 ); }else{ @@ -146641,11 +149184,11 @@ static int selectExpander(Walker *pWalker, Select *p){ zSchemaName, zTabName, zName); testcase( pX->zEName==0 ); } - pX->fg.eEName = ENAME_TAB; + pX->fg.eEName = (j==pTab->nCol ? ENAME_ROWID : ENAME_TAB); if( (pFrom->fg.isUsing && sqlite3IdListIndex(pFrom->u3.pUsing, zName)>=0) || (pUsing && sqlite3IdListIndex(pUsing, zName)>=0) - || (pTab->aCol[j].colFlags & COLFLAG_NOEXPAND)!=0 + || (jnCol && (pTab->aCol[j].colFlags & COLFLAG_NOEXPAND)) ){ pX->fg.bNoExpand = 1; } @@ -146747,10 +149290,10 @@ static void selectAddSubqueryTypeInfo(Walker *pWalker, Select *p){ SrcList *pTabList; SrcItem *pFrom; - assert( p->selFlags & SF_Resolved ); if( p->selFlags & SF_HasTypeInfo ) return; p->selFlags |= SF_HasTypeInfo; pParse = pWalker->pParse; + assert( (p->selFlags & SF_Resolved) ); pTabList = p->pSrc; for(i=0, pFrom=pTabList->a; inSrc; i++, pFrom++){ Table *pTab = pFrom->pTab; @@ -146820,6 +149363,8 @@ SQLITE_PRIVATE void sqlite3SelectPrep( */ static void printAggInfo(AggInfo *pAggInfo){ int ii; + sqlite3DebugPrintf("AggInfo %d/%p:\n", + pAggInfo->selId, pAggInfo); for(ii=0; iinColumn; ii++){ struct AggInfo_col *pCol = &pAggInfo->aCol[ii]; sqlite3DebugPrintf( @@ -146866,8 +149411,14 @@ static void analyzeAggFuncArgs( pNC->ncFlags |= NC_InAggFunc; for(i=0; inFunc; i++){ Expr *pExpr = pAggInfo->aFunc[i].pFExpr; + assert( pExpr->op==TK_FUNCTION || pExpr->op==TK_AGG_FUNCTION ); assert( ExprUseXList(pExpr) ); sqlite3ExprAnalyzeAggList(pNC, pExpr->x.pList); + if( pExpr->pLeft ){ + assert( pExpr->pLeft->op==TK_ORDER ); + assert( ExprUseXList(pExpr->pLeft) ); + sqlite3ExprAnalyzeAggList(pNC, pExpr->pLeft->x.pList); + } #ifndef SQLITE_OMIT_WINDOWFUNC assert( !IsWindowFunc(pExpr) ); if( ExprHasProperty(pExpr, EP_WinFunc) ){ @@ -147022,6 +149573,36 @@ static void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){ pFunc->pFunc->zName)); } } + if( pFunc->iOBTab>=0 ){ + ExprList *pOBList; + KeyInfo *pKeyInfo; + int nExtra = 0; + assert( pFunc->pFExpr->pLeft!=0 ); + assert( pFunc->pFExpr->pLeft->op==TK_ORDER ); + assert( ExprUseXList(pFunc->pFExpr->pLeft) ); + assert( pFunc->pFunc!=0 ); + pOBList = pFunc->pFExpr->pLeft->x.pList; + if( !pFunc->bOBUnique ){ + nExtra++; /* One extra column for the OP_Sequence */ + } + if( pFunc->bOBPayload ){ + /* extra columns for the function arguments */ + assert( ExprUseXList(pFunc->pFExpr) ); + nExtra += pFunc->pFExpr->x.pList->nExpr; + } + if( pFunc->bUseSubtype ){ + nExtra += pFunc->pFExpr->x.pList->nExpr; + } + pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pOBList, 0, nExtra); + if( !pFunc->bOBUnique && pParse->nErr==0 ){ + pKeyInfo->nKeyField++; + } + sqlite3VdbeAddOp4(v, OP_OpenEphemeral, + pFunc->iOBTab, pOBList->nExpr+nExtra, 0, + (char*)pKeyInfo, P4_KEYINFO); + ExplainQueryPlan((pParse, 0, "USE TEMP B-TREE FOR %s(ORDER BY)", + pFunc->pFunc->zName)); + } } } @@ -147037,13 +149618,56 @@ static void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){ ExprList *pList; assert( ExprUseXList(pF->pFExpr) ); pList = pF->pFExpr->x.pList; + if( pF->iOBTab>=0 ){ + /* For an ORDER BY aggregate, calls to OP_AggStep were deferred. Inputs + ** were stored in emphermal table pF->iOBTab. Here, we extract those + ** inputs (in ORDER BY order) and make all calls to OP_AggStep + ** before doing the OP_AggFinal call. */ + int iTop; /* Start of loop for extracting columns */ + int nArg; /* Number of columns to extract */ + int nKey; /* Key columns to be skipped */ + int regAgg; /* Extract into this array */ + int j; /* Loop counter */ + + assert( pF->pFunc!=0 ); + nArg = pList->nExpr; + regAgg = sqlite3GetTempRange(pParse, nArg); + + if( pF->bOBPayload==0 ){ + nKey = 0; + }else{ + assert( pF->pFExpr->pLeft!=0 ); + assert( ExprUseXList(pF->pFExpr->pLeft) ); + assert( pF->pFExpr->pLeft->x.pList!=0 ); + nKey = pF->pFExpr->pLeft->x.pList->nExpr; + if( ALWAYS(!pF->bOBUnique) ) nKey++; + } + iTop = sqlite3VdbeAddOp1(v, OP_Rewind, pF->iOBTab); VdbeCoverage(v); + for(j=nArg-1; j>=0; j--){ + sqlite3VdbeAddOp3(v, OP_Column, pF->iOBTab, nKey+j, regAgg+j); + } + if( pF->bUseSubtype ){ + int regSubtype = sqlite3GetTempReg(pParse); + int iBaseCol = nKey + nArg + (pF->bOBPayload==0 && pF->bOBUnique==0); + for(j=nArg-1; j>=0; j--){ + sqlite3VdbeAddOp3(v, OP_Column, pF->iOBTab, iBaseCol+j, regSubtype); + sqlite3VdbeAddOp2(v, OP_SetSubtype, regSubtype, regAgg+j); + } + sqlite3ReleaseTempReg(pParse, regSubtype); + } + sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, AggInfoFuncReg(pAggInfo,i)); + sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); + sqlite3VdbeChangeP5(v, (u8)nArg); + sqlite3VdbeAddOp2(v, OP_Next, pF->iOBTab, iTop+1); VdbeCoverage(v); + sqlite3VdbeJumpHere(v, iTop); + sqlite3ReleaseTempRange(pParse, regAgg, nArg); + } sqlite3VdbeAddOp2(v, OP_AggFinal, AggInfoFuncReg(pAggInfo,i), pList ? pList->nExpr : 0); sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); } } - /* ** Generate code that will update the accumulator memory cells for an ** aggregate based on the current cursor position. @@ -147052,6 +149676,13 @@ static void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){ ** in pAggInfo, then only populate the pAggInfo->nAccumulator accumulator ** registers if register regAcc contains 0. The caller will take care ** of setting and clearing regAcc. +** +** For an ORDER BY aggregate, the actual accumulator memory cell update +** is deferred until after all input rows have been received, so that they +** can be run in the requested order. In that case, instead of invoking +** OP_AggStep to update the accumulator, just add the arguments that would +** have been passed into OP_AggStep into the sorting ephemeral table +** (along with the appropriate sort key). */ static void updateAccumulator( Parse *pParse, @@ -147073,9 +149704,12 @@ static void updateAccumulator( int nArg; int addrNext = 0; int regAgg; + int regAggSz = 0; + int regDistinct = 0; ExprList *pList; assert( ExprUseXList(pF->pFExpr) ); assert( !IsWindowFunc(pF->pFExpr) ); + assert( pF->pFunc!=0 ); pList = pF->pFExpr->x.pList; if( ExprHasProperty(pF->pFExpr, EP_WinFunc) ){ Expr *pFilter = pF->pFExpr->y.pWin->pFilter; @@ -147099,9 +149733,55 @@ static void updateAccumulator( addrNext = sqlite3VdbeMakeLabel(pParse); sqlite3ExprIfFalse(pParse, pFilter, addrNext, SQLITE_JUMPIFNULL); } - if( pList ){ + if( pF->iOBTab>=0 ){ + /* Instead of invoking AggStep, we must push the arguments that would + ** have been passed to AggStep onto the sorting table. */ + int jj; /* Registered used so far in building the record */ + ExprList *pOBList; /* The ORDER BY clause */ + assert( pList!=0 ); + nArg = pList->nExpr; + assert( nArg>0 ); + assert( pF->pFExpr->pLeft!=0 ); + assert( pF->pFExpr->pLeft->op==TK_ORDER ); + assert( ExprUseXList(pF->pFExpr->pLeft) ); + pOBList = pF->pFExpr->pLeft->x.pList; + assert( pOBList!=0 ); + assert( pOBList->nExpr>0 ); + regAggSz = pOBList->nExpr; + if( !pF->bOBUnique ){ + regAggSz++; /* One register for OP_Sequence */ + } + if( pF->bOBPayload ){ + regAggSz += nArg; + } + if( pF->bUseSubtype ){ + regAggSz += nArg; + } + regAggSz++; /* One extra register to hold result of MakeRecord */ + regAgg = sqlite3GetTempRange(pParse, regAggSz); + regDistinct = regAgg; + sqlite3ExprCodeExprList(pParse, pOBList, regAgg, 0, SQLITE_ECEL_DUP); + jj = pOBList->nExpr; + if( !pF->bOBUnique ){ + sqlite3VdbeAddOp2(v, OP_Sequence, pF->iOBTab, regAgg+jj); + jj++; + } + if( pF->bOBPayload ){ + regDistinct = regAgg+jj; + sqlite3ExprCodeExprList(pParse, pList, regDistinct, 0, SQLITE_ECEL_DUP); + jj += nArg; + } + if( pF->bUseSubtype ){ + int kk; + int regBase = pF->bOBPayload ? regDistinct : regAgg; + for(kk=0; kknExpr; regAgg = sqlite3GetTempRange(pParse, nArg); + regDistinct = regAgg; sqlite3ExprCodeExprList(pParse, pList, regAgg, 0, SQLITE_ECEL_DUP); }else{ nArg = 0; @@ -147112,26 +149792,37 @@ static void updateAccumulator( addrNext = sqlite3VdbeMakeLabel(pParse); } pF->iDistinct = codeDistinct(pParse, eDistinctType, - pF->iDistinct, addrNext, pList, regAgg); - } - if( pF->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){ - CollSeq *pColl = 0; - struct ExprList_item *pItem; - int j; - assert( pList!=0 ); /* pList!=0 if pF->pFunc has NEEDCOLL */ - for(j=0, pItem=pList->a; !pColl && jpExpr); - } - if( !pColl ){ - pColl = pParse->db->pDfltColl; + pF->iDistinct, addrNext, pList, regDistinct); + } + if( pF->iOBTab>=0 ){ + /* Insert a new record into the ORDER BY table */ + sqlite3VdbeAddOp3(v, OP_MakeRecord, regAgg, regAggSz-1, + regAgg+regAggSz-1); + sqlite3VdbeAddOp4Int(v, OP_IdxInsert, pF->iOBTab, regAgg+regAggSz-1, + regAgg, regAggSz-1); + sqlite3ReleaseTempRange(pParse, regAgg, regAggSz); + }else{ + /* Invoke the AggStep function */ + if( pF->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){ + CollSeq *pColl = 0; + struct ExprList_item *pItem; + int j; + assert( pList!=0 ); /* pList!=0 if pF->pFunc has NEEDCOLL */ + for(j=0, pItem=pList->a; !pColl && jpExpr); + } + if( !pColl ){ + pColl = pParse->db->pDfltColl; + } + if( regHit==0 && pAggInfo->nAccumulator ) regHit = ++pParse->nMem; + sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, + (char *)pColl, P4_COLLSEQ); } - if( regHit==0 && pAggInfo->nAccumulator ) regHit = ++pParse->nMem; - sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, (char *)pColl, P4_COLLSEQ); + sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, AggInfoFuncReg(pAggInfo,i)); + sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); + sqlite3VdbeChangeP5(v, (u8)nArg); + sqlite3ReleaseTempRange(pParse, regAgg, nArg); } - sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, AggInfoFuncReg(pAggInfo,i)); - sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); - sqlite3VdbeChangeP5(v, (u8)nArg); - sqlite3ReleaseTempRange(pParse, regAgg, nArg); if( addrNext ){ sqlite3VdbeResolveLabel(v, addrNext); } @@ -147290,7 +149981,8 @@ static SrcItem *isSelfJoinView( /* ** Deallocate a single AggInfo object */ -static void agginfoFree(sqlite3 *db, AggInfo *p){ +static void agginfoFree(sqlite3 *db, void *pArg){ + AggInfo *p = (AggInfo*)pArg; sqlite3DbFree(db, p->aCol); sqlite3DbFree(db, p->aFunc); sqlite3DbFreeNN(db, p); @@ -147364,7 +150056,7 @@ static int countOfViewOptimization(Parse *pParse, Select *p){ pSub->selFlags |= SF_Aggregate; pSub->selFlags &= ~SF_Compound; pSub->nSelectRow = 0; - sqlite3ExprListDelete(db, pSub->pEList); + sqlite3ParserAddCleanup(pParse, sqlite3ExprListDeleteGeneric, pSub->pEList); pTerm = pPrior ? sqlite3ExprDup(db, pCount, 0) : pCount; pSub->pEList = sqlite3ExprListAppend(pParse, 0, pTerm); pTerm = sqlite3PExpr(pParse, TK_SELECT, 0, 0); @@ -147544,9 +150236,8 @@ SQLITE_PRIVATE int sqlite3Select( sqlite3TreeViewExprList(0, p->pOrderBy, 0, "ORDERBY"); } #endif - sqlite3ParserAddCleanup(pParse, - (void(*)(sqlite3*,void*))sqlite3ExprListDelete, - p->pOrderBy); + sqlite3ParserAddCleanup(pParse, sqlite3ExprListDeleteGeneric, + p->pOrderBy); testcase( pParse->earlyCleanup ); p->pOrderBy = 0; } @@ -147652,6 +150343,7 @@ SQLITE_PRIVATE int sqlite3Select( TREETRACE(0x1000,pParse,p, ("LEFT-JOIN simplifies to JOIN on term %d\n",i)); pItem->fg.jointype &= ~(JT_LEFT|JT_OUTER); + unsetJoinExpr(p->pWhere, pItem->iCursor, 0); } } if( pItem->fg.jointype & JT_LTORJ ){ @@ -147666,17 +150358,15 @@ SQLITE_PRIVATE int sqlite3Select( TREETRACE(0x1000,pParse,p, ("RIGHT-JOIN simplifies to JOIN on term %d\n",j)); pI2->fg.jointype &= ~(JT_RIGHT|JT_OUTER); + unsetJoinExpr(p->pWhere, pI2->iCursor, 1); } } } - for(j=pTabList->nSrc-1; j>=i; j--){ + for(j=pTabList->nSrc-1; j>=0; j--){ pTabList->a[j].fg.jointype &= ~JT_LTORJ; if( pTabList->a[j].fg.jointype & JT_RIGHT ) break; } } - assert( pItem->iCursor>=0 ); - unsetJoinExpr(p->pWhere, pItem->iCursor, - pTabList->a[0].fg.jointype & JT_LTORJ); } /* No further action if this term of the FROM clause is not a subquery */ @@ -147739,9 +150429,8 @@ SQLITE_PRIVATE int sqlite3Select( ){ TREETRACE(0x800,pParse,p, ("omit superfluous ORDER BY on %r FROM-clause subquery\n",i+1)); - sqlite3ParserAddCleanup(pParse, - (void(*)(sqlite3*,void*))sqlite3ExprListDelete, - pSub->pOrderBy); + sqlite3ParserAddCleanup(pParse, sqlite3ExprListDeleteGeneric, + pSub->pOrderBy); pSub->pOrderBy = 0; } @@ -147866,7 +150555,7 @@ SQLITE_PRIVATE int sqlite3Select( /* Generate code for all sub-queries in the FROM clause */ pSub = pItem->pSelect; - if( pSub==0 ) continue; + if( pSub==0 || pItem->addrFillSub!=0 ) continue; /* The code for a subquery should only be generated once. */ assert( pItem->addrFillSub==0 ); @@ -147897,7 +150586,7 @@ SQLITE_PRIVATE int sqlite3Select( #endif assert( pItem->pSelect && (pItem->pSelect->selFlags & SF_PushDown)!=0 ); }else{ - TREETRACE(0x4000,pParse,p,("Push-down not possible\n")); + TREETRACE(0x4000,pParse,p,("WHERE-lcause push-down not possible\n")); } /* Convert unused result columns of the subquery into simple NULL @@ -148270,8 +150959,7 @@ SQLITE_PRIVATE int sqlite3Select( */ pAggInfo = sqlite3DbMallocZero(db, sizeof(*pAggInfo) ); if( pAggInfo ){ - sqlite3ParserAddCleanup(pParse, - (void(*)(sqlite3*,void*))agginfoFree, pAggInfo); + sqlite3ParserAddCleanup(pParse, agginfoFree, pAggInfo); testcase( pParse->earlyCleanup ); } if( db->mallocFailed ){ @@ -148779,6 +151467,12 @@ SQLITE_PRIVATE int sqlite3Select( sqlite3ExprListDelete(db, pMinMaxOrderBy); #ifdef SQLITE_DEBUG if( pAggInfo && !db->mallocFailed ){ +#if TREETRACE_ENABLED + if( sqlite3TreeTrace & 0x20 ){ + TREETRACE(0x20,pParse,p,("Finished with AggInfo\n")); + printAggInfo(pAggInfo); + } +#endif for(i=0; inColumn; i++){ Expr *pExpr = pAggInfo->aCol[i].pCExpr; if( pExpr==0 ) continue; @@ -149192,6 +151886,10 @@ SQLITE_PRIVATE void sqlite3BeginTrigger( sqlite3ErrorMsg(pParse, "cannot create triggers on virtual tables"); goto trigger_orphan_error; } + if( (pTab->tabFlags & TF_Shadow)!=0 && sqlite3ReadOnlyShadowTables(db) ){ + sqlite3ErrorMsg(pParse, "cannot create triggers on shadow tables"); + goto trigger_orphan_error; + } /* Check that the trigger name is not reserved and that no trigger of the ** specified name exists */ @@ -149956,6 +152654,72 @@ static ExprList *sqlite3ExpandReturning( return pNew; } +/* If the Expr node is a subquery or an EXISTS operator or an IN operator that +** uses a subquery, and if the subquery is SF_Correlated, then mark the +** expression as EP_VarSelect. +*/ +static int sqlite3ReturningSubqueryVarSelect(Walker *NotUsed, Expr *pExpr){ + UNUSED_PARAMETER(NotUsed); + if( ExprUseXSelect(pExpr) + && (pExpr->x.pSelect->selFlags & SF_Correlated)!=0 + ){ + testcase( ExprHasProperty(pExpr, EP_VarSelect) ); + ExprSetProperty(pExpr, EP_VarSelect); + } + return WRC_Continue; +} + + +/* +** If the SELECT references the table pWalker->u.pTab, then do two things: +** +** (1) Mark the SELECT as as SF_Correlated. +** (2) Set pWalker->eCode to non-zero so that the caller will know +** that (1) has happened. +*/ +static int sqlite3ReturningSubqueryCorrelated(Walker *pWalker, Select *pSelect){ + int i; + SrcList *pSrc; + assert( pSelect!=0 ); + pSrc = pSelect->pSrc; + assert( pSrc!=0 ); + for(i=0; inSrc; i++){ + if( pSrc->a[i].pTab==pWalker->u.pTab ){ + testcase( pSelect->selFlags & SF_Correlated ); + pSelect->selFlags |= SF_Correlated; + pWalker->eCode = 1; + break; + } + } + return WRC_Continue; +} + +/* +** Scan the expression list that is the argument to RETURNING looking +** for subqueries that depend on the table which is being modified in the +** statement that is hosting the RETURNING clause (pTab). Mark all such +** subqueries as SF_Correlated. If the subqueries are part of an +** expression, mark the expression as EP_VarSelect. +** +** https://sqlite.org/forum/forumpost/2c83569ce8945d39 +*/ +static void sqlite3ProcessReturningSubqueries( + ExprList *pEList, + Table *pTab +){ + Walker w; + memset(&w, 0, sizeof(w)); + w.xExprCallback = sqlite3ExprWalkNoop; + w.xSelectCallback = sqlite3ReturningSubqueryCorrelated; + w.u.pTab = pTab; + sqlite3WalkExprList(&w, pEList); + if( w.eCode ){ + w.xExprCallback = sqlite3ReturningSubqueryVarSelect; + w.xSelectCallback = sqlite3SelectWalkNoop; + sqlite3WalkExprList(&w, pEList); + } +} + /* ** Generate code for the RETURNING trigger. Unlike other triggers ** that invoke a subprogram in the bytecode, the code for RETURNING @@ -149975,16 +152739,24 @@ static void codeReturningTrigger( SrcList sFrom; assert( v!=0 ); - assert( pParse->bReturning ); + if( !pParse->bReturning ){ + /* This RETURNING trigger must be for a different statement as + ** this statement lacks a RETURNING clause. */ + return; + } assert( db->pParse==pParse ); pReturning = pParse->u1.pReturning; - assert( pTrigger == &(pReturning->retTrig) ); + if( pTrigger != &(pReturning->retTrig) ){ + /* This RETURNING trigger is for a different statement */ + return; + } memset(&sSelect, 0, sizeof(sSelect)); memset(&sFrom, 0, sizeof(sFrom)); sSelect.pEList = sqlite3ExprListDup(db, pReturning->pReturnEL, 0); sSelect.pSrc = &sFrom; sFrom.nSrc = 1; sFrom.a[0].pTab = pTab; + sFrom.a[0].zName = pTab->zName; /* tag-20240424-1 */ sFrom.a[0].iCursor = -1; sqlite3SelectPrep(pParse, &sSelect, 0); if( pParse->nErr==0 ){ @@ -150011,6 +152783,7 @@ static void codeReturningTrigger( int i; int nCol = pNew->nExpr; int reg = pParse->nMem+1; + sqlite3ProcessReturningSubqueries(pNew, pTab); pParse->nMem += nCol+2; pReturning->iRetReg = reg; for(i=0; ipUpsertIdx = pIdx; + if( sqlite3UpsertOfIndex(pAll,pIdx)!=pUpsert ){ + /* Really this should be an error. The isDup ON CONFLICT clause will + ** never fire. But this problem was not discovered until three years + ** after multi-CONFLICT upsert was added, and so we silently ignore + ** the problem to prevent breaking applications that might actually + ** have redundant ON CONFLICT clauses. */ + pUpsert->isDup = 1; + } break; } if( pUpsert->pUpsertIdx==0 ){ @@ -152078,9 +154863,13 @@ SQLITE_PRIVATE int sqlite3UpsertNextIsIPK(Upsert *pUpsert){ Upsert *pNext; if( NEVER(pUpsert==0) ) return 0; pNext = pUpsert->pNextUpsert; - if( pNext==0 ) return 1; - if( pNext->pUpsertTarget==0 ) return 1; - if( pNext->pUpsertIdx==0 ) return 1; + while( 1 /*exit-by-return*/ ){ + if( pNext==0 ) return 1; + if( pNext->pUpsertTarget==0 ) return 1; + if( pNext->pUpsertIdx==0 ) return 1; + if( !pNext->isDup ) return 0; + pNext = pNext->pNextUpsert; + } return 0; } @@ -152909,7 +155698,6 @@ SQLITE_PRIVATE void sqlite3VtabUnlockList(sqlite3 *db){ if( p ){ db->pDisconnect = 0; - sqlite3ExpirePreparedStatements(db, 0); do { VTable *pNext = p->pNext; sqlite3VtabUnlock(p); @@ -153206,6 +155994,8 @@ static int vtabCallConstructor( db->pVtabCtx = &sCtx; pTab->nTabRef++; rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr); + assert( pTab!=0 ); + assert( pTab->nTabRef>1 || rc!=SQLITE_OK ); sqlite3DeleteTable(db, pTab); db->pVtabCtx = sCtx.pPrior; if( rc==SQLITE_NOMEM ) sqlite3OomFault(db); @@ -153228,7 +156018,7 @@ static int vtabCallConstructor( pVTable->nRef = 1; if( sCtx.bDeclared==0 ){ const char *zFormat = "vtable constructor did not declare schema: %s"; - *pzErr = sqlite3MPrintf(db, zFormat, pTab->zName); + *pzErr = sqlite3MPrintf(db, zFormat, zModuleName); sqlite3VtabUnlock(pVTable); rc = SQLITE_ERROR; }else{ @@ -153406,19 +156196,38 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ Table *pTab; Parse sParse; int initBusy; + int i; + const unsigned char *z; + static const u8 aKeyword[] = { TK_CREATE, TK_TABLE, 0 }; #ifdef SQLITE_ENABLE_API_ARMOR if( !sqlite3SafetyCheckOk(db) || zCreateTable==0 ){ return SQLITE_MISUSE_BKPT; } #endif + + /* Verify that the first two keywords in the CREATE TABLE statement + ** really are "CREATE" and "TABLE". If this is not the case, then + ** sqlite3_declare_vtab() is being misused. + */ + z = (const unsigned char*)zCreateTable; + for(i=0; aKeyword[i]; i++){ + int tokenType = 0; + do{ z += sqlite3GetToken(z, &tokenType); }while( tokenType==TK_SPACE ); + if( tokenType!=aKeyword[i] ){ + sqlite3ErrorWithMsg(db, SQLITE_ERROR, "syntax error"); + return SQLITE_ERROR; + } + } + sqlite3_mutex_enter(db->mutex); pCtx = db->pVtabCtx; if( !pCtx || pCtx->bDeclared ){ - sqlite3Error(db, SQLITE_MISUSE); + sqlite3Error(db, SQLITE_MISUSE_BKPT); sqlite3_mutex_leave(db->mutex); return SQLITE_MISUSE_BKPT; } + pTab = pCtx->pTab; assert( IsVirtual(pTab) ); @@ -153432,11 +156241,10 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ initBusy = db->init.busy; db->init.busy = 0; sParse.nQueryLoop = 1; - if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable) - && ALWAYS(sParse.pNewTable!=0) - && ALWAYS(!db->mallocFailed) - && IsOrdinaryTable(sParse.pNewTable) - ){ + if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable) ){ + assert( sParse.pNewTable!=0 ); + assert( !db->mallocFailed ); + assert( IsOrdinaryTable(sParse.pNewTable) ); assert( sParse.zErrMsg==0 ); if( !pTab->aCol ){ Table *pNew = sParse.pNewTable; @@ -154475,7 +157283,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereGetMask(WhereMaskSet*,int); #ifdef WHERETRACE_ENABLED SQLITE_PRIVATE void sqlite3WhereClausePrint(WhereClause *pWC); SQLITE_PRIVATE void sqlite3WhereTermPrint(WhereTerm *pTerm, int iTerm); -SQLITE_PRIVATE void sqlite3WhereLoopPrint(WhereLoop *p, WhereClause *pWC); +SQLITE_PRIVATE void sqlite3WhereLoopPrint(const WhereLoop *p, const WhereClause *pWC); #endif SQLITE_PRIVATE WhereTerm *sqlite3WhereFindTerm( WhereClause *pWC, /* The WHERE clause to be searched */ @@ -154606,7 +157414,7 @@ SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(Parse*, SrcItem*, WhereClause*); #define WHERE_BLOOMFILTER 0x00400000 /* Consider using a Bloom-filter */ #define WHERE_SELFCULL 0x00800000 /* nOut reduced by extra WHERE terms */ #define WHERE_OMIT_OFFSET 0x01000000 /* Set offset counter to zero */ -#define WHERE_VIEWSCAN 0x02000000 /* A full-scan of a VIEW or subquery */ + /* 0x02000000 -- available for reuse */ #define WHERE_EXPRIDX 0x04000000 /* Uses an index-on-expressions */ #endif /* !defined(SQLITE_WHEREINT_H) */ @@ -155931,6 +158739,27 @@ static SQLITE_NOINLINE void filterPullDown( } } +/* +** Loop pLoop is a WHERE_INDEXED level that uses at least one IN(...) +** operator. Return true if level pLoop is guaranteed to visit only one +** row for each key generated for the index. +*/ +static int whereLoopIsOneRow(WhereLoop *pLoop){ + if( pLoop->u.btree.pIndex->onError + && pLoop->nSkip==0 + && pLoop->u.btree.nEq==pLoop->u.btree.pIndex->nKeyCol + ){ + int ii; + for(ii=0; iiu.btree.nEq; ii++){ + if( pLoop->aLTerm[ii]->eOperator & (WO_IS|WO_ISNULL) ){ + return 0; + } + } + return 1; + } + return 0; +} + /* ** Generate code for the start of the iLevel-th loop in the WHERE clause ** implementation described by pWInfo. @@ -156009,7 +158838,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( if( pLevel->iFrom>0 && (pTabItem[0].fg.jointype & JT_LEFT)!=0 ){ pLevel->iLeftJoin = ++pParse->nMem; sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin); - VdbeComment((v, "init LEFT JOIN no-match flag")); + VdbeComment((v, "init LEFT JOIN match flag")); } /* Compute a safe address to jump to if we discover that the table for @@ -156678,7 +159507,9 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( } /* Record the instruction used to terminate the loop. */ - if( pLoop->wsFlags & WHERE_ONEROW ){ + if( (pLoop->wsFlags & WHERE_ONEROW) + || (pLevel->u.in.nIn && regBignull==0 && whereLoopIsOneRow(pLoop)) + ){ pLevel->op = OP_Noop; }else if( bRev ){ pLevel->op = OP_Prev; @@ -157068,6 +159899,12 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ** iLoop==3: Code all remaining expressions. ** ** An effort is made to skip unnecessary iterations of the loop. + ** + ** This optimization of causing simple query restrictions to occur before + ** more complex one is call the "push-down" optimization in MySQL. Here + ** in SQLite, the name is "MySQL push-down", since there is also another + ** totally unrelated optimization called "WHERE-clause push-down". + ** Sometimes the qualifier is omitted, resulting in an ambiguity, so beware. */ iLoop = (pIdx ? 1 : 2); do{ @@ -157318,7 +160155,16 @@ SQLITE_PRIVATE SQLITE_NOINLINE void sqlite3WhereRightJoinLoop( pRJ->regReturn); for(k=0; ka[k].pWLoop->iTab == pWInfo->a[k].iFrom ); + pRight = &pWInfo->pTabList->a[pWInfo->a[k].iFrom]; mAll |= pWInfo->a[k].pWLoop->maskSelf; + if( pRight->fg.viaCoroutine ){ + sqlite3VdbeAddOp3( + v, OP_Null, 0, pRight->regResult, + pRight->regResult + pRight->pSelect->pEList->nExpr-1 + ); + } sqlite3VdbeAddOp1(v, OP_NullRow, pWInfo->a[k].iTabCur); iIdxCur = pWInfo->a[k].iIdxCur; if( iIdxCur ){ @@ -158375,7 +161221,7 @@ static SQLITE_NOINLINE int exprMightBeIndexed2( if( pIdx->aiColumn[i]!=XN_EXPR ) continue; assert( pIdx->bHasExpr ); if( sqlite3ExprCompareSkip(pExpr,pIdx->aColExpr->a[i].pExpr,iCur)==0 - && pExpr->op!=TK_STRING + && !sqlite3ExprIsConstant(0,pIdx->aColExpr->a[i].pExpr) ){ aiCurCol[0] = iCur; aiCurCol[1] = XN_EXPR; @@ -159024,6 +161870,7 @@ SQLITE_PRIVATE void SQLITE_NOINLINE sqlite3WhereAddLimit(WhereClause *pWC, Selec continue; } if( pWC->a[ii].leftCursor!=iCsr ) return; + if( pWC->a[ii].prereqRight!=0 ) return; } /* Check condition (5). Return early if it is not met. */ @@ -159038,12 +161885,14 @@ SQLITE_PRIVATE void SQLITE_NOINLINE sqlite3WhereAddLimit(WhereClause *pWC, Selec /* All conditions are met. Add the terms to the where-clause object. */ assert( p->pLimit->op==TK_LIMIT ); - whereAddLimitExpr(pWC, p->iLimit, p->pLimit->pLeft, - iCsr, SQLITE_INDEX_CONSTRAINT_LIMIT); - if( p->iOffset>0 ){ + if( p->iOffset!=0 && (p->selFlags & SF_Compound)==0 ){ whereAddLimitExpr(pWC, p->iOffset, p->pLimit->pRight, iCsr, SQLITE_INDEX_CONSTRAINT_OFFSET); } + if( p->iOffset==0 || (p->selFlags & SF_Compound)==0 ){ + whereAddLimitExpr(pWC, p->iLimit, p->pLimit->pLeft, + iCsr, SQLITE_INDEX_CONSTRAINT_LIMIT); + } } } @@ -159561,6 +162410,42 @@ static Expr *whereRightSubexprIsColumn(Expr *p){ return 0; } +/* +** Term pTerm is guaranteed to be a WO_IN term. It may be a component term +** of a vector IN expression of the form "(x, y, ...) IN (SELECT ...)". +** This function checks to see if the term is compatible with an index +** column with affinity idxaff (one of the SQLITE_AFF_XYZ values). If so, +** it returns a pointer to the name of the collation sequence (e.g. "BINARY" +** or "NOCASE") used by the comparison in pTerm. If it is not compatible +** with affinity idxaff, NULL is returned. +*/ +static SQLITE_NOINLINE const char *indexInAffinityOk( + Parse *pParse, + WhereTerm *pTerm, + u8 idxaff +){ + Expr *pX = pTerm->pExpr; + Expr inexpr; + + assert( pTerm->eOperator & WO_IN ); + + if( sqlite3ExprIsVector(pX->pLeft) ){ + int iField = pTerm->u.x.iField - 1; + inexpr.flags = 0; + inexpr.op = TK_EQ; + inexpr.pLeft = pX->pLeft->x.pList->a[iField].pExpr; + assert( ExprUseXSelect(pX) ); + inexpr.pRight = pX->x.pSelect->pEList->a[iField].pExpr; + pX = &inexpr; + } + + if( sqlite3IndexAffinityOk(pX, idxaff) ){ + CollSeq *pRet = sqlite3ExprCompareCollSeq(pParse, pX); + return pRet ? pRet->zName : sqlite3StrBINARY; + } + return 0; +} + /* ** Advance to the next WhereTerm that matches according to the criteria ** established when the pScan object was initialized by whereScanInit(). @@ -159611,16 +162496,24 @@ static WhereTerm *whereScanNext(WhereScan *pScan){ if( (pTerm->eOperator & pScan->opMask)!=0 ){ /* Verify the affinity and collating sequence match */ if( pScan->zCollName && (pTerm->eOperator & WO_ISNULL)==0 ){ - CollSeq *pColl; + const char *zCollName; Parse *pParse = pWC->pWInfo->pParse; pX = pTerm->pExpr; - if( !sqlite3IndexAffinityOk(pX, pScan->idxaff) ){ - continue; + + if( (pTerm->eOperator & WO_IN) ){ + zCollName = indexInAffinityOk(pParse, pTerm, pScan->idxaff); + if( !zCollName ) continue; + }else{ + CollSeq *pColl; + if( !sqlite3IndexAffinityOk(pX, pScan->idxaff) ){ + continue; + } + assert(pX->pLeft); + pColl = sqlite3ExprCompareCollSeq(pParse, pX); + zCollName = pColl ? pColl->zName : sqlite3StrBINARY; } - assert(pX->pLeft); - pColl = sqlite3ExprCompareCollSeq(pParse, pX); - if( pColl==0 ) pColl = pParse->db->pDfltColl; - if( sqlite3StrICmp(pColl->zName, pScan->zCollName) ){ + + if( sqlite3StrICmp(zCollName, pScan->zCollName) ){ continue; } } @@ -159937,12 +162830,22 @@ static void translateColumnToCopy( for(; iStartp1!=iTabCur ) continue; if( pOp->opcode==OP_Column ){ +#ifdef SQLITE_DEBUG + if( pParse->db->flags & SQLITE_VdbeAddopTrace ){ + printf("TRANSLATE OP_Column to OP_Copy at %d\n", iStart); + } +#endif pOp->opcode = OP_Copy; pOp->p1 = pOp->p2 + iRegister; pOp->p2 = pOp->p3; pOp->p3 = 0; pOp->p5 = 2; /* Cause the MEM_Subtype flag to be cleared */ }else if( pOp->opcode==OP_Rowid ){ +#ifdef SQLITE_DEBUG + if( pParse->db->flags & SQLITE_VdbeAddopTrace ){ + printf("TRANSLATE OP_Rowid to OP_Sequence at %d\n", iStart); + } +#endif pOp->opcode = OP_Sequence; pOp->p1 = iAutoidxCur; #ifdef SQLITE_ALLOW_ROWID_IN_VIEW @@ -159962,9 +162865,13 @@ static void translateColumnToCopy( ** are no-ops. */ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(WHERETRACE_ENABLED) -static void whereTraceIndexInfoInputs(sqlite3_index_info *p){ +static void whereTraceIndexInfoInputs( + sqlite3_index_info *p, /* The IndexInfo object */ + Table *pTab /* The TABLE that is the virtual table */ +){ int i; if( (sqlite3WhereTrace & 0x10)==0 ) return; + sqlite3DebugPrintf("sqlite3_index_info inputs for %s:\n", pTab->zName); for(i=0; inConstraint; i++){ sqlite3DebugPrintf( " constraint[%d]: col=%d termid=%d op=%d usabled=%d collseq=%s\n", @@ -159982,9 +162889,13 @@ static void whereTraceIndexInfoInputs(sqlite3_index_info *p){ p->aOrderBy[i].desc); } } -static void whereTraceIndexInfoOutputs(sqlite3_index_info *p){ +static void whereTraceIndexInfoOutputs( + sqlite3_index_info *p, /* The IndexInfo object */ + Table *pTab /* The TABLE that is the virtual table */ +){ int i; if( (sqlite3WhereTrace & 0x10)==0 ) return; + sqlite3DebugPrintf("sqlite3_index_info outputs for %s:\n", pTab->zName); for(i=0; inConstraint; i++){ sqlite3DebugPrintf(" usage[%d]: argvIdx=%d omit=%d\n", i, @@ -159998,8 +162909,8 @@ static void whereTraceIndexInfoOutputs(sqlite3_index_info *p){ sqlite3DebugPrintf(" estimatedRows=%lld\n", p->estimatedRows); } #else -#define whereTraceIndexInfoInputs(A) -#define whereTraceIndexInfoOutputs(A) +#define whereTraceIndexInfoInputs(A,B) +#define whereTraceIndexInfoOutputs(A,B) #endif /* @@ -160183,7 +163094,7 @@ static SQLITE_NOINLINE void constructAutomaticIndex( ** WHERE clause (or the ON clause of a LEFT join) that constrain which ** rows of the target table (pSrc) that can be used. */ if( (pTerm->wtFlags & TERM_VIRTUAL)==0 - && sqlite3ExprIsSingleTableConstraint(pExpr, pTabList, pLevel->iFrom) + && sqlite3ExprIsSingleTableConstraint(pExpr, pTabList, pLevel->iFrom, 0) ){ pPartial = sqlite3ExprAnd(pParse, pPartial, sqlite3ExprDup(pParse->db, pExpr, 0)); @@ -160225,7 +163136,7 @@ static SQLITE_NOINLINE void constructAutomaticIndex( ** if they go out of sync. */ if( IsView(pTable) ){ - extraCols = ALLBITS; + extraCols = ALLBITS & ~idxCols; }else{ extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1)); } @@ -160401,13 +163312,17 @@ static SQLITE_NOINLINE void sqlite3ConstructBloomFilter( WhereLoop *pLoop = pLevel->pWLoop; /* The loop being coded */ int iCur; /* Cursor for table getting the filter */ IndexedExpr *saved_pIdxEpr; /* saved copy of Parse.pIdxEpr */ + IndexedExpr *saved_pIdxPartExpr; /* saved copy of Parse.pIdxPartExpr */ saved_pIdxEpr = pParse->pIdxEpr; + saved_pIdxPartExpr = pParse->pIdxPartExpr; pParse->pIdxEpr = 0; + pParse->pIdxPartExpr = 0; assert( pLoop!=0 ); assert( v!=0 ); assert( pLoop->wsFlags & WHERE_BLOOMFILTER ); + assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 ); addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); do{ @@ -160448,7 +163363,7 @@ static SQLITE_NOINLINE void sqlite3ConstructBloomFilter( for(pTerm=pWInfo->sWC.a; pTermpExpr; if( (pTerm->wtFlags & TERM_VIRTUAL)==0 - && sqlite3ExprIsSingleTableConstraint(pExpr, pTabList, iSrc) + && sqlite3ExprIsSingleTableConstraint(pExpr, pTabList, iSrc, 0) ){ sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL); } @@ -160497,6 +163412,7 @@ static SQLITE_NOINLINE void sqlite3ConstructBloomFilter( }while( iLevel < pWInfo->nLevel ); sqlite3VdbeJumpHere(v, addrOnce); pParse->pIdxEpr = saved_pIdxEpr; + pParse->pIdxPartExpr = saved_pIdxPartExpr; } @@ -160573,7 +163489,7 @@ static sqlite3_index_info *allocateIndexInfo( Expr *pE2; /* Skip over constant terms in the ORDER BY clause */ - if( sqlite3ExprIsConstant(pExpr) ){ + if( sqlite3ExprIsConstant(0, pExpr) ){ continue; } @@ -160608,7 +163524,7 @@ static sqlite3_index_info *allocateIndexInfo( } if( i==n ){ nOrderBy = n; - if( (pWInfo->wctrlFlags & WHERE_DISTINCTBY) ){ + if( (pWInfo->wctrlFlags & WHERE_DISTINCTBY) && !pSrc->fg.rowidUsed ){ eDistinct = 2 + ((pWInfo->wctrlFlags & WHERE_SORTBYGROUP)!=0); }else if( pWInfo->wctrlFlags & WHERE_GROUPBY ){ eDistinct = 1; @@ -160685,7 +163601,7 @@ static sqlite3_index_info *allocateIndexInfo( pIdxInfo->nConstraint = j; for(i=j=0; ia[i].pExpr; - if( sqlite3ExprIsConstant(pExpr) ) continue; + if( sqlite3ExprIsConstant(0, pExpr) ) continue; assert( pExpr->op==TK_COLUMN || (pExpr->op==TK_COLLATE && pExpr->pLeft->op==TK_COLUMN && pExpr->iColumn==pExpr->pLeft->iColumn) ); @@ -160737,11 +163653,11 @@ static int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){ sqlite3_vtab *pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab; int rc; - whereTraceIndexInfoInputs(p); + whereTraceIndexInfoInputs(p, pTab); pParse->db->nSchemaLock++; rc = pVtab->pModule->xBestIndex(pVtab, p); pParse->db->nSchemaLock--; - whereTraceIndexInfoOutputs(p); + whereTraceIndexInfoOutputs(p, pTab); if( rc!=SQLITE_OK && rc!=SQLITE_CONSTRAINT ){ if( rc==SQLITE_NOMEM ){ @@ -161264,7 +164180,8 @@ static int whereRangeScanEst( ** sample, then assume they are 4x more selective. This brings ** the estimated selectivity more in line with what it would be ** if estimated without the use of STAT4 tables. */ - if( iLwrIdx==iUprIdx ) nNew -= 20; assert( 20==sqlite3LogEst(4) ); + if( iLwrIdx==iUprIdx ){ nNew -= 20; } + assert( 20==sqlite3LogEst(4) ); }else{ nNew = 10; assert( 10==sqlite3LogEst(2) ); } @@ -161488,17 +164405,34 @@ SQLITE_PRIVATE void sqlite3WhereClausePrint(WhereClause *pWC){ #ifdef WHERETRACE_ENABLED /* ** Print a WhereLoop object for debugging purposes -*/ -SQLITE_PRIVATE void sqlite3WhereLoopPrint(WhereLoop *p, WhereClause *pWC){ - WhereInfo *pWInfo = pWC->pWInfo; - int nb = 1+(pWInfo->pTabList->nSrc+3)/4; - SrcItem *pItem = pWInfo->pTabList->a + p->iTab; - Table *pTab = pItem->pTab; - Bitmask mAll = (((Bitmask)1)<<(nb*4)) - 1; - sqlite3DebugPrintf("%c%2d.%0*llx.%0*llx", p->cId, - p->iTab, nb, p->maskSelf, nb, p->prereq & mAll); - sqlite3DebugPrintf(" %12s", - pItem->zAlias ? pItem->zAlias : pTab->zName); +** +** Format example: +** +** .--- Position in WHERE clause rSetup, rRun, nOut ---. +** | | +** | .--- selfMask nTerm ------. | +** | | | | +** | | .-- prereq Idx wsFlags----. | | +** | | | Name | | | +** | | | __|__ nEq ---. ___|__ | __|__ +** | / \ / \ / \ | / \ / \ / \ +** 1.002.001 t2.t2xy 2 f 010241 N 2 cost 0,56,31 +*/ +SQLITE_PRIVATE void sqlite3WhereLoopPrint(const WhereLoop *p, const WhereClause *pWC){ + if( pWC ){ + WhereInfo *pWInfo = pWC->pWInfo; + int nb = 1+(pWInfo->pTabList->nSrc+3)/4; + SrcItem *pItem = pWInfo->pTabList->a + p->iTab; + Table *pTab = pItem->pTab; + Bitmask mAll = (((Bitmask)1)<<(nb*4)) - 1; + sqlite3DebugPrintf("%c%2d.%0*llx.%0*llx", p->cId, + p->iTab, nb, p->maskSelf, nb, p->prereq & mAll); + sqlite3DebugPrintf(" %12s", + pItem->zAlias ? pItem->zAlias : pTab->zName); + }else{ + sqlite3DebugPrintf("%c%2d.%03llx.%03llx %c%d", + p->cId, p->iTab, p->maskSelf, p->prereq & 0xfff, p->cId, p->iTab); + } if( (p->wsFlags & WHERE_VIRTUALTABLE)==0 ){ const char *zName; if( p->u.btree.pIndex && (zName = p->u.btree.pIndex->zName)!=0 ){ @@ -161535,6 +164469,15 @@ SQLITE_PRIVATE void sqlite3WhereLoopPrint(WhereLoop *p, WhereClause *pWC){ } } } +SQLITE_PRIVATE void sqlite3ShowWhereLoop(const WhereLoop *p){ + if( p ) sqlite3WhereLoopPrint(p, 0); +} +SQLITE_PRIVATE void sqlite3ShowWhereLoopList(const WhereLoop *p){ + while( p ){ + sqlite3ShowWhereLoop(p); + p = p->pNextLoop; + } +} #endif /* @@ -161647,46 +164590,60 @@ static void whereInfoFree(sqlite3 *db, WhereInfo *pWInfo){ } /* -** Return TRUE if all of the following are true: +** Return TRUE if X is a proper subset of Y but is of equal or less cost. +** In other words, return true if all constraints of X are also part of Y +** and Y has additional constraints that might speed the search that X lacks +** but the cost of running X is not more than the cost of running Y. +** +** In other words, return true if the cost relationwship between X and Y +** is inverted and needs to be adjusted. +** +** Case 1: ** -** (1) X has the same or lower cost, or returns the same or fewer rows, -** than Y. -** (2) X uses fewer WHERE clause terms than Y -** (3) Every WHERE clause term used by X is also used by Y -** (4) X skips at least as many columns as Y -** (5) If X is a covering index, than Y is too +** (1a) X and Y use the same index. +** (1b) X has fewer == terms than Y +** (1c) Neither X nor Y use skip-scan +** (1d) X does not have a a greater cost than Y ** -** Conditions (2) and (3) mean that X is a "proper subset" of Y. -** If X is a proper subset of Y then Y is a better choice and ought -** to have a lower cost. This routine returns TRUE when that cost -** relationship is inverted and needs to be adjusted. Constraint (4) -** was added because if X uses skip-scan less than Y it still might -** deserve a lower cost even if it is a proper subset of Y. Constraint (5) -** was added because a covering index probably deserves to have a lower cost -** than a non-covering index even if it is a proper subset. +** Case 2: +** +** (2a) X has the same or lower cost, or returns the same or fewer rows, +** than Y. +** (2b) X uses fewer WHERE clause terms than Y +** (2c) Every WHERE clause term used by X is also used by Y +** (2d) X skips at least as many columns as Y +** (2e) If X is a covering index, than Y is too */ static int whereLoopCheaperProperSubset( const WhereLoop *pX, /* First WhereLoop to compare */ const WhereLoop *pY /* Compare against this WhereLoop */ ){ int i, j; + if( pX->rRun>pY->rRun && pX->nOut>pY->nOut ) return 0; /* (1d) and (2a) */ + assert( (pX->wsFlags & WHERE_VIRTUALTABLE)==0 ); + assert( (pY->wsFlags & WHERE_VIRTUALTABLE)==0 ); + if( pX->u.btree.nEq < pY->u.btree.nEq /* (1b) */ + && pX->u.btree.pIndex==pY->u.btree.pIndex /* (1a) */ + && pX->nSkip==0 && pY->nSkip==0 /* (1c) */ + ){ + return 1; /* Case 1 is true */ + } if( pX->nLTerm-pX->nSkip >= pY->nLTerm-pY->nSkip ){ - return 0; /* X is not a subset of Y */ + return 0; /* (2b) */ } - if( pX->rRun>pY->rRun && pX->nOut>pY->nOut ) return 0; - if( pY->nSkip > pX->nSkip ) return 0; + if( pY->nSkip > pX->nSkip ) return 0; /* (2d) */ for(i=pX->nLTerm-1; i>=0; i--){ if( pX->aLTerm[i]==0 ) continue; for(j=pY->nLTerm-1; j>=0; j--){ if( pY->aLTerm[j]==pX->aLTerm[i] ) break; } - if( j<0 ) return 0; /* X not a subset of Y since term X[i] not used by Y */ + if( j<0 ) return 0; /* (2c) */ } if( (pX->wsFlags&WHERE_IDX_ONLY)!=0 && (pY->wsFlags&WHERE_IDX_ONLY)==0 ){ - return 0; /* Constraint (5) */ + return 0; /* (2e) */ } - return 1; /* All conditions meet */ + return 1; /* Case 2 is true */ } /* @@ -162176,7 +165133,12 @@ static int whereLoopAddBtreeIndex( assert( pNew->u.btree.nBtm==0 ); opMask = WO_EQ|WO_IN|WO_GT|WO_GE|WO_LT|WO_LE|WO_ISNULL|WO_IS; } - if( pProbe->bUnordered ) opMask &= ~(WO_GT|WO_GE|WO_LT|WO_LE); + if( pProbe->bUnordered || pProbe->bLowQual ){ + if( pProbe->bUnordered ) opMask &= ~(WO_GT|WO_GE|WO_LT|WO_LE); + if( pProbe->bLowQual && pSrc->fg.isIndexedBy==0 ){ + opMask &= ~(WO_EQ|WO_IN|WO_IS); + } + } assert( pNew->u.btree.nEqnColumn ); assert( pNew->u.btree.nEqnKeyCol @@ -162442,10 +165404,13 @@ static int whereLoopAddBtreeIndex( } } - /* Set rCostIdx to the cost of visiting selected rows in index. Add - ** it to pNew->rRun, which is currently set to the cost of the index - ** seek only. Then, if this is a non-covering index, add the cost of - ** visiting the rows in the main table. */ + /* Set rCostIdx to the estimated cost of visiting selected rows in the + ** index. The estimate is the sum of two values: + ** 1. The cost of doing one search-by-key to find the first matching + ** entry + ** 2. Stepping forward in the index pNew->nOut times to find all + ** additional matching entries. + */ assert( pSrc->pTab->szTabRow>0 ); if( pProbe->idxType==SQLITE_IDXTYPE_IPK ){ /* The pProbe->szIdxRow is low for an IPK table since the interior @@ -162456,7 +165421,15 @@ static int whereLoopAddBtreeIndex( }else{ rCostIdx = pNew->nOut + 1 + (15*pProbe->szIdxRow)/pSrc->pTab->szTabRow; } - pNew->rRun = sqlite3LogEstAdd(rLogSize, rCostIdx); + rCostIdx = sqlite3LogEstAdd(rLogSize, rCostIdx); + + /* Estimate the cost of running the loop. If all data is coming + ** from the index, then this is just the cost of doing the index + ** lookup and scan. But if some data is coming out of the main table, + ** we also have to add in the cost of doing pNew->nOut searches to + ** locate the row in the main table that corresponds to the index entry. + */ + pNew->rRun = rCostIdx; if( (pNew->wsFlags & (WHERE_IDX_ONLY|WHERE_IPK|WHERE_EXPRIDX))==0 ){ pNew->rRun = sqlite3LogEstAdd(pNew->rRun, pNew->nOut + 16); } @@ -162562,7 +165535,9 @@ static int indexMightHelpWithOrderBy( for(ii=0; iinExpr; ii++){ Expr *pExpr = sqlite3ExprSkipCollateAndLikely(pOB->a[ii].pExpr); if( NEVER(pExpr==0) ) continue; - if( pExpr->op==TK_COLUMN && pExpr->iTable==iCursor ){ + if( (pExpr->op==TK_COLUMN || pExpr->op==TK_AGG_COLUMN) + && pExpr->iTable==iCursor + ){ if( pExpr->iColumn<0 ) return 1; for(jj=0; jjnKeyCol; jj++){ if( pExpr->iColumn==pIndex->aiColumn[jj] ) return 1; @@ -162756,6 +165731,100 @@ static SQLITE_NOINLINE u32 whereIsCoveringIndex( return rc; } +/* +** This is an sqlite3ParserAddCleanup() callback that is invoked to +** free the Parse->pIdxEpr list when the Parse object is destroyed. +*/ +static void whereIndexedExprCleanup(sqlite3 *db, void *pObject){ + IndexedExpr **pp = (IndexedExpr**)pObject; + while( *pp!=0 ){ + IndexedExpr *p = *pp; + *pp = p->pIENext; + sqlite3ExprDelete(db, p->pExpr); + sqlite3DbFreeNN(db, p); + } +} + +/* +** This function is called for a partial index - one with a WHERE clause - in +** two scenarios. In both cases, it determines whether or not the WHERE +** clause on the index implies that a column of the table may be safely +** replaced by a constant expression. For example, in the following +** SELECT: +** +** CREATE INDEX i1 ON t1(b, c) WHERE a=; +** SELECT a, b, c FROM t1 WHERE a= AND b=?; +** +** The "a" in the select-list may be replaced by , iff: +** +** (a) is a constant expression, and +** (b) The (a=) comparison uses the BINARY collation sequence, and +** (c) Column "a" has an affinity other than NONE or BLOB. +** +** If argument pItem is NULL, then pMask must not be NULL. In this case this +** function is being called as part of determining whether or not pIdx +** is a covering index. This function clears any bits in (*pMask) +** corresponding to columns that may be replaced by constants as described +** above. +** +** Otherwise, if pItem is not NULL, then this function is being called +** as part of coding a loop that uses index pIdx. In this case, add entries +** to the Parse.pIdxPartExpr list for each column that can be replaced +** by a constant. +*/ +static void wherePartIdxExpr( + Parse *pParse, /* Parse context */ + Index *pIdx, /* Partial index being processed */ + Expr *pPart, /* WHERE clause being processed */ + Bitmask *pMask, /* Mask to clear bits in */ + int iIdxCur, /* Cursor number for index */ + SrcItem *pItem /* The FROM clause entry for the table */ +){ + assert( pItem==0 || (pItem->fg.jointype & JT_RIGHT)==0 ); + assert( (pItem==0 || pMask==0) && (pMask!=0 || pItem!=0) ); + + if( pPart->op==TK_AND ){ + wherePartIdxExpr(pParse, pIdx, pPart->pRight, pMask, iIdxCur, pItem); + pPart = pPart->pLeft; + } + + if( (pPart->op==TK_EQ || pPart->op==TK_IS) ){ + Expr *pLeft = pPart->pLeft; + Expr *pRight = pPart->pRight; + u8 aff; + + if( pLeft->op!=TK_COLUMN ) return; + if( !sqlite3ExprIsConstant(0, pRight) ) return; + if( !sqlite3IsBinary(sqlite3ExprCompareCollSeq(pParse, pPart)) ) return; + if( pLeft->iColumn<0 ) return; + aff = pIdx->pTable->aCol[pLeft->iColumn].affinity; + if( aff>=SQLITE_AFF_TEXT ){ + if( pItem ){ + sqlite3 *db = pParse->db; + IndexedExpr *p = (IndexedExpr*)sqlite3DbMallocRaw(db, sizeof(*p)); + if( p ){ + int bNullRow = (pItem->fg.jointype&(JT_LEFT|JT_LTORJ))!=0; + p->pExpr = sqlite3ExprDup(db, pRight, 0); + p->iDataCur = pItem->iCursor; + p->iIdxCur = iIdxCur; + p->iIdxCol = pLeft->iColumn; + p->bMaybeNullRow = bNullRow; + p->pIENext = pParse->pIdxPartExpr; + p->aff = aff; + pParse->pIdxPartExpr = p; + if( p->pIENext==0 ){ + void *pArg = (void*)&pParse->pIdxPartExpr; + sqlite3ParserAddCleanup(pParse, whereIndexedExprCleanup, pArg); + } + } + }else if( pLeft->iColumn<(BMS-1) ){ + *pMask &= ~((Bitmask)1 << pLeft->iColumn); + } + } + } +} + + /* ** Add all WhereLoop objects for a single table of the join where the table ** is identified by pBuilder->pNew->iTab. That table is guaranteed to be @@ -162959,9 +166028,6 @@ static int whereLoopAddBtree( #else pNew->rRun = rSize + 16; #endif - if( IsView(pTab) || (pTab->tabFlags & TF_Ephemeral)!=0 ){ - pNew->wsFlags |= WHERE_VIEWSCAN; - } ApplyCostMultiplier(pNew->rRun, pTab->costMult); whereLoopOutputAdjust(pWC, pNew, rSize); rc = whereLoopInsert(pBuilder, pNew); @@ -162974,6 +166040,11 @@ static int whereLoopAddBtree( pNew->wsFlags = WHERE_IDX_ONLY | WHERE_INDEXED; }else{ m = pSrc->colUsed & pProbe->colNotIdxed; + if( pProbe->pPartIdxWhere ){ + wherePartIdxExpr( + pWInfo->pParse, pProbe, pProbe->pPartIdxWhere, &m, 0, 0 + ); + } pNew->wsFlags = WHERE_INDEXED; if( m==TOPBIT || (pProbe->bHasExpr && !pProbe->bHasVCol && m!=0) ){ u32 isCov = whereIsCoveringIndex(pWInfo, pProbe, pSrc->iCursor); @@ -163072,7 +166143,7 @@ static int whereLoopAddBtree( ** unique index is used (making the index functionally non-unique) ** then the sqlite_stat1 data becomes important for scoring the ** plan */ - pTab->tabFlags |= TF_StatsUsed; + pTab->tabFlags |= TF_MaybeReanalyze; } #ifdef SQLITE_ENABLE_STAT4 sqlite3Stat4ProbeFree(pBuilder->pRec); @@ -163094,6 +166165,21 @@ static int isLimitTerm(WhereTerm *pTerm){ && pTerm->eMatchOp<=SQLITE_INDEX_CONSTRAINT_OFFSET; } +/* +** Return true if the first nCons constraints in the pUsage array are +** marked as in-use (have argvIndex>0). False otherwise. +*/ +static int allConstraintsUsed( + struct sqlite3_index_constraint_usage *aUsage, + int nCons +){ + int ii; + for(ii=0; iipNew->iTab. This @@ -163234,13 +166320,20 @@ static int whereLoopAddVirtualOne( *pbIn = 1; assert( (mExclude & WO_IN)==0 ); } + /* Unless pbRetryLimit is non-NULL, there should be no LIMIT/OFFSET + ** terms. And if there are any, they should follow all other terms. */ assert( pbRetryLimit || !isLimitTerm(pTerm) ); - if( isLimitTerm(pTerm) && *pbIn ){ + assert( !isLimitTerm(pTerm) || i>=nConstraint-2 ); + assert( !isLimitTerm(pTerm) || i==nConstraint-1 || isLimitTerm(pTerm+1) ); + + if( isLimitTerm(pTerm) && (*pbIn || !allConstraintsUsed(pUsage, i)) ){ /* If there is an IN(...) term handled as an == (separate call to ** xFilter for each value on the RHS of the IN) and a LIMIT or - ** OFFSET term handled as well, the plan is unusable. Set output - ** variable *pbRetryLimit to true to tell the caller to retry with - ** LIMIT and OFFSET disabled. */ + ** OFFSET term handled as well, the plan is unusable. Similarly, + ** if there is a LIMIT/OFFSET and there are other unused terms, + ** the plan cannot be used. In these cases set variable *pbRetryLimit + ** to true to tell the caller to retry with LIMIT and OFFSET + ** disabled. */ if( pIdxInfo->needToFreeIdxStr ){ sqlite3_free(pIdxInfo->idxStr); pIdxInfo->idxStr = 0; @@ -163356,7 +166449,7 @@ SQLITE_API int sqlite3_vtab_rhs_value( sqlite3_value *pVal = 0; int rc = SQLITE_OK; if( iCons<0 || iCons>=pIdxInfo->nConstraint ){ - rc = SQLITE_MISUSE; /* EV: R-30545-25046 */ + rc = SQLITE_MISUSE_BKPT; /* EV: R-30545-25046 */ }else{ if( pH->aRhs[iCons]==0 ){ WhereTerm *pTerm = &pH->pWC->a[pIdxInfo->aConstraint[iCons].iTermOffset]; @@ -164097,7 +167190,7 @@ static i8 wherePathSatisfiesOrderBy( if( MASKBIT(i) & obSat ) continue; p = pOrderBy->a[i].pExpr; mTerm = sqlite3WhereExprUsage(&pWInfo->sMaskSet,p); - if( mTerm==0 && !sqlite3ExprIsConstant(p) ) continue; + if( mTerm==0 && !sqlite3ExprIsConstant(0,p) ) continue; if( (mTerm&~orderDistinctMask)==0 ){ obSat |= MASKBIT(i); } @@ -164380,14 +167473,6 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ rUnsorted -= 2; /* TUNING: Slight bias in favor of no-sort plans */ } - /* TUNING: A full-scan of a VIEW or subquery in the outer loop - ** is not so bad. */ - if( iLoop==0 && (pWLoop->wsFlags & WHERE_VIEWSCAN)!=0 && nLoop>1 ){ - rCost += -10; - nOut += -30; - WHERETRACE(0x80,("VIEWSCAN cost reduction for %c\n",pWLoop->cId)); - } - /* Check to see if pWLoop should be added to the set of ** mxChoice best-so-far paths. ** @@ -164574,10 +167659,9 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){ pWInfo->eDistinct = WHERE_DISTINCT_ORDERED; } - if( pWInfo->pSelect->pOrderBy - && pWInfo->nOBSat > pWInfo->pSelect->pOrderBy->nExpr ){ - pWInfo->nOBSat = pWInfo->pSelect->pOrderBy->nExpr; - } + /* vvv--- See check-in [12ad822d9b827777] on 2023-03-16 ---vvv */ + assert( pWInfo->pSelect->pOrderBy==0 + || pWInfo->nOBSat <= pWInfo->pSelect->pOrderBy->nExpr ); }else{ pWInfo->revMask = pFrom->revLoop; if( pWInfo->nOBSat<=0 ){ @@ -164620,7 +167704,6 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ } } - pWInfo->nRowOut = pFrom->nRow; /* Free temporary memory and return success */ @@ -164628,6 +167711,83 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ return SQLITE_OK; } +/* +** This routine implements a heuristic designed to improve query planning. +** This routine is called in between the first and second call to +** wherePathSolver(). Hence the name "Interstage" "Heuristic". +** +** The first call to wherePathSolver() (hereafter just "solver()") computes +** the best path without regard to the order of the outputs. The second call +** to the solver() builds upon the first call to try to find an alternative +** path that satisfies the ORDER BY clause. +** +** This routine looks at the results of the first solver() run, and for +** every FROM clause term in the resulting query plan that uses an equality +** constraint against an index, disable other WhereLoops for that same +** FROM clause term that would try to do a full-table scan. This prevents +** an index search from being converted into a full-table scan in order to +** satisfy an ORDER BY clause, since even though we might get slightly better +** performance using the full-scan without sorting if the output size +** estimates are very precise, we might also get severe performance +** degradation using the full-scan if the output size estimate is too large. +** It is better to err on the side of caution. +** +** Except, if the first solver() call generated a full-table scan in an outer +** loop then stop this analysis at the first full-scan, since the second +** solver() run might try to swap that full-scan for another in order to +** get the output into the correct order. In other words, we allow a +** rewrite like this: +** +** First Solver() Second Solver() +** |-- SCAN t1 |-- SCAN t2 +** |-- SEARCH t2 `-- SEARCH t1 +** `-- SORT USING B-TREE +** +** The purpose of this routine is to disallow rewrites such as: +** +** First Solver() Second Solver() +** |-- SEARCH t1 |-- SCAN t2 <--- bad! +** |-- SEARCH t2 `-- SEARCH t1 +** `-- SORT USING B-TREE +** +** See test cases in test/whereN.test for the real-world query that +** originally provoked this heuristic. +*/ +static SQLITE_NOINLINE void whereInterstageHeuristic(WhereInfo *pWInfo){ + int i; +#ifdef WHERETRACE_ENABLED + int once = 0; +#endif + for(i=0; inLevel; i++){ + WhereLoop *p = pWInfo->a[i].pWLoop; + if( p==0 ) break; + if( (p->wsFlags & WHERE_VIRTUALTABLE)!=0 ) continue; + if( (p->wsFlags & (WHERE_COLUMN_EQ|WHERE_COLUMN_NULL|WHERE_COLUMN_IN))!=0 ){ + u8 iTab = p->iTab; + WhereLoop *pLoop; + for(pLoop=pWInfo->pLoops; pLoop; pLoop=pLoop->pNextLoop){ + if( pLoop->iTab!=iTab ) continue; + if( (pLoop->wsFlags & (WHERE_CONSTRAINT|WHERE_AUTO_INDEX))!=0 ){ + /* Auto-index and index-constrained loops allowed to remain */ + continue; + } +#ifdef WHERETRACE_ENABLED + if( sqlite3WhereTrace & 0x80 ){ + if( once==0 ){ + sqlite3DebugPrintf("Loops disabled by interstage heuristic:\n"); + once = 1; + } + sqlite3WhereLoopPrint(pLoop, &pWInfo->sWC); + } +#endif /* WHERETRACE_ENABLED */ + pLoop->prereq = ALLBITS; /* Prevent 2nd solver() from using this one */ + } + }else{ + break; + } + } +} + /* ** Most queries use only a single table (they are not joins) and have ** simple == constraints against indexed fields. This routine attempts @@ -164916,7 +168076,7 @@ static SQLITE_NOINLINE void whereCheckIfBloomFilterIsUseful( SrcItem *pItem = &pWInfo->pTabList->a[pLoop->iTab]; Table *pTab = pItem->pTab; if( (pTab->tabFlags & TF_HasStat1)==0 ) break; - pTab->tabFlags |= TF_StatsUsed; + pTab->tabFlags |= TF_MaybeReanalyze; if( i>=1 && (pLoop->wsFlags & reqFlags)==reqFlags /* vvvvvv--- Always the case if WHERE_COLUMN_EQ is defined */ @@ -164938,17 +168098,55 @@ static SQLITE_NOINLINE void whereCheckIfBloomFilterIsUseful( } /* -** This is an sqlite3ParserAddCleanup() callback that is invoked to -** free the Parse->pIdxEpr list when the Parse object is destroyed. +** Expression Node callback for sqlite3ExprCanReturnSubtype(). +** +** Only a function call is able to return a subtype. So if the node +** is not a function call, return WRC_Prune immediately. +** +** A function call is able to return a subtype if it has the +** SQLITE_RESULT_SUBTYPE property. +** +** Assume that every function is able to pass-through a subtype from +** one of its argument (using sqlite3_result_value()). Most functions +** are not this way, but we don't have a mechanism to distinguish those +** that are from those that are not, so assume they all work this way. +** That means that if one of its arguments is another function and that +** other function is able to return a subtype, then this function is +** able to return a subtype. */ -static void whereIndexedExprCleanup(sqlite3 *db, void *pObject){ - Parse *pParse = (Parse*)pObject; - while( pParse->pIdxEpr!=0 ){ - IndexedExpr *p = pParse->pIdxEpr; - pParse->pIdxEpr = p->pIENext; - sqlite3ExprDelete(db, p->pExpr); - sqlite3DbFreeNN(db, p); +static int exprNodeCanReturnSubtype(Walker *pWalker, Expr *pExpr){ + int n; + FuncDef *pDef; + sqlite3 *db; + if( pExpr->op!=TK_FUNCTION ){ + return WRC_Prune; } + assert( ExprUseXList(pExpr) ); + db = pWalker->pParse->db; + n = pExpr->x.pList ? pExpr->x.pList->nExpr : 0; + pDef = sqlite3FindFunction(db, pExpr->u.zToken, n, ENC(db), 0); + if( pDef==0 || (pDef->funcFlags & SQLITE_RESULT_SUBTYPE)!=0 ){ + pWalker->eCode = 1; + return WRC_Prune; + } + return WRC_Continue; +} + +/* +** Return TRUE if expression pExpr is able to return a subtype. +** +** A TRUE return does not guarantee that a subtype will be returned. +** It only indicates that a subtype return is possible. False positives +** are acceptable as they only disable an optimization. False negatives, +** on the other hand, can lead to incorrect answers. +*/ +static int sqlite3ExprCanReturnSubtype(Parse *pParse, Expr *pExpr){ + Walker w; + memset(&w, 0, sizeof(w)); + w.pParse = pParse; + w.xExprCallback = exprNodeCanReturnSubtype; + sqlite3WalkExpr(&w, pExpr); + return w.eCode; } /* @@ -164976,20 +168174,20 @@ static SQLITE_NOINLINE void whereAddIndexedExpr( for(i=0; inColumn; i++){ Expr *pExpr; int j = pIdx->aiColumn[i]; - int bMaybeNullRow; if( j==XN_EXPR ){ pExpr = pIdx->aColExpr->a[i].pExpr; - testcase( pTabItem->fg.jointype & JT_LEFT ); - testcase( pTabItem->fg.jointype & JT_RIGHT ); - testcase( pTabItem->fg.jointype & JT_LTORJ ); - bMaybeNullRow = (pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0; }else if( j>=0 && (pTab->aCol[j].colFlags & COLFLAG_VIRTUAL)!=0 ){ pExpr = sqlite3ColumnExpr(pTab, &pTab->aCol[j]); - bMaybeNullRow = 0; }else{ continue; } - if( sqlite3ExprIsConstant(pExpr) ) continue; + if( sqlite3ExprIsConstant(0,pExpr) ) continue; + if( pExpr->op==TK_FUNCTION && sqlite3ExprCanReturnSubtype(pParse,pExpr) ){ + /* Functions that might set a subtype should not be replaced by the + ** value taken from an expression index since the index omits the + ** subtype. https://sqlite.org/forum/forumpost/68d284c86b082c3e */ + continue; + } p = sqlite3DbMallocRaw(pParse->db, sizeof(IndexedExpr)); if( p==0 ) break; p->pIENext = pParse->pIdxEpr; @@ -165003,7 +168201,7 @@ static SQLITE_NOINLINE void whereAddIndexedExpr( p->iDataCur = pTabItem->iCursor; p->iIdxCur = iIdxCur; p->iIdxCol = i; - p->bMaybeNullRow = bMaybeNullRow; + p->bMaybeNullRow = (pTabItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT))!=0; if( sqlite3IndexAffinityStr(pParse->db, pIdx) ){ p->aff = pIdx->zColAff[i]; } @@ -165012,7 +168210,8 @@ static SQLITE_NOINLINE void whereAddIndexedExpr( #endif pParse->pIdxEpr = p; if( p->pIENext==0 ){ - sqlite3ParserAddCleanup(pParse, whereIndexedExprCleanup, pParse); + void *pArg = (void*)&pParse->pIdxEpr; + sqlite3ParserAddCleanup(pParse, whereIndexedExprCleanup, pArg); } } } @@ -165167,7 +168366,10 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( /* An ORDER/GROUP BY clause of more than 63 terms cannot be optimized */ testcase( pOrderBy && pOrderBy->nExpr==BMS-1 ); - if( pOrderBy && pOrderBy->nExpr>=BMS ) pOrderBy = 0; + if( pOrderBy && pOrderBy->nExpr>=BMS ){ + pOrderBy = 0; + wctrlFlags &= ~WHERE_WANT_DISTINCT; + } /* The number of tables in the FROM clause is limited by the number of ** bits in a Bitmask @@ -165192,7 +168394,10 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( ** field (type Bitmask) it must be aligned on an 8-byte boundary on ** some architectures. Hence the ROUND8() below. */ - nByteWInfo = ROUND8P(sizeof(WhereInfo)+(nTabList-1)*sizeof(WhereLevel)); + nByteWInfo = ROUND8P(sizeof(WhereInfo)); + if( nTabList>1 ){ + nByteWInfo = ROUND8P(nByteWInfo + (nTabList-1)*sizeof(WhereLevel)); + } pWInfo = sqlite3DbMallocRawNN(db, nByteWInfo + sizeof(WhereLoop)); if( db->mallocFailed ){ sqlite3DbFree(db, pWInfo); @@ -165246,7 +168451,11 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( ){ pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE; } - ExplainQueryPlan((pParse, 0, "SCAN CONSTANT ROW")); + if( ALWAYS(pWInfo->pSelect) + && (pWInfo->pSelect->selFlags & SF_MultiValue)==0 + ){ + ExplainQueryPlan((pParse, 0, "SCAN CONSTANT ROW")); + } }else{ /* Assign a bit from the bitmask to every term in the FROM clause. ** @@ -165399,9 +168608,20 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( wherePathSolver(pWInfo, 0); if( db->mallocFailed ) goto whereBeginError; if( pWInfo->pOrderBy ){ + whereInterstageHeuristic(pWInfo); wherePathSolver(pWInfo, pWInfo->nRowOut+1); if( db->mallocFailed ) goto whereBeginError; } + + /* TUNING: Assume that a DISTINCT clause on a subquery reduces + ** the output size by a factor of 8 (LogEst -30). + */ + if( (pWInfo->wctrlFlags & WHERE_WANT_DISTINCT)!=0 ){ + WHERETRACE(0x0080,("nRowOut reduced from %d to %d due to DISTINCT\n", + pWInfo->nRowOut, pWInfo->nRowOut-30)); + pWInfo->nRowOut -= 30; + } + } assert( pWInfo->pTabList!=0 ); if( pWInfo->pOrderBy==0 && (db->flags & SQLITE_ReverseOrder)!=0 ){ @@ -165614,6 +168834,11 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( if( pIx->bHasExpr && OptimizationEnabled(db, SQLITE_IndexedExpr) ){ whereAddIndexedExpr(pParse, pIx, iIndexCur, pTabItem); } + if( pIx->pPartIdxWhere && (pTabItem->fg.jointype & JT_RIGHT)==0 ){ + wherePartIdxExpr( + pParse, pIx, pIx->pPartIdxWhere, 0, iIndexCur, pTabItem + ); + } } pLevel->iIdxCur = iIndexCur; assert( pIx!=0 ); @@ -165739,6 +168964,11 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( pParse->nQueryLoop = pWInfo->savedNQueryLoop; whereInfoFree(db, pWInfo); } +#ifdef WHERETRACE_ENABLED + /* Prevent harmless compiler warnings about debugging routines + ** being declared but never used */ + sqlite3ShowWhereLoopList(0); +#endif /* WHERETRACE_ENABLED */ return 0; } @@ -165928,7 +169158,15 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin); VdbeCoverage(v); assert( (ws & WHERE_IDX_ONLY)==0 || (ws & WHERE_INDEXED)!=0 ); if( (ws & WHERE_IDX_ONLY)==0 ){ - assert( pLevel->iTabCur==pTabList->a[pLevel->iFrom].iCursor ); + SrcItem *pSrc = &pTabList->a[pLevel->iFrom]; + assert( pLevel->iTabCur==pSrc->iCursor ); + if( pSrc->fg.viaCoroutine ){ + int m, n; + n = pSrc->regResult; + assert( pSrc->pTab!=0 ); + m = pSrc->pTab->nCol; + sqlite3VdbeAddOp3(v, OP_Null, 0, n, n+m-1); + } sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iTabCur); } if( (ws & WHERE_INDEXED) @@ -165978,6 +169216,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ */ if( pTabItem->fg.viaCoroutine ){ testcase( pParse->db->mallocFailed ); + assert( pTabItem->regResult>=0 ); translateColumnToCopy(pParse, pLevel->addrBody, pLevel->iTabCur, pTabItem->regResult, 0); continue; @@ -167156,7 +170395,7 @@ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){ assert( ExprUseXList(pWin->pOwner) ); assert( pWin->pWFunc!=0 ); pArgs = pWin->pOwner->x.pList; - if( pWin->pWFunc->funcFlags & SQLITE_FUNC_SUBTYPE ){ + if( pWin->pWFunc->funcFlags & SQLITE_SUBTYPE ){ selectWindowRewriteEList(pParse, pMWin, pSrc, pArgs, pTab, &pSublist); pWin->iArgCol = (pSublist ? pSublist->nExpr : 0); pWin->bExprArgs = 1; @@ -167282,7 +170521,7 @@ SQLITE_PRIVATE void sqlite3WindowListDelete(sqlite3 *db, Window *p){ ** variable values in the expression tree. */ static Expr *sqlite3WindowOffsetExpr(Parse *pParse, Expr *pExpr){ - if( 0==sqlite3ExprIsConstant(pExpr) ){ + if( 0==sqlite3ExprIsConstant(0,pExpr) ){ if( IN_RENAME_OBJECT ) sqlite3RenameExprUnmap(pParse, pExpr); sqlite3ExprDelete(pParse->db, pExpr); pExpr = sqlite3ExprAlloc(pParse->db, TK_NULL, 0, 0); @@ -167430,8 +170669,9 @@ SQLITE_PRIVATE void sqlite3WindowAttach(Parse *pParse, Expr *p, Window *pWin){ if( p ){ assert( p->op==TK_FUNCTION ); assert( pWin ); + assert( ExprIsFullSize(p) ); p->y.pWin = pWin; - ExprSetProperty(p, EP_WinFunc); + ExprSetProperty(p, EP_WinFunc|EP_FullSize); pWin->pOwner = p; if( (p->flags & EP_Distinct) && pWin->eFrmType!=TK_FILTER ){ sqlite3ErrorMsg(pParse, @@ -169373,6 +172613,14 @@ static void updateDeleteLimitError( return pSelect; } + /* Memory allocator for parser stack resizing. This is a thin wrapper around + ** sqlite3_realloc() that includes a call to sqlite3FaultSim() to facilitate + ** testing. + */ + static void *parserStackRealloc(void *pOld, sqlite3_uint64 newSize){ + return sqlite3FaultSim(700) ? 0 : sqlite3_realloc(pOld, newSize); + } + /* Construct a new Expr object from a single token */ static Expr *tokenExpr(Parse *pParse, int op, Token t){ @@ -169622,8 +172870,8 @@ static void updateDeleteLimitError( #define TK_TRUEFALSE 170 #define TK_ISNOT 171 #define TK_FUNCTION 172 -#define TK_UMINUS 173 -#define TK_UPLUS 174 +#define TK_UPLUS 173 +#define TK_UMINUS 174 #define TK_TRUTH 175 #define TK_REGISTER 176 #define TK_VECTOR 177 @@ -169632,8 +172880,9 @@ static void updateDeleteLimitError( #define TK_ASTERISK 180 #define TK_SPAN 181 #define TK_ERROR 182 -#define TK_SPACE 183 -#define TK_ILLEGAL 184 +#define TK_QNUMBER 183 +#define TK_SPACE 184 +#define TK_ILLEGAL 185 #endif /**************** End token definitions ***************************************/ @@ -169674,6 +172923,9 @@ static void updateDeleteLimitError( ** sqlite3ParserARG_STORE Code to store %extra_argument into yypParser ** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser ** sqlite3ParserCTX_* As sqlite3ParserARG_ except for %extra_context +** YYREALLOC Name of the realloc() function to use +** YYFREE Name of the free() function to use +** YYDYNSTACK True if stack space should be extended on heap ** YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** YYNSTATE the combined number of states. @@ -169687,37 +172939,39 @@ static void updateDeleteLimitError( ** YY_NO_ACTION The yy_action[] code for no-op ** YY_MIN_REDUCE Minimum value for reduce actions ** YY_MAX_REDUCE Maximum value for reduce actions +** YY_MIN_DSTRCTR Minimum symbol value that has a destructor +** YY_MAX_DSTRCTR Maximum symbol value that has a destructor */ #ifndef INTERFACE # define INTERFACE 1 #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 319 +#define YYNOCODE 322 #define YYACTIONTYPE unsigned short int #define YYWILDCARD 101 #define sqlite3ParserTOKENTYPE Token typedef union { int yyinit; sqlite3ParserTOKENTYPE yy0; - TriggerStep* yy33; - Window* yy41; - Select* yy47; - SrcList* yy131; - struct TrigEvent yy180; - struct {int value; int mask;} yy231; - IdList* yy254; - u32 yy285; - ExprList* yy322; - Cte* yy385; - int yy394; - Upsert* yy444; - u8 yy516; - With* yy521; - const char* yy522; - Expr* yy528; - OnOrUsing yy561; - struct FrameBound yy595; + ExprList* yy14; + With* yy59; + Cte* yy67; + Upsert* yy122; + IdList* yy132; + int yy144; + const char* yy168; + SrcList* yy203; + Window* yy211; + OnOrUsing yy269; + struct TrigEvent yy286; + struct {int value; int mask;} yy383; + u32 yy391; + TriggerStep* yy427; + Expr* yy454; + u8 yy462; + struct FrameBound yy509; + Select* yy555; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -169727,24 +172981,29 @@ typedef union { #define sqlite3ParserARG_PARAM #define sqlite3ParserARG_FETCH #define sqlite3ParserARG_STORE +#define YYREALLOC parserStackRealloc +#define YYFREE sqlite3_free +#define YYDYNSTACK 1 #define sqlite3ParserCTX_SDECL Parse *pParse; #define sqlite3ParserCTX_PDECL ,Parse *pParse #define sqlite3ParserCTX_PARAM ,pParse #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; #define sqlite3ParserCTX_STORE yypParser->pParse=pParse; #define YYFALLBACK 1 -#define YYNSTATE 575 -#define YYNRULE 403 -#define YYNRULE_WITH_ACTION 338 -#define YYNTOKEN 185 -#define YY_MAX_SHIFT 574 -#define YY_MIN_SHIFTREDUCE 833 -#define YY_MAX_SHIFTREDUCE 1235 -#define YY_ERROR_ACTION 1236 -#define YY_ACCEPT_ACTION 1237 -#define YY_NO_ACTION 1238 -#define YY_MIN_REDUCE 1239 -#define YY_MAX_REDUCE 1641 +#define YYNSTATE 583 +#define YYNRULE 409 +#define YYNRULE_WITH_ACTION 344 +#define YYNTOKEN 186 +#define YY_MAX_SHIFT 582 +#define YY_MIN_SHIFTREDUCE 845 +#define YY_MAX_SHIFTREDUCE 1253 +#define YY_ERROR_ACTION 1254 +#define YY_ACCEPT_ACTION 1255 +#define YY_NO_ACTION 1256 +#define YY_MIN_REDUCE 1257 +#define YY_MAX_REDUCE 1665 +#define YY_MIN_DSTRCTR 205 +#define YY_MAX_DSTRCTR 319 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -169760,6 +173019,22 @@ typedef union { # define yytestcase(X) #endif +/* Macro to determine if stack space has the ability to grow using +** heap memory. +*/ +#if YYSTACKDEPTH<=0 || YYDYNSTACK +# define YYGROWABLESTACK 1 +#else +# define YYGROWABLESTACK 0 +#endif + +/* Guarantee a minimum number of initial stack slots. +*/ +#if YYSTACKDEPTH<=0 +# undef YYSTACKDEPTH +# define YYSTACKDEPTH 2 /* Need a minimum stack size */ +#endif + /* Next are the tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement @@ -169811,618 +173086,630 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2096) +#define YY_ACTTAB_COUNT (2142) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 568, 208, 568, 118, 115, 229, 568, 118, 115, 229, - /* 10 */ 568, 1310, 377, 1289, 408, 562, 562, 562, 568, 409, - /* 20 */ 378, 1310, 1272, 41, 41, 41, 41, 208, 1520, 71, - /* 30 */ 71, 969, 419, 41, 41, 491, 303, 279, 303, 970, - /* 40 */ 397, 71, 71, 125, 126, 80, 1210, 1210, 1047, 1050, - /* 50 */ 1037, 1037, 123, 123, 124, 124, 124, 124, 476, 409, - /* 60 */ 1237, 1, 1, 574, 2, 1241, 550, 118, 115, 229, - /* 70 */ 317, 480, 146, 480, 524, 118, 115, 229, 529, 1323, - /* 80 */ 417, 523, 142, 125, 126, 80, 1210, 1210, 1047, 1050, - /* 90 */ 1037, 1037, 123, 123, 124, 124, 124, 124, 118, 115, - /* 100 */ 229, 327, 122, 122, 122, 122, 121, 121, 120, 120, - /* 110 */ 120, 119, 116, 444, 284, 284, 284, 284, 442, 442, - /* 120 */ 442, 1559, 376, 1561, 1186, 375, 1157, 565, 1157, 565, - /* 130 */ 409, 1559, 537, 259, 226, 444, 101, 145, 449, 316, - /* 140 */ 559, 240, 122, 122, 122, 122, 121, 121, 120, 120, - /* 150 */ 120, 119, 116, 444, 125, 126, 80, 1210, 1210, 1047, - /* 160 */ 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, 142, - /* 170 */ 294, 1186, 339, 448, 120, 120, 120, 119, 116, 444, - /* 180 */ 127, 1186, 1187, 1186, 148, 441, 440, 568, 119, 116, - /* 190 */ 444, 124, 124, 124, 124, 117, 122, 122, 122, 122, - /* 200 */ 121, 121, 120, 120, 120, 119, 116, 444, 454, 113, - /* 210 */ 13, 13, 546, 122, 122, 122, 122, 121, 121, 120, - /* 220 */ 120, 120, 119, 116, 444, 422, 316, 559, 1186, 1187, - /* 230 */ 1186, 149, 1218, 409, 1218, 124, 124, 124, 124, 122, - /* 240 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116, - /* 250 */ 444, 465, 342, 1034, 1034, 1048, 1051, 125, 126, 80, - /* 260 */ 1210, 1210, 1047, 1050, 1037, 1037, 123, 123, 124, 124, - /* 270 */ 124, 124, 1275, 522, 222, 1186, 568, 409, 224, 514, - /* 280 */ 175, 82, 83, 122, 122, 122, 122, 121, 121, 120, - /* 290 */ 120, 120, 119, 116, 444, 1005, 16, 16, 1186, 133, - /* 300 */ 133, 125, 126, 80, 1210, 1210, 1047, 1050, 1037, 1037, - /* 310 */ 123, 123, 124, 124, 124, 124, 122, 122, 122, 122, - /* 320 */ 121, 121, 120, 120, 120, 119, 116, 444, 1038, 546, - /* 330 */ 1186, 373, 1186, 1187, 1186, 252, 1429, 399, 504, 501, - /* 340 */ 500, 111, 560, 566, 4, 924, 924, 433, 499, 340, - /* 350 */ 460, 328, 360, 394, 1231, 1186, 1187, 1186, 563, 568, - /* 360 */ 122, 122, 122, 122, 121, 121, 120, 120, 120, 119, - /* 370 */ 116, 444, 284, 284, 369, 1572, 1598, 441, 440, 154, - /* 380 */ 409, 445, 71, 71, 1282, 565, 1215, 1186, 1187, 1186, - /* 390 */ 85, 1217, 271, 557, 543, 515, 515, 568, 98, 1216, - /* 400 */ 6, 1274, 472, 142, 125, 126, 80, 1210, 1210, 1047, - /* 410 */ 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, 550, - /* 420 */ 13, 13, 1024, 507, 1218, 1186, 1218, 549, 109, 109, - /* 430 */ 222, 568, 1232, 175, 568, 427, 110, 197, 445, 569, - /* 440 */ 445, 430, 1546, 1014, 325, 551, 1186, 270, 287, 368, - /* 450 */ 510, 363, 509, 257, 71, 71, 543, 71, 71, 359, - /* 460 */ 316, 559, 1604, 122, 122, 122, 122, 121, 121, 120, - /* 470 */ 120, 120, 119, 116, 444, 1014, 1014, 1016, 1017, 27, - /* 480 */ 284, 284, 1186, 1187, 1186, 1152, 568, 1603, 409, 899, - /* 490 */ 190, 550, 356, 565, 550, 935, 533, 517, 1152, 516, - /* 500 */ 413, 1152, 552, 1186, 1187, 1186, 568, 544, 544, 51, - /* 510 */ 51, 214, 125, 126, 80, 1210, 1210, 1047, 1050, 1037, - /* 520 */ 1037, 123, 123, 124, 124, 124, 124, 1186, 474, 135, - /* 530 */ 135, 409, 284, 284, 1484, 505, 121, 121, 120, 120, - /* 540 */ 120, 119, 116, 444, 1005, 565, 518, 217, 541, 541, - /* 550 */ 316, 559, 142, 6, 532, 125, 126, 80, 1210, 1210, - /* 560 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, - /* 570 */ 1548, 122, 122, 122, 122, 121, 121, 120, 120, 120, - /* 580 */ 119, 116, 444, 485, 1186, 1187, 1186, 482, 281, 1263, - /* 590 */ 955, 252, 1186, 373, 504, 501, 500, 1186, 340, 570, - /* 600 */ 1186, 570, 409, 292, 499, 955, 874, 191, 480, 316, - /* 610 */ 559, 384, 290, 380, 122, 122, 122, 122, 121, 121, - /* 620 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1210, - /* 630 */ 1210, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, - /* 640 */ 124, 409, 394, 1132, 1186, 867, 100, 284, 284, 1186, - /* 650 */ 1187, 1186, 373, 1089, 1186, 1187, 1186, 1186, 1187, 1186, - /* 660 */ 565, 455, 32, 373, 233, 125, 126, 80, 1210, 1210, - /* 670 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, - /* 680 */ 1428, 957, 568, 228, 956, 122, 122, 122, 122, 121, - /* 690 */ 121, 120, 120, 120, 119, 116, 444, 1152, 228, 1186, - /* 700 */ 157, 1186, 1187, 1186, 1547, 13, 13, 301, 955, 1226, - /* 710 */ 1152, 153, 409, 1152, 373, 1575, 1170, 5, 369, 1572, - /* 720 */ 429, 1232, 3, 955, 122, 122, 122, 122, 121, 121, - /* 730 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1210, - /* 740 */ 1210, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, - /* 750 */ 124, 409, 208, 567, 1186, 1025, 1186, 1187, 1186, 1186, - /* 760 */ 388, 850, 155, 1546, 286, 402, 1094, 1094, 488, 568, - /* 770 */ 465, 342, 1315, 1315, 1546, 125, 126, 80, 1210, 1210, - /* 780 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, - /* 790 */ 129, 568, 13, 13, 374, 122, 122, 122, 122, 121, - /* 800 */ 121, 120, 120, 120, 119, 116, 444, 302, 568, 453, - /* 810 */ 528, 1186, 1187, 1186, 13, 13, 1186, 1187, 1186, 1293, - /* 820 */ 463, 1263, 409, 1313, 1313, 1546, 1010, 453, 452, 200, - /* 830 */ 299, 71, 71, 1261, 122, 122, 122, 122, 121, 121, - /* 840 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1210, - /* 850 */ 1210, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, - /* 860 */ 124, 409, 227, 1069, 1152, 284, 284, 419, 312, 278, - /* 870 */ 278, 285, 285, 1415, 406, 405, 382, 1152, 565, 568, - /* 880 */ 1152, 1189, 565, 1592, 565, 125, 126, 80, 1210, 1210, - /* 890 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, - /* 900 */ 453, 1476, 13, 13, 1530, 122, 122, 122, 122, 121, - /* 910 */ 121, 120, 120, 120, 119, 116, 444, 201, 568, 354, - /* 920 */ 1578, 574, 2, 1241, 838, 839, 840, 1554, 317, 1205, - /* 930 */ 146, 6, 409, 255, 254, 253, 206, 1323, 9, 1189, - /* 940 */ 262, 71, 71, 424, 122, 122, 122, 122, 121, 121, - /* 950 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1210, - /* 960 */ 1210, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, - /* 970 */ 124, 568, 284, 284, 568, 1206, 409, 573, 313, 1241, - /* 980 */ 349, 1292, 352, 419, 317, 565, 146, 491, 525, 1635, - /* 990 */ 395, 371, 491, 1323, 70, 70, 1291, 71, 71, 240, - /* 1000 */ 1321, 104, 80, 1210, 1210, 1047, 1050, 1037, 1037, 123, - /* 1010 */ 123, 124, 124, 124, 124, 122, 122, 122, 122, 121, - /* 1020 */ 121, 120, 120, 120, 119, 116, 444, 1110, 284, 284, - /* 1030 */ 428, 448, 1519, 1206, 439, 284, 284, 1483, 1348, 311, - /* 1040 */ 474, 565, 1111, 969, 491, 491, 217, 1259, 565, 1532, - /* 1050 */ 568, 970, 207, 568, 1024, 240, 383, 1112, 519, 122, - /* 1060 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116, - /* 1070 */ 444, 1015, 107, 71, 71, 1014, 13, 13, 910, 568, - /* 1080 */ 1489, 568, 284, 284, 97, 526, 491, 448, 911, 1322, - /* 1090 */ 1318, 545, 409, 284, 284, 565, 151, 209, 1489, 1491, - /* 1100 */ 262, 450, 55, 55, 56, 56, 565, 1014, 1014, 1016, - /* 1110 */ 443, 332, 409, 527, 12, 295, 125, 126, 80, 1210, - /* 1120 */ 1210, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, - /* 1130 */ 124, 347, 409, 862, 1528, 1206, 125, 126, 80, 1210, - /* 1140 */ 1210, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, - /* 1150 */ 124, 1133, 1633, 474, 1633, 371, 125, 114, 80, 1210, - /* 1160 */ 1210, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, - /* 1170 */ 124, 1489, 329, 474, 331, 122, 122, 122, 122, 121, - /* 1180 */ 121, 120, 120, 120, 119, 116, 444, 203, 1415, 568, - /* 1190 */ 1290, 862, 464, 1206, 436, 122, 122, 122, 122, 121, - /* 1200 */ 121, 120, 120, 120, 119, 116, 444, 553, 1133, 1634, - /* 1210 */ 539, 1634, 15, 15, 890, 122, 122, 122, 122, 121, - /* 1220 */ 121, 120, 120, 120, 119, 116, 444, 568, 298, 538, - /* 1230 */ 1131, 1415, 1552, 1553, 1327, 409, 6, 6, 1163, 1264, - /* 1240 */ 415, 320, 284, 284, 1415, 508, 565, 525, 300, 457, - /* 1250 */ 43, 43, 568, 891, 12, 565, 330, 478, 425, 407, - /* 1260 */ 126, 80, 1210, 1210, 1047, 1050, 1037, 1037, 123, 123, - /* 1270 */ 124, 124, 124, 124, 568, 57, 57, 288, 1186, 1415, - /* 1280 */ 496, 458, 392, 392, 391, 273, 389, 1131, 1551, 847, - /* 1290 */ 1163, 407, 6, 568, 321, 1152, 470, 44, 44, 1550, - /* 1300 */ 1110, 426, 234, 6, 323, 256, 540, 256, 1152, 431, - /* 1310 */ 568, 1152, 322, 17, 487, 1111, 58, 58, 122, 122, - /* 1320 */ 122, 122, 121, 121, 120, 120, 120, 119, 116, 444, - /* 1330 */ 1112, 216, 481, 59, 59, 1186, 1187, 1186, 111, 560, - /* 1340 */ 324, 4, 236, 456, 526, 568, 237, 456, 568, 437, - /* 1350 */ 168, 556, 420, 141, 479, 563, 568, 293, 568, 1091, - /* 1360 */ 568, 293, 568, 1091, 531, 568, 870, 8, 60, 60, - /* 1370 */ 235, 61, 61, 568, 414, 568, 414, 568, 445, 62, - /* 1380 */ 62, 45, 45, 46, 46, 47, 47, 199, 49, 49, - /* 1390 */ 557, 568, 359, 568, 100, 486, 50, 50, 63, 63, - /* 1400 */ 64, 64, 561, 415, 535, 410, 568, 1024, 568, 534, - /* 1410 */ 316, 559, 316, 559, 65, 65, 14, 14, 568, 1024, - /* 1420 */ 568, 512, 930, 870, 1015, 109, 109, 929, 1014, 66, - /* 1430 */ 66, 131, 131, 110, 451, 445, 569, 445, 416, 177, - /* 1440 */ 1014, 132, 132, 67, 67, 568, 467, 568, 930, 471, - /* 1450 */ 1360, 283, 226, 929, 315, 1359, 407, 568, 459, 407, - /* 1460 */ 1014, 1014, 1016, 239, 407, 86, 213, 1346, 52, 52, - /* 1470 */ 68, 68, 1014, 1014, 1016, 1017, 27, 1577, 1174, 447, - /* 1480 */ 69, 69, 288, 97, 108, 1535, 106, 392, 392, 391, - /* 1490 */ 273, 389, 568, 877, 847, 881, 568, 111, 560, 466, - /* 1500 */ 4, 568, 152, 30, 38, 568, 1128, 234, 396, 323, - /* 1510 */ 111, 560, 527, 4, 563, 53, 53, 322, 568, 163, - /* 1520 */ 163, 568, 337, 468, 164, 164, 333, 563, 76, 76, - /* 1530 */ 568, 289, 1508, 568, 31, 1507, 568, 445, 338, 483, - /* 1540 */ 100, 54, 54, 344, 72, 72, 296, 236, 1076, 557, - /* 1550 */ 445, 877, 1356, 134, 134, 168, 73, 73, 141, 161, - /* 1560 */ 161, 1566, 557, 535, 568, 319, 568, 348, 536, 1007, - /* 1570 */ 473, 261, 261, 889, 888, 235, 535, 568, 1024, 568, - /* 1580 */ 475, 534, 261, 367, 109, 109, 521, 136, 136, 130, - /* 1590 */ 130, 1024, 110, 366, 445, 569, 445, 109, 109, 1014, - /* 1600 */ 162, 162, 156, 156, 568, 110, 1076, 445, 569, 445, - /* 1610 */ 410, 351, 1014, 568, 353, 316, 559, 568, 343, 568, - /* 1620 */ 100, 497, 357, 258, 100, 896, 897, 140, 140, 355, - /* 1630 */ 1306, 1014, 1014, 1016, 1017, 27, 139, 139, 362, 451, - /* 1640 */ 137, 137, 138, 138, 1014, 1014, 1016, 1017, 27, 1174, - /* 1650 */ 447, 568, 372, 288, 111, 560, 1018, 4, 392, 392, - /* 1660 */ 391, 273, 389, 568, 1137, 847, 568, 1072, 568, 258, - /* 1670 */ 492, 563, 568, 211, 75, 75, 555, 960, 234, 261, - /* 1680 */ 323, 111, 560, 927, 4, 113, 77, 77, 322, 74, - /* 1690 */ 74, 42, 42, 1369, 445, 48, 48, 1414, 563, 972, - /* 1700 */ 973, 1088, 1087, 1088, 1087, 860, 557, 150, 928, 1342, - /* 1710 */ 113, 1354, 554, 1419, 1018, 1271, 1262, 1250, 236, 1249, - /* 1720 */ 1251, 445, 1585, 1339, 308, 276, 168, 309, 11, 141, - /* 1730 */ 393, 310, 232, 557, 1401, 1024, 335, 291, 1396, 219, - /* 1740 */ 336, 109, 109, 934, 297, 1406, 235, 341, 477, 110, - /* 1750 */ 502, 445, 569, 445, 1389, 1405, 1014, 400, 1289, 365, - /* 1760 */ 223, 1480, 1024, 1479, 1351, 1352, 1350, 1349, 109, 109, - /* 1770 */ 204, 1588, 1226, 558, 265, 218, 110, 205, 445, 569, - /* 1780 */ 445, 410, 387, 1014, 1527, 179, 316, 559, 1014, 1014, - /* 1790 */ 1016, 1017, 27, 230, 1525, 1223, 79, 560, 85, 4, - /* 1800 */ 418, 215, 548, 81, 84, 188, 1402, 173, 181, 461, - /* 1810 */ 451, 35, 462, 563, 183, 1014, 1014, 1016, 1017, 27, - /* 1820 */ 184, 1485, 185, 186, 495, 242, 98, 398, 1408, 36, - /* 1830 */ 1407, 484, 91, 469, 401, 1410, 445, 192, 1474, 246, - /* 1840 */ 1496, 490, 346, 277, 248, 196, 493, 511, 557, 350, - /* 1850 */ 1252, 249, 250, 403, 1309, 1308, 111, 560, 432, 4, - /* 1860 */ 1307, 1300, 93, 1602, 881, 1601, 224, 404, 434, 520, - /* 1870 */ 263, 435, 1571, 563, 1279, 1278, 364, 1024, 306, 1277, - /* 1880 */ 264, 1600, 1557, 109, 109, 370, 1299, 307, 1556, 438, - /* 1890 */ 128, 110, 1374, 445, 569, 445, 445, 546, 1014, 10, - /* 1900 */ 1461, 105, 381, 1373, 34, 571, 99, 1332, 557, 314, - /* 1910 */ 1180, 530, 272, 274, 379, 210, 1331, 547, 385, 386, - /* 1920 */ 275, 572, 1247, 1242, 411, 412, 1512, 165, 178, 1513, - /* 1930 */ 1014, 1014, 1016, 1017, 27, 1511, 1510, 1024, 78, 147, - /* 1940 */ 166, 220, 221, 109, 109, 834, 304, 167, 446, 212, - /* 1950 */ 318, 110, 231, 445, 569, 445, 144, 1086, 1014, 1084, - /* 1960 */ 326, 180, 169, 1205, 182, 334, 238, 913, 241, 1100, - /* 1970 */ 187, 170, 171, 421, 87, 88, 423, 189, 89, 90, - /* 1980 */ 172, 1103, 243, 1099, 244, 158, 18, 245, 345, 247, - /* 1990 */ 1014, 1014, 1016, 1017, 27, 261, 1092, 193, 1220, 489, - /* 2000 */ 194, 37, 366, 849, 494, 251, 195, 506, 92, 19, - /* 2010 */ 498, 358, 20, 503, 879, 361, 94, 892, 305, 159, - /* 2020 */ 513, 39, 95, 1168, 160, 1053, 964, 1139, 96, 174, - /* 2030 */ 1138, 225, 280, 282, 198, 958, 113, 1158, 1154, 260, - /* 2040 */ 21, 22, 23, 1156, 1162, 1161, 1143, 24, 33, 25, - /* 2050 */ 202, 542, 26, 100, 1067, 102, 1054, 103, 7, 1052, - /* 2060 */ 1056, 1109, 1057, 1108, 266, 267, 28, 40, 390, 1019, - /* 2070 */ 861, 112, 29, 564, 1176, 1175, 268, 176, 143, 923, - /* 2080 */ 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238, - /* 2090 */ 1238, 1238, 1238, 1238, 269, 1593, + /* 0 */ 576, 128, 125, 232, 1622, 549, 576, 1290, 1281, 576, + /* 10 */ 328, 576, 1300, 212, 576, 128, 125, 232, 578, 412, + /* 20 */ 578, 391, 1542, 51, 51, 523, 405, 1293, 529, 51, + /* 30 */ 51, 983, 51, 51, 81, 81, 1107, 61, 61, 984, + /* 40 */ 1107, 1292, 380, 135, 136, 90, 1228, 1228, 1063, 1066, + /* 50 */ 1053, 1053, 133, 133, 134, 134, 134, 134, 1577, 412, + /* 60 */ 287, 287, 7, 287, 287, 422, 1050, 1050, 1064, 1067, + /* 70 */ 289, 556, 492, 573, 524, 561, 573, 497, 561, 482, + /* 80 */ 530, 262, 229, 135, 136, 90, 1228, 1228, 1063, 1066, + /* 90 */ 1053, 1053, 133, 133, 134, 134, 134, 134, 128, 125, + /* 100 */ 232, 1506, 132, 132, 132, 132, 131, 131, 130, 130, + /* 110 */ 130, 129, 126, 450, 1204, 1255, 1, 1, 582, 2, + /* 120 */ 1259, 1571, 420, 1582, 379, 320, 1174, 153, 1174, 1584, + /* 130 */ 412, 378, 1582, 543, 1341, 330, 111, 570, 570, 570, + /* 140 */ 293, 1054, 132, 132, 132, 132, 131, 131, 130, 130, + /* 150 */ 130, 129, 126, 450, 135, 136, 90, 1228, 1228, 1063, + /* 160 */ 1066, 1053, 1053, 133, 133, 134, 134, 134, 134, 287, + /* 170 */ 287, 1204, 1205, 1204, 255, 287, 287, 510, 507, 506, + /* 180 */ 137, 455, 573, 212, 561, 447, 446, 505, 573, 1616, + /* 190 */ 561, 134, 134, 134, 134, 127, 400, 243, 132, 132, + /* 200 */ 132, 132, 131, 131, 130, 130, 130, 129, 126, 450, + /* 210 */ 282, 471, 345, 132, 132, 132, 132, 131, 131, 130, + /* 220 */ 130, 130, 129, 126, 450, 574, 155, 936, 936, 454, + /* 230 */ 227, 521, 1236, 412, 1236, 134, 134, 134, 134, 132, + /* 240 */ 132, 132, 132, 131, 131, 130, 130, 130, 129, 126, + /* 250 */ 450, 130, 130, 130, 129, 126, 450, 135, 136, 90, + /* 260 */ 1228, 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, + /* 270 */ 134, 134, 128, 125, 232, 450, 576, 412, 397, 1249, + /* 280 */ 180, 92, 93, 132, 132, 132, 132, 131, 131, 130, + /* 290 */ 130, 130, 129, 126, 450, 381, 387, 1204, 383, 81, + /* 300 */ 81, 135, 136, 90, 1228, 1228, 1063, 1066, 1053, 1053, + /* 310 */ 133, 133, 134, 134, 134, 134, 132, 132, 132, 132, + /* 320 */ 131, 131, 130, 130, 130, 129, 126, 450, 131, 131, + /* 330 */ 130, 130, 130, 129, 126, 450, 556, 1204, 302, 319, + /* 340 */ 567, 121, 568, 480, 4, 555, 1149, 1657, 1628, 1657, + /* 350 */ 45, 128, 125, 232, 1204, 1205, 1204, 1250, 571, 1169, + /* 360 */ 132, 132, 132, 132, 131, 131, 130, 130, 130, 129, + /* 370 */ 126, 450, 1169, 287, 287, 1169, 1019, 576, 422, 1019, + /* 380 */ 412, 451, 1602, 582, 2, 1259, 573, 44, 561, 95, + /* 390 */ 320, 110, 153, 565, 1204, 1205, 1204, 522, 522, 1341, + /* 400 */ 81, 81, 7, 44, 135, 136, 90, 1228, 1228, 1063, + /* 410 */ 1066, 1053, 1053, 133, 133, 134, 134, 134, 134, 295, + /* 420 */ 1149, 1658, 1040, 1658, 1204, 1147, 319, 567, 119, 119, + /* 430 */ 343, 466, 331, 343, 287, 287, 120, 556, 451, 577, + /* 440 */ 451, 1169, 1169, 1028, 319, 567, 438, 573, 210, 561, + /* 450 */ 1339, 1451, 546, 531, 1169, 1169, 1598, 1169, 1169, 416, + /* 460 */ 319, 567, 243, 132, 132, 132, 132, 131, 131, 130, + /* 470 */ 130, 130, 129, 126, 450, 1028, 1028, 1030, 1031, 35, + /* 480 */ 44, 1204, 1205, 1204, 472, 287, 287, 1328, 412, 1307, + /* 490 */ 372, 1595, 359, 225, 454, 1204, 195, 1328, 573, 1147, + /* 500 */ 561, 1333, 1333, 274, 576, 1188, 576, 340, 46, 196, + /* 510 */ 537, 217, 135, 136, 90, 1228, 1228, 1063, 1066, 1053, + /* 520 */ 1053, 133, 133, 134, 134, 134, 134, 19, 19, 19, + /* 530 */ 19, 412, 581, 1204, 1259, 511, 1204, 319, 567, 320, + /* 540 */ 944, 153, 425, 491, 430, 943, 1204, 488, 1341, 1450, + /* 550 */ 532, 1277, 1204, 1205, 1204, 135, 136, 90, 1228, 1228, + /* 560 */ 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, 134, + /* 570 */ 575, 132, 132, 132, 132, 131, 131, 130, 130, 130, + /* 580 */ 129, 126, 450, 287, 287, 528, 287, 287, 372, 1595, + /* 590 */ 1204, 1205, 1204, 1204, 1205, 1204, 573, 486, 561, 573, + /* 600 */ 889, 561, 412, 1204, 1205, 1204, 886, 40, 22, 22, + /* 610 */ 220, 243, 525, 1449, 132, 132, 132, 132, 131, 131, + /* 620 */ 130, 130, 130, 129, 126, 450, 135, 136, 90, 1228, + /* 630 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, + /* 640 */ 134, 412, 180, 454, 1204, 879, 255, 287, 287, 510, + /* 650 */ 507, 506, 372, 1595, 1568, 1331, 1331, 576, 889, 505, + /* 660 */ 573, 44, 561, 559, 1207, 135, 136, 90, 1228, 1228, + /* 670 */ 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, 134, + /* 680 */ 81, 81, 422, 576, 377, 132, 132, 132, 132, 131, + /* 690 */ 131, 130, 130, 130, 129, 126, 450, 297, 287, 287, + /* 700 */ 460, 1204, 1205, 1204, 1204, 534, 19, 19, 448, 448, + /* 710 */ 448, 573, 412, 561, 230, 436, 1187, 535, 319, 567, + /* 720 */ 363, 432, 1207, 1435, 132, 132, 132, 132, 131, 131, + /* 730 */ 130, 130, 130, 129, 126, 450, 135, 136, 90, 1228, + /* 740 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, + /* 750 */ 134, 412, 211, 949, 1169, 1041, 1110, 1110, 494, 547, + /* 760 */ 547, 1204, 1205, 1204, 7, 539, 1570, 1169, 376, 576, + /* 770 */ 1169, 5, 1204, 486, 3, 135, 136, 90, 1228, 1228, + /* 780 */ 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, 134, + /* 790 */ 576, 513, 19, 19, 427, 132, 132, 132, 132, 131, + /* 800 */ 131, 130, 130, 130, 129, 126, 450, 305, 1204, 433, + /* 810 */ 225, 1204, 385, 19, 19, 273, 290, 371, 516, 366, + /* 820 */ 515, 260, 412, 538, 1568, 549, 1024, 362, 437, 1204, + /* 830 */ 1205, 1204, 902, 1552, 132, 132, 132, 132, 131, 131, + /* 840 */ 130, 130, 130, 129, 126, 450, 135, 136, 90, 1228, + /* 850 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, + /* 860 */ 134, 412, 1435, 514, 1281, 1204, 1205, 1204, 1204, 1205, + /* 870 */ 1204, 903, 48, 342, 1568, 1568, 1279, 1627, 1568, 911, + /* 880 */ 576, 129, 126, 450, 110, 135, 136, 90, 1228, 1228, + /* 890 */ 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, 134, + /* 900 */ 265, 576, 459, 19, 19, 132, 132, 132, 132, 131, + /* 910 */ 131, 130, 130, 130, 129, 126, 450, 1345, 204, 576, + /* 920 */ 459, 458, 50, 47, 19, 19, 49, 434, 1105, 573, + /* 930 */ 497, 561, 412, 428, 108, 1224, 1569, 1554, 376, 205, + /* 940 */ 550, 550, 81, 81, 132, 132, 132, 132, 131, 131, + /* 950 */ 130, 130, 130, 129, 126, 450, 135, 136, 90, 1228, + /* 960 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, + /* 970 */ 134, 480, 576, 1204, 576, 1541, 412, 1435, 969, 315, + /* 980 */ 1659, 398, 284, 497, 969, 893, 1569, 1569, 376, 376, + /* 990 */ 1569, 461, 376, 1224, 459, 80, 80, 81, 81, 497, + /* 1000 */ 374, 114, 90, 1228, 1228, 1063, 1066, 1053, 1053, 133, + /* 1010 */ 133, 134, 134, 134, 134, 132, 132, 132, 132, 131, + /* 1020 */ 131, 130, 130, 130, 129, 126, 450, 1204, 1505, 576, + /* 1030 */ 1204, 1205, 1204, 1366, 316, 486, 281, 281, 497, 431, + /* 1040 */ 557, 288, 288, 402, 1340, 471, 345, 298, 429, 573, + /* 1050 */ 576, 561, 81, 81, 573, 374, 561, 971, 386, 132, + /* 1060 */ 132, 132, 132, 131, 131, 130, 130, 130, 129, 126, + /* 1070 */ 450, 231, 117, 81, 81, 287, 287, 231, 287, 287, + /* 1080 */ 576, 1511, 576, 1336, 1204, 1205, 1204, 139, 573, 556, + /* 1090 */ 561, 573, 412, 561, 441, 456, 969, 213, 558, 1511, + /* 1100 */ 1513, 1550, 969, 143, 143, 145, 145, 1368, 314, 478, + /* 1110 */ 444, 970, 412, 850, 851, 852, 135, 136, 90, 1228, + /* 1120 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, + /* 1130 */ 134, 357, 412, 397, 1148, 304, 135, 136, 90, 1228, + /* 1140 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, + /* 1150 */ 134, 1575, 323, 6, 862, 7, 135, 124, 90, 1228, + /* 1160 */ 1228, 1063, 1066, 1053, 1053, 133, 133, 134, 134, 134, + /* 1170 */ 134, 409, 408, 1511, 212, 132, 132, 132, 132, 131, + /* 1180 */ 131, 130, 130, 130, 129, 126, 450, 411, 118, 1204, + /* 1190 */ 116, 10, 352, 265, 355, 132, 132, 132, 132, 131, + /* 1200 */ 131, 130, 130, 130, 129, 126, 450, 576, 324, 306, + /* 1210 */ 576, 306, 1250, 469, 158, 132, 132, 132, 132, 131, + /* 1220 */ 131, 130, 130, 130, 129, 126, 450, 207, 1224, 1126, + /* 1230 */ 65, 65, 470, 66, 66, 412, 447, 446, 882, 531, + /* 1240 */ 335, 258, 257, 256, 1127, 1233, 1204, 1205, 1204, 327, + /* 1250 */ 1235, 874, 159, 576, 16, 480, 1085, 1040, 1234, 1128, + /* 1260 */ 136, 90, 1228, 1228, 1063, 1066, 1053, 1053, 133, 133, + /* 1270 */ 134, 134, 134, 134, 1029, 576, 81, 81, 1028, 1040, + /* 1280 */ 922, 576, 463, 1236, 576, 1236, 1224, 502, 107, 1435, + /* 1290 */ 923, 6, 576, 410, 1498, 882, 1029, 480, 21, 21, + /* 1300 */ 1028, 332, 1380, 334, 53, 53, 497, 81, 81, 874, + /* 1310 */ 1028, 1028, 1030, 445, 259, 19, 19, 533, 132, 132, + /* 1320 */ 132, 132, 131, 131, 130, 130, 130, 129, 126, 450, + /* 1330 */ 551, 301, 1028, 1028, 1030, 107, 532, 545, 121, 568, + /* 1340 */ 1188, 4, 1126, 1576, 449, 576, 462, 7, 1282, 418, + /* 1350 */ 462, 350, 1435, 576, 518, 571, 544, 1127, 121, 568, + /* 1360 */ 442, 4, 1188, 464, 533, 1180, 1223, 9, 67, 67, + /* 1370 */ 487, 576, 1128, 303, 410, 571, 54, 54, 451, 576, + /* 1380 */ 123, 944, 576, 417, 576, 333, 943, 1379, 576, 236, + /* 1390 */ 565, 576, 1574, 564, 68, 68, 7, 576, 451, 362, + /* 1400 */ 419, 182, 69, 69, 541, 70, 70, 71, 71, 540, + /* 1410 */ 565, 72, 72, 484, 55, 55, 473, 1180, 296, 1040, + /* 1420 */ 56, 56, 296, 493, 541, 119, 119, 410, 1573, 542, + /* 1430 */ 569, 418, 7, 120, 1244, 451, 577, 451, 465, 1040, + /* 1440 */ 1028, 576, 1557, 552, 476, 119, 119, 527, 259, 121, + /* 1450 */ 568, 240, 4, 120, 576, 451, 577, 451, 576, 477, + /* 1460 */ 1028, 576, 156, 576, 57, 57, 571, 576, 286, 229, + /* 1470 */ 410, 336, 1028, 1028, 1030, 1031, 35, 59, 59, 219, + /* 1480 */ 983, 60, 60, 220, 73, 73, 74, 74, 984, 451, + /* 1490 */ 75, 75, 1028, 1028, 1030, 1031, 35, 96, 216, 291, + /* 1500 */ 552, 565, 1188, 318, 395, 395, 394, 276, 392, 576, + /* 1510 */ 485, 859, 474, 1311, 410, 541, 576, 417, 1530, 1144, + /* 1520 */ 540, 399, 1188, 292, 237, 1153, 326, 38, 23, 576, + /* 1530 */ 1040, 576, 20, 20, 325, 299, 119, 119, 164, 76, + /* 1540 */ 76, 1529, 121, 568, 120, 4, 451, 577, 451, 203, + /* 1550 */ 576, 1028, 141, 141, 142, 142, 576, 322, 39, 571, + /* 1560 */ 341, 1021, 110, 264, 239, 901, 900, 423, 242, 908, + /* 1570 */ 909, 370, 173, 77, 77, 43, 479, 1310, 264, 62, + /* 1580 */ 62, 369, 451, 1028, 1028, 1030, 1031, 35, 1601, 1192, + /* 1590 */ 453, 1092, 238, 291, 565, 163, 1309, 110, 395, 395, + /* 1600 */ 394, 276, 392, 986, 987, 859, 481, 346, 264, 110, + /* 1610 */ 1032, 489, 576, 1188, 503, 1088, 261, 261, 237, 576, + /* 1620 */ 326, 121, 568, 1040, 4, 347, 1376, 413, 325, 119, + /* 1630 */ 119, 948, 319, 567, 351, 78, 78, 120, 571, 451, + /* 1640 */ 577, 451, 79, 79, 1028, 354, 356, 576, 360, 1092, + /* 1650 */ 110, 576, 974, 942, 264, 123, 457, 358, 239, 576, + /* 1660 */ 519, 451, 939, 1104, 123, 1104, 173, 576, 1032, 43, + /* 1670 */ 63, 63, 1324, 565, 168, 168, 1028, 1028, 1030, 1031, + /* 1680 */ 35, 576, 169, 169, 1308, 872, 238, 157, 1589, 576, + /* 1690 */ 86, 86, 365, 89, 568, 375, 4, 1103, 941, 1103, + /* 1700 */ 123, 576, 1040, 1389, 64, 64, 1188, 1434, 119, 119, + /* 1710 */ 571, 576, 82, 82, 563, 576, 120, 165, 451, 577, + /* 1720 */ 451, 413, 1362, 1028, 144, 144, 319, 567, 576, 1374, + /* 1730 */ 562, 498, 279, 451, 83, 83, 1439, 576, 166, 166, + /* 1740 */ 576, 1289, 554, 576, 1280, 565, 576, 12, 576, 1268, + /* 1750 */ 457, 146, 146, 1267, 576, 1028, 1028, 1030, 1031, 35, + /* 1760 */ 140, 140, 1269, 167, 167, 1609, 160, 160, 1359, 150, + /* 1770 */ 150, 149, 149, 311, 1040, 576, 312, 147, 147, 313, + /* 1780 */ 119, 119, 222, 235, 576, 1188, 396, 576, 120, 576, + /* 1790 */ 451, 577, 451, 1192, 453, 1028, 508, 291, 148, 148, + /* 1800 */ 1421, 1612, 395, 395, 394, 276, 392, 85, 85, 859, + /* 1810 */ 87, 87, 84, 84, 553, 576, 294, 576, 1426, 338, + /* 1820 */ 339, 1425, 237, 300, 326, 1416, 1409, 1028, 1028, 1030, + /* 1830 */ 1031, 35, 325, 344, 403, 483, 226, 1307, 52, 52, + /* 1840 */ 58, 58, 368, 1371, 1502, 566, 1501, 121, 568, 221, + /* 1850 */ 4, 208, 268, 209, 390, 1244, 1549, 1188, 1372, 1370, + /* 1860 */ 1369, 1547, 239, 184, 571, 233, 421, 1241, 95, 218, + /* 1870 */ 173, 1507, 193, 43, 91, 94, 178, 186, 467, 188, + /* 1880 */ 468, 1422, 13, 189, 190, 191, 501, 451, 245, 108, + /* 1890 */ 238, 401, 1428, 1427, 1430, 475, 404, 1496, 197, 565, + /* 1900 */ 14, 490, 249, 101, 1518, 496, 349, 280, 251, 201, + /* 1910 */ 353, 499, 252, 406, 1270, 253, 517, 1327, 1326, 435, + /* 1920 */ 1325, 1318, 103, 893, 1296, 413, 227, 407, 1040, 1626, + /* 1930 */ 319, 567, 1625, 1297, 119, 119, 439, 367, 1317, 1295, + /* 1940 */ 1624, 526, 120, 440, 451, 577, 451, 1594, 309, 1028, + /* 1950 */ 310, 373, 266, 267, 457, 1580, 1579, 443, 138, 1394, + /* 1960 */ 552, 1393, 11, 1483, 384, 115, 317, 1350, 109, 536, + /* 1970 */ 42, 579, 382, 214, 1349, 388, 1198, 389, 275, 277, + /* 1980 */ 278, 1028, 1028, 1030, 1031, 35, 580, 1265, 414, 1260, + /* 1990 */ 170, 415, 183, 1534, 1535, 1533, 171, 154, 307, 1532, + /* 2000 */ 846, 223, 224, 88, 452, 215, 172, 321, 234, 1102, + /* 2010 */ 152, 1188, 1100, 329, 185, 174, 1223, 925, 187, 241, + /* 2020 */ 337, 244, 1116, 192, 175, 176, 424, 426, 97, 194, + /* 2030 */ 98, 99, 100, 177, 1119, 1115, 246, 247, 161, 24, + /* 2040 */ 248, 348, 1238, 264, 1108, 250, 495, 199, 198, 15, + /* 2050 */ 861, 500, 369, 254, 504, 509, 512, 200, 102, 25, + /* 2060 */ 179, 361, 26, 364, 104, 891, 308, 162, 105, 904, + /* 2070 */ 520, 106, 1185, 1069, 1155, 17, 228, 27, 1154, 283, + /* 2080 */ 285, 263, 978, 202, 972, 123, 28, 1175, 29, 30, + /* 2090 */ 1179, 1171, 31, 1173, 1160, 41, 32, 206, 548, 33, + /* 2100 */ 110, 1178, 1083, 8, 112, 1070, 113, 1068, 1072, 34, + /* 2110 */ 1073, 560, 1125, 269, 1124, 270, 36, 18, 1194, 1033, + /* 2120 */ 873, 151, 122, 37, 393, 271, 272, 572, 181, 1193, + /* 2130 */ 1256, 1256, 1256, 935, 1256, 1256, 1256, 1256, 1256, 1256, + /* 2140 */ 1256, 1617, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 193, 193, 193, 274, 275, 276, 193, 274, 275, 276, - /* 10 */ 193, 223, 219, 225, 206, 210, 211, 212, 193, 19, - /* 20 */ 219, 233, 216, 216, 217, 216, 217, 193, 295, 216, - /* 30 */ 217, 31, 193, 216, 217, 193, 228, 213, 230, 39, - /* 40 */ 206, 216, 217, 43, 44, 45, 46, 47, 48, 49, - /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 193, 19, - /* 60 */ 185, 186, 187, 188, 189, 190, 253, 274, 275, 276, - /* 70 */ 195, 193, 197, 193, 261, 274, 275, 276, 253, 204, - /* 80 */ 238, 204, 81, 43, 44, 45, 46, 47, 48, 49, - /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 274, 275, - /* 100 */ 276, 262, 102, 103, 104, 105, 106, 107, 108, 109, - /* 110 */ 110, 111, 112, 113, 239, 240, 239, 240, 210, 211, - /* 120 */ 212, 314, 315, 314, 59, 316, 86, 252, 88, 252, - /* 130 */ 19, 314, 315, 256, 257, 113, 25, 72, 296, 138, - /* 140 */ 139, 266, 102, 103, 104, 105, 106, 107, 108, 109, + /* 0 */ 194, 276, 277, 278, 216, 194, 194, 217, 194, 194, + /* 10 */ 194, 194, 224, 194, 194, 276, 277, 278, 204, 19, + /* 20 */ 206, 202, 297, 217, 218, 205, 207, 217, 205, 217, + /* 30 */ 218, 31, 217, 218, 217, 218, 29, 217, 218, 39, + /* 40 */ 33, 217, 220, 43, 44, 45, 46, 47, 48, 49, + /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 312, 19, + /* 60 */ 240, 241, 316, 240, 241, 194, 46, 47, 48, 49, + /* 70 */ 22, 254, 65, 253, 254, 255, 253, 194, 255, 194, + /* 80 */ 263, 258, 259, 43, 44, 45, 46, 47, 48, 49, + /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 276, 277, + /* 100 */ 278, 285, 102, 103, 104, 105, 106, 107, 108, 109, + /* 110 */ 110, 111, 112, 113, 59, 186, 187, 188, 189, 190, + /* 120 */ 191, 310, 239, 317, 318, 196, 86, 198, 88, 317, + /* 130 */ 19, 319, 317, 318, 205, 264, 25, 211, 212, 213, + /* 140 */ 205, 121, 102, 103, 104, 105, 106, 107, 108, 109, /* 150 */ 110, 111, 112, 113, 43, 44, 45, 46, 47, 48, - /* 160 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 81, - /* 170 */ 292, 59, 292, 298, 108, 109, 110, 111, 112, 113, - /* 180 */ 69, 116, 117, 118, 72, 106, 107, 193, 111, 112, - /* 190 */ 113, 54, 55, 56, 57, 58, 102, 103, 104, 105, - /* 200 */ 106, 107, 108, 109, 110, 111, 112, 113, 120, 25, - /* 210 */ 216, 217, 145, 102, 103, 104, 105, 106, 107, 108, - /* 220 */ 109, 110, 111, 112, 113, 231, 138, 139, 116, 117, - /* 230 */ 118, 164, 153, 19, 155, 54, 55, 56, 57, 102, + /* 160 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 240, + /* 170 */ 241, 116, 117, 118, 119, 240, 241, 122, 123, 124, + /* 180 */ 69, 298, 253, 194, 255, 106, 107, 132, 253, 141, + /* 190 */ 255, 54, 55, 56, 57, 58, 207, 268, 102, 103, + /* 200 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + /* 210 */ 214, 128, 129, 102, 103, 104, 105, 106, 107, 108, + /* 220 */ 109, 110, 111, 112, 113, 134, 25, 136, 137, 300, + /* 230 */ 165, 166, 153, 19, 155, 54, 55, 56, 57, 102, /* 240 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - /* 250 */ 113, 128, 129, 46, 47, 48, 49, 43, 44, 45, + /* 250 */ 113, 108, 109, 110, 111, 112, 113, 43, 44, 45, /* 260 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - /* 270 */ 56, 57, 216, 193, 25, 59, 193, 19, 165, 166, - /* 280 */ 193, 67, 24, 102, 103, 104, 105, 106, 107, 108, - /* 290 */ 109, 110, 111, 112, 113, 73, 216, 217, 59, 216, - /* 300 */ 217, 43, 44, 45, 46, 47, 48, 49, 50, 51, + /* 270 */ 56, 57, 276, 277, 278, 113, 194, 19, 22, 23, + /* 280 */ 194, 67, 24, 102, 103, 104, 105, 106, 107, 108, + /* 290 */ 109, 110, 111, 112, 113, 220, 250, 59, 252, 217, + /* 300 */ 218, 43, 44, 45, 46, 47, 48, 49, 50, 51, /* 310 */ 52, 53, 54, 55, 56, 57, 102, 103, 104, 105, - /* 320 */ 106, 107, 108, 109, 110, 111, 112, 113, 121, 145, - /* 330 */ 59, 193, 116, 117, 118, 119, 273, 204, 122, 123, - /* 340 */ 124, 19, 20, 134, 22, 136, 137, 19, 132, 127, - /* 350 */ 128, 129, 24, 22, 23, 116, 117, 118, 36, 193, + /* 320 */ 106, 107, 108, 109, 110, 111, 112, 113, 106, 107, + /* 330 */ 108, 109, 110, 111, 112, 113, 254, 59, 205, 138, + /* 340 */ 139, 19, 20, 194, 22, 263, 22, 23, 231, 25, + /* 350 */ 72, 276, 277, 278, 116, 117, 118, 101, 36, 76, /* 360 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - /* 370 */ 112, 113, 239, 240, 311, 312, 215, 106, 107, 241, - /* 380 */ 19, 59, 216, 217, 223, 252, 115, 116, 117, 118, - /* 390 */ 151, 120, 26, 71, 193, 308, 309, 193, 149, 128, - /* 400 */ 313, 216, 269, 81, 43, 44, 45, 46, 47, 48, - /* 410 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 253, - /* 420 */ 216, 217, 100, 95, 153, 59, 155, 261, 106, 107, - /* 430 */ 25, 193, 101, 193, 193, 231, 114, 25, 116, 117, - /* 440 */ 118, 113, 304, 121, 193, 204, 59, 119, 120, 121, - /* 450 */ 122, 123, 124, 125, 216, 217, 193, 216, 217, 131, - /* 460 */ 138, 139, 230, 102, 103, 104, 105, 106, 107, 108, + /* 370 */ 112, 113, 89, 240, 241, 92, 73, 194, 194, 73, + /* 380 */ 19, 59, 188, 189, 190, 191, 253, 81, 255, 151, + /* 390 */ 196, 25, 198, 71, 116, 117, 118, 311, 312, 205, + /* 400 */ 217, 218, 316, 81, 43, 44, 45, 46, 47, 48, + /* 410 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 270, + /* 420 */ 22, 23, 100, 25, 59, 101, 138, 139, 106, 107, + /* 430 */ 127, 128, 129, 127, 240, 241, 114, 254, 116, 117, + /* 440 */ 118, 76, 76, 121, 138, 139, 263, 253, 264, 255, + /* 450 */ 205, 275, 87, 19, 89, 89, 194, 92, 92, 199, + /* 460 */ 138, 139, 268, 102, 103, 104, 105, 106, 107, 108, /* 470 */ 109, 110, 111, 112, 113, 153, 154, 155, 156, 157, - /* 480 */ 239, 240, 116, 117, 118, 76, 193, 23, 19, 25, - /* 490 */ 22, 253, 23, 252, 253, 108, 87, 204, 89, 261, - /* 500 */ 198, 92, 261, 116, 117, 118, 193, 306, 307, 216, - /* 510 */ 217, 150, 43, 44, 45, 46, 47, 48, 49, 50, - /* 520 */ 51, 52, 53, 54, 55, 56, 57, 59, 193, 216, - /* 530 */ 217, 19, 239, 240, 283, 23, 106, 107, 108, 109, - /* 540 */ 110, 111, 112, 113, 73, 252, 253, 142, 308, 309, - /* 550 */ 138, 139, 81, 313, 145, 43, 44, 45, 46, 47, + /* 480 */ 81, 116, 117, 118, 129, 240, 241, 224, 19, 226, + /* 490 */ 314, 315, 23, 25, 300, 59, 22, 234, 253, 101, + /* 500 */ 255, 236, 237, 26, 194, 183, 194, 152, 72, 22, + /* 510 */ 145, 150, 43, 44, 45, 46, 47, 48, 49, 50, + /* 520 */ 51, 52, 53, 54, 55, 56, 57, 217, 218, 217, + /* 530 */ 218, 19, 189, 59, 191, 23, 59, 138, 139, 196, + /* 540 */ 135, 198, 232, 283, 232, 140, 59, 287, 205, 275, + /* 550 */ 116, 205, 116, 117, 118, 43, 44, 45, 46, 47, /* 560 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 570 */ 307, 102, 103, 104, 105, 106, 107, 108, 109, 110, - /* 580 */ 111, 112, 113, 281, 116, 117, 118, 285, 23, 193, - /* 590 */ 25, 119, 59, 193, 122, 123, 124, 59, 127, 203, - /* 600 */ 59, 205, 19, 268, 132, 25, 23, 22, 193, 138, - /* 610 */ 139, 249, 204, 251, 102, 103, 104, 105, 106, 107, + /* 570 */ 194, 102, 103, 104, 105, 106, 107, 108, 109, 110, + /* 580 */ 111, 112, 113, 240, 241, 194, 240, 241, 314, 315, + /* 590 */ 116, 117, 118, 116, 117, 118, 253, 194, 255, 253, + /* 600 */ 59, 255, 19, 116, 117, 118, 23, 22, 217, 218, + /* 610 */ 142, 268, 205, 275, 102, 103, 104, 105, 106, 107, /* 620 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46, /* 630 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - /* 640 */ 57, 19, 22, 23, 59, 23, 25, 239, 240, 116, - /* 650 */ 117, 118, 193, 11, 116, 117, 118, 116, 117, 118, - /* 660 */ 252, 269, 22, 193, 15, 43, 44, 45, 46, 47, + /* 640 */ 57, 19, 194, 300, 59, 23, 119, 240, 241, 122, + /* 650 */ 123, 124, 314, 315, 194, 236, 237, 194, 117, 132, + /* 660 */ 253, 81, 255, 205, 59, 43, 44, 45, 46, 47, /* 670 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 680 */ 273, 143, 193, 118, 143, 102, 103, 104, 105, 106, - /* 690 */ 107, 108, 109, 110, 111, 112, 113, 76, 118, 59, - /* 700 */ 241, 116, 117, 118, 304, 216, 217, 292, 143, 60, - /* 710 */ 89, 241, 19, 92, 193, 193, 23, 22, 311, 312, - /* 720 */ 231, 101, 22, 143, 102, 103, 104, 105, 106, 107, + /* 680 */ 217, 218, 194, 194, 194, 102, 103, 104, 105, 106, + /* 690 */ 107, 108, 109, 110, 111, 112, 113, 294, 240, 241, + /* 700 */ 120, 116, 117, 118, 59, 194, 217, 218, 211, 212, + /* 710 */ 213, 253, 19, 255, 194, 19, 23, 254, 138, 139, + /* 720 */ 24, 232, 117, 194, 102, 103, 104, 105, 106, 107, /* 730 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46, /* 740 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - /* 750 */ 57, 19, 193, 193, 59, 23, 116, 117, 118, 59, - /* 760 */ 201, 21, 241, 304, 22, 206, 127, 128, 129, 193, - /* 770 */ 128, 129, 235, 236, 304, 43, 44, 45, 46, 47, + /* 750 */ 57, 19, 264, 108, 76, 23, 127, 128, 129, 311, + /* 760 */ 312, 116, 117, 118, 316, 87, 306, 89, 308, 194, + /* 770 */ 92, 22, 59, 194, 22, 43, 44, 45, 46, 47, /* 780 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 790 */ 22, 193, 216, 217, 193, 102, 103, 104, 105, 106, - /* 800 */ 107, 108, 109, 110, 111, 112, 113, 231, 193, 193, - /* 810 */ 193, 116, 117, 118, 216, 217, 116, 117, 118, 226, - /* 820 */ 80, 193, 19, 235, 236, 304, 23, 211, 212, 231, - /* 830 */ 204, 216, 217, 205, 102, 103, 104, 105, 106, 107, + /* 790 */ 194, 95, 217, 218, 265, 102, 103, 104, 105, 106, + /* 800 */ 107, 108, 109, 110, 111, 112, 113, 232, 59, 113, + /* 810 */ 25, 59, 194, 217, 218, 119, 120, 121, 122, 123, + /* 820 */ 124, 125, 19, 145, 194, 194, 23, 131, 232, 116, + /* 830 */ 117, 118, 35, 194, 102, 103, 104, 105, 106, 107, /* 840 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46, /* 850 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - /* 860 */ 57, 19, 193, 123, 76, 239, 240, 193, 253, 239, - /* 870 */ 240, 239, 240, 193, 106, 107, 193, 89, 252, 193, - /* 880 */ 92, 59, 252, 141, 252, 43, 44, 45, 46, 47, + /* 860 */ 57, 19, 194, 66, 194, 116, 117, 118, 116, 117, + /* 870 */ 118, 74, 242, 294, 194, 194, 206, 23, 194, 25, + /* 880 */ 194, 111, 112, 113, 25, 43, 44, 45, 46, 47, /* 890 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, - /* 900 */ 284, 161, 216, 217, 193, 102, 103, 104, 105, 106, - /* 910 */ 107, 108, 109, 110, 111, 112, 113, 231, 193, 16, - /* 920 */ 187, 188, 189, 190, 7, 8, 9, 309, 195, 25, - /* 930 */ 197, 313, 19, 127, 128, 129, 262, 204, 22, 117, - /* 940 */ 24, 216, 217, 263, 102, 103, 104, 105, 106, 107, + /* 900 */ 24, 194, 194, 217, 218, 102, 103, 104, 105, 106, + /* 910 */ 107, 108, 109, 110, 111, 112, 113, 241, 232, 194, + /* 920 */ 212, 213, 242, 242, 217, 218, 242, 130, 11, 253, + /* 930 */ 194, 255, 19, 265, 149, 59, 306, 194, 308, 232, + /* 940 */ 309, 310, 217, 218, 102, 103, 104, 105, 106, 107, /* 950 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46, /* 960 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - /* 970 */ 57, 193, 239, 240, 193, 59, 19, 188, 253, 190, - /* 980 */ 77, 226, 79, 193, 195, 252, 197, 193, 19, 301, - /* 990 */ 302, 193, 193, 204, 216, 217, 226, 216, 217, 266, - /* 1000 */ 204, 159, 45, 46, 47, 48, 49, 50, 51, 52, + /* 970 */ 57, 194, 194, 59, 194, 239, 19, 194, 25, 254, + /* 980 */ 303, 304, 23, 194, 25, 126, 306, 306, 308, 308, + /* 990 */ 306, 271, 308, 117, 286, 217, 218, 217, 218, 194, + /* 1000 */ 194, 159, 45, 46, 47, 48, 49, 50, 51, 52, /* 1010 */ 53, 54, 55, 56, 57, 102, 103, 104, 105, 106, - /* 1020 */ 107, 108, 109, 110, 111, 112, 113, 12, 239, 240, - /* 1030 */ 232, 298, 238, 117, 253, 239, 240, 238, 259, 260, - /* 1040 */ 193, 252, 27, 31, 193, 193, 142, 204, 252, 193, - /* 1050 */ 193, 39, 262, 193, 100, 266, 278, 42, 204, 102, + /* 1020 */ 107, 108, 109, 110, 111, 112, 113, 59, 239, 194, + /* 1030 */ 116, 117, 118, 260, 254, 194, 240, 241, 194, 233, + /* 1040 */ 205, 240, 241, 205, 239, 128, 129, 270, 265, 253, + /* 1050 */ 194, 255, 217, 218, 253, 194, 255, 143, 280, 102, /* 1060 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - /* 1070 */ 113, 117, 159, 216, 217, 121, 216, 217, 63, 193, - /* 1080 */ 193, 193, 239, 240, 115, 116, 193, 298, 73, 238, - /* 1090 */ 238, 231, 19, 239, 240, 252, 22, 24, 211, 212, - /* 1100 */ 24, 193, 216, 217, 216, 217, 252, 153, 154, 155, - /* 1110 */ 253, 16, 19, 144, 213, 268, 43, 44, 45, 46, + /* 1070 */ 113, 118, 159, 217, 218, 240, 241, 118, 240, 241, + /* 1080 */ 194, 194, 194, 239, 116, 117, 118, 22, 253, 254, + /* 1090 */ 255, 253, 19, 255, 233, 194, 143, 24, 263, 212, + /* 1100 */ 213, 194, 143, 217, 218, 217, 218, 261, 262, 271, + /* 1110 */ 254, 143, 19, 7, 8, 9, 43, 44, 45, 46, /* 1120 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - /* 1130 */ 57, 238, 19, 59, 193, 59, 43, 44, 45, 46, + /* 1130 */ 57, 16, 19, 22, 23, 294, 43, 44, 45, 46, /* 1140 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - /* 1150 */ 57, 22, 23, 193, 25, 193, 43, 44, 45, 46, + /* 1150 */ 57, 312, 194, 214, 21, 316, 43, 44, 45, 46, /* 1160 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - /* 1170 */ 57, 284, 77, 193, 79, 102, 103, 104, 105, 106, - /* 1180 */ 107, 108, 109, 110, 111, 112, 113, 286, 193, 193, - /* 1190 */ 193, 117, 291, 117, 232, 102, 103, 104, 105, 106, - /* 1200 */ 107, 108, 109, 110, 111, 112, 113, 204, 22, 23, - /* 1210 */ 66, 25, 216, 217, 35, 102, 103, 104, 105, 106, - /* 1220 */ 107, 108, 109, 110, 111, 112, 113, 193, 268, 85, - /* 1230 */ 101, 193, 309, 309, 240, 19, 313, 313, 94, 208, - /* 1240 */ 209, 193, 239, 240, 193, 66, 252, 19, 268, 244, - /* 1250 */ 216, 217, 193, 74, 213, 252, 161, 19, 263, 254, + /* 1170 */ 57, 106, 107, 286, 194, 102, 103, 104, 105, 106, + /* 1180 */ 107, 108, 109, 110, 111, 112, 113, 207, 158, 59, + /* 1190 */ 160, 22, 77, 24, 79, 102, 103, 104, 105, 106, + /* 1200 */ 107, 108, 109, 110, 111, 112, 113, 194, 194, 229, + /* 1210 */ 194, 231, 101, 80, 22, 102, 103, 104, 105, 106, + /* 1220 */ 107, 108, 109, 110, 111, 112, 113, 288, 59, 12, + /* 1230 */ 217, 218, 293, 217, 218, 19, 106, 107, 59, 19, + /* 1240 */ 16, 127, 128, 129, 27, 115, 116, 117, 118, 194, + /* 1250 */ 120, 59, 22, 194, 24, 194, 123, 100, 128, 42, /* 1260 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - /* 1270 */ 54, 55, 56, 57, 193, 216, 217, 5, 59, 193, - /* 1280 */ 19, 244, 10, 11, 12, 13, 14, 101, 309, 17, - /* 1290 */ 146, 254, 313, 193, 193, 76, 115, 216, 217, 309, - /* 1300 */ 12, 263, 30, 313, 32, 46, 87, 46, 89, 130, - /* 1310 */ 193, 92, 40, 22, 263, 27, 216, 217, 102, 103, + /* 1270 */ 54, 55, 56, 57, 117, 194, 217, 218, 121, 100, + /* 1280 */ 63, 194, 245, 153, 194, 155, 117, 19, 115, 194, + /* 1290 */ 73, 214, 194, 256, 161, 116, 117, 194, 217, 218, + /* 1300 */ 121, 77, 194, 79, 217, 218, 194, 217, 218, 117, + /* 1310 */ 153, 154, 155, 254, 46, 217, 218, 144, 102, 103, /* 1320 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - /* 1330 */ 42, 150, 291, 216, 217, 116, 117, 118, 19, 20, - /* 1340 */ 193, 22, 70, 260, 116, 193, 24, 264, 193, 263, - /* 1350 */ 78, 63, 61, 81, 116, 36, 193, 260, 193, 29, - /* 1360 */ 193, 264, 193, 33, 145, 193, 59, 48, 216, 217, - /* 1370 */ 98, 216, 217, 193, 115, 193, 115, 193, 59, 216, - /* 1380 */ 217, 216, 217, 216, 217, 216, 217, 255, 216, 217, - /* 1390 */ 71, 193, 131, 193, 25, 65, 216, 217, 216, 217, - /* 1400 */ 216, 217, 208, 209, 85, 133, 193, 100, 193, 90, - /* 1410 */ 138, 139, 138, 139, 216, 217, 216, 217, 193, 100, - /* 1420 */ 193, 108, 135, 116, 117, 106, 107, 140, 121, 216, - /* 1430 */ 217, 216, 217, 114, 162, 116, 117, 118, 299, 300, - /* 1440 */ 121, 216, 217, 216, 217, 193, 244, 193, 135, 244, - /* 1450 */ 193, 256, 257, 140, 244, 193, 254, 193, 193, 254, - /* 1460 */ 153, 154, 155, 141, 254, 149, 150, 258, 216, 217, - /* 1470 */ 216, 217, 153, 154, 155, 156, 157, 0, 1, 2, - /* 1480 */ 216, 217, 5, 115, 158, 193, 160, 10, 11, 12, - /* 1490 */ 13, 14, 193, 59, 17, 126, 193, 19, 20, 129, - /* 1500 */ 22, 193, 22, 22, 24, 193, 23, 30, 25, 32, - /* 1510 */ 19, 20, 144, 22, 36, 216, 217, 40, 193, 216, - /* 1520 */ 217, 193, 152, 129, 216, 217, 193, 36, 216, 217, - /* 1530 */ 193, 99, 193, 193, 53, 193, 193, 59, 23, 193, - /* 1540 */ 25, 216, 217, 193, 216, 217, 152, 70, 59, 71, - /* 1550 */ 59, 117, 193, 216, 217, 78, 216, 217, 81, 216, - /* 1560 */ 217, 318, 71, 85, 193, 133, 193, 193, 90, 23, - /* 1570 */ 23, 25, 25, 120, 121, 98, 85, 193, 100, 193, - /* 1580 */ 23, 90, 25, 121, 106, 107, 19, 216, 217, 216, - /* 1590 */ 217, 100, 114, 131, 116, 117, 118, 106, 107, 121, - /* 1600 */ 216, 217, 216, 217, 193, 114, 117, 116, 117, 118, - /* 1610 */ 133, 193, 121, 193, 193, 138, 139, 193, 23, 193, - /* 1620 */ 25, 23, 23, 25, 25, 7, 8, 216, 217, 193, - /* 1630 */ 193, 153, 154, 155, 156, 157, 216, 217, 193, 162, - /* 1640 */ 216, 217, 216, 217, 153, 154, 155, 156, 157, 1, - /* 1650 */ 2, 193, 193, 5, 19, 20, 59, 22, 10, 11, - /* 1660 */ 12, 13, 14, 193, 97, 17, 193, 23, 193, 25, - /* 1670 */ 288, 36, 193, 242, 216, 217, 236, 23, 30, 25, - /* 1680 */ 32, 19, 20, 23, 22, 25, 216, 217, 40, 216, - /* 1690 */ 217, 216, 217, 193, 59, 216, 217, 193, 36, 83, - /* 1700 */ 84, 153, 153, 155, 155, 23, 71, 25, 23, 193, - /* 1710 */ 25, 193, 193, 193, 117, 193, 193, 193, 70, 193, - /* 1720 */ 193, 59, 193, 255, 255, 287, 78, 255, 243, 81, - /* 1730 */ 191, 255, 297, 71, 271, 100, 293, 245, 267, 214, - /* 1740 */ 246, 106, 107, 108, 246, 271, 98, 245, 293, 114, - /* 1750 */ 220, 116, 117, 118, 267, 271, 121, 271, 225, 219, - /* 1760 */ 229, 219, 100, 219, 259, 259, 259, 259, 106, 107, - /* 1770 */ 249, 196, 60, 280, 141, 243, 114, 249, 116, 117, - /* 1780 */ 118, 133, 245, 121, 200, 297, 138, 139, 153, 154, - /* 1790 */ 155, 156, 157, 297, 200, 38, 19, 20, 151, 22, - /* 1800 */ 200, 150, 140, 294, 294, 22, 272, 43, 234, 18, - /* 1810 */ 162, 270, 200, 36, 237, 153, 154, 155, 156, 157, - /* 1820 */ 237, 283, 237, 237, 18, 199, 149, 246, 272, 270, - /* 1830 */ 272, 200, 158, 246, 246, 234, 59, 234, 246, 199, - /* 1840 */ 290, 62, 289, 200, 199, 22, 221, 115, 71, 200, - /* 1850 */ 200, 199, 199, 221, 218, 218, 19, 20, 64, 22, - /* 1860 */ 218, 227, 22, 224, 126, 224, 165, 221, 24, 305, - /* 1870 */ 200, 113, 312, 36, 218, 220, 218, 100, 282, 218, - /* 1880 */ 91, 218, 317, 106, 107, 221, 227, 282, 317, 82, - /* 1890 */ 148, 114, 265, 116, 117, 118, 59, 145, 121, 22, - /* 1900 */ 277, 158, 200, 265, 25, 202, 147, 250, 71, 279, - /* 1910 */ 13, 146, 194, 194, 249, 248, 250, 140, 247, 246, - /* 1920 */ 6, 192, 192, 192, 303, 303, 213, 207, 300, 213, - /* 1930 */ 153, 154, 155, 156, 157, 213, 213, 100, 213, 222, - /* 1940 */ 207, 214, 214, 106, 107, 4, 222, 207, 3, 22, - /* 1950 */ 163, 114, 15, 116, 117, 118, 16, 23, 121, 23, - /* 1960 */ 139, 151, 130, 25, 142, 16, 24, 20, 144, 1, - /* 1970 */ 142, 130, 130, 61, 53, 53, 37, 151, 53, 53, - /* 1980 */ 130, 116, 34, 1, 141, 5, 22, 115, 161, 141, - /* 1990 */ 153, 154, 155, 156, 157, 25, 68, 68, 75, 41, - /* 2000 */ 115, 24, 131, 20, 19, 125, 22, 96, 22, 22, - /* 2010 */ 67, 23, 22, 67, 59, 24, 22, 28, 67, 23, - /* 2020 */ 22, 22, 149, 23, 23, 23, 116, 23, 25, 37, - /* 2030 */ 97, 141, 23, 23, 22, 143, 25, 75, 88, 34, - /* 2040 */ 34, 34, 34, 86, 75, 93, 23, 34, 22, 34, - /* 2050 */ 25, 24, 34, 25, 23, 142, 23, 142, 44, 23, - /* 2060 */ 23, 23, 11, 23, 25, 22, 22, 22, 15, 23, - /* 2070 */ 23, 22, 22, 25, 1, 1, 141, 25, 23, 135, - /* 2080 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2090 */ 319, 319, 319, 319, 141, 141, 319, 319, 319, 319, - /* 2100 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2110 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2120 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2130 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2140 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2150 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2160 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2170 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2180 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2190 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2200 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2210 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2220 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2230 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2250 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2260 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2270 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, - /* 2280 */ 319, + /* 1330 */ 232, 270, 153, 154, 155, 115, 116, 66, 19, 20, + /* 1340 */ 183, 22, 12, 312, 254, 194, 262, 316, 209, 210, + /* 1350 */ 266, 239, 194, 194, 108, 36, 85, 27, 19, 20, + /* 1360 */ 265, 22, 183, 245, 144, 94, 25, 48, 217, 218, + /* 1370 */ 293, 194, 42, 270, 256, 36, 217, 218, 59, 194, + /* 1380 */ 25, 135, 194, 115, 194, 161, 140, 194, 194, 15, + /* 1390 */ 71, 194, 312, 63, 217, 218, 316, 194, 59, 131, + /* 1400 */ 301, 302, 217, 218, 85, 217, 218, 217, 218, 90, + /* 1410 */ 71, 217, 218, 19, 217, 218, 245, 146, 262, 100, + /* 1420 */ 217, 218, 266, 265, 85, 106, 107, 256, 312, 90, + /* 1430 */ 209, 210, 316, 114, 60, 116, 117, 118, 194, 100, + /* 1440 */ 121, 194, 194, 145, 115, 106, 107, 19, 46, 19, + /* 1450 */ 20, 24, 22, 114, 194, 116, 117, 118, 194, 245, + /* 1460 */ 121, 194, 164, 194, 217, 218, 36, 194, 258, 259, + /* 1470 */ 256, 194, 153, 154, 155, 156, 157, 217, 218, 150, + /* 1480 */ 31, 217, 218, 142, 217, 218, 217, 218, 39, 59, + /* 1490 */ 217, 218, 153, 154, 155, 156, 157, 149, 150, 5, + /* 1500 */ 145, 71, 183, 245, 10, 11, 12, 13, 14, 194, + /* 1510 */ 116, 17, 129, 227, 256, 85, 194, 115, 194, 23, + /* 1520 */ 90, 25, 183, 99, 30, 97, 32, 22, 22, 194, + /* 1530 */ 100, 194, 217, 218, 40, 152, 106, 107, 23, 217, + /* 1540 */ 218, 194, 19, 20, 114, 22, 116, 117, 118, 257, + /* 1550 */ 194, 121, 217, 218, 217, 218, 194, 133, 53, 36, + /* 1560 */ 23, 23, 25, 25, 70, 120, 121, 61, 141, 7, + /* 1570 */ 8, 121, 78, 217, 218, 81, 23, 227, 25, 217, + /* 1580 */ 218, 131, 59, 153, 154, 155, 156, 157, 0, 1, + /* 1590 */ 2, 59, 98, 5, 71, 23, 227, 25, 10, 11, + /* 1600 */ 12, 13, 14, 83, 84, 17, 23, 23, 25, 25, + /* 1610 */ 59, 194, 194, 183, 23, 23, 25, 25, 30, 194, + /* 1620 */ 32, 19, 20, 100, 22, 194, 194, 133, 40, 106, + /* 1630 */ 107, 108, 138, 139, 194, 217, 218, 114, 36, 116, + /* 1640 */ 117, 118, 217, 218, 121, 194, 194, 194, 23, 117, + /* 1650 */ 25, 194, 23, 23, 25, 25, 162, 194, 70, 194, + /* 1660 */ 145, 59, 23, 153, 25, 155, 78, 194, 117, 81, + /* 1670 */ 217, 218, 194, 71, 217, 218, 153, 154, 155, 156, + /* 1680 */ 157, 194, 217, 218, 194, 23, 98, 25, 321, 194, + /* 1690 */ 217, 218, 194, 19, 20, 194, 22, 153, 23, 155, + /* 1700 */ 25, 194, 100, 194, 217, 218, 183, 194, 106, 107, + /* 1710 */ 36, 194, 217, 218, 237, 194, 114, 243, 116, 117, + /* 1720 */ 118, 133, 194, 121, 217, 218, 138, 139, 194, 194, + /* 1730 */ 194, 290, 289, 59, 217, 218, 194, 194, 217, 218, + /* 1740 */ 194, 194, 140, 194, 194, 71, 194, 244, 194, 194, + /* 1750 */ 162, 217, 218, 194, 194, 153, 154, 155, 156, 157, + /* 1760 */ 217, 218, 194, 217, 218, 194, 217, 218, 257, 217, + /* 1770 */ 218, 217, 218, 257, 100, 194, 257, 217, 218, 257, + /* 1780 */ 106, 107, 215, 299, 194, 183, 192, 194, 114, 194, + /* 1790 */ 116, 117, 118, 1, 2, 121, 221, 5, 217, 218, + /* 1800 */ 273, 197, 10, 11, 12, 13, 14, 217, 218, 17, + /* 1810 */ 217, 218, 217, 218, 140, 194, 246, 194, 273, 295, + /* 1820 */ 247, 273, 30, 247, 32, 269, 269, 153, 154, 155, + /* 1830 */ 156, 157, 40, 246, 273, 295, 230, 226, 217, 218, + /* 1840 */ 217, 218, 220, 261, 220, 282, 220, 19, 20, 244, + /* 1850 */ 22, 250, 141, 250, 246, 60, 201, 183, 261, 261, + /* 1860 */ 261, 201, 70, 299, 36, 299, 201, 38, 151, 150, + /* 1870 */ 78, 285, 22, 81, 296, 296, 43, 235, 18, 238, + /* 1880 */ 201, 274, 272, 238, 238, 238, 18, 59, 200, 149, + /* 1890 */ 98, 247, 274, 274, 235, 247, 247, 247, 235, 71, + /* 1900 */ 272, 201, 200, 158, 292, 62, 291, 201, 200, 22, + /* 1910 */ 201, 222, 200, 222, 201, 200, 115, 219, 219, 64, + /* 1920 */ 219, 228, 22, 126, 221, 133, 165, 222, 100, 225, + /* 1930 */ 138, 139, 225, 219, 106, 107, 24, 219, 228, 219, + /* 1940 */ 219, 307, 114, 113, 116, 117, 118, 315, 284, 121, + /* 1950 */ 284, 222, 201, 91, 162, 320, 320, 82, 148, 267, + /* 1960 */ 145, 267, 22, 279, 201, 158, 281, 251, 147, 146, + /* 1970 */ 25, 203, 250, 249, 251, 248, 13, 247, 195, 195, + /* 1980 */ 6, 153, 154, 155, 156, 157, 193, 193, 305, 193, + /* 1990 */ 208, 305, 302, 214, 214, 214, 208, 223, 223, 214, + /* 2000 */ 4, 215, 215, 214, 3, 22, 208, 163, 15, 23, + /* 2010 */ 16, 183, 23, 139, 151, 130, 25, 20, 142, 24, + /* 2020 */ 16, 144, 1, 142, 130, 130, 61, 37, 53, 151, + /* 2030 */ 53, 53, 53, 130, 116, 1, 34, 141, 5, 22, + /* 2040 */ 115, 161, 75, 25, 68, 141, 41, 115, 68, 24, + /* 2050 */ 20, 19, 131, 125, 67, 67, 96, 22, 22, 22, + /* 2060 */ 37, 23, 22, 24, 22, 59, 67, 23, 149, 28, + /* 2070 */ 22, 25, 23, 23, 23, 22, 141, 34, 97, 23, + /* 2080 */ 23, 34, 116, 22, 143, 25, 34, 75, 34, 34, + /* 2090 */ 75, 88, 34, 86, 23, 22, 34, 25, 24, 34, + /* 2100 */ 25, 93, 23, 44, 142, 23, 142, 23, 23, 22, + /* 2110 */ 11, 25, 23, 25, 23, 22, 22, 22, 1, 23, + /* 2120 */ 23, 23, 22, 22, 15, 141, 141, 25, 25, 1, + /* 2130 */ 322, 322, 322, 135, 322, 322, 322, 322, 322, 322, + /* 2140 */ 322, 141, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2150 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2160 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2170 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2180 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2190 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2200 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2210 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2220 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2230 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2240 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2250 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2260 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2270 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2280 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2290 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2300 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2310 */ 322, 322, 322, 322, 322, 322, 322, 322, 322, 322, + /* 2320 */ 322, 322, 322, 322, 322, 322, 322, 322, }; -#define YY_SHIFT_COUNT (574) +#define YY_SHIFT_COUNT (582) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2074) +#define YY_SHIFT_MAX (2128) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 1648, 1477, 1272, 322, 322, 1, 1319, 1478, 1491, 1837, - /* 10 */ 1837, 1837, 471, 0, 0, 214, 1093, 1837, 1837, 1837, - /* 20 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, - /* 30 */ 271, 271, 1219, 1219, 216, 88, 1, 1, 1, 1, - /* 40 */ 1, 40, 111, 258, 361, 469, 512, 583, 622, 693, - /* 50 */ 732, 803, 842, 913, 1073, 1093, 1093, 1093, 1093, 1093, - /* 60 */ 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, - /* 70 */ 1093, 1093, 1093, 1113, 1093, 1216, 957, 957, 1635, 1662, - /* 80 */ 1777, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, - /* 90 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, - /* 100 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, - /* 110 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, - /* 120 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, - /* 130 */ 137, 181, 181, 181, 181, 181, 181, 181, 94, 430, - /* 140 */ 66, 65, 112, 366, 533, 533, 740, 1261, 533, 533, - /* 150 */ 79, 79, 533, 412, 412, 412, 77, 412, 123, 113, - /* 160 */ 113, 22, 22, 2096, 2096, 328, 328, 328, 239, 468, - /* 170 */ 468, 468, 468, 1015, 1015, 409, 366, 1129, 1186, 533, - /* 180 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533, - /* 190 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 969, - /* 200 */ 621, 621, 533, 642, 788, 788, 1228, 1228, 822, 822, - /* 210 */ 67, 1274, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 1307, - /* 220 */ 954, 954, 585, 472, 640, 387, 695, 538, 541, 700, - /* 230 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533, - /* 240 */ 222, 533, 533, 533, 533, 533, 533, 533, 533, 533, - /* 250 */ 533, 533, 533, 1179, 1179, 1179, 533, 533, 533, 565, - /* 260 */ 533, 533, 533, 916, 1144, 533, 533, 1288, 533, 533, - /* 270 */ 533, 533, 533, 533, 533, 533, 639, 1330, 209, 1076, - /* 280 */ 1076, 1076, 1076, 580, 209, 209, 1313, 768, 917, 649, - /* 290 */ 1181, 1316, 405, 1316, 1238, 249, 1181, 1181, 249, 1181, - /* 300 */ 405, 1238, 1369, 464, 1259, 1012, 1012, 1012, 1368, 1368, - /* 310 */ 1368, 1368, 184, 184, 1326, 904, 1287, 1480, 1712, 1712, - /* 320 */ 1633, 1633, 1757, 1757, 1633, 1647, 1651, 1783, 1764, 1791, - /* 330 */ 1791, 1791, 1791, 1633, 1806, 1677, 1651, 1651, 1677, 1783, - /* 340 */ 1764, 1677, 1764, 1677, 1633, 1806, 1674, 1779, 1633, 1806, - /* 350 */ 1823, 1633, 1806, 1633, 1806, 1823, 1732, 1732, 1732, 1794, - /* 360 */ 1840, 1840, 1823, 1732, 1738, 1732, 1794, 1732, 1732, 1701, - /* 370 */ 1844, 1758, 1758, 1823, 1633, 1789, 1789, 1807, 1807, 1742, - /* 380 */ 1752, 1877, 1633, 1743, 1742, 1759, 1765, 1677, 1879, 1897, - /* 390 */ 1897, 1914, 1914, 1914, 2096, 2096, 2096, 2096, 2096, 2096, - /* 400 */ 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 207, - /* 410 */ 1095, 331, 620, 903, 806, 1074, 1483, 1432, 1481, 1322, - /* 420 */ 1370, 1394, 1515, 1291, 1546, 1547, 1557, 1595, 1598, 1599, - /* 430 */ 1434, 1453, 1618, 1462, 1567, 1489, 1644, 1654, 1616, 1660, - /* 440 */ 1548, 1549, 1682, 1685, 1597, 742, 1941, 1945, 1927, 1787, - /* 450 */ 1937, 1940, 1934, 1936, 1821, 1810, 1832, 1938, 1938, 1942, - /* 460 */ 1822, 1947, 1824, 1949, 1968, 1828, 1841, 1938, 1842, 1912, - /* 470 */ 1939, 1938, 1826, 1921, 1922, 1925, 1926, 1850, 1865, 1948, - /* 480 */ 1843, 1982, 1980, 1964, 1872, 1827, 1928, 1970, 1929, 1923, - /* 490 */ 1958, 1848, 1885, 1977, 1983, 1985, 1871, 1880, 1984, 1943, - /* 500 */ 1986, 1987, 1988, 1990, 1946, 1955, 1991, 1911, 1989, 1994, - /* 510 */ 1951, 1992, 1996, 1873, 1998, 2000, 2001, 2002, 2003, 2004, - /* 520 */ 1999, 1933, 1890, 2009, 2010, 1910, 2005, 2012, 1892, 2011, - /* 530 */ 2006, 2007, 2008, 2013, 1950, 1962, 1957, 2014, 1969, 1952, - /* 540 */ 2015, 2023, 2026, 2027, 2025, 2028, 2018, 1913, 1915, 2031, - /* 550 */ 2011, 2033, 2036, 2037, 2038, 2039, 2040, 2043, 2051, 2044, - /* 560 */ 2045, 2046, 2047, 2049, 2050, 2048, 1944, 1935, 1953, 1954, - /* 570 */ 2052, 2055, 2053, 2073, 2074, + /* 0 */ 1792, 1588, 1494, 322, 322, 399, 306, 1319, 1339, 1430, + /* 10 */ 1828, 1828, 1828, 580, 399, 399, 399, 399, 399, 0, + /* 20 */ 0, 214, 1093, 1828, 1828, 1828, 1828, 1828, 1828, 1828, + /* 30 */ 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1130, 1130, + /* 40 */ 365, 365, 55, 278, 436, 713, 713, 201, 201, 201, + /* 50 */ 201, 40, 111, 258, 361, 469, 512, 583, 622, 693, + /* 60 */ 732, 803, 842, 913, 1073, 1093, 1093, 1093, 1093, 1093, + /* 70 */ 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, + /* 80 */ 1093, 1093, 1093, 1113, 1093, 1216, 957, 957, 1523, 1602, + /* 90 */ 1674, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, + /* 100 */ 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, + /* 110 */ 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, + /* 120 */ 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, + /* 130 */ 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, 1828, + /* 140 */ 137, 181, 181, 181, 181, 181, 181, 181, 96, 222, + /* 150 */ 143, 477, 713, 1133, 1268, 713, 713, 79, 79, 713, + /* 160 */ 770, 83, 65, 65, 65, 288, 162, 162, 2142, 2142, + /* 170 */ 696, 696, 696, 238, 474, 474, 474, 474, 1217, 1217, + /* 180 */ 678, 477, 324, 398, 713, 713, 713, 713, 713, 713, + /* 190 */ 713, 713, 713, 713, 713, 713, 713, 713, 713, 713, + /* 200 */ 713, 713, 713, 1220, 366, 366, 713, 917, 283, 283, + /* 210 */ 434, 434, 605, 605, 1298, 2142, 2142, 2142, 2142, 2142, + /* 220 */ 2142, 2142, 1179, 1157, 1157, 487, 527, 585, 645, 749, + /* 230 */ 914, 968, 752, 713, 713, 713, 713, 713, 713, 713, + /* 240 */ 713, 713, 713, 303, 713, 713, 713, 713, 713, 713, + /* 250 */ 713, 713, 713, 713, 713, 713, 797, 797, 797, 713, + /* 260 */ 713, 713, 959, 713, 713, 713, 1169, 1271, 713, 713, + /* 270 */ 1330, 713, 713, 713, 713, 713, 713, 713, 713, 629, + /* 280 */ 7, 91, 876, 876, 876, 876, 953, 91, 91, 1246, + /* 290 */ 1065, 1106, 1374, 1329, 1348, 468, 1348, 1394, 785, 1329, + /* 300 */ 1329, 785, 1329, 468, 1394, 859, 854, 1402, 1449, 1449, + /* 310 */ 1449, 1173, 1173, 1173, 1173, 1355, 1355, 1030, 1341, 405, + /* 320 */ 1230, 1795, 1795, 1711, 1711, 1829, 1829, 1711, 1717, 1719, + /* 330 */ 1850, 1833, 1860, 1860, 1860, 1860, 1711, 1868, 1740, 1719, + /* 340 */ 1719, 1740, 1850, 1833, 1740, 1833, 1740, 1711, 1868, 1745, + /* 350 */ 1843, 1711, 1868, 1887, 1711, 1868, 1711, 1868, 1887, 1801, + /* 360 */ 1801, 1801, 1855, 1900, 1900, 1887, 1801, 1797, 1801, 1855, + /* 370 */ 1801, 1801, 1761, 1912, 1830, 1830, 1887, 1711, 1862, 1862, + /* 380 */ 1875, 1875, 1810, 1815, 1940, 1711, 1807, 1810, 1821, 1823, + /* 390 */ 1740, 1945, 1963, 1963, 1974, 1974, 1974, 2142, 2142, 2142, + /* 400 */ 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, + /* 410 */ 2142, 2142, 20, 1224, 256, 1111, 1115, 1114, 1192, 1496, + /* 420 */ 1424, 1505, 1427, 355, 1383, 1537, 1506, 1538, 1553, 1583, + /* 430 */ 1584, 1591, 1625, 541, 1445, 1562, 1450, 1572, 1515, 1428, + /* 440 */ 1532, 1592, 1629, 1520, 1630, 1639, 1510, 1544, 1662, 1675, + /* 450 */ 1551, 48, 1996, 2001, 1983, 1844, 1993, 1994, 1986, 1989, + /* 460 */ 1874, 1863, 1885, 1991, 1991, 1995, 1876, 1997, 1877, 2004, + /* 470 */ 2021, 1881, 1894, 1991, 1895, 1965, 1990, 1991, 1878, 1975, + /* 480 */ 1977, 1978, 1979, 1903, 1918, 2002, 1896, 2034, 2033, 2017, + /* 490 */ 1925, 1880, 1976, 2018, 1980, 1967, 2005, 1904, 1932, 2025, + /* 500 */ 2030, 2032, 1921, 1928, 2035, 1987, 2036, 2037, 2038, 2040, + /* 510 */ 1988, 2006, 2039, 1960, 2041, 2042, 1999, 2023, 2044, 2043, + /* 520 */ 1919, 2048, 2049, 2050, 2046, 2051, 2053, 1981, 1935, 2056, + /* 530 */ 2057, 1966, 2047, 2061, 1941, 2060, 2052, 2054, 2055, 2058, + /* 540 */ 2003, 2012, 2007, 2059, 2015, 2008, 2062, 2071, 2073, 2074, + /* 550 */ 2072, 2075, 2065, 1962, 1964, 2079, 2060, 2082, 2084, 2085, + /* 560 */ 2087, 2086, 2089, 2088, 2091, 2093, 2099, 2094, 2095, 2096, + /* 570 */ 2097, 2100, 2101, 2102, 1998, 1984, 1985, 2000, 2103, 2098, + /* 580 */ 2109, 2117, 2128, }; -#define YY_REDUCE_COUNT (408) -#define YY_REDUCE_MIN (-271) -#define YY_REDUCE_MAX (1740) +#define YY_REDUCE_COUNT (411) +#define YY_REDUCE_MIN (-275) +#define YY_REDUCE_MAX (1798) static const short yy_reduce_ofst[] = { - /* 0 */ -125, 733, 789, 241, 293, -123, -193, -191, -183, -187, - /* 10 */ 166, 238, 133, -207, -199, -267, -176, -6, 204, 489, - /* 20 */ 576, -175, 598, 686, 615, 725, 860, 778, 781, 857, - /* 30 */ 616, 887, 87, 240, -192, 408, 626, 796, 843, 854, - /* 40 */ 1003, -271, -271, -271, -271, -271, -271, -271, -271, -271, - /* 50 */ -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, - /* 60 */ -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, - /* 70 */ -271, -271, -271, -271, -271, -271, -271, -271, 80, 83, - /* 80 */ 313, 886, 888, 996, 1034, 1059, 1081, 1100, 1117, 1152, - /* 90 */ 1155, 1163, 1165, 1167, 1169, 1172, 1180, 1182, 1184, 1198, - /* 100 */ 1200, 1213, 1215, 1225, 1227, 1252, 1254, 1264, 1299, 1303, - /* 110 */ 1308, 1312, 1325, 1328, 1337, 1340, 1343, 1371, 1373, 1384, - /* 120 */ 1386, 1411, 1420, 1424, 1426, 1458, 1470, 1473, 1475, 1479, - /* 130 */ -271, -271, -271, -271, -271, -271, -271, -271, -271, -271, - /* 140 */ -271, 138, 459, 396, -158, 470, 302, -212, 521, 201, - /* 150 */ -195, -92, 559, 630, 632, 630, -271, 632, 901, 63, - /* 160 */ 407, -271, -271, -271, -271, 161, 161, 161, 251, 335, - /* 170 */ 847, 960, 980, 537, 588, 618, 628, 688, 688, -166, - /* 180 */ -161, 674, 790, 794, 799, 851, 852, -122, 680, -120, - /* 190 */ 995, 1038, 415, 1051, 893, 798, 962, 400, 1086, 779, - /* 200 */ 923, 924, 263, 1041, 979, 990, 1083, 1097, 1031, 1194, - /* 210 */ 362, 994, 1139, 1005, 1037, 1202, 1205, 1195, 1210, -194, - /* 220 */ 56, 185, -135, 232, 522, 560, 601, 617, 669, 683, - /* 230 */ 711, 856, 908, 941, 1048, 1101, 1147, 1257, 1262, 1265, - /* 240 */ 392, 1292, 1333, 1339, 1342, 1346, 1350, 1359, 1374, 1418, - /* 250 */ 1421, 1436, 1437, 593, 755, 770, 997, 1445, 1459, 1209, - /* 260 */ 1500, 1504, 1516, 1132, 1243, 1518, 1519, 1440, 1520, 560, - /* 270 */ 1522, 1523, 1524, 1526, 1527, 1529, 1382, 1438, 1431, 1468, - /* 280 */ 1469, 1472, 1476, 1209, 1431, 1431, 1485, 1525, 1539, 1435, - /* 290 */ 1463, 1471, 1492, 1487, 1443, 1494, 1474, 1484, 1498, 1486, - /* 300 */ 1502, 1455, 1530, 1531, 1533, 1540, 1542, 1544, 1505, 1506, - /* 310 */ 1507, 1508, 1521, 1528, 1493, 1537, 1532, 1575, 1488, 1496, - /* 320 */ 1584, 1594, 1509, 1510, 1600, 1538, 1534, 1541, 1574, 1577, - /* 330 */ 1583, 1585, 1586, 1612, 1626, 1581, 1556, 1558, 1587, 1559, - /* 340 */ 1601, 1588, 1603, 1592, 1631, 1640, 1550, 1553, 1643, 1645, - /* 350 */ 1625, 1649, 1652, 1650, 1653, 1632, 1636, 1637, 1642, 1634, - /* 360 */ 1639, 1641, 1646, 1656, 1655, 1658, 1659, 1661, 1663, 1560, - /* 370 */ 1564, 1596, 1605, 1664, 1670, 1565, 1571, 1627, 1638, 1657, - /* 380 */ 1665, 1623, 1702, 1630, 1666, 1667, 1671, 1673, 1703, 1718, - /* 390 */ 1719, 1729, 1730, 1731, 1621, 1622, 1628, 1720, 1713, 1716, - /* 400 */ 1722, 1723, 1733, 1717, 1724, 1727, 1728, 1725, 1740, + /* 0 */ -71, 194, 343, 835, -180, -177, 838, -194, -188, -185, + /* 10 */ -183, 82, 183, -65, 133, 245, 346, 407, 458, -178, + /* 20 */ 75, -275, -4, 310, 312, 489, 575, 596, 463, 686, + /* 30 */ 707, 725, 780, 1098, 856, 778, 1059, 1090, 708, 887, + /* 40 */ 86, 448, 980, 630, 680, 681, 684, 796, 801, 796, + /* 50 */ 801, -261, -261, -261, -261, -261, -261, -261, -261, -261, + /* 60 */ -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, + /* 70 */ -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, + /* 80 */ -261, -261, -261, -261, -261, -261, -261, -261, 391, 886, + /* 90 */ 888, 1013, 1016, 1081, 1087, 1151, 1159, 1177, 1185, 1188, + /* 100 */ 1190, 1194, 1197, 1203, 1247, 1260, 1264, 1267, 1269, 1273, + /* 110 */ 1315, 1322, 1335, 1337, 1356, 1362, 1418, 1425, 1453, 1457, + /* 120 */ 1465, 1473, 1487, 1495, 1507, 1517, 1521, 1534, 1543, 1546, + /* 130 */ 1549, 1552, 1554, 1560, 1581, 1590, 1593, 1595, 1621, 1623, + /* 140 */ -261, -261, -261, -261, -261, -261, -261, -261, -261, -261, + /* 150 */ -261, -186, -117, 260, 263, 460, 631, -74, 497, -181, + /* 160 */ -261, 939, 176, 274, 338, 676, -261, -261, -261, -261, + /* 170 */ -212, -212, -212, -184, 149, 777, 1061, 1103, 265, 419, + /* 180 */ -254, 670, 677, 677, -11, -129, 184, 488, 736, 789, + /* 190 */ 805, 844, 403, 529, 579, 668, 783, 841, 1158, 1112, + /* 200 */ 806, 861, 1095, 846, 839, 1031, -189, 1077, 1080, 1116, + /* 210 */ 1084, 1156, 1139, 1221, 46, 1099, 1037, 1118, 1171, 1214, + /* 220 */ 1210, 1258, -210, -190, -176, -115, 117, 262, 376, 490, + /* 230 */ 511, 520, 618, 639, 743, 901, 907, 958, 1014, 1055, + /* 240 */ 1108, 1193, 1244, 720, 1248, 1277, 1324, 1347, 1417, 1431, + /* 250 */ 1432, 1440, 1451, 1452, 1463, 1478, 1286, 1350, 1369, 1490, + /* 260 */ 1498, 1501, 773, 1509, 1513, 1528, 1292, 1367, 1535, 1536, + /* 270 */ 1477, 1542, 376, 1547, 1550, 1555, 1559, 1568, 1571, 1441, + /* 280 */ 1443, 1474, 1511, 1516, 1519, 1522, 773, 1474, 1474, 1503, + /* 290 */ 1567, 1594, 1484, 1527, 1556, 1570, 1557, 1524, 1573, 1545, + /* 300 */ 1548, 1576, 1561, 1587, 1540, 1575, 1606, 1611, 1622, 1624, + /* 310 */ 1626, 1582, 1597, 1598, 1599, 1601, 1603, 1563, 1608, 1605, + /* 320 */ 1604, 1564, 1566, 1655, 1660, 1578, 1579, 1665, 1586, 1607, + /* 330 */ 1610, 1642, 1641, 1645, 1646, 1647, 1679, 1688, 1644, 1618, + /* 340 */ 1619, 1648, 1628, 1659, 1649, 1663, 1650, 1700, 1702, 1612, + /* 350 */ 1615, 1706, 1708, 1689, 1709, 1712, 1713, 1715, 1691, 1698, + /* 360 */ 1699, 1701, 1693, 1704, 1707, 1705, 1714, 1703, 1718, 1710, + /* 370 */ 1720, 1721, 1632, 1634, 1664, 1666, 1729, 1751, 1635, 1636, + /* 380 */ 1692, 1694, 1716, 1722, 1684, 1763, 1685, 1723, 1724, 1727, + /* 390 */ 1730, 1768, 1783, 1784, 1793, 1794, 1796, 1683, 1686, 1690, + /* 400 */ 1782, 1779, 1780, 1781, 1785, 1788, 1774, 1775, 1786, 1787, + /* 410 */ 1789, 1798, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1639, 1639, 1639, 1469, 1236, 1347, 1236, 1236, 1236, 1469, - /* 10 */ 1469, 1469, 1236, 1377, 1377, 1522, 1269, 1236, 1236, 1236, - /* 20 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1468, 1236, 1236, - /* 30 */ 1236, 1236, 1555, 1555, 1236, 1236, 1236, 1236, 1236, 1236, - /* 40 */ 1236, 1236, 1386, 1236, 1393, 1236, 1236, 1236, 1236, 1236, - /* 50 */ 1470, 1471, 1236, 1236, 1236, 1521, 1523, 1486, 1400, 1399, - /* 60 */ 1398, 1397, 1504, 1365, 1391, 1384, 1388, 1465, 1466, 1464, - /* 70 */ 1617, 1471, 1470, 1236, 1387, 1433, 1449, 1432, 1236, 1236, - /* 80 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, - /* 90 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, - /* 100 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, - /* 110 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, - /* 120 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, - /* 130 */ 1441, 1448, 1447, 1446, 1455, 1445, 1442, 1435, 1434, 1436, - /* 140 */ 1437, 1236, 1236, 1260, 1236, 1236, 1257, 1311, 1236, 1236, - /* 150 */ 1236, 1236, 1236, 1541, 1540, 1236, 1438, 1236, 1269, 1427, - /* 160 */ 1426, 1452, 1439, 1451, 1450, 1529, 1591, 1590, 1487, 1236, - /* 170 */ 1236, 1236, 1236, 1236, 1236, 1555, 1236, 1236, 1236, 1236, - /* 180 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, - /* 190 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1367, - /* 200 */ 1555, 1555, 1236, 1269, 1555, 1555, 1368, 1368, 1265, 1265, - /* 210 */ 1371, 1236, 1536, 1338, 1338, 1338, 1338, 1347, 1338, 1236, - /* 220 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, - /* 230 */ 1236, 1236, 1236, 1236, 1526, 1524, 1236, 1236, 1236, 1236, - /* 240 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, - /* 250 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, - /* 260 */ 1236, 1236, 1236, 1343, 1236, 1236, 1236, 1236, 1236, 1236, - /* 270 */ 1236, 1236, 1236, 1236, 1236, 1584, 1236, 1499, 1325, 1343, - /* 280 */ 1343, 1343, 1343, 1345, 1326, 1324, 1337, 1270, 1243, 1631, - /* 290 */ 1403, 1392, 1344, 1392, 1628, 1390, 1403, 1403, 1390, 1403, - /* 300 */ 1344, 1628, 1286, 1606, 1281, 1377, 1377, 1377, 1367, 1367, - /* 310 */ 1367, 1367, 1371, 1371, 1467, 1344, 1337, 1236, 1631, 1631, - /* 320 */ 1353, 1353, 1630, 1630, 1353, 1487, 1614, 1412, 1314, 1320, - /* 330 */ 1320, 1320, 1320, 1353, 1254, 1390, 1614, 1614, 1390, 1412, - /* 340 */ 1314, 1390, 1314, 1390, 1353, 1254, 1503, 1625, 1353, 1254, - /* 350 */ 1477, 1353, 1254, 1353, 1254, 1477, 1312, 1312, 1312, 1301, - /* 360 */ 1236, 1236, 1477, 1312, 1286, 1312, 1301, 1312, 1312, 1573, - /* 370 */ 1236, 1481, 1481, 1477, 1353, 1565, 1565, 1380, 1380, 1385, - /* 380 */ 1371, 1472, 1353, 1236, 1385, 1383, 1381, 1390, 1304, 1587, - /* 390 */ 1587, 1583, 1583, 1583, 1636, 1636, 1536, 1599, 1269, 1269, - /* 400 */ 1269, 1269, 1599, 1288, 1288, 1270, 1270, 1269, 1599, 1236, - /* 410 */ 1236, 1236, 1236, 1236, 1236, 1594, 1236, 1531, 1488, 1357, - /* 420 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, - /* 430 */ 1236, 1236, 1236, 1236, 1542, 1236, 1236, 1236, 1236, 1236, - /* 440 */ 1236, 1236, 1236, 1236, 1236, 1417, 1236, 1239, 1533, 1236, - /* 450 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1394, 1395, 1358, - /* 460 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1409, 1236, 1236, - /* 470 */ 1236, 1404, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, - /* 480 */ 1627, 1236, 1236, 1236, 1236, 1236, 1236, 1502, 1501, 1236, - /* 490 */ 1236, 1355, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, - /* 500 */ 1236, 1236, 1236, 1236, 1236, 1284, 1236, 1236, 1236, 1236, - /* 510 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, - /* 520 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1382, - /* 530 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, - /* 540 */ 1236, 1236, 1236, 1236, 1570, 1372, 1236, 1236, 1236, 1236, - /* 550 */ 1618, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, - /* 560 */ 1236, 1236, 1236, 1236, 1236, 1610, 1328, 1418, 1236, 1421, - /* 570 */ 1258, 1236, 1248, 1236, 1236, + /* 0 */ 1663, 1663, 1663, 1491, 1254, 1367, 1254, 1254, 1254, 1254, + /* 10 */ 1491, 1491, 1491, 1254, 1254, 1254, 1254, 1254, 1254, 1397, + /* 20 */ 1397, 1544, 1287, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 30 */ 1254, 1254, 1254, 1254, 1254, 1490, 1254, 1254, 1254, 1254, + /* 40 */ 1578, 1578, 1254, 1254, 1254, 1254, 1254, 1563, 1562, 1254, + /* 50 */ 1254, 1254, 1406, 1254, 1413, 1254, 1254, 1254, 1254, 1254, + /* 60 */ 1492, 1493, 1254, 1254, 1254, 1543, 1545, 1508, 1420, 1419, + /* 70 */ 1418, 1417, 1526, 1385, 1411, 1404, 1408, 1487, 1488, 1486, + /* 80 */ 1641, 1493, 1492, 1254, 1407, 1455, 1471, 1454, 1254, 1254, + /* 90 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 100 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 110 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 120 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 130 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 140 */ 1463, 1470, 1469, 1468, 1477, 1467, 1464, 1457, 1456, 1458, + /* 150 */ 1459, 1278, 1254, 1275, 1329, 1254, 1254, 1254, 1254, 1254, + /* 160 */ 1460, 1287, 1448, 1447, 1446, 1254, 1474, 1461, 1473, 1472, + /* 170 */ 1551, 1615, 1614, 1509, 1254, 1254, 1254, 1254, 1254, 1254, + /* 180 */ 1578, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 190 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 200 */ 1254, 1254, 1254, 1387, 1578, 1578, 1254, 1287, 1578, 1578, + /* 210 */ 1388, 1388, 1283, 1283, 1391, 1558, 1358, 1358, 1358, 1358, + /* 220 */ 1367, 1358, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 230 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1548, 1546, 1254, + /* 240 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 250 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 260 */ 1254, 1254, 1254, 1254, 1254, 1254, 1363, 1254, 1254, 1254, + /* 270 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1608, 1254, + /* 280 */ 1521, 1343, 1363, 1363, 1363, 1363, 1365, 1344, 1342, 1357, + /* 290 */ 1288, 1261, 1655, 1423, 1412, 1364, 1412, 1652, 1410, 1423, + /* 300 */ 1423, 1410, 1423, 1364, 1652, 1304, 1630, 1299, 1397, 1397, + /* 310 */ 1397, 1387, 1387, 1387, 1387, 1391, 1391, 1489, 1364, 1357, + /* 320 */ 1254, 1655, 1655, 1373, 1373, 1654, 1654, 1373, 1509, 1638, + /* 330 */ 1432, 1332, 1338, 1338, 1338, 1338, 1373, 1272, 1410, 1638, + /* 340 */ 1638, 1410, 1432, 1332, 1410, 1332, 1410, 1373, 1272, 1525, + /* 350 */ 1649, 1373, 1272, 1499, 1373, 1272, 1373, 1272, 1499, 1330, + /* 360 */ 1330, 1330, 1319, 1254, 1254, 1499, 1330, 1304, 1330, 1319, + /* 370 */ 1330, 1330, 1596, 1254, 1503, 1503, 1499, 1373, 1588, 1588, + /* 380 */ 1400, 1400, 1405, 1391, 1494, 1373, 1254, 1405, 1403, 1401, + /* 390 */ 1410, 1322, 1611, 1611, 1607, 1607, 1607, 1660, 1660, 1558, + /* 400 */ 1623, 1287, 1287, 1287, 1287, 1623, 1306, 1306, 1288, 1288, + /* 410 */ 1287, 1623, 1254, 1254, 1254, 1254, 1254, 1254, 1618, 1254, + /* 420 */ 1553, 1510, 1377, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 430 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1564, + /* 440 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 450 */ 1254, 1437, 1254, 1257, 1555, 1254, 1254, 1254, 1254, 1254, + /* 460 */ 1254, 1254, 1254, 1414, 1415, 1378, 1254, 1254, 1254, 1254, + /* 470 */ 1254, 1254, 1254, 1429, 1254, 1254, 1254, 1424, 1254, 1254, + /* 480 */ 1254, 1254, 1254, 1254, 1254, 1254, 1651, 1254, 1254, 1254, + /* 490 */ 1254, 1254, 1254, 1524, 1523, 1254, 1254, 1375, 1254, 1254, + /* 500 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 510 */ 1254, 1302, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 520 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 530 */ 1254, 1254, 1254, 1254, 1254, 1402, 1254, 1254, 1254, 1254, + /* 540 */ 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 550 */ 1593, 1392, 1254, 1254, 1254, 1254, 1642, 1254, 1254, 1254, + /* 560 */ 1254, 1352, 1254, 1254, 1254, 1254, 1254, 1254, 1254, 1254, + /* 570 */ 1254, 1254, 1254, 1634, 1346, 1438, 1254, 1441, 1276, 1254, + /* 580 */ 1266, 1254, 1254, }; /********** End of lemon-generated parsing tables *****************************/ @@ -170615,8 +173902,8 @@ static const YYCODETYPE yyFallback[] = { 0, /* TRUEFALSE => nothing */ 0, /* ISNOT => nothing */ 0, /* FUNCTION => nothing */ - 0, /* UMINUS => nothing */ 0, /* UPLUS => nothing */ + 0, /* UMINUS => nothing */ 0, /* TRUTH => nothing */ 0, /* REGISTER => nothing */ 0, /* VECTOR => nothing */ @@ -170625,6 +173912,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASTERISK => nothing */ 0, /* SPAN => nothing */ 0, /* ERROR => nothing */ + 0, /* QNUMBER => nothing */ 0, /* SPACE => nothing */ 0, /* ILLEGAL => nothing */ }; @@ -170667,14 +173955,9 @@ struct yyParser { #endif sqlite3ParserARG_SDECL /* A place to hold %extra_argument */ sqlite3ParserCTX_SDECL /* A place to hold %extra_context */ -#if YYSTACKDEPTH<=0 - int yystksz; /* Current side of the stack */ - yyStackEntry *yystack; /* The parser's stack */ - yyStackEntry yystk0; /* First stack entry */ -#else - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ - yyStackEntry *yystackEnd; /* Last entry in the stack */ -#endif + yyStackEntry *yystackEnd; /* Last entry in the stack */ + yyStackEntry *yystack; /* The parser stack */ + yyStackEntry yystk0[YYSTACKDEPTH]; /* Initial stack space */ }; typedef struct yyParser yyParser; @@ -170888,8 +174171,8 @@ static const char *const yyTokenName[] = { /* 170 */ "TRUEFALSE", /* 171 */ "ISNOT", /* 172 */ "FUNCTION", - /* 173 */ "UMINUS", - /* 174 */ "UPLUS", + /* 173 */ "UPLUS", + /* 174 */ "UMINUS", /* 175 */ "TRUTH", /* 176 */ "REGISTER", /* 177 */ "VECTOR", @@ -170898,142 +174181,145 @@ static const char *const yyTokenName[] = { /* 180 */ "ASTERISK", /* 181 */ "SPAN", /* 182 */ "ERROR", - /* 183 */ "SPACE", - /* 184 */ "ILLEGAL", - /* 185 */ "input", - /* 186 */ "cmdlist", - /* 187 */ "ecmd", - /* 188 */ "cmdx", - /* 189 */ "explain", - /* 190 */ "cmd", - /* 191 */ "transtype", - /* 192 */ "trans_opt", - /* 193 */ "nm", - /* 194 */ "savepoint_opt", - /* 195 */ "create_table", - /* 196 */ "create_table_args", - /* 197 */ "createkw", - /* 198 */ "temp", - /* 199 */ "ifnotexists", - /* 200 */ "dbnm", - /* 201 */ "columnlist", - /* 202 */ "conslist_opt", - /* 203 */ "table_option_set", - /* 204 */ "select", - /* 205 */ "table_option", - /* 206 */ "columnname", - /* 207 */ "carglist", - /* 208 */ "typetoken", - /* 209 */ "typename", - /* 210 */ "signed", - /* 211 */ "plus_num", - /* 212 */ "minus_num", - /* 213 */ "scanpt", - /* 214 */ "scantok", - /* 215 */ "ccons", - /* 216 */ "term", - /* 217 */ "expr", - /* 218 */ "onconf", - /* 219 */ "sortorder", - /* 220 */ "autoinc", - /* 221 */ "eidlist_opt", - /* 222 */ "refargs", - /* 223 */ "defer_subclause", - /* 224 */ "generated", - /* 225 */ "refarg", - /* 226 */ "refact", - /* 227 */ "init_deferred_pred_opt", - /* 228 */ "conslist", - /* 229 */ "tconscomma", - /* 230 */ "tcons", - /* 231 */ "sortlist", - /* 232 */ "eidlist", - /* 233 */ "defer_subclause_opt", - /* 234 */ "orconf", - /* 235 */ "resolvetype", - /* 236 */ "raisetype", - /* 237 */ "ifexists", - /* 238 */ "fullname", - /* 239 */ "selectnowith", - /* 240 */ "oneselect", - /* 241 */ "wqlist", - /* 242 */ "multiselect_op", - /* 243 */ "distinct", - /* 244 */ "selcollist", - /* 245 */ "from", - /* 246 */ "where_opt", - /* 247 */ "groupby_opt", - /* 248 */ "having_opt", - /* 249 */ "orderby_opt", - /* 250 */ "limit_opt", - /* 251 */ "window_clause", - /* 252 */ "values", - /* 253 */ "nexprlist", - /* 254 */ "sclp", - /* 255 */ "as", - /* 256 */ "seltablist", - /* 257 */ "stl_prefix", - /* 258 */ "joinop", - /* 259 */ "on_using", - /* 260 */ "indexed_by", - /* 261 */ "exprlist", - /* 262 */ "xfullname", - /* 263 */ "idlist", - /* 264 */ "indexed_opt", - /* 265 */ "nulls", - /* 266 */ "with", - /* 267 */ "where_opt_ret", - /* 268 */ "setlist", - /* 269 */ "insert_cmd", - /* 270 */ "idlist_opt", - /* 271 */ "upsert", - /* 272 */ "returning", - /* 273 */ "filter_over", - /* 274 */ "likeop", - /* 275 */ "between_op", - /* 276 */ "in_op", - /* 277 */ "paren_exprlist", - /* 278 */ "case_operand", - /* 279 */ "case_exprlist", - /* 280 */ "case_else", - /* 281 */ "uniqueflag", - /* 282 */ "collate", - /* 283 */ "vinto", - /* 284 */ "nmnum", - /* 285 */ "trigger_decl", - /* 286 */ "trigger_cmd_list", - /* 287 */ "trigger_time", - /* 288 */ "trigger_event", - /* 289 */ "foreach_clause", - /* 290 */ "when_clause", - /* 291 */ "trigger_cmd", - /* 292 */ "trnm", - /* 293 */ "tridxby", - /* 294 */ "database_kw_opt", - /* 295 */ "key_opt", - /* 296 */ "add_column_fullname", - /* 297 */ "kwcolumn_opt", - /* 298 */ "create_vtab", - /* 299 */ "vtabarglist", - /* 300 */ "vtabarg", - /* 301 */ "vtabargtoken", - /* 302 */ "lp", - /* 303 */ "anylist", - /* 304 */ "wqitem", - /* 305 */ "wqas", - /* 306 */ "windowdefn_list", - /* 307 */ "windowdefn", - /* 308 */ "window", - /* 309 */ "frame_opt", - /* 310 */ "part_opt", - /* 311 */ "filter_clause", - /* 312 */ "over_clause", - /* 313 */ "range_or_rows", - /* 314 */ "frame_bound", - /* 315 */ "frame_bound_s", - /* 316 */ "frame_bound_e", - /* 317 */ "frame_exclude_opt", - /* 318 */ "frame_exclude", + /* 183 */ "QNUMBER", + /* 184 */ "SPACE", + /* 185 */ "ILLEGAL", + /* 186 */ "input", + /* 187 */ "cmdlist", + /* 188 */ "ecmd", + /* 189 */ "cmdx", + /* 190 */ "explain", + /* 191 */ "cmd", + /* 192 */ "transtype", + /* 193 */ "trans_opt", + /* 194 */ "nm", + /* 195 */ "savepoint_opt", + /* 196 */ "create_table", + /* 197 */ "create_table_args", + /* 198 */ "createkw", + /* 199 */ "temp", + /* 200 */ "ifnotexists", + /* 201 */ "dbnm", + /* 202 */ "columnlist", + /* 203 */ "conslist_opt", + /* 204 */ "table_option_set", + /* 205 */ "select", + /* 206 */ "table_option", + /* 207 */ "columnname", + /* 208 */ "carglist", + /* 209 */ "typetoken", + /* 210 */ "typename", + /* 211 */ "signed", + /* 212 */ "plus_num", + /* 213 */ "minus_num", + /* 214 */ "scanpt", + /* 215 */ "scantok", + /* 216 */ "ccons", + /* 217 */ "term", + /* 218 */ "expr", + /* 219 */ "onconf", + /* 220 */ "sortorder", + /* 221 */ "autoinc", + /* 222 */ "eidlist_opt", + /* 223 */ "refargs", + /* 224 */ "defer_subclause", + /* 225 */ "generated", + /* 226 */ "refarg", + /* 227 */ "refact", + /* 228 */ "init_deferred_pred_opt", + /* 229 */ "conslist", + /* 230 */ "tconscomma", + /* 231 */ "tcons", + /* 232 */ "sortlist", + /* 233 */ "eidlist", + /* 234 */ "defer_subclause_opt", + /* 235 */ "orconf", + /* 236 */ "resolvetype", + /* 237 */ "raisetype", + /* 238 */ "ifexists", + /* 239 */ "fullname", + /* 240 */ "selectnowith", + /* 241 */ "oneselect", + /* 242 */ "wqlist", + /* 243 */ "multiselect_op", + /* 244 */ "distinct", + /* 245 */ "selcollist", + /* 246 */ "from", + /* 247 */ "where_opt", + /* 248 */ "groupby_opt", + /* 249 */ "having_opt", + /* 250 */ "orderby_opt", + /* 251 */ "limit_opt", + /* 252 */ "window_clause", + /* 253 */ "values", + /* 254 */ "nexprlist", + /* 255 */ "mvalues", + /* 256 */ "sclp", + /* 257 */ "as", + /* 258 */ "seltablist", + /* 259 */ "stl_prefix", + /* 260 */ "joinop", + /* 261 */ "on_using", + /* 262 */ "indexed_by", + /* 263 */ "exprlist", + /* 264 */ "xfullname", + /* 265 */ "idlist", + /* 266 */ "indexed_opt", + /* 267 */ "nulls", + /* 268 */ "with", + /* 269 */ "where_opt_ret", + /* 270 */ "setlist", + /* 271 */ "insert_cmd", + /* 272 */ "idlist_opt", + /* 273 */ "upsert", + /* 274 */ "returning", + /* 275 */ "filter_over", + /* 276 */ "likeop", + /* 277 */ "between_op", + /* 278 */ "in_op", + /* 279 */ "paren_exprlist", + /* 280 */ "case_operand", + /* 281 */ "case_exprlist", + /* 282 */ "case_else", + /* 283 */ "uniqueflag", + /* 284 */ "collate", + /* 285 */ "vinto", + /* 286 */ "nmnum", + /* 287 */ "trigger_decl", + /* 288 */ "trigger_cmd_list", + /* 289 */ "trigger_time", + /* 290 */ "trigger_event", + /* 291 */ "foreach_clause", + /* 292 */ "when_clause", + /* 293 */ "trigger_cmd", + /* 294 */ "trnm", + /* 295 */ "tridxby", + /* 296 */ "database_kw_opt", + /* 297 */ "key_opt", + /* 298 */ "add_column_fullname", + /* 299 */ "kwcolumn_opt", + /* 300 */ "create_vtab", + /* 301 */ "vtabarglist", + /* 302 */ "vtabarg", + /* 303 */ "vtabargtoken", + /* 304 */ "lp", + /* 305 */ "anylist", + /* 306 */ "wqitem", + /* 307 */ "wqas", + /* 308 */ "withnm", + /* 309 */ "windowdefn_list", + /* 310 */ "windowdefn", + /* 311 */ "window", + /* 312 */ "frame_opt", + /* 313 */ "part_opt", + /* 314 */ "filter_clause", + /* 315 */ "over_clause", + /* 316 */ "range_or_rows", + /* 317 */ "frame_bound", + /* 318 */ "frame_bound_s", + /* 319 */ "frame_bound_e", + /* 320 */ "frame_exclude_opt", + /* 321 */ "frame_exclude", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -171136,349 +174422,363 @@ static const char *const yyRuleName[] = { /* 92 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt", /* 93 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt", /* 94 */ "values ::= VALUES LP nexprlist RP", - /* 95 */ "values ::= values COMMA LP nexprlist RP", - /* 96 */ "distinct ::= DISTINCT", - /* 97 */ "distinct ::= ALL", - /* 98 */ "distinct ::=", - /* 99 */ "sclp ::=", - /* 100 */ "selcollist ::= sclp scanpt expr scanpt as", - /* 101 */ "selcollist ::= sclp scanpt STAR", - /* 102 */ "selcollist ::= sclp scanpt nm DOT STAR", - /* 103 */ "as ::= AS nm", - /* 104 */ "as ::=", - /* 105 */ "from ::=", - /* 106 */ "from ::= FROM seltablist", - /* 107 */ "stl_prefix ::= seltablist joinop", - /* 108 */ "stl_prefix ::=", - /* 109 */ "seltablist ::= stl_prefix nm dbnm as on_using", - /* 110 */ "seltablist ::= stl_prefix nm dbnm as indexed_by on_using", - /* 111 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using", - /* 112 */ "seltablist ::= stl_prefix LP select RP as on_using", - /* 113 */ "seltablist ::= stl_prefix LP seltablist RP as on_using", - /* 114 */ "dbnm ::=", - /* 115 */ "dbnm ::= DOT nm", - /* 116 */ "fullname ::= nm", - /* 117 */ "fullname ::= nm DOT nm", - /* 118 */ "xfullname ::= nm", - /* 119 */ "xfullname ::= nm DOT nm", - /* 120 */ "xfullname ::= nm DOT nm AS nm", - /* 121 */ "xfullname ::= nm AS nm", - /* 122 */ "joinop ::= COMMA|JOIN", - /* 123 */ "joinop ::= JOIN_KW JOIN", - /* 124 */ "joinop ::= JOIN_KW nm JOIN", - /* 125 */ "joinop ::= JOIN_KW nm nm JOIN", - /* 126 */ "on_using ::= ON expr", - /* 127 */ "on_using ::= USING LP idlist RP", - /* 128 */ "on_using ::=", - /* 129 */ "indexed_opt ::=", - /* 130 */ "indexed_by ::= INDEXED BY nm", - /* 131 */ "indexed_by ::= NOT INDEXED", - /* 132 */ "orderby_opt ::=", - /* 133 */ "orderby_opt ::= ORDER BY sortlist", - /* 134 */ "sortlist ::= sortlist COMMA expr sortorder nulls", - /* 135 */ "sortlist ::= expr sortorder nulls", - /* 136 */ "sortorder ::= ASC", - /* 137 */ "sortorder ::= DESC", - /* 138 */ "sortorder ::=", - /* 139 */ "nulls ::= NULLS FIRST", - /* 140 */ "nulls ::= NULLS LAST", - /* 141 */ "nulls ::=", - /* 142 */ "groupby_opt ::=", - /* 143 */ "groupby_opt ::= GROUP BY nexprlist", - /* 144 */ "having_opt ::=", - /* 145 */ "having_opt ::= HAVING expr", - /* 146 */ "limit_opt ::=", - /* 147 */ "limit_opt ::= LIMIT expr", - /* 148 */ "limit_opt ::= LIMIT expr OFFSET expr", - /* 149 */ "limit_opt ::= LIMIT expr COMMA expr", - /* 150 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret", - /* 151 */ "where_opt ::=", - /* 152 */ "where_opt ::= WHERE expr", - /* 153 */ "where_opt_ret ::=", - /* 154 */ "where_opt_ret ::= WHERE expr", - /* 155 */ "where_opt_ret ::= RETURNING selcollist", - /* 156 */ "where_opt_ret ::= WHERE expr RETURNING selcollist", - /* 157 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret", - /* 158 */ "setlist ::= setlist COMMA nm EQ expr", - /* 159 */ "setlist ::= setlist COMMA LP idlist RP EQ expr", - /* 160 */ "setlist ::= nm EQ expr", - /* 161 */ "setlist ::= LP idlist RP EQ expr", - /* 162 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert", - /* 163 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning", - /* 164 */ "upsert ::=", - /* 165 */ "upsert ::= RETURNING selcollist", - /* 166 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert", - /* 167 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert", - /* 168 */ "upsert ::= ON CONFLICT DO NOTHING returning", - /* 169 */ "upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning", - /* 170 */ "returning ::= RETURNING selcollist", - /* 171 */ "insert_cmd ::= INSERT orconf", - /* 172 */ "insert_cmd ::= REPLACE", - /* 173 */ "idlist_opt ::=", - /* 174 */ "idlist_opt ::= LP idlist RP", - /* 175 */ "idlist ::= idlist COMMA nm", - /* 176 */ "idlist ::= nm", - /* 177 */ "expr ::= LP expr RP", - /* 178 */ "expr ::= ID|INDEXED|JOIN_KW", - /* 179 */ "expr ::= nm DOT nm", - /* 180 */ "expr ::= nm DOT nm DOT nm", - /* 181 */ "term ::= NULL|FLOAT|BLOB", - /* 182 */ "term ::= STRING", - /* 183 */ "term ::= INTEGER", - /* 184 */ "expr ::= VARIABLE", - /* 185 */ "expr ::= expr COLLATE ID|STRING", - /* 186 */ "expr ::= CAST LP expr AS typetoken RP", - /* 187 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP", - /* 188 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP", - /* 189 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over", - /* 190 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over", - /* 191 */ "term ::= CTIME_KW", - /* 192 */ "expr ::= LP nexprlist COMMA expr RP", - /* 193 */ "expr ::= expr AND expr", - /* 194 */ "expr ::= expr OR expr", - /* 195 */ "expr ::= expr LT|GT|GE|LE expr", - /* 196 */ "expr ::= expr EQ|NE expr", - /* 197 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", - /* 198 */ "expr ::= expr PLUS|MINUS expr", - /* 199 */ "expr ::= expr STAR|SLASH|REM expr", - /* 200 */ "expr ::= expr CONCAT expr", - /* 201 */ "likeop ::= NOT LIKE_KW|MATCH", - /* 202 */ "expr ::= expr likeop expr", - /* 203 */ "expr ::= expr likeop expr ESCAPE expr", - /* 204 */ "expr ::= expr ISNULL|NOTNULL", - /* 205 */ "expr ::= expr NOT NULL", - /* 206 */ "expr ::= expr IS expr", - /* 207 */ "expr ::= expr IS NOT expr", - /* 208 */ "expr ::= expr IS NOT DISTINCT FROM expr", - /* 209 */ "expr ::= expr IS DISTINCT FROM expr", - /* 210 */ "expr ::= NOT expr", - /* 211 */ "expr ::= BITNOT expr", - /* 212 */ "expr ::= PLUS|MINUS expr", - /* 213 */ "expr ::= expr PTR expr", - /* 214 */ "between_op ::= BETWEEN", - /* 215 */ "between_op ::= NOT BETWEEN", - /* 216 */ "expr ::= expr between_op expr AND expr", - /* 217 */ "in_op ::= IN", - /* 218 */ "in_op ::= NOT IN", - /* 219 */ "expr ::= expr in_op LP exprlist RP", - /* 220 */ "expr ::= LP select RP", - /* 221 */ "expr ::= expr in_op LP select RP", - /* 222 */ "expr ::= expr in_op nm dbnm paren_exprlist", - /* 223 */ "expr ::= EXISTS LP select RP", - /* 224 */ "expr ::= CASE case_operand case_exprlist case_else END", - /* 225 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", - /* 226 */ "case_exprlist ::= WHEN expr THEN expr", - /* 227 */ "case_else ::= ELSE expr", - /* 228 */ "case_else ::=", - /* 229 */ "case_operand ::=", - /* 230 */ "exprlist ::=", - /* 231 */ "nexprlist ::= nexprlist COMMA expr", - /* 232 */ "nexprlist ::= expr", - /* 233 */ "paren_exprlist ::=", - /* 234 */ "paren_exprlist ::= LP exprlist RP", - /* 235 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", - /* 236 */ "uniqueflag ::= UNIQUE", - /* 237 */ "uniqueflag ::=", - /* 238 */ "eidlist_opt ::=", - /* 239 */ "eidlist_opt ::= LP eidlist RP", - /* 240 */ "eidlist ::= eidlist COMMA nm collate sortorder", - /* 241 */ "eidlist ::= nm collate sortorder", - /* 242 */ "collate ::=", - /* 243 */ "collate ::= COLLATE ID|STRING", - /* 244 */ "cmd ::= DROP INDEX ifexists fullname", - /* 245 */ "cmd ::= VACUUM vinto", - /* 246 */ "cmd ::= VACUUM nm vinto", - /* 247 */ "vinto ::= INTO expr", - /* 248 */ "vinto ::=", - /* 249 */ "cmd ::= PRAGMA nm dbnm", - /* 250 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", - /* 251 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", - /* 252 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", - /* 253 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", - /* 254 */ "plus_num ::= PLUS INTEGER|FLOAT", - /* 255 */ "minus_num ::= MINUS INTEGER|FLOAT", - /* 256 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", - /* 257 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", - /* 258 */ "trigger_time ::= BEFORE|AFTER", - /* 259 */ "trigger_time ::= INSTEAD OF", - /* 260 */ "trigger_time ::=", - /* 261 */ "trigger_event ::= DELETE|INSERT", - /* 262 */ "trigger_event ::= UPDATE", - /* 263 */ "trigger_event ::= UPDATE OF idlist", - /* 264 */ "when_clause ::=", - /* 265 */ "when_clause ::= WHEN expr", - /* 266 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", - /* 267 */ "trigger_cmd_list ::= trigger_cmd SEMI", - /* 268 */ "trnm ::= nm DOT nm", - /* 269 */ "tridxby ::= INDEXED BY nm", - /* 270 */ "tridxby ::= NOT INDEXED", - /* 271 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt", - /* 272 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt", - /* 273 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt", - /* 274 */ "trigger_cmd ::= scanpt select scanpt", - /* 275 */ "expr ::= RAISE LP IGNORE RP", - /* 276 */ "expr ::= RAISE LP raisetype COMMA nm RP", - /* 277 */ "raisetype ::= ROLLBACK", - /* 278 */ "raisetype ::= ABORT", - /* 279 */ "raisetype ::= FAIL", - /* 280 */ "cmd ::= DROP TRIGGER ifexists fullname", - /* 281 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", - /* 282 */ "cmd ::= DETACH database_kw_opt expr", - /* 283 */ "key_opt ::=", - /* 284 */ "key_opt ::= KEY expr", - /* 285 */ "cmd ::= REINDEX", - /* 286 */ "cmd ::= REINDEX nm dbnm", - /* 287 */ "cmd ::= ANALYZE", - /* 288 */ "cmd ::= ANALYZE nm dbnm", - /* 289 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", - /* 290 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", - /* 291 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm", - /* 292 */ "add_column_fullname ::= fullname", - /* 293 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm", - /* 294 */ "cmd ::= create_vtab", - /* 295 */ "cmd ::= create_vtab LP vtabarglist RP", - /* 296 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", - /* 297 */ "vtabarg ::=", - /* 298 */ "vtabargtoken ::= ANY", - /* 299 */ "vtabargtoken ::= lp anylist RP", - /* 300 */ "lp ::= LP", - /* 301 */ "with ::= WITH wqlist", - /* 302 */ "with ::= WITH RECURSIVE wqlist", - /* 303 */ "wqas ::= AS", - /* 304 */ "wqas ::= AS MATERIALIZED", - /* 305 */ "wqas ::= AS NOT MATERIALIZED", - /* 306 */ "wqitem ::= nm eidlist_opt wqas LP select RP", - /* 307 */ "wqlist ::= wqitem", - /* 308 */ "wqlist ::= wqlist COMMA wqitem", - /* 309 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", - /* 310 */ "windowdefn ::= nm AS LP window RP", - /* 311 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt", - /* 312 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt", - /* 313 */ "window ::= ORDER BY sortlist frame_opt", - /* 314 */ "window ::= nm ORDER BY sortlist frame_opt", - /* 315 */ "window ::= nm frame_opt", - /* 316 */ "frame_opt ::=", - /* 317 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt", - /* 318 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt", - /* 319 */ "range_or_rows ::= RANGE|ROWS|GROUPS", - /* 320 */ "frame_bound_s ::= frame_bound", - /* 321 */ "frame_bound_s ::= UNBOUNDED PRECEDING", - /* 322 */ "frame_bound_e ::= frame_bound", - /* 323 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", - /* 324 */ "frame_bound ::= expr PRECEDING|FOLLOWING", - /* 325 */ "frame_bound ::= CURRENT ROW", - /* 326 */ "frame_exclude_opt ::=", - /* 327 */ "frame_exclude_opt ::= EXCLUDE frame_exclude", - /* 328 */ "frame_exclude ::= NO OTHERS", - /* 329 */ "frame_exclude ::= CURRENT ROW", - /* 330 */ "frame_exclude ::= GROUP|TIES", - /* 331 */ "window_clause ::= WINDOW windowdefn_list", - /* 332 */ "filter_over ::= filter_clause over_clause", - /* 333 */ "filter_over ::= over_clause", - /* 334 */ "filter_over ::= filter_clause", - /* 335 */ "over_clause ::= OVER LP window RP", - /* 336 */ "over_clause ::= OVER nm", - /* 337 */ "filter_clause ::= FILTER LP WHERE expr RP", - /* 338 */ "input ::= cmdlist", - /* 339 */ "cmdlist ::= cmdlist ecmd", - /* 340 */ "cmdlist ::= ecmd", - /* 341 */ "ecmd ::= SEMI", - /* 342 */ "ecmd ::= cmdx SEMI", - /* 343 */ "ecmd ::= explain cmdx SEMI", - /* 344 */ "trans_opt ::=", - /* 345 */ "trans_opt ::= TRANSACTION", - /* 346 */ "trans_opt ::= TRANSACTION nm", - /* 347 */ "savepoint_opt ::= SAVEPOINT", - /* 348 */ "savepoint_opt ::=", - /* 349 */ "cmd ::= create_table create_table_args", - /* 350 */ "table_option_set ::= table_option", - /* 351 */ "columnlist ::= columnlist COMMA columnname carglist", - /* 352 */ "columnlist ::= columnname carglist", - /* 353 */ "nm ::= ID|INDEXED|JOIN_KW", - /* 354 */ "nm ::= STRING", - /* 355 */ "typetoken ::= typename", - /* 356 */ "typename ::= ID|STRING", - /* 357 */ "signed ::= plus_num", - /* 358 */ "signed ::= minus_num", - /* 359 */ "carglist ::= carglist ccons", - /* 360 */ "carglist ::=", - /* 361 */ "ccons ::= NULL onconf", - /* 362 */ "ccons ::= GENERATED ALWAYS AS generated", - /* 363 */ "ccons ::= AS generated", - /* 364 */ "conslist_opt ::= COMMA conslist", - /* 365 */ "conslist ::= conslist tconscomma tcons", - /* 366 */ "conslist ::= tcons", - /* 367 */ "tconscomma ::=", - /* 368 */ "defer_subclause_opt ::= defer_subclause", - /* 369 */ "resolvetype ::= raisetype", - /* 370 */ "selectnowith ::= oneselect", - /* 371 */ "oneselect ::= values", - /* 372 */ "sclp ::= selcollist COMMA", - /* 373 */ "as ::= ID|STRING", - /* 374 */ "indexed_opt ::= indexed_by", - /* 375 */ "returning ::=", - /* 376 */ "expr ::= term", - /* 377 */ "likeop ::= LIKE_KW|MATCH", - /* 378 */ "case_operand ::= expr", - /* 379 */ "exprlist ::= nexprlist", - /* 380 */ "nmnum ::= plus_num", - /* 381 */ "nmnum ::= nm", - /* 382 */ "nmnum ::= ON", - /* 383 */ "nmnum ::= DELETE", - /* 384 */ "nmnum ::= DEFAULT", - /* 385 */ "plus_num ::= INTEGER|FLOAT", - /* 386 */ "foreach_clause ::=", - /* 387 */ "foreach_clause ::= FOR EACH ROW", - /* 388 */ "trnm ::= nm", - /* 389 */ "tridxby ::=", - /* 390 */ "database_kw_opt ::= DATABASE", - /* 391 */ "database_kw_opt ::=", - /* 392 */ "kwcolumn_opt ::=", - /* 393 */ "kwcolumn_opt ::= COLUMNKW", - /* 394 */ "vtabarglist ::= vtabarg", - /* 395 */ "vtabarglist ::= vtabarglist COMMA vtabarg", - /* 396 */ "vtabarg ::= vtabarg vtabargtoken", - /* 397 */ "anylist ::=", - /* 398 */ "anylist ::= anylist LP anylist RP", - /* 399 */ "anylist ::= anylist ANY", - /* 400 */ "with ::=", - /* 401 */ "windowdefn_list ::= windowdefn", - /* 402 */ "window ::= frame_opt", + /* 95 */ "oneselect ::= mvalues", + /* 96 */ "mvalues ::= values COMMA LP nexprlist RP", + /* 97 */ "mvalues ::= mvalues COMMA LP nexprlist RP", + /* 98 */ "distinct ::= DISTINCT", + /* 99 */ "distinct ::= ALL", + /* 100 */ "distinct ::=", + /* 101 */ "sclp ::=", + /* 102 */ "selcollist ::= sclp scanpt expr scanpt as", + /* 103 */ "selcollist ::= sclp scanpt STAR", + /* 104 */ "selcollist ::= sclp scanpt nm DOT STAR", + /* 105 */ "as ::= AS nm", + /* 106 */ "as ::=", + /* 107 */ "from ::=", + /* 108 */ "from ::= FROM seltablist", + /* 109 */ "stl_prefix ::= seltablist joinop", + /* 110 */ "stl_prefix ::=", + /* 111 */ "seltablist ::= stl_prefix nm dbnm as on_using", + /* 112 */ "seltablist ::= stl_prefix nm dbnm as indexed_by on_using", + /* 113 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using", + /* 114 */ "seltablist ::= stl_prefix LP select RP as on_using", + /* 115 */ "seltablist ::= stl_prefix LP seltablist RP as on_using", + /* 116 */ "dbnm ::=", + /* 117 */ "dbnm ::= DOT nm", + /* 118 */ "fullname ::= nm", + /* 119 */ "fullname ::= nm DOT nm", + /* 120 */ "xfullname ::= nm", + /* 121 */ "xfullname ::= nm DOT nm", + /* 122 */ "xfullname ::= nm DOT nm AS nm", + /* 123 */ "xfullname ::= nm AS nm", + /* 124 */ "joinop ::= COMMA|JOIN", + /* 125 */ "joinop ::= JOIN_KW JOIN", + /* 126 */ "joinop ::= JOIN_KW nm JOIN", + /* 127 */ "joinop ::= JOIN_KW nm nm JOIN", + /* 128 */ "on_using ::= ON expr", + /* 129 */ "on_using ::= USING LP idlist RP", + /* 130 */ "on_using ::=", + /* 131 */ "indexed_opt ::=", + /* 132 */ "indexed_by ::= INDEXED BY nm", + /* 133 */ "indexed_by ::= NOT INDEXED", + /* 134 */ "orderby_opt ::=", + /* 135 */ "orderby_opt ::= ORDER BY sortlist", + /* 136 */ "sortlist ::= sortlist COMMA expr sortorder nulls", + /* 137 */ "sortlist ::= expr sortorder nulls", + /* 138 */ "sortorder ::= ASC", + /* 139 */ "sortorder ::= DESC", + /* 140 */ "sortorder ::=", + /* 141 */ "nulls ::= NULLS FIRST", + /* 142 */ "nulls ::= NULLS LAST", + /* 143 */ "nulls ::=", + /* 144 */ "groupby_opt ::=", + /* 145 */ "groupby_opt ::= GROUP BY nexprlist", + /* 146 */ "having_opt ::=", + /* 147 */ "having_opt ::= HAVING expr", + /* 148 */ "limit_opt ::=", + /* 149 */ "limit_opt ::= LIMIT expr", + /* 150 */ "limit_opt ::= LIMIT expr OFFSET expr", + /* 151 */ "limit_opt ::= LIMIT expr COMMA expr", + /* 152 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret", + /* 153 */ "where_opt ::=", + /* 154 */ "where_opt ::= WHERE expr", + /* 155 */ "where_opt_ret ::=", + /* 156 */ "where_opt_ret ::= WHERE expr", + /* 157 */ "where_opt_ret ::= RETURNING selcollist", + /* 158 */ "where_opt_ret ::= WHERE expr RETURNING selcollist", + /* 159 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret", + /* 160 */ "setlist ::= setlist COMMA nm EQ expr", + /* 161 */ "setlist ::= setlist COMMA LP idlist RP EQ expr", + /* 162 */ "setlist ::= nm EQ expr", + /* 163 */ "setlist ::= LP idlist RP EQ expr", + /* 164 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert", + /* 165 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning", + /* 166 */ "upsert ::=", + /* 167 */ "upsert ::= RETURNING selcollist", + /* 168 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert", + /* 169 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert", + /* 170 */ "upsert ::= ON CONFLICT DO NOTHING returning", + /* 171 */ "upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning", + /* 172 */ "returning ::= RETURNING selcollist", + /* 173 */ "insert_cmd ::= INSERT orconf", + /* 174 */ "insert_cmd ::= REPLACE", + /* 175 */ "idlist_opt ::=", + /* 176 */ "idlist_opt ::= LP idlist RP", + /* 177 */ "idlist ::= idlist COMMA nm", + /* 178 */ "idlist ::= nm", + /* 179 */ "expr ::= LP expr RP", + /* 180 */ "expr ::= ID|INDEXED|JOIN_KW", + /* 181 */ "expr ::= nm DOT nm", + /* 182 */ "expr ::= nm DOT nm DOT nm", + /* 183 */ "term ::= NULL|FLOAT|BLOB", + /* 184 */ "term ::= STRING", + /* 185 */ "term ::= INTEGER", + /* 186 */ "expr ::= VARIABLE", + /* 187 */ "expr ::= expr COLLATE ID|STRING", + /* 188 */ "expr ::= CAST LP expr AS typetoken RP", + /* 189 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP", + /* 190 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP", + /* 191 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP", + /* 192 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over", + /* 193 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over", + /* 194 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over", + /* 195 */ "term ::= CTIME_KW", + /* 196 */ "expr ::= LP nexprlist COMMA expr RP", + /* 197 */ "expr ::= expr AND expr", + /* 198 */ "expr ::= expr OR expr", + /* 199 */ "expr ::= expr LT|GT|GE|LE expr", + /* 200 */ "expr ::= expr EQ|NE expr", + /* 201 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", + /* 202 */ "expr ::= expr PLUS|MINUS expr", + /* 203 */ "expr ::= expr STAR|SLASH|REM expr", + /* 204 */ "expr ::= expr CONCAT expr", + /* 205 */ "likeop ::= NOT LIKE_KW|MATCH", + /* 206 */ "expr ::= expr likeop expr", + /* 207 */ "expr ::= expr likeop expr ESCAPE expr", + /* 208 */ "expr ::= expr ISNULL|NOTNULL", + /* 209 */ "expr ::= expr NOT NULL", + /* 210 */ "expr ::= expr IS expr", + /* 211 */ "expr ::= expr IS NOT expr", + /* 212 */ "expr ::= expr IS NOT DISTINCT FROM expr", + /* 213 */ "expr ::= expr IS DISTINCT FROM expr", + /* 214 */ "expr ::= NOT expr", + /* 215 */ "expr ::= BITNOT expr", + /* 216 */ "expr ::= PLUS|MINUS expr", + /* 217 */ "expr ::= expr PTR expr", + /* 218 */ "between_op ::= BETWEEN", + /* 219 */ "between_op ::= NOT BETWEEN", + /* 220 */ "expr ::= expr between_op expr AND expr", + /* 221 */ "in_op ::= IN", + /* 222 */ "in_op ::= NOT IN", + /* 223 */ "expr ::= expr in_op LP exprlist RP", + /* 224 */ "expr ::= LP select RP", + /* 225 */ "expr ::= expr in_op LP select RP", + /* 226 */ "expr ::= expr in_op nm dbnm paren_exprlist", + /* 227 */ "expr ::= EXISTS LP select RP", + /* 228 */ "expr ::= CASE case_operand case_exprlist case_else END", + /* 229 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", + /* 230 */ "case_exprlist ::= WHEN expr THEN expr", + /* 231 */ "case_else ::= ELSE expr", + /* 232 */ "case_else ::=", + /* 233 */ "case_operand ::=", + /* 234 */ "exprlist ::=", + /* 235 */ "nexprlist ::= nexprlist COMMA expr", + /* 236 */ "nexprlist ::= expr", + /* 237 */ "paren_exprlist ::=", + /* 238 */ "paren_exprlist ::= LP exprlist RP", + /* 239 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", + /* 240 */ "uniqueflag ::= UNIQUE", + /* 241 */ "uniqueflag ::=", + /* 242 */ "eidlist_opt ::=", + /* 243 */ "eidlist_opt ::= LP eidlist RP", + /* 244 */ "eidlist ::= eidlist COMMA nm collate sortorder", + /* 245 */ "eidlist ::= nm collate sortorder", + /* 246 */ "collate ::=", + /* 247 */ "collate ::= COLLATE ID|STRING", + /* 248 */ "cmd ::= DROP INDEX ifexists fullname", + /* 249 */ "cmd ::= VACUUM vinto", + /* 250 */ "cmd ::= VACUUM nm vinto", + /* 251 */ "vinto ::= INTO expr", + /* 252 */ "vinto ::=", + /* 253 */ "cmd ::= PRAGMA nm dbnm", + /* 254 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", + /* 255 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", + /* 256 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", + /* 257 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", + /* 258 */ "plus_num ::= PLUS INTEGER|FLOAT", + /* 259 */ "minus_num ::= MINUS INTEGER|FLOAT", + /* 260 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", + /* 261 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", + /* 262 */ "trigger_time ::= BEFORE|AFTER", + /* 263 */ "trigger_time ::= INSTEAD OF", + /* 264 */ "trigger_time ::=", + /* 265 */ "trigger_event ::= DELETE|INSERT", + /* 266 */ "trigger_event ::= UPDATE", + /* 267 */ "trigger_event ::= UPDATE OF idlist", + /* 268 */ "when_clause ::=", + /* 269 */ "when_clause ::= WHEN expr", + /* 270 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", + /* 271 */ "trigger_cmd_list ::= trigger_cmd SEMI", + /* 272 */ "trnm ::= nm DOT nm", + /* 273 */ "tridxby ::= INDEXED BY nm", + /* 274 */ "tridxby ::= NOT INDEXED", + /* 275 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt", + /* 276 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt", + /* 277 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt", + /* 278 */ "trigger_cmd ::= scanpt select scanpt", + /* 279 */ "expr ::= RAISE LP IGNORE RP", + /* 280 */ "expr ::= RAISE LP raisetype COMMA nm RP", + /* 281 */ "raisetype ::= ROLLBACK", + /* 282 */ "raisetype ::= ABORT", + /* 283 */ "raisetype ::= FAIL", + /* 284 */ "cmd ::= DROP TRIGGER ifexists fullname", + /* 285 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", + /* 286 */ "cmd ::= DETACH database_kw_opt expr", + /* 287 */ "key_opt ::=", + /* 288 */ "key_opt ::= KEY expr", + /* 289 */ "cmd ::= REINDEX", + /* 290 */ "cmd ::= REINDEX nm dbnm", + /* 291 */ "cmd ::= ANALYZE", + /* 292 */ "cmd ::= ANALYZE nm dbnm", + /* 293 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", + /* 294 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", + /* 295 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm", + /* 296 */ "add_column_fullname ::= fullname", + /* 297 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm", + /* 298 */ "cmd ::= create_vtab", + /* 299 */ "cmd ::= create_vtab LP vtabarglist RP", + /* 300 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", + /* 301 */ "vtabarg ::=", + /* 302 */ "vtabargtoken ::= ANY", + /* 303 */ "vtabargtoken ::= lp anylist RP", + /* 304 */ "lp ::= LP", + /* 305 */ "with ::= WITH wqlist", + /* 306 */ "with ::= WITH RECURSIVE wqlist", + /* 307 */ "wqas ::= AS", + /* 308 */ "wqas ::= AS MATERIALIZED", + /* 309 */ "wqas ::= AS NOT MATERIALIZED", + /* 310 */ "wqitem ::= withnm eidlist_opt wqas LP select RP", + /* 311 */ "withnm ::= nm", + /* 312 */ "wqlist ::= wqitem", + /* 313 */ "wqlist ::= wqlist COMMA wqitem", + /* 314 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", + /* 315 */ "windowdefn ::= nm AS LP window RP", + /* 316 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt", + /* 317 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt", + /* 318 */ "window ::= ORDER BY sortlist frame_opt", + /* 319 */ "window ::= nm ORDER BY sortlist frame_opt", + /* 320 */ "window ::= nm frame_opt", + /* 321 */ "frame_opt ::=", + /* 322 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt", + /* 323 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt", + /* 324 */ "range_or_rows ::= RANGE|ROWS|GROUPS", + /* 325 */ "frame_bound_s ::= frame_bound", + /* 326 */ "frame_bound_s ::= UNBOUNDED PRECEDING", + /* 327 */ "frame_bound_e ::= frame_bound", + /* 328 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", + /* 329 */ "frame_bound ::= expr PRECEDING|FOLLOWING", + /* 330 */ "frame_bound ::= CURRENT ROW", + /* 331 */ "frame_exclude_opt ::=", + /* 332 */ "frame_exclude_opt ::= EXCLUDE frame_exclude", + /* 333 */ "frame_exclude ::= NO OTHERS", + /* 334 */ "frame_exclude ::= CURRENT ROW", + /* 335 */ "frame_exclude ::= GROUP|TIES", + /* 336 */ "window_clause ::= WINDOW windowdefn_list", + /* 337 */ "filter_over ::= filter_clause over_clause", + /* 338 */ "filter_over ::= over_clause", + /* 339 */ "filter_over ::= filter_clause", + /* 340 */ "over_clause ::= OVER LP window RP", + /* 341 */ "over_clause ::= OVER nm", + /* 342 */ "filter_clause ::= FILTER LP WHERE expr RP", + /* 343 */ "term ::= QNUMBER", + /* 344 */ "input ::= cmdlist", + /* 345 */ "cmdlist ::= cmdlist ecmd", + /* 346 */ "cmdlist ::= ecmd", + /* 347 */ "ecmd ::= SEMI", + /* 348 */ "ecmd ::= cmdx SEMI", + /* 349 */ "ecmd ::= explain cmdx SEMI", + /* 350 */ "trans_opt ::=", + /* 351 */ "trans_opt ::= TRANSACTION", + /* 352 */ "trans_opt ::= TRANSACTION nm", + /* 353 */ "savepoint_opt ::= SAVEPOINT", + /* 354 */ "savepoint_opt ::=", + /* 355 */ "cmd ::= create_table create_table_args", + /* 356 */ "table_option_set ::= table_option", + /* 357 */ "columnlist ::= columnlist COMMA columnname carglist", + /* 358 */ "columnlist ::= columnname carglist", + /* 359 */ "nm ::= ID|INDEXED|JOIN_KW", + /* 360 */ "nm ::= STRING", + /* 361 */ "typetoken ::= typename", + /* 362 */ "typename ::= ID|STRING", + /* 363 */ "signed ::= plus_num", + /* 364 */ "signed ::= minus_num", + /* 365 */ "carglist ::= carglist ccons", + /* 366 */ "carglist ::=", + /* 367 */ "ccons ::= NULL onconf", + /* 368 */ "ccons ::= GENERATED ALWAYS AS generated", + /* 369 */ "ccons ::= AS generated", + /* 370 */ "conslist_opt ::= COMMA conslist", + /* 371 */ "conslist ::= conslist tconscomma tcons", + /* 372 */ "conslist ::= tcons", + /* 373 */ "tconscomma ::=", + /* 374 */ "defer_subclause_opt ::= defer_subclause", + /* 375 */ "resolvetype ::= raisetype", + /* 376 */ "selectnowith ::= oneselect", + /* 377 */ "oneselect ::= values", + /* 378 */ "sclp ::= selcollist COMMA", + /* 379 */ "as ::= ID|STRING", + /* 380 */ "indexed_opt ::= indexed_by", + /* 381 */ "returning ::=", + /* 382 */ "expr ::= term", + /* 383 */ "likeop ::= LIKE_KW|MATCH", + /* 384 */ "case_operand ::= expr", + /* 385 */ "exprlist ::= nexprlist", + /* 386 */ "nmnum ::= plus_num", + /* 387 */ "nmnum ::= nm", + /* 388 */ "nmnum ::= ON", + /* 389 */ "nmnum ::= DELETE", + /* 390 */ "nmnum ::= DEFAULT", + /* 391 */ "plus_num ::= INTEGER|FLOAT", + /* 392 */ "foreach_clause ::=", + /* 393 */ "foreach_clause ::= FOR EACH ROW", + /* 394 */ "trnm ::= nm", + /* 395 */ "tridxby ::=", + /* 396 */ "database_kw_opt ::= DATABASE", + /* 397 */ "database_kw_opt ::=", + /* 398 */ "kwcolumn_opt ::=", + /* 399 */ "kwcolumn_opt ::= COLUMNKW", + /* 400 */ "vtabarglist ::= vtabarg", + /* 401 */ "vtabarglist ::= vtabarglist COMMA vtabarg", + /* 402 */ "vtabarg ::= vtabarg vtabargtoken", + /* 403 */ "anylist ::=", + /* 404 */ "anylist ::= anylist LP anylist RP", + /* 405 */ "anylist ::= anylist ANY", + /* 406 */ "with ::=", + /* 407 */ "windowdefn_list ::= windowdefn", + /* 408 */ "window ::= frame_opt", }; #endif /* NDEBUG */ -#if YYSTACKDEPTH<=0 +#if YYGROWABLESTACK /* ** Try to increase the size of the parser stack. Return the number ** of errors. Return 0 on success. */ static int yyGrowStack(yyParser *p){ + int oldSize = 1 + (int)(p->yystackEnd - p->yystack); int newSize; int idx; yyStackEntry *pNew; - newSize = p->yystksz*2 + 100; - idx = p->yytos ? (int)(p->yytos - p->yystack) : 0; - if( p->yystack==&p->yystk0 ){ - pNew = malloc(newSize*sizeof(pNew[0])); - if( pNew ) pNew[0] = p->yystk0; + newSize = oldSize*2 + 100; + idx = (int)(p->yytos - p->yystack); + if( p->yystack==p->yystk0 ){ + pNew = YYREALLOC(0, newSize*sizeof(pNew[0])); + if( pNew==0 ) return 1; + memcpy(pNew, p->yystack, oldSize*sizeof(pNew[0])); }else{ - pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); + pNew = YYREALLOC(p->yystack, newSize*sizeof(pNew[0])); + if( pNew==0 ) return 1; } - if( pNew ){ - p->yystack = pNew; - p->yytos = &p->yystack[idx]; + p->yystack = pNew; + p->yytos = &p->yystack[idx]; #ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", - yyTracePrompt, p->yystksz, newSize); - } -#endif - p->yystksz = newSize; + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", + yyTracePrompt, oldSize, newSize); } - return pNew==0; +#endif + p->yystackEnd = &p->yystack[newSize-1]; + return 0; } +#endif /* YYGROWABLESTACK */ + +#if !YYGROWABLESTACK +/* For builds that do no have a growable stack, yyGrowStack always +** returns an error. +*/ +# define yyGrowStack(X) 1 #endif /* Datatype of the argument to the memory allocated passed as the @@ -171498,24 +174798,14 @@ SQLITE_PRIVATE void sqlite3ParserInit(void *yypRawParser sqlite3ParserCTX_PDECL) #ifdef YYTRACKMAXSTACKDEPTH yypParser->yyhwm = 0; #endif -#if YYSTACKDEPTH<=0 - yypParser->yytos = NULL; - yypParser->yystack = NULL; - yypParser->yystksz = 0; - if( yyGrowStack(yypParser) ){ - yypParser->yystack = &yypParser->yystk0; - yypParser->yystksz = 1; - } -#endif + yypParser->yystack = yypParser->yystk0; + yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt = -1; #endif yypParser->yytos = yypParser->yystack; yypParser->yystack[0].stateno = 0; yypParser->yystack[0].major = 0; -#if YYSTACKDEPTH>0 - yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; -#endif } #ifndef sqlite3Parser_ENGINEALWAYSONSTACK @@ -171569,97 +174859,98 @@ static void yy_destructor( ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case 204: /* select */ - case 239: /* selectnowith */ - case 240: /* oneselect */ - case 252: /* values */ + case 205: /* select */ + case 240: /* selectnowith */ + case 241: /* oneselect */ + case 253: /* values */ + case 255: /* mvalues */ { -sqlite3SelectDelete(pParse->db, (yypminor->yy47)); -} - break; - case 216: /* term */ - case 217: /* expr */ - case 246: /* where_opt */ - case 248: /* having_opt */ - case 267: /* where_opt_ret */ - case 278: /* case_operand */ - case 280: /* case_else */ - case 283: /* vinto */ - case 290: /* when_clause */ - case 295: /* key_opt */ - case 311: /* filter_clause */ +sqlite3SelectDelete(pParse->db, (yypminor->yy555)); +} + break; + case 217: /* term */ + case 218: /* expr */ + case 247: /* where_opt */ + case 249: /* having_opt */ + case 269: /* where_opt_ret */ + case 280: /* case_operand */ + case 282: /* case_else */ + case 285: /* vinto */ + case 292: /* when_clause */ + case 297: /* key_opt */ + case 314: /* filter_clause */ { -sqlite3ExprDelete(pParse->db, (yypminor->yy528)); -} - break; - case 221: /* eidlist_opt */ - case 231: /* sortlist */ - case 232: /* eidlist */ - case 244: /* selcollist */ - case 247: /* groupby_opt */ - case 249: /* orderby_opt */ - case 253: /* nexprlist */ - case 254: /* sclp */ - case 261: /* exprlist */ - case 268: /* setlist */ - case 277: /* paren_exprlist */ - case 279: /* case_exprlist */ - case 310: /* part_opt */ +sqlite3ExprDelete(pParse->db, (yypminor->yy454)); +} + break; + case 222: /* eidlist_opt */ + case 232: /* sortlist */ + case 233: /* eidlist */ + case 245: /* selcollist */ + case 248: /* groupby_opt */ + case 250: /* orderby_opt */ + case 254: /* nexprlist */ + case 256: /* sclp */ + case 263: /* exprlist */ + case 270: /* setlist */ + case 279: /* paren_exprlist */ + case 281: /* case_exprlist */ + case 313: /* part_opt */ { -sqlite3ExprListDelete(pParse->db, (yypminor->yy322)); +sqlite3ExprListDelete(pParse->db, (yypminor->yy14)); } break; - case 238: /* fullname */ - case 245: /* from */ - case 256: /* seltablist */ - case 257: /* stl_prefix */ - case 262: /* xfullname */ + case 239: /* fullname */ + case 246: /* from */ + case 258: /* seltablist */ + case 259: /* stl_prefix */ + case 264: /* xfullname */ { -sqlite3SrcListDelete(pParse->db, (yypminor->yy131)); +sqlite3SrcListDelete(pParse->db, (yypminor->yy203)); } break; - case 241: /* wqlist */ + case 242: /* wqlist */ { -sqlite3WithDelete(pParse->db, (yypminor->yy521)); +sqlite3WithDelete(pParse->db, (yypminor->yy59)); } break; - case 251: /* window_clause */ - case 306: /* windowdefn_list */ + case 252: /* window_clause */ + case 309: /* windowdefn_list */ { -sqlite3WindowListDelete(pParse->db, (yypminor->yy41)); +sqlite3WindowListDelete(pParse->db, (yypminor->yy211)); } break; - case 263: /* idlist */ - case 270: /* idlist_opt */ + case 265: /* idlist */ + case 272: /* idlist_opt */ { -sqlite3IdListDelete(pParse->db, (yypminor->yy254)); +sqlite3IdListDelete(pParse->db, (yypminor->yy132)); } break; - case 273: /* filter_over */ - case 307: /* windowdefn */ - case 308: /* window */ - case 309: /* frame_opt */ - case 312: /* over_clause */ + case 275: /* filter_over */ + case 310: /* windowdefn */ + case 311: /* window */ + case 312: /* frame_opt */ + case 315: /* over_clause */ { -sqlite3WindowDelete(pParse->db, (yypminor->yy41)); +sqlite3WindowDelete(pParse->db, (yypminor->yy211)); } break; - case 286: /* trigger_cmd_list */ - case 291: /* trigger_cmd */ + case 288: /* trigger_cmd_list */ + case 293: /* trigger_cmd */ { -sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy33)); +sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy427)); } break; - case 288: /* trigger_event */ + case 290: /* trigger_event */ { -sqlite3IdListDelete(pParse->db, (yypminor->yy180).b); +sqlite3IdListDelete(pParse->db, (yypminor->yy286).b); } break; - case 314: /* frame_bound */ - case 315: /* frame_bound_s */ - case 316: /* frame_bound_e */ + case 317: /* frame_bound */ + case 318: /* frame_bound_s */ + case 319: /* frame_bound_e */ { -sqlite3ExprDelete(pParse->db, (yypminor->yy595).pExpr); +sqlite3ExprDelete(pParse->db, (yypminor->yy509).pExpr); } break; /********* End destructor definitions *****************************************/ @@ -171693,9 +174984,26 @@ static void yy_pop_parser_stack(yyParser *pParser){ */ SQLITE_PRIVATE void sqlite3ParserFinalize(void *p){ yyParser *pParser = (yyParser*)p; - while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser); -#if YYSTACKDEPTH<=0 - if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack); + + /* In-lined version of calling yy_pop_parser_stack() for each + ** element left in the stack */ + yyStackEntry *yytos = pParser->yytos; + while( yytos>pParser->yystack ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sPopping %s\n", + yyTracePrompt, + yyTokenName[yytos->major]); + } +#endif + if( yytos->major>=YY_MIN_DSTRCTR ){ + yy_destructor(pParser, yytos->major, &yytos->minor); + } + yytos--; + } + +#if YYGROWABLESTACK + if( pParser->yystack!=pParser->yystk0 ) YYFREE(pParser->yystack); #endif } @@ -171878,7 +175186,7 @@ static void yyStackOverflow(yyParser *yypParser){ ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ - sqlite3ErrorMsg(pParse, "parser stack overflow"); + sqlite3OomFault(pParse->db); /******** End %stack_overflow code ********************************************/ sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument var */ sqlite3ParserCTX_STORE @@ -171922,25 +175230,19 @@ static void yy_shift( assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); } #endif -#if YYSTACKDEPTH>0 - if( yypParser->yytos>yypParser->yystackEnd ){ - yypParser->yytos--; - yyStackOverflow(yypParser); - return; - } -#else - if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){ + yytos = yypParser->yytos; + if( yytos>yypParser->yystackEnd ){ if( yyGrowStack(yypParser) ){ yypParser->yytos--; yyStackOverflow(yypParser); return; } + yytos = yypParser->yytos; + assert( yytos <= yypParser->yystackEnd ); } -#endif if( yyNewState > YY_MAX_SHIFT ){ yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; } - yytos = yypParser->yytos; yytos->stateno = yyNewState; yytos->major = yyMajor; yytos->minor.yy0 = yyMinor; @@ -171950,409 +175252,415 @@ static void yy_shift( /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side ** of that rule */ static const YYCODETYPE yyRuleInfoLhs[] = { - 189, /* (0) explain ::= EXPLAIN */ - 189, /* (1) explain ::= EXPLAIN QUERY PLAN */ - 188, /* (2) cmdx ::= cmd */ - 190, /* (3) cmd ::= BEGIN transtype trans_opt */ - 191, /* (4) transtype ::= */ - 191, /* (5) transtype ::= DEFERRED */ - 191, /* (6) transtype ::= IMMEDIATE */ - 191, /* (7) transtype ::= EXCLUSIVE */ - 190, /* (8) cmd ::= COMMIT|END trans_opt */ - 190, /* (9) cmd ::= ROLLBACK trans_opt */ - 190, /* (10) cmd ::= SAVEPOINT nm */ - 190, /* (11) cmd ::= RELEASE savepoint_opt nm */ - 190, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ - 195, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */ - 197, /* (14) createkw ::= CREATE */ - 199, /* (15) ifnotexists ::= */ - 199, /* (16) ifnotexists ::= IF NOT EXISTS */ - 198, /* (17) temp ::= TEMP */ - 198, /* (18) temp ::= */ - 196, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_option_set */ - 196, /* (20) create_table_args ::= AS select */ - 203, /* (21) table_option_set ::= */ - 203, /* (22) table_option_set ::= table_option_set COMMA table_option */ - 205, /* (23) table_option ::= WITHOUT nm */ - 205, /* (24) table_option ::= nm */ - 206, /* (25) columnname ::= nm typetoken */ - 208, /* (26) typetoken ::= */ - 208, /* (27) typetoken ::= typename LP signed RP */ - 208, /* (28) typetoken ::= typename LP signed COMMA signed RP */ - 209, /* (29) typename ::= typename ID|STRING */ - 213, /* (30) scanpt ::= */ - 214, /* (31) scantok ::= */ - 215, /* (32) ccons ::= CONSTRAINT nm */ - 215, /* (33) ccons ::= DEFAULT scantok term */ - 215, /* (34) ccons ::= DEFAULT LP expr RP */ - 215, /* (35) ccons ::= DEFAULT PLUS scantok term */ - 215, /* (36) ccons ::= DEFAULT MINUS scantok term */ - 215, /* (37) ccons ::= DEFAULT scantok ID|INDEXED */ - 215, /* (38) ccons ::= NOT NULL onconf */ - 215, /* (39) ccons ::= PRIMARY KEY sortorder onconf autoinc */ - 215, /* (40) ccons ::= UNIQUE onconf */ - 215, /* (41) ccons ::= CHECK LP expr RP */ - 215, /* (42) ccons ::= REFERENCES nm eidlist_opt refargs */ - 215, /* (43) ccons ::= defer_subclause */ - 215, /* (44) ccons ::= COLLATE ID|STRING */ - 224, /* (45) generated ::= LP expr RP */ - 224, /* (46) generated ::= LP expr RP ID */ - 220, /* (47) autoinc ::= */ - 220, /* (48) autoinc ::= AUTOINCR */ - 222, /* (49) refargs ::= */ - 222, /* (50) refargs ::= refargs refarg */ - 225, /* (51) refarg ::= MATCH nm */ - 225, /* (52) refarg ::= ON INSERT refact */ - 225, /* (53) refarg ::= ON DELETE refact */ - 225, /* (54) refarg ::= ON UPDATE refact */ - 226, /* (55) refact ::= SET NULL */ - 226, /* (56) refact ::= SET DEFAULT */ - 226, /* (57) refact ::= CASCADE */ - 226, /* (58) refact ::= RESTRICT */ - 226, /* (59) refact ::= NO ACTION */ - 223, /* (60) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ - 223, /* (61) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ - 227, /* (62) init_deferred_pred_opt ::= */ - 227, /* (63) init_deferred_pred_opt ::= INITIALLY DEFERRED */ - 227, /* (64) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ - 202, /* (65) conslist_opt ::= */ - 229, /* (66) tconscomma ::= COMMA */ - 230, /* (67) tcons ::= CONSTRAINT nm */ - 230, /* (68) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ - 230, /* (69) tcons ::= UNIQUE LP sortlist RP onconf */ - 230, /* (70) tcons ::= CHECK LP expr RP onconf */ - 230, /* (71) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ - 233, /* (72) defer_subclause_opt ::= */ - 218, /* (73) onconf ::= */ - 218, /* (74) onconf ::= ON CONFLICT resolvetype */ - 234, /* (75) orconf ::= */ - 234, /* (76) orconf ::= OR resolvetype */ - 235, /* (77) resolvetype ::= IGNORE */ - 235, /* (78) resolvetype ::= REPLACE */ - 190, /* (79) cmd ::= DROP TABLE ifexists fullname */ - 237, /* (80) ifexists ::= IF EXISTS */ - 237, /* (81) ifexists ::= */ - 190, /* (82) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ - 190, /* (83) cmd ::= DROP VIEW ifexists fullname */ - 190, /* (84) cmd ::= select */ - 204, /* (85) select ::= WITH wqlist selectnowith */ - 204, /* (86) select ::= WITH RECURSIVE wqlist selectnowith */ - 204, /* (87) select ::= selectnowith */ - 239, /* (88) selectnowith ::= selectnowith multiselect_op oneselect */ - 242, /* (89) multiselect_op ::= UNION */ - 242, /* (90) multiselect_op ::= UNION ALL */ - 242, /* (91) multiselect_op ::= EXCEPT|INTERSECT */ - 240, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ - 240, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ - 252, /* (94) values ::= VALUES LP nexprlist RP */ - 252, /* (95) values ::= values COMMA LP nexprlist RP */ - 243, /* (96) distinct ::= DISTINCT */ - 243, /* (97) distinct ::= ALL */ - 243, /* (98) distinct ::= */ - 254, /* (99) sclp ::= */ - 244, /* (100) selcollist ::= sclp scanpt expr scanpt as */ - 244, /* (101) selcollist ::= sclp scanpt STAR */ - 244, /* (102) selcollist ::= sclp scanpt nm DOT STAR */ - 255, /* (103) as ::= AS nm */ - 255, /* (104) as ::= */ - 245, /* (105) from ::= */ - 245, /* (106) from ::= FROM seltablist */ - 257, /* (107) stl_prefix ::= seltablist joinop */ - 257, /* (108) stl_prefix ::= */ - 256, /* (109) seltablist ::= stl_prefix nm dbnm as on_using */ - 256, /* (110) seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ - 256, /* (111) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ - 256, /* (112) seltablist ::= stl_prefix LP select RP as on_using */ - 256, /* (113) seltablist ::= stl_prefix LP seltablist RP as on_using */ - 200, /* (114) dbnm ::= */ - 200, /* (115) dbnm ::= DOT nm */ - 238, /* (116) fullname ::= nm */ - 238, /* (117) fullname ::= nm DOT nm */ - 262, /* (118) xfullname ::= nm */ - 262, /* (119) xfullname ::= nm DOT nm */ - 262, /* (120) xfullname ::= nm DOT nm AS nm */ - 262, /* (121) xfullname ::= nm AS nm */ - 258, /* (122) joinop ::= COMMA|JOIN */ - 258, /* (123) joinop ::= JOIN_KW JOIN */ - 258, /* (124) joinop ::= JOIN_KW nm JOIN */ - 258, /* (125) joinop ::= JOIN_KW nm nm JOIN */ - 259, /* (126) on_using ::= ON expr */ - 259, /* (127) on_using ::= USING LP idlist RP */ - 259, /* (128) on_using ::= */ - 264, /* (129) indexed_opt ::= */ - 260, /* (130) indexed_by ::= INDEXED BY nm */ - 260, /* (131) indexed_by ::= NOT INDEXED */ - 249, /* (132) orderby_opt ::= */ - 249, /* (133) orderby_opt ::= ORDER BY sortlist */ - 231, /* (134) sortlist ::= sortlist COMMA expr sortorder nulls */ - 231, /* (135) sortlist ::= expr sortorder nulls */ - 219, /* (136) sortorder ::= ASC */ - 219, /* (137) sortorder ::= DESC */ - 219, /* (138) sortorder ::= */ - 265, /* (139) nulls ::= NULLS FIRST */ - 265, /* (140) nulls ::= NULLS LAST */ - 265, /* (141) nulls ::= */ - 247, /* (142) groupby_opt ::= */ - 247, /* (143) groupby_opt ::= GROUP BY nexprlist */ - 248, /* (144) having_opt ::= */ - 248, /* (145) having_opt ::= HAVING expr */ - 250, /* (146) limit_opt ::= */ - 250, /* (147) limit_opt ::= LIMIT expr */ - 250, /* (148) limit_opt ::= LIMIT expr OFFSET expr */ - 250, /* (149) limit_opt ::= LIMIT expr COMMA expr */ - 190, /* (150) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ - 246, /* (151) where_opt ::= */ - 246, /* (152) where_opt ::= WHERE expr */ - 267, /* (153) where_opt_ret ::= */ - 267, /* (154) where_opt_ret ::= WHERE expr */ - 267, /* (155) where_opt_ret ::= RETURNING selcollist */ - 267, /* (156) where_opt_ret ::= WHERE expr RETURNING selcollist */ - 190, /* (157) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ - 268, /* (158) setlist ::= setlist COMMA nm EQ expr */ - 268, /* (159) setlist ::= setlist COMMA LP idlist RP EQ expr */ - 268, /* (160) setlist ::= nm EQ expr */ - 268, /* (161) setlist ::= LP idlist RP EQ expr */ - 190, /* (162) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ - 190, /* (163) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ - 271, /* (164) upsert ::= */ - 271, /* (165) upsert ::= RETURNING selcollist */ - 271, /* (166) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ - 271, /* (167) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ - 271, /* (168) upsert ::= ON CONFLICT DO NOTHING returning */ - 271, /* (169) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ - 272, /* (170) returning ::= RETURNING selcollist */ - 269, /* (171) insert_cmd ::= INSERT orconf */ - 269, /* (172) insert_cmd ::= REPLACE */ - 270, /* (173) idlist_opt ::= */ - 270, /* (174) idlist_opt ::= LP idlist RP */ - 263, /* (175) idlist ::= idlist COMMA nm */ - 263, /* (176) idlist ::= nm */ - 217, /* (177) expr ::= LP expr RP */ - 217, /* (178) expr ::= ID|INDEXED|JOIN_KW */ - 217, /* (179) expr ::= nm DOT nm */ - 217, /* (180) expr ::= nm DOT nm DOT nm */ - 216, /* (181) term ::= NULL|FLOAT|BLOB */ - 216, /* (182) term ::= STRING */ - 216, /* (183) term ::= INTEGER */ - 217, /* (184) expr ::= VARIABLE */ - 217, /* (185) expr ::= expr COLLATE ID|STRING */ - 217, /* (186) expr ::= CAST LP expr AS typetoken RP */ - 217, /* (187) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ - 217, /* (188) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ - 217, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ - 217, /* (190) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ - 216, /* (191) term ::= CTIME_KW */ - 217, /* (192) expr ::= LP nexprlist COMMA expr RP */ - 217, /* (193) expr ::= expr AND expr */ - 217, /* (194) expr ::= expr OR expr */ - 217, /* (195) expr ::= expr LT|GT|GE|LE expr */ - 217, /* (196) expr ::= expr EQ|NE expr */ - 217, /* (197) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ - 217, /* (198) expr ::= expr PLUS|MINUS expr */ - 217, /* (199) expr ::= expr STAR|SLASH|REM expr */ - 217, /* (200) expr ::= expr CONCAT expr */ - 274, /* (201) likeop ::= NOT LIKE_KW|MATCH */ - 217, /* (202) expr ::= expr likeop expr */ - 217, /* (203) expr ::= expr likeop expr ESCAPE expr */ - 217, /* (204) expr ::= expr ISNULL|NOTNULL */ - 217, /* (205) expr ::= expr NOT NULL */ - 217, /* (206) expr ::= expr IS expr */ - 217, /* (207) expr ::= expr IS NOT expr */ - 217, /* (208) expr ::= expr IS NOT DISTINCT FROM expr */ - 217, /* (209) expr ::= expr IS DISTINCT FROM expr */ - 217, /* (210) expr ::= NOT expr */ - 217, /* (211) expr ::= BITNOT expr */ - 217, /* (212) expr ::= PLUS|MINUS expr */ - 217, /* (213) expr ::= expr PTR expr */ - 275, /* (214) between_op ::= BETWEEN */ - 275, /* (215) between_op ::= NOT BETWEEN */ - 217, /* (216) expr ::= expr between_op expr AND expr */ - 276, /* (217) in_op ::= IN */ - 276, /* (218) in_op ::= NOT IN */ - 217, /* (219) expr ::= expr in_op LP exprlist RP */ - 217, /* (220) expr ::= LP select RP */ - 217, /* (221) expr ::= expr in_op LP select RP */ - 217, /* (222) expr ::= expr in_op nm dbnm paren_exprlist */ - 217, /* (223) expr ::= EXISTS LP select RP */ - 217, /* (224) expr ::= CASE case_operand case_exprlist case_else END */ - 279, /* (225) case_exprlist ::= case_exprlist WHEN expr THEN expr */ - 279, /* (226) case_exprlist ::= WHEN expr THEN expr */ - 280, /* (227) case_else ::= ELSE expr */ - 280, /* (228) case_else ::= */ - 278, /* (229) case_operand ::= */ - 261, /* (230) exprlist ::= */ - 253, /* (231) nexprlist ::= nexprlist COMMA expr */ - 253, /* (232) nexprlist ::= expr */ - 277, /* (233) paren_exprlist ::= */ - 277, /* (234) paren_exprlist ::= LP exprlist RP */ - 190, /* (235) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ - 281, /* (236) uniqueflag ::= UNIQUE */ - 281, /* (237) uniqueflag ::= */ - 221, /* (238) eidlist_opt ::= */ - 221, /* (239) eidlist_opt ::= LP eidlist RP */ - 232, /* (240) eidlist ::= eidlist COMMA nm collate sortorder */ - 232, /* (241) eidlist ::= nm collate sortorder */ - 282, /* (242) collate ::= */ - 282, /* (243) collate ::= COLLATE ID|STRING */ - 190, /* (244) cmd ::= DROP INDEX ifexists fullname */ - 190, /* (245) cmd ::= VACUUM vinto */ - 190, /* (246) cmd ::= VACUUM nm vinto */ - 283, /* (247) vinto ::= INTO expr */ - 283, /* (248) vinto ::= */ - 190, /* (249) cmd ::= PRAGMA nm dbnm */ - 190, /* (250) cmd ::= PRAGMA nm dbnm EQ nmnum */ - 190, /* (251) cmd ::= PRAGMA nm dbnm LP nmnum RP */ - 190, /* (252) cmd ::= PRAGMA nm dbnm EQ minus_num */ - 190, /* (253) cmd ::= PRAGMA nm dbnm LP minus_num RP */ - 211, /* (254) plus_num ::= PLUS INTEGER|FLOAT */ - 212, /* (255) minus_num ::= MINUS INTEGER|FLOAT */ - 190, /* (256) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ - 285, /* (257) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ - 287, /* (258) trigger_time ::= BEFORE|AFTER */ - 287, /* (259) trigger_time ::= INSTEAD OF */ - 287, /* (260) trigger_time ::= */ - 288, /* (261) trigger_event ::= DELETE|INSERT */ - 288, /* (262) trigger_event ::= UPDATE */ - 288, /* (263) trigger_event ::= UPDATE OF idlist */ - 290, /* (264) when_clause ::= */ - 290, /* (265) when_clause ::= WHEN expr */ - 286, /* (266) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ - 286, /* (267) trigger_cmd_list ::= trigger_cmd SEMI */ - 292, /* (268) trnm ::= nm DOT nm */ - 293, /* (269) tridxby ::= INDEXED BY nm */ - 293, /* (270) tridxby ::= NOT INDEXED */ - 291, /* (271) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ - 291, /* (272) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ - 291, /* (273) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ - 291, /* (274) trigger_cmd ::= scanpt select scanpt */ - 217, /* (275) expr ::= RAISE LP IGNORE RP */ - 217, /* (276) expr ::= RAISE LP raisetype COMMA nm RP */ - 236, /* (277) raisetype ::= ROLLBACK */ - 236, /* (278) raisetype ::= ABORT */ - 236, /* (279) raisetype ::= FAIL */ - 190, /* (280) cmd ::= DROP TRIGGER ifexists fullname */ - 190, /* (281) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ - 190, /* (282) cmd ::= DETACH database_kw_opt expr */ - 295, /* (283) key_opt ::= */ - 295, /* (284) key_opt ::= KEY expr */ - 190, /* (285) cmd ::= REINDEX */ - 190, /* (286) cmd ::= REINDEX nm dbnm */ - 190, /* (287) cmd ::= ANALYZE */ - 190, /* (288) cmd ::= ANALYZE nm dbnm */ - 190, /* (289) cmd ::= ALTER TABLE fullname RENAME TO nm */ - 190, /* (290) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ - 190, /* (291) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ - 296, /* (292) add_column_fullname ::= fullname */ - 190, /* (293) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ - 190, /* (294) cmd ::= create_vtab */ - 190, /* (295) cmd ::= create_vtab LP vtabarglist RP */ - 298, /* (296) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ - 300, /* (297) vtabarg ::= */ - 301, /* (298) vtabargtoken ::= ANY */ - 301, /* (299) vtabargtoken ::= lp anylist RP */ - 302, /* (300) lp ::= LP */ - 266, /* (301) with ::= WITH wqlist */ - 266, /* (302) with ::= WITH RECURSIVE wqlist */ - 305, /* (303) wqas ::= AS */ - 305, /* (304) wqas ::= AS MATERIALIZED */ - 305, /* (305) wqas ::= AS NOT MATERIALIZED */ - 304, /* (306) wqitem ::= nm eidlist_opt wqas LP select RP */ - 241, /* (307) wqlist ::= wqitem */ - 241, /* (308) wqlist ::= wqlist COMMA wqitem */ - 306, /* (309) windowdefn_list ::= windowdefn_list COMMA windowdefn */ - 307, /* (310) windowdefn ::= nm AS LP window RP */ - 308, /* (311) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ - 308, /* (312) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ - 308, /* (313) window ::= ORDER BY sortlist frame_opt */ - 308, /* (314) window ::= nm ORDER BY sortlist frame_opt */ - 308, /* (315) window ::= nm frame_opt */ - 309, /* (316) frame_opt ::= */ - 309, /* (317) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ - 309, /* (318) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ - 313, /* (319) range_or_rows ::= RANGE|ROWS|GROUPS */ - 315, /* (320) frame_bound_s ::= frame_bound */ - 315, /* (321) frame_bound_s ::= UNBOUNDED PRECEDING */ - 316, /* (322) frame_bound_e ::= frame_bound */ - 316, /* (323) frame_bound_e ::= UNBOUNDED FOLLOWING */ - 314, /* (324) frame_bound ::= expr PRECEDING|FOLLOWING */ - 314, /* (325) frame_bound ::= CURRENT ROW */ - 317, /* (326) frame_exclude_opt ::= */ - 317, /* (327) frame_exclude_opt ::= EXCLUDE frame_exclude */ - 318, /* (328) frame_exclude ::= NO OTHERS */ - 318, /* (329) frame_exclude ::= CURRENT ROW */ - 318, /* (330) frame_exclude ::= GROUP|TIES */ - 251, /* (331) window_clause ::= WINDOW windowdefn_list */ - 273, /* (332) filter_over ::= filter_clause over_clause */ - 273, /* (333) filter_over ::= over_clause */ - 273, /* (334) filter_over ::= filter_clause */ - 312, /* (335) over_clause ::= OVER LP window RP */ - 312, /* (336) over_clause ::= OVER nm */ - 311, /* (337) filter_clause ::= FILTER LP WHERE expr RP */ - 185, /* (338) input ::= cmdlist */ - 186, /* (339) cmdlist ::= cmdlist ecmd */ - 186, /* (340) cmdlist ::= ecmd */ - 187, /* (341) ecmd ::= SEMI */ - 187, /* (342) ecmd ::= cmdx SEMI */ - 187, /* (343) ecmd ::= explain cmdx SEMI */ - 192, /* (344) trans_opt ::= */ - 192, /* (345) trans_opt ::= TRANSACTION */ - 192, /* (346) trans_opt ::= TRANSACTION nm */ - 194, /* (347) savepoint_opt ::= SAVEPOINT */ - 194, /* (348) savepoint_opt ::= */ - 190, /* (349) cmd ::= create_table create_table_args */ - 203, /* (350) table_option_set ::= table_option */ - 201, /* (351) columnlist ::= columnlist COMMA columnname carglist */ - 201, /* (352) columnlist ::= columnname carglist */ - 193, /* (353) nm ::= ID|INDEXED|JOIN_KW */ - 193, /* (354) nm ::= STRING */ - 208, /* (355) typetoken ::= typename */ - 209, /* (356) typename ::= ID|STRING */ - 210, /* (357) signed ::= plus_num */ - 210, /* (358) signed ::= minus_num */ - 207, /* (359) carglist ::= carglist ccons */ - 207, /* (360) carglist ::= */ - 215, /* (361) ccons ::= NULL onconf */ - 215, /* (362) ccons ::= GENERATED ALWAYS AS generated */ - 215, /* (363) ccons ::= AS generated */ - 202, /* (364) conslist_opt ::= COMMA conslist */ - 228, /* (365) conslist ::= conslist tconscomma tcons */ - 228, /* (366) conslist ::= tcons */ - 229, /* (367) tconscomma ::= */ - 233, /* (368) defer_subclause_opt ::= defer_subclause */ - 235, /* (369) resolvetype ::= raisetype */ - 239, /* (370) selectnowith ::= oneselect */ - 240, /* (371) oneselect ::= values */ - 254, /* (372) sclp ::= selcollist COMMA */ - 255, /* (373) as ::= ID|STRING */ - 264, /* (374) indexed_opt ::= indexed_by */ - 272, /* (375) returning ::= */ - 217, /* (376) expr ::= term */ - 274, /* (377) likeop ::= LIKE_KW|MATCH */ - 278, /* (378) case_operand ::= expr */ - 261, /* (379) exprlist ::= nexprlist */ - 284, /* (380) nmnum ::= plus_num */ - 284, /* (381) nmnum ::= nm */ - 284, /* (382) nmnum ::= ON */ - 284, /* (383) nmnum ::= DELETE */ - 284, /* (384) nmnum ::= DEFAULT */ - 211, /* (385) plus_num ::= INTEGER|FLOAT */ - 289, /* (386) foreach_clause ::= */ - 289, /* (387) foreach_clause ::= FOR EACH ROW */ - 292, /* (388) trnm ::= nm */ - 293, /* (389) tridxby ::= */ - 294, /* (390) database_kw_opt ::= DATABASE */ - 294, /* (391) database_kw_opt ::= */ - 297, /* (392) kwcolumn_opt ::= */ - 297, /* (393) kwcolumn_opt ::= COLUMNKW */ - 299, /* (394) vtabarglist ::= vtabarg */ - 299, /* (395) vtabarglist ::= vtabarglist COMMA vtabarg */ - 300, /* (396) vtabarg ::= vtabarg vtabargtoken */ - 303, /* (397) anylist ::= */ - 303, /* (398) anylist ::= anylist LP anylist RP */ - 303, /* (399) anylist ::= anylist ANY */ - 266, /* (400) with ::= */ - 306, /* (401) windowdefn_list ::= windowdefn */ - 308, /* (402) window ::= frame_opt */ + 190, /* (0) explain ::= EXPLAIN */ + 190, /* (1) explain ::= EXPLAIN QUERY PLAN */ + 189, /* (2) cmdx ::= cmd */ + 191, /* (3) cmd ::= BEGIN transtype trans_opt */ + 192, /* (4) transtype ::= */ + 192, /* (5) transtype ::= DEFERRED */ + 192, /* (6) transtype ::= IMMEDIATE */ + 192, /* (7) transtype ::= EXCLUSIVE */ + 191, /* (8) cmd ::= COMMIT|END trans_opt */ + 191, /* (9) cmd ::= ROLLBACK trans_opt */ + 191, /* (10) cmd ::= SAVEPOINT nm */ + 191, /* (11) cmd ::= RELEASE savepoint_opt nm */ + 191, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ + 196, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */ + 198, /* (14) createkw ::= CREATE */ + 200, /* (15) ifnotexists ::= */ + 200, /* (16) ifnotexists ::= IF NOT EXISTS */ + 199, /* (17) temp ::= TEMP */ + 199, /* (18) temp ::= */ + 197, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_option_set */ + 197, /* (20) create_table_args ::= AS select */ + 204, /* (21) table_option_set ::= */ + 204, /* (22) table_option_set ::= table_option_set COMMA table_option */ + 206, /* (23) table_option ::= WITHOUT nm */ + 206, /* (24) table_option ::= nm */ + 207, /* (25) columnname ::= nm typetoken */ + 209, /* (26) typetoken ::= */ + 209, /* (27) typetoken ::= typename LP signed RP */ + 209, /* (28) typetoken ::= typename LP signed COMMA signed RP */ + 210, /* (29) typename ::= typename ID|STRING */ + 214, /* (30) scanpt ::= */ + 215, /* (31) scantok ::= */ + 216, /* (32) ccons ::= CONSTRAINT nm */ + 216, /* (33) ccons ::= DEFAULT scantok term */ + 216, /* (34) ccons ::= DEFAULT LP expr RP */ + 216, /* (35) ccons ::= DEFAULT PLUS scantok term */ + 216, /* (36) ccons ::= DEFAULT MINUS scantok term */ + 216, /* (37) ccons ::= DEFAULT scantok ID|INDEXED */ + 216, /* (38) ccons ::= NOT NULL onconf */ + 216, /* (39) ccons ::= PRIMARY KEY sortorder onconf autoinc */ + 216, /* (40) ccons ::= UNIQUE onconf */ + 216, /* (41) ccons ::= CHECK LP expr RP */ + 216, /* (42) ccons ::= REFERENCES nm eidlist_opt refargs */ + 216, /* (43) ccons ::= defer_subclause */ + 216, /* (44) ccons ::= COLLATE ID|STRING */ + 225, /* (45) generated ::= LP expr RP */ + 225, /* (46) generated ::= LP expr RP ID */ + 221, /* (47) autoinc ::= */ + 221, /* (48) autoinc ::= AUTOINCR */ + 223, /* (49) refargs ::= */ + 223, /* (50) refargs ::= refargs refarg */ + 226, /* (51) refarg ::= MATCH nm */ + 226, /* (52) refarg ::= ON INSERT refact */ + 226, /* (53) refarg ::= ON DELETE refact */ + 226, /* (54) refarg ::= ON UPDATE refact */ + 227, /* (55) refact ::= SET NULL */ + 227, /* (56) refact ::= SET DEFAULT */ + 227, /* (57) refact ::= CASCADE */ + 227, /* (58) refact ::= RESTRICT */ + 227, /* (59) refact ::= NO ACTION */ + 224, /* (60) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ + 224, /* (61) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ + 228, /* (62) init_deferred_pred_opt ::= */ + 228, /* (63) init_deferred_pred_opt ::= INITIALLY DEFERRED */ + 228, /* (64) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ + 203, /* (65) conslist_opt ::= */ + 230, /* (66) tconscomma ::= COMMA */ + 231, /* (67) tcons ::= CONSTRAINT nm */ + 231, /* (68) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ + 231, /* (69) tcons ::= UNIQUE LP sortlist RP onconf */ + 231, /* (70) tcons ::= CHECK LP expr RP onconf */ + 231, /* (71) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ + 234, /* (72) defer_subclause_opt ::= */ + 219, /* (73) onconf ::= */ + 219, /* (74) onconf ::= ON CONFLICT resolvetype */ + 235, /* (75) orconf ::= */ + 235, /* (76) orconf ::= OR resolvetype */ + 236, /* (77) resolvetype ::= IGNORE */ + 236, /* (78) resolvetype ::= REPLACE */ + 191, /* (79) cmd ::= DROP TABLE ifexists fullname */ + 238, /* (80) ifexists ::= IF EXISTS */ + 238, /* (81) ifexists ::= */ + 191, /* (82) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ + 191, /* (83) cmd ::= DROP VIEW ifexists fullname */ + 191, /* (84) cmd ::= select */ + 205, /* (85) select ::= WITH wqlist selectnowith */ + 205, /* (86) select ::= WITH RECURSIVE wqlist selectnowith */ + 205, /* (87) select ::= selectnowith */ + 240, /* (88) selectnowith ::= selectnowith multiselect_op oneselect */ + 243, /* (89) multiselect_op ::= UNION */ + 243, /* (90) multiselect_op ::= UNION ALL */ + 243, /* (91) multiselect_op ::= EXCEPT|INTERSECT */ + 241, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ + 241, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ + 253, /* (94) values ::= VALUES LP nexprlist RP */ + 241, /* (95) oneselect ::= mvalues */ + 255, /* (96) mvalues ::= values COMMA LP nexprlist RP */ + 255, /* (97) mvalues ::= mvalues COMMA LP nexprlist RP */ + 244, /* (98) distinct ::= DISTINCT */ + 244, /* (99) distinct ::= ALL */ + 244, /* (100) distinct ::= */ + 256, /* (101) sclp ::= */ + 245, /* (102) selcollist ::= sclp scanpt expr scanpt as */ + 245, /* (103) selcollist ::= sclp scanpt STAR */ + 245, /* (104) selcollist ::= sclp scanpt nm DOT STAR */ + 257, /* (105) as ::= AS nm */ + 257, /* (106) as ::= */ + 246, /* (107) from ::= */ + 246, /* (108) from ::= FROM seltablist */ + 259, /* (109) stl_prefix ::= seltablist joinop */ + 259, /* (110) stl_prefix ::= */ + 258, /* (111) seltablist ::= stl_prefix nm dbnm as on_using */ + 258, /* (112) seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ + 258, /* (113) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ + 258, /* (114) seltablist ::= stl_prefix LP select RP as on_using */ + 258, /* (115) seltablist ::= stl_prefix LP seltablist RP as on_using */ + 201, /* (116) dbnm ::= */ + 201, /* (117) dbnm ::= DOT nm */ + 239, /* (118) fullname ::= nm */ + 239, /* (119) fullname ::= nm DOT nm */ + 264, /* (120) xfullname ::= nm */ + 264, /* (121) xfullname ::= nm DOT nm */ + 264, /* (122) xfullname ::= nm DOT nm AS nm */ + 264, /* (123) xfullname ::= nm AS nm */ + 260, /* (124) joinop ::= COMMA|JOIN */ + 260, /* (125) joinop ::= JOIN_KW JOIN */ + 260, /* (126) joinop ::= JOIN_KW nm JOIN */ + 260, /* (127) joinop ::= JOIN_KW nm nm JOIN */ + 261, /* (128) on_using ::= ON expr */ + 261, /* (129) on_using ::= USING LP idlist RP */ + 261, /* (130) on_using ::= */ + 266, /* (131) indexed_opt ::= */ + 262, /* (132) indexed_by ::= INDEXED BY nm */ + 262, /* (133) indexed_by ::= NOT INDEXED */ + 250, /* (134) orderby_opt ::= */ + 250, /* (135) orderby_opt ::= ORDER BY sortlist */ + 232, /* (136) sortlist ::= sortlist COMMA expr sortorder nulls */ + 232, /* (137) sortlist ::= expr sortorder nulls */ + 220, /* (138) sortorder ::= ASC */ + 220, /* (139) sortorder ::= DESC */ + 220, /* (140) sortorder ::= */ + 267, /* (141) nulls ::= NULLS FIRST */ + 267, /* (142) nulls ::= NULLS LAST */ + 267, /* (143) nulls ::= */ + 248, /* (144) groupby_opt ::= */ + 248, /* (145) groupby_opt ::= GROUP BY nexprlist */ + 249, /* (146) having_opt ::= */ + 249, /* (147) having_opt ::= HAVING expr */ + 251, /* (148) limit_opt ::= */ + 251, /* (149) limit_opt ::= LIMIT expr */ + 251, /* (150) limit_opt ::= LIMIT expr OFFSET expr */ + 251, /* (151) limit_opt ::= LIMIT expr COMMA expr */ + 191, /* (152) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ + 247, /* (153) where_opt ::= */ + 247, /* (154) where_opt ::= WHERE expr */ + 269, /* (155) where_opt_ret ::= */ + 269, /* (156) where_opt_ret ::= WHERE expr */ + 269, /* (157) where_opt_ret ::= RETURNING selcollist */ + 269, /* (158) where_opt_ret ::= WHERE expr RETURNING selcollist */ + 191, /* (159) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ + 270, /* (160) setlist ::= setlist COMMA nm EQ expr */ + 270, /* (161) setlist ::= setlist COMMA LP idlist RP EQ expr */ + 270, /* (162) setlist ::= nm EQ expr */ + 270, /* (163) setlist ::= LP idlist RP EQ expr */ + 191, /* (164) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ + 191, /* (165) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ + 273, /* (166) upsert ::= */ + 273, /* (167) upsert ::= RETURNING selcollist */ + 273, /* (168) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ + 273, /* (169) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ + 273, /* (170) upsert ::= ON CONFLICT DO NOTHING returning */ + 273, /* (171) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ + 274, /* (172) returning ::= RETURNING selcollist */ + 271, /* (173) insert_cmd ::= INSERT orconf */ + 271, /* (174) insert_cmd ::= REPLACE */ + 272, /* (175) idlist_opt ::= */ + 272, /* (176) idlist_opt ::= LP idlist RP */ + 265, /* (177) idlist ::= idlist COMMA nm */ + 265, /* (178) idlist ::= nm */ + 218, /* (179) expr ::= LP expr RP */ + 218, /* (180) expr ::= ID|INDEXED|JOIN_KW */ + 218, /* (181) expr ::= nm DOT nm */ + 218, /* (182) expr ::= nm DOT nm DOT nm */ + 217, /* (183) term ::= NULL|FLOAT|BLOB */ + 217, /* (184) term ::= STRING */ + 217, /* (185) term ::= INTEGER */ + 218, /* (186) expr ::= VARIABLE */ + 218, /* (187) expr ::= expr COLLATE ID|STRING */ + 218, /* (188) expr ::= CAST LP expr AS typetoken RP */ + 218, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ + 218, /* (190) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ + 218, /* (191) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ + 218, /* (192) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ + 218, /* (193) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ + 218, /* (194) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ + 217, /* (195) term ::= CTIME_KW */ + 218, /* (196) expr ::= LP nexprlist COMMA expr RP */ + 218, /* (197) expr ::= expr AND expr */ + 218, /* (198) expr ::= expr OR expr */ + 218, /* (199) expr ::= expr LT|GT|GE|LE expr */ + 218, /* (200) expr ::= expr EQ|NE expr */ + 218, /* (201) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ + 218, /* (202) expr ::= expr PLUS|MINUS expr */ + 218, /* (203) expr ::= expr STAR|SLASH|REM expr */ + 218, /* (204) expr ::= expr CONCAT expr */ + 276, /* (205) likeop ::= NOT LIKE_KW|MATCH */ + 218, /* (206) expr ::= expr likeop expr */ + 218, /* (207) expr ::= expr likeop expr ESCAPE expr */ + 218, /* (208) expr ::= expr ISNULL|NOTNULL */ + 218, /* (209) expr ::= expr NOT NULL */ + 218, /* (210) expr ::= expr IS expr */ + 218, /* (211) expr ::= expr IS NOT expr */ + 218, /* (212) expr ::= expr IS NOT DISTINCT FROM expr */ + 218, /* (213) expr ::= expr IS DISTINCT FROM expr */ + 218, /* (214) expr ::= NOT expr */ + 218, /* (215) expr ::= BITNOT expr */ + 218, /* (216) expr ::= PLUS|MINUS expr */ + 218, /* (217) expr ::= expr PTR expr */ + 277, /* (218) between_op ::= BETWEEN */ + 277, /* (219) between_op ::= NOT BETWEEN */ + 218, /* (220) expr ::= expr between_op expr AND expr */ + 278, /* (221) in_op ::= IN */ + 278, /* (222) in_op ::= NOT IN */ + 218, /* (223) expr ::= expr in_op LP exprlist RP */ + 218, /* (224) expr ::= LP select RP */ + 218, /* (225) expr ::= expr in_op LP select RP */ + 218, /* (226) expr ::= expr in_op nm dbnm paren_exprlist */ + 218, /* (227) expr ::= EXISTS LP select RP */ + 218, /* (228) expr ::= CASE case_operand case_exprlist case_else END */ + 281, /* (229) case_exprlist ::= case_exprlist WHEN expr THEN expr */ + 281, /* (230) case_exprlist ::= WHEN expr THEN expr */ + 282, /* (231) case_else ::= ELSE expr */ + 282, /* (232) case_else ::= */ + 280, /* (233) case_operand ::= */ + 263, /* (234) exprlist ::= */ + 254, /* (235) nexprlist ::= nexprlist COMMA expr */ + 254, /* (236) nexprlist ::= expr */ + 279, /* (237) paren_exprlist ::= */ + 279, /* (238) paren_exprlist ::= LP exprlist RP */ + 191, /* (239) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ + 283, /* (240) uniqueflag ::= UNIQUE */ + 283, /* (241) uniqueflag ::= */ + 222, /* (242) eidlist_opt ::= */ + 222, /* (243) eidlist_opt ::= LP eidlist RP */ + 233, /* (244) eidlist ::= eidlist COMMA nm collate sortorder */ + 233, /* (245) eidlist ::= nm collate sortorder */ + 284, /* (246) collate ::= */ + 284, /* (247) collate ::= COLLATE ID|STRING */ + 191, /* (248) cmd ::= DROP INDEX ifexists fullname */ + 191, /* (249) cmd ::= VACUUM vinto */ + 191, /* (250) cmd ::= VACUUM nm vinto */ + 285, /* (251) vinto ::= INTO expr */ + 285, /* (252) vinto ::= */ + 191, /* (253) cmd ::= PRAGMA nm dbnm */ + 191, /* (254) cmd ::= PRAGMA nm dbnm EQ nmnum */ + 191, /* (255) cmd ::= PRAGMA nm dbnm LP nmnum RP */ + 191, /* (256) cmd ::= PRAGMA nm dbnm EQ minus_num */ + 191, /* (257) cmd ::= PRAGMA nm dbnm LP minus_num RP */ + 212, /* (258) plus_num ::= PLUS INTEGER|FLOAT */ + 213, /* (259) minus_num ::= MINUS INTEGER|FLOAT */ + 191, /* (260) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ + 287, /* (261) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ + 289, /* (262) trigger_time ::= BEFORE|AFTER */ + 289, /* (263) trigger_time ::= INSTEAD OF */ + 289, /* (264) trigger_time ::= */ + 290, /* (265) trigger_event ::= DELETE|INSERT */ + 290, /* (266) trigger_event ::= UPDATE */ + 290, /* (267) trigger_event ::= UPDATE OF idlist */ + 292, /* (268) when_clause ::= */ + 292, /* (269) when_clause ::= WHEN expr */ + 288, /* (270) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ + 288, /* (271) trigger_cmd_list ::= trigger_cmd SEMI */ + 294, /* (272) trnm ::= nm DOT nm */ + 295, /* (273) tridxby ::= INDEXED BY nm */ + 295, /* (274) tridxby ::= NOT INDEXED */ + 293, /* (275) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ + 293, /* (276) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ + 293, /* (277) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ + 293, /* (278) trigger_cmd ::= scanpt select scanpt */ + 218, /* (279) expr ::= RAISE LP IGNORE RP */ + 218, /* (280) expr ::= RAISE LP raisetype COMMA nm RP */ + 237, /* (281) raisetype ::= ROLLBACK */ + 237, /* (282) raisetype ::= ABORT */ + 237, /* (283) raisetype ::= FAIL */ + 191, /* (284) cmd ::= DROP TRIGGER ifexists fullname */ + 191, /* (285) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ + 191, /* (286) cmd ::= DETACH database_kw_opt expr */ + 297, /* (287) key_opt ::= */ + 297, /* (288) key_opt ::= KEY expr */ + 191, /* (289) cmd ::= REINDEX */ + 191, /* (290) cmd ::= REINDEX nm dbnm */ + 191, /* (291) cmd ::= ANALYZE */ + 191, /* (292) cmd ::= ANALYZE nm dbnm */ + 191, /* (293) cmd ::= ALTER TABLE fullname RENAME TO nm */ + 191, /* (294) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ + 191, /* (295) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ + 298, /* (296) add_column_fullname ::= fullname */ + 191, /* (297) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ + 191, /* (298) cmd ::= create_vtab */ + 191, /* (299) cmd ::= create_vtab LP vtabarglist RP */ + 300, /* (300) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ + 302, /* (301) vtabarg ::= */ + 303, /* (302) vtabargtoken ::= ANY */ + 303, /* (303) vtabargtoken ::= lp anylist RP */ + 304, /* (304) lp ::= LP */ + 268, /* (305) with ::= WITH wqlist */ + 268, /* (306) with ::= WITH RECURSIVE wqlist */ + 307, /* (307) wqas ::= AS */ + 307, /* (308) wqas ::= AS MATERIALIZED */ + 307, /* (309) wqas ::= AS NOT MATERIALIZED */ + 306, /* (310) wqitem ::= withnm eidlist_opt wqas LP select RP */ + 308, /* (311) withnm ::= nm */ + 242, /* (312) wqlist ::= wqitem */ + 242, /* (313) wqlist ::= wqlist COMMA wqitem */ + 309, /* (314) windowdefn_list ::= windowdefn_list COMMA windowdefn */ + 310, /* (315) windowdefn ::= nm AS LP window RP */ + 311, /* (316) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ + 311, /* (317) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ + 311, /* (318) window ::= ORDER BY sortlist frame_opt */ + 311, /* (319) window ::= nm ORDER BY sortlist frame_opt */ + 311, /* (320) window ::= nm frame_opt */ + 312, /* (321) frame_opt ::= */ + 312, /* (322) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ + 312, /* (323) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ + 316, /* (324) range_or_rows ::= RANGE|ROWS|GROUPS */ + 318, /* (325) frame_bound_s ::= frame_bound */ + 318, /* (326) frame_bound_s ::= UNBOUNDED PRECEDING */ + 319, /* (327) frame_bound_e ::= frame_bound */ + 319, /* (328) frame_bound_e ::= UNBOUNDED FOLLOWING */ + 317, /* (329) frame_bound ::= expr PRECEDING|FOLLOWING */ + 317, /* (330) frame_bound ::= CURRENT ROW */ + 320, /* (331) frame_exclude_opt ::= */ + 320, /* (332) frame_exclude_opt ::= EXCLUDE frame_exclude */ + 321, /* (333) frame_exclude ::= NO OTHERS */ + 321, /* (334) frame_exclude ::= CURRENT ROW */ + 321, /* (335) frame_exclude ::= GROUP|TIES */ + 252, /* (336) window_clause ::= WINDOW windowdefn_list */ + 275, /* (337) filter_over ::= filter_clause over_clause */ + 275, /* (338) filter_over ::= over_clause */ + 275, /* (339) filter_over ::= filter_clause */ + 315, /* (340) over_clause ::= OVER LP window RP */ + 315, /* (341) over_clause ::= OVER nm */ + 314, /* (342) filter_clause ::= FILTER LP WHERE expr RP */ + 217, /* (343) term ::= QNUMBER */ + 186, /* (344) input ::= cmdlist */ + 187, /* (345) cmdlist ::= cmdlist ecmd */ + 187, /* (346) cmdlist ::= ecmd */ + 188, /* (347) ecmd ::= SEMI */ + 188, /* (348) ecmd ::= cmdx SEMI */ + 188, /* (349) ecmd ::= explain cmdx SEMI */ + 193, /* (350) trans_opt ::= */ + 193, /* (351) trans_opt ::= TRANSACTION */ + 193, /* (352) trans_opt ::= TRANSACTION nm */ + 195, /* (353) savepoint_opt ::= SAVEPOINT */ + 195, /* (354) savepoint_opt ::= */ + 191, /* (355) cmd ::= create_table create_table_args */ + 204, /* (356) table_option_set ::= table_option */ + 202, /* (357) columnlist ::= columnlist COMMA columnname carglist */ + 202, /* (358) columnlist ::= columnname carglist */ + 194, /* (359) nm ::= ID|INDEXED|JOIN_KW */ + 194, /* (360) nm ::= STRING */ + 209, /* (361) typetoken ::= typename */ + 210, /* (362) typename ::= ID|STRING */ + 211, /* (363) signed ::= plus_num */ + 211, /* (364) signed ::= minus_num */ + 208, /* (365) carglist ::= carglist ccons */ + 208, /* (366) carglist ::= */ + 216, /* (367) ccons ::= NULL onconf */ + 216, /* (368) ccons ::= GENERATED ALWAYS AS generated */ + 216, /* (369) ccons ::= AS generated */ + 203, /* (370) conslist_opt ::= COMMA conslist */ + 229, /* (371) conslist ::= conslist tconscomma tcons */ + 229, /* (372) conslist ::= tcons */ + 230, /* (373) tconscomma ::= */ + 234, /* (374) defer_subclause_opt ::= defer_subclause */ + 236, /* (375) resolvetype ::= raisetype */ + 240, /* (376) selectnowith ::= oneselect */ + 241, /* (377) oneselect ::= values */ + 256, /* (378) sclp ::= selcollist COMMA */ + 257, /* (379) as ::= ID|STRING */ + 266, /* (380) indexed_opt ::= indexed_by */ + 274, /* (381) returning ::= */ + 218, /* (382) expr ::= term */ + 276, /* (383) likeop ::= LIKE_KW|MATCH */ + 280, /* (384) case_operand ::= expr */ + 263, /* (385) exprlist ::= nexprlist */ + 286, /* (386) nmnum ::= plus_num */ + 286, /* (387) nmnum ::= nm */ + 286, /* (388) nmnum ::= ON */ + 286, /* (389) nmnum ::= DELETE */ + 286, /* (390) nmnum ::= DEFAULT */ + 212, /* (391) plus_num ::= INTEGER|FLOAT */ + 291, /* (392) foreach_clause ::= */ + 291, /* (393) foreach_clause ::= FOR EACH ROW */ + 294, /* (394) trnm ::= nm */ + 295, /* (395) tridxby ::= */ + 296, /* (396) database_kw_opt ::= DATABASE */ + 296, /* (397) database_kw_opt ::= */ + 299, /* (398) kwcolumn_opt ::= */ + 299, /* (399) kwcolumn_opt ::= COLUMNKW */ + 301, /* (400) vtabarglist ::= vtabarg */ + 301, /* (401) vtabarglist ::= vtabarglist COMMA vtabarg */ + 302, /* (402) vtabarg ::= vtabarg vtabargtoken */ + 305, /* (403) anylist ::= */ + 305, /* (404) anylist ::= anylist LP anylist RP */ + 305, /* (405) anylist ::= anylist ANY */ + 268, /* (406) with ::= */ + 309, /* (407) windowdefn_list ::= windowdefn */ + 311, /* (408) window ::= frame_opt */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -172453,314 +175761,320 @@ static const signed char yyRuleInfoNRhs[] = { -9, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ -10, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ -4, /* (94) values ::= VALUES LP nexprlist RP */ - -5, /* (95) values ::= values COMMA LP nexprlist RP */ - -1, /* (96) distinct ::= DISTINCT */ - -1, /* (97) distinct ::= ALL */ - 0, /* (98) distinct ::= */ - 0, /* (99) sclp ::= */ - -5, /* (100) selcollist ::= sclp scanpt expr scanpt as */ - -3, /* (101) selcollist ::= sclp scanpt STAR */ - -5, /* (102) selcollist ::= sclp scanpt nm DOT STAR */ - -2, /* (103) as ::= AS nm */ - 0, /* (104) as ::= */ - 0, /* (105) from ::= */ - -2, /* (106) from ::= FROM seltablist */ - -2, /* (107) stl_prefix ::= seltablist joinop */ - 0, /* (108) stl_prefix ::= */ - -5, /* (109) seltablist ::= stl_prefix nm dbnm as on_using */ - -6, /* (110) seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ - -8, /* (111) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ - -6, /* (112) seltablist ::= stl_prefix LP select RP as on_using */ - -6, /* (113) seltablist ::= stl_prefix LP seltablist RP as on_using */ - 0, /* (114) dbnm ::= */ - -2, /* (115) dbnm ::= DOT nm */ - -1, /* (116) fullname ::= nm */ - -3, /* (117) fullname ::= nm DOT nm */ - -1, /* (118) xfullname ::= nm */ - -3, /* (119) xfullname ::= nm DOT nm */ - -5, /* (120) xfullname ::= nm DOT nm AS nm */ - -3, /* (121) xfullname ::= nm AS nm */ - -1, /* (122) joinop ::= COMMA|JOIN */ - -2, /* (123) joinop ::= JOIN_KW JOIN */ - -3, /* (124) joinop ::= JOIN_KW nm JOIN */ - -4, /* (125) joinop ::= JOIN_KW nm nm JOIN */ - -2, /* (126) on_using ::= ON expr */ - -4, /* (127) on_using ::= USING LP idlist RP */ - 0, /* (128) on_using ::= */ - 0, /* (129) indexed_opt ::= */ - -3, /* (130) indexed_by ::= INDEXED BY nm */ - -2, /* (131) indexed_by ::= NOT INDEXED */ - 0, /* (132) orderby_opt ::= */ - -3, /* (133) orderby_opt ::= ORDER BY sortlist */ - -5, /* (134) sortlist ::= sortlist COMMA expr sortorder nulls */ - -3, /* (135) sortlist ::= expr sortorder nulls */ - -1, /* (136) sortorder ::= ASC */ - -1, /* (137) sortorder ::= DESC */ - 0, /* (138) sortorder ::= */ - -2, /* (139) nulls ::= NULLS FIRST */ - -2, /* (140) nulls ::= NULLS LAST */ - 0, /* (141) nulls ::= */ - 0, /* (142) groupby_opt ::= */ - -3, /* (143) groupby_opt ::= GROUP BY nexprlist */ - 0, /* (144) having_opt ::= */ - -2, /* (145) having_opt ::= HAVING expr */ - 0, /* (146) limit_opt ::= */ - -2, /* (147) limit_opt ::= LIMIT expr */ - -4, /* (148) limit_opt ::= LIMIT expr OFFSET expr */ - -4, /* (149) limit_opt ::= LIMIT expr COMMA expr */ - -6, /* (150) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ - 0, /* (151) where_opt ::= */ - -2, /* (152) where_opt ::= WHERE expr */ - 0, /* (153) where_opt_ret ::= */ - -2, /* (154) where_opt_ret ::= WHERE expr */ - -2, /* (155) where_opt_ret ::= RETURNING selcollist */ - -4, /* (156) where_opt_ret ::= WHERE expr RETURNING selcollist */ - -9, /* (157) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ - -5, /* (158) setlist ::= setlist COMMA nm EQ expr */ - -7, /* (159) setlist ::= setlist COMMA LP idlist RP EQ expr */ - -3, /* (160) setlist ::= nm EQ expr */ - -5, /* (161) setlist ::= LP idlist RP EQ expr */ - -7, /* (162) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ - -8, /* (163) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ - 0, /* (164) upsert ::= */ - -2, /* (165) upsert ::= RETURNING selcollist */ - -12, /* (166) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ - -9, /* (167) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ - -5, /* (168) upsert ::= ON CONFLICT DO NOTHING returning */ - -8, /* (169) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ - -2, /* (170) returning ::= RETURNING selcollist */ - -2, /* (171) insert_cmd ::= INSERT orconf */ - -1, /* (172) insert_cmd ::= REPLACE */ - 0, /* (173) idlist_opt ::= */ - -3, /* (174) idlist_opt ::= LP idlist RP */ - -3, /* (175) idlist ::= idlist COMMA nm */ - -1, /* (176) idlist ::= nm */ - -3, /* (177) expr ::= LP expr RP */ - -1, /* (178) expr ::= ID|INDEXED|JOIN_KW */ - -3, /* (179) expr ::= nm DOT nm */ - -5, /* (180) expr ::= nm DOT nm DOT nm */ - -1, /* (181) term ::= NULL|FLOAT|BLOB */ - -1, /* (182) term ::= STRING */ - -1, /* (183) term ::= INTEGER */ - -1, /* (184) expr ::= VARIABLE */ - -3, /* (185) expr ::= expr COLLATE ID|STRING */ - -6, /* (186) expr ::= CAST LP expr AS typetoken RP */ - -5, /* (187) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ - -4, /* (188) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ - -6, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ - -5, /* (190) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ - -1, /* (191) term ::= CTIME_KW */ - -5, /* (192) expr ::= LP nexprlist COMMA expr RP */ - -3, /* (193) expr ::= expr AND expr */ - -3, /* (194) expr ::= expr OR expr */ - -3, /* (195) expr ::= expr LT|GT|GE|LE expr */ - -3, /* (196) expr ::= expr EQ|NE expr */ - -3, /* (197) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ - -3, /* (198) expr ::= expr PLUS|MINUS expr */ - -3, /* (199) expr ::= expr STAR|SLASH|REM expr */ - -3, /* (200) expr ::= expr CONCAT expr */ - -2, /* (201) likeop ::= NOT LIKE_KW|MATCH */ - -3, /* (202) expr ::= expr likeop expr */ - -5, /* (203) expr ::= expr likeop expr ESCAPE expr */ - -2, /* (204) expr ::= expr ISNULL|NOTNULL */ - -3, /* (205) expr ::= expr NOT NULL */ - -3, /* (206) expr ::= expr IS expr */ - -4, /* (207) expr ::= expr IS NOT expr */ - -6, /* (208) expr ::= expr IS NOT DISTINCT FROM expr */ - -5, /* (209) expr ::= expr IS DISTINCT FROM expr */ - -2, /* (210) expr ::= NOT expr */ - -2, /* (211) expr ::= BITNOT expr */ - -2, /* (212) expr ::= PLUS|MINUS expr */ - -3, /* (213) expr ::= expr PTR expr */ - -1, /* (214) between_op ::= BETWEEN */ - -2, /* (215) between_op ::= NOT BETWEEN */ - -5, /* (216) expr ::= expr between_op expr AND expr */ - -1, /* (217) in_op ::= IN */ - -2, /* (218) in_op ::= NOT IN */ - -5, /* (219) expr ::= expr in_op LP exprlist RP */ - -3, /* (220) expr ::= LP select RP */ - -5, /* (221) expr ::= expr in_op LP select RP */ - -5, /* (222) expr ::= expr in_op nm dbnm paren_exprlist */ - -4, /* (223) expr ::= EXISTS LP select RP */ - -5, /* (224) expr ::= CASE case_operand case_exprlist case_else END */ - -5, /* (225) case_exprlist ::= case_exprlist WHEN expr THEN expr */ - -4, /* (226) case_exprlist ::= WHEN expr THEN expr */ - -2, /* (227) case_else ::= ELSE expr */ - 0, /* (228) case_else ::= */ - 0, /* (229) case_operand ::= */ - 0, /* (230) exprlist ::= */ - -3, /* (231) nexprlist ::= nexprlist COMMA expr */ - -1, /* (232) nexprlist ::= expr */ - 0, /* (233) paren_exprlist ::= */ - -3, /* (234) paren_exprlist ::= LP exprlist RP */ - -12, /* (235) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ - -1, /* (236) uniqueflag ::= UNIQUE */ - 0, /* (237) uniqueflag ::= */ - 0, /* (238) eidlist_opt ::= */ - -3, /* (239) eidlist_opt ::= LP eidlist RP */ - -5, /* (240) eidlist ::= eidlist COMMA nm collate sortorder */ - -3, /* (241) eidlist ::= nm collate sortorder */ - 0, /* (242) collate ::= */ - -2, /* (243) collate ::= COLLATE ID|STRING */ - -4, /* (244) cmd ::= DROP INDEX ifexists fullname */ - -2, /* (245) cmd ::= VACUUM vinto */ - -3, /* (246) cmd ::= VACUUM nm vinto */ - -2, /* (247) vinto ::= INTO expr */ - 0, /* (248) vinto ::= */ - -3, /* (249) cmd ::= PRAGMA nm dbnm */ - -5, /* (250) cmd ::= PRAGMA nm dbnm EQ nmnum */ - -6, /* (251) cmd ::= PRAGMA nm dbnm LP nmnum RP */ - -5, /* (252) cmd ::= PRAGMA nm dbnm EQ minus_num */ - -6, /* (253) cmd ::= PRAGMA nm dbnm LP minus_num RP */ - -2, /* (254) plus_num ::= PLUS INTEGER|FLOAT */ - -2, /* (255) minus_num ::= MINUS INTEGER|FLOAT */ - -5, /* (256) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ - -11, /* (257) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ - -1, /* (258) trigger_time ::= BEFORE|AFTER */ - -2, /* (259) trigger_time ::= INSTEAD OF */ - 0, /* (260) trigger_time ::= */ - -1, /* (261) trigger_event ::= DELETE|INSERT */ - -1, /* (262) trigger_event ::= UPDATE */ - -3, /* (263) trigger_event ::= UPDATE OF idlist */ - 0, /* (264) when_clause ::= */ - -2, /* (265) when_clause ::= WHEN expr */ - -3, /* (266) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ - -2, /* (267) trigger_cmd_list ::= trigger_cmd SEMI */ - -3, /* (268) trnm ::= nm DOT nm */ - -3, /* (269) tridxby ::= INDEXED BY nm */ - -2, /* (270) tridxby ::= NOT INDEXED */ - -9, /* (271) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ - -8, /* (272) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ - -6, /* (273) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ - -3, /* (274) trigger_cmd ::= scanpt select scanpt */ - -4, /* (275) expr ::= RAISE LP IGNORE RP */ - -6, /* (276) expr ::= RAISE LP raisetype COMMA nm RP */ - -1, /* (277) raisetype ::= ROLLBACK */ - -1, /* (278) raisetype ::= ABORT */ - -1, /* (279) raisetype ::= FAIL */ - -4, /* (280) cmd ::= DROP TRIGGER ifexists fullname */ - -6, /* (281) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ - -3, /* (282) cmd ::= DETACH database_kw_opt expr */ - 0, /* (283) key_opt ::= */ - -2, /* (284) key_opt ::= KEY expr */ - -1, /* (285) cmd ::= REINDEX */ - -3, /* (286) cmd ::= REINDEX nm dbnm */ - -1, /* (287) cmd ::= ANALYZE */ - -3, /* (288) cmd ::= ANALYZE nm dbnm */ - -6, /* (289) cmd ::= ALTER TABLE fullname RENAME TO nm */ - -7, /* (290) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ - -6, /* (291) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ - -1, /* (292) add_column_fullname ::= fullname */ - -8, /* (293) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ - -1, /* (294) cmd ::= create_vtab */ - -4, /* (295) cmd ::= create_vtab LP vtabarglist RP */ - -8, /* (296) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ - 0, /* (297) vtabarg ::= */ - -1, /* (298) vtabargtoken ::= ANY */ - -3, /* (299) vtabargtoken ::= lp anylist RP */ - -1, /* (300) lp ::= LP */ - -2, /* (301) with ::= WITH wqlist */ - -3, /* (302) with ::= WITH RECURSIVE wqlist */ - -1, /* (303) wqas ::= AS */ - -2, /* (304) wqas ::= AS MATERIALIZED */ - -3, /* (305) wqas ::= AS NOT MATERIALIZED */ - -6, /* (306) wqitem ::= nm eidlist_opt wqas LP select RP */ - -1, /* (307) wqlist ::= wqitem */ - -3, /* (308) wqlist ::= wqlist COMMA wqitem */ - -3, /* (309) windowdefn_list ::= windowdefn_list COMMA windowdefn */ - -5, /* (310) windowdefn ::= nm AS LP window RP */ - -5, /* (311) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ - -6, /* (312) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ - -4, /* (313) window ::= ORDER BY sortlist frame_opt */ - -5, /* (314) window ::= nm ORDER BY sortlist frame_opt */ - -2, /* (315) window ::= nm frame_opt */ - 0, /* (316) frame_opt ::= */ - -3, /* (317) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ - -6, /* (318) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ - -1, /* (319) range_or_rows ::= RANGE|ROWS|GROUPS */ - -1, /* (320) frame_bound_s ::= frame_bound */ - -2, /* (321) frame_bound_s ::= UNBOUNDED PRECEDING */ - -1, /* (322) frame_bound_e ::= frame_bound */ - -2, /* (323) frame_bound_e ::= UNBOUNDED FOLLOWING */ - -2, /* (324) frame_bound ::= expr PRECEDING|FOLLOWING */ - -2, /* (325) frame_bound ::= CURRENT ROW */ - 0, /* (326) frame_exclude_opt ::= */ - -2, /* (327) frame_exclude_opt ::= EXCLUDE frame_exclude */ - -2, /* (328) frame_exclude ::= NO OTHERS */ - -2, /* (329) frame_exclude ::= CURRENT ROW */ - -1, /* (330) frame_exclude ::= GROUP|TIES */ - -2, /* (331) window_clause ::= WINDOW windowdefn_list */ - -2, /* (332) filter_over ::= filter_clause over_clause */ - -1, /* (333) filter_over ::= over_clause */ - -1, /* (334) filter_over ::= filter_clause */ - -4, /* (335) over_clause ::= OVER LP window RP */ - -2, /* (336) over_clause ::= OVER nm */ - -5, /* (337) filter_clause ::= FILTER LP WHERE expr RP */ - -1, /* (338) input ::= cmdlist */ - -2, /* (339) cmdlist ::= cmdlist ecmd */ - -1, /* (340) cmdlist ::= ecmd */ - -1, /* (341) ecmd ::= SEMI */ - -2, /* (342) ecmd ::= cmdx SEMI */ - -3, /* (343) ecmd ::= explain cmdx SEMI */ - 0, /* (344) trans_opt ::= */ - -1, /* (345) trans_opt ::= TRANSACTION */ - -2, /* (346) trans_opt ::= TRANSACTION nm */ - -1, /* (347) savepoint_opt ::= SAVEPOINT */ - 0, /* (348) savepoint_opt ::= */ - -2, /* (349) cmd ::= create_table create_table_args */ - -1, /* (350) table_option_set ::= table_option */ - -4, /* (351) columnlist ::= columnlist COMMA columnname carglist */ - -2, /* (352) columnlist ::= columnname carglist */ - -1, /* (353) nm ::= ID|INDEXED|JOIN_KW */ - -1, /* (354) nm ::= STRING */ - -1, /* (355) typetoken ::= typename */ - -1, /* (356) typename ::= ID|STRING */ - -1, /* (357) signed ::= plus_num */ - -1, /* (358) signed ::= minus_num */ - -2, /* (359) carglist ::= carglist ccons */ - 0, /* (360) carglist ::= */ - -2, /* (361) ccons ::= NULL onconf */ - -4, /* (362) ccons ::= GENERATED ALWAYS AS generated */ - -2, /* (363) ccons ::= AS generated */ - -2, /* (364) conslist_opt ::= COMMA conslist */ - -3, /* (365) conslist ::= conslist tconscomma tcons */ - -1, /* (366) conslist ::= tcons */ - 0, /* (367) tconscomma ::= */ - -1, /* (368) defer_subclause_opt ::= defer_subclause */ - -1, /* (369) resolvetype ::= raisetype */ - -1, /* (370) selectnowith ::= oneselect */ - -1, /* (371) oneselect ::= values */ - -2, /* (372) sclp ::= selcollist COMMA */ - -1, /* (373) as ::= ID|STRING */ - -1, /* (374) indexed_opt ::= indexed_by */ - 0, /* (375) returning ::= */ - -1, /* (376) expr ::= term */ - -1, /* (377) likeop ::= LIKE_KW|MATCH */ - -1, /* (378) case_operand ::= expr */ - -1, /* (379) exprlist ::= nexprlist */ - -1, /* (380) nmnum ::= plus_num */ - -1, /* (381) nmnum ::= nm */ - -1, /* (382) nmnum ::= ON */ - -1, /* (383) nmnum ::= DELETE */ - -1, /* (384) nmnum ::= DEFAULT */ - -1, /* (385) plus_num ::= INTEGER|FLOAT */ - 0, /* (386) foreach_clause ::= */ - -3, /* (387) foreach_clause ::= FOR EACH ROW */ - -1, /* (388) trnm ::= nm */ - 0, /* (389) tridxby ::= */ - -1, /* (390) database_kw_opt ::= DATABASE */ - 0, /* (391) database_kw_opt ::= */ - 0, /* (392) kwcolumn_opt ::= */ - -1, /* (393) kwcolumn_opt ::= COLUMNKW */ - -1, /* (394) vtabarglist ::= vtabarg */ - -3, /* (395) vtabarglist ::= vtabarglist COMMA vtabarg */ - -2, /* (396) vtabarg ::= vtabarg vtabargtoken */ - 0, /* (397) anylist ::= */ - -4, /* (398) anylist ::= anylist LP anylist RP */ - -2, /* (399) anylist ::= anylist ANY */ - 0, /* (400) with ::= */ - -1, /* (401) windowdefn_list ::= windowdefn */ - -1, /* (402) window ::= frame_opt */ + -1, /* (95) oneselect ::= mvalues */ + -5, /* (96) mvalues ::= values COMMA LP nexprlist RP */ + -5, /* (97) mvalues ::= mvalues COMMA LP nexprlist RP */ + -1, /* (98) distinct ::= DISTINCT */ + -1, /* (99) distinct ::= ALL */ + 0, /* (100) distinct ::= */ + 0, /* (101) sclp ::= */ + -5, /* (102) selcollist ::= sclp scanpt expr scanpt as */ + -3, /* (103) selcollist ::= sclp scanpt STAR */ + -5, /* (104) selcollist ::= sclp scanpt nm DOT STAR */ + -2, /* (105) as ::= AS nm */ + 0, /* (106) as ::= */ + 0, /* (107) from ::= */ + -2, /* (108) from ::= FROM seltablist */ + -2, /* (109) stl_prefix ::= seltablist joinop */ + 0, /* (110) stl_prefix ::= */ + -5, /* (111) seltablist ::= stl_prefix nm dbnm as on_using */ + -6, /* (112) seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ + -8, /* (113) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ + -6, /* (114) seltablist ::= stl_prefix LP select RP as on_using */ + -6, /* (115) seltablist ::= stl_prefix LP seltablist RP as on_using */ + 0, /* (116) dbnm ::= */ + -2, /* (117) dbnm ::= DOT nm */ + -1, /* (118) fullname ::= nm */ + -3, /* (119) fullname ::= nm DOT nm */ + -1, /* (120) xfullname ::= nm */ + -3, /* (121) xfullname ::= nm DOT nm */ + -5, /* (122) xfullname ::= nm DOT nm AS nm */ + -3, /* (123) xfullname ::= nm AS nm */ + -1, /* (124) joinop ::= COMMA|JOIN */ + -2, /* (125) joinop ::= JOIN_KW JOIN */ + -3, /* (126) joinop ::= JOIN_KW nm JOIN */ + -4, /* (127) joinop ::= JOIN_KW nm nm JOIN */ + -2, /* (128) on_using ::= ON expr */ + -4, /* (129) on_using ::= USING LP idlist RP */ + 0, /* (130) on_using ::= */ + 0, /* (131) indexed_opt ::= */ + -3, /* (132) indexed_by ::= INDEXED BY nm */ + -2, /* (133) indexed_by ::= NOT INDEXED */ + 0, /* (134) orderby_opt ::= */ + -3, /* (135) orderby_opt ::= ORDER BY sortlist */ + -5, /* (136) sortlist ::= sortlist COMMA expr sortorder nulls */ + -3, /* (137) sortlist ::= expr sortorder nulls */ + -1, /* (138) sortorder ::= ASC */ + -1, /* (139) sortorder ::= DESC */ + 0, /* (140) sortorder ::= */ + -2, /* (141) nulls ::= NULLS FIRST */ + -2, /* (142) nulls ::= NULLS LAST */ + 0, /* (143) nulls ::= */ + 0, /* (144) groupby_opt ::= */ + -3, /* (145) groupby_opt ::= GROUP BY nexprlist */ + 0, /* (146) having_opt ::= */ + -2, /* (147) having_opt ::= HAVING expr */ + 0, /* (148) limit_opt ::= */ + -2, /* (149) limit_opt ::= LIMIT expr */ + -4, /* (150) limit_opt ::= LIMIT expr OFFSET expr */ + -4, /* (151) limit_opt ::= LIMIT expr COMMA expr */ + -6, /* (152) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ + 0, /* (153) where_opt ::= */ + -2, /* (154) where_opt ::= WHERE expr */ + 0, /* (155) where_opt_ret ::= */ + -2, /* (156) where_opt_ret ::= WHERE expr */ + -2, /* (157) where_opt_ret ::= RETURNING selcollist */ + -4, /* (158) where_opt_ret ::= WHERE expr RETURNING selcollist */ + -9, /* (159) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ + -5, /* (160) setlist ::= setlist COMMA nm EQ expr */ + -7, /* (161) setlist ::= setlist COMMA LP idlist RP EQ expr */ + -3, /* (162) setlist ::= nm EQ expr */ + -5, /* (163) setlist ::= LP idlist RP EQ expr */ + -7, /* (164) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ + -8, /* (165) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ + 0, /* (166) upsert ::= */ + -2, /* (167) upsert ::= RETURNING selcollist */ + -12, /* (168) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ + -9, /* (169) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ + -5, /* (170) upsert ::= ON CONFLICT DO NOTHING returning */ + -8, /* (171) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ + -2, /* (172) returning ::= RETURNING selcollist */ + -2, /* (173) insert_cmd ::= INSERT orconf */ + -1, /* (174) insert_cmd ::= REPLACE */ + 0, /* (175) idlist_opt ::= */ + -3, /* (176) idlist_opt ::= LP idlist RP */ + -3, /* (177) idlist ::= idlist COMMA nm */ + -1, /* (178) idlist ::= nm */ + -3, /* (179) expr ::= LP expr RP */ + -1, /* (180) expr ::= ID|INDEXED|JOIN_KW */ + -3, /* (181) expr ::= nm DOT nm */ + -5, /* (182) expr ::= nm DOT nm DOT nm */ + -1, /* (183) term ::= NULL|FLOAT|BLOB */ + -1, /* (184) term ::= STRING */ + -1, /* (185) term ::= INTEGER */ + -1, /* (186) expr ::= VARIABLE */ + -3, /* (187) expr ::= expr COLLATE ID|STRING */ + -6, /* (188) expr ::= CAST LP expr AS typetoken RP */ + -5, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ + -8, /* (190) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ + -4, /* (191) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ + -6, /* (192) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ + -9, /* (193) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ + -5, /* (194) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ + -1, /* (195) term ::= CTIME_KW */ + -5, /* (196) expr ::= LP nexprlist COMMA expr RP */ + -3, /* (197) expr ::= expr AND expr */ + -3, /* (198) expr ::= expr OR expr */ + -3, /* (199) expr ::= expr LT|GT|GE|LE expr */ + -3, /* (200) expr ::= expr EQ|NE expr */ + -3, /* (201) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ + -3, /* (202) expr ::= expr PLUS|MINUS expr */ + -3, /* (203) expr ::= expr STAR|SLASH|REM expr */ + -3, /* (204) expr ::= expr CONCAT expr */ + -2, /* (205) likeop ::= NOT LIKE_KW|MATCH */ + -3, /* (206) expr ::= expr likeop expr */ + -5, /* (207) expr ::= expr likeop expr ESCAPE expr */ + -2, /* (208) expr ::= expr ISNULL|NOTNULL */ + -3, /* (209) expr ::= expr NOT NULL */ + -3, /* (210) expr ::= expr IS expr */ + -4, /* (211) expr ::= expr IS NOT expr */ + -6, /* (212) expr ::= expr IS NOT DISTINCT FROM expr */ + -5, /* (213) expr ::= expr IS DISTINCT FROM expr */ + -2, /* (214) expr ::= NOT expr */ + -2, /* (215) expr ::= BITNOT expr */ + -2, /* (216) expr ::= PLUS|MINUS expr */ + -3, /* (217) expr ::= expr PTR expr */ + -1, /* (218) between_op ::= BETWEEN */ + -2, /* (219) between_op ::= NOT BETWEEN */ + -5, /* (220) expr ::= expr between_op expr AND expr */ + -1, /* (221) in_op ::= IN */ + -2, /* (222) in_op ::= NOT IN */ + -5, /* (223) expr ::= expr in_op LP exprlist RP */ + -3, /* (224) expr ::= LP select RP */ + -5, /* (225) expr ::= expr in_op LP select RP */ + -5, /* (226) expr ::= expr in_op nm dbnm paren_exprlist */ + -4, /* (227) expr ::= EXISTS LP select RP */ + -5, /* (228) expr ::= CASE case_operand case_exprlist case_else END */ + -5, /* (229) case_exprlist ::= case_exprlist WHEN expr THEN expr */ + -4, /* (230) case_exprlist ::= WHEN expr THEN expr */ + -2, /* (231) case_else ::= ELSE expr */ + 0, /* (232) case_else ::= */ + 0, /* (233) case_operand ::= */ + 0, /* (234) exprlist ::= */ + -3, /* (235) nexprlist ::= nexprlist COMMA expr */ + -1, /* (236) nexprlist ::= expr */ + 0, /* (237) paren_exprlist ::= */ + -3, /* (238) paren_exprlist ::= LP exprlist RP */ + -12, /* (239) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ + -1, /* (240) uniqueflag ::= UNIQUE */ + 0, /* (241) uniqueflag ::= */ + 0, /* (242) eidlist_opt ::= */ + -3, /* (243) eidlist_opt ::= LP eidlist RP */ + -5, /* (244) eidlist ::= eidlist COMMA nm collate sortorder */ + -3, /* (245) eidlist ::= nm collate sortorder */ + 0, /* (246) collate ::= */ + -2, /* (247) collate ::= COLLATE ID|STRING */ + -4, /* (248) cmd ::= DROP INDEX ifexists fullname */ + -2, /* (249) cmd ::= VACUUM vinto */ + -3, /* (250) cmd ::= VACUUM nm vinto */ + -2, /* (251) vinto ::= INTO expr */ + 0, /* (252) vinto ::= */ + -3, /* (253) cmd ::= PRAGMA nm dbnm */ + -5, /* (254) cmd ::= PRAGMA nm dbnm EQ nmnum */ + -6, /* (255) cmd ::= PRAGMA nm dbnm LP nmnum RP */ + -5, /* (256) cmd ::= PRAGMA nm dbnm EQ minus_num */ + -6, /* (257) cmd ::= PRAGMA nm dbnm LP minus_num RP */ + -2, /* (258) plus_num ::= PLUS INTEGER|FLOAT */ + -2, /* (259) minus_num ::= MINUS INTEGER|FLOAT */ + -5, /* (260) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ + -11, /* (261) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ + -1, /* (262) trigger_time ::= BEFORE|AFTER */ + -2, /* (263) trigger_time ::= INSTEAD OF */ + 0, /* (264) trigger_time ::= */ + -1, /* (265) trigger_event ::= DELETE|INSERT */ + -1, /* (266) trigger_event ::= UPDATE */ + -3, /* (267) trigger_event ::= UPDATE OF idlist */ + 0, /* (268) when_clause ::= */ + -2, /* (269) when_clause ::= WHEN expr */ + -3, /* (270) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ + -2, /* (271) trigger_cmd_list ::= trigger_cmd SEMI */ + -3, /* (272) trnm ::= nm DOT nm */ + -3, /* (273) tridxby ::= INDEXED BY nm */ + -2, /* (274) tridxby ::= NOT INDEXED */ + -9, /* (275) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ + -8, /* (276) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ + -6, /* (277) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ + -3, /* (278) trigger_cmd ::= scanpt select scanpt */ + -4, /* (279) expr ::= RAISE LP IGNORE RP */ + -6, /* (280) expr ::= RAISE LP raisetype COMMA nm RP */ + -1, /* (281) raisetype ::= ROLLBACK */ + -1, /* (282) raisetype ::= ABORT */ + -1, /* (283) raisetype ::= FAIL */ + -4, /* (284) cmd ::= DROP TRIGGER ifexists fullname */ + -6, /* (285) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ + -3, /* (286) cmd ::= DETACH database_kw_opt expr */ + 0, /* (287) key_opt ::= */ + -2, /* (288) key_opt ::= KEY expr */ + -1, /* (289) cmd ::= REINDEX */ + -3, /* (290) cmd ::= REINDEX nm dbnm */ + -1, /* (291) cmd ::= ANALYZE */ + -3, /* (292) cmd ::= ANALYZE nm dbnm */ + -6, /* (293) cmd ::= ALTER TABLE fullname RENAME TO nm */ + -7, /* (294) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ + -6, /* (295) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ + -1, /* (296) add_column_fullname ::= fullname */ + -8, /* (297) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ + -1, /* (298) cmd ::= create_vtab */ + -4, /* (299) cmd ::= create_vtab LP vtabarglist RP */ + -8, /* (300) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ + 0, /* (301) vtabarg ::= */ + -1, /* (302) vtabargtoken ::= ANY */ + -3, /* (303) vtabargtoken ::= lp anylist RP */ + -1, /* (304) lp ::= LP */ + -2, /* (305) with ::= WITH wqlist */ + -3, /* (306) with ::= WITH RECURSIVE wqlist */ + -1, /* (307) wqas ::= AS */ + -2, /* (308) wqas ::= AS MATERIALIZED */ + -3, /* (309) wqas ::= AS NOT MATERIALIZED */ + -6, /* (310) wqitem ::= withnm eidlist_opt wqas LP select RP */ + -1, /* (311) withnm ::= nm */ + -1, /* (312) wqlist ::= wqitem */ + -3, /* (313) wqlist ::= wqlist COMMA wqitem */ + -3, /* (314) windowdefn_list ::= windowdefn_list COMMA windowdefn */ + -5, /* (315) windowdefn ::= nm AS LP window RP */ + -5, /* (316) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ + -6, /* (317) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ + -4, /* (318) window ::= ORDER BY sortlist frame_opt */ + -5, /* (319) window ::= nm ORDER BY sortlist frame_opt */ + -2, /* (320) window ::= nm frame_opt */ + 0, /* (321) frame_opt ::= */ + -3, /* (322) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ + -6, /* (323) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ + -1, /* (324) range_or_rows ::= RANGE|ROWS|GROUPS */ + -1, /* (325) frame_bound_s ::= frame_bound */ + -2, /* (326) frame_bound_s ::= UNBOUNDED PRECEDING */ + -1, /* (327) frame_bound_e ::= frame_bound */ + -2, /* (328) frame_bound_e ::= UNBOUNDED FOLLOWING */ + -2, /* (329) frame_bound ::= expr PRECEDING|FOLLOWING */ + -2, /* (330) frame_bound ::= CURRENT ROW */ + 0, /* (331) frame_exclude_opt ::= */ + -2, /* (332) frame_exclude_opt ::= EXCLUDE frame_exclude */ + -2, /* (333) frame_exclude ::= NO OTHERS */ + -2, /* (334) frame_exclude ::= CURRENT ROW */ + -1, /* (335) frame_exclude ::= GROUP|TIES */ + -2, /* (336) window_clause ::= WINDOW windowdefn_list */ + -2, /* (337) filter_over ::= filter_clause over_clause */ + -1, /* (338) filter_over ::= over_clause */ + -1, /* (339) filter_over ::= filter_clause */ + -4, /* (340) over_clause ::= OVER LP window RP */ + -2, /* (341) over_clause ::= OVER nm */ + -5, /* (342) filter_clause ::= FILTER LP WHERE expr RP */ + -1, /* (343) term ::= QNUMBER */ + -1, /* (344) input ::= cmdlist */ + -2, /* (345) cmdlist ::= cmdlist ecmd */ + -1, /* (346) cmdlist ::= ecmd */ + -1, /* (347) ecmd ::= SEMI */ + -2, /* (348) ecmd ::= cmdx SEMI */ + -3, /* (349) ecmd ::= explain cmdx SEMI */ + 0, /* (350) trans_opt ::= */ + -1, /* (351) trans_opt ::= TRANSACTION */ + -2, /* (352) trans_opt ::= TRANSACTION nm */ + -1, /* (353) savepoint_opt ::= SAVEPOINT */ + 0, /* (354) savepoint_opt ::= */ + -2, /* (355) cmd ::= create_table create_table_args */ + -1, /* (356) table_option_set ::= table_option */ + -4, /* (357) columnlist ::= columnlist COMMA columnname carglist */ + -2, /* (358) columnlist ::= columnname carglist */ + -1, /* (359) nm ::= ID|INDEXED|JOIN_KW */ + -1, /* (360) nm ::= STRING */ + -1, /* (361) typetoken ::= typename */ + -1, /* (362) typename ::= ID|STRING */ + -1, /* (363) signed ::= plus_num */ + -1, /* (364) signed ::= minus_num */ + -2, /* (365) carglist ::= carglist ccons */ + 0, /* (366) carglist ::= */ + -2, /* (367) ccons ::= NULL onconf */ + -4, /* (368) ccons ::= GENERATED ALWAYS AS generated */ + -2, /* (369) ccons ::= AS generated */ + -2, /* (370) conslist_opt ::= COMMA conslist */ + -3, /* (371) conslist ::= conslist tconscomma tcons */ + -1, /* (372) conslist ::= tcons */ + 0, /* (373) tconscomma ::= */ + -1, /* (374) defer_subclause_opt ::= defer_subclause */ + -1, /* (375) resolvetype ::= raisetype */ + -1, /* (376) selectnowith ::= oneselect */ + -1, /* (377) oneselect ::= values */ + -2, /* (378) sclp ::= selcollist COMMA */ + -1, /* (379) as ::= ID|STRING */ + -1, /* (380) indexed_opt ::= indexed_by */ + 0, /* (381) returning ::= */ + -1, /* (382) expr ::= term */ + -1, /* (383) likeop ::= LIKE_KW|MATCH */ + -1, /* (384) case_operand ::= expr */ + -1, /* (385) exprlist ::= nexprlist */ + -1, /* (386) nmnum ::= plus_num */ + -1, /* (387) nmnum ::= nm */ + -1, /* (388) nmnum ::= ON */ + -1, /* (389) nmnum ::= DELETE */ + -1, /* (390) nmnum ::= DEFAULT */ + -1, /* (391) plus_num ::= INTEGER|FLOAT */ + 0, /* (392) foreach_clause ::= */ + -3, /* (393) foreach_clause ::= FOR EACH ROW */ + -1, /* (394) trnm ::= nm */ + 0, /* (395) tridxby ::= */ + -1, /* (396) database_kw_opt ::= DATABASE */ + 0, /* (397) database_kw_opt ::= */ + 0, /* (398) kwcolumn_opt ::= */ + -1, /* (399) kwcolumn_opt ::= COLUMNKW */ + -1, /* (400) vtabarglist ::= vtabarg */ + -3, /* (401) vtabarglist ::= vtabarglist COMMA vtabarg */ + -2, /* (402) vtabarg ::= vtabarg vtabargtoken */ + 0, /* (403) anylist ::= */ + -4, /* (404) anylist ::= anylist LP anylist RP */ + -2, /* (405) anylist ::= anylist ANY */ + 0, /* (406) with ::= */ + -1, /* (407) windowdefn_list ::= windowdefn */ + -1, /* (408) window ::= frame_opt */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -172812,16 +176126,16 @@ static YYACTIONTYPE yy_reduce( { sqlite3FinishCoding(pParse); } break; case 3: /* cmd ::= BEGIN transtype trans_opt */ -{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy394);} +{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy144);} break; case 4: /* transtype ::= */ -{yymsp[1].minor.yy394 = TK_DEFERRED;} +{yymsp[1].minor.yy144 = TK_DEFERRED;} break; case 5: /* transtype ::= DEFERRED */ case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6); case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7); - case 319: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==319); -{yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/} + case 324: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==324); +{yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-X*/} break; case 8: /* cmd ::= COMMIT|END trans_opt */ case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9); @@ -172844,7 +176158,7 @@ static YYACTIONTYPE yy_reduce( break; case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ { - sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy394,0,0,yymsp[-2].minor.yy394); + sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy144,0,0,yymsp[-2].minor.yy144); } break; case 14: /* createkw ::= CREATE */ @@ -172856,40 +176170,40 @@ static YYACTIONTYPE yy_reduce( case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62); case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72); case 81: /* ifexists ::= */ yytestcase(yyruleno==81); - case 98: /* distinct ::= */ yytestcase(yyruleno==98); - case 242: /* collate ::= */ yytestcase(yyruleno==242); -{yymsp[1].minor.yy394 = 0;} + case 100: /* distinct ::= */ yytestcase(yyruleno==100); + case 246: /* collate ::= */ yytestcase(yyruleno==246); +{yymsp[1].minor.yy144 = 0;} break; case 16: /* ifnotexists ::= IF NOT EXISTS */ -{yymsp[-2].minor.yy394 = 1;} +{yymsp[-2].minor.yy144 = 1;} break; case 17: /* temp ::= TEMP */ -{yymsp[0].minor.yy394 = pParse->db->init.busy==0;} +{yymsp[0].minor.yy144 = pParse->db->init.busy==0;} break; case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ { - sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy285,0); + sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy391,0); } break; case 20: /* create_table_args ::= AS select */ { - sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy47); - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy47); + sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy555); + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy555); } break; case 21: /* table_option_set ::= */ -{yymsp[1].minor.yy285 = 0;} +{yymsp[1].minor.yy391 = 0;} break; case 22: /* table_option_set ::= table_option_set COMMA table_option */ -{yylhsminor.yy285 = yymsp[-2].minor.yy285|yymsp[0].minor.yy285;} - yymsp[-2].minor.yy285 = yylhsminor.yy285; +{yylhsminor.yy391 = yymsp[-2].minor.yy391|yymsp[0].minor.yy391;} + yymsp[-2].minor.yy391 = yylhsminor.yy391; break; case 23: /* table_option ::= WITHOUT nm */ { if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){ - yymsp[-1].minor.yy285 = TF_WithoutRowid | TF_NoVisibleRowid; + yymsp[-1].minor.yy391 = TF_WithoutRowid | TF_NoVisibleRowid; }else{ - yymsp[-1].minor.yy285 = 0; + yymsp[-1].minor.yy391 = 0; sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); } } @@ -172897,20 +176211,20 @@ static YYACTIONTYPE yy_reduce( case 24: /* table_option ::= nm */ { if( yymsp[0].minor.yy0.n==6 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"strict",6)==0 ){ - yylhsminor.yy285 = TF_Strict; + yylhsminor.yy391 = TF_Strict; }else{ - yylhsminor.yy285 = 0; + yylhsminor.yy391 = 0; sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); } } - yymsp[0].minor.yy285 = yylhsminor.yy285; + yymsp[0].minor.yy391 = yylhsminor.yy391; break; case 25: /* columnname ::= nm typetoken */ {sqlite3AddColumn(pParse,yymsp[-1].minor.yy0,yymsp[0].minor.yy0);} break; case 26: /* typetoken ::= */ case 65: /* conslist_opt ::= */ yytestcase(yyruleno==65); - case 104: /* as ::= */ yytestcase(yyruleno==104); + case 106: /* as ::= */ yytestcase(yyruleno==106); {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;} break; case 27: /* typetoken ::= typename LP signed RP */ @@ -172929,7 +176243,7 @@ static YYACTIONTYPE yy_reduce( case 30: /* scanpt ::= */ { assert( yyLookahead!=YYNOCODE ); - yymsp[1].minor.yy522 = yyLookaheadToken.z; + yymsp[1].minor.yy168 = yyLookaheadToken.z; } break; case 31: /* scantok ::= */ @@ -172943,17 +176257,17 @@ static YYACTIONTYPE yy_reduce( {pParse->constraintName = yymsp[0].minor.yy0;} break; case 33: /* ccons ::= DEFAULT scantok term */ -{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy528,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} +{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} break; case 34: /* ccons ::= DEFAULT LP expr RP */ -{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy528,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);} +{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);} break; case 35: /* ccons ::= DEFAULT PLUS scantok term */ -{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy528,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} +{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} break; case 36: /* ccons ::= DEFAULT MINUS scantok term */ { - Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy528, 0); + Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy454, 0); sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]); } break; @@ -172968,151 +176282,151 @@ static YYACTIONTYPE yy_reduce( } break; case 38: /* ccons ::= NOT NULL onconf */ -{sqlite3AddNotNull(pParse, yymsp[0].minor.yy394);} +{sqlite3AddNotNull(pParse, yymsp[0].minor.yy144);} break; case 39: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ -{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy394,yymsp[0].minor.yy394,yymsp[-2].minor.yy394);} +{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy144,yymsp[0].minor.yy144,yymsp[-2].minor.yy144);} break; case 40: /* ccons ::= UNIQUE onconf */ -{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy394,0,0,0,0, +{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy144,0,0,0,0, SQLITE_IDXTYPE_UNIQUE);} break; case 41: /* ccons ::= CHECK LP expr RP */ -{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy528,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);} +{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy454,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);} break; case 42: /* ccons ::= REFERENCES nm eidlist_opt refargs */ -{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy322,yymsp[0].minor.yy394);} +{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy14,yymsp[0].minor.yy144);} break; case 43: /* ccons ::= defer_subclause */ -{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy394);} +{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy144);} break; case 44: /* ccons ::= COLLATE ID|STRING */ {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);} break; case 45: /* generated ::= LP expr RP */ -{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy528,0);} +{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy454,0);} break; case 46: /* generated ::= LP expr RP ID */ -{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy528,&yymsp[0].minor.yy0);} +{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy454,&yymsp[0].minor.yy0);} break; case 48: /* autoinc ::= AUTOINCR */ -{yymsp[0].minor.yy394 = 1;} +{yymsp[0].minor.yy144 = 1;} break; case 49: /* refargs ::= */ -{ yymsp[1].minor.yy394 = OE_None*0x0101; /* EV: R-19803-45884 */} +{ yymsp[1].minor.yy144 = OE_None*0x0101; /* EV: R-19803-45884 */} break; case 50: /* refargs ::= refargs refarg */ -{ yymsp[-1].minor.yy394 = (yymsp[-1].minor.yy394 & ~yymsp[0].minor.yy231.mask) | yymsp[0].minor.yy231.value; } +{ yymsp[-1].minor.yy144 = (yymsp[-1].minor.yy144 & ~yymsp[0].minor.yy383.mask) | yymsp[0].minor.yy383.value; } break; case 51: /* refarg ::= MATCH nm */ -{ yymsp[-1].minor.yy231.value = 0; yymsp[-1].minor.yy231.mask = 0x000000; } +{ yymsp[-1].minor.yy383.value = 0; yymsp[-1].minor.yy383.mask = 0x000000; } break; case 52: /* refarg ::= ON INSERT refact */ -{ yymsp[-2].minor.yy231.value = 0; yymsp[-2].minor.yy231.mask = 0x000000; } +{ yymsp[-2].minor.yy383.value = 0; yymsp[-2].minor.yy383.mask = 0x000000; } break; case 53: /* refarg ::= ON DELETE refact */ -{ yymsp[-2].minor.yy231.value = yymsp[0].minor.yy394; yymsp[-2].minor.yy231.mask = 0x0000ff; } +{ yymsp[-2].minor.yy383.value = yymsp[0].minor.yy144; yymsp[-2].minor.yy383.mask = 0x0000ff; } break; case 54: /* refarg ::= ON UPDATE refact */ -{ yymsp[-2].minor.yy231.value = yymsp[0].minor.yy394<<8; yymsp[-2].minor.yy231.mask = 0x00ff00; } +{ yymsp[-2].minor.yy383.value = yymsp[0].minor.yy144<<8; yymsp[-2].minor.yy383.mask = 0x00ff00; } break; case 55: /* refact ::= SET NULL */ -{ yymsp[-1].minor.yy394 = OE_SetNull; /* EV: R-33326-45252 */} +{ yymsp[-1].minor.yy144 = OE_SetNull; /* EV: R-33326-45252 */} break; case 56: /* refact ::= SET DEFAULT */ -{ yymsp[-1].minor.yy394 = OE_SetDflt; /* EV: R-33326-45252 */} +{ yymsp[-1].minor.yy144 = OE_SetDflt; /* EV: R-33326-45252 */} break; case 57: /* refact ::= CASCADE */ -{ yymsp[0].minor.yy394 = OE_Cascade; /* EV: R-33326-45252 */} +{ yymsp[0].minor.yy144 = OE_Cascade; /* EV: R-33326-45252 */} break; case 58: /* refact ::= RESTRICT */ -{ yymsp[0].minor.yy394 = OE_Restrict; /* EV: R-33326-45252 */} +{ yymsp[0].minor.yy144 = OE_Restrict; /* EV: R-33326-45252 */} break; case 59: /* refact ::= NO ACTION */ -{ yymsp[-1].minor.yy394 = OE_None; /* EV: R-33326-45252 */} +{ yymsp[-1].minor.yy144 = OE_None; /* EV: R-33326-45252 */} break; case 60: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ -{yymsp[-2].minor.yy394 = 0;} +{yymsp[-2].minor.yy144 = 0;} break; case 61: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ case 76: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==76); - case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171); -{yymsp[-1].minor.yy394 = yymsp[0].minor.yy394;} + case 173: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==173); +{yymsp[-1].minor.yy144 = yymsp[0].minor.yy144;} break; case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80); - case 215: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==215); - case 218: /* in_op ::= NOT IN */ yytestcase(yyruleno==218); - case 243: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==243); -{yymsp[-1].minor.yy394 = 1;} + case 219: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==219); + case 222: /* in_op ::= NOT IN */ yytestcase(yyruleno==222); + case 247: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==247); +{yymsp[-1].minor.yy144 = 1;} break; case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ -{yymsp[-1].minor.yy394 = 0;} +{yymsp[-1].minor.yy144 = 0;} break; case 66: /* tconscomma ::= COMMA */ {pParse->constraintName.n = 0;} break; case 68: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ -{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy322,yymsp[0].minor.yy394,yymsp[-2].minor.yy394,0);} +{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy14,yymsp[0].minor.yy144,yymsp[-2].minor.yy144,0);} break; case 69: /* tcons ::= UNIQUE LP sortlist RP onconf */ -{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy322,yymsp[0].minor.yy394,0,0,0,0, +{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy14,yymsp[0].minor.yy144,0,0,0,0, SQLITE_IDXTYPE_UNIQUE);} break; case 70: /* tcons ::= CHECK LP expr RP onconf */ -{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy528,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);} +{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy454,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);} break; case 71: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ { - sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy322, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[-1].minor.yy394); - sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy394); + sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy14, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy14, yymsp[-1].minor.yy144); + sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy144); } break; case 73: /* onconf ::= */ case 75: /* orconf ::= */ yytestcase(yyruleno==75); -{yymsp[1].minor.yy394 = OE_Default;} +{yymsp[1].minor.yy144 = OE_Default;} break; case 74: /* onconf ::= ON CONFLICT resolvetype */ -{yymsp[-2].minor.yy394 = yymsp[0].minor.yy394;} +{yymsp[-2].minor.yy144 = yymsp[0].minor.yy144;} break; case 77: /* resolvetype ::= IGNORE */ -{yymsp[0].minor.yy394 = OE_Ignore;} +{yymsp[0].minor.yy144 = OE_Ignore;} break; case 78: /* resolvetype ::= REPLACE */ - case 172: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==172); -{yymsp[0].minor.yy394 = OE_Replace;} + case 174: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==174); +{yymsp[0].minor.yy144 = OE_Replace;} break; case 79: /* cmd ::= DROP TABLE ifexists fullname */ { - sqlite3DropTable(pParse, yymsp[0].minor.yy131, 0, yymsp[-1].minor.yy394); + sqlite3DropTable(pParse, yymsp[0].minor.yy203, 0, yymsp[-1].minor.yy144); } break; case 82: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ { - sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[0].minor.yy47, yymsp[-7].minor.yy394, yymsp[-5].minor.yy394); + sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy14, yymsp[0].minor.yy555, yymsp[-7].minor.yy144, yymsp[-5].minor.yy144); } break; case 83: /* cmd ::= DROP VIEW ifexists fullname */ { - sqlite3DropTable(pParse, yymsp[0].minor.yy131, 1, yymsp[-1].minor.yy394); + sqlite3DropTable(pParse, yymsp[0].minor.yy203, 1, yymsp[-1].minor.yy144); } break; case 84: /* cmd ::= select */ { SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0}; - sqlite3Select(pParse, yymsp[0].minor.yy47, &dest); - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy47); + sqlite3Select(pParse, yymsp[0].minor.yy555, &dest); + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy555); } break; case 85: /* select ::= WITH wqlist selectnowith */ -{yymsp[-2].minor.yy47 = attachWithToSelect(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy521);} +{yymsp[-2].minor.yy555 = attachWithToSelect(pParse,yymsp[0].minor.yy555,yymsp[-1].minor.yy59);} break; case 86: /* select ::= WITH RECURSIVE wqlist selectnowith */ -{yymsp[-3].minor.yy47 = attachWithToSelect(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy521);} +{yymsp[-3].minor.yy555 = attachWithToSelect(pParse,yymsp[0].minor.yy555,yymsp[-1].minor.yy59);} break; case 87: /* select ::= selectnowith */ { - Select *p = yymsp[0].minor.yy47; + Select *p = yymsp[0].minor.yy555; if( p ){ parserDoubleLinkSelect(pParse, p); } @@ -173120,8 +176434,8 @@ static YYACTIONTYPE yy_reduce( break; case 88: /* selectnowith ::= selectnowith multiselect_op oneselect */ { - Select *pRhs = yymsp[0].minor.yy47; - Select *pLhs = yymsp[-2].minor.yy47; + Select *pRhs = yymsp[0].minor.yy555; + Select *pLhs = yymsp[-2].minor.yy555; if( pRhs && pRhs->pPrior ){ SrcList *pFrom; Token x; @@ -173131,148 +176445,145 @@ static YYACTIONTYPE yy_reduce( pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0); } if( pRhs ){ - pRhs->op = (u8)yymsp[-1].minor.yy394; + pRhs->op = (u8)yymsp[-1].minor.yy144; pRhs->pPrior = pLhs; if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue; pRhs->selFlags &= ~SF_MultiValue; - if( yymsp[-1].minor.yy394!=TK_ALL ) pParse->hasCompound = 1; + if( yymsp[-1].minor.yy144!=TK_ALL ) pParse->hasCompound = 1; }else{ sqlite3SelectDelete(pParse->db, pLhs); } - yymsp[-2].minor.yy47 = pRhs; + yymsp[-2].minor.yy555 = pRhs; } break; case 89: /* multiselect_op ::= UNION */ case 91: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==91); -{yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-OP*/} +{yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-OP*/} break; case 90: /* multiselect_op ::= UNION ALL */ -{yymsp[-1].minor.yy394 = TK_ALL;} +{yymsp[-1].minor.yy144 = TK_ALL;} break; case 92: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ { - yymsp[-8].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy322,yymsp[-5].minor.yy131,yymsp[-4].minor.yy528,yymsp[-3].minor.yy322,yymsp[-2].minor.yy528,yymsp[-1].minor.yy322,yymsp[-7].minor.yy394,yymsp[0].minor.yy528); + yymsp[-8].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy14,yymsp[-5].minor.yy203,yymsp[-4].minor.yy454,yymsp[-3].minor.yy14,yymsp[-2].minor.yy454,yymsp[-1].minor.yy14,yymsp[-7].minor.yy144,yymsp[0].minor.yy454); } break; case 93: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ { - yymsp[-9].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy322,yymsp[-6].minor.yy131,yymsp[-5].minor.yy528,yymsp[-4].minor.yy322,yymsp[-3].minor.yy528,yymsp[-1].minor.yy322,yymsp[-8].minor.yy394,yymsp[0].minor.yy528); - if( yymsp[-9].minor.yy47 ){ - yymsp[-9].minor.yy47->pWinDefn = yymsp[-2].minor.yy41; + yymsp[-9].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy14,yymsp[-6].minor.yy203,yymsp[-5].minor.yy454,yymsp[-4].minor.yy14,yymsp[-3].minor.yy454,yymsp[-1].minor.yy14,yymsp[-8].minor.yy144,yymsp[0].minor.yy454); + if( yymsp[-9].minor.yy555 ){ + yymsp[-9].minor.yy555->pWinDefn = yymsp[-2].minor.yy211; }else{ - sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy41); + sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy211); } } break; case 94: /* values ::= VALUES LP nexprlist RP */ { - yymsp[-3].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values,0); + yymsp[-3].minor.yy555 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy14,0,0,0,0,0,SF_Values,0); } break; - case 95: /* values ::= values COMMA LP nexprlist RP */ + case 95: /* oneselect ::= mvalues */ { - Select *pRight, *pLeft = yymsp[-4].minor.yy47; - pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values|SF_MultiValue,0); - if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue; - if( pRight ){ - pRight->op = TK_ALL; - pRight->pPrior = pLeft; - yymsp[-4].minor.yy47 = pRight; - }else{ - yymsp[-4].minor.yy47 = pLeft; - } + sqlite3MultiValuesEnd(pParse, yymsp[0].minor.yy555); +} + break; + case 96: /* mvalues ::= values COMMA LP nexprlist RP */ + case 97: /* mvalues ::= mvalues COMMA LP nexprlist RP */ yytestcase(yyruleno==97); +{ + yymsp[-4].minor.yy555 = sqlite3MultiValues(pParse, yymsp[-4].minor.yy555, yymsp[-1].minor.yy14); } break; - case 96: /* distinct ::= DISTINCT */ -{yymsp[0].minor.yy394 = SF_Distinct;} + case 98: /* distinct ::= DISTINCT */ +{yymsp[0].minor.yy144 = SF_Distinct;} break; - case 97: /* distinct ::= ALL */ -{yymsp[0].minor.yy394 = SF_All;} + case 99: /* distinct ::= ALL */ +{yymsp[0].minor.yy144 = SF_All;} break; - case 99: /* sclp ::= */ - case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132); - case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142); - case 230: /* exprlist ::= */ yytestcase(yyruleno==230); - case 233: /* paren_exprlist ::= */ yytestcase(yyruleno==233); - case 238: /* eidlist_opt ::= */ yytestcase(yyruleno==238); -{yymsp[1].minor.yy322 = 0;} + case 101: /* sclp ::= */ + case 134: /* orderby_opt ::= */ yytestcase(yyruleno==134); + case 144: /* groupby_opt ::= */ yytestcase(yyruleno==144); + case 234: /* exprlist ::= */ yytestcase(yyruleno==234); + case 237: /* paren_exprlist ::= */ yytestcase(yyruleno==237); + case 242: /* eidlist_opt ::= */ yytestcase(yyruleno==242); +{yymsp[1].minor.yy14 = 0;} break; - case 100: /* selcollist ::= sclp scanpt expr scanpt as */ + case 102: /* selcollist ::= sclp scanpt expr scanpt as */ { - yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy528); - if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[0].minor.yy0, 1); - sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy322,yymsp[-3].minor.yy522,yymsp[-1].minor.yy522); + yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy14, yymsp[-2].minor.yy454); + if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy14, &yymsp[0].minor.yy0, 1); + sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy14,yymsp[-3].minor.yy168,yymsp[-1].minor.yy168); } break; - case 101: /* selcollist ::= sclp scanpt STAR */ + case 103: /* selcollist ::= sclp scanpt STAR */ { Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0); sqlite3ExprSetErrorOffset(p, (int)(yymsp[0].minor.yy0.z - pParse->zTail)); - yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy322, p); + yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy14, p); } break; - case 102: /* selcollist ::= sclp scanpt nm DOT STAR */ + case 104: /* selcollist ::= sclp scanpt nm DOT STAR */ { Expr *pRight, *pLeft, *pDot; pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0); sqlite3ExprSetErrorOffset(pRight, (int)(yymsp[0].minor.yy0.z - pParse->zTail)); pLeft = tokenExpr(pParse, TK_ID, yymsp[-2].minor.yy0); pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight); - yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot); + yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, pDot); } break; - case 103: /* as ::= AS nm */ - case 115: /* dbnm ::= DOT nm */ yytestcase(yyruleno==115); - case 254: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==254); - case 255: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==255); + case 105: /* as ::= AS nm */ + case 117: /* dbnm ::= DOT nm */ yytestcase(yyruleno==117); + case 258: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==258); + case 259: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==259); {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;} break; - case 105: /* from ::= */ - case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108); -{yymsp[1].minor.yy131 = 0;} + case 107: /* from ::= */ + case 110: /* stl_prefix ::= */ yytestcase(yyruleno==110); +{yymsp[1].minor.yy203 = 0;} break; - case 106: /* from ::= FROM seltablist */ + case 108: /* from ::= FROM seltablist */ { - yymsp[-1].minor.yy131 = yymsp[0].minor.yy131; - sqlite3SrcListShiftJoinType(pParse,yymsp[-1].minor.yy131); + yymsp[-1].minor.yy203 = yymsp[0].minor.yy203; + sqlite3SrcListShiftJoinType(pParse,yymsp[-1].minor.yy203); } break; - case 107: /* stl_prefix ::= seltablist joinop */ + case 109: /* stl_prefix ::= seltablist joinop */ { - if( ALWAYS(yymsp[-1].minor.yy131 && yymsp[-1].minor.yy131->nSrc>0) ) yymsp[-1].minor.yy131->a[yymsp[-1].minor.yy131->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy394; + if( ALWAYS(yymsp[-1].minor.yy203 && yymsp[-1].minor.yy203->nSrc>0) ) yymsp[-1].minor.yy203->a[yymsp[-1].minor.yy203->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy144; } break; - case 109: /* seltablist ::= stl_prefix nm dbnm as on_using */ + case 111: /* seltablist ::= stl_prefix nm dbnm as on_using */ { - yymsp[-4].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-4].minor.yy131,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy561); + yymsp[-4].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-4].minor.yy203,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269); } break; - case 110: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ + case 112: /* seltablist ::= stl_prefix nm dbnm as indexed_by on_using */ { - yymsp[-5].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy131,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,0,&yymsp[0].minor.yy561); - sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy131, &yymsp[-1].minor.yy0); + yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,0,&yymsp[0].minor.yy269); + sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy203, &yymsp[-1].minor.yy0); } break; - case 111: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ + case 113: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_using */ { - yymsp[-7].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-7].minor.yy131,&yymsp[-6].minor.yy0,&yymsp[-5].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy561); - sqlite3SrcListFuncArgs(pParse, yymsp[-7].minor.yy131, yymsp[-3].minor.yy322); + yymsp[-7].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-7].minor.yy203,&yymsp[-6].minor.yy0,&yymsp[-5].minor.yy0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269); + sqlite3SrcListFuncArgs(pParse, yymsp[-7].minor.yy203, yymsp[-3].minor.yy14); } break; - case 112: /* seltablist ::= stl_prefix LP select RP as on_using */ + case 114: /* seltablist ::= stl_prefix LP select RP as on_using */ { - yymsp[-5].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy131,0,0,&yymsp[-1].minor.yy0,yymsp[-3].minor.yy47,&yymsp[0].minor.yy561); + yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,yymsp[-3].minor.yy555,&yymsp[0].minor.yy269); } break; - case 113: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ + case 115: /* seltablist ::= stl_prefix LP seltablist RP as on_using */ { - if( yymsp[-5].minor.yy131==0 && yymsp[-1].minor.yy0.n==0 && yymsp[0].minor.yy561.pOn==0 && yymsp[0].minor.yy561.pUsing==0 ){ - yymsp[-5].minor.yy131 = yymsp[-3].minor.yy131; - }else if( ALWAYS(yymsp[-3].minor.yy131!=0) && yymsp[-3].minor.yy131->nSrc==1 ){ - yymsp[-5].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy131,0,0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy561); - if( yymsp[-5].minor.yy131 ){ - SrcItem *pNew = &yymsp[-5].minor.yy131->a[yymsp[-5].minor.yy131->nSrc-1]; - SrcItem *pOld = yymsp[-3].minor.yy131->a; + if( yymsp[-5].minor.yy203==0 && yymsp[-1].minor.yy0.n==0 && yymsp[0].minor.yy269.pOn==0 && yymsp[0].minor.yy269.pUsing==0 ){ + yymsp[-5].minor.yy203 = yymsp[-3].minor.yy203; + }else if( ALWAYS(yymsp[-3].minor.yy203!=0) && yymsp[-3].minor.yy203->nSrc==1 ){ + yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,0,&yymsp[0].minor.yy269); + if( yymsp[-5].minor.yy203 ){ + SrcItem *pNew = &yymsp[-5].minor.yy203->a[yymsp[-5].minor.yy203->nSrc-1]; + SrcItem *pOld = yymsp[-3].minor.yy203->a; pNew->zName = pOld->zName; pNew->zDatabase = pOld->zDatabase; pNew->pSelect = pOld->pSelect; @@ -173288,153 +176599,153 @@ static YYACTIONTYPE yy_reduce( pOld->zName = pOld->zDatabase = 0; pOld->pSelect = 0; } - sqlite3SrcListDelete(pParse->db, yymsp[-3].minor.yy131); + sqlite3SrcListDelete(pParse->db, yymsp[-3].minor.yy203); }else{ Select *pSubquery; - sqlite3SrcListShiftJoinType(pParse,yymsp[-3].minor.yy131); - pSubquery = sqlite3SelectNew(pParse,0,yymsp[-3].minor.yy131,0,0,0,0,SF_NestedFrom,0); - yymsp[-5].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy131,0,0,&yymsp[-1].minor.yy0,pSubquery,&yymsp[0].minor.yy561); + sqlite3SrcListShiftJoinType(pParse,yymsp[-3].minor.yy203); + pSubquery = sqlite3SelectNew(pParse,0,yymsp[-3].minor.yy203,0,0,0,0,SF_NestedFrom,0); + yymsp[-5].minor.yy203 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy203,0,0,&yymsp[-1].minor.yy0,pSubquery,&yymsp[0].minor.yy269); } } break; - case 114: /* dbnm ::= */ - case 129: /* indexed_opt ::= */ yytestcase(yyruleno==129); + case 116: /* dbnm ::= */ + case 131: /* indexed_opt ::= */ yytestcase(yyruleno==131); {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;} break; - case 116: /* fullname ::= nm */ + case 118: /* fullname ::= nm */ { - yylhsminor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); - if( IN_RENAME_OBJECT && yylhsminor.yy131 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy131->a[0].zName, &yymsp[0].minor.yy0); + yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); + if( IN_RENAME_OBJECT && yylhsminor.yy203 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy131 = yylhsminor.yy131; + yymsp[0].minor.yy203 = yylhsminor.yy203; break; - case 117: /* fullname ::= nm DOT nm */ + case 119: /* fullname ::= nm DOT nm */ { - yylhsminor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); - if( IN_RENAME_OBJECT && yylhsminor.yy131 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy131->a[0].zName, &yymsp[0].minor.yy0); + yylhsminor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); + if( IN_RENAME_OBJECT && yylhsminor.yy203 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy203->a[0].zName, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy131 = yylhsminor.yy131; + yymsp[-2].minor.yy203 = yylhsminor.yy203; break; - case 118: /* xfullname ::= nm */ -{yymsp[0].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} + case 120: /* xfullname ::= nm */ +{yymsp[0].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} break; - case 119: /* xfullname ::= nm DOT nm */ -{yymsp[-2].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} + case 121: /* xfullname ::= nm DOT nm */ +{yymsp[-2].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} break; - case 120: /* xfullname ::= nm DOT nm AS nm */ + case 122: /* xfullname ::= nm DOT nm AS nm */ { - yymsp[-4].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ - if( yymsp[-4].minor.yy131 ) yymsp[-4].minor.yy131->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); + yymsp[-4].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ + if( yymsp[-4].minor.yy203 ) yymsp[-4].minor.yy203->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); } break; - case 121: /* xfullname ::= nm AS nm */ + case 123: /* xfullname ::= nm AS nm */ { - yymsp[-2].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/ - if( yymsp[-2].minor.yy131 ) yymsp[-2].minor.yy131->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); + yymsp[-2].minor.yy203 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/ + if( yymsp[-2].minor.yy203 ) yymsp[-2].minor.yy203->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); } break; - case 122: /* joinop ::= COMMA|JOIN */ -{ yymsp[0].minor.yy394 = JT_INNER; } + case 124: /* joinop ::= COMMA|JOIN */ +{ yymsp[0].minor.yy144 = JT_INNER; } break; - case 123: /* joinop ::= JOIN_KW JOIN */ -{yymsp[-1].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} + case 125: /* joinop ::= JOIN_KW JOIN */ +{yymsp[-1].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} break; - case 124: /* joinop ::= JOIN_KW nm JOIN */ -{yymsp[-2].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} + case 126: /* joinop ::= JOIN_KW nm JOIN */ +{yymsp[-2].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} break; - case 125: /* joinop ::= JOIN_KW nm nm JOIN */ -{yymsp[-3].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} + case 127: /* joinop ::= JOIN_KW nm nm JOIN */ +{yymsp[-3].minor.yy144 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} break; - case 126: /* on_using ::= ON expr */ -{yymsp[-1].minor.yy561.pOn = yymsp[0].minor.yy528; yymsp[-1].minor.yy561.pUsing = 0;} + case 128: /* on_using ::= ON expr */ +{yymsp[-1].minor.yy269.pOn = yymsp[0].minor.yy454; yymsp[-1].minor.yy269.pUsing = 0;} break; - case 127: /* on_using ::= USING LP idlist RP */ -{yymsp[-3].minor.yy561.pOn = 0; yymsp[-3].minor.yy561.pUsing = yymsp[-1].minor.yy254;} + case 129: /* on_using ::= USING LP idlist RP */ +{yymsp[-3].minor.yy269.pOn = 0; yymsp[-3].minor.yy269.pUsing = yymsp[-1].minor.yy132;} break; - case 128: /* on_using ::= */ -{yymsp[1].minor.yy561.pOn = 0; yymsp[1].minor.yy561.pUsing = 0;} + case 130: /* on_using ::= */ +{yymsp[1].minor.yy269.pOn = 0; yymsp[1].minor.yy269.pUsing = 0;} break; - case 130: /* indexed_by ::= INDEXED BY nm */ + case 132: /* indexed_by ::= INDEXED BY nm */ {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;} break; - case 131: /* indexed_by ::= NOT INDEXED */ + case 133: /* indexed_by ::= NOT INDEXED */ {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;} break; - case 133: /* orderby_opt ::= ORDER BY sortlist */ - case 143: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==143); -{yymsp[-2].minor.yy322 = yymsp[0].minor.yy322;} + case 135: /* orderby_opt ::= ORDER BY sortlist */ + case 145: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==145); +{yymsp[-2].minor.yy14 = yymsp[0].minor.yy14;} break; - case 134: /* sortlist ::= sortlist COMMA expr sortorder nulls */ + case 136: /* sortlist ::= sortlist COMMA expr sortorder nulls */ { - yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322,yymsp[-2].minor.yy528); - sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy322,yymsp[-1].minor.yy394,yymsp[0].minor.yy394); + yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14,yymsp[-2].minor.yy454); + sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy14,yymsp[-1].minor.yy144,yymsp[0].minor.yy144); } break; - case 135: /* sortlist ::= expr sortorder nulls */ + case 137: /* sortlist ::= expr sortorder nulls */ { - yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy528); /*A-overwrites-Y*/ - sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy322,yymsp[-1].minor.yy394,yymsp[0].minor.yy394); + yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy454); /*A-overwrites-Y*/ + sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy14,yymsp[-1].minor.yy144,yymsp[0].minor.yy144); } break; - case 136: /* sortorder ::= ASC */ -{yymsp[0].minor.yy394 = SQLITE_SO_ASC;} + case 138: /* sortorder ::= ASC */ +{yymsp[0].minor.yy144 = SQLITE_SO_ASC;} break; - case 137: /* sortorder ::= DESC */ -{yymsp[0].minor.yy394 = SQLITE_SO_DESC;} + case 139: /* sortorder ::= DESC */ +{yymsp[0].minor.yy144 = SQLITE_SO_DESC;} break; - case 138: /* sortorder ::= */ - case 141: /* nulls ::= */ yytestcase(yyruleno==141); -{yymsp[1].minor.yy394 = SQLITE_SO_UNDEFINED;} + case 140: /* sortorder ::= */ + case 143: /* nulls ::= */ yytestcase(yyruleno==143); +{yymsp[1].minor.yy144 = SQLITE_SO_UNDEFINED;} break; - case 139: /* nulls ::= NULLS FIRST */ -{yymsp[-1].minor.yy394 = SQLITE_SO_ASC;} + case 141: /* nulls ::= NULLS FIRST */ +{yymsp[-1].minor.yy144 = SQLITE_SO_ASC;} break; - case 140: /* nulls ::= NULLS LAST */ -{yymsp[-1].minor.yy394 = SQLITE_SO_DESC;} + case 142: /* nulls ::= NULLS LAST */ +{yymsp[-1].minor.yy144 = SQLITE_SO_DESC;} break; - case 144: /* having_opt ::= */ - case 146: /* limit_opt ::= */ yytestcase(yyruleno==146); - case 151: /* where_opt ::= */ yytestcase(yyruleno==151); - case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153); - case 228: /* case_else ::= */ yytestcase(yyruleno==228); - case 229: /* case_operand ::= */ yytestcase(yyruleno==229); - case 248: /* vinto ::= */ yytestcase(yyruleno==248); -{yymsp[1].minor.yy528 = 0;} + case 146: /* having_opt ::= */ + case 148: /* limit_opt ::= */ yytestcase(yyruleno==148); + case 153: /* where_opt ::= */ yytestcase(yyruleno==153); + case 155: /* where_opt_ret ::= */ yytestcase(yyruleno==155); + case 232: /* case_else ::= */ yytestcase(yyruleno==232); + case 233: /* case_operand ::= */ yytestcase(yyruleno==233); + case 252: /* vinto ::= */ yytestcase(yyruleno==252); +{yymsp[1].minor.yy454 = 0;} break; - case 145: /* having_opt ::= HAVING expr */ - case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152); - case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154); - case 227: /* case_else ::= ELSE expr */ yytestcase(yyruleno==227); - case 247: /* vinto ::= INTO expr */ yytestcase(yyruleno==247); -{yymsp[-1].minor.yy528 = yymsp[0].minor.yy528;} + case 147: /* having_opt ::= HAVING expr */ + case 154: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==154); + case 156: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==156); + case 231: /* case_else ::= ELSE expr */ yytestcase(yyruleno==231); + case 251: /* vinto ::= INTO expr */ yytestcase(yyruleno==251); +{yymsp[-1].minor.yy454 = yymsp[0].minor.yy454;} break; - case 147: /* limit_opt ::= LIMIT expr */ -{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,0);} + case 149: /* limit_opt ::= LIMIT expr */ +{yymsp[-1].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,0);} break; - case 148: /* limit_opt ::= LIMIT expr OFFSET expr */ -{yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);} + case 150: /* limit_opt ::= LIMIT expr OFFSET expr */ +{yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);} break; - case 149: /* limit_opt ::= LIMIT expr COMMA expr */ -{yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,yymsp[-2].minor.yy528);} + case 151: /* limit_opt ::= LIMIT expr COMMA expr */ +{yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy454,yymsp[-2].minor.yy454);} break; - case 150: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ + case 152: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ { - sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy131, &yymsp[-1].minor.yy0); - sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy131,yymsp[0].minor.yy528,0,0); + sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy203, &yymsp[-1].minor.yy0); + sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy203,yymsp[0].minor.yy454,0,0); } break; - case 155: /* where_opt_ret ::= RETURNING selcollist */ -{sqlite3AddReturning(pParse,yymsp[0].minor.yy322); yymsp[-1].minor.yy528 = 0;} + case 157: /* where_opt_ret ::= RETURNING selcollist */ +{sqlite3AddReturning(pParse,yymsp[0].minor.yy14); yymsp[-1].minor.yy454 = 0;} break; - case 156: /* where_opt_ret ::= WHERE expr RETURNING selcollist */ -{sqlite3AddReturning(pParse,yymsp[0].minor.yy322); yymsp[-3].minor.yy528 = yymsp[-2].minor.yy528;} + case 158: /* where_opt_ret ::= WHERE expr RETURNING selcollist */ +{sqlite3AddReturning(pParse,yymsp[0].minor.yy14); yymsp[-3].minor.yy454 = yymsp[-2].minor.yy454;} break; - case 157: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ + case 159: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ { - sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy131, &yymsp[-4].minor.yy0); - sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy322,"set list"); - if( yymsp[-1].minor.yy131 ){ - SrcList *pFromClause = yymsp[-1].minor.yy131; + sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy203, &yymsp[-4].minor.yy0); + sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy14,"set list"); + if( yymsp[-1].minor.yy203 ){ + SrcList *pFromClause = yymsp[-1].minor.yy203; if( pFromClause->nSrc>1 ){ Select *pSubquery; Token as; @@ -173443,92 +176754,92 @@ static YYACTIONTYPE yy_reduce( as.z = 0; pFromClause = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&as,pSubquery,0); } - yymsp[-5].minor.yy131 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy131, pFromClause); + yymsp[-5].minor.yy203 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy203, pFromClause); } - sqlite3Update(pParse,yymsp[-5].minor.yy131,yymsp[-2].minor.yy322,yymsp[0].minor.yy528,yymsp[-6].minor.yy394,0,0,0); + sqlite3Update(pParse,yymsp[-5].minor.yy203,yymsp[-2].minor.yy14,yymsp[0].minor.yy454,yymsp[-6].minor.yy144,0,0,0); } break; - case 158: /* setlist ::= setlist COMMA nm EQ expr */ + case 160: /* setlist ::= setlist COMMA nm EQ expr */ { - yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[0].minor.yy528); - sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, 1); + yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy14, yymsp[0].minor.yy454); + sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy14, &yymsp[-2].minor.yy0, 1); } break; - case 159: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ + case 161: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ { - yymsp[-6].minor.yy322 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy322, yymsp[-3].minor.yy254, yymsp[0].minor.yy528); + yymsp[-6].minor.yy14 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy14, yymsp[-3].minor.yy132, yymsp[0].minor.yy454); } break; - case 160: /* setlist ::= nm EQ expr */ + case 162: /* setlist ::= nm EQ expr */ { - yylhsminor.yy322 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy528); - sqlite3ExprListSetName(pParse, yylhsminor.yy322, &yymsp[-2].minor.yy0, 1); + yylhsminor.yy14 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy454); + sqlite3ExprListSetName(pParse, yylhsminor.yy14, &yymsp[-2].minor.yy0, 1); } - yymsp[-2].minor.yy322 = yylhsminor.yy322; + yymsp[-2].minor.yy14 = yylhsminor.yy14; break; - case 161: /* setlist ::= LP idlist RP EQ expr */ + case 163: /* setlist ::= LP idlist RP EQ expr */ { - yymsp[-4].minor.yy322 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy254, yymsp[0].minor.yy528); + yymsp[-4].minor.yy14 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy132, yymsp[0].minor.yy454); } break; - case 162: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ + case 164: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ { - sqlite3Insert(pParse, yymsp[-3].minor.yy131, yymsp[-1].minor.yy47, yymsp[-2].minor.yy254, yymsp[-5].minor.yy394, yymsp[0].minor.yy444); + sqlite3Insert(pParse, yymsp[-3].minor.yy203, yymsp[-1].minor.yy555, yymsp[-2].minor.yy132, yymsp[-5].minor.yy144, yymsp[0].minor.yy122); } break; - case 163: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ + case 165: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ { - sqlite3Insert(pParse, yymsp[-4].minor.yy131, 0, yymsp[-3].minor.yy254, yymsp[-6].minor.yy394, 0); + sqlite3Insert(pParse, yymsp[-4].minor.yy203, 0, yymsp[-3].minor.yy132, yymsp[-6].minor.yy144, 0); } break; - case 164: /* upsert ::= */ -{ yymsp[1].minor.yy444 = 0; } + case 166: /* upsert ::= */ +{ yymsp[1].minor.yy122 = 0; } break; - case 165: /* upsert ::= RETURNING selcollist */ -{ yymsp[-1].minor.yy444 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy322); } + case 167: /* upsert ::= RETURNING selcollist */ +{ yymsp[-1].minor.yy122 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy14); } break; - case 166: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ -{ yymsp[-11].minor.yy444 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy322,yymsp[-6].minor.yy528,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528,yymsp[0].minor.yy444);} + case 168: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ +{ yymsp[-11].minor.yy122 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy14,yymsp[-6].minor.yy454,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454,yymsp[0].minor.yy122);} break; - case 167: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ -{ yymsp[-8].minor.yy444 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy322,yymsp[-3].minor.yy528,0,0,yymsp[0].minor.yy444); } + case 169: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ +{ yymsp[-8].minor.yy122 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy14,yymsp[-3].minor.yy454,0,0,yymsp[0].minor.yy122); } break; - case 168: /* upsert ::= ON CONFLICT DO NOTHING returning */ -{ yymsp[-4].minor.yy444 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); } + case 170: /* upsert ::= ON CONFLICT DO NOTHING returning */ +{ yymsp[-4].minor.yy122 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); } break; - case 169: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ -{ yymsp[-7].minor.yy444 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528,0);} + case 171: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ +{ yymsp[-7].minor.yy122 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454,0);} break; - case 170: /* returning ::= RETURNING selcollist */ -{sqlite3AddReturning(pParse,yymsp[0].minor.yy322);} + case 172: /* returning ::= RETURNING selcollist */ +{sqlite3AddReturning(pParse,yymsp[0].minor.yy14);} break; - case 173: /* idlist_opt ::= */ -{yymsp[1].minor.yy254 = 0;} + case 175: /* idlist_opt ::= */ +{yymsp[1].minor.yy132 = 0;} break; - case 174: /* idlist_opt ::= LP idlist RP */ -{yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;} + case 176: /* idlist_opt ::= LP idlist RP */ +{yymsp[-2].minor.yy132 = yymsp[-1].minor.yy132;} break; - case 175: /* idlist ::= idlist COMMA nm */ -{yymsp[-2].minor.yy254 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);} + case 177: /* idlist ::= idlist COMMA nm */ +{yymsp[-2].minor.yy132 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy132,&yymsp[0].minor.yy0);} break; - case 176: /* idlist ::= nm */ -{yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} + case 178: /* idlist ::= nm */ +{yymsp[0].minor.yy132 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} break; - case 177: /* expr ::= LP expr RP */ -{yymsp[-2].minor.yy528 = yymsp[-1].minor.yy528;} + case 179: /* expr ::= LP expr RP */ +{yymsp[-2].minor.yy454 = yymsp[-1].minor.yy454;} break; - case 178: /* expr ::= ID|INDEXED|JOIN_KW */ -{yymsp[0].minor.yy528=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} + case 180: /* expr ::= ID|INDEXED|JOIN_KW */ +{yymsp[0].minor.yy454=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} break; - case 179: /* expr ::= nm DOT nm */ + case 181: /* expr ::= nm DOT nm */ { Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0); Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); - yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); + yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); } - yymsp[-2].minor.yy528 = yylhsminor.yy528; + yymsp[-2].minor.yy454 = yylhsminor.yy454; break; - case 180: /* expr ::= nm DOT nm DOT nm */ + case 182: /* expr ::= nm DOT nm DOT nm */ { Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0); Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0); @@ -173537,27 +176848,27 @@ static YYACTIONTYPE yy_reduce( if( IN_RENAME_OBJECT ){ sqlite3RenameTokenRemap(pParse, 0, temp1); } - yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); + yylhsminor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); } - yymsp[-4].minor.yy528 = yylhsminor.yy528; + yymsp[-4].minor.yy454 = yylhsminor.yy454; break; - case 181: /* term ::= NULL|FLOAT|BLOB */ - case 182: /* term ::= STRING */ yytestcase(yyruleno==182); -{yymsp[0].minor.yy528=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/} + case 183: /* term ::= NULL|FLOAT|BLOB */ + case 184: /* term ::= STRING */ yytestcase(yyruleno==184); +{yymsp[0].minor.yy454=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/} break; - case 183: /* term ::= INTEGER */ + case 185: /* term ::= INTEGER */ { - yylhsminor.yy528 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1); - if( yylhsminor.yy528 ) yylhsminor.yy528->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail); + yylhsminor.yy454 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1); + if( yylhsminor.yy454 ) yylhsminor.yy454->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail); } - yymsp[0].minor.yy528 = yylhsminor.yy528; + yymsp[0].minor.yy454 = yylhsminor.yy454; break; - case 184: /* expr ::= VARIABLE */ + case 186: /* expr ::= VARIABLE */ { if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){ u32 n = yymsp[0].minor.yy0.n; - yymsp[0].minor.yy528 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0); - sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy528, n); + yymsp[0].minor.yy454 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0); + sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy454, n); }else{ /* When doing a nested parse, one can include terms in an expression ** that look like this: #1 #2 ... These terms refer to registers @@ -173566,179 +176877,203 @@ static YYACTIONTYPE yy_reduce( assert( t.n>=2 ); if( pParse->nested==0 ){ sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t); - yymsp[0].minor.yy528 = 0; + yymsp[0].minor.yy454 = 0; }else{ - yymsp[0].minor.yy528 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0); - if( yymsp[0].minor.yy528 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy528->iTable); + yymsp[0].minor.yy454 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0); + if( yymsp[0].minor.yy454 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy454->iTable); } } } break; - case 185: /* expr ::= expr COLLATE ID|STRING */ + case 187: /* expr ::= expr COLLATE ID|STRING */ { - yymsp[-2].minor.yy528 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy528, &yymsp[0].minor.yy0, 1); + yymsp[-2].minor.yy454 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy454, &yymsp[0].minor.yy0, 1); } break; - case 186: /* expr ::= CAST LP expr AS typetoken RP */ + case 188: /* expr ::= CAST LP expr AS typetoken RP */ { - yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1); - sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy528, yymsp[-3].minor.yy528, 0); + yymsp[-5].minor.yy454 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1); + sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy454, yymsp[-3].minor.yy454, 0); } break; - case 187: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ + case 189: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ { - yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy394); + yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy14, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy144); } - yymsp[-4].minor.yy528 = yylhsminor.yy528; + yymsp[-4].minor.yy454 = yylhsminor.yy454; break; - case 188: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ + case 190: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP */ { - yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0); + yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-4].minor.yy14, &yymsp[-7].minor.yy0, yymsp[-5].minor.yy144); + sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy454, yymsp[-1].minor.yy14); } - yymsp[-3].minor.yy528 = yylhsminor.yy528; + yymsp[-7].minor.yy454 = yylhsminor.yy454; break; - case 189: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ + case 191: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ { - yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy322, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy394); - sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41); + yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0); } - yymsp[-5].minor.yy528 = yylhsminor.yy528; + yymsp[-3].minor.yy454 = yylhsminor.yy454; break; - case 190: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ + case 192: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ { - yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0); - sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41); + yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy14, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy144); + sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211); } - yymsp[-4].minor.yy528 = yylhsminor.yy528; + yymsp[-5].minor.yy454 = yylhsminor.yy454; break; - case 191: /* term ::= CTIME_KW */ + case 193: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist ORDER BY sortlist RP filter_over */ { - yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0); + yylhsminor.yy454 = sqlite3ExprFunction(pParse, yymsp[-5].minor.yy14, &yymsp[-8].minor.yy0, yymsp[-6].minor.yy144); + sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211); + sqlite3ExprAddFunctionOrderBy(pParse, yylhsminor.yy454, yymsp[-2].minor.yy14); } - yymsp[0].minor.yy528 = yylhsminor.yy528; + yymsp[-8].minor.yy454 = yylhsminor.yy454; break; - case 192: /* expr ::= LP nexprlist COMMA expr RP */ + case 194: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ { - ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528); - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); - if( yymsp[-4].minor.yy528 ){ - yymsp[-4].minor.yy528->x.pList = pList; + yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0); + sqlite3WindowAttach(pParse, yylhsminor.yy454, yymsp[0].minor.yy211); +} + yymsp[-4].minor.yy454 = yylhsminor.yy454; + break; + case 195: /* term ::= CTIME_KW */ +{ + yylhsminor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0); +} + yymsp[0].minor.yy454 = yylhsminor.yy454; + break; + case 196: /* expr ::= LP nexprlist COMMA expr RP */ +{ + ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy14, yymsp[-1].minor.yy454); + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); + if( yymsp[-4].minor.yy454 ){ + yymsp[-4].minor.yy454->x.pList = pList; if( ALWAYS(pList->nExpr) ){ - yymsp[-4].minor.yy528->flags |= pList->a[0].pExpr->flags & EP_Propagate; + yymsp[-4].minor.yy454->flags |= pList->a[0].pExpr->flags & EP_Propagate; } }else{ sqlite3ExprListDelete(pParse->db, pList); } } break; - case 193: /* expr ::= expr AND expr */ -{yymsp[-2].minor.yy528=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);} + case 197: /* expr ::= expr AND expr */ +{yymsp[-2].minor.yy454=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);} break; - case 194: /* expr ::= expr OR expr */ - case 195: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==195); - case 196: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==196); - case 197: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==197); - case 198: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==198); - case 199: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==199); - case 200: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==200); -{yymsp[-2].minor.yy528=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);} + case 198: /* expr ::= expr OR expr */ + case 199: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==199); + case 200: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==200); + case 201: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==201); + case 202: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==202); + case 203: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==203); + case 204: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==204); +{yymsp[-2].minor.yy454=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy454,yymsp[0].minor.yy454);} break; - case 201: /* likeop ::= NOT LIKE_KW|MATCH */ + case 205: /* likeop ::= NOT LIKE_KW|MATCH */ {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/} break; - case 202: /* expr ::= expr likeop expr */ + case 206: /* expr ::= expr likeop expr */ { ExprList *pList; int bNot = yymsp[-1].minor.yy0.n & 0x80000000; yymsp[-1].minor.yy0.n &= 0x7fffffff; - pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy528); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy528); - yymsp[-2].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); - if( bNot ) yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy528, 0); - if( yymsp[-2].minor.yy528 ) yymsp[-2].minor.yy528->flags |= EP_InfixFunc; + pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy454); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy454); + yymsp[-2].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); + if( bNot ) yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy454, 0); + if( yymsp[-2].minor.yy454 ) yymsp[-2].minor.yy454->flags |= EP_InfixFunc; } break; - case 203: /* expr ::= expr likeop expr ESCAPE expr */ + case 207: /* expr ::= expr likeop expr ESCAPE expr */ { ExprList *pList; int bNot = yymsp[-3].minor.yy0.n & 0x80000000; yymsp[-3].minor.yy0.n &= 0x7fffffff; - pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy528); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528); - yymsp[-4].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0); - if( bNot ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); - if( yymsp[-4].minor.yy528 ) yymsp[-4].minor.yy528->flags |= EP_InfixFunc; + pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy454); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454); + yymsp[-4].minor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0); + if( bNot ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0); + if( yymsp[-4].minor.yy454 ) yymsp[-4].minor.yy454->flags |= EP_InfixFunc; } break; - case 204: /* expr ::= expr ISNULL|NOTNULL */ -{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy528,0);} + case 208: /* expr ::= expr ISNULL|NOTNULL */ +{yymsp[-1].minor.yy454 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy454,0);} break; - case 205: /* expr ::= expr NOT NULL */ -{yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy528,0);} + case 209: /* expr ::= expr NOT NULL */ +{yymsp[-2].minor.yy454 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy454,0);} break; - case 206: /* expr ::= expr IS expr */ + case 210: /* expr ::= expr IS expr */ { - yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy528,yymsp[0].minor.yy528); - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-2].minor.yy528, TK_ISNULL); + yymsp[-2].minor.yy454 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy454,yymsp[0].minor.yy454); + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-2].minor.yy454, TK_ISNULL); } break; - case 207: /* expr ::= expr IS NOT expr */ + case 211: /* expr ::= expr IS NOT expr */ { - yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy528,yymsp[0].minor.yy528); - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-3].minor.yy528, TK_NOTNULL); + yymsp[-3].minor.yy454 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy454,yymsp[0].minor.yy454); + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-3].minor.yy454, TK_NOTNULL); } break; - case 208: /* expr ::= expr IS NOT DISTINCT FROM expr */ + case 212: /* expr ::= expr IS NOT DISTINCT FROM expr */ { - yymsp[-5].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy528,yymsp[0].minor.yy528); - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-5].minor.yy528, TK_ISNULL); + yymsp[-5].minor.yy454 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy454,yymsp[0].minor.yy454); + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-5].minor.yy454, TK_ISNULL); } break; - case 209: /* expr ::= expr IS DISTINCT FROM expr */ + case 213: /* expr ::= expr IS DISTINCT FROM expr */ { - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy528,yymsp[0].minor.yy528); - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-4].minor.yy528, TK_NOTNULL); + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy454,yymsp[0].minor.yy454); + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy454, yymsp[-4].minor.yy454, TK_NOTNULL); } break; - case 210: /* expr ::= NOT expr */ - case 211: /* expr ::= BITNOT expr */ yytestcase(yyruleno==211); -{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy528, 0);/*A-overwrites-B*/} + case 214: /* expr ::= NOT expr */ + case 215: /* expr ::= BITNOT expr */ yytestcase(yyruleno==215); +{yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy454, 0);/*A-overwrites-B*/} break; - case 212: /* expr ::= PLUS|MINUS expr */ + case 216: /* expr ::= PLUS|MINUS expr */ { - yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy528, 0); - /*A-overwrites-B*/ + Expr *p = yymsp[0].minor.yy454; + u8 op = yymsp[-1].major + (TK_UPLUS-TK_PLUS); + assert( TK_UPLUS>TK_PLUS ); + assert( TK_UMINUS == TK_MINUS + (TK_UPLUS - TK_PLUS) ); + if( p && p->op==TK_UPLUS ){ + p->op = op; + yymsp[-1].minor.yy454 = p; + }else{ + yymsp[-1].minor.yy454 = sqlite3PExpr(pParse, op, p, 0); + /*A-overwrites-B*/ + } } break; - case 213: /* expr ::= expr PTR expr */ + case 217: /* expr ::= expr PTR expr */ { - ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy528); - pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy528); - yylhsminor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); + ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy454); + pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy454); + yylhsminor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); } - yymsp[-2].minor.yy528 = yylhsminor.yy528; + yymsp[-2].minor.yy454 = yylhsminor.yy454; break; - case 214: /* between_op ::= BETWEEN */ - case 217: /* in_op ::= IN */ yytestcase(yyruleno==217); -{yymsp[0].minor.yy394 = 0;} + case 218: /* between_op ::= BETWEEN */ + case 221: /* in_op ::= IN */ yytestcase(yyruleno==221); +{yymsp[0].minor.yy144 = 0;} break; - case 216: /* expr ::= expr between_op expr AND expr */ + case 220: /* expr ::= expr between_op expr AND expr */ { - ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528); - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy528, 0); - if( yymsp[-4].minor.yy528 ){ - yymsp[-4].minor.yy528->x.pList = pList; + ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454); + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy454, 0); + if( yymsp[-4].minor.yy454 ){ + yymsp[-4].minor.yy454->x.pList = pList; }else{ sqlite3ExprListDelete(pParse->db, pList); } - if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); + if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0); } break; - case 219: /* expr ::= expr in_op LP exprlist RP */ + case 223: /* expr ::= expr in_op LP exprlist RP */ { - if( yymsp[-1].minor.yy322==0 ){ + if( yymsp[-1].minor.yy14==0 ){ /* Expressions of the form ** ** expr1 IN () @@ -173747,208 +177082,208 @@ static YYACTIONTYPE yy_reduce( ** simplify to constants 0 (false) and 1 (true), respectively, ** regardless of the value of expr1. */ - sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy528); - yymsp[-4].minor.yy528 = sqlite3Expr(pParse->db, TK_STRING, yymsp[-3].minor.yy394 ? "true" : "false"); - if( yymsp[-4].minor.yy528 ) sqlite3ExprIdToTrueFalse(yymsp[-4].minor.yy528); - }else{ - Expr *pRHS = yymsp[-1].minor.yy322->a[0].pExpr; - if( yymsp[-1].minor.yy322->nExpr==1 && sqlite3ExprIsConstant(pRHS) && yymsp[-4].minor.yy528->op!=TK_VECTOR ){ - yymsp[-1].minor.yy322->a[0].pExpr = 0; - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322); + sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy454); + yymsp[-4].minor.yy454 = sqlite3Expr(pParse->db, TK_STRING, yymsp[-3].minor.yy144 ? "true" : "false"); + if( yymsp[-4].minor.yy454 ) sqlite3ExprIdToTrueFalse(yymsp[-4].minor.yy454); + }else{ + Expr *pRHS = yymsp[-1].minor.yy14->a[0].pExpr; + if( yymsp[-1].minor.yy14->nExpr==1 && sqlite3ExprIsConstant(pParse,pRHS) && yymsp[-4].minor.yy454->op!=TK_VECTOR ){ + yymsp[-1].minor.yy14->a[0].pExpr = 0; + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14); pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0); - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy528, pRHS); - }else if( yymsp[-1].minor.yy322->nExpr==1 && pRHS->op==TK_SELECT ){ - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pRHS->x.pSelect); + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy454, pRHS); + }else if( yymsp[-1].minor.yy14->nExpr==1 && pRHS->op==TK_SELECT ){ + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0); + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pRHS->x.pSelect); pRHS->x.pSelect = 0; - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322); - }else{ - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); - if( yymsp[-4].minor.yy528==0 ){ - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322); - }else if( yymsp[-4].minor.yy528->pLeft->op==TK_VECTOR ){ - int nExpr = yymsp[-4].minor.yy528->pLeft->x.pList->nExpr; - Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy322); + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14); + }else{ + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0); + if( yymsp[-4].minor.yy454==0 ){ + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14); + }else if( yymsp[-4].minor.yy454->pLeft->op==TK_VECTOR ){ + int nExpr = yymsp[-4].minor.yy454->pLeft->x.pList->nExpr; + Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy14); if( pSelectRHS ){ parserDoubleLinkSelect(pParse, pSelectRHS); - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelectRHS); + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pSelectRHS); } }else{ - yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy322; - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528); + yymsp[-4].minor.yy454->x.pList = yymsp[-1].minor.yy14; + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy454); } } - if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); + if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0); } } break; - case 220: /* expr ::= LP select RP */ + case 224: /* expr ::= LP select RP */ { - yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_SELECT, 0, 0); - sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy528, yymsp[-1].minor.yy47); + yymsp[-2].minor.yy454 = sqlite3PExpr(pParse, TK_SELECT, 0, 0); + sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy454, yymsp[-1].minor.yy555); } break; - case 221: /* expr ::= expr in_op LP select RP */ + case 225: /* expr ::= expr in_op LP select RP */ { - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, yymsp[-1].minor.yy47); - if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0); + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, yymsp[-1].minor.yy555); + if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0); } break; - case 222: /* expr ::= expr in_op nm dbnm paren_exprlist */ + case 226: /* expr ::= expr in_op nm dbnm paren_exprlist */ { SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0); - if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322); - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelect); - if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); + if( yymsp[0].minor.yy14 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy14); + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0); + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy454, pSelect); + if( yymsp[-3].minor.yy144 ) yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy454, 0); } break; - case 223: /* expr ::= EXISTS LP select RP */ + case 227: /* expr ::= EXISTS LP select RP */ { Expr *p; - p = yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0); - sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy47); + p = yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0); + sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy555); } break; - case 224: /* expr ::= CASE case_operand case_exprlist case_else END */ + case 228: /* expr ::= CASE case_operand case_exprlist case_else END */ { - yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy528, 0); - if( yymsp[-4].minor.yy528 ){ - yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy528 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528) : yymsp[-2].minor.yy322; - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528); + yymsp[-4].minor.yy454 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy454, 0); + if( yymsp[-4].minor.yy454 ){ + yymsp[-4].minor.yy454->x.pList = yymsp[-1].minor.yy454 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[-1].minor.yy454) : yymsp[-2].minor.yy14; + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy454); }else{ - sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322); - sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528); + sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy14); + sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy454); } } break; - case 225: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ + case 229: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ { - yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy528); - yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy528); + yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, yymsp[-2].minor.yy454); + yymsp[-4].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, yymsp[0].minor.yy454); } break; - case 226: /* case_exprlist ::= WHEN expr THEN expr */ + case 230: /* case_exprlist ::= WHEN expr THEN expr */ { - yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528); - yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy528); + yymsp[-3].minor.yy14 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454); + yymsp[-3].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy14, yymsp[0].minor.yy454); } break; - case 231: /* nexprlist ::= nexprlist COMMA expr */ -{yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy528);} + case 235: /* nexprlist ::= nexprlist COMMA expr */ +{yymsp[-2].minor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[0].minor.yy454);} break; - case 232: /* nexprlist ::= expr */ -{yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy528); /*A-overwrites-Y*/} + case 236: /* nexprlist ::= expr */ +{yymsp[0].minor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy454); /*A-overwrites-Y*/} break; - case 234: /* paren_exprlist ::= LP exprlist RP */ - case 239: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==239); -{yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;} + case 238: /* paren_exprlist ::= LP exprlist RP */ + case 243: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==243); +{yymsp[-2].minor.yy14 = yymsp[-1].minor.yy14;} break; - case 235: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ + case 239: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ { sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, - sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy394, - &yymsp[-11].minor.yy0, yymsp[0].minor.yy528, SQLITE_SO_ASC, yymsp[-8].minor.yy394, SQLITE_IDXTYPE_APPDEF); + sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy14, yymsp[-10].minor.yy144, + &yymsp[-11].minor.yy0, yymsp[0].minor.yy454, SQLITE_SO_ASC, yymsp[-8].minor.yy144, SQLITE_IDXTYPE_APPDEF); if( IN_RENAME_OBJECT && pParse->pNewIndex ){ sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0); } } break; - case 236: /* uniqueflag ::= UNIQUE */ - case 278: /* raisetype ::= ABORT */ yytestcase(yyruleno==278); -{yymsp[0].minor.yy394 = OE_Abort;} + case 240: /* uniqueflag ::= UNIQUE */ + case 282: /* raisetype ::= ABORT */ yytestcase(yyruleno==282); +{yymsp[0].minor.yy144 = OE_Abort;} break; - case 237: /* uniqueflag ::= */ -{yymsp[1].minor.yy394 = OE_None;} + case 241: /* uniqueflag ::= */ +{yymsp[1].minor.yy144 = OE_None;} break; - case 240: /* eidlist ::= eidlist COMMA nm collate sortorder */ + case 244: /* eidlist ::= eidlist COMMA nm collate sortorder */ { - yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); + yymsp[-4].minor.yy14 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy14, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy144, yymsp[0].minor.yy144); } break; - case 241: /* eidlist ::= nm collate sortorder */ + case 245: /* eidlist ::= nm collate sortorder */ { - yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); /*A-overwrites-Y*/ + yymsp[-2].minor.yy14 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy144, yymsp[0].minor.yy144); /*A-overwrites-Y*/ } break; - case 244: /* cmd ::= DROP INDEX ifexists fullname */ -{sqlite3DropIndex(pParse, yymsp[0].minor.yy131, yymsp[-1].minor.yy394);} + case 248: /* cmd ::= DROP INDEX ifexists fullname */ +{sqlite3DropIndex(pParse, yymsp[0].minor.yy203, yymsp[-1].minor.yy144);} break; - case 245: /* cmd ::= VACUUM vinto */ -{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy528);} + case 249: /* cmd ::= VACUUM vinto */ +{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy454);} break; - case 246: /* cmd ::= VACUUM nm vinto */ -{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy528);} + case 250: /* cmd ::= VACUUM nm vinto */ +{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy454);} break; - case 249: /* cmd ::= PRAGMA nm dbnm */ + case 253: /* cmd ::= PRAGMA nm dbnm */ {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} break; - case 250: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ + case 254: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);} break; - case 251: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ + case 255: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);} break; - case 252: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ + case 256: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);} break; - case 253: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ + case 257: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);} break; - case 256: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ + case 260: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ { Token all; all.z = yymsp[-3].minor.yy0.z; all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n; - sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy33, &all); + sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy427, &all); } break; - case 257: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ + case 261: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ { - sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy394, yymsp[-4].minor.yy180.a, yymsp[-4].minor.yy180.b, yymsp[-2].minor.yy131, yymsp[0].minor.yy528, yymsp[-10].minor.yy394, yymsp[-8].minor.yy394); + sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy144, yymsp[-4].minor.yy286.a, yymsp[-4].minor.yy286.b, yymsp[-2].minor.yy203, yymsp[0].minor.yy454, yymsp[-10].minor.yy144, yymsp[-8].minor.yy144); yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ } break; - case 258: /* trigger_time ::= BEFORE|AFTER */ -{ yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/ } + case 262: /* trigger_time ::= BEFORE|AFTER */ +{ yymsp[0].minor.yy144 = yymsp[0].major; /*A-overwrites-X*/ } break; - case 259: /* trigger_time ::= INSTEAD OF */ -{ yymsp[-1].minor.yy394 = TK_INSTEAD;} + case 263: /* trigger_time ::= INSTEAD OF */ +{ yymsp[-1].minor.yy144 = TK_INSTEAD;} break; - case 260: /* trigger_time ::= */ -{ yymsp[1].minor.yy394 = TK_BEFORE; } + case 264: /* trigger_time ::= */ +{ yymsp[1].minor.yy144 = TK_BEFORE; } break; - case 261: /* trigger_event ::= DELETE|INSERT */ - case 262: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==262); -{yymsp[0].minor.yy180.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy180.b = 0;} + case 265: /* trigger_event ::= DELETE|INSERT */ + case 266: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==266); +{yymsp[0].minor.yy286.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy286.b = 0;} break; - case 263: /* trigger_event ::= UPDATE OF idlist */ -{yymsp[-2].minor.yy180.a = TK_UPDATE; yymsp[-2].minor.yy180.b = yymsp[0].minor.yy254;} + case 267: /* trigger_event ::= UPDATE OF idlist */ +{yymsp[-2].minor.yy286.a = TK_UPDATE; yymsp[-2].minor.yy286.b = yymsp[0].minor.yy132;} break; - case 264: /* when_clause ::= */ - case 283: /* key_opt ::= */ yytestcase(yyruleno==283); -{ yymsp[1].minor.yy528 = 0; } + case 268: /* when_clause ::= */ + case 287: /* key_opt ::= */ yytestcase(yyruleno==287); +{ yymsp[1].minor.yy454 = 0; } break; - case 265: /* when_clause ::= WHEN expr */ - case 284: /* key_opt ::= KEY expr */ yytestcase(yyruleno==284); -{ yymsp[-1].minor.yy528 = yymsp[0].minor.yy528; } + case 269: /* when_clause ::= WHEN expr */ + case 288: /* key_opt ::= KEY expr */ yytestcase(yyruleno==288); +{ yymsp[-1].minor.yy454 = yymsp[0].minor.yy454; } break; - case 266: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ + case 270: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ { - assert( yymsp[-2].minor.yy33!=0 ); - yymsp[-2].minor.yy33->pLast->pNext = yymsp[-1].minor.yy33; - yymsp[-2].minor.yy33->pLast = yymsp[-1].minor.yy33; + assert( yymsp[-2].minor.yy427!=0 ); + yymsp[-2].minor.yy427->pLast->pNext = yymsp[-1].minor.yy427; + yymsp[-2].minor.yy427->pLast = yymsp[-1].minor.yy427; } break; - case 267: /* trigger_cmd_list ::= trigger_cmd SEMI */ + case 271: /* trigger_cmd_list ::= trigger_cmd SEMI */ { - assert( yymsp[-1].minor.yy33!=0 ); - yymsp[-1].minor.yy33->pLast = yymsp[-1].minor.yy33; + assert( yymsp[-1].minor.yy427!=0 ); + yymsp[-1].minor.yy427->pLast = yymsp[-1].minor.yy427; } break; - case 268: /* trnm ::= nm DOT nm */ + case 272: /* trnm ::= nm DOT nm */ { yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; sqlite3ErrorMsg(pParse, @@ -173956,367 +177291,377 @@ static YYACTIONTYPE yy_reduce( "statements within triggers"); } break; - case 269: /* tridxby ::= INDEXED BY nm */ + case 273: /* tridxby ::= INDEXED BY nm */ { sqlite3ErrorMsg(pParse, "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; - case 270: /* tridxby ::= NOT INDEXED */ + case 274: /* tridxby ::= NOT INDEXED */ { sqlite3ErrorMsg(pParse, "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; - case 271: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ -{yylhsminor.yy33 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy131, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528, yymsp[-7].minor.yy394, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy522);} - yymsp[-8].minor.yy33 = yylhsminor.yy33; + case 275: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ +{yylhsminor.yy427 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy203, yymsp[-3].minor.yy14, yymsp[-1].minor.yy454, yymsp[-7].minor.yy144, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy168);} + yymsp[-8].minor.yy427 = yylhsminor.yy427; break; - case 272: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ + case 276: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ { - yylhsminor.yy33 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy254,yymsp[-2].minor.yy47,yymsp[-6].minor.yy394,yymsp[-1].minor.yy444,yymsp[-7].minor.yy522,yymsp[0].minor.yy522);/*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/ + yylhsminor.yy427 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy132,yymsp[-2].minor.yy555,yymsp[-6].minor.yy144,yymsp[-1].minor.yy122,yymsp[-7].minor.yy168,yymsp[0].minor.yy168);/*yylhsminor.yy427-overwrites-yymsp[-6].minor.yy144*/ } - yymsp[-7].minor.yy33 = yylhsminor.yy33; + yymsp[-7].minor.yy427 = yylhsminor.yy427; break; - case 273: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ -{yylhsminor.yy33 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy528, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy522);} - yymsp[-5].minor.yy33 = yylhsminor.yy33; + case 277: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ +{yylhsminor.yy427 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy454, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy168);} + yymsp[-5].minor.yy427 = yylhsminor.yy427; break; - case 274: /* trigger_cmd ::= scanpt select scanpt */ -{yylhsminor.yy33 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy47, yymsp[-2].minor.yy522, yymsp[0].minor.yy522); /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/} - yymsp[-2].minor.yy33 = yylhsminor.yy33; + case 278: /* trigger_cmd ::= scanpt select scanpt */ +{yylhsminor.yy427 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy555, yymsp[-2].minor.yy168, yymsp[0].minor.yy168); /*yylhsminor.yy427-overwrites-yymsp[-1].minor.yy555*/} + yymsp[-2].minor.yy427 = yylhsminor.yy427; break; - case 275: /* expr ::= RAISE LP IGNORE RP */ + case 279: /* expr ::= RAISE LP IGNORE RP */ { - yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); - if( yymsp[-3].minor.yy528 ){ - yymsp[-3].minor.yy528->affExpr = OE_Ignore; + yymsp[-3].minor.yy454 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); + if( yymsp[-3].minor.yy454 ){ + yymsp[-3].minor.yy454->affExpr = OE_Ignore; } } break; - case 276: /* expr ::= RAISE LP raisetype COMMA nm RP */ + case 280: /* expr ::= RAISE LP raisetype COMMA nm RP */ { - yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); - if( yymsp[-5].minor.yy528 ) { - yymsp[-5].minor.yy528->affExpr = (char)yymsp[-3].minor.yy394; + yymsp[-5].minor.yy454 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); + if( yymsp[-5].minor.yy454 ) { + yymsp[-5].minor.yy454->affExpr = (char)yymsp[-3].minor.yy144; } } break; - case 277: /* raisetype ::= ROLLBACK */ -{yymsp[0].minor.yy394 = OE_Rollback;} + case 281: /* raisetype ::= ROLLBACK */ +{yymsp[0].minor.yy144 = OE_Rollback;} break; - case 279: /* raisetype ::= FAIL */ -{yymsp[0].minor.yy394 = OE_Fail;} + case 283: /* raisetype ::= FAIL */ +{yymsp[0].minor.yy144 = OE_Fail;} break; - case 280: /* cmd ::= DROP TRIGGER ifexists fullname */ + case 284: /* cmd ::= DROP TRIGGER ifexists fullname */ { - sqlite3DropTrigger(pParse,yymsp[0].minor.yy131,yymsp[-1].minor.yy394); + sqlite3DropTrigger(pParse,yymsp[0].minor.yy203,yymsp[-1].minor.yy144); } break; - case 281: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ + case 285: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ { - sqlite3Attach(pParse, yymsp[-3].minor.yy528, yymsp[-1].minor.yy528, yymsp[0].minor.yy528); + sqlite3Attach(pParse, yymsp[-3].minor.yy454, yymsp[-1].minor.yy454, yymsp[0].minor.yy454); } break; - case 282: /* cmd ::= DETACH database_kw_opt expr */ + case 286: /* cmd ::= DETACH database_kw_opt expr */ { - sqlite3Detach(pParse, yymsp[0].minor.yy528); + sqlite3Detach(pParse, yymsp[0].minor.yy454); } break; - case 285: /* cmd ::= REINDEX */ + case 289: /* cmd ::= REINDEX */ {sqlite3Reindex(pParse, 0, 0);} break; - case 286: /* cmd ::= REINDEX nm dbnm */ + case 290: /* cmd ::= REINDEX nm dbnm */ {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} break; - case 287: /* cmd ::= ANALYZE */ + case 291: /* cmd ::= ANALYZE */ {sqlite3Analyze(pParse, 0, 0);} break; - case 288: /* cmd ::= ANALYZE nm dbnm */ + case 292: /* cmd ::= ANALYZE nm dbnm */ {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} break; - case 289: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ + case 293: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ { - sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy131,&yymsp[0].minor.yy0); + sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy203,&yymsp[0].minor.yy0); } break; - case 290: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ + case 294: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ { yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n; sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0); } break; - case 291: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ + case 295: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ { - sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy131, &yymsp[0].minor.yy0); + sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy203, &yymsp[0].minor.yy0); } break; - case 292: /* add_column_fullname ::= fullname */ + case 296: /* add_column_fullname ::= fullname */ { disableLookaside(pParse); - sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy131); + sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy203); } break; - case 293: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ + case 297: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ { - sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy131, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); + sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy203, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 294: /* cmd ::= create_vtab */ + case 298: /* cmd ::= create_vtab */ {sqlite3VtabFinishParse(pParse,0);} break; - case 295: /* cmd ::= create_vtab LP vtabarglist RP */ + case 299: /* cmd ::= create_vtab LP vtabarglist RP */ {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} break; - case 296: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ + case 300: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ { - sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy394); + sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy144); } break; - case 297: /* vtabarg ::= */ + case 301: /* vtabarg ::= */ {sqlite3VtabArgInit(pParse);} break; - case 298: /* vtabargtoken ::= ANY */ - case 299: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==299); - case 300: /* lp ::= LP */ yytestcase(yyruleno==300); + case 302: /* vtabargtoken ::= ANY */ + case 303: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==303); + case 304: /* lp ::= LP */ yytestcase(yyruleno==304); {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} break; - case 301: /* with ::= WITH wqlist */ - case 302: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==302); -{ sqlite3WithPush(pParse, yymsp[0].minor.yy521, 1); } + case 305: /* with ::= WITH wqlist */ + case 306: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==306); +{ sqlite3WithPush(pParse, yymsp[0].minor.yy59, 1); } break; - case 303: /* wqas ::= AS */ -{yymsp[0].minor.yy516 = M10d_Any;} + case 307: /* wqas ::= AS */ +{yymsp[0].minor.yy462 = M10d_Any;} break; - case 304: /* wqas ::= AS MATERIALIZED */ -{yymsp[-1].minor.yy516 = M10d_Yes;} + case 308: /* wqas ::= AS MATERIALIZED */ +{yymsp[-1].minor.yy462 = M10d_Yes;} break; - case 305: /* wqas ::= AS NOT MATERIALIZED */ -{yymsp[-2].minor.yy516 = M10d_No;} + case 309: /* wqas ::= AS NOT MATERIALIZED */ +{yymsp[-2].minor.yy462 = M10d_No;} break; - case 306: /* wqitem ::= nm eidlist_opt wqas LP select RP */ + case 310: /* wqitem ::= withnm eidlist_opt wqas LP select RP */ { - yymsp[-5].minor.yy385 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy47, yymsp[-3].minor.yy516); /*A-overwrites-X*/ + yymsp[-5].minor.yy67 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy14, yymsp[-1].minor.yy555, yymsp[-3].minor.yy462); /*A-overwrites-X*/ } break; - case 307: /* wqlist ::= wqitem */ + case 311: /* withnm ::= nm */ +{pParse->bHasWith = 1;} + break; + case 312: /* wqlist ::= wqitem */ { - yymsp[0].minor.yy521 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy385); /*A-overwrites-X*/ + yymsp[0].minor.yy59 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy67); /*A-overwrites-X*/ } break; - case 308: /* wqlist ::= wqlist COMMA wqitem */ + case 313: /* wqlist ::= wqlist COMMA wqitem */ { - yymsp[-2].minor.yy521 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy521, yymsp[0].minor.yy385); + yymsp[-2].minor.yy59 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy59, yymsp[0].minor.yy67); } break; - case 309: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ + case 314: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ { - assert( yymsp[0].minor.yy41!=0 ); - sqlite3WindowChain(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy41); - yymsp[0].minor.yy41->pNextWin = yymsp[-2].minor.yy41; - yylhsminor.yy41 = yymsp[0].minor.yy41; + assert( yymsp[0].minor.yy211!=0 ); + sqlite3WindowChain(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy211); + yymsp[0].minor.yy211->pNextWin = yymsp[-2].minor.yy211; + yylhsminor.yy211 = yymsp[0].minor.yy211; } - yymsp[-2].minor.yy41 = yylhsminor.yy41; + yymsp[-2].minor.yy211 = yylhsminor.yy211; break; - case 310: /* windowdefn ::= nm AS LP window RP */ + case 315: /* windowdefn ::= nm AS LP window RP */ { - if( ALWAYS(yymsp[-1].minor.yy41) ){ - yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n); + if( ALWAYS(yymsp[-1].minor.yy211) ){ + yymsp[-1].minor.yy211->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n); } - yylhsminor.yy41 = yymsp[-1].minor.yy41; + yylhsminor.yy211 = yymsp[-1].minor.yy211; } - yymsp[-4].minor.yy41 = yylhsminor.yy41; + yymsp[-4].minor.yy211 = yylhsminor.yy211; break; - case 311: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ + case 316: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ { - yymsp[-4].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, 0); + yymsp[-4].minor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy14, yymsp[-1].minor.yy14, 0); } break; - case 312: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ + case 317: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ { - yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, &yymsp[-5].minor.yy0); + yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, yymsp[-2].minor.yy14, yymsp[-1].minor.yy14, &yymsp[-5].minor.yy0); } - yymsp[-5].minor.yy41 = yylhsminor.yy41; + yymsp[-5].minor.yy211 = yylhsminor.yy211; break; - case 313: /* window ::= ORDER BY sortlist frame_opt */ + case 318: /* window ::= ORDER BY sortlist frame_opt */ { - yymsp[-3].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, 0); + yymsp[-3].minor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, yymsp[-1].minor.yy14, 0); } break; - case 314: /* window ::= nm ORDER BY sortlist frame_opt */ + case 319: /* window ::= nm ORDER BY sortlist frame_opt */ { - yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0); + yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, yymsp[-1].minor.yy14, &yymsp[-4].minor.yy0); } - yymsp[-4].minor.yy41 = yylhsminor.yy41; + yymsp[-4].minor.yy211 = yylhsminor.yy211; break; - case 315: /* window ::= nm frame_opt */ + case 320: /* window ::= nm frame_opt */ { - yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, 0, &yymsp[-1].minor.yy0); + yylhsminor.yy211 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy211, 0, 0, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy41 = yylhsminor.yy41; + yymsp[-1].minor.yy211 = yylhsminor.yy211; break; - case 316: /* frame_opt ::= */ + case 321: /* frame_opt ::= */ { - yymsp[1].minor.yy41 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0); + yymsp[1].minor.yy211 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0); } break; - case 317: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ + case 322: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ { - yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy394, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy516); + yylhsminor.yy211 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy144, yymsp[-1].minor.yy509.eType, yymsp[-1].minor.yy509.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy462); } - yymsp[-2].minor.yy41 = yylhsminor.yy41; + yymsp[-2].minor.yy211 = yylhsminor.yy211; break; - case 318: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ + case 323: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ { - yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy394, yymsp[-3].minor.yy595.eType, yymsp[-3].minor.yy595.pExpr, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, yymsp[0].minor.yy516); + yylhsminor.yy211 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy144, yymsp[-3].minor.yy509.eType, yymsp[-3].minor.yy509.pExpr, yymsp[-1].minor.yy509.eType, yymsp[-1].minor.yy509.pExpr, yymsp[0].minor.yy462); } - yymsp[-5].minor.yy41 = yylhsminor.yy41; + yymsp[-5].minor.yy211 = yylhsminor.yy211; break; - case 320: /* frame_bound_s ::= frame_bound */ - case 322: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==322); -{yylhsminor.yy595 = yymsp[0].minor.yy595;} - yymsp[0].minor.yy595 = yylhsminor.yy595; + case 325: /* frame_bound_s ::= frame_bound */ + case 327: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==327); +{yylhsminor.yy509 = yymsp[0].minor.yy509;} + yymsp[0].minor.yy509 = yylhsminor.yy509; break; - case 321: /* frame_bound_s ::= UNBOUNDED PRECEDING */ - case 323: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==323); - case 325: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==325); -{yylhsminor.yy595.eType = yymsp[-1].major; yylhsminor.yy595.pExpr = 0;} - yymsp[-1].minor.yy595 = yylhsminor.yy595; + case 326: /* frame_bound_s ::= UNBOUNDED PRECEDING */ + case 328: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==328); + case 330: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==330); +{yylhsminor.yy509.eType = yymsp[-1].major; yylhsminor.yy509.pExpr = 0;} + yymsp[-1].minor.yy509 = yylhsminor.yy509; break; - case 324: /* frame_bound ::= expr PRECEDING|FOLLOWING */ -{yylhsminor.yy595.eType = yymsp[0].major; yylhsminor.yy595.pExpr = yymsp[-1].minor.yy528;} - yymsp[-1].minor.yy595 = yylhsminor.yy595; + case 329: /* frame_bound ::= expr PRECEDING|FOLLOWING */ +{yylhsminor.yy509.eType = yymsp[0].major; yylhsminor.yy509.pExpr = yymsp[-1].minor.yy454;} + yymsp[-1].minor.yy509 = yylhsminor.yy509; break; - case 326: /* frame_exclude_opt ::= */ -{yymsp[1].minor.yy516 = 0;} + case 331: /* frame_exclude_opt ::= */ +{yymsp[1].minor.yy462 = 0;} break; - case 327: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ -{yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;} + case 332: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ +{yymsp[-1].minor.yy462 = yymsp[0].minor.yy462;} break; - case 328: /* frame_exclude ::= NO OTHERS */ - case 329: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==329); -{yymsp[-1].minor.yy516 = yymsp[-1].major; /*A-overwrites-X*/} + case 333: /* frame_exclude ::= NO OTHERS */ + case 334: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==334); +{yymsp[-1].minor.yy462 = yymsp[-1].major; /*A-overwrites-X*/} break; - case 330: /* frame_exclude ::= GROUP|TIES */ -{yymsp[0].minor.yy516 = yymsp[0].major; /*A-overwrites-X*/} + case 335: /* frame_exclude ::= GROUP|TIES */ +{yymsp[0].minor.yy462 = yymsp[0].major; /*A-overwrites-X*/} break; - case 331: /* window_clause ::= WINDOW windowdefn_list */ -{ yymsp[-1].minor.yy41 = yymsp[0].minor.yy41; } + case 336: /* window_clause ::= WINDOW windowdefn_list */ +{ yymsp[-1].minor.yy211 = yymsp[0].minor.yy211; } break; - case 332: /* filter_over ::= filter_clause over_clause */ + case 337: /* filter_over ::= filter_clause over_clause */ { - if( yymsp[0].minor.yy41 ){ - yymsp[0].minor.yy41->pFilter = yymsp[-1].minor.yy528; + if( yymsp[0].minor.yy211 ){ + yymsp[0].minor.yy211->pFilter = yymsp[-1].minor.yy454; }else{ - sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528); + sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy454); } - yylhsminor.yy41 = yymsp[0].minor.yy41; + yylhsminor.yy211 = yymsp[0].minor.yy211; } - yymsp[-1].minor.yy41 = yylhsminor.yy41; + yymsp[-1].minor.yy211 = yylhsminor.yy211; break; - case 333: /* filter_over ::= over_clause */ + case 338: /* filter_over ::= over_clause */ { - yylhsminor.yy41 = yymsp[0].minor.yy41; + yylhsminor.yy211 = yymsp[0].minor.yy211; } - yymsp[0].minor.yy41 = yylhsminor.yy41; + yymsp[0].minor.yy211 = yylhsminor.yy211; break; - case 334: /* filter_over ::= filter_clause */ + case 339: /* filter_over ::= filter_clause */ { - yylhsminor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); - if( yylhsminor.yy41 ){ - yylhsminor.yy41->eFrmType = TK_FILTER; - yylhsminor.yy41->pFilter = yymsp[0].minor.yy528; + yylhsminor.yy211 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); + if( yylhsminor.yy211 ){ + yylhsminor.yy211->eFrmType = TK_FILTER; + yylhsminor.yy211->pFilter = yymsp[0].minor.yy454; }else{ - sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy528); + sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy454); } } - yymsp[0].minor.yy41 = yylhsminor.yy41; + yymsp[0].minor.yy211 = yylhsminor.yy211; break; - case 335: /* over_clause ::= OVER LP window RP */ + case 340: /* over_clause ::= OVER LP window RP */ { - yymsp[-3].minor.yy41 = yymsp[-1].minor.yy41; - assert( yymsp[-3].minor.yy41!=0 ); + yymsp[-3].minor.yy211 = yymsp[-1].minor.yy211; + assert( yymsp[-3].minor.yy211!=0 ); } break; - case 336: /* over_clause ::= OVER nm */ + case 341: /* over_clause ::= OVER nm */ { - yymsp[-1].minor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); - if( yymsp[-1].minor.yy41 ){ - yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); + yymsp[-1].minor.yy211 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); + if( yymsp[-1].minor.yy211 ){ + yymsp[-1].minor.yy211->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); } } break; - case 337: /* filter_clause ::= FILTER LP WHERE expr RP */ -{ yymsp[-4].minor.yy528 = yymsp[-1].minor.yy528; } + case 342: /* filter_clause ::= FILTER LP WHERE expr RP */ +{ yymsp[-4].minor.yy454 = yymsp[-1].minor.yy454; } + break; + case 343: /* term ::= QNUMBER */ +{ + yylhsminor.yy454=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); + sqlite3DequoteNumber(pParse, yylhsminor.yy454); +} + yymsp[0].minor.yy454 = yylhsminor.yy454; break; default: - /* (338) input ::= cmdlist */ yytestcase(yyruleno==338); - /* (339) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==339); - /* (340) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=340); - /* (341) ecmd ::= SEMI */ yytestcase(yyruleno==341); - /* (342) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==342); - /* (343) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=343); - /* (344) trans_opt ::= */ yytestcase(yyruleno==344); - /* (345) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==345); - /* (346) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==346); - /* (347) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==347); - /* (348) savepoint_opt ::= */ yytestcase(yyruleno==348); - /* (349) cmd ::= create_table create_table_args */ yytestcase(yyruleno==349); - /* (350) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=350); - /* (351) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==351); - /* (352) columnlist ::= columnname carglist */ yytestcase(yyruleno==352); - /* (353) nm ::= ID|INDEXED|JOIN_KW */ yytestcase(yyruleno==353); - /* (354) nm ::= STRING */ yytestcase(yyruleno==354); - /* (355) typetoken ::= typename */ yytestcase(yyruleno==355); - /* (356) typename ::= ID|STRING */ yytestcase(yyruleno==356); - /* (357) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=357); - /* (358) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=358); - /* (359) carglist ::= carglist ccons */ yytestcase(yyruleno==359); - /* (360) carglist ::= */ yytestcase(yyruleno==360); - /* (361) ccons ::= NULL onconf */ yytestcase(yyruleno==361); - /* (362) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==362); - /* (363) ccons ::= AS generated */ yytestcase(yyruleno==363); - /* (364) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==364); - /* (365) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==365); - /* (366) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=366); - /* (367) tconscomma ::= */ yytestcase(yyruleno==367); - /* (368) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=368); - /* (369) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=369); - /* (370) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=370); - /* (371) oneselect ::= values */ yytestcase(yyruleno==371); - /* (372) sclp ::= selcollist COMMA */ yytestcase(yyruleno==372); - /* (373) as ::= ID|STRING */ yytestcase(yyruleno==373); - /* (374) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=374); - /* (375) returning ::= */ yytestcase(yyruleno==375); - /* (376) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=376); - /* (377) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==377); - /* (378) case_operand ::= expr */ yytestcase(yyruleno==378); - /* (379) exprlist ::= nexprlist */ yytestcase(yyruleno==379); - /* (380) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=380); - /* (381) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=381); - /* (382) nmnum ::= ON */ yytestcase(yyruleno==382); - /* (383) nmnum ::= DELETE */ yytestcase(yyruleno==383); - /* (384) nmnum ::= DEFAULT */ yytestcase(yyruleno==384); - /* (385) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==385); - /* (386) foreach_clause ::= */ yytestcase(yyruleno==386); - /* (387) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==387); - /* (388) trnm ::= nm */ yytestcase(yyruleno==388); - /* (389) tridxby ::= */ yytestcase(yyruleno==389); - /* (390) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==390); - /* (391) database_kw_opt ::= */ yytestcase(yyruleno==391); - /* (392) kwcolumn_opt ::= */ yytestcase(yyruleno==392); - /* (393) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==393); - /* (394) vtabarglist ::= vtabarg */ yytestcase(yyruleno==394); - /* (395) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==395); - /* (396) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==396); - /* (397) anylist ::= */ yytestcase(yyruleno==397); - /* (398) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==398); - /* (399) anylist ::= anylist ANY */ yytestcase(yyruleno==399); - /* (400) with ::= */ yytestcase(yyruleno==400); - /* (401) windowdefn_list ::= windowdefn (OPTIMIZED OUT) */ assert(yyruleno!=401); - /* (402) window ::= frame_opt (OPTIMIZED OUT) */ assert(yyruleno!=402); + /* (344) input ::= cmdlist */ yytestcase(yyruleno==344); + /* (345) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==345); + /* (346) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=346); + /* (347) ecmd ::= SEMI */ yytestcase(yyruleno==347); + /* (348) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==348); + /* (349) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=349); + /* (350) trans_opt ::= */ yytestcase(yyruleno==350); + /* (351) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==351); + /* (352) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==352); + /* (353) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==353); + /* (354) savepoint_opt ::= */ yytestcase(yyruleno==354); + /* (355) cmd ::= create_table create_table_args */ yytestcase(yyruleno==355); + /* (356) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=356); + /* (357) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==357); + /* (358) columnlist ::= columnname carglist */ yytestcase(yyruleno==358); + /* (359) nm ::= ID|INDEXED|JOIN_KW */ yytestcase(yyruleno==359); + /* (360) nm ::= STRING */ yytestcase(yyruleno==360); + /* (361) typetoken ::= typename */ yytestcase(yyruleno==361); + /* (362) typename ::= ID|STRING */ yytestcase(yyruleno==362); + /* (363) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=363); + /* (364) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=364); + /* (365) carglist ::= carglist ccons */ yytestcase(yyruleno==365); + /* (366) carglist ::= */ yytestcase(yyruleno==366); + /* (367) ccons ::= NULL onconf */ yytestcase(yyruleno==367); + /* (368) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==368); + /* (369) ccons ::= AS generated */ yytestcase(yyruleno==369); + /* (370) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==370); + /* (371) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==371); + /* (372) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=372); + /* (373) tconscomma ::= */ yytestcase(yyruleno==373); + /* (374) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=374); + /* (375) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=375); + /* (376) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=376); + /* (377) oneselect ::= values */ yytestcase(yyruleno==377); + /* (378) sclp ::= selcollist COMMA */ yytestcase(yyruleno==378); + /* (379) as ::= ID|STRING */ yytestcase(yyruleno==379); + /* (380) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=380); + /* (381) returning ::= */ yytestcase(yyruleno==381); + /* (382) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=382); + /* (383) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==383); + /* (384) case_operand ::= expr */ yytestcase(yyruleno==384); + /* (385) exprlist ::= nexprlist */ yytestcase(yyruleno==385); + /* (386) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=386); + /* (387) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=387); + /* (388) nmnum ::= ON */ yytestcase(yyruleno==388); + /* (389) nmnum ::= DELETE */ yytestcase(yyruleno==389); + /* (390) nmnum ::= DEFAULT */ yytestcase(yyruleno==390); + /* (391) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==391); + /* (392) foreach_clause ::= */ yytestcase(yyruleno==392); + /* (393) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==393); + /* (394) trnm ::= nm */ yytestcase(yyruleno==394); + /* (395) tridxby ::= */ yytestcase(yyruleno==395); + /* (396) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==396); + /* (397) database_kw_opt ::= */ yytestcase(yyruleno==397); + /* (398) kwcolumn_opt ::= */ yytestcase(yyruleno==398); + /* (399) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==399); + /* (400) vtabarglist ::= vtabarg */ yytestcase(yyruleno==400); + /* (401) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==401); + /* (402) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==402); + /* (403) anylist ::= */ yytestcase(yyruleno==403); + /* (404) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==404); + /* (405) anylist ::= anylist ANY */ yytestcase(yyruleno==405); + /* (406) with ::= */ yytestcase(yyruleno==406); + /* (407) windowdefn_list ::= windowdefn (OPTIMIZED OUT) */ assert(yyruleno!=407); + /* (408) window ::= frame_opt (OPTIMIZED OUT) */ assert(yyruleno!=408); break; /********** End reduce actions ************************************************/ }; @@ -174503,19 +177848,12 @@ SQLITE_PRIVATE void sqlite3Parser( (int)(yypParser->yytos - yypParser->yystack)); } #endif -#if YYSTACKDEPTH>0 if( yypParser->yytos>=yypParser->yystackEnd ){ - yyStackOverflow(yypParser); - break; - } -#else - if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ if( yyGrowStack(yypParser) ){ yyStackOverflow(yypParser); break; } } -#endif } yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor sqlite3ParserCTX_PARAM); }else if( yyact <= YY_MAX_SHIFTREDUCE ){ @@ -175586,27 +178924,58 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){ *tokenType = TK_INTEGER; #ifndef SQLITE_OMIT_HEX_INTEGER if( z[0]=='0' && (z[1]=='x' || z[1]=='X') && sqlite3Isxdigit(z[2]) ){ - for(i=3; sqlite3Isxdigit(z[i]); i++){} - return i; - } + for(i=3; 1; i++){ + if( sqlite3Isxdigit(z[i])==0 ){ + if( z[i]==SQLITE_DIGIT_SEPARATOR ){ + *tokenType = TK_QNUMBER; + }else{ + break; + } + } + } + }else #endif - for(i=0; sqlite3Isdigit(z[i]); i++){} + { + for(i=0; 1; i++){ + if( sqlite3Isdigit(z[i])==0 ){ + if( z[i]==SQLITE_DIGIT_SEPARATOR ){ + *tokenType = TK_QNUMBER; + }else{ + break; + } + } + } #ifndef SQLITE_OMIT_FLOATING_POINT - if( z[i]=='.' ){ - i++; - while( sqlite3Isdigit(z[i]) ){ i++; } - *tokenType = TK_FLOAT; - } - if( (z[i]=='e' || z[i]=='E') && - ( sqlite3Isdigit(z[i+1]) - || ((z[i+1]=='+' || z[i+1]=='-') && sqlite3Isdigit(z[i+2])) - ) - ){ - i += 2; - while( sqlite3Isdigit(z[i]) ){ i++; } - *tokenType = TK_FLOAT; - } + if( z[i]=='.' ){ + if( *tokenType==TK_INTEGER ) *tokenType = TK_FLOAT; + for(i++; 1; i++){ + if( sqlite3Isdigit(z[i])==0 ){ + if( z[i]==SQLITE_DIGIT_SEPARATOR ){ + *tokenType = TK_QNUMBER; + }else{ + break; + } + } + } + } + if( (z[i]=='e' || z[i]=='E') && + ( sqlite3Isdigit(z[i+1]) + || ((z[i+1]=='+' || z[i+1]=='-') && sqlite3Isdigit(z[i+2])) + ) + ){ + if( *tokenType==TK_INTEGER ) *tokenType = TK_FLOAT; + for(i+=2; 1; i++){ + if( sqlite3Isdigit(z[i])==0 ){ + if( z[i]==SQLITE_DIGIT_SEPARATOR ){ + *tokenType = TK_QNUMBER; + }else{ + break; + } + } + } + } #endif + } while( IdChar(z[i]) ){ *tokenType = TK_ILLEGAL; i++; @@ -175771,10 +179140,13 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql){ if( tokenType>=TK_WINDOW ){ assert( tokenType==TK_SPACE || tokenType==TK_OVER || tokenType==TK_FILTER || tokenType==TK_ILLEGAL || tokenType==TK_WINDOW + || tokenType==TK_QNUMBER ); #else if( tokenType>=TK_SPACE ){ - assert( tokenType==TK_SPACE || tokenType==TK_ILLEGAL ); + assert( tokenType==TK_SPACE || tokenType==TK_ILLEGAL + || tokenType==TK_QNUMBER + ); #endif /* SQLITE_OMIT_WINDOWFUNC */ if( AtomicLoad(&db->u1.isInterrupted) ){ pParse->rc = SQLITE_INTERRUPT; @@ -175807,7 +179179,7 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql){ assert( n==6 ); tokenType = analyzeFilterKeyword((const u8*)&zSql[6], lastTokenParsed); #endif /* SQLITE_OMIT_WINDOWFUNC */ - }else{ + }else if( tokenType!=TK_QNUMBER ){ Token x; x.z = zSql; x.n = n; @@ -176440,7 +179812,9 @@ SQLITE_PRIVATE int sqlite3Fts5Init(sqlite3*); #ifdef SQLITE_ENABLE_STMTVTAB SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3*); #endif - +#ifdef SQLITE_EXTRA_AUTOEXT +int SQLITE_EXTRA_AUTOEXT(sqlite3*); +#endif /* ** An array of pointers to extension initializer functions for ** built-in extensions. @@ -176474,6 +179848,9 @@ static int (*const sqlite3BuiltinExtensions[])(sqlite3*) = { #ifdef SQLITE_ENABLE_BYTECODE_VTAB sqlite3VdbeBytecodeVtabInit, #endif +#ifdef SQLITE_EXTRA_AUTOEXT + SQLITE_EXTRA_AUTOEXT, +#endif }; #ifndef SQLITE_AMALGAMATION @@ -176547,6 +179924,32 @@ SQLITE_API char *sqlite3_temp_directory = 0; */ SQLITE_API char *sqlite3_data_directory = 0; +/* +** Determine whether or not high-precision (long double) floating point +** math works correctly on CPU currently running. +*/ +static SQLITE_NOINLINE int hasHighPrecisionDouble(int rc){ + if( sizeof(LONGDOUBLE_TYPE)<=8 ){ + /* If the size of "long double" is not more than 8, then + ** high-precision math is not possible. */ + return 0; + }else{ + /* Just because sizeof(long double)>8 does not mean that the underlying + ** hardware actually supports high-precision floating point. For example, + ** clearing the 0x100 bit in the floating-point control word on Intel + ** processors will make long double work like double, even though long + ** double takes up more space. The only way to determine if long double + ** actually works is to run an experiment. */ + LONGDOUBLE_TYPE a, b, c; + rc++; + a = 1.0+rc*0.1; + b = 1.0e+18+rc*25.0; + c = a+b; + return b!=c; + } +} + + /* ** Initialize SQLite. ** @@ -176742,6 +180145,12 @@ SQLITE_API int sqlite3_initialize(void){ } #endif + /* Experimentally determine if high-precision floating point is + ** available. */ +#ifndef SQLITE_OMIT_WSD + sqlite3Config.bUseLongDouble = hasHighPrecisionDouble(rc); +#endif + return rc; } @@ -177121,6 +180530,18 @@ SQLITE_API int sqlite3_config(int op, ...){ } #endif /* SQLITE_OMIT_DESERIALIZE */ + case SQLITE_CONFIG_ROWID_IN_VIEW: { + int *pVal = va_arg(ap,int*); +#ifdef SQLITE_ALLOW_ROWID_IN_VIEW + if( 0==*pVal ) sqlite3GlobalConfig.mNoVisibleRowid = TF_NoVisibleRowid; + if( 1==*pVal ) sqlite3GlobalConfig.mNoVisibleRowid = 0; + *pVal = (sqlite3GlobalConfig.mNoVisibleRowid==0); +#else + *pVal = 0; +#endif + break; + } + default: { rc = SQLITE_ERROR; break; @@ -177312,6 +180733,10 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3 *db){ SQLITE_API int sqlite3_db_config(sqlite3 *db, int op, ...){ va_list ap; int rc; + +#ifdef SQLITE_ENABLE_API_ARMOR + if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; +#endif sqlite3_mutex_enter(db->mutex); va_start(ap, op); switch( op ){ @@ -177641,6 +181066,14 @@ static int sqlite3Close(sqlite3 *db, int forceZombie){ } #endif + while( db->pDbData ){ + DbClientData *p = db->pDbData; + db->pDbData = p->pNext; + assert( p->pData!=0 ); + if( p->xDestructor ) p->xDestructor(p->pData); + sqlite3_free(p); + } + /* Convert the connection into a zombie and then close it. */ db->eOpenState = SQLITE_STATE_ZOMBIE; @@ -178258,7 +181691,7 @@ SQLITE_PRIVATE int sqlite3CreateFunc( assert( SQLITE_FUNC_CONSTANT==SQLITE_DETERMINISTIC ); assert( SQLITE_FUNC_DIRECT==SQLITE_DIRECTONLY ); extraFlags = enc & (SQLITE_DETERMINISTIC|SQLITE_DIRECTONLY| - SQLITE_SUBTYPE|SQLITE_INNOCUOUS); + SQLITE_SUBTYPE|SQLITE_INNOCUOUS|SQLITE_RESULT_SUBTYPE); enc &= (SQLITE_FUNC_ENCMASK|SQLITE_ANY); /* The SQLITE_INNOCUOUS flag is the same bit as SQLITE_FUNC_UNSAFE. But @@ -178715,6 +182148,12 @@ SQLITE_API void *sqlite3_preupdate_hook( void *pArg /* First callback argument */ ){ void *pRet; + +#ifdef SQLITE_ENABLE_API_ARMOR + if( db==0 ){ + return 0; + } +#endif sqlite3_mutex_enter(db->mutex); pRet = db->pPreUpdateArg; db->xPreUpdateCallback = xCallback; @@ -178861,7 +182300,7 @@ SQLITE_API int sqlite3_wal_checkpoint_v2( if( eModeSQLITE_CHECKPOINT_TRUNCATE ){ /* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint ** mode: */ - return SQLITE_MISUSE; + return SQLITE_MISUSE_BKPT; } sqlite3_mutex_enter(db->mutex); @@ -180098,6 +183537,69 @@ SQLITE_API int sqlite3_collation_needed16( } #endif /* SQLITE_OMIT_UTF16 */ +/* +** Find existing client data. +*/ +SQLITE_API void *sqlite3_get_clientdata(sqlite3 *db, const char *zName){ + DbClientData *p; + sqlite3_mutex_enter(db->mutex); + for(p=db->pDbData; p; p=p->pNext){ + if( strcmp(p->zName, zName)==0 ){ + void *pResult = p->pData; + sqlite3_mutex_leave(db->mutex); + return pResult; + } + } + sqlite3_mutex_leave(db->mutex); + return 0; +} + +/* +** Add new client data to a database connection. +*/ +SQLITE_API int sqlite3_set_clientdata( + sqlite3 *db, /* Attach client data to this connection */ + const char *zName, /* Name of the client data */ + void *pData, /* The client data itself */ + void (*xDestructor)(void*) /* Destructor */ +){ + DbClientData *p, **pp; + sqlite3_mutex_enter(db->mutex); + pp = &db->pDbData; + for(p=db->pDbData; p && strcmp(p->zName,zName); p=p->pNext){ + pp = &p->pNext; + } + if( p ){ + assert( p->pData!=0 ); + if( p->xDestructor ) p->xDestructor(p->pData); + if( pData==0 ){ + *pp = p->pNext; + sqlite3_free(p); + sqlite3_mutex_leave(db->mutex); + return SQLITE_OK; + } + }else if( pData==0 ){ + sqlite3_mutex_leave(db->mutex); + return SQLITE_OK; + }else{ + size_t n = strlen(zName); + p = sqlite3_malloc64( sizeof(DbClientData)+n+1 ); + if( p==0 ){ + if( xDestructor ) xDestructor(pData); + sqlite3_mutex_leave(db->mutex); + return SQLITE_NOMEM; + } + memcpy(p->zName, zName, n+1); + p->pNext = db->pDbData; + db->pDbData = p; + } + p->pData = pData; + p->xDestructor = xDestructor; + sqlite3_mutex_leave(db->mutex); + return SQLITE_OK; +} + + #ifndef SQLITE_OMIT_DEPRECATED /* ** This function is now an anachronism. It used to be used to recover from a @@ -180447,6 +183949,28 @@ SQLITE_API int sqlite3_test_control(int op, ...){ } #endif + /* sqlite3_test_control(SQLITE_TESTCTRL_FK_NO_ACTION, sqlite3 *db, int b); + ** + ** If b is true, then activate the SQLITE_FkNoAction setting. If b is + ** false then clearn that setting. If the SQLITE_FkNoAction setting is + ** abled, all foreign key ON DELETE and ON UPDATE actions behave as if + ** they were NO ACTION, regardless of how they are defined. + ** + ** NB: One must usually run "PRAGMA writable_schema=RESET" after + ** using this test-control, before it will take full effect. failing + ** to reset the schema can result in some unexpected behavior. + */ + case SQLITE_TESTCTRL_FK_NO_ACTION: { + sqlite3 *db = va_arg(ap, sqlite3*); + int b = va_arg(ap, int); + if( b ){ + db->flags |= SQLITE_FkNoAction; + }else{ + db->flags &= ~SQLITE_FkNoAction; + } + break; + } + /* ** sqlite3_test_control(BITVEC_TEST, size, program) ** @@ -180871,11 +184395,11 @@ SQLITE_API int sqlite3_test_control(int op, ...){ ** X<0 Make no changes to the bUseLongDouble. Just report value. ** X==0 Disable bUseLongDouble ** X==1 Enable bUseLongDouble - ** X==2 Set bUseLongDouble to its default value for this platform + ** X>=2 Set bUseLongDouble to its default value for this platform */ case SQLITE_TESTCTRL_USELONGDOUBLE: { int b = va_arg(ap, int); - if( b==2 ) b = sizeof(LONGDOUBLE_TYPE)>8; + if( b>=2 ) b = hasHighPrecisionDouble(b); if( b>=0 ) sqlite3Config.bUseLongDouble = b>0; rc = sqlite3Config.bUseLongDouble!=0; break; @@ -180912,6 +184436,28 @@ SQLITE_API int sqlite3_test_control(int op, ...){ break; } #endif + + /* sqlite3_test_control(SQLITE_TESTCTRL_JSON_SELFCHECK, &onOff); + ** + ** Activate or deactivate validation of JSONB that is generated from + ** text. Off by default, as the validation is slow. Validation is + ** only available if compiled using SQLITE_DEBUG. + ** + ** If onOff is initially 1, then turn it on. If onOff is initially + ** off, turn it off. If onOff is initially -1, then change onOff + ** to be the current setting. + */ + case SQLITE_TESTCTRL_JSON_SELFCHECK: { +#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_WSD) + int *pOnOff = va_arg(ap, int*); + if( *pOnOff<0 ){ + *pOnOff = sqlite3Config.bJsonSelfcheck; + }else{ + sqlite3Config.bJsonSelfcheck = (u8)((*pOnOff)&0xff); + } +#endif + break; + } } va_end(ap); #endif /* SQLITE_UNTESTABLE */ @@ -181289,7 +184835,7 @@ SQLITE_API int sqlite3_compileoption_used(const char *zOptName){ int nOpt; const char **azCompileOpt; -#if SQLITE_ENABLE_API_ARMOR +#ifdef SQLITE_ENABLE_API_ARMOR if( zOptName==0 ){ (void)SQLITE_MISUSE_BKPT; return 0; @@ -181484,6 +185030,9 @@ SQLITE_API int sqlite3_unlock_notify( ){ int rc = SQLITE_OK; +#ifdef SQLITE_ENABLE_API_ARMOR + if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; +#endif sqlite3_mutex_enter(db->mutex); enterMutex(); @@ -182505,6 +186054,7 @@ struct Fts3Table { int nPgsz; /* Page size for host database */ char *zSegmentsTbl; /* Name of %_segments table */ sqlite3_blob *pSegments; /* Blob handle open on %_segments table */ + int iSavepoint; /* ** The following array of hash tables is used to buffer pending index @@ -182892,6 +186442,8 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeIsdiacritic(int); SQLITE_PRIVATE int sqlite3Fts3ExprIterate(Fts3Expr*, int (*x)(Fts3Expr*,int,void*), void*); +SQLITE_PRIVATE int sqlite3Fts3IntegrityCheck(Fts3Table *p, int *pbOk); + #endif /* !SQLITE_CORE || SQLITE_ENABLE_FTS3 */ #endif /* _FTSINT_H */ @@ -183248,6 +186800,7 @@ static void fts3DeclareVtab(int *pRc, Fts3Table *p){ zLanguageid = (p->zLanguageid ? p->zLanguageid : "__langid"); sqlite3_vtab_config(p->db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1); + sqlite3_vtab_config(p->db, SQLITE_VTAB_INNOCUOUS); /* Create a list of user columns for the virtual table */ zCols = sqlite3_mprintf("%Q, ", p->azColumn[0]); @@ -186497,6 +190050,8 @@ static int fts3RenameMethod( rc = sqlite3Fts3PendingTermsFlush(p); } + p->bIgnoreSavepoint = 1; + if( p->zContentTbl==0 ){ fts3DbExec(&rc, db, "ALTER TABLE %Q.'%q_content' RENAME TO '%q_content';", @@ -186524,6 +190079,8 @@ static int fts3RenameMethod( "ALTER TABLE %Q.'%q_segdir' RENAME TO '%q_segdir';", p->zDb, p->zName, zName ); + + p->bIgnoreSavepoint = 0; return rc; } @@ -186534,12 +190091,28 @@ static int fts3RenameMethod( */ static int fts3SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){ int rc = SQLITE_OK; - UNUSED_PARAMETER(iSavepoint); - assert( ((Fts3Table *)pVtab)->inTransaction ); - assert( ((Fts3Table *)pVtab)->mxSavepoint <= iSavepoint ); - TESTONLY( ((Fts3Table *)pVtab)->mxSavepoint = iSavepoint ); - if( ((Fts3Table *)pVtab)->bIgnoreSavepoint==0 ){ - rc = fts3SyncMethod(pVtab); + Fts3Table *pTab = (Fts3Table*)pVtab; + assert( pTab->inTransaction ); + assert( pTab->mxSavepoint<=iSavepoint ); + TESTONLY( pTab->mxSavepoint = iSavepoint ); + + if( pTab->bIgnoreSavepoint==0 ){ + if( fts3HashCount(&pTab->aIndex[0].hPending)>0 ){ + char *zSql = sqlite3_mprintf("INSERT INTO %Q.%Q(%Q) VALUES('flush')", + pTab->zDb, pTab->zName, pTab->zName + ); + if( zSql ){ + pTab->bIgnoreSavepoint = 1; + rc = sqlite3_exec(pTab->db, zSql, 0, 0, 0); + pTab->bIgnoreSavepoint = 0; + sqlite3_free(zSql); + }else{ + rc = SQLITE_NOMEM; + } + } + if( rc==SQLITE_OK ){ + pTab->iSavepoint = iSavepoint+1; + } } return rc; } @@ -186550,12 +190123,11 @@ static int fts3SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){ ** This is a no-op. */ static int fts3ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){ - TESTONLY( Fts3Table *p = (Fts3Table*)pVtab ); - UNUSED_PARAMETER(iSavepoint); - UNUSED_PARAMETER(pVtab); - assert( p->inTransaction ); - assert( p->mxSavepoint >= iSavepoint ); - TESTONLY( p->mxSavepoint = iSavepoint-1 ); + Fts3Table *pTab = (Fts3Table*)pVtab; + assert( pTab->inTransaction ); + assert( pTab->mxSavepoint >= iSavepoint ); + TESTONLY( pTab->mxSavepoint = iSavepoint-1 ); + pTab->iSavepoint = iSavepoint; return SQLITE_OK; } @@ -186565,11 +190137,13 @@ static int fts3ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){ ** Discard the contents of the pending terms table. */ static int fts3RollbackToMethod(sqlite3_vtab *pVtab, int iSavepoint){ - Fts3Table *p = (Fts3Table*)pVtab; + Fts3Table *pTab = (Fts3Table*)pVtab; UNUSED_PARAMETER(iSavepoint); - assert( p->inTransaction ); - TESTONLY( p->mxSavepoint = iSavepoint ); - sqlite3Fts3PendingTermsClear(p); + assert( pTab->inTransaction ); + TESTONLY( pTab->mxSavepoint = iSavepoint ); + if( (iSavepoint+1)<=pTab->iSavepoint ){ + sqlite3Fts3PendingTermsClear(pTab); + } return SQLITE_OK; } @@ -186588,8 +190162,42 @@ static int fts3ShadowName(const char *zName){ return 0; } +/* +** Implementation of the xIntegrity() method on the FTS3/FTS4 virtual +** table. +*/ +static int fts3IntegrityMethod( + sqlite3_vtab *pVtab, /* The virtual table to be checked */ + const char *zSchema, /* Name of schema in which pVtab lives */ + const char *zTabname, /* Name of the pVTab table */ + int isQuick, /* True if this is a quick_check */ + char **pzErr /* Write error message here */ +){ + Fts3Table *p = (Fts3Table*)pVtab; + int rc = SQLITE_OK; + int bOk = 0; + + UNUSED_PARAMETER(isQuick); + rc = sqlite3Fts3IntegrityCheck(p, &bOk); + assert( rc!=SQLITE_CORRUPT_VTAB ); + if( rc==SQLITE_ERROR || (rc&0xFF)==SQLITE_CORRUPT ){ + *pzErr = sqlite3_mprintf("unable to validate the inverted index for" + " FTS%d table %s.%s: %s", + p->bFts4 ? 4 : 3, zSchema, zTabname, sqlite3_errstr(rc)); + if( *pzErr ) rc = SQLITE_OK; + }else if( rc==SQLITE_OK && bOk==0 ){ + *pzErr = sqlite3_mprintf("malformed inverted index for FTS%d table %s.%s", + p->bFts4 ? 4 : 3, zSchema, zTabname); + if( *pzErr==0 ) rc = SQLITE_NOMEM; + } + sqlite3Fts3SegmentsClose(p); + return rc; +} + + + static const sqlite3_module fts3Module = { - /* iVersion */ 3, + /* iVersion */ 4, /* xCreate */ fts3CreateMethod, /* xConnect */ fts3ConnectMethod, /* xBestIndex */ fts3BestIndexMethod, @@ -186613,6 +190221,7 @@ static const sqlite3_module fts3Module = { /* xRelease */ fts3ReleaseMethod, /* xRollbackTo */ fts3RollbackToMethod, /* xShadowName */ fts3ShadowName, + /* xIntegrity */ fts3IntegrityMethod, }; /* @@ -189288,7 +192897,8 @@ SQLITE_PRIVATE int sqlite3Fts3InitAux(sqlite3 *db){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; int rc; /* Return code */ @@ -192854,7 +196464,8 @@ SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash, void(*xDestr 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; int rc; /* Return code */ @@ -196195,7 +199806,6 @@ SQLITE_PRIVATE int sqlite3Fts3PendingTermsFlush(Fts3Table *p){ rc = fts3SegmentMerge(p, p->iPrevLangid, i, FTS3_SEGCURSOR_PENDING); if( rc==SQLITE_DONE ) rc = SQLITE_OK; } - sqlite3Fts3PendingTermsClear(p); /* Determine the auto-incr-merge setting if unknown. If enabled, ** estimate the number of leaf blocks of content to be written @@ -196217,6 +199827,10 @@ SQLITE_PRIVATE int sqlite3Fts3PendingTermsFlush(Fts3Table *p){ rc = sqlite3_reset(pStmt); } } + + if( rc==SQLITE_OK ){ + sqlite3Fts3PendingTermsClear(p); + } return rc; } @@ -196848,6 +200462,8 @@ static int fts3AppendToNode( blobGrowBuffer(pPrev, nTerm, &rc); if( rc!=SQLITE_OK ) return rc; + assert( pPrev!=0 ); + assert( pPrev->a!=0 ); nPrefix = fts3PrefixCompress(pPrev->a, pPrev->n, zTerm, nTerm); nSuffix = nTerm - nPrefix; @@ -196904,9 +200520,13 @@ static int fts3IncrmergeAppend( nSpace += sqlite3Fts3VarintLen(nDoclist) + nDoclist; /* If the current block is not empty, and if adding this term/doclist - ** to the current block would make it larger than Fts3Table.nNodeSize - ** bytes, write this block out to the database. */ - if( pLeaf->block.n>0 && (pLeaf->block.n + nSpace)>p->nNodeSize ){ + ** to the current block would make it larger than Fts3Table.nNodeSize bytes, + ** and if there is still room for another leaf page, write this block out to + ** the database. */ + if( pLeaf->block.n>0 + && (pLeaf->block.n + nSpace)>p->nNodeSize + && pLeaf->iBlock < (pWriter->iStart + pWriter->nLeafEst) + ){ rc = fts3WriteSegment(p, pLeaf->iBlock, pLeaf->block.a, pLeaf->block.n); pWriter->nWork++; @@ -197238,7 +200858,7 @@ static int fts3IncrmergeLoad( rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock,0); blobGrowBuffer(&pNode->block, MAX(nBlock, p->nNodeSize)+FTS3_NODE_PADDING, &rc - ); + ); if( rc==SQLITE_OK ){ memcpy(pNode->block.a, aBlock, nBlock); pNode->block.n = nBlock; @@ -198155,7 +201775,7 @@ static u64 fts3ChecksumIndex( ** If an error occurs (e.g. an OOM or IO error), return an SQLite error ** code. The final value of *pbOk is undefined in this case. */ -static int fts3IntegrityCheck(Fts3Table *p, int *pbOk){ +SQLITE_PRIVATE int sqlite3Fts3IntegrityCheck(Fts3Table *p, int *pbOk){ int rc = SQLITE_OK; /* Return code */ u64 cksum1 = 0; /* Checksum based on FTS index contents */ u64 cksum2 = 0; /* Checksum based on %_content contents */ @@ -198233,7 +201853,12 @@ static int fts3IntegrityCheck(Fts3Table *p, int *pbOk){ sqlite3_finalize(pStmt); } - *pbOk = (cksum1==cksum2); + if( rc==SQLITE_CORRUPT_VTAB ){ + rc = SQLITE_OK; + *pbOk = 0; + }else{ + *pbOk = (rc==SQLITE_OK && cksum1==cksum2); + } return rc; } @@ -198273,7 +201898,7 @@ static int fts3DoIntegrityCheck( ){ int rc; int bOk = 0; - rc = fts3IntegrityCheck(p, &bOk); + rc = sqlite3Fts3IntegrityCheck(p, &bOk); if( rc==SQLITE_OK && bOk==0 ) rc = FTS_CORRUPT_VTAB; return rc; } @@ -198303,8 +201928,11 @@ static int fts3SpecialInsert(Fts3Table *p, sqlite3_value *pVal){ rc = fts3DoIncrmerge(p, &zVal[6]); }else if( nVal>10 && 0==sqlite3_strnicmp(zVal, "automerge=", 10) ){ rc = fts3DoAutoincrmerge(p, &zVal[10]); + }else if( nVal==5 && 0==sqlite3_strnicmp(zVal, "flush", 5) ){ + rc = sqlite3Fts3PendingTermsFlush(p); + } #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) - }else{ + else{ int v; if( nVal>9 && 0==sqlite3_strnicmp(zVal, "nodesize=", 9) ){ v = atoi(&zVal[9]); @@ -198322,8 +201950,8 @@ static int fts3SpecialInsert(Fts3Table *p, sqlite3_value *pVal){ if( v>=4 && v<=FTS3_MERGE_COUNT && (v&1)==0 ) p->nMergeCount = v; rc = SQLITE_OK; } -#endif } +#endif return rc; } @@ -199136,7 +202764,7 @@ static void fts3SnippetDetails( } mCover |= mPhrase; - for(j=0; jnToken; j++){ + for(j=0; jnToken && jnSnippet; j++){ mHighlight |= (mPos>>j); } @@ -201244,24 +204872,145 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int c, int eRemoveDiacritic){ ** ****************************************************************************** ** -** This SQLite JSON functions. +** SQLite JSON functions. ** ** This file began as an extension in ext/misc/json1.c in 2015. That ** extension proved so useful that it has now been moved into the core. ** -** For the time being, all JSON is stored as pure text. (We might add -** a JSONB type in the future which stores a binary encoding of JSON in -** a BLOB, but there is no support for JSONB in the current implementation. -** This implementation parses JSON text at 250 MB/s, so it is hard to see -** how JSONB might improve on that.) +** The original design stored all JSON as pure text, canonical RFC-8259. +** Support for JSON-5 extensions was added with version 3.42.0 (2023-05-16). +** All generated JSON text still conforms strictly to RFC-8259, but text +** with JSON-5 extensions is accepted as input. +** +** Beginning with version 3.45.0 (circa 2024-01-01), these routines also +** accept BLOB values that have JSON encoded using a binary representation +** called "JSONB". The name JSONB comes from PostgreSQL, however the on-disk +** format SQLite JSONB is completely different and incompatible with +** PostgreSQL JSONB. +** +** Decoding and interpreting JSONB is still O(N) where N is the size of +** the input, the same as text JSON. However, the constant of proportionality +** for JSONB is much smaller due to faster parsing. The size of each +** element in JSONB is encoded in its header, so there is no need to search +** for delimiters using persnickety syntax rules. JSONB seems to be about +** 3x faster than text JSON as a result. JSONB is also tends to be slightly +** smaller than text JSON, by 5% or 10%, but there are corner cases where +** JSONB can be slightly larger. So you are not far mistaken to say that +** a JSONB blob is the same size as the equivalent RFC-8259 text. +** +** +** THE JSONB ENCODING: +** +** Every JSON element is encoded in JSONB as a header and a payload. +** The header is between 1 and 9 bytes in size. The payload is zero +** or more bytes. +** +** The lower 4 bits of the first byte of the header determines the +** element type: +** +** 0: NULL +** 1: TRUE +** 2: FALSE +** 3: INT -- RFC-8259 integer literal +** 4: INT5 -- JSON5 integer literal +** 5: FLOAT -- RFC-8259 floating point literal +** 6: FLOAT5 -- JSON5 floating point literal +** 7: TEXT -- Text literal acceptable to both SQL and JSON +** 8: TEXTJ -- Text containing RFC-8259 escapes +** 9: TEXT5 -- Text containing JSON5 and/or RFC-8259 escapes +** 10: TEXTRAW -- Text containing unescaped syntax characters +** 11: ARRAY +** 12: OBJECT +** +** The other three possible values (13-15) are reserved for future +** enhancements. +** +** The upper 4 bits of the first byte determine the size of the header +** and sometimes also the size of the payload. If X is the first byte +** of the element and if X>>4 is between 0 and 11, then the payload +** will be that many bytes in size and the header is exactly one byte +** in size. Other four values for X>>4 (12-15) indicate that the header +** is more than one byte in size and that the payload size is determined +** by the remainder of the header, interpreted as a unsigned big-endian +** integer. +** +** Value of X>>4 Size integer Total header size +** ------------- -------------------- ----------------- +** 12 1 byte (0-255) 2 +** 13 2 byte (0-65535) 3 +** 14 4 byte (0-4294967295) 5 +** 15 8 byte (0-1.8e19) 9 +** +** The payload size need not be expressed in its minimal form. For example, +** if the payload size is 10, the size can be expressed in any of 5 different +** ways: (1) (X>>4)==10, (2) (X>>4)==12 following by on 0x0a byte, +** (3) (X>>4)==13 followed by 0x00 and 0x0a, (4) (X>>4)==14 followed by +** 0x00 0x00 0x00 0x0a, or (5) (X>>4)==15 followed by 7 bytes of 0x00 and +** a single byte of 0x0a. The shorter forms are preferred, of course, but +** sometimes when generating JSONB, the payload size is not known in advance +** and it is convenient to reserve sufficient header space to cover the +** largest possible payload size and then come back later and patch up +** the size when it becomes known, resulting in a non-minimal encoding. +** +** The value (X>>4)==15 is not actually used in the current implementation +** (as SQLite is currently unable handle BLOBs larger than about 2GB) +** but is included in the design to allow for future enhancements. +** +** The payload follows the header. NULL, TRUE, and FALSE have no payload and +** their payload size must always be zero. The payload for INT, INT5, +** FLOAT, FLOAT5, TEXT, TEXTJ, TEXT5, and TEXTROW is text. Note that the +** "..." or '...' delimiters are omitted from the various text encodings. +** The payload for ARRAY and OBJECT is a list of additional elements that +** are the content for the array or object. The payload for an OBJECT +** must be an even number of elements. The first element of each pair is +** the label and must be of type TEXT, TEXTJ, TEXT5, or TEXTRAW. +** +** A valid JSONB blob consists of a single element, as described above. +** Usually this will be an ARRAY or OBJECT element which has many more +** elements as its content. But the overall blob is just a single element. +** +** Input validation for JSONB blobs simply checks that the element type +** code is between 0 and 12 and that the total size of the element +** (header plus payload) is the same as the size of the BLOB. If those +** checks are true, the BLOB is assumed to be JSONB and processing continues. +** Errors are only raised if some other miscoding is discovered during +** processing. +** +** Additional information can be found in the doc/jsonb.md file of the +** canonical SQLite source tree. */ #ifndef SQLITE_OMIT_JSON /* #include "sqliteInt.h" */ +/* JSONB element types +*/ +#define JSONB_NULL 0 /* "null" */ +#define JSONB_TRUE 1 /* "true" */ +#define JSONB_FALSE 2 /* "false" */ +#define JSONB_INT 3 /* integer acceptable to JSON and SQL */ +#define JSONB_INT5 4 /* integer in 0x000 notation */ +#define JSONB_FLOAT 5 /* float acceptable to JSON and SQL */ +#define JSONB_FLOAT5 6 /* float with JSON5 extensions */ +#define JSONB_TEXT 7 /* Text compatible with both JSON and SQL */ +#define JSONB_TEXTJ 8 /* Text with JSON escapes */ +#define JSONB_TEXT5 9 /* Text with JSON-5 escape */ +#define JSONB_TEXTRAW 10 /* SQL text that needs escaping for JSON */ +#define JSONB_ARRAY 11 /* An array */ +#define JSONB_OBJECT 12 /* An object */ + +/* Human-readable names for the JSONB values. The index for each +** string must correspond to the JSONB_* integer above. +*/ +static const char * const jsonbType[] = { + "null", "true", "false", "integer", "integer", + "real", "real", "text", "text", "text", + "text", "array", "object", "", "", "", "" +}; + /* ** Growing our own isspace() routine this way is twice as fast as ** the library isspace() function, resulting in a 7% overall performance -** increase for the parser. (Ubuntu14.10 gcc 4.8.4 x64 with -Os). +** increase for the text-JSON parser. (Ubuntu14.10 gcc 4.8.4 x64 with -Os). */ static const char jsonIsSpace[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, @@ -201282,11 +205031,19 @@ static const char jsonIsSpace[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -#define fast_isspace(x) (jsonIsSpace[(unsigned char)x]) +#define jsonIsspace(x) (jsonIsSpace[(unsigned char)x]) + +/* +** The set of all space characters recognized by jsonIsspace(). +** Useful as the second argument to strspn(). +*/ +static const char jsonSpaces[] = "\011\012\015\040"; /* -** Characters that are special to JSON. Control charaters, -** '"' and '\\'. +** Characters that are special to JSON. Control characters, +** '"' and '\\' and '\''. Actually, '\'' is not special to +** canonical JSON, but it is special in JSON-5, so we include +** it in the set of special characters. */ static const char jsonIsOk[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -201308,22 +205065,49 @@ static const char jsonIsOk[256] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; - -#if !defined(SQLITE_DEBUG) && !defined(SQLITE_COVERAGE_TEST) -# define VVA(X) -#else -# define VVA(X) X -#endif - /* Objects */ +typedef struct JsonCache JsonCache; typedef struct JsonString JsonString; -typedef struct JsonNode JsonNode; typedef struct JsonParse JsonParse; -typedef struct JsonCleanup JsonCleanup; + +/* +** Magic number used for the JSON parse cache in sqlite3_get_auxdata() +*/ +#define JSON_CACHE_ID (-429938) /* Cache entry */ +#define JSON_CACHE_SIZE 4 /* Max number of cache entries */ + +/* +** jsonUnescapeOneChar() returns this invalid code point if it encounters +** a syntax error. +*/ +#define JSON_INVALID_CHAR 0x99999 + +/* A cache mapping JSON text into JSONB blobs. +** +** Each cache entry is a JsonParse object with the following restrictions: +** +** * The bReadOnly flag must be set +** +** * The aBlob[] array must be owned by the JsonParse object. In other +** words, nBlobAlloc must be non-zero. +** +** * eEdit and delta must be zero. +** +** * zJson must be an RCStr. In other words bJsonIsRCStr must be true. +*/ +struct JsonCache { + sqlite3 *db; /* Database connection */ + int nUsed; /* Number of active entries in the cache */ + JsonParse *a[JSON_CACHE_SIZE]; /* One line for each cache entry */ +}; /* An instance of this object represents a JSON string ** under construction. Really, this is a generic string accumulator ** that can be and is used to create strings other than JSON. +** +** If the generated string is longer than will fit into the zSpace[] buffer, +** then it will be an RCStr string. This aids with caching of large +** JSON strings. */ struct JsonString { sqlite3_context *pCtx; /* Function context - put error messages here */ @@ -201331,121 +205115,75 @@ struct JsonString { u64 nAlloc; /* Bytes of storage available in zBuf[] */ u64 nUsed; /* Bytes of zBuf[] currently used */ u8 bStatic; /* True if zBuf is static space */ - u8 bErr; /* True if an error has been encountered */ + u8 eErr; /* True if an error has been encountered */ char zSpace[100]; /* Initial static space */ }; -/* A deferred cleanup task. A list of JsonCleanup objects might be -** run when the JsonParse object is destroyed. -*/ -struct JsonCleanup { - JsonCleanup *pJCNext; /* Next in a list */ - void (*xOp)(void*); /* Routine to run */ - void *pArg; /* Argument to xOp() */ -}; +/* Allowed values for JsonString.eErr */ +#define JSTRING_OOM 0x01 /* Out of memory */ +#define JSTRING_MALFORMED 0x02 /* Malformed JSONB */ +#define JSTRING_ERR 0x04 /* Error already sent to sqlite3_result */ -/* JSON type values +/* The "subtype" set for text JSON values passed through using +** sqlite3_result_subtype() and sqlite3_value_subtype(). */ -#define JSON_SUBST 0 /* Special edit node. Uses u.iPrev */ -#define JSON_NULL 1 -#define JSON_TRUE 2 -#define JSON_FALSE 3 -#define JSON_INT 4 -#define JSON_REAL 5 -#define JSON_STRING 6 -#define JSON_ARRAY 7 -#define JSON_OBJECT 8 - -/* The "subtype" set for JSON values */ #define JSON_SUBTYPE 74 /* Ascii for "J" */ /* -** Names of the various JSON types: -*/ -static const char * const jsonType[] = { - "subst", - "null", "true", "false", "integer", "real", "text", "array", "object" -}; - -/* Bit values for the JsonNode.jnFlag field -*/ -#define JNODE_RAW 0x01 /* Content is raw, not JSON encoded */ -#define JNODE_ESCAPE 0x02 /* Content is text with \ escapes */ -#define JNODE_REMOVE 0x04 /* Do not output */ -#define JNODE_REPLACE 0x08 /* Target of a JSON_SUBST node */ -#define JNODE_APPEND 0x10 /* More ARRAY/OBJECT entries at u.iAppend */ -#define JNODE_LABEL 0x20 /* Is a label of an object */ -#define JNODE_JSON5 0x40 /* Node contains JSON5 enhancements */ - - -/* A single node of parsed JSON. An array of these nodes describes -** a parse of JSON + edits. -** -** Use the json_parse() SQL function (available when compiled with -** -DSQLITE_DEBUG) to see a dump of complete JsonParse objects, including -** a complete listing and decoding of the array of JsonNodes. +** Bit values for the flags passed into various SQL function implementations +** via the sqlite3_user_data() value. */ -struct JsonNode { - u8 eType; /* One of the JSON_ type values */ - u8 jnFlags; /* JNODE flags */ - u8 eU; /* Which union element to use */ - u32 n; /* Bytes of content for INT, REAL or STRING - ** Number of sub-nodes for ARRAY and OBJECT - ** Node that SUBST applies to */ - union { - const char *zJContent; /* 1: Content for INT, REAL, and STRING */ - u32 iAppend; /* 2: More terms for ARRAY and OBJECT */ - u32 iKey; /* 3: Key for ARRAY objects in json_tree() */ - u32 iPrev; /* 4: Previous SUBST node, or 0 */ - } u; -}; +#define JSON_JSON 0x01 /* Result is always JSON */ +#define JSON_SQL 0x02 /* Result is always SQL */ +#define JSON_ABPATH 0x03 /* Allow abbreviated JSON path specs */ +#define JSON_ISSET 0x04 /* json_set(), not json_insert() */ +#define JSON_BLOB 0x08 /* Use the BLOB output format */ -/* A parsed and possibly edited JSON string. Lifecycle: +/* A parsed JSON value. Lifecycle: ** -** 1. JSON comes in and is parsed into an array aNode[]. The original -** JSON text is stored in zJson. +** 1. JSON comes in and is parsed into a JSONB value in aBlob. The +** original text is stored in zJson. This step is skipped if the +** input is JSONB instead of text JSON. ** -** 2. Zero or more changes are made (via json_remove() or json_replace() -** or similar) to the aNode[] array. +** 2. The aBlob[] array is searched using the JSON path notation, if needed. ** -** 3. A new, edited and mimified JSON string is generated from aNode -** and stored in zAlt. The JsonParse object always owns zAlt. +** 3. Zero or more changes are made to aBlob[] (via json_remove() or +** json_replace() or json_patch() or similar). ** -** Step 1 always happens. Step 2 and 3 may or may not happen, depending -** on the operation. -** -** aNode[].u.zJContent entries typically point into zJson. Hence zJson -** must remain valid for the lifespan of the parse. For edits, -** aNode[].u.zJContent might point to malloced space other than zJson. -** Entries in pClup are responsible for freeing that extra malloced space. -** -** When walking the parse tree in aNode[], edits are ignored if useMod is -** false. +** 4. New JSON text is generated from the aBlob[] for output. This step +** is skipped if the function is one of the jsonb_* functions that +** returns JSONB instead of text JSON. */ struct JsonParse { - u32 nNode; /* Number of slots of aNode[] used */ - u32 nAlloc; /* Number of slots of aNode[] allocated */ - JsonNode *aNode; /* Array of nodes containing the parse */ - char *zJson; /* Original JSON string (before edits) */ - char *zAlt; /* Revised and/or mimified JSON */ - u32 *aUp; /* Index of parent of each node */ - JsonCleanup *pClup;/* Cleanup operations prior to freeing this object */ + u8 *aBlob; /* JSONB representation of JSON value */ + u32 nBlob; /* Bytes of aBlob[] actually used */ + u32 nBlobAlloc; /* Bytes allocated to aBlob[]. 0 if aBlob is external */ + char *zJson; /* Json text used for parsing */ + sqlite3 *db; /* The database connection to which this object belongs */ + int nJson; /* Length of the zJson string in bytes */ + u32 nJPRef; /* Number of references to this object */ + u32 iErr; /* Error location in zJson[] */ u16 iDepth; /* Nesting depth */ u8 nErr; /* Number of errors seen */ u8 oom; /* Set to true if out of memory */ u8 bJsonIsRCStr; /* True if zJson is an RCStr */ u8 hasNonstd; /* True if input uses non-standard features like JSON5 */ - u8 useMod; /* Actually use the edits contain inside aNode */ - u8 hasMod; /* aNode contains edits from the original zJson */ - u32 nJPRef; /* Number of references to this object */ - int nJson; /* Length of the zJson string in bytes */ - int nAlt; /* Length of alternative JSON string zAlt, in bytes */ - u32 iErr; /* Error location in zJson[] */ - u32 iSubst; /* Last JSON_SUBST entry in aNode[] */ - u32 iHold; /* Age of this entry in the cache for LRU replacement */ + u8 bReadOnly; /* Do not modify. */ + /* Search and edit information. See jsonLookupStep() */ + u8 eEdit; /* Edit operation to apply */ + int delta; /* Size change due to the edit */ + u32 nIns; /* Number of bytes to insert */ + u32 iLabel; /* Location of label if search landed on an object value */ + u8 *aIns; /* Content to be inserted */ }; +/* Allowed values for JsonParse.eEdit */ +#define JEDIT_DEL 1 /* Delete if exists */ +#define JEDIT_REPL 2 /* Overwrite if exists */ +#define JEDIT_INS 3 /* Insert if not exists */ +#define JEDIT_SET 4 /* Insert or overwrite */ + /* ** Maximum nesting depth of JSON for this implementation. ** @@ -201453,15 +205191,151 @@ struct JsonParse { ** descent parser. A depth of 1000 is far deeper than any sane JSON ** should go. Historical note: This limit was 2000 prior to version 3.42.0 */ -#define JSON_MAX_DEPTH 1000 +#ifndef SQLITE_JSON_MAX_DEPTH +# define JSON_MAX_DEPTH 1000 +#else +# define JSON_MAX_DEPTH SQLITE_JSON_MAX_DEPTH +#endif + +/* +** Allowed values for the flgs argument to jsonParseFuncArg(); +*/ +#define JSON_EDITABLE 0x01 /* Generate a writable JsonParse object */ +#define JSON_KEEPERROR 0x02 /* Return non-NULL even if there is an error */ + +/************************************************************************** +** Forward references +**************************************************************************/ +static void jsonReturnStringAsBlob(JsonString*); +static int jsonFuncArgMightBeBinary(sqlite3_value *pJson); +static u32 jsonTranslateBlobToText(const JsonParse*,u32,JsonString*); +static void jsonReturnParse(sqlite3_context*,JsonParse*); +static JsonParse *jsonParseFuncArg(sqlite3_context*,sqlite3_value*,u32); +static void jsonParseFree(JsonParse*); +static u32 jsonbPayloadSize(const JsonParse*, u32, u32*); +static u32 jsonUnescapeOneChar(const char*, u32, u32*); + +/************************************************************************** +** Utility routines for dealing with JsonCache objects +**************************************************************************/ + +/* +** Free a JsonCache object. +*/ +static void jsonCacheDelete(JsonCache *p){ + int i; + for(i=0; inUsed; i++){ + jsonParseFree(p->a[i]); + } + sqlite3DbFree(p->db, p); +} +static void jsonCacheDeleteGeneric(void *p){ + jsonCacheDelete((JsonCache*)p); +} + +/* +** Insert a new entry into the cache. If the cache is full, expel +** the least recently used entry. Return SQLITE_OK on success or a +** result code otherwise. +** +** Cache entries are stored in age order, oldest first. +*/ +static int jsonCacheInsert( + sqlite3_context *ctx, /* The SQL statement context holding the cache */ + JsonParse *pParse /* The parse object to be added to the cache */ +){ + JsonCache *p; + + assert( pParse->zJson!=0 ); + assert( pParse->bJsonIsRCStr ); + assert( pParse->delta==0 ); + p = sqlite3_get_auxdata(ctx, JSON_CACHE_ID); + if( p==0 ){ + sqlite3 *db = sqlite3_context_db_handle(ctx); + p = sqlite3DbMallocZero(db, sizeof(*p)); + if( p==0 ) return SQLITE_NOMEM; + p->db = db; + sqlite3_set_auxdata(ctx, JSON_CACHE_ID, p, jsonCacheDeleteGeneric); + p = sqlite3_get_auxdata(ctx, JSON_CACHE_ID); + if( p==0 ) return SQLITE_NOMEM; + } + if( p->nUsed >= JSON_CACHE_SIZE ){ + jsonParseFree(p->a[0]); + memmove(p->a, &p->a[1], (JSON_CACHE_SIZE-1)*sizeof(p->a[0])); + p->nUsed = JSON_CACHE_SIZE-1; + } + assert( pParse->nBlobAlloc>0 ); + pParse->eEdit = 0; + pParse->nJPRef++; + pParse->bReadOnly = 1; + p->a[p->nUsed] = pParse; + p->nUsed++; + return SQLITE_OK; +} + +/* +** Search for a cached translation the json text supplied by pArg. Return +** the JsonParse object if found. Return NULL if not found. +** +** When a match if found, the matching entry is moved to become the +** most-recently used entry if it isn't so already. +** +** The JsonParse object returned still belongs to the Cache and might +** be deleted at any moment. If the caller whants the JsonParse to +** linger, it needs to increment the nPJRef reference counter. +*/ +static JsonParse *jsonCacheSearch( + sqlite3_context *ctx, /* The SQL statement context holding the cache */ + sqlite3_value *pArg /* Function argument containing SQL text */ +){ + JsonCache *p; + int i; + const char *zJson; + int nJson; + + if( sqlite3_value_type(pArg)!=SQLITE_TEXT ){ + return 0; + } + zJson = (const char*)sqlite3_value_text(pArg); + if( zJson==0 ) return 0; + nJson = sqlite3_value_bytes(pArg); + + p = sqlite3_get_auxdata(ctx, JSON_CACHE_ID); + if( p==0 ){ + return 0; + } + for(i=0; inUsed; i++){ + if( p->a[i]->zJson==zJson ) break; + } + if( i>=p->nUsed ){ + for(i=0; inUsed; i++){ + if( p->a[i]->nJson!=nJson ) continue; + if( memcmp(p->a[i]->zJson, zJson, nJson)==0 ) break; + } + } + if( inUsed ){ + if( inUsed-1 ){ + /* Make the matching entry the most recently used entry */ + JsonParse *tmp = p->a[i]; + memmove(&p->a[i], &p->a[i+1], (p->nUsed-i-1)*sizeof(tmp)); + p->a[p->nUsed-1] = tmp; + i = p->nUsed - 1; + } + assert( p->a[i]->delta==0 ); + return p->a[i]; + }else{ + return 0; + } +} /************************************************************************** ** Utility routines for dealing with JsonString objects **************************************************************************/ -/* Set the JsonString object to an empty string +/* Turn uninitialized bulk memory into a valid JsonString object +** holding a zero-length string. */ -static void jsonZero(JsonString *p){ +static void jsonStringZero(JsonString *p){ p->zBuf = p->zSpace; p->nAlloc = sizeof(p->zSpace); p->nUsed = 0; @@ -201470,39 +205344,39 @@ static void jsonZero(JsonString *p){ /* Initialize the JsonString object */ -static void jsonInit(JsonString *p, sqlite3_context *pCtx){ +static void jsonStringInit(JsonString *p, sqlite3_context *pCtx){ p->pCtx = pCtx; - p->bErr = 0; - jsonZero(p); + p->eErr = 0; + jsonStringZero(p); } /* Free all allocated memory and reset the JsonString object back to its ** initial state. */ -static void jsonReset(JsonString *p){ +static void jsonStringReset(JsonString *p){ if( !p->bStatic ) sqlite3RCStrUnref(p->zBuf); - jsonZero(p); + jsonStringZero(p); } /* Report an out-of-memory (OOM) condition */ -static void jsonOom(JsonString *p){ - p->bErr = 1; - sqlite3_result_error_nomem(p->pCtx); - jsonReset(p); +static void jsonStringOom(JsonString *p){ + p->eErr |= JSTRING_OOM; + if( p->pCtx ) sqlite3_result_error_nomem(p->pCtx); + jsonStringReset(p); } /* Enlarge pJson->zBuf so that it can hold at least N more bytes. ** Return zero on success. Return non-zero on an OOM error */ -static int jsonGrow(JsonString *p, u32 N){ +static int jsonStringGrow(JsonString *p, u32 N){ u64 nTotal = NnAlloc ? p->nAlloc*2 : p->nAlloc+N+10; char *zNew; if( p->bStatic ){ - if( p->bErr ) return 1; + if( p->eErr ) return 1; zNew = sqlite3RCStrNew(nTotal); if( zNew==0 ){ - jsonOom(p); + jsonStringOom(p); return SQLITE_NOMEM; } memcpy(zNew, p->zBuf, (size_t)p->nUsed); @@ -201511,8 +205385,8 @@ static int jsonGrow(JsonString *p, u32 N){ }else{ p->zBuf = sqlite3RCStrResize(p->zBuf, nTotal); if( p->zBuf==0 ){ - p->bErr = 1; - jsonZero(p); + p->eErr |= JSTRING_OOM; + jsonStringZero(p); return SQLITE_NOMEM; } } @@ -201522,20 +205396,20 @@ static int jsonGrow(JsonString *p, u32 N){ /* Append N bytes from zIn onto the end of the JsonString string. */ -static SQLITE_NOINLINE void jsonAppendExpand( +static SQLITE_NOINLINE void jsonStringExpandAndAppend( JsonString *p, const char *zIn, u32 N ){ assert( N>0 ); - if( jsonGrow(p,N) ) return; + if( jsonStringGrow(p,N) ) return; memcpy(p->zBuf+p->nUsed, zIn, N); p->nUsed += N; } static void jsonAppendRaw(JsonString *p, const char *zIn, u32 N){ if( N==0 ) return; if( N+p->nUsed >= p->nAlloc ){ - jsonAppendExpand(p,zIn,N); + jsonStringExpandAndAppend(p,zIn,N); }else{ memcpy(p->zBuf+p->nUsed, zIn, N); p->nUsed += N; @@ -201544,19 +205418,18 @@ static void jsonAppendRaw(JsonString *p, const char *zIn, u32 N){ static void jsonAppendRawNZ(JsonString *p, const char *zIn, u32 N){ assert( N>0 ); if( N+p->nUsed >= p->nAlloc ){ - jsonAppendExpand(p,zIn,N); + jsonStringExpandAndAppend(p,zIn,N); }else{ memcpy(p->zBuf+p->nUsed, zIn, N); p->nUsed += N; } } - /* Append formatted text (not to exceed N bytes) to the JsonString. */ static void jsonPrintf(int N, JsonString *p, const char *zFormat, ...){ va_list ap; - if( (p->nUsed + N >= p->nAlloc) && jsonGrow(p, N) ) return; + if( (p->nUsed + N >= p->nAlloc) && jsonStringGrow(p, N) ) return; va_start(ap, zFormat); sqlite3_vsnprintf(N, p->zBuf+p->nUsed, zFormat, ap); va_end(ap); @@ -201566,7 +205439,7 @@ static void jsonPrintf(int N, JsonString *p, const char *zFormat, ...){ /* Append a single character */ static SQLITE_NOINLINE void jsonAppendCharExpand(JsonString *p, char c){ - if( jsonGrow(p,1) ) return; + if( jsonStringGrow(p,1) ) return; p->zBuf[p->nUsed++] = c; } static void jsonAppendChar(JsonString *p, char c){ @@ -201577,24 +205450,27 @@ static void jsonAppendChar(JsonString *p, char c){ } } -/* Try to force the string to be a zero-terminated RCStr string. +/* Remove a single character from the end of the string +*/ +static void jsonStringTrimOneChar(JsonString *p){ + if( p->eErr==0 ){ + assert( p->nUsed>0 ); + p->nUsed--; + } +} + + +/* Make sure there is a zero terminator on p->zBuf[] ** ** Return true on success. Return false if an OOM prevents this ** from happening. */ -static int jsonForceRCStr(JsonString *p){ +static int jsonStringTerminate(JsonString *p){ jsonAppendChar(p, 0); - if( p->bErr ) return 0; - p->nUsed--; - if( p->bStatic==0 ) return 1; - p->nAlloc = 0; - p->nUsed++; - jsonGrow(p, p->nUsed); - p->nUsed--; - return p->bStatic==0; + jsonStringTrimOneChar(p); + return p->eErr==0; } - /* Append a comma separator to the output buffer, if the previous ** character is not '[' or '{'. */ @@ -201606,184 +205482,120 @@ static void jsonAppendSeparator(JsonString *p){ jsonAppendChar(p, ','); } -/* Append the N-byte string in zIn to the end of the JsonString string -** under construction. Enclose the string in "..." and escape -** any double-quotes or backslash characters contained within the -** string. +/* c is a control character. Append the canonical JSON representation +** of that control character to p. +** +** This routine assumes that the output buffer has already been enlarged +** sufficiently to hold the worst-case encoding plus a nul terminator. */ -static void jsonAppendString(JsonString *p, const char *zIn, u32 N){ - u32 i; - if( zIn==0 || ((N+p->nUsed+2 >= p->nAlloc) && jsonGrow(p,N+2)!=0) ) return; - p->zBuf[p->nUsed++] = '"'; - for(i=0; izBuf[p->nUsed++] = c; - }else if( c=='"' || c=='\\' ){ - json_simple_escape: - if( (p->nUsed+N+3-i > p->nAlloc) && jsonGrow(p,N+3-i)!=0 ) return; - p->zBuf[p->nUsed++] = '\\'; - p->zBuf[p->nUsed++] = c; - }else if( c=='\'' ){ - p->zBuf[p->nUsed++] = c; - }else{ - static const char aSpecial[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 'b', 't', 'n', 0, 'f', 'r', 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - assert( sizeof(aSpecial)==32 ); - assert( aSpecial['\b']=='b' ); - assert( aSpecial['\f']=='f' ); - assert( aSpecial['\n']=='n' ); - assert( aSpecial['\r']=='r' ); - assert( aSpecial['\t']=='t' ); - assert( c>=0 && cnUsed+N+7+i > p->nAlloc) && jsonGrow(p,N+7-i)!=0 ) return; - p->zBuf[p->nUsed++] = '\\'; - p->zBuf[p->nUsed++] = 'u'; - p->zBuf[p->nUsed++] = '0'; - p->zBuf[p->nUsed++] = '0'; - p->zBuf[p->nUsed++] = "0123456789abcdef"[c>>4]; - p->zBuf[p->nUsed++] = "0123456789abcdef"[c&0xf]; - } +static void jsonAppendControlChar(JsonString *p, u8 c){ + static const char aSpecial[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 'b', 't', 'n', 0, 'f', 'r', 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + assert( sizeof(aSpecial)==32 ); + assert( aSpecial['\b']=='b' ); + assert( aSpecial['\f']=='f' ); + assert( aSpecial['\n']=='n' ); + assert( aSpecial['\r']=='r' ); + assert( aSpecial['\t']=='t' ); + assert( c>=0 && cnUsed+7 <= p->nAlloc ); + if( aSpecial[c] ){ + p->zBuf[p->nUsed] = '\\'; + p->zBuf[p->nUsed+1] = aSpecial[c]; + p->nUsed += 2; + }else{ + p->zBuf[p->nUsed] = '\\'; + p->zBuf[p->nUsed+1] = 'u'; + p->zBuf[p->nUsed+2] = '0'; + p->zBuf[p->nUsed+3] = '0'; + p->zBuf[p->nUsed+4] = "0123456789abcdef"[c>>4]; + p->zBuf[p->nUsed+5] = "0123456789abcdef"[c&0xf]; + p->nUsed += 6; } - p->zBuf[p->nUsed++] = '"'; - assert( p->nUsednAlloc ); } -/* -** The zIn[0..N] string is a JSON5 string literal. Append to p a translation -** of the string literal that standard JSON and that omits all JSON5 -** features. +/* Append the N-byte string in zIn to the end of the JsonString string +** under construction. Enclose the string in double-quotes ("...") and +** escape any double-quotes or backslash characters contained within the +** string. +** +** This routine is a high-runner. There is a measurable performance +** increase associated with unwinding the jsonIsOk[] loop. */ -static void jsonAppendNormalizedString(JsonString *p, const char *zIn, u32 N){ - u32 i; - jsonAppendChar(p, '"'); - zIn++; - N -= 2; - while( N>0 ){ - for(i=0; i0 ){ - jsonAppendRawNZ(p, zIn, i); - zIn += i; - N -= i; - if( N==0 ) break; - } - assert( zIn[0]=='\\' ); - switch( (u8)zIn[1] ){ - case '\'': - jsonAppendChar(p, '\''); - break; - case 'v': - jsonAppendRawNZ(p, "\\u0009", 6); - break; - case 'x': - jsonAppendRawNZ(p, "\\u00", 4); - jsonAppendRawNZ(p, &zIn[2], 2); - zIn += 2; - N -= 2; - break; - case '0': - jsonAppendRawNZ(p, "\\u0000", 6); +static void jsonAppendString(JsonString *p, const char *zIn, u32 N){ + u32 k; + u8 c; + const u8 *z = (const u8*)zIn; + if( z==0 ) return; + if( (N+p->nUsed+2 >= p->nAlloc) && jsonStringGrow(p,N+2)!=0 ) return; + p->zBuf[p->nUsed++] = '"'; + while( 1 /*exit-by-break*/ ){ + k = 0; + /* The following while() is the 4-way unwound equivalent of + ** + ** while( k=N ){ + while( k=4 ); - assert( 0x80==(u8)zIn[2] ); - assert( 0xa8==(u8)zIn[3] || 0xa9==(u8)zIn[3] ); - zIn += 2; - N -= 2; + } + if( !jsonIsOk[z[k+2]] ){ + k += 2; break; - default: - jsonAppendRawNZ(p, zIn, 2); + } + if( !jsonIsOk[z[k+3]] ){ + k += 3; break; + }else{ + k += 4; + } } - zIn += 2; - N -= 2; - } - jsonAppendChar(p, '"'); -} - -/* -** The zIn[0..N] string is a JSON5 integer literal. Append to p a translation -** of the string literal that standard JSON and that omits all JSON5 -** features. -*/ -static void jsonAppendNormalizedInt(JsonString *p, const char *zIn, u32 N){ - if( zIn[0]=='+' ){ - zIn++; - N--; - }else if( zIn[0]=='-' ){ - jsonAppendChar(p, '-'); - zIn++; - N--; - } - if( zIn[0]=='0' && (zIn[1]=='x' || zIn[1]=='X') ){ - sqlite3_int64 i = 0; - int rc = sqlite3DecOrHexToI64(zIn, &i); - if( rc<=1 ){ - jsonPrintf(100,p,"%lld",i); + if( k>=N ){ + if( k>0 ){ + memcpy(&p->zBuf[p->nUsed], z, k); + p->nUsed += k; + } + break; + } + if( k>0 ){ + memcpy(&p->zBuf[p->nUsed], z, k); + p->nUsed += k; + z += k; + N -= k; + } + c = z[0]; + if( c=='"' || c=='\\' ){ + if( (p->nUsed+N+3 > p->nAlloc) && jsonStringGrow(p,N+3)!=0 ) return; + p->zBuf[p->nUsed++] = '\\'; + p->zBuf[p->nUsed++] = c; + }else if( c=='\'' ){ + p->zBuf[p->nUsed++] = c; }else{ - assert( rc==2 ); - jsonAppendRawNZ(p, "9.0e999", 7); + if( (p->nUsed+N+7 > p->nAlloc) && jsonStringGrow(p,N+7)!=0 ) return; + jsonAppendControlChar(p, c); } - return; - } - assert( N>0 ); - jsonAppendRawNZ(p, zIn, N); -} - -/* -** The zIn[0..N] string is a JSON5 real literal. Append to p a translation -** of the string literal that standard JSON and that omits all JSON5 -** features. -*/ -static void jsonAppendNormalizedReal(JsonString *p, const char *zIn, u32 N){ - u32 i; - if( zIn[0]=='+' ){ - zIn++; - N--; - }else if( zIn[0]=='-' ){ - jsonAppendChar(p, '-'); - zIn++; + z++; N--; } - if( zIn[0]=='.' ){ - jsonAppendChar(p, '0'); - } - for(i=0; i0 ){ - jsonAppendRawNZ(p, zIn, N); - } + p->zBuf[p->nUsed++] = '"'; + assert( p->nUsednAlloc ); } - - /* -** Append a function parameter value to the JSON string under -** construction. +** Append an sqlite3_value (such as a function parameter) to the JSON +** string under construction in p. */ -static void jsonAppendValue( +static void jsonAppendSqlValue( JsonString *p, /* Append to this JSON string */ sqlite3_value *pValue /* Value to append */ ){ @@ -201813,290 +205625,127 @@ static void jsonAppendValue( break; } default: { - if( p->bErr==0 ){ + if( jsonFuncArgMightBeBinary(pValue) ){ + JsonParse px; + memset(&px, 0, sizeof(px)); + px.aBlob = (u8*)sqlite3_value_blob(pValue); + px.nBlob = sqlite3_value_bytes(pValue); + jsonTranslateBlobToText(&px, 0, p); + }else if( p->eErr==0 ){ sqlite3_result_error(p->pCtx, "JSON cannot hold BLOB values", -1); - p->bErr = 2; - jsonReset(p); + p->eErr = JSTRING_ERR; + jsonStringReset(p); } break; } } } - -/* Make the JSON in p the result of the SQL function. +/* Make the text in p (which is probably a generated JSON text string) +** the result of the SQL function. +** +** The JsonString is reset. ** -** The JSON string is reset. +** If pParse and ctx are both non-NULL, then the SQL string in p is +** loaded into the zJson field of the pParse object as a RCStr and the +** pParse is added to the cache. */ -static void jsonResult(JsonString *p){ - if( p->bErr==0 ){ - if( p->bStatic ){ +static void jsonReturnString( + JsonString *p, /* String to return */ + JsonParse *pParse, /* JSONB source or NULL */ + sqlite3_context *ctx /* Where to cache */ +){ + assert( (pParse!=0)==(ctx!=0) ); + assert( ctx==0 || ctx==p->pCtx ); + if( p->eErr==0 ){ + int flags = SQLITE_PTR_TO_INT(sqlite3_user_data(p->pCtx)); + if( flags & JSON_BLOB ){ + jsonReturnStringAsBlob(p); + }else if( p->bStatic ){ sqlite3_result_text64(p->pCtx, p->zBuf, p->nUsed, SQLITE_TRANSIENT, SQLITE_UTF8); - }else if( jsonForceRCStr(p) ){ - sqlite3RCStrRef(p->zBuf); - sqlite3_result_text64(p->pCtx, p->zBuf, p->nUsed, - (void(*)(void*))sqlite3RCStrUnref, + }else if( jsonStringTerminate(p) ){ + if( pParse && pParse->bJsonIsRCStr==0 && pParse->nBlobAlloc>0 ){ + int rc; + pParse->zJson = sqlite3RCStrRef(p->zBuf); + pParse->nJson = p->nUsed; + pParse->bJsonIsRCStr = 1; + rc = jsonCacheInsert(ctx, pParse); + if( rc==SQLITE_NOMEM ){ + sqlite3_result_error_nomem(ctx); + jsonStringReset(p); + return; + } + } + sqlite3_result_text64(p->pCtx, sqlite3RCStrRef(p->zBuf), p->nUsed, + sqlite3RCStrUnref, SQLITE_UTF8); + }else{ + sqlite3_result_error_nomem(p->pCtx); } - } - if( p->bErr==1 ){ + }else if( p->eErr & JSTRING_OOM ){ sqlite3_result_error_nomem(p->pCtx); + }else if( p->eErr & JSTRING_MALFORMED ){ + sqlite3_result_error(p->pCtx, "malformed JSON", -1); } - jsonReset(p); + jsonStringReset(p); } /************************************************************************** -** Utility routines for dealing with JsonNode and JsonParse objects +** Utility routines for dealing with JsonParse objects **************************************************************************/ -/* -** Return the number of consecutive JsonNode slots need to represent -** the parsed JSON at pNode. The minimum answer is 1. For ARRAY and -** OBJECT types, the number might be larger. -** -** Appended elements are not counted. The value returned is the number -** by which the JsonNode counter should increment in order to go to the -** next peer value. -*/ -static u32 jsonNodeSize(JsonNode *pNode){ - return pNode->eType>=JSON_ARRAY ? pNode->n+1 : 1; -} - /* ** Reclaim all memory allocated by a JsonParse object. But do not ** delete the JsonParse object itself. */ static void jsonParseReset(JsonParse *pParse){ - while( pParse->pClup ){ - JsonCleanup *pTask = pParse->pClup; - pParse->pClup = pTask->pJCNext; - pTask->xOp(pTask->pArg); - sqlite3_free(pTask); - } assert( pParse->nJPRef<=1 ); - if( pParse->aNode ){ - sqlite3_free(pParse->aNode); - pParse->aNode = 0; - } - pParse->nNode = 0; - pParse->nAlloc = 0; - if( pParse->aUp ){ - sqlite3_free(pParse->aUp); - pParse->aUp = 0; - } if( pParse->bJsonIsRCStr ){ sqlite3RCStrUnref(pParse->zJson); pParse->zJson = 0; + pParse->nJson = 0; pParse->bJsonIsRCStr = 0; } - if( pParse->zAlt ){ - sqlite3RCStrUnref(pParse->zAlt); - pParse->zAlt = 0; + if( pParse->nBlobAlloc ){ + sqlite3DbFree(pParse->db, pParse->aBlob); + pParse->aBlob = 0; + pParse->nBlob = 0; + pParse->nBlobAlloc = 0; } } /* -** Free a JsonParse object that was obtained from sqlite3_malloc(). -** -** Note that destroying JsonParse might call sqlite3RCStrUnref() to -** destroy the zJson value. The RCStr object might recursively invoke -** JsonParse to destroy this pParse object again. Take care to ensure -** that this recursive destructor sequence terminates harmlessly. +** Decrement the reference count on the JsonParse object. When the +** count reaches zero, free the object. */ static void jsonParseFree(JsonParse *pParse){ - if( pParse->nJPRef>1 ){ - pParse->nJPRef--; - }else{ - jsonParseReset(pParse); - sqlite3_free(pParse); - } -} - -/* -** Add a cleanup task to the JsonParse object. -** -** If an OOM occurs, the cleanup operation happens immediately -** and this function returns SQLITE_NOMEM. -*/ -static int jsonParseAddCleanup( - JsonParse *pParse, /* Add the cleanup task to this parser */ - void(*xOp)(void*), /* The cleanup task */ - void *pArg /* Argument to the cleanup */ -){ - JsonCleanup *pTask = sqlite3_malloc64( sizeof(*pTask) ); - if( pTask==0 ){ - pParse->oom = 1; - xOp(pArg); - return SQLITE_ERROR; - } - pTask->pJCNext = pParse->pClup; - pParse->pClup = pTask; - pTask->xOp = xOp; - pTask->pArg = pArg; - return SQLITE_OK; -} - -/* -** Convert the JsonNode pNode into a pure JSON string and -** append to pOut. Subsubstructure is also included. Return -** the number of JsonNode objects that are encoded. -*/ -static void jsonRenderNode( - JsonParse *pParse, /* the complete parse of the JSON */ - JsonNode *pNode, /* The node to render */ - JsonString *pOut /* Write JSON here */ -){ - assert( pNode!=0 ); - while( (pNode->jnFlags & JNODE_REPLACE)!=0 && pParse->useMod ){ - u32 idx = (u32)(pNode - pParse->aNode); - u32 i = pParse->iSubst; - while( 1 /*exit-by-break*/ ){ - assert( inNode ); - assert( pParse->aNode[i].eType==JSON_SUBST ); - assert( pParse->aNode[i].eU==4 ); - assert( pParse->aNode[i].u.iPrevaNode[i].n==idx ){ - pNode = &pParse->aNode[i+1]; - break; - } - i = pParse->aNode[i].u.iPrev; - } - } - switch( pNode->eType ){ - default: { - assert( pNode->eType==JSON_NULL ); - jsonAppendRawNZ(pOut, "null", 4); - break; - } - case JSON_TRUE: { - jsonAppendRawNZ(pOut, "true", 4); - break; - } - case JSON_FALSE: { - jsonAppendRawNZ(pOut, "false", 5); - break; - } - case JSON_STRING: { - assert( pNode->eU==1 ); - if( pNode->jnFlags & JNODE_RAW ){ - if( pNode->jnFlags & JNODE_LABEL ){ - jsonAppendChar(pOut, '"'); - jsonAppendRaw(pOut, pNode->u.zJContent, pNode->n); - jsonAppendChar(pOut, '"'); - }else{ - jsonAppendString(pOut, pNode->u.zJContent, pNode->n); - } - }else if( pNode->jnFlags & JNODE_JSON5 ){ - jsonAppendNormalizedString(pOut, pNode->u.zJContent, pNode->n); - }else{ - assert( pNode->n>0 ); - jsonAppendRawNZ(pOut, pNode->u.zJContent, pNode->n); - } - break; - } - case JSON_REAL: { - assert( pNode->eU==1 ); - if( pNode->jnFlags & JNODE_JSON5 ){ - jsonAppendNormalizedReal(pOut, pNode->u.zJContent, pNode->n); - }else{ - assert( pNode->n>0 ); - jsonAppendRawNZ(pOut, pNode->u.zJContent, pNode->n); - } - break; - } - case JSON_INT: { - assert( pNode->eU==1 ); - if( pNode->jnFlags & JNODE_JSON5 ){ - jsonAppendNormalizedInt(pOut, pNode->u.zJContent, pNode->n); - }else{ - assert( pNode->n>0 ); - jsonAppendRawNZ(pOut, pNode->u.zJContent, pNode->n); - } - break; - } - case JSON_ARRAY: { - u32 j = 1; - jsonAppendChar(pOut, '['); - for(;;){ - while( j<=pNode->n ){ - if( (pNode[j].jnFlags & JNODE_REMOVE)==0 || pParse->useMod==0 ){ - jsonAppendSeparator(pOut); - jsonRenderNode(pParse, &pNode[j], pOut); - } - j += jsonNodeSize(&pNode[j]); - } - if( (pNode->jnFlags & JNODE_APPEND)==0 ) break; - if( pParse->useMod==0 ) break; - assert( pNode->eU==2 ); - pNode = &pParse->aNode[pNode->u.iAppend]; - j = 1; - } - jsonAppendChar(pOut, ']'); - break; - } - case JSON_OBJECT: { - u32 j = 1; - jsonAppendChar(pOut, '{'); - for(;;){ - while( j<=pNode->n ){ - if( (pNode[j+1].jnFlags & JNODE_REMOVE)==0 || pParse->useMod==0 ){ - jsonAppendSeparator(pOut); - jsonRenderNode(pParse, &pNode[j], pOut); - jsonAppendChar(pOut, ':'); - jsonRenderNode(pParse, &pNode[j+1], pOut); - } - j += 1 + jsonNodeSize(&pNode[j+1]); - } - if( (pNode->jnFlags & JNODE_APPEND)==0 ) break; - if( pParse->useMod==0 ) break; - assert( pNode->eU==2 ); - pNode = &pParse->aNode[pNode->u.iAppend]; - j = 1; - } - jsonAppendChar(pOut, '}'); - break; + if( pParse ){ + if( pParse->nJPRef>1 ){ + pParse->nJPRef--; + }else{ + jsonParseReset(pParse); + sqlite3DbFree(pParse->db, pParse); } } } -/* -** Return a JsonNode and all its descendants as a JSON string. -*/ -static void jsonReturnJson( - JsonParse *pParse, /* The complete JSON */ - JsonNode *pNode, /* Node to return */ - sqlite3_context *pCtx, /* Return value for this function */ - int bGenerateAlt /* Also store the rendered text in zAlt */ -){ - JsonString s; - if( pParse->oom ){ - sqlite3_result_error_nomem(pCtx); - return; - } - if( pParse->nErr==0 ){ - jsonInit(&s, pCtx); - jsonRenderNode(pParse, pNode, &s); - if( bGenerateAlt && pParse->zAlt==0 && jsonForceRCStr(&s) ){ - pParse->zAlt = sqlite3RCStrRef(s.zBuf); - pParse->nAlt = s.nUsed; - } - jsonResult(&s); - sqlite3_result_subtype(pCtx, JSON_SUBTYPE); - } -} +/************************************************************************** +** Utility routines for the JSON text parser +**************************************************************************/ /* ** Translate a single byte of Hex into an integer. -** This routine only works if h really is a valid hexadecimal -** character: 0..9a..fA..F +** This routine only gives a correct answer if h really is a valid hexadecimal +** character: 0..9a..fA..F. But unlike sqlite3HexToInt(), it does not +** assert() if the digit is not hex. */ static u8 jsonHexToInt(int h){ - assert( (h>='0' && h<='9') || (h>='a' && h<='f') || (h>='A' && h<='F') ); +#ifdef SQLITE_ASCII + h += 9*(1&(h>>6)); +#endif #ifdef SQLITE_EBCDIC h += 9*(1&~(h>>4)); -#else - h += 9*(1&(h>>6)); #endif return (u8)(h & 0xf); } @@ -202106,10 +205755,6 @@ static u8 jsonHexToInt(int h){ */ static u32 jsonHexToInt4(const char *z){ u32 v; - assert( sqlite3Isxdigit(z[0]) ); - assert( sqlite3Isxdigit(z[1]) ); - assert( sqlite3Isxdigit(z[2]) ); - assert( sqlite3Isxdigit(z[3]) ); v = (jsonHexToInt(z[0])<<12) + (jsonHexToInt(z[1])<<8) + (jsonHexToInt(z[2])<<4) @@ -202117,281 +205762,6 @@ static u32 jsonHexToInt4(const char *z){ return v; } -/* -** Make the JsonNode the return value of the function. -*/ -static void jsonReturn( - JsonParse *pParse, /* Complete JSON parse tree */ - JsonNode *pNode, /* Node to return */ - sqlite3_context *pCtx /* Return value for this function */ -){ - switch( pNode->eType ){ - default: { - assert( pNode->eType==JSON_NULL ); - sqlite3_result_null(pCtx); - break; - } - case JSON_TRUE: { - sqlite3_result_int(pCtx, 1); - break; - } - case JSON_FALSE: { - sqlite3_result_int(pCtx, 0); - break; - } - case JSON_INT: { - sqlite3_int64 i = 0; - int rc; - int bNeg = 0; - const char *z; - - assert( pNode->eU==1 ); - z = pNode->u.zJContent; - if( z[0]=='-' ){ z++; bNeg = 1; } - else if( z[0]=='+' ){ z++; } - rc = sqlite3DecOrHexToI64(z, &i); - if( rc<=1 ){ - sqlite3_result_int64(pCtx, bNeg ? -i : i); - }else if( rc==3 && bNeg ){ - sqlite3_result_int64(pCtx, SMALLEST_INT64); - }else{ - goto to_double; - } - break; - } - case JSON_REAL: { - double r; - const char *z; - assert( pNode->eU==1 ); - to_double: - z = pNode->u.zJContent; - sqlite3AtoF(z, &r, sqlite3Strlen30(z), SQLITE_UTF8); - sqlite3_result_double(pCtx, r); - break; - } - case JSON_STRING: { - if( pNode->jnFlags & JNODE_RAW ){ - assert( pNode->eU==1 ); - sqlite3_result_text(pCtx, pNode->u.zJContent, pNode->n, - SQLITE_TRANSIENT); - }else if( (pNode->jnFlags & JNODE_ESCAPE)==0 ){ - /* JSON formatted without any backslash-escapes */ - assert( pNode->eU==1 ); - sqlite3_result_text(pCtx, pNode->u.zJContent+1, pNode->n-2, - SQLITE_TRANSIENT); - }else{ - /* Translate JSON formatted string into raw text */ - u32 i; - u32 n = pNode->n; - const char *z; - char *zOut; - u32 j; - u32 nOut = n; - assert( pNode->eU==1 ); - z = pNode->u.zJContent; - zOut = sqlite3_malloc( nOut+1 ); - if( zOut==0 ){ - sqlite3_result_error_nomem(pCtx); - break; - } - for(i=1, j=0; i>6)); - zOut[j++] = 0x80 | (v&0x3f); - }else{ - u32 vlo; - if( (v&0xfc00)==0xd800 - && i>18); - zOut[j++] = 0x80 | ((v>>12)&0x3f); - zOut[j++] = 0x80 | ((v>>6)&0x3f); - zOut[j++] = 0x80 | (v&0x3f); - }else{ - zOut[j++] = 0xe0 | (v>>12); - zOut[j++] = 0x80 | ((v>>6)&0x3f); - zOut[j++] = 0x80 | (v&0x3f); - } - } - continue; - }else if( c=='b' ){ - c = '\b'; - }else if( c=='f' ){ - c = '\f'; - }else if( c=='n' ){ - c = '\n'; - }else if( c=='r' ){ - c = '\r'; - }else if( c=='t' ){ - c = '\t'; - }else if( c=='v' ){ - c = '\v'; - }else if( c=='\'' || c=='"' || c=='/' || c=='\\' ){ - /* pass through unchanged */ - }else if( c=='0' ){ - c = 0; - }else if( c=='x' ){ - c = (jsonHexToInt(z[i+1])<<4) | jsonHexToInt(z[i+2]); - i += 2; - }else if( c=='\r' && z[i+1]=='\n' ){ - i++; - continue; - }else if( 0xe2==(u8)c ){ - assert( 0x80==(u8)z[i+1] ); - assert( 0xa8==(u8)z[i+2] || 0xa9==(u8)z[i+2] ); - i += 2; - continue; - }else{ - continue; - } - } /* end if( c=='\\' ) */ - zOut[j++] = c; - } /* end for() */ - zOut[j] = 0; - sqlite3_result_text(pCtx, zOut, j, sqlite3_free); - } - break; - } - case JSON_ARRAY: - case JSON_OBJECT: { - jsonReturnJson(pParse, pNode, pCtx, 0); - break; - } - } -} - -/* Forward reference */ -static int jsonParseAddNode(JsonParse*,u32,u32,const char*); - -/* -** A macro to hint to the compiler that a function should not be -** inlined. -*/ -#if defined(__GNUC__) -# define JSON_NOINLINE __attribute__((noinline)) -#elif defined(_MSC_VER) && _MSC_VER>=1310 -# define JSON_NOINLINE __declspec(noinline) -#else -# define JSON_NOINLINE -#endif - - -/* -** Add a single node to pParse->aNode after first expanding the -** size of the aNode array. Return the index of the new node. -** -** If an OOM error occurs, set pParse->oom and return -1. -*/ -static JSON_NOINLINE int jsonParseAddNodeExpand( - JsonParse *pParse, /* Append the node to this object */ - u32 eType, /* Node type */ - u32 n, /* Content size or sub-node count */ - const char *zContent /* Content */ -){ - u32 nNew; - JsonNode *pNew; - assert( pParse->nNode>=pParse->nAlloc ); - if( pParse->oom ) return -1; - nNew = pParse->nAlloc*2 + 10; - pNew = sqlite3_realloc64(pParse->aNode, sizeof(JsonNode)*nNew); - if( pNew==0 ){ - pParse->oom = 1; - return -1; - } - pParse->nAlloc = sqlite3_msize(pNew)/sizeof(JsonNode); - pParse->aNode = pNew; - assert( pParse->nNodenAlloc ); - return jsonParseAddNode(pParse, eType, n, zContent); -} - -/* -** Create a new JsonNode instance based on the arguments and append that -** instance to the JsonParse. Return the index in pParse->aNode[] of the -** new node, or -1 if a memory allocation fails. -*/ -static int jsonParseAddNode( - JsonParse *pParse, /* Append the node to this object */ - u32 eType, /* Node type */ - u32 n, /* Content size or sub-node count */ - const char *zContent /* Content */ -){ - JsonNode *p; - assert( pParse->aNode!=0 || pParse->nNode>=pParse->nAlloc ); - if( pParse->nNode>=pParse->nAlloc ){ - return jsonParseAddNodeExpand(pParse, eType, n, zContent); - } - assert( pParse->aNode!=0 ); - p = &pParse->aNode[pParse->nNode]; - assert( p!=0 ); - p->eType = (u8)(eType & 0xff); - p->jnFlags = (u8)(eType >> 8); - VVA( p->eU = zContent ? 1 : 0 ); - p->n = n; - p->u.zJContent = zContent; - return pParse->nNode++; -} - -/* -** Add an array of new nodes to the current pParse->aNode array. -** Return the index of the first node added. -** -** If an OOM error occurs, set pParse->oom. -*/ -static void jsonParseAddNodeArray( - JsonParse *pParse, /* Append the node to this object */ - JsonNode *aNode, /* Array of nodes to add */ - u32 nNode /* Number of elements in aNew */ -){ - assert( aNode!=0 ); - assert( nNode>=1 ); - if( pParse->nNode + nNode > pParse->nAlloc ){ - u32 nNew = pParse->nNode + nNode; - JsonNode *aNew = sqlite3_realloc64(pParse->aNode, nNew*sizeof(JsonNode)); - if( aNew==0 ){ - pParse->oom = 1; - return; - } - pParse->nAlloc = sqlite3_msize(aNew)/sizeof(JsonNode); - pParse->aNode = aNew; - } - memcpy(&pParse->aNode[pParse->nNode], aNode, nNode*sizeof(JsonNode)); - pParse->nNode += nNode; -} - -/* -** Add a new JSON_SUBST node. The node immediately following -** this new node will be the substitute content for iNode. -*/ -static int jsonParseAddSubstNode( - JsonParse *pParse, /* Add the JSON_SUBST here */ - u32 iNode /* References this node */ -){ - int idx = jsonParseAddNode(pParse, JSON_SUBST, iNode, 0); - if( pParse->oom ) return -1; - pParse->aNode[iNode].jnFlags |= JNODE_REPLACE; - pParse->aNode[idx].eU = 4; - pParse->aNode[idx].u.iPrev = pParse->iSubst; - pParse->iSubst = idx; - pParse->hasMod = 1; - pParse->useMod = 1; - return idx; -} - /* ** Return true if z[] begins with 2 (or more) hexadecimal digits */ @@ -202545,63 +205915,503 @@ static const struct NanInfName { char *zMatch; char *zRepl; } aNanInfName[] = { - { 'i', 'I', 3, JSON_REAL, 7, "inf", "9.0e999" }, - { 'i', 'I', 8, JSON_REAL, 7, "infinity", "9.0e999" }, - { 'n', 'N', 3, JSON_NULL, 4, "NaN", "null" }, - { 'q', 'Q', 4, JSON_NULL, 4, "QNaN", "null" }, - { 's', 'S', 4, JSON_NULL, 4, "SNaN", "null" }, + { 'i', 'I', 3, JSONB_FLOAT, 7, "inf", "9.0e999" }, + { 'i', 'I', 8, JSONB_FLOAT, 7, "infinity", "9.0e999" }, + { 'n', 'N', 3, JSONB_NULL, 4, "NaN", "null" }, + { 'q', 'Q', 4, JSONB_NULL, 4, "QNaN", "null" }, + { 's', 'S', 4, JSONB_NULL, 4, "SNaN", "null" }, }; + /* -** Parse a single JSON value which begins at pParse->zJson[i]. Return the -** index of the first character past the end of the value parsed. +** Report the wrong number of arguments for json_insert(), json_replace() +** or json_set(). +*/ +static void jsonWrongNumArgs( + sqlite3_context *pCtx, + const char *zFuncName +){ + char *zMsg = sqlite3_mprintf("json_%s() needs an odd number of arguments", + zFuncName); + sqlite3_result_error(pCtx, zMsg, -1); + sqlite3_free(zMsg); +} + +/**************************************************************************** +** Utility routines for dealing with the binary BLOB representation of JSON +****************************************************************************/ + +/* +** Expand pParse->aBlob so that it holds at least N bytes. ** -** Special return values: +** Return the number of errors. +*/ +static int jsonBlobExpand(JsonParse *pParse, u32 N){ + u8 *aNew; + u32 t; + assert( N>pParse->nBlobAlloc ); + if( pParse->nBlobAlloc==0 ){ + t = 100; + }else{ + t = pParse->nBlobAlloc*2; + } + if( tdb, pParse->aBlob, t); + if( aNew==0 ){ pParse->oom = 1; return 1; } + pParse->aBlob = aNew; + pParse->nBlobAlloc = t; + return 0; +} + +/* +** If pParse->aBlob is not previously editable (because it is taken +** from sqlite3_value_blob(), as indicated by the fact that +** pParse->nBlobAlloc==0 and pParse->nBlob>0) then make it editable +** by making a copy into space obtained from malloc. +** +** Return true on success. Return false on OOM. +*/ +static int jsonBlobMakeEditable(JsonParse *pParse, u32 nExtra){ + u8 *aOld; + u32 nSize; + assert( !pParse->bReadOnly ); + if( pParse->oom ) return 0; + if( pParse->nBlobAlloc>0 ) return 1; + aOld = pParse->aBlob; + nSize = pParse->nBlob + nExtra; + pParse->aBlob = 0; + if( jsonBlobExpand(pParse, nSize) ){ + return 0; + } + assert( pParse->nBlobAlloc >= pParse->nBlob + nExtra ); + memcpy(pParse->aBlob, aOld, pParse->nBlob); + return 1; +} + +/* Expand pParse->aBlob and append one bytes. +*/ +static SQLITE_NOINLINE void jsonBlobExpandAndAppendOneByte( + JsonParse *pParse, + u8 c +){ + jsonBlobExpand(pParse, pParse->nBlob+1); + if( pParse->oom==0 ){ + assert( pParse->nBlob+1<=pParse->nBlobAlloc ); + pParse->aBlob[pParse->nBlob++] = c; + } +} + +/* Append a single character. +*/ +static void jsonBlobAppendOneByte(JsonParse *pParse, u8 c){ + if( pParse->nBlob >= pParse->nBlobAlloc ){ + jsonBlobExpandAndAppendOneByte(pParse, c); + }else{ + pParse->aBlob[pParse->nBlob++] = c; + } +} + +/* Slow version of jsonBlobAppendNode() that first resizes the +** pParse->aBlob structure. +*/ +static void jsonBlobAppendNode(JsonParse*,u8,u32,const void*); +static SQLITE_NOINLINE void jsonBlobExpandAndAppendNode( + JsonParse *pParse, + u8 eType, + u32 szPayload, + const void *aPayload +){ + if( jsonBlobExpand(pParse, pParse->nBlob+szPayload+9) ) return; + jsonBlobAppendNode(pParse, eType, szPayload, aPayload); +} + + +/* Append an node type byte together with the payload size and +** possibly also the payload. +** +** If aPayload is not NULL, then it is a pointer to the payload which +** is also appended. If aPayload is NULL, the pParse->aBlob[] array +** is resized (if necessary) so that it is big enough to hold the +** payload, but the payload is not appended and pParse->nBlob is left +** pointing to where the first byte of payload will eventually be. +*/ +static void jsonBlobAppendNode( + JsonParse *pParse, /* The JsonParse object under construction */ + u8 eType, /* Node type. One of JSONB_* */ + u32 szPayload, /* Number of bytes of payload */ + const void *aPayload /* The payload. Might be NULL */ +){ + u8 *a; + if( pParse->nBlob+szPayload+9 > pParse->nBlobAlloc ){ + jsonBlobExpandAndAppendNode(pParse,eType,szPayload,aPayload); + return; + } + assert( pParse->aBlob!=0 ); + a = &pParse->aBlob[pParse->nBlob]; + if( szPayload<=11 ){ + a[0] = eType | (szPayload<<4); + pParse->nBlob += 1; + }else if( szPayload<=0xff ){ + a[0] = eType | 0xc0; + a[1] = szPayload & 0xff; + pParse->nBlob += 2; + }else if( szPayload<=0xffff ){ + a[0] = eType | 0xd0; + a[1] = (szPayload >> 8) & 0xff; + a[2] = szPayload & 0xff; + pParse->nBlob += 3; + }else{ + a[0] = eType | 0xe0; + a[1] = (szPayload >> 24) & 0xff; + a[2] = (szPayload >> 16) & 0xff; + a[3] = (szPayload >> 8) & 0xff; + a[4] = szPayload & 0xff; + pParse->nBlob += 5; + } + if( aPayload ){ + pParse->nBlob += szPayload; + memcpy(&pParse->aBlob[pParse->nBlob-szPayload], aPayload, szPayload); + } +} + +/* Change the payload size for the node at index i to be szPayload. +*/ +static int jsonBlobChangePayloadSize( + JsonParse *pParse, + u32 i, + u32 szPayload +){ + u8 *a; + u8 szType; + u8 nExtra; + u8 nNeeded; + int delta; + if( pParse->oom ) return 0; + a = &pParse->aBlob[i]; + szType = a[0]>>4; + if( szType<=11 ){ + nExtra = 0; + }else if( szType==12 ){ + nExtra = 1; + }else if( szType==13 ){ + nExtra = 2; + }else{ + nExtra = 4; + } + if( szPayload<=11 ){ + nNeeded = 0; + }else if( szPayload<=0xff ){ + nNeeded = 1; + }else if( szPayload<=0xffff ){ + nNeeded = 2; + }else{ + nNeeded = 4; + } + delta = nNeeded - nExtra; + if( delta ){ + u32 newSize = pParse->nBlob + delta; + if( delta>0 ){ + if( newSize>pParse->nBlobAlloc && jsonBlobExpand(pParse, newSize) ){ + return 0; /* OOM error. Error state recorded in pParse->oom. */ + } + a = &pParse->aBlob[i]; + memmove(&a[1+delta], &a[1], pParse->nBlob - (i+1)); + }else{ + memmove(&a[1], &a[1-delta], pParse->nBlob - (i+1-delta)); + } + pParse->nBlob = newSize; + } + if( nNeeded==0 ){ + a[0] = (a[0] & 0x0f) | (szPayload<<4); + }else if( nNeeded==1 ){ + a[0] = (a[0] & 0x0f) | 0xc0; + a[1] = szPayload & 0xff; + }else if( nNeeded==2 ){ + a[0] = (a[0] & 0x0f) | 0xd0; + a[1] = (szPayload >> 8) & 0xff; + a[2] = szPayload & 0xff; + }else{ + a[0] = (a[0] & 0x0f) | 0xe0; + a[1] = (szPayload >> 24) & 0xff; + a[2] = (szPayload >> 16) & 0xff; + a[3] = (szPayload >> 8) & 0xff; + a[4] = szPayload & 0xff; + } + return delta; +} + +/* +** If z[0] is 'u' and is followed by exactly 4 hexadecimal character, +** then set *pOp to JSONB_TEXTJ and return true. If not, do not make +** any changes to *pOp and return false. +*/ +static int jsonIs4HexB(const char *z, int *pOp){ + if( z[0]!='u' ) return 0; + if( !jsonIs4Hex(&z[1]) ) return 0; + *pOp = JSONB_TEXTJ; + return 1; +} + +/* +** Check a single element of the JSONB in pParse for validity. +** +** The element to be checked starts at offset i and must end at on the +** last byte before iEnd. +** +** Return 0 if everything is correct. Return the 1-based byte offset of the +** error if a problem is detected. (In other words, if the error is at offset +** 0, return 1). +*/ +static u32 jsonbValidityCheck( + const JsonParse *pParse, /* Input JSONB. Only aBlob and nBlob are used */ + u32 i, /* Start of element as pParse->aBlob[i] */ + u32 iEnd, /* One more than the last byte of the element */ + u32 iDepth /* Current nesting depth */ +){ + u32 n, sz, j, k; + const u8 *z; + u8 x; + if( iDepth>JSON_MAX_DEPTH ) return i+1; + sz = 0; + n = jsonbPayloadSize(pParse, i, &sz); + if( NEVER(n==0) ) return i+1; /* Checked by caller */ + if( NEVER(i+n+sz!=iEnd) ) return i+1; /* Checked by caller */ + z = pParse->aBlob; + x = z[i] & 0x0f; + switch( x ){ + case JSONB_NULL: + case JSONB_TRUE: + case JSONB_FALSE: { + return n+sz==1 ? 0 : i+1; + } + case JSONB_INT: { + if( sz<1 ) return i+1; + j = i+n; + if( z[j]=='-' ){ + j++; + if( sz<2 ) return i+1; + } + k = i+n+sz; + while( jk ) return j+1; + if( z[j+1]!='.' && z[j+1]!='e' && z[j+1]!='E' ) return j+1; + j++; + } + for(; j0 ) return j+1; + if( x==JSONB_FLOAT && (j==k-1 || !sqlite3Isdigit(z[j+1])) ){ + return j+1; + } + seen = 1; + continue; + } + if( z[j]=='e' || z[j]=='E' ){ + if( seen==2 ) return j+1; + if( j==k-1 ) return j+1; + if( z[j+1]=='+' || z[j+1]=='-' ){ + j++; + if( j==k-1 ) return j+1; + } + seen = 2; + continue; + } + return j+1; + } + if( seen==0 ) return i+1; + return 0; + } + case JSONB_TEXT: { + j = i+n; + k = j+sz; + while( j=k ){ + return j+1; + }else if( strchr("\"\\/bfnrt",z[j+1])!=0 ){ + j++; + }else if( z[j+1]=='u' ){ + if( j+5>=k ) return j+1; + if( !jsonIs4Hex((const char*)&z[j+2]) ) return j+1; + j++; + }else if( x!=JSONB_TEXT5 ){ + return j+1; + }else{ + u32 c = 0; + u32 szC = jsonUnescapeOneChar((const char*)&z[j], k-j, &c); + if( c==JSON_INVALID_CHAR ) return j+1; + j += szC - 1; + } + } + j++; + } + return 0; + } + case JSONB_TEXTRAW: { + return 0; + } + case JSONB_ARRAY: { + u32 sub; + j = i+n; + k = j+sz; + while( jk ) return j+1; + sub = jsonbValidityCheck(pParse, j, j+n+sz, iDepth+1); + if( sub ) return sub; + j += n + sz; + } + assert( j==k ); + return 0; + } + case JSONB_OBJECT: { + u32 cnt = 0; + u32 sub; + j = i+n; + k = j+sz; + while( jk ) return j+1; + if( (cnt & 1)==0 ){ + x = z[j] & 0x0f; + if( xJSONB_TEXTRAW ) return j+1; + } + sub = jsonbValidityCheck(pParse, j, j+n+sz, iDepth+1); + if( sub ) return sub; + cnt++; + j += n + sz; + } + assert( j==k ); + if( (cnt & 1)!=0 ) return j+1; + return 0; + } + default: { + return i+1; + } + } +} + +/* +** Translate a single element of JSON text at pParse->zJson[i] into +** its equivalent binary JSONB representation. Append the translation into +** pParse->aBlob[] beginning at pParse->nBlob. The size of +** pParse->aBlob[] is increased as necessary. +** +** Return the index of the first character past the end of the element parsed, +** or one of the following special result codes: ** ** 0 End of input -** -1 Syntax error -** -2 '}' seen -** -3 ']' seen -** -4 ',' seen -** -5 ':' seen +** -1 Syntax error or OOM +** -2 '}' seen \ +** -3 ']' seen \___ For these returns, pParse->iErr is set to +** -4 ',' seen / the index in zJson[] of the seen character +** -5 ':' seen / */ -static int jsonParseValue(JsonParse *pParse, u32 i){ +static int jsonTranslateTextToBlob(JsonParse *pParse, u32 i){ char c; u32 j; - int iThis; + u32 iThis, iStart; int x; - JsonNode *pNode; + u8 t; const char *z = pParse->zJson; json_parse_restart: switch( (u8)z[i] ){ case '{': { /* Parse object */ - iThis = jsonParseAddNode(pParse, JSON_OBJECT, 0, 0); - if( iThis<0 ) return -1; + iThis = pParse->nBlob; + jsonBlobAppendNode(pParse, JSONB_OBJECT, pParse->nJson-i, 0); if( ++pParse->iDepth > JSON_MAX_DEPTH ){ pParse->iErr = i; return -1; } + iStart = pParse->nBlob; for(j=i+1;;j++){ - u32 nNode = pParse->nNode; - x = jsonParseValue(pParse, j); + u32 iBlob = pParse->nBlob; + x = jsonTranslateTextToBlob(pParse, j); if( x<=0 ){ + int op; if( x==(-2) ){ j = pParse->iErr; - if( pParse->nNode!=(u32)iThis+1 ) pParse->hasNonstd = 1; + if( pParse->nBlob!=(u32)iStart ) pParse->hasNonstd = 1; break; } j += json5Whitespace(&z[j]); + op = JSONB_TEXT; if( sqlite3JsonId1(z[j]) - || (z[j]=='\\' && z[j+1]=='u' && jsonIs4Hex(&z[j+2])) + || (z[j]=='\\' && jsonIs4HexB(&z[j+1], &op)) ){ int k = j+1; while( (sqlite3JsonId2(z[k]) && json5Whitespace(&z[k])==0) - || (z[k]=='\\' && z[k+1]=='u' && jsonIs4Hex(&z[k+2])) + || (z[k]=='\\' && jsonIs4HexB(&z[k+1], &op)) ){ k++; } - jsonParseAddNode(pParse, JSON_STRING | (JNODE_RAW<<8), k-j, &z[j]); + assert( iBlob==pParse->nBlob ); + jsonBlobAppendNode(pParse, op, k-j, &z[j]); pParse->hasNonstd = 1; x = k; }else{ @@ -202610,24 +206420,24 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ } } if( pParse->oom ) return -1; - pNode = &pParse->aNode[nNode]; - if( pNode->eType!=JSON_STRING ){ + t = pParse->aBlob[iBlob] & 0x0f; + if( tJSONB_TEXTRAW ){ pParse->iErr = j; return -1; } - pNode->jnFlags |= JNODE_LABEL; j = x; if( z[j]==':' ){ j++; }else{ - if( fast_isspace(z[j]) ){ - do{ j++; }while( fast_isspace(z[j]) ); + if( jsonIsspace(z[j]) ){ + /* strspn() is not helpful here */ + do{ j++; }while( jsonIsspace(z[j]) ); if( z[j]==':' ){ j++; goto parse_object_value; } } - x = jsonParseValue(pParse, j); + x = jsonTranslateTextToBlob(pParse, j); if( x!=(-5) ){ if( x!=(-1) ) pParse->iErr = j; return -1; @@ -202635,7 +206445,7 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ j = pParse->iErr+1; } parse_object_value: - x = jsonParseValue(pParse, j); + x = jsonTranslateTextToBlob(pParse, j); if( x<=0 ){ if( x!=(-1) ) pParse->iErr = j; return -1; @@ -202646,15 +206456,15 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ }else if( z[j]=='}' ){ break; }else{ - if( fast_isspace(z[j]) ){ - do{ j++; }while( fast_isspace(z[j]) ); + if( jsonIsspace(z[j]) ){ + j += 1 + (u32)strspn(&z[j+1], jsonSpaces); if( z[j]==',' ){ continue; }else if( z[j]=='}' ){ break; } } - x = jsonParseValue(pParse, j); + x = jsonTranslateTextToBlob(pParse, j); if( x==(-4) ){ j = pParse->iErr; continue; @@ -202667,25 +206477,27 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ pParse->iErr = j; return -1; } - pParse->aNode[iThis].n = pParse->nNode - (u32)iThis - 1; + jsonBlobChangePayloadSize(pParse, iThis, pParse->nBlob - iStart); pParse->iDepth--; return j+1; } case '[': { /* Parse array */ - iThis = jsonParseAddNode(pParse, JSON_ARRAY, 0, 0); - if( iThis<0 ) return -1; + iThis = pParse->nBlob; + assert( i<=(u32)pParse->nJson ); + jsonBlobAppendNode(pParse, JSONB_ARRAY, pParse->nJson - i, 0); + iStart = pParse->nBlob; + if( pParse->oom ) return -1; if( ++pParse->iDepth > JSON_MAX_DEPTH ){ pParse->iErr = i; return -1; } - memset(&pParse->aNode[iThis].u, 0, sizeof(pParse->aNode[iThis].u)); for(j=i+1;;j++){ - x = jsonParseValue(pParse, j); + x = jsonTranslateTextToBlob(pParse, j); if( x<=0 ){ if( x==(-3) ){ j = pParse->iErr; - if( pParse->nNode!=(u32)iThis+1 ) pParse->hasNonstd = 1; + if( pParse->nBlob!=iStart ) pParse->hasNonstd = 1; break; } if( x!=(-1) ) pParse->iErr = j; @@ -202697,15 +206509,15 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ }else if( z[j]==']' ){ break; }else{ - if( fast_isspace(z[j]) ){ - do{ j++; }while( fast_isspace(z[j]) ); + if( jsonIsspace(z[j]) ){ + j += 1 + (u32)strspn(&z[j+1], jsonSpaces); if( z[j]==',' ){ continue; }else if( z[j]==']' ){ break; } } - x = jsonParseValue(pParse, j); + x = jsonTranslateTextToBlob(pParse, j); if( x==(-4) ){ j = pParse->iErr; continue; @@ -202718,23 +206530,33 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ pParse->iErr = j; return -1; } - pParse->aNode[iThis].n = pParse->nNode - (u32)iThis - 1; + jsonBlobChangePayloadSize(pParse, iThis, pParse->nBlob - iStart); pParse->iDepth--; return j+1; } case '\'': { - u8 jnFlags; + u8 opcode; char cDelim; pParse->hasNonstd = 1; - jnFlags = JNODE_JSON5; + opcode = JSONB_TEXT; goto parse_string; case '"': /* Parse string */ - jnFlags = 0; + opcode = JSONB_TEXT; parse_string: cDelim = z[i]; - for(j=i+1; 1; j++){ - if( jsonIsOk[(unsigned char)z[j]] ) continue; + j = i+1; + while( 1 /*exit-by-break*/ ){ + if( jsonIsOk[(u8)z[j]] ){ + if( !jsonIsOk[(u8)z[j+1]] ){ + j += 1; + }else if( !jsonIsOk[(u8)z[j+2]] ){ + j += 2; + }else{ + j += 3; + continue; + } + } c = z[j]; if( c==cDelim ){ break; @@ -202743,33 +206565,41 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ if( c=='"' || c=='\\' || c=='/' || c=='b' || c=='f' || c=='n' || c=='r' || c=='t' || (c=='u' && jsonIs4Hex(&z[j+1])) ){ - jnFlags |= JNODE_ESCAPE; + if( opcode==JSONB_TEXT ) opcode = JSONB_TEXTJ; }else if( c=='\'' || c=='0' || c=='v' || c=='\n' || (0xe2==(u8)c && 0x80==(u8)z[j+1] && (0xa8==(u8)z[j+2] || 0xa9==(u8)z[j+2])) || (c=='x' && jsonIs2Hex(&z[j+1])) ){ - jnFlags |= (JNODE_ESCAPE|JNODE_JSON5); + opcode = JSONB_TEXT5; pParse->hasNonstd = 1; }else if( c=='\r' ){ if( z[j+1]=='\n' ) j++; - jnFlags |= (JNODE_ESCAPE|JNODE_JSON5); + opcode = JSONB_TEXT5; pParse->hasNonstd = 1; }else{ pParse->iErr = j; return -1; } }else if( c<=0x1f ){ - /* Control characters are not allowed in strings */ - pParse->iErr = j; - return -1; + if( c==0 ){ + pParse->iErr = j; + return -1; + } + /* Control characters are not allowed in canonical JSON string + ** literals, but are allowed in JSON5 string literals. */ + opcode = JSONB_TEXT5; + pParse->hasNonstd = 1; + }else if( c=='"' ){ + opcode = JSONB_TEXT5; } + j++; } - jsonParseAddNode(pParse, JSON_STRING | (jnFlags<<8), j+1-i, &z[i]); + jsonBlobAppendNode(pParse, opcode, j-1-i, &z[i+1]); return j+1; } case 't': { if( strncmp(z+i,"true",4)==0 && !sqlite3Isalnum(z[i+4]) ){ - jsonParseAddNode(pParse, JSON_TRUE, 0, 0); + jsonBlobAppendOneByte(pParse, JSONB_TRUE); return i+4; } pParse->iErr = i; @@ -202777,23 +206607,22 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ } case 'f': { if( strncmp(z+i,"false",5)==0 && !sqlite3Isalnum(z[i+5]) ){ - jsonParseAddNode(pParse, JSON_FALSE, 0, 0); + jsonBlobAppendOneByte(pParse, JSONB_FALSE); return i+5; } pParse->iErr = i; return -1; } case '+': { - u8 seenDP, seenE, jnFlags; + u8 seenE; pParse->hasNonstd = 1; - jnFlags = JNODE_JSON5; + t = 0x00; /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ goto parse_number; case '.': if( sqlite3Isdigit(z[i+1]) ){ pParse->hasNonstd = 1; - jnFlags = JNODE_JSON5; + t = 0x03; /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ seenE = 0; - seenDP = JSON_REAL; goto parse_number_2; } pParse->iErr = i; @@ -202810,9 +206639,8 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ case '8': case '9': /* Parse number */ - jnFlags = 0; + t = 0x00; /* Bit 0x01: JSON5. Bit 0x02: FLOAT */ parse_number: - seenDP = JSON_INT; seenE = 0; assert( '-' < '0' ); assert( '+' < '0' ); @@ -202822,9 +206650,9 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ if( c<='0' ){ if( c=='0' ){ if( (z[i+1]=='x' || z[i+1]=='X') && sqlite3Isxdigit(z[i+2]) ){ - assert( seenDP==JSON_INT ); + assert( t==0x00 ); pParse->hasNonstd = 1; - jnFlags |= JNODE_JSON5; + t = 0x01; for(j=i+3; sqlite3Isxdigit(z[j]); j++){} goto parse_number_finish; }else if( sqlite3Isdigit(z[i+1]) ){ @@ -202841,15 +206669,15 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ ){ pParse->hasNonstd = 1; if( z[i]=='-' ){ - jsonParseAddNode(pParse, JSON_REAL, 8, "-9.0e999"); + jsonBlobAppendNode(pParse, JSONB_FLOAT, 6, "-9e999"); }else{ - jsonParseAddNode(pParse, JSON_REAL, 7, "9.0e999"); + jsonBlobAppendNode(pParse, JSONB_FLOAT, 5, "9e999"); } return i + (sqlite3StrNICmp(&z[i+4],"inity",5)==0 ? 9 : 4); } if( z[i+1]=='.' ){ pParse->hasNonstd = 1; - jnFlags |= JNODE_JSON5; + t |= 0x01; goto parse_number_2; } pParse->iErr = i; @@ -202861,30 +206689,31 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ return -1; }else if( (z[i+2]=='x' || z[i+2]=='X') && sqlite3Isxdigit(z[i+3]) ){ pParse->hasNonstd = 1; - jnFlags |= JNODE_JSON5; + t |= 0x01; for(j=i+4; sqlite3Isxdigit(z[j]); j++){} goto parse_number_finish; } } } } + parse_number_2: for(j=i+1;; j++){ c = z[j]; if( sqlite3Isdigit(c) ) continue; if( c=='.' ){ - if( seenDP==JSON_REAL ){ + if( (t & 0x02)!=0 ){ pParse->iErr = j; return -1; } - seenDP = JSON_REAL; + t |= 0x02; continue; } if( c=='e' || c=='E' ){ if( z[j-1]<'0' ){ if( ALWAYS(z[j-1]=='.') && ALWAYS(j-2>=i) && sqlite3Isdigit(z[j-2]) ){ pParse->hasNonstd = 1; - jnFlags |= JNODE_JSON5; + t |= 0x01; }else{ pParse->iErr = j; return -1; @@ -202894,7 +206723,7 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ pParse->iErr = j; return -1; } - seenDP = JSON_REAL; + t |= 0x02; seenE = 1; c = z[j+1]; if( c=='+' || c=='-' ){ @@ -202912,14 +206741,18 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ if( z[j-1]<'0' ){ if( ALWAYS(z[j-1]=='.') && ALWAYS(j-2>=i) && sqlite3Isdigit(z[j-2]) ){ pParse->hasNonstd = 1; - jnFlags |= JNODE_JSON5; + t |= 0x01; }else{ pParse->iErr = j; return -1; } } parse_number_finish: - jsonParseAddNode(pParse, seenDP | (jnFlags<<8), j - i, &z[i]); + assert( JSONB_INT+0x01==JSONB_INT5 ); + assert( JSONB_FLOAT+0x01==JSONB_FLOAT5 ); + assert( JSONB_INT+0x02==JSONB_FLOAT ); + if( z[i]=='+' ) i++; + jsonBlobAppendNode(pParse, JSONB_INT+t, j-i, &z[i]); return j; } case '}': { @@ -202945,9 +206778,7 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ case 0x0a: case 0x0d: case 0x20: { - do{ - i++; - }while( fast_isspace(z[i]) ); + i += 1 + (u32)strspn(&z[i+1], jsonSpaces); goto json_parse_restart; } case 0x0b: @@ -202969,10 +206800,11 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ } case 'n': { if( strncmp(z+i,"null",4)==0 && !sqlite3Isalnum(z[i+4]) ){ - jsonParseAddNode(pParse, JSON_NULL, 0, 0); + jsonBlobAppendOneByte(pParse, JSONB_NULL); return i+4; } /* fall-through into the default case that checks for NaN */ + /* no break */ deliberate_fall_through } default: { u32 k; @@ -202985,8 +206817,11 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ continue; } if( sqlite3Isalnum(z[i+nn]) ) continue; - jsonParseAddNode(pParse, aNanInfName[k].eType, - aNanInfName[k].nRepl, aNanInfName[k].zRepl); + if( aNanInfName[k].eType==JSONB_FLOAT ){ + jsonBlobAppendNode(pParse, JSONB_FLOAT, 5, "9e999"); + }else{ + jsonBlobAppendOneByte(pParse, JSONB_NULL); + } pParse->hasNonstd = 1; return i + nn; } @@ -202996,6 +206831,7 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ } /* End switch(z[i]) */ } + /* ** Parse a complete JSON string. Return 0 on success or non-zero if there ** are any errors. If an error occurs, free all memory held by pParse, @@ -203004,20 +206840,26 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ ** pParse must be initialized to an empty parse object prior to calling ** this routine. */ -static int jsonParse( +static int jsonConvertTextToBlob( JsonParse *pParse, /* Initialize and fill this JsonParse object */ sqlite3_context *pCtx /* Report errors here */ ){ int i; const char *zJson = pParse->zJson; - i = jsonParseValue(pParse, 0); + i = jsonTranslateTextToBlob(pParse, 0); if( pParse->oom ) i = -1; if( i>0 ){ +#ifdef SQLITE_DEBUG assert( pParse->iDepth==0 ); - while( fast_isspace(zJson[i]) ) i++; + if( sqlite3Config.bJsonSelfcheck ){ + assert( jsonbValidityCheck(pParse, 0, pParse->nBlob, 0)==0 ); + } +#endif + while( jsonIsspace(zJson[i]) ) i++; if( zJson[i] ){ i += json5Whitespace(&zJson[i]); if( zJson[i] ){ + if( pCtx ) sqlite3_result_error(pCtx, "malformed JSON", -1); jsonParseReset(pParse); return 1; } @@ -203038,248 +206880,832 @@ static int jsonParse( return 0; } +/* +** The input string pStr is a well-formed JSON text string. Convert +** this into the JSONB format and make it the return value of the +** SQL function. +*/ +static void jsonReturnStringAsBlob(JsonString *pStr){ + JsonParse px; + memset(&px, 0, sizeof(px)); + jsonStringTerminate(pStr); + if( pStr->eErr ){ + sqlite3_result_error_nomem(pStr->pCtx); + return; + } + px.zJson = pStr->zBuf; + px.nJson = pStr->nUsed; + px.db = sqlite3_context_db_handle(pStr->pCtx); + (void)jsonTranslateTextToBlob(&px, 0); + if( px.oom ){ + sqlite3DbFree(px.db, px.aBlob); + sqlite3_result_error_nomem(pStr->pCtx); + }else{ + assert( px.nBlobAlloc>0 ); + assert( !px.bReadOnly ); + sqlite3_result_blob(pStr->pCtx, px.aBlob, px.nBlob, SQLITE_DYNAMIC); + } +} -/* Mark node i of pParse as being a child of iParent. Call recursively -** to fill in all the descendants of node i. +/* The byte at index i is a node type-code. This routine +** determines the payload size for that node and writes that +** payload size in to *pSz. It returns the offset from i to the +** beginning of the payload. Return 0 on error. */ -static void jsonParseFillInParentage(JsonParse *pParse, u32 i, u32 iParent){ - JsonNode *pNode = &pParse->aNode[i]; - u32 j; - pParse->aUp[i] = iParent; - switch( pNode->eType ){ - case JSON_ARRAY: { - for(j=1; j<=pNode->n; j += jsonNodeSize(pNode+j)){ - jsonParseFillInParentage(pParse, i+j, i); +static u32 jsonbPayloadSize(const JsonParse *pParse, u32 i, u32 *pSz){ + u8 x; + u32 sz; + u32 n; + if( NEVER(i>pParse->nBlob) ){ + *pSz = 0; + return 0; + } + x = pParse->aBlob[i]>>4; + if( x<=11 ){ + sz = x; + n = 1; + }else if( x==12 ){ + if( i+1>=pParse->nBlob ){ + *pSz = 0; + return 0; + } + sz = pParse->aBlob[i+1]; + n = 2; + }else if( x==13 ){ + if( i+2>=pParse->nBlob ){ + *pSz = 0; + return 0; + } + sz = (pParse->aBlob[i+1]<<8) + pParse->aBlob[i+2]; + n = 3; + }else if( x==14 ){ + if( i+4>=pParse->nBlob ){ + *pSz = 0; + return 0; + } + sz = ((u32)pParse->aBlob[i+1]<<24) + (pParse->aBlob[i+2]<<16) + + (pParse->aBlob[i+3]<<8) + pParse->aBlob[i+4]; + n = 5; + }else{ + if( i+8>=pParse->nBlob + || pParse->aBlob[i+1]!=0 + || pParse->aBlob[i+2]!=0 + || pParse->aBlob[i+3]!=0 + || pParse->aBlob[i+4]!=0 + ){ + *pSz = 0; + return 0; + } + sz = (pParse->aBlob[i+5]<<24) + (pParse->aBlob[i+6]<<16) + + (pParse->aBlob[i+7]<<8) + pParse->aBlob[i+8]; + n = 9; + } + if( (i64)i+sz+n > pParse->nBlob + && (i64)i+sz+n > pParse->nBlob-pParse->delta + ){ + sz = 0; + n = 0; + } + *pSz = sz; + return n; +} + + +/* +** Translate the binary JSONB representation of JSON beginning at +** pParse->aBlob[i] into a JSON text string. Append the JSON +** text onto the end of pOut. Return the index in pParse->aBlob[] +** of the first byte past the end of the element that is translated. +** +** If an error is detected in the BLOB input, the pOut->eErr flag +** might get set to JSTRING_MALFORMED. But not all BLOB input errors +** are detected. So a malformed JSONB input might either result +** in an error, or in incorrect JSON. +** +** The pOut->eErr JSTRING_OOM flag is set on a OOM. +*/ +static u32 jsonTranslateBlobToText( + const JsonParse *pParse, /* the complete parse of the JSON */ + u32 i, /* Start rendering at this index */ + JsonString *pOut /* Write JSON here */ +){ + u32 sz, n, j, iEnd; + + n = jsonbPayloadSize(pParse, i, &sz); + if( n==0 ){ + pOut->eErr |= JSTRING_MALFORMED; + return pParse->nBlob+1; + } + switch( pParse->aBlob[i] & 0x0f ){ + case JSONB_NULL: { + jsonAppendRawNZ(pOut, "null", 4); + return i+1; + } + case JSONB_TRUE: { + jsonAppendRawNZ(pOut, "true", 4); + return i+1; + } + case JSONB_FALSE: { + jsonAppendRawNZ(pOut, "false", 5); + return i+1; + } + case JSONB_INT: + case JSONB_FLOAT: { + if( sz==0 ) goto malformed_jsonb; + jsonAppendRaw(pOut, (const char*)&pParse->aBlob[i+n], sz); + break; + } + case JSONB_INT5: { /* Integer literal in hexadecimal notation */ + u32 k = 2; + sqlite3_uint64 u = 0; + const char *zIn = (const char*)&pParse->aBlob[i+n]; + int bOverflow = 0; + if( sz==0 ) goto malformed_jsonb; + if( zIn[0]=='-' ){ + jsonAppendChar(pOut, '-'); + k++; + }else if( zIn[0]=='+' ){ + k++; + } + for(; keErr |= JSTRING_MALFORMED; + break; + }else if( (u>>60)!=0 ){ + bOverflow = 1; + }else{ + u = u*16 + sqlite3HexToInt(zIn[k]); + } } + jsonPrintf(100,pOut,bOverflow?"9.0e999":"%llu", u); break; } - case JSON_OBJECT: { - for(j=1; j<=pNode->n; j += jsonNodeSize(pNode+j+1)+1){ - pParse->aUp[i+j] = i; - jsonParseFillInParentage(pParse, i+j+1, i); + case JSONB_FLOAT5: { /* Float literal missing digits beside "." */ + u32 k = 0; + const char *zIn = (const char*)&pParse->aBlob[i+n]; + if( sz==0 ) goto malformed_jsonb; + if( zIn[0]=='-' ){ + jsonAppendChar(pOut, '-'); + k++; + } + if( zIn[k]=='.' ){ + jsonAppendChar(pOut, '0'); + } + for(; kaBlob[i+n], sz); + jsonAppendChar(pOut, '"'); + break; + } + case JSONB_TEXT5: { + const char *zIn; + u32 k; + u32 sz2 = sz; + zIn = (const char*)&pParse->aBlob[i+n]; + jsonAppendChar(pOut, '"'); + while( sz2>0 ){ + for(k=0; k0 ){ + jsonAppendRawNZ(pOut, zIn, k); + if( k>=sz2 ){ + break; + } + zIn += k; + sz2 -= k; + } + if( zIn[0]=='"' ){ + jsonAppendRawNZ(pOut, "\\\"", 2); + zIn++; + sz2--; + continue; + } + if( zIn[0]<=0x1f ){ + if( pOut->nUsed+7>pOut->nAlloc && jsonStringGrow(pOut,7) ) break; + jsonAppendControlChar(pOut, zIn[0]); + zIn++; + sz2--; + continue; + } + assert( zIn[0]=='\\' ); + assert( sz2>=1 ); + if( sz2<2 ){ + pOut->eErr |= JSTRING_MALFORMED; + break; + } + switch( (u8)zIn[1] ){ + case '\'': + jsonAppendChar(pOut, '\''); + break; + case 'v': + jsonAppendRawNZ(pOut, "\\u0009", 6); + break; + case 'x': + if( sz2<4 ){ + pOut->eErr |= JSTRING_MALFORMED; + sz2 = 2; + break; + } + jsonAppendRawNZ(pOut, "\\u00", 4); + jsonAppendRawNZ(pOut, &zIn[2], 2); + zIn += 2; + sz2 -= 2; + break; + case '0': + jsonAppendRawNZ(pOut, "\\u0000", 6); + break; + case '\r': + if( sz2>2 && zIn[2]=='\n' ){ + zIn++; + sz2--; + } + break; + case '\n': + break; + case 0xe2: + /* '\' followed by either U+2028 or U+2029 is ignored as + ** whitespace. Not that in UTF8, U+2028 is 0xe2 0x80 0x29. + ** U+2029 is the same except for the last byte */ + if( sz2<4 + || 0x80!=(u8)zIn[2] + || (0xa8!=(u8)zIn[3] && 0xa9!=(u8)zIn[3]) + ){ + pOut->eErr |= JSTRING_MALFORMED; + sz2 = 2; + break; + } + zIn += 2; + sz2 -= 2; + break; + default: + jsonAppendRawNZ(pOut, zIn, 2); + break; + } + assert( sz2>=2 ); + zIn += 2; + sz2 -= 2; + } + jsonAppendChar(pOut, '"'); + break; + } + case JSONB_TEXTRAW: { + jsonAppendString(pOut, (const char*)&pParse->aBlob[i+n], sz); + break; + } + case JSONB_ARRAY: { + jsonAppendChar(pOut, '['); + j = i+n; + iEnd = j+sz; + while( jeErr==0 ){ + j = jsonTranslateBlobToText(pParse, j, pOut); + jsonAppendChar(pOut, ','); + } + if( j>iEnd ) pOut->eErr |= JSTRING_MALFORMED; + if( sz>0 ) jsonStringTrimOneChar(pOut); + jsonAppendChar(pOut, ']'); + break; + } + case JSONB_OBJECT: { + int x = 0; + jsonAppendChar(pOut, '{'); + j = i+n; + iEnd = j+sz; + while( jeErr==0 ){ + j = jsonTranslateBlobToText(pParse, j, pOut); + jsonAppendChar(pOut, (x++ & 1) ? ',' : ':'); + } + if( (x & 1)!=0 || j>iEnd ) pOut->eErr |= JSTRING_MALFORMED; + if( sz>0 ) jsonStringTrimOneChar(pOut); + jsonAppendChar(pOut, '}'); + break; + } + default: { + malformed_jsonb: + pOut->eErr |= JSTRING_MALFORMED; break; } } + return i+n+sz; +} + +/* Context for recursion of json_pretty() +*/ +typedef struct JsonPretty JsonPretty; +struct JsonPretty { + JsonParse *pParse; /* The BLOB being rendered */ + JsonString *pOut; /* Generate pretty output into this string */ + const char *zIndent; /* Use this text for indentation */ + u32 szIndent; /* Bytes in zIndent[] */ + u32 nIndent; /* Current level of indentation */ +}; + +/* Append indentation to the pretty JSON under construction */ +static void jsonPrettyIndent(JsonPretty *pPretty){ + u32 jj; + for(jj=0; jjnIndent; jj++){ + jsonAppendRaw(pPretty->pOut, pPretty->zIndent, pPretty->szIndent); + } } /* -** Compute the parentage of all nodes in a completed parse. +** Translate the binary JSONB representation of JSON beginning at +** pParse->aBlob[i] into a JSON text string. Append the JSON +** text onto the end of pOut. Return the index in pParse->aBlob[] +** of the first byte past the end of the element that is translated. +** +** This is a variant of jsonTranslateBlobToText() that "pretty-prints" +** the output. Extra whitespace is inserted to make the JSON easier +** for humans to read. +** +** If an error is detected in the BLOB input, the pOut->eErr flag +** might get set to JSTRING_MALFORMED. But not all BLOB input errors +** are detected. So a malformed JSONB input might either result +** in an error, or in incorrect JSON. +** +** The pOut->eErr JSTRING_OOM flag is set on a OOM. */ -static int jsonParseFindParents(JsonParse *pParse){ - u32 *aUp; - assert( pParse->aUp==0 ); - aUp = pParse->aUp = sqlite3_malloc64( sizeof(u32)*pParse->nNode ); - if( aUp==0 ){ - pParse->oom = 1; - return SQLITE_NOMEM; +static u32 jsonTranslateBlobToPrettyText( + JsonPretty *pPretty, /* Pretty-printing context */ + u32 i /* Start rendering at this index */ +){ + u32 sz, n, j, iEnd; + const JsonParse *pParse = pPretty->pParse; + JsonString *pOut = pPretty->pOut; + n = jsonbPayloadSize(pParse, i, &sz); + if( n==0 ){ + pOut->eErr |= JSTRING_MALFORMED; + return pParse->nBlob+1; } - jsonParseFillInParentage(pParse, 0, 0); - return SQLITE_OK; + switch( pParse->aBlob[i] & 0x0f ){ + case JSONB_ARRAY: { + j = i+n; + iEnd = j+sz; + jsonAppendChar(pOut, '['); + if( jnIndent++; + while( pOut->eErr==0 ){ + jsonPrettyIndent(pPretty); + j = jsonTranslateBlobToPrettyText(pPretty, j); + if( j>=iEnd ) break; + jsonAppendRawNZ(pOut, ",\n", 2); + } + jsonAppendChar(pOut, '\n'); + pPretty->nIndent--; + jsonPrettyIndent(pPretty); + } + jsonAppendChar(pOut, ']'); + i = iEnd; + break; + } + case JSONB_OBJECT: { + j = i+n; + iEnd = j+sz; + jsonAppendChar(pOut, '{'); + if( jnIndent++; + while( pOut->eErr==0 ){ + jsonPrettyIndent(pPretty); + j = jsonTranslateBlobToText(pParse, j, pOut); + if( j>iEnd ){ + pOut->eErr |= JSTRING_MALFORMED; + break; + } + jsonAppendRawNZ(pOut, ": ", 2); + j = jsonTranslateBlobToPrettyText(pPretty, j); + if( j>=iEnd ) break; + jsonAppendRawNZ(pOut, ",\n", 2); + } + jsonAppendChar(pOut, '\n'); + pPretty->nIndent--; + jsonPrettyIndent(pPretty); + } + jsonAppendChar(pOut, '}'); + i = iEnd; + break; + } + default: { + i = jsonTranslateBlobToText(pParse, i, pOut); + break; + } + } + return i; +} + + +/* Return true if the input pJson +** +** For performance reasons, this routine does not do a detailed check of the +** input BLOB to ensure that it is well-formed. Hence, false positives are +** possible. False negatives should never occur, however. +*/ +static int jsonFuncArgMightBeBinary(sqlite3_value *pJson){ + u32 sz, n; + const u8 *aBlob; + int nBlob; + JsonParse s; + if( sqlite3_value_type(pJson)!=SQLITE_BLOB ) return 0; + aBlob = sqlite3_value_blob(pJson); + nBlob = sqlite3_value_bytes(pJson); + if( nBlob<1 ) return 0; + if( NEVER(aBlob==0) || (aBlob[0] & 0x0f)>JSONB_OBJECT ) return 0; + memset(&s, 0, sizeof(s)); + s.aBlob = (u8*)aBlob; + s.nBlob = nBlob; + n = jsonbPayloadSize(&s, 0, &sz); + if( n==0 ) return 0; + if( sz+n!=(u32)nBlob ) return 0; + if( (aBlob[0] & 0x0f)<=JSONB_FALSE && sz>0 ) return 0; + return sz+n==(u32)nBlob; } /* -** Magic number used for the JSON parse cache in sqlite3_get_auxdata() +** Given that a JSONB_ARRAY object starts at offset i, return +** the number of entries in that array. */ -#define JSON_CACHE_ID (-429938) /* First cache entry */ -#define JSON_CACHE_SZ 4 /* Max number of cache entries */ +static u32 jsonbArrayCount(JsonParse *pParse, u32 iRoot){ + u32 n, sz, i, iEnd; + u32 k = 0; + n = jsonbPayloadSize(pParse, iRoot, &sz); + iEnd = iRoot+n+sz; + for(i=iRoot+n; n>0 && idelta. +*/ +static void jsonAfterEditSizeAdjust(JsonParse *pParse, u32 iRoot){ + u32 sz = 0; + u32 nBlob; + assert( pParse->delta!=0 ); + assert( pParse->nBlobAlloc >= pParse->nBlob ); + nBlob = pParse->nBlob; + pParse->nBlob = pParse->nBlobAlloc; + (void)jsonbPayloadSize(pParse, iRoot, &sz); + pParse->nBlob = nBlob; + sz += pParse->delta; + pParse->delta += jsonBlobChangePayloadSize(pParse, iRoot, sz); +} + +/* +** Modify the JSONB blob at pParse->aBlob by removing nDel bytes of +** content beginning at iDel, and replacing them with nIns bytes of +** content given by aIns. ** -** Except, if an error occurs and pErrCtx==0 then return the JsonParse -** object with JsonParse.nErr non-zero and the caller will own the JsonParse -** object. In that case, it will be the responsibility of the caller to -** invoke jsonParseFree(). To summarize: +** nDel may be zero, in which case no bytes are removed. But iDel is +** still important as new bytes will be insert beginning at iDel. ** -** pErrCtx!=0 || p->nErr==0 ==> Return value p is owned by the -** cache. Call does not need to -** free it. +** aIns may be zero, in which case space is created to hold nIns bytes +** beginning at iDel, but that space is uninitialized. ** -** pErrCtx==0 && p->nErr!=0 ==> Return value is owned by the caller -** and so the caller must free it. +** Set pParse->oom if an OOM occurs. */ -static JsonParse *jsonParseCached( - sqlite3_context *pCtx, /* Context to use for cache search */ - sqlite3_value *pJson, /* Function param containing JSON text */ - sqlite3_context *pErrCtx, /* Write parse errors here if not NULL */ - int bUnedited /* No prior edits allowed */ +static void jsonBlobEdit( + JsonParse *pParse, /* The JSONB to be modified is in pParse->aBlob */ + u32 iDel, /* First byte to be removed */ + u32 nDel, /* Number of bytes to remove */ + const u8 *aIns, /* Content to insert */ + u32 nIns /* Bytes of content to insert */ ){ - char *zJson = (char*)sqlite3_value_text(pJson); - int nJson = sqlite3_value_bytes(pJson); - JsonParse *p; - JsonParse *pMatch = 0; - int iKey; - int iMinKey = 0; - u32 iMinHold = 0xffffffff; - u32 iMaxHold = 0; - int bJsonRCStr; + i64 d = (i64)nIns - (i64)nDel; + if( d!=0 ){ + if( pParse->nBlob + d > pParse->nBlobAlloc ){ + jsonBlobExpand(pParse, pParse->nBlob+d); + if( pParse->oom ) return; + } + memmove(&pParse->aBlob[iDel+nIns], + &pParse->aBlob[iDel+nDel], + pParse->nBlob - (iDel+nDel)); + pParse->nBlob += d; + pParse->delta += d; + } + if( nIns && aIns ) memcpy(&pParse->aBlob[iDel], aIns, nIns); +} - if( zJson==0 ) return 0; - for(iKey=0; iKeynJson==nJson - && (p->hasMod==0 || bUnedited==0) - && (p->zJson==zJson || memcmp(p->zJson,zJson,nJson)==0) - ){ - p->nErr = 0; - p->useMod = 0; - pMatch = p; - }else - if( pMatch==0 - && p->zAlt!=0 - && bUnedited==0 - && p->nAlt==nJson - && memcmp(p->zAlt, zJson, nJson)==0 - ){ - p->nErr = 0; - p->useMod = 1; - pMatch = p; - }else if( p->iHoldiHold; - iMinKey = iKey; + if( z[i+1]=='\r' ){ + if( i+2iHold>iMaxHold ){ - iMaxHold = p->iHold; + if( 0xe2==(u8)z[i+1] + && i+3nErr = 0; - pMatch->iHold = iMaxHold+1; - assert( pMatch->nJPRef>0 ); /* pMatch is owned by the cache */ - return pMatch; - } + return i; +} - /* The input JSON was not found anywhere in the cache. We will need - ** to parse it ourselves and generate a new JsonParse object. - */ - bJsonRCStr = sqlite3ValueIsOfClass(pJson,(void(*)(void*))sqlite3RCStrUnref); - p = sqlite3_malloc64( sizeof(*p) + (bJsonRCStr ? 0 : nJson+1) ); - if( p==0 ){ - sqlite3_result_error_nomem(pCtx); - return 0; +/* +** Input z[0..n] defines JSON escape sequence including the leading '\\'. +** Decode that escape sequence into a single character. Write that +** character into *piOut. Return the number of bytes in the escape sequence. +** +** If there is a syntax error of some kind (for example too few characters +** after the '\\' to complete the encoding) then *piOut is set to +** JSON_INVALID_CHAR. +*/ +static u32 jsonUnescapeOneChar(const char *z, u32 n, u32 *piOut){ + assert( n>0 ); + assert( z[0]=='\\' ); + if( n<2 ){ + *piOut = JSON_INVALID_CHAR; + return n; } - memset(p, 0, sizeof(*p)); - if( bJsonRCStr ){ - p->zJson = sqlite3RCStrRef(zJson); - p->bJsonIsRCStr = 1; - }else{ - p->zJson = (char*)&p[1]; - memcpy(p->zJson, zJson, nJson+1); + switch( (u8)z[1] ){ + case 'u': { + u32 v, vlo; + if( n<6 ){ + *piOut = JSON_INVALID_CHAR; + return n; + } + v = jsonHexToInt4(&z[2]); + if( (v & 0xfc00)==0xd800 + && n>=12 + && z[6]=='\\' + && z[7]=='u' + && ((vlo = jsonHexToInt4(&z[8]))&0xfc00)==0xdc00 + ){ + *piOut = ((v&0x3ff)<<10) + (vlo&0x3ff) + 0x10000; + return 12; + }else{ + *piOut = v; + return 6; + } + } + case 'b': { *piOut = '\b'; return 2; } + case 'f': { *piOut = '\f'; return 2; } + case 'n': { *piOut = '\n'; return 2; } + case 'r': { *piOut = '\r'; return 2; } + case 't': { *piOut = '\t'; return 2; } + case 'v': { *piOut = '\v'; return 2; } + case '0': { *piOut = 0; return 2; } + case '\'': + case '"': + case '/': + case '\\':{ *piOut = z[1]; return 2; } + case 'x': { + if( n<4 ){ + *piOut = JSON_INVALID_CHAR; + return n; + } + *piOut = (jsonHexToInt(z[2])<<4) | jsonHexToInt(z[3]); + return 4; + } + case 0xe2: + case '\r': + case '\n': { + u32 nSkip = jsonBytesToBypass(z, n); + if( nSkip==0 ){ + *piOut = JSON_INVALID_CHAR; + return n; + }else if( nSkip==n ){ + *piOut = 0; + return n; + }else if( z[nSkip]=='\\' ){ + return nSkip + jsonUnescapeOneChar(&z[nSkip], n-nSkip, piOut); + }else{ + int sz = sqlite3Utf8ReadLimited((u8*)&z[nSkip], n-nSkip, piOut); + return nSkip + sz; + } + } + default: { + *piOut = JSON_INVALID_CHAR; + return 2; + } } - p->nJPRef = 1; - if( jsonParse(p, pErrCtx) ){ - if( pErrCtx==0 ){ - p->nErr = 1; - assert( p->nJPRef==1 ); /* Caller will own the new JsonParse object p */ - return p; +} + + +/* +** Compare two object labels. Return 1 if they are equal and +** 0 if they differ. +** +** In this version, we know that one or the other or both of the +** two comparands contains an escape sequence. +*/ +static SQLITE_NOINLINE int jsonLabelCompareEscaped( + const char *zLeft, /* The left label */ + u32 nLeft, /* Size of the left label in bytes */ + int rawLeft, /* True if zLeft contains no escapes */ + const char *zRight, /* The right label */ + u32 nRight, /* Size of the right label in bytes */ + int rawRight /* True if zRight is escape-free */ +){ + u32 cLeft, cRight; + assert( rawLeft==0 || rawRight==0 ); + while( 1 /*exit-by-return*/ ){ + if( nLeft==0 ){ + cLeft = 0; + }else if( rawLeft || zLeft[0]!='\\' ){ + cLeft = ((u8*)zLeft)[0]; + if( cLeft>=0xc0 ){ + int sz = sqlite3Utf8ReadLimited((u8*)zLeft, nLeft, &cLeft); + zLeft += sz; + nLeft -= sz; + }else{ + zLeft++; + nLeft--; + } + }else{ + u32 n = jsonUnescapeOneChar(zLeft, nLeft, &cLeft); + zLeft += n; + assert( n<=nLeft ); + nLeft -= n; + } + if( nRight==0 ){ + cRight = 0; + }else if( rawRight || zRight[0]!='\\' ){ + cRight = ((u8*)zRight)[0]; + if( cRight>=0xc0 ){ + int sz = sqlite3Utf8ReadLimited((u8*)zRight, nRight, &cRight); + zRight += sz; + nRight -= sz; + }else{ + zRight++; + nRight--; + } + }else{ + u32 n = jsonUnescapeOneChar(zRight, nRight, &cRight); + zRight += n; + assert( n<=nRight ); + nRight -= n; } - jsonParseFree(p); - return 0; + if( cLeft!=cRight ) return 0; + if( cLeft==0 ) return 1; } - p->nJson = nJson; - p->iHold = iMaxHold+1; - /* Transfer ownership of the new JsonParse to the cache */ - sqlite3_set_auxdata(pCtx, JSON_CACHE_ID+iMinKey, p, - (void(*)(void*))jsonParseFree); - return (JsonParse*)sqlite3_get_auxdata(pCtx, JSON_CACHE_ID+iMinKey); } /* -** Compare the OBJECT label at pNode against zKey,nKey. Return true on -** a match. +** Compare two object labels. Return 1 if they are equal and +** 0 if they differ. Return -1 if an OOM occurs. */ -static int jsonLabelCompare(const JsonNode *pNode, const char *zKey, u32 nKey){ - assert( pNode->eU==1 ); - if( pNode->jnFlags & JNODE_RAW ){ - if( pNode->n!=nKey ) return 0; - return strncmp(pNode->u.zJContent, zKey, nKey)==0; +static int jsonLabelCompare( + const char *zLeft, /* The left label */ + u32 nLeft, /* Size of the left label in bytes */ + int rawLeft, /* True if zLeft contains no escapes */ + const char *zRight, /* The right label */ + u32 nRight, /* Size of the right label in bytes */ + int rawRight /* True if zRight is escape-free */ +){ + if( rawLeft && rawRight ){ + /* Simpliest case: Neither label contains escapes. A simple + ** memcmp() is sufficient. */ + if( nLeft!=nRight ) return 0; + return memcmp(zLeft, zRight, nLeft)==0; }else{ - if( pNode->n!=nKey+2 ) return 0; - return strncmp(pNode->u.zJContent+1, zKey, nKey)==0; + return jsonLabelCompareEscaped(zLeft, nLeft, rawLeft, + zRight, nRight, rawRight); } } -static int jsonSameLabel(const JsonNode *p1, const JsonNode *p2){ - if( p1->jnFlags & JNODE_RAW ){ - return jsonLabelCompare(p2, p1->u.zJContent, p1->n); - }else if( p2->jnFlags & JNODE_RAW ){ - return jsonLabelCompare(p1, p2->u.zJContent, p2->n); + +/* +** Error returns from jsonLookupStep() +*/ +#define JSON_LOOKUP_ERROR 0xffffffff +#define JSON_LOOKUP_NOTFOUND 0xfffffffe +#define JSON_LOOKUP_PATHERROR 0xfffffffd +#define JSON_LOOKUP_ISERROR(x) ((x)>=JSON_LOOKUP_PATHERROR) + +/* Forward declaration */ +static u32 jsonLookupStep(JsonParse*,u32,const char*,u32); + + +/* This helper routine for jsonLookupStep() populates pIns with +** binary data that is to be inserted into pParse. +** +** In the common case, pIns just points to pParse->aIns and pParse->nIns. +** But if the zPath of the original edit operation includes path elements +** that go deeper, additional substructure must be created. +** +** For example: +** +** json_insert('{}', '$.a.b.c', 123); +** +** The search stops at '$.a' But additional substructure must be +** created for the ".b.c" part of the patch so that the final result +** is: {"a":{"b":{"c"::123}}}. This routine populates pIns with +** the binary equivalent of {"b":{"c":123}} so that it can be inserted. +** +** The caller is responsible for resetting pIns when it has finished +** using the substructure. +*/ +static u32 jsonCreateEditSubstructure( + JsonParse *pParse, /* The original JSONB that is being edited */ + JsonParse *pIns, /* Populate this with the blob data to insert */ + const char *zTail /* Tail of the path that determins substructure */ +){ + static const u8 emptyObject[] = { JSONB_ARRAY, JSONB_OBJECT }; + int rc; + memset(pIns, 0, sizeof(*pIns)); + pIns->db = pParse->db; + if( zTail[0]==0 ){ + /* No substructure. Just insert what is given in pParse. */ + pIns->aBlob = pParse->aIns; + pIns->nBlob = pParse->nIns; + rc = 0; }else{ - return p1->n==p2->n && strncmp(p1->u.zJContent,p2->u.zJContent,p1->n)==0; + /* Construct the binary substructure */ + pIns->nBlob = 1; + pIns->aBlob = (u8*)&emptyObject[zTail[0]=='.']; + pIns->eEdit = pParse->eEdit; + pIns->nIns = pParse->nIns; + pIns->aIns = pParse->aIns; + rc = jsonLookupStep(pIns, 0, zTail, 0); + pParse->oom |= pIns->oom; } + return rc; /* Error code only */ } -/* forward declaration */ -static JsonNode *jsonLookupAppend(JsonParse*,const char*,int*,const char**); - /* -** Search along zPath to find the node specified. Return a pointer -** to that node, or NULL if zPath is malformed or if there is no such -** node. +** Search along zPath to find the Json element specified. Return an +** index into pParse->aBlob[] for the start of that element's value. ** -** If pApnd!=0, then try to append new nodes to complete zPath if it is -** possible to do so and if no existing node corresponds to zPath. If -** new nodes are appended *pApnd is set to 1. +** If the value found by this routine is the value half of label/value pair +** within an object, then set pPath->iLabel to the start of the corresponding +** label, before returning. +** +** Return one of the JSON_LOOKUP error codes if problems are seen. +** +** This routine will also modify the blob. If pParse->eEdit is one of +** JEDIT_DEL, JEDIT_REPL, JEDIT_INS, or JEDIT_SET, then changes might be +** made to the selected value. If an edit is performed, then the return +** value does not necessarily point to the select element. If an edit +** is performed, the return value is only useful for detecting error +** conditions. */ -static JsonNode *jsonLookupStep( +static u32 jsonLookupStep( JsonParse *pParse, /* The JSON to search */ - u32 iRoot, /* Begin the search at this node */ + u32 iRoot, /* Begin the search at this element of aBlob[] */ const char *zPath, /* The path to search */ - int *pApnd, /* Append nodes to complete path if not NULL */ - const char **pzErr /* Make *pzErr point to any syntax error in zPath */ + u32 iLabel /* Label if iRoot is a value of in an object */ ){ - u32 i, j, nKey; + u32 i, j, k, nKey, sz, n, iEnd, rc; const char *zKey; - JsonNode *pRoot; - if( pParse->oom ) return 0; - pRoot = &pParse->aNode[iRoot]; - if( pRoot->jnFlags & (JNODE_REPLACE|JNODE_REMOVE) && pParse->useMod ){ - while( (pRoot->jnFlags & JNODE_REPLACE)!=0 ){ - u32 idx = (u32)(pRoot - pParse->aNode); - i = pParse->iSubst; - while( 1 /*exit-by-break*/ ){ - assert( inNode ); - assert( pParse->aNode[i].eType==JSON_SUBST ); - assert( pParse->aNode[i].eU==4 ); - assert( pParse->aNode[i].u.iPrevaNode[i].n==idx ){ - pRoot = &pParse->aNode[i+1]; - iRoot = i+1; - break; - } - i = pParse->aNode[i].u.iPrev; + u8 x; + + if( zPath[0]==0 ){ + if( pParse->eEdit && jsonBlobMakeEditable(pParse, pParse->nIns) ){ + n = jsonbPayloadSize(pParse, iRoot, &sz); + sz += n; + if( pParse->eEdit==JEDIT_DEL ){ + if( iLabel>0 ){ + sz += iRoot - iLabel; + iRoot = iLabel; + } + jsonBlobEdit(pParse, iRoot, sz, 0, 0); + }else if( pParse->eEdit==JEDIT_INS ){ + /* Already exists, so json_insert() is a no-op */ + }else{ + /* json_set() or json_replace() */ + jsonBlobEdit(pParse, iRoot, sz, pParse->aIns, pParse->nIns); } } - if( pRoot->jnFlags & JNODE_REMOVE ){ - return 0; - } + pParse->iLabel = iLabel; + return iRoot; } - if( zPath[0]==0 ) return pRoot; if( zPath[0]=='.' ){ - if( pRoot->eType!=JSON_OBJECT ) return 0; + int rawKey = 1; + x = pParse->aBlob[iRoot]; zPath++; if( zPath[0]=='"' ){ zKey = zPath + 1; @@ -203288,250 +207714,705 @@ static JsonNode *jsonLookupStep( if( zPath[i] ){ i++; }else{ - *pzErr = zPath; - return 0; + return JSON_LOOKUP_PATHERROR; } testcase( nKey==0 ); + rawKey = memchr(zKey, '\\', nKey)==0; }else{ zKey = zPath; for(i=0; zPath[i] && zPath[i]!='.' && zPath[i]!='['; i++){} nKey = i; if( nKey==0 ){ - *pzErr = zPath; - return 0; - } - } - j = 1; - for(;;){ - while( j<=pRoot->n ){ - if( jsonLabelCompare(pRoot+j, zKey, nKey) ){ - return jsonLookupStep(pParse, iRoot+j+1, &zPath[i], pApnd, pzErr); - } - j++; - j += jsonNodeSize(&pRoot[j]); + return JSON_LOOKUP_PATHERROR; + } + } + if( (x & 0x0f)!=JSONB_OBJECT ) return JSON_LOOKUP_NOTFOUND; + n = jsonbPayloadSize(pParse, iRoot, &sz); + j = iRoot + n; /* j is the index of a label */ + iEnd = j+sz; + while( jaBlob[j] & 0x0f; + if( xJSONB_TEXTRAW ) return JSON_LOOKUP_ERROR; + n = jsonbPayloadSize(pParse, j, &sz); + if( n==0 ) return JSON_LOOKUP_ERROR; + k = j+n; /* k is the index of the label text */ + if( k+sz>=iEnd ) return JSON_LOOKUP_ERROR; + zLabel = (const char*)&pParse->aBlob[k]; + rawLabel = x==JSONB_TEXT || x==JSONB_TEXTRAW; + if( jsonLabelCompare(zKey, nKey, rawKey, zLabel, sz, rawLabel) ){ + u32 v = k+sz; /* v is the index of the value */ + if( ((pParse->aBlob[v])&0x0f)>JSONB_OBJECT ) return JSON_LOOKUP_ERROR; + n = jsonbPayloadSize(pParse, v, &sz); + if( n==0 || v+n+sz>iEnd ) return JSON_LOOKUP_ERROR; + assert( j>0 ); + rc = jsonLookupStep(pParse, v, &zPath[i], j); + if( pParse->delta ) jsonAfterEditSizeAdjust(pParse, iRoot); + return rc; } - if( (pRoot->jnFlags & JNODE_APPEND)==0 ) break; - if( pParse->useMod==0 ) break; - assert( pRoot->eU==2 ); - iRoot = pRoot->u.iAppend; - pRoot = &pParse->aNode[iRoot]; - j = 1; - } - if( pApnd ){ - u32 iStart, iLabel; - JsonNode *pNode; - assert( pParse->useMod ); - iStart = jsonParseAddNode(pParse, JSON_OBJECT, 2, 0); - iLabel = jsonParseAddNode(pParse, JSON_STRING, nKey, zKey); - zPath += i; - pNode = jsonLookupAppend(pParse, zPath, pApnd, pzErr); - if( pParse->oom ) return 0; - if( pNode ){ - pRoot = &pParse->aNode[iRoot]; - assert( pRoot->eU==0 ); - pRoot->u.iAppend = iStart; - pRoot->jnFlags |= JNODE_APPEND; - VVA( pRoot->eU = 2 ); - pParse->aNode[iLabel].jnFlags |= JNODE_RAW; - } - return pNode; + j = k+sz; + if( ((pParse->aBlob[j])&0x0f)>JSONB_OBJECT ) return JSON_LOOKUP_ERROR; + n = jsonbPayloadSize(pParse, j, &sz); + if( n==0 ) return JSON_LOOKUP_ERROR; + j += n+sz; + } + if( j>iEnd ) return JSON_LOOKUP_ERROR; + if( pParse->eEdit>=JEDIT_INS ){ + u32 nIns; /* Total bytes to insert (label+value) */ + JsonParse v; /* BLOB encoding of the value to be inserted */ + JsonParse ix; /* Header of the label to be inserted */ + testcase( pParse->eEdit==JEDIT_INS ); + testcase( pParse->eEdit==JEDIT_SET ); + memset(&ix, 0, sizeof(ix)); + ix.db = pParse->db; + jsonBlobAppendNode(&ix, rawKey?JSONB_TEXTRAW:JSONB_TEXT5, nKey, 0); + pParse->oom |= ix.oom; + rc = jsonCreateEditSubstructure(pParse, &v, &zPath[i]); + if( !JSON_LOOKUP_ISERROR(rc) + && jsonBlobMakeEditable(pParse, ix.nBlob+nKey+v.nBlob) + ){ + assert( !pParse->oom ); + nIns = ix.nBlob + nKey + v.nBlob; + jsonBlobEdit(pParse, j, 0, 0, nIns); + if( !pParse->oom ){ + assert( pParse->aBlob!=0 ); /* Because pParse->oom!=0 */ + assert( ix.aBlob!=0 ); /* Because pPasre->oom!=0 */ + memcpy(&pParse->aBlob[j], ix.aBlob, ix.nBlob); + k = j + ix.nBlob; + memcpy(&pParse->aBlob[k], zKey, nKey); + k += nKey; + memcpy(&pParse->aBlob[k], v.aBlob, v.nBlob); + if( ALWAYS(pParse->delta) ) jsonAfterEditSizeAdjust(pParse, iRoot); + } + } + jsonParseReset(&v); + jsonParseReset(&ix); + return rc; } }else if( zPath[0]=='[' ){ - i = 0; - j = 1; - while( sqlite3Isdigit(zPath[j]) ){ - i = i*10 + zPath[j] - '0'; - j++; + x = pParse->aBlob[iRoot] & 0x0f; + if( x!=JSONB_ARRAY ) return JSON_LOOKUP_NOTFOUND; + n = jsonbPayloadSize(pParse, iRoot, &sz); + k = 0; + i = 1; + while( sqlite3Isdigit(zPath[i]) ){ + k = k*10 + zPath[i] - '0'; + i++; } - if( j<2 || zPath[j]!=']' ){ + if( i<2 || zPath[i]!=']' ){ if( zPath[1]=='#' ){ - JsonNode *pBase = pRoot; - int iBase = iRoot; - if( pRoot->eType!=JSON_ARRAY ) return 0; - for(;;){ - while( j<=pBase->n ){ - if( (pBase[j].jnFlags & JNODE_REMOVE)==0 || pParse->useMod==0 ) i++; - j += jsonNodeSize(&pBase[j]); - } - if( (pBase->jnFlags & JNODE_APPEND)==0 ) break; - if( pParse->useMod==0 ) break; - assert( pBase->eU==2 ); - iBase = pBase->u.iAppend; - pBase = &pParse->aNode[iBase]; - j = 1; - } - j = 2; + k = jsonbArrayCount(pParse, iRoot); + i = 2; if( zPath[2]=='-' && sqlite3Isdigit(zPath[3]) ){ - unsigned int x = 0; - j = 3; + unsigned int nn = 0; + i = 3; do{ - x = x*10 + zPath[j] - '0'; - j++; - }while( sqlite3Isdigit(zPath[j]) ); - if( x>i ) return 0; - i -= x; + nn = nn*10 + zPath[i] - '0'; + i++; + }while( sqlite3Isdigit(zPath[i]) ); + if( nn>k ) return JSON_LOOKUP_NOTFOUND; + k -= nn; } - if( zPath[j]!=']' ){ - *pzErr = zPath; - return 0; + if( zPath[i]!=']' ){ + return JSON_LOOKUP_PATHERROR; } }else{ - *pzErr = zPath; - return 0; + return JSON_LOOKUP_PATHERROR; } } - if( pRoot->eType!=JSON_ARRAY ) return 0; - zPath += j + 1; - j = 1; - for(;;){ - while( j<=pRoot->n - && (i>0 || ((pRoot[j].jnFlags & JNODE_REMOVE)!=0 && pParse->useMod)) + j = iRoot+n; + iEnd = j+sz; + while( jdelta ) jsonAfterEditSizeAdjust(pParse, iRoot); + return rc; + } + k--; + n = jsonbPayloadSize(pParse, j, &sz); + if( n==0 ) return JSON_LOOKUP_ERROR; + j += n+sz; + } + if( j>iEnd ) return JSON_LOOKUP_ERROR; + if( k>0 ) return JSON_LOOKUP_NOTFOUND; + if( pParse->eEdit>=JEDIT_INS ){ + JsonParse v; + testcase( pParse->eEdit==JEDIT_INS ); + testcase( pParse->eEdit==JEDIT_SET ); + rc = jsonCreateEditSubstructure(pParse, &v, &zPath[i+1]); + if( !JSON_LOOKUP_ISERROR(rc) + && jsonBlobMakeEditable(pParse, v.nBlob) ){ - if( (pRoot[j].jnFlags & JNODE_REMOVE)==0 || pParse->useMod==0 ) i--; - j += jsonNodeSize(&pRoot[j]); - } - if( (pRoot->jnFlags & JNODE_APPEND)==0 ) break; - if( pParse->useMod==0 ) break; - assert( pRoot->eU==2 ); - iRoot = pRoot->u.iAppend; - pRoot = &pParse->aNode[iRoot]; - j = 1; - } - if( j<=pRoot->n ){ - return jsonLookupStep(pParse, iRoot+j, zPath, pApnd, pzErr); - } - if( i==0 && pApnd ){ - u32 iStart; - JsonNode *pNode; - assert( pParse->useMod ); - iStart = jsonParseAddNode(pParse, JSON_ARRAY, 1, 0); - pNode = jsonLookupAppend(pParse, zPath, pApnd, pzErr); - if( pParse->oom ) return 0; - if( pNode ){ - pRoot = &pParse->aNode[iRoot]; - assert( pRoot->eU==0 ); - pRoot->u.iAppend = iStart; - pRoot->jnFlags |= JNODE_APPEND; - VVA( pRoot->eU = 2 ); + assert( !pParse->oom ); + jsonBlobEdit(pParse, j, 0, v.aBlob, v.nBlob); } - return pNode; + jsonParseReset(&v); + if( pParse->delta ) jsonAfterEditSizeAdjust(pParse, iRoot); + return rc; } }else{ - *pzErr = zPath; + return JSON_LOOKUP_PATHERROR; } - return 0; + return JSON_LOOKUP_NOTFOUND; } /* -** Append content to pParse that will complete zPath. Return a pointer -** to the inserted node, or return NULL if the append fails. +** Convert a JSON BLOB into text and make that text the return value +** of an SQL function. */ -static JsonNode *jsonLookupAppend( - JsonParse *pParse, /* Append content to the JSON parse */ - const char *zPath, /* Description of content to append */ - int *pApnd, /* Set this flag to 1 */ - const char **pzErr /* Make this point to any syntax error */ +static void jsonReturnTextJsonFromBlob( + sqlite3_context *ctx, + const u8 *aBlob, + u32 nBlob ){ - *pApnd = 1; - if( zPath[0]==0 ){ - jsonParseAddNode(pParse, JSON_NULL, 0, 0); - return pParse->oom ? 0 : &pParse->aNode[pParse->nNode-1]; - } - if( zPath[0]=='.' ){ - jsonParseAddNode(pParse, JSON_OBJECT, 0, 0); - }else if( strncmp(zPath,"[0]",3)==0 ){ - jsonParseAddNode(pParse, JSON_ARRAY, 0, 0); - }else{ - return 0; - } - if( pParse->oom ) return 0; - return jsonLookupStep(pParse, pParse->nNode-1, zPath, pApnd, pzErr); + JsonParse x; + JsonString s; + + if( NEVER(aBlob==0) ) return; + memset(&x, 0, sizeof(x)); + x.aBlob = (u8*)aBlob; + x.nBlob = nBlob; + jsonStringInit(&s, ctx); + jsonTranslateBlobToText(&x, 0, &s); + jsonReturnString(&s, 0, 0); } + /* -** Return the text of a syntax error message on a JSON path. Space is -** obtained from sqlite3_malloc(). +** Return the value of the BLOB node at index i. +** +** If the value is a primitive, return it as an SQL value. +** If the value is an array or object, return it as either +** JSON text or the BLOB encoding, depending on the JSON_B flag +** on the userdata. */ -static char *jsonPathSyntaxError(const char *zErr){ - return sqlite3_mprintf("JSON path error near '%q'", zErr); +static void jsonReturnFromBlob( + JsonParse *pParse, /* Complete JSON parse tree */ + u32 i, /* Index of the node */ + sqlite3_context *pCtx, /* Return value for this function */ + int textOnly /* return text JSON. Disregard user-data */ +){ + u32 n, sz; + int rc; + sqlite3 *db = sqlite3_context_db_handle(pCtx); + + n = jsonbPayloadSize(pParse, i, &sz); + if( n==0 ){ + sqlite3_result_error(pCtx, "malformed JSON", -1); + return; + } + switch( pParse->aBlob[i] & 0x0f ){ + case JSONB_NULL: { + if( sz ) goto returnfromblob_malformed; + sqlite3_result_null(pCtx); + break; + } + case JSONB_TRUE: { + if( sz ) goto returnfromblob_malformed; + sqlite3_result_int(pCtx, 1); + break; + } + case JSONB_FALSE: { + if( sz ) goto returnfromblob_malformed; + sqlite3_result_int(pCtx, 0); + break; + } + case JSONB_INT5: + case JSONB_INT: { + sqlite3_int64 iRes = 0; + char *z; + int bNeg = 0; + char x; + if( sz==0 ) goto returnfromblob_malformed; + x = (char)pParse->aBlob[i+n]; + if( x=='-' ){ + if( sz<2 ) goto returnfromblob_malformed; + n++; + sz--; + bNeg = 1; + } + z = sqlite3DbStrNDup(db, (const char*)&pParse->aBlob[i+n], (int)sz); + if( z==0 ) goto returnfromblob_oom; + rc = sqlite3DecOrHexToI64(z, &iRes); + sqlite3DbFree(db, z); + if( rc==0 ){ + sqlite3_result_int64(pCtx, bNeg ? -iRes : iRes); + }else if( rc==3 && bNeg ){ + sqlite3_result_int64(pCtx, SMALLEST_INT64); + }else if( rc==1 ){ + goto returnfromblob_malformed; + }else{ + if( bNeg ){ n--; sz++; } + goto to_double; + } + break; + } + case JSONB_FLOAT5: + case JSONB_FLOAT: { + double r; + char *z; + if( sz==0 ) goto returnfromblob_malformed; + to_double: + z = sqlite3DbStrNDup(db, (const char*)&pParse->aBlob[i+n], (int)sz); + if( z==0 ) goto returnfromblob_oom; + rc = sqlite3AtoF(z, &r, sqlite3Strlen30(z), SQLITE_UTF8); + sqlite3DbFree(db, z); + if( rc<=0 ) goto returnfromblob_malformed; + sqlite3_result_double(pCtx, r); + break; + } + case JSONB_TEXTRAW: + case JSONB_TEXT: { + sqlite3_result_text(pCtx, (char*)&pParse->aBlob[i+n], sz, + SQLITE_TRANSIENT); + break; + } + case JSONB_TEXT5: + case JSONB_TEXTJ: { + /* Translate JSON formatted string into raw text */ + u32 iIn, iOut; + const char *z; + char *zOut; + u32 nOut = sz; + z = (const char*)&pParse->aBlob[i+n]; + zOut = sqlite3DbMallocRaw(db, nOut+1); + if( zOut==0 ) goto returnfromblob_oom; + for(iIn=iOut=0; iIn=2 ); + zOut[iOut++] = (char)(0xc0 | (v>>6)); + zOut[iOut++] = 0x80 | (v&0x3f); + }else if( v<0x10000 ){ + assert( szEscape>=3 ); + zOut[iOut++] = 0xe0 | (v>>12); + zOut[iOut++] = 0x80 | ((v>>6)&0x3f); + zOut[iOut++] = 0x80 | (v&0x3f); + }else if( v==JSON_INVALID_CHAR ){ + /* Silently ignore illegal unicode */ + }else{ + assert( szEscape>=4 ); + zOut[iOut++] = 0xf0 | (v>>18); + zOut[iOut++] = 0x80 | ((v>>12)&0x3f); + zOut[iOut++] = 0x80 | ((v>>6)&0x3f); + zOut[iOut++] = 0x80 | (v&0x3f); + } + iIn += szEscape - 1; + }else{ + zOut[iOut++] = c; + } + } /* end for() */ + assert( iOut<=nOut ); + zOut[iOut] = 0; + sqlite3_result_text(pCtx, zOut, iOut, SQLITE_DYNAMIC); + break; + } + case JSONB_ARRAY: + case JSONB_OBJECT: { + int flags = textOnly ? 0 : SQLITE_PTR_TO_INT(sqlite3_user_data(pCtx)); + if( flags & JSON_BLOB ){ + sqlite3_result_blob(pCtx, &pParse->aBlob[i], sz+n, SQLITE_TRANSIENT); + }else{ + jsonReturnTextJsonFromBlob(pCtx, &pParse->aBlob[i], sz+n); + } + break; + } + default: { + goto returnfromblob_malformed; + } + } + return; + +returnfromblob_oom: + sqlite3_result_error_nomem(pCtx); + return; + +returnfromblob_malformed: + sqlite3_result_error(pCtx, "malformed JSON", -1); + return; } /* -** Do a node lookup using zPath. Return a pointer to the node on success. -** Return NULL if not found or if there is an error. +** pArg is a function argument that might be an SQL value or a JSON +** value. Figure out what it is and encode it as a JSONB blob. +** Return the results in pParse. ** -** On an error, write an error message into pCtx and increment the -** pParse->nErr counter. +** pParse is uninitialized upon entry. This routine will handle the +** initialization of pParse. The result will be contained in +** pParse->aBlob and pParse->nBlob. pParse->aBlob might be dynamically +** allocated (if pParse->nBlobAlloc is greater than zero) in which case +** the caller is responsible for freeing the space allocated to pParse->aBlob +** when it has finished with it. Or pParse->aBlob might be a static string +** or a value obtained from sqlite3_value_blob(pArg). ** -** If pApnd!=NULL then try to append missing nodes and set *pApnd = 1 if -** nodes are appended. +** If the argument is a BLOB that is clearly not a JSONB, then this +** function might set an error message in ctx and return non-zero. +** It might also set an error message and return non-zero on an OOM error. */ -static JsonNode *jsonLookup( - JsonParse *pParse, /* The JSON to search */ - const char *zPath, /* The path to search */ - int *pApnd, /* Append nodes to complete path if not NULL */ - sqlite3_context *pCtx /* Report errors here, if not NULL */ -){ - const char *zErr = 0; - JsonNode *pNode = 0; - char *zMsg; - - if( zPath==0 ) return 0; - if( zPath[0]!='$' ){ - zErr = zPath; - goto lookup_err; +static int jsonFunctionArgToBlob( + sqlite3_context *ctx, + sqlite3_value *pArg, + JsonParse *pParse +){ + int eType = sqlite3_value_type(pArg); + static u8 aNull[] = { 0x00 }; + memset(pParse, 0, sizeof(pParse[0])); + pParse->db = sqlite3_context_db_handle(ctx); + switch( eType ){ + default: { + pParse->aBlob = aNull; + pParse->nBlob = 1; + return 0; + } + case SQLITE_BLOB: { + if( jsonFuncArgMightBeBinary(pArg) ){ + pParse->aBlob = (u8*)sqlite3_value_blob(pArg); + pParse->nBlob = sqlite3_value_bytes(pArg); + }else{ + sqlite3_result_error(ctx, "JSON cannot hold BLOB values", -1); + return 1; + } + break; + } + case SQLITE_TEXT: { + const char *zJson = (const char*)sqlite3_value_text(pArg); + int nJson = sqlite3_value_bytes(pArg); + if( zJson==0 ) return 1; + if( sqlite3_value_subtype(pArg)==JSON_SUBTYPE ){ + pParse->zJson = (char*)zJson; + pParse->nJson = nJson; + if( jsonConvertTextToBlob(pParse, ctx) ){ + sqlite3_result_error(ctx, "malformed JSON", -1); + sqlite3DbFree(pParse->db, pParse->aBlob); + memset(pParse, 0, sizeof(pParse[0])); + return 1; + } + }else{ + jsonBlobAppendNode(pParse, JSONB_TEXTRAW, nJson, zJson); + } + break; + } + case SQLITE_FLOAT: { + double r = sqlite3_value_double(pArg); + if( NEVER(sqlite3IsNaN(r)) ){ + jsonBlobAppendNode(pParse, JSONB_NULL, 0, 0); + }else{ + int n = sqlite3_value_bytes(pArg); + const char *z = (const char*)sqlite3_value_text(pArg); + if( z==0 ) return 1; + if( z[0]=='I' ){ + jsonBlobAppendNode(pParse, JSONB_FLOAT, 5, "9e999"); + }else if( z[0]=='-' && z[1]=='I' ){ + jsonBlobAppendNode(pParse, JSONB_FLOAT, 6, "-9e999"); + }else{ + jsonBlobAppendNode(pParse, JSONB_FLOAT, n, z); + } + } + break; + } + case SQLITE_INTEGER: { + int n = sqlite3_value_bytes(pArg); + const char *z = (const char*)sqlite3_value_text(pArg); + if( z==0 ) return 1; + jsonBlobAppendNode(pParse, JSONB_INT, n, z); + break; + } } - zPath++; - pNode = jsonLookupStep(pParse, 0, zPath, pApnd, &zErr); - if( zErr==0 ) return pNode; + if( pParse->oom ){ + sqlite3_result_error_nomem(ctx); + return 1; + }else{ + return 0; + } +} -lookup_err: - pParse->nErr++; - assert( zErr!=0 && pCtx!=0 ); - zMsg = jsonPathSyntaxError(zErr); +/* +** Generate a bad path error. +** +** If ctx is not NULL then push the error message into ctx and return NULL. +** If ctx is NULL, then return the text of the error message. +*/ +static char *jsonBadPathError( + sqlite3_context *ctx, /* The function call containing the error */ + const char *zPath /* The path with the problem */ +){ + char *zMsg = sqlite3_mprintf("bad JSON path: %Q", zPath); + if( ctx==0 ) return zMsg; if( zMsg ){ - sqlite3_result_error(pCtx, zMsg, -1); + sqlite3_result_error(ctx, zMsg, -1); sqlite3_free(zMsg); }else{ - sqlite3_result_error_nomem(pCtx); + sqlite3_result_error_nomem(ctx); } return 0; } +/* argv[0] is a BLOB that seems likely to be a JSONB. Subsequent +** arguments come in parse where each pair contains a JSON path and +** content to insert or set at that patch. Do the updates +** and return the result. +** +** The specific operation is determined by eEdit, which can be one +** of JEDIT_INS, JEDIT_REPL, or JEDIT_SET. +*/ +static void jsonInsertIntoBlob( + sqlite3_context *ctx, + int argc, + sqlite3_value **argv, + int eEdit /* JEDIT_INS, JEDIT_REPL, or JEDIT_SET */ +){ + int i; + u32 rc = 0; + const char *zPath = 0; + int flgs; + JsonParse *p; + JsonParse ax; + + assert( (argc&1)==1 ); + flgs = argc==1 ? 0 : JSON_EDITABLE; + p = jsonParseFuncArg(ctx, argv[0], flgs); + if( p==0 ) return; + for(i=1; inBlob, ax.aBlob, ax.nBlob); + } + rc = 0; + }else{ + p->eEdit = eEdit; + p->nIns = ax.nBlob; + p->aIns = ax.aBlob; + p->delta = 0; + rc = jsonLookupStep(p, 0, zPath+1, 0); + } + jsonParseReset(&ax); + if( rc==JSON_LOOKUP_NOTFOUND ) continue; + if( JSON_LOOKUP_ISERROR(rc) ) goto jsonInsertIntoBlob_patherror; + } + jsonReturnParse(ctx, p); + jsonParseFree(p); + return; + +jsonInsertIntoBlob_patherror: + jsonParseFree(p); + if( rc==JSON_LOOKUP_ERROR ){ + sqlite3_result_error(ctx, "malformed JSON", -1); + }else{ + jsonBadPathError(ctx, zPath); + } + return; +} /* -** Report the wrong number of arguments for json_insert(), json_replace() -** or json_set(). +** If pArg is a blob that seems like a JSONB blob, then initialize +** p to point to that JSONB and return TRUE. If pArg does not seem like +** a JSONB blob, then return FALSE; +** +** This routine is only called if it is already known that pArg is a +** blob. The only open question is whether or not the blob appears +** to be a JSONB blob. */ -static void jsonWrongNumArgs( - sqlite3_context *pCtx, - const char *zFuncName -){ - char *zMsg = sqlite3_mprintf("json_%s() needs an odd number of arguments", - zFuncName); - sqlite3_result_error(pCtx, zMsg, -1); - sqlite3_free(zMsg); +static int jsonArgIsJsonb(sqlite3_value *pArg, JsonParse *p){ + u32 n, sz = 0; + p->aBlob = (u8*)sqlite3_value_blob(pArg); + p->nBlob = (u32)sqlite3_value_bytes(pArg); + if( p->nBlob==0 ){ + p->aBlob = 0; + return 0; + } + if( NEVER(p->aBlob==0) ){ + return 0; + } + if( (p->aBlob[0] & 0x0f)<=JSONB_OBJECT + && (n = jsonbPayloadSize(p, 0, &sz))>0 + && sz+n==p->nBlob + && ((p->aBlob[0] & 0x0f)>JSONB_FALSE || sz==0) + ){ + return 1; + } + p->aBlob = 0; + p->nBlob = 0; + return 0; } /* -** Mark all NULL entries in the Object passed in as JNODE_REMOVE. +** Generate a JsonParse object, containing valid JSONB in aBlob and nBlob, +** from the SQL function argument pArg. Return a pointer to the new +** JsonParse object. +** +** Ownership of the new JsonParse object is passed to the caller. The +** caller should invoke jsonParseFree() on the return value when it +** has finished using it. +** +** If any errors are detected, an appropriate error messages is set +** using sqlite3_result_error() or the equivalent and this routine +** returns NULL. This routine also returns NULL if the pArg argument +** is an SQL NULL value, but no error message is set in that case. This +** is so that SQL functions that are given NULL arguments will return +** a NULL value. */ -static void jsonRemoveAllNulls(JsonNode *pNode){ - int i, n; - assert( pNode->eType==JSON_OBJECT ); - n = pNode->n; - for(i=2; i<=n; i += jsonNodeSize(&pNode[i])+1){ - switch( pNode[i].eType ){ - case JSON_NULL: - pNode[i].jnFlags |= JNODE_REMOVE; - break; - case JSON_OBJECT: - jsonRemoveAllNulls(&pNode[i]); - break; +static JsonParse *jsonParseFuncArg( + sqlite3_context *ctx, + sqlite3_value *pArg, + u32 flgs +){ + int eType; /* Datatype of pArg */ + JsonParse *p = 0; /* Value to be returned */ + JsonParse *pFromCache = 0; /* Value taken from cache */ + sqlite3 *db; /* The database connection */ + + assert( ctx!=0 ); + eType = sqlite3_value_type(pArg); + if( eType==SQLITE_NULL ){ + return 0; + } + pFromCache = jsonCacheSearch(ctx, pArg); + if( pFromCache ){ + pFromCache->nJPRef++; + if( (flgs & JSON_EDITABLE)==0 ){ + return pFromCache; } } + db = sqlite3_context_db_handle(ctx); +rebuild_from_cache: + p = sqlite3DbMallocZero(db, sizeof(*p)); + if( p==0 ) goto json_pfa_oom; + memset(p, 0, sizeof(*p)); + p->db = db; + p->nJPRef = 1; + if( pFromCache!=0 ){ + u32 nBlob = pFromCache->nBlob; + p->aBlob = sqlite3DbMallocRaw(db, nBlob); + if( p->aBlob==0 ) goto json_pfa_oom; + memcpy(p->aBlob, pFromCache->aBlob, nBlob); + p->nBlobAlloc = p->nBlob = nBlob; + p->hasNonstd = pFromCache->hasNonstd; + jsonParseFree(pFromCache); + return p; + } + if( eType==SQLITE_BLOB ){ + if( jsonArgIsJsonb(pArg,p) ){ + if( (flgs & JSON_EDITABLE)!=0 && jsonBlobMakeEditable(p, 0)==0 ){ + goto json_pfa_oom; + } + return p; + } + /* If the blob is not valid JSONB, fall through into trying to cast + ** the blob into text which is then interpreted as JSON. (tag-20240123-a) + ** + ** This goes against all historical documentation about how the SQLite + ** JSON functions were suppose to work. From the beginning, blob was + ** reserved for expansion and a blob value should have raised an error. + ** But it did not, due to a bug. And many applications came to depend + ** upon this buggy behavior, espeically when using the CLI and reading + ** JSON text using readfile(), which returns a blob. For this reason + ** we will continue to support the bug moving forward. + ** See for example https://sqlite.org/forum/forumpost/012136abd5292b8d + */ + } + p->zJson = (char*)sqlite3_value_text(pArg); + p->nJson = sqlite3_value_bytes(pArg); + if( db->mallocFailed ) goto json_pfa_oom; + if( p->nJson==0 ) goto json_pfa_malformed; + assert( p->zJson!=0 ); + if( jsonConvertTextToBlob(p, (flgs & JSON_KEEPERROR) ? 0 : ctx) ){ + if( flgs & JSON_KEEPERROR ){ + p->nErr = 1; + return p; + }else{ + jsonParseFree(p); + return 0; + } + }else{ + int isRCStr = sqlite3ValueIsOfClass(pArg, sqlite3RCStrUnref); + int rc; + if( !isRCStr ){ + char *zNew = sqlite3RCStrNew( p->nJson ); + if( zNew==0 ) goto json_pfa_oom; + memcpy(zNew, p->zJson, p->nJson); + p->zJson = zNew; + p->zJson[p->nJson] = 0; + }else{ + sqlite3RCStrRef(p->zJson); + } + p->bJsonIsRCStr = 1; + rc = jsonCacheInsert(ctx, p); + if( rc==SQLITE_NOMEM ) goto json_pfa_oom; + if( flgs & JSON_EDITABLE ){ + pFromCache = p; + p = 0; + goto rebuild_from_cache; + } + } + return p; + +json_pfa_malformed: + if( flgs & JSON_KEEPERROR ){ + p->nErr = 1; + return p; + }else{ + jsonParseFree(p); + sqlite3_result_error(ctx, "malformed JSON", -1); + return 0; + } + +json_pfa_oom: + jsonParseFree(pFromCache); + jsonParseFree(p); + sqlite3_result_error_nomem(ctx); + return 0; } +/* +** Make the return value of a JSON function either the raw JSONB blob +** or make it JSON text, depending on whether the JSON_BLOB flag is +** set on the function. +*/ +static void jsonReturnParse( + sqlite3_context *ctx, + JsonParse *p +){ + int flgs; + if( p->oom ){ + sqlite3_result_error_nomem(ctx); + return; + } + flgs = SQLITE_PTR_TO_INT(sqlite3_user_data(ctx)); + if( flgs & JSON_BLOB ){ + if( p->nBlobAlloc>0 && !p->bReadOnly ){ + sqlite3_result_blob(ctx, p->aBlob, p->nBlob, SQLITE_DYNAMIC); + p->nBlobAlloc = 0; + }else{ + sqlite3_result_blob(ctx, p->aBlob, p->nBlob, SQLITE_TRANSIENT); + } + }else{ + JsonString s; + jsonStringInit(&s, ctx); + p->delta = 0; + jsonTranslateBlobToText(p, 0, &s); + jsonReturnString(&s, p, ctx); + sqlite3_result_subtype(ctx, JSON_SUBTYPE); + } +} /**************************************************************************** ** SQL functions used for testing and debugging @@ -203539,63 +208420,124 @@ static void jsonRemoveAllNulls(JsonNode *pNode){ #if SQLITE_DEBUG /* -** Print N node entries. -*/ -static void jsonDebugPrintNodeEntries( - JsonNode *aNode, /* First node entry to print */ - int N /* Number of node entries to print */ -){ - int i; - for(i=0; iaBlob[iStart] & 0x0f; + u32 savedNBlob = pParse->nBlob; + sqlite3_str_appendf(pOut, "%5d:%*s", iStart, nIndent, ""); + if( pParse->nBlobAlloc>pParse->nBlob ){ + pParse->nBlob = pParse->nBlobAlloc; + } + nn = n = jsonbPayloadSize(pParse, iStart, &sz); + if( nn==0 ) nn = 1; + if( sz>0 && xaBlob[iStart+i]); + } + if( n==0 ){ + sqlite3_str_appendf(pOut, " ERROR invalid node size\n"); + iStart = n==0 ? iStart+1 : iEnd; + continue; + } + pParse->nBlob = savedNBlob; + if( iStart+n+sz>iEnd ){ + iEnd = iStart+n+sz; + if( iEnd>pParse->nBlob ){ + if( pParse->nBlobAlloc>0 && iEnd>pParse->nBlobAlloc ){ + iEnd = pParse->nBlobAlloc; + }else{ + iEnd = pParse->nBlob; + } + } } - printf("node %4u: %-7s n=%-5d", i, zType, aNode[i].n); - if( (aNode[i].jnFlags & ~JNODE_LABEL)!=0 ){ - u8 f = aNode[i].jnFlags; - if( f & JNODE_RAW ) printf(" RAW"); - if( f & JNODE_ESCAPE ) printf(" ESCAPE"); - if( f & JNODE_REMOVE ) printf(" REMOVE"); - if( f & JNODE_REPLACE ) printf(" REPLACE"); - if( f & JNODE_APPEND ) printf(" APPEND"); - if( f & JNODE_JSON5 ) printf(" JSON5"); + sqlite3_str_appendall(pOut," <-- "); + switch( x ){ + case JSONB_NULL: sqlite3_str_appendall(pOut,"null"); break; + case JSONB_TRUE: sqlite3_str_appendall(pOut,"true"); break; + case JSONB_FALSE: sqlite3_str_appendall(pOut,"false"); break; + case JSONB_INT: sqlite3_str_appendall(pOut,"int"); break; + case JSONB_INT5: sqlite3_str_appendall(pOut,"int5"); break; + case JSONB_FLOAT: sqlite3_str_appendall(pOut,"float"); break; + case JSONB_FLOAT5: sqlite3_str_appendall(pOut,"float5"); break; + case JSONB_TEXT: sqlite3_str_appendall(pOut,"text"); break; + case JSONB_TEXTJ: sqlite3_str_appendall(pOut,"textj"); break; + case JSONB_TEXT5: sqlite3_str_appendall(pOut,"text5"); break; + case JSONB_TEXTRAW: sqlite3_str_appendall(pOut,"textraw"); break; + case JSONB_ARRAY: { + sqlite3_str_appendf(pOut,"array, %u bytes\n", sz); + jsonDebugPrintBlob(pParse, iStart+n, iStart+n+sz, nIndent+2, pOut); + showContent = 0; + break; + } + case JSONB_OBJECT: { + sqlite3_str_appendf(pOut, "object, %u bytes\n", sz); + jsonDebugPrintBlob(pParse, iStart+n, iStart+n+sz, nIndent+2, pOut); + showContent = 0; + break; + } + default: { + sqlite3_str_appendall(pOut, "ERROR: unknown node type\n"); + showContent = 0; + break; + } } - switch( aNode[i].eU ){ - case 1: printf(" zJContent=[%.*s]\n", - aNode[i].n, aNode[i].u.zJContent); break; - case 2: printf(" iAppend=%u\n", aNode[i].u.iAppend); break; - case 3: printf(" iKey=%u\n", aNode[i].u.iKey); break; - case 4: printf(" iPrev=%u\n", aNode[i].u.iPrev); break; - default: printf("\n"); + if( showContent ){ + if( sz==0 && x<=JSONB_FALSE ){ + sqlite3_str_append(pOut, "\n", 1); + }else{ + u32 j; + sqlite3_str_appendall(pOut, ": \""); + for(j=iStart+n; jaBlob[j]; + if( c<0x20 || c>=0x7f ) c = '.'; + sqlite3_str_append(pOut, (char*)&c, 1); + } + sqlite3_str_append(pOut, "\"\n", 2); + } } + iStart += n + sz; } } -#endif /* SQLITE_DEBUG */ - - -#if 0 /* 1 for debugging. 0 normally. Requires -DSQLITE_DEBUG too */ -static void jsonDebugPrintParse(JsonParse *p){ - jsonDebugPrintNodeEntries(p->aNode, p->nNode); -} -static void jsonDebugPrintNode(JsonNode *pNode){ - jsonDebugPrintNodeEntries(pNode, jsonNodeSize(pNode)); +static void jsonShowParse(JsonParse *pParse){ + sqlite3_str out; + char zBuf[1000]; + if( pParse==0 ){ + printf("NULL pointer\n"); + return; + }else{ + printf("nBlobAlloc = %u\n", pParse->nBlobAlloc); + printf("nBlob = %u\n", pParse->nBlob); + printf("delta = %d\n", pParse->delta); + if( pParse->nBlob==0 ) return; + printf("content (bytes 0..%u):\n", pParse->nBlob-1); + } + sqlite3StrAccumInit(&out, 0, zBuf, sizeof(zBuf), 1000000); + jsonDebugPrintBlob(pParse, 0, pParse->nBlob, 0, &out); + printf("%s", sqlite3_str_value(&out)); + sqlite3_str_reset(&out); } -#else - /* The usual case */ -# define jsonDebugPrintNode(X) -# define jsonDebugPrintParse(X) -#endif +#endif /* SQLITE_DEBUG */ #ifdef SQLITE_DEBUG /* ** SQL function: json_parse(JSON) ** -** Parse JSON using jsonParseCached(). Then print a dump of that -** parse on standard output. Return the mimified JSON result, just -** like the json() function. +** Parse JSON using jsonParseFuncArg(). Return text that is a +** human-readable dump of the binary JSONB for the input parameter. */ static void jsonParseFunc( sqlite3_context *ctx, @@ -203603,38 +208545,20 @@ static void jsonParseFunc( sqlite3_value **argv ){ JsonParse *p; /* The parse */ + sqlite3_str out; - assert( argc==1 ); - p = jsonParseCached(ctx, argv[0], ctx, 0); + assert( argc>=1 ); + sqlite3StrAccumInit(&out, 0, 0, 0, 1000000); + p = jsonParseFuncArg(ctx, argv[0], 0); if( p==0 ) return; - printf("nNode = %u\n", p->nNode); - printf("nAlloc = %u\n", p->nAlloc); - printf("nJson = %d\n", p->nJson); - printf("nAlt = %d\n", p->nAlt); - printf("nErr = %u\n", p->nErr); - printf("oom = %u\n", p->oom); - printf("hasNonstd = %u\n", p->hasNonstd); - printf("useMod = %u\n", p->useMod); - printf("hasMod = %u\n", p->hasMod); - printf("nJPRef = %u\n", p->nJPRef); - printf("iSubst = %u\n", p->iSubst); - printf("iHold = %u\n", p->iHold); - jsonDebugPrintNodeEntries(p->aNode, p->nNode); - jsonReturnJson(p, p->aNode, ctx, 1); -} - -/* -** The json_test1(JSON) function return true (1) if the input is JSON -** text generated by another json function. It returns (0) if the input -** is not known to be JSON. -*/ -static void jsonTest1Func( - sqlite3_context *ctx, - int argc, - sqlite3_value **argv -){ - UNUSED_PARAMETER(argc); - sqlite3_result_int(ctx, sqlite3_value_subtype(argv[0])==JSON_SUBTYPE); + if( argc==1 ){ + jsonDebugPrintBlob(p, 0, p->nBlob, 0, &out); + sqlite3_result_text64(ctx,out.zText,out.nChar,SQLITE_TRANSIENT,SQLITE_UTF8); + }else{ + jsonShowParse(p); + } + jsonParseFree(p); + sqlite3_str_reset(&out); } #endif /* SQLITE_DEBUG */ @@ -203643,7 +208567,7 @@ static void jsonTest1Func( ****************************************************************************/ /* -** Implementation of the json_QUOTE(VALUE) function. Return a JSON value +** Implementation of the json_quote(VALUE) function. Return a JSON value ** corresponding to the SQL value input. Mostly this means putting ** double-quotes around strings and returning the unquoted string "null" ** when given a NULL input. @@ -203656,9 +208580,9 @@ static void jsonQuoteFunc( JsonString jx; UNUSED_PARAMETER(argc); - jsonInit(&jx, ctx); - jsonAppendValue(&jx, argv[0]); - jsonResult(&jx); + jsonStringInit(&jx, ctx); + jsonAppendSqlValue(&jx, argv[0]); + jsonReturnString(&jx, 0, 0); sqlite3_result_subtype(ctx, JSON_SUBTYPE); } @@ -203675,18 +208599,17 @@ static void jsonArrayFunc( int i; JsonString jx; - jsonInit(&jx, ctx); + jsonStringInit(&jx, ctx); jsonAppendChar(&jx, '['); for(i=0; inNode ); if( argc==2 ){ const char *zPath = (const char*)sqlite3_value_text(argv[1]); - pNode = jsonLookup(p, zPath, 0, ctx); - }else{ - pNode = p->aNode; - } - if( pNode==0 ){ - return; - } - if( pNode->eType==JSON_ARRAY ){ - while( 1 /*exit-by-break*/ ){ - i = 1; - while( i<=pNode->n ){ - if( (pNode[i].jnFlags & JNODE_REMOVE)==0 ) n++; - i += jsonNodeSize(&pNode[i]); + if( zPath==0 ){ + jsonParseFree(p); + return; + } + i = jsonLookupStep(p, 0, zPath[0]=='$' ? zPath+1 : "@", 0); + if( JSON_LOOKUP_ISERROR(i) ){ + if( i==JSON_LOOKUP_NOTFOUND ){ + /* no-op */ + }else if( i==JSON_LOOKUP_PATHERROR ){ + jsonBadPathError(ctx, zPath); + }else{ + sqlite3_result_error(ctx, "malformed JSON", -1); } - if( (pNode->jnFlags & JNODE_APPEND)==0 ) break; - if( p->useMod==0 ) break; - assert( pNode->eU==2 ); - pNode = &p->aNode[pNode->u.iAppend]; + eErr = 1; + i = 0; } + }else{ + i = 0; + } + if( (p->aBlob[i] & 0x0f)==JSONB_ARRAY ){ + cnt = jsonbArrayCount(p, i); } - sqlite3_result_int64(ctx, n); + if( !eErr ) sqlite3_result_int64(ctx, cnt); + jsonParseFree(p); } -/* -** Bit values for the flags passed into jsonExtractFunc() or -** jsonSetFunc() via the user-data value. -*/ -#define JSON_JSON 0x01 /* Result is always JSON */ -#define JSON_SQL 0x02 /* Result is always SQL */ -#define JSON_ABPATH 0x03 /* Allow abbreviated JSON path specs */ -#define JSON_ISSET 0x04 /* json_set(), not json_insert() */ +/* True if the string is all alphanumerics and underscores */ +static int jsonAllAlphanum(const char *z, int n){ + int i; + for(i=0; i2 ){ + jsonAppendChar(&jx, '['); + } + for(i=1; i and ->> operators accept abbreviated PATH arguments. This - ** is mostly for compatibility with PostgreSQL, but also for - ** convenience. - ** - ** NUMBER ==> $[NUMBER] // PG compatible - ** LABEL ==> $.LABEL // PG compatible - ** [NUMBER] ==> $[NUMBER] // Not PG. Purely for convenience - */ - jsonInit(&jx, ctx); - if( sqlite3Isdigit(zPath[0]) ){ - jsonAppendRawNZ(&jx, "$[", 2); - jsonAppendRaw(&jx, zPath, (int)strlen(zPath)); - jsonAppendRawNZ(&jx, "]", 2); - }else{ - jsonAppendRawNZ(&jx, "$.", 1 + (zPath[0]!='[')); - jsonAppendRaw(&jx, zPath, (int)strlen(zPath)); - jsonAppendChar(&jx, 0); - } - pNode = jx.bErr ? 0 : jsonLookup(p, jx.zBuf, 0, ctx); - jsonReset(&jx); + const char *zPath = (const char*)sqlite3_value_text(argv[i]); + int nPath; + u32 j; + if( zPath==0 ) goto json_extract_error; + nPath = sqlite3Strlen30(zPath); + if( zPath[0]=='$' ){ + j = jsonLookupStep(p, 0, zPath+1, 0); + }else if( (flags & JSON_ABPATH) ){ + /* The -> and ->> operators accept abbreviated PATH arguments. This + ** is mostly for compatibility with PostgreSQL, but also for + ** convenience. + ** + ** NUMBER ==> $[NUMBER] // PG compatible + ** LABEL ==> $.LABEL // PG compatible + ** [NUMBER] ==> $[NUMBER] // Not PG. Purely for convenience + */ + jsonStringInit(&jx, ctx); + if( sqlite3_value_type(argv[i])==SQLITE_INTEGER ){ + jsonAppendRawNZ(&jx, "[", 1); + jsonAppendRaw(&jx, zPath, nPath); + jsonAppendRawNZ(&jx, "]", 2); + }else if( jsonAllAlphanum(zPath, nPath) ){ + jsonAppendRawNZ(&jx, ".", 1); + jsonAppendRaw(&jx, zPath, nPath); + }else if( zPath[0]=='[' && nPath>=3 && zPath[nPath-1]==']' ){ + jsonAppendRaw(&jx, zPath, nPath); }else{ - pNode = jsonLookup(p, zPath, 0, ctx); + jsonAppendRawNZ(&jx, ".\"", 2); + jsonAppendRaw(&jx, zPath, nPath); + jsonAppendRawNZ(&jx, "\"", 1); } - if( pNode ){ + jsonStringTerminate(&jx); + j = jsonLookupStep(p, 0, jx.zBuf, 0); + jsonStringReset(&jx); + }else{ + jsonBadPathError(ctx, zPath); + goto json_extract_error; + } + if( jnBlob ){ + if( argc==2 ){ if( flags & JSON_JSON ){ - jsonReturnJson(p, pNode, ctx, 0); + jsonStringInit(&jx, ctx); + jsonTranslateBlobToText(p, j, &jx); + jsonReturnString(&jx, 0, 0); + jsonStringReset(&jx); + assert( (flags & JSON_BLOB)==0 ); + sqlite3_result_subtype(ctx, JSON_SUBTYPE); }else{ - jsonReturn(p, pNode, ctx); - sqlite3_result_subtype(ctx, 0); + jsonReturnFromBlob(p, j, ctx, 0); + if( (flags & (JSON_SQL|JSON_BLOB))==0 + && (p->aBlob[j]&0x0f)>=JSONB_ARRAY + ){ + sqlite3_result_subtype(ctx, JSON_SUBTYPE); + } } + }else{ + jsonAppendSeparator(&jx); + jsonTranslateBlobToText(p, j, &jx); } - }else{ - pNode = jsonLookup(p, zPath, 0, ctx); - if( p->nErr==0 && pNode ) jsonReturn(p, pNode, ctx); - } - }else{ - /* Two or more PATH arguments results in a JSON array with each - ** element of the array being the value selected by one of the PATHs */ - int i; - jsonInit(&jx, ctx); - jsonAppendChar(&jx, '['); - for(i=1; inErr ) break; - jsonAppendSeparator(&jx); - if( pNode ){ - jsonRenderNode(p, pNode, &jx); + }else if( j==JSON_LOOKUP_NOTFOUND ){ + if( argc==2 ){ + goto json_extract_error; /* Return NULL if not found */ }else{ + jsonAppendSeparator(&jx); jsonAppendRawNZ(&jx, "null", 4); } + }else if( j==JSON_LOOKUP_ERROR ){ + sqlite3_result_error(ctx, "malformed JSON", -1); + goto json_extract_error; + }else{ + jsonBadPathError(ctx, zPath); + goto json_extract_error; } - if( i==argc ){ - jsonAppendChar(&jx, ']'); - jsonResult(&jx); + } + if( argc>2 ){ + jsonAppendChar(&jx, ']'); + jsonReturnString(&jx, 0, 0); + if( (flags & JSON_BLOB)==0 ){ sqlite3_result_subtype(ctx, JSON_SUBTYPE); } - jsonReset(&jx); } +json_extract_error: + jsonStringReset(&jx); + jsonParseFree(p); + return; } -/* This is the RFC 7396 MergePatch algorithm. -*/ -static JsonNode *jsonMergePatch( - JsonParse *pParse, /* The JSON parser that contains the TARGET */ - u32 iTarget, /* Node of the TARGET in pParse */ - JsonNode *pPatch /* The PATCH */ -){ - u32 i, j; - u32 iRoot; - JsonNode *pTarget; - if( pPatch->eType!=JSON_OBJECT ){ - return pPatch; - } - assert( iTargetnNode ); - pTarget = &pParse->aNode[iTarget]; - assert( (pPatch->jnFlags & JNODE_APPEND)==0 ); - if( pTarget->eType!=JSON_OBJECT ){ - jsonRemoveAllNulls(pPatch); - return pPatch; - } - iRoot = iTarget; - for(i=1; in; i += jsonNodeSize(&pPatch[i+1])+1){ - u32 nKey; - const char *zKey; - assert( pPatch[i].eType==JSON_STRING ); - assert( pPatch[i].jnFlags & JNODE_LABEL ); - assert( pPatch[i].eU==1 ); - nKey = pPatch[i].n; - zKey = pPatch[i].u.zJContent; - for(j=1; jn; j += jsonNodeSize(&pTarget[j+1])+1 ){ - assert( pTarget[j].eType==JSON_STRING ); - assert( pTarget[j].jnFlags & JNODE_LABEL ); - if( jsonSameLabel(&pPatch[i], &pTarget[j]) ){ - if( pTarget[j+1].jnFlags & (JNODE_REMOVE|JNODE_REPLACE) ) break; - if( pPatch[i+1].eType==JSON_NULL ){ - pTarget[j+1].jnFlags |= JNODE_REMOVE; - }else{ - JsonNode *pNew = jsonMergePatch(pParse, iTarget+j+1, &pPatch[i+1]); - if( pNew==0 ) return 0; - if( pNew!=&pParse->aNode[iTarget+j+1] ){ - jsonParseAddSubstNode(pParse, iTarget+j+1); - jsonParseAddNodeArray(pParse, pNew, jsonNodeSize(pNew)); - } - pTarget = &pParse->aNode[iTarget]; - } - break; +/* +** Return codes for jsonMergePatch() +*/ +#define JSON_MERGE_OK 0 /* Success */ +#define JSON_MERGE_BADTARGET 1 /* Malformed TARGET blob */ +#define JSON_MERGE_BADPATCH 2 /* Malformed PATCH blob */ +#define JSON_MERGE_OOM 3 /* Out-of-memory condition */ + +/* +** RFC-7396 MergePatch for two JSONB blobs. +** +** pTarget is the target. pPatch is the patch. The target is updated +** in place. The patch is read-only. +** +** The original RFC-7396 algorithm is this: +** +** define MergePatch(Target, Patch): +** if Patch is an Object: +** if Target is not an Object: +** Target = {} # Ignore the contents and set it to an empty Object +** for each Name/Value pair in Patch: +** if Value is null: +** if Name exists in Target: +** remove the Name/Value pair from Target +** else: +** Target[Name] = MergePatch(Target[Name], Value) +** return Target +** else: +** return Patch +** +** Here is an equivalent algorithm restructured to show the actual +** implementation: +** +** 01 define MergePatch(Target, Patch): +** 02 if Patch is not an Object: +** 03 return Patch +** 04 else: // if Patch is an Object +** 05 if Target is not an Object: +** 06 Target = {} +** 07 for each Name/Value pair in Patch: +** 08 if Name exists in Target: +** 09 if Value is null: +** 10 remove the Name/Value pair from Target +** 11 else +** 12 Target[name] = MergePatch(Target[Name], Value) +** 13 else if Value is not NULL: +** 14 if Value is not an Object: +** 15 Target[name] = Value +** 16 else: +** 17 Target[name] = MergePatch('{}',value) +** 18 return Target +** | +** ^---- Line numbers referenced in comments in the implementation +*/ +static int jsonMergePatch( + JsonParse *pTarget, /* The JSON parser that contains the TARGET */ + u32 iTarget, /* Index of TARGET in pTarget->aBlob[] */ + const JsonParse *pPatch, /* The PATCH */ + u32 iPatch /* Index of PATCH in pPatch->aBlob[] */ +){ + u8 x; /* Type of a single node */ + u32 n, sz=0; /* Return values from jsonbPayloadSize() */ + u32 iTCursor; /* Cursor position while scanning the target object */ + u32 iTStart; /* First label in the target object */ + u32 iTEndBE; /* Original first byte past end of target, before edit */ + u32 iTEnd; /* Current first byte past end of target */ + u8 eTLabel; /* Node type of the target label */ + u32 iTLabel = 0; /* Index of the label */ + u32 nTLabel = 0; /* Header size in bytes for the target label */ + u32 szTLabel = 0; /* Size of the target label payload */ + u32 iTValue = 0; /* Index of the target value */ + u32 nTValue = 0; /* Header size of the target value */ + u32 szTValue = 0; /* Payload size for the target value */ + + u32 iPCursor; /* Cursor position while scanning the patch */ + u32 iPEnd; /* First byte past the end of the patch */ + u8 ePLabel; /* Node type of the patch label */ + u32 iPLabel; /* Start of patch label */ + u32 nPLabel; /* Size of header on the patch label */ + u32 szPLabel; /* Payload size of the patch label */ + u32 iPValue; /* Start of patch value */ + u32 nPValue; /* Header size for the patch value */ + u32 szPValue; /* Payload size of the patch value */ + + assert( iTarget>=0 && iTargetnBlob ); + assert( iPatch>=0 && iPatchnBlob ); + x = pPatch->aBlob[iPatch] & 0x0f; + if( x!=JSONB_OBJECT ){ /* Algorithm line 02 */ + u32 szPatch; /* Total size of the patch, header+payload */ + u32 szTarget; /* Total size of the target, header+payload */ + n = jsonbPayloadSize(pPatch, iPatch, &sz); + szPatch = n+sz; + sz = 0; + n = jsonbPayloadSize(pTarget, iTarget, &sz); + szTarget = n+sz; + jsonBlobEdit(pTarget, iTarget, szTarget, pPatch->aBlob+iPatch, szPatch); + return pTarget->oom ? JSON_MERGE_OOM : JSON_MERGE_OK; /* Line 03 */ + } + x = pTarget->aBlob[iTarget] & 0x0f; + if( x!=JSONB_OBJECT ){ /* Algorithm line 05 */ + n = jsonbPayloadSize(pTarget, iTarget, &sz); + jsonBlobEdit(pTarget, iTarget+n, sz, 0, 0); + x = pTarget->aBlob[iTarget]; + pTarget->aBlob[iTarget] = (x & 0xf0) | JSONB_OBJECT; + } + n = jsonbPayloadSize(pPatch, iPatch, &sz); + if( NEVER(n==0) ) return JSON_MERGE_BADPATCH; + iPCursor = iPatch+n; + iPEnd = iPCursor+sz; + n = jsonbPayloadSize(pTarget, iTarget, &sz); + if( NEVER(n==0) ) return JSON_MERGE_BADTARGET; + iTStart = iTarget+n; + iTEndBE = iTStart+sz; + + while( iPCursoraBlob[iPCursor] & 0x0f; + if( ePLabelJSONB_TEXTRAW ){ + return JSON_MERGE_BADPATCH; + } + nPLabel = jsonbPayloadSize(pPatch, iPCursor, &szPLabel); + if( nPLabel==0 ) return JSON_MERGE_BADPATCH; + iPValue = iPCursor + nPLabel + szPLabel; + if( iPValue>=iPEnd ) return JSON_MERGE_BADPATCH; + nPValue = jsonbPayloadSize(pPatch, iPValue, &szPValue); + if( nPValue==0 ) return JSON_MERGE_BADPATCH; + iPCursor = iPValue + nPValue + szPValue; + if( iPCursor>iPEnd ) return JSON_MERGE_BADPATCH; + + iTCursor = iTStart; + iTEnd = iTEndBE + pTarget->delta; + while( iTCursoraBlob[iTCursor] & 0x0f; + if( eTLabelJSONB_TEXTRAW ){ + return JSON_MERGE_BADTARGET; + } + nTLabel = jsonbPayloadSize(pTarget, iTCursor, &szTLabel); + if( nTLabel==0 ) return JSON_MERGE_BADTARGET; + iTValue = iTLabel + nTLabel + szTLabel; + if( iTValue>=iTEnd ) return JSON_MERGE_BADTARGET; + nTValue = jsonbPayloadSize(pTarget, iTValue, &szTValue); + if( nTValue==0 ) return JSON_MERGE_BADTARGET; + if( iTValue + nTValue + szTValue > iTEnd ) return JSON_MERGE_BADTARGET; + isEqual = jsonLabelCompare( + (const char*)&pPatch->aBlob[iPLabel+nPLabel], + szPLabel, + (ePLabel==JSONB_TEXT || ePLabel==JSONB_TEXTRAW), + (const char*)&pTarget->aBlob[iTLabel+nTLabel], + szTLabel, + (eTLabel==JSONB_TEXT || eTLabel==JSONB_TEXTRAW)); + if( isEqual ) break; + iTCursor = iTValue + nTValue + szTValue; + } + x = pPatch->aBlob[iPValue] & 0x0f; + if( iTCursoroom) ) return JSON_MERGE_OOM; + }else{ + /* Algorithm line 12 */ + int rc, savedDelta = pTarget->delta; + pTarget->delta = 0; + rc = jsonMergePatch(pTarget, iTValue, pPatch, iPValue); + if( rc ) return rc; + pTarget->delta += savedDelta; + } + }else if( x>0 ){ /* Algorithm line 13 */ + /* No match and patch value is not NULL */ + u32 szNew = szPLabel+nPLabel; + if( (pPatch->aBlob[iPValue] & 0x0f)!=JSONB_OBJECT ){ /* Line 14 */ + jsonBlobEdit(pTarget, iTEnd, 0, 0, szPValue+nPValue+szNew); + if( pTarget->oom ) return JSON_MERGE_OOM; + memcpy(&pTarget->aBlob[iTEnd], &pPatch->aBlob[iPLabel], szNew); + memcpy(&pTarget->aBlob[iTEnd+szNew], + &pPatch->aBlob[iPValue], szPValue+nPValue); + }else{ + int rc, savedDelta; + jsonBlobEdit(pTarget, iTEnd, 0, 0, szNew+1); + if( pTarget->oom ) return JSON_MERGE_OOM; + memcpy(&pTarget->aBlob[iTEnd], &pPatch->aBlob[iPLabel], szNew); + pTarget->aBlob[iTEnd+szNew] = 0x00; + savedDelta = pTarget->delta; + pTarget->delta = 0; + rc = jsonMergePatch(pTarget, iTEnd+szNew,pPatch,iPValue); + if( rc ) return rc; + pTarget->delta += savedDelta; } } - if( j>=pTarget->n && pPatch[i+1].eType!=JSON_NULL ){ - int iStart; - JsonNode *pApnd; - u32 nApnd; - iStart = jsonParseAddNode(pParse, JSON_OBJECT, 0, 0); - jsonParseAddNode(pParse, JSON_STRING, nKey, zKey); - pApnd = &pPatch[i+1]; - if( pApnd->eType==JSON_OBJECT ) jsonRemoveAllNulls(pApnd); - nApnd = jsonNodeSize(pApnd); - jsonParseAddNodeArray(pParse, pApnd, jsonNodeSize(pApnd)); - if( pParse->oom ) return 0; - pParse->aNode[iStart].n = 1+nApnd; - pParse->aNode[iRoot].jnFlags |= JNODE_APPEND; - pParse->aNode[iRoot].u.iAppend = iStart; - VVA( pParse->aNode[iRoot].eU = 2 ); - iRoot = iStart; - pTarget = &pParse->aNode[iTarget]; - } } - return pTarget; + if( pTarget->delta ) jsonAfterEditSizeAdjust(pTarget, iTarget); + return pTarget->oom ? JSON_MERGE_OOM : JSON_MERGE_OK; } + /* ** Implementation of the json_mergepatch(JSON1,JSON2) function. Return a JSON ** object that is the result of running the RFC 7396 MergePatch() algorithm @@ -203922,28 +209000,27 @@ static void jsonPatchFunc( int argc, sqlite3_value **argv ){ - JsonParse *pX; /* The JSON that is being patched */ - JsonParse *pY; /* The patch */ - JsonNode *pResult; /* The result of the merge */ + JsonParse *pTarget; /* The TARGET */ + JsonParse *pPatch; /* The PATCH */ + int rc; /* Result code */ UNUSED_PARAMETER(argc); - pX = jsonParseCached(ctx, argv[0], ctx, 1); - if( pX==0 ) return; - assert( pX->hasMod==0 ); - pX->hasMod = 1; - pY = jsonParseCached(ctx, argv[1], ctx, 1); - if( pY==0 ) return; - pX->useMod = 1; - pY->useMod = 1; - pResult = jsonMergePatch(pX, 0, pY->aNode); - assert( pResult!=0 || pX->oom ); - if( pResult && pX->oom==0 ){ - jsonDebugPrintParse(pX); - jsonDebugPrintNode(pResult); - jsonReturnJson(pX, pResult, ctx, 0); - }else{ - sqlite3_result_error_nomem(ctx); + assert( argc==2 ); + pTarget = jsonParseFuncArg(ctx, argv[0], JSON_EDITABLE); + if( pTarget==0 ) return; + pPatch = jsonParseFuncArg(ctx, argv[1], 0); + if( pPatch ){ + rc = jsonMergePatch(pTarget, 0, pPatch, 0); + if( rc==JSON_MERGE_OK ){ + jsonReturnParse(ctx, pTarget); + }else if( rc==JSON_MERGE_OOM ){ + sqlite3_result_error_nomem(ctx); + }else{ + sqlite3_result_error(ctx, "malformed JSON", -1); + } + jsonParseFree(pPatch); } + jsonParseFree(pTarget); } @@ -203967,23 +209044,23 @@ static void jsonObjectFunc( "of arguments", -1); return; } - jsonInit(&jx, ctx); + jsonStringInit(&jx, ctx); jsonAppendChar(&jx, '{'); for(i=0; i1); - if( pParse==0 ) return; - for(i=1; i<(u32)argc; i++){ + p = jsonParseFuncArg(ctx, argv[0], argc>1 ? JSON_EDITABLE : 0); + if( p==0 ) return; + for(i=1; inErr ) goto remove_done; - if( pNode ){ - pNode->jnFlags |= JNODE_REMOVE; - pParse->hasMod = 1; - pParse->useMod = 1; + if( zPath==0 ){ + goto json_remove_done; + } + if( zPath[0]!='$' ){ + goto json_remove_patherror; + } + if( zPath[1]==0 ){ + /* json_remove(j,'$') returns NULL */ + goto json_remove_done; + } + p->eEdit = JEDIT_DEL; + p->delta = 0; + rc = jsonLookupStep(p, 0, zPath+1, 0); + if( JSON_LOOKUP_ISERROR(rc) ){ + if( rc==JSON_LOOKUP_NOTFOUND ){ + continue; /* No-op */ + }else if( rc==JSON_LOOKUP_PATHERROR ){ + jsonBadPathError(ctx, zPath); + }else{ + sqlite3_result_error(ctx, "malformed JSON", -1); + } + goto json_remove_done; } } - if( (pParse->aNode[0].jnFlags & JNODE_REMOVE)==0 ){ - jsonReturnJson(pParse, pParse->aNode, ctx, 1); - } -remove_done: - jsonDebugPrintParse(p); -} + jsonReturnParse(ctx, p); + jsonParseFree(p); + return; -/* -** Substitute the value at iNode with the pValue parameter. -*/ -static void jsonReplaceNode( - sqlite3_context *pCtx, - JsonParse *p, - int iNode, - sqlite3_value *pValue -){ - int idx = jsonParseAddSubstNode(p, iNode); - if( idx<=0 ){ - assert( p->oom ); - return; - } - switch( sqlite3_value_type(pValue) ){ - case SQLITE_NULL: { - jsonParseAddNode(p, JSON_NULL, 0, 0); - break; - } - case SQLITE_FLOAT: { - char *z = sqlite3_mprintf("%!0.15g", sqlite3_value_double(pValue)); - int n; - if( z==0 ){ - p->oom = 1; - break; - } - n = sqlite3Strlen30(z); - jsonParseAddNode(p, JSON_REAL, n, z); - jsonParseAddCleanup(p, sqlite3_free, z); - break; - } - case SQLITE_INTEGER: { - char *z = sqlite3_mprintf("%lld", sqlite3_value_int64(pValue)); - int n; - if( z==0 ){ - p->oom = 1; - break; - } - n = sqlite3Strlen30(z); - jsonParseAddNode(p, JSON_INT, n, z); - jsonParseAddCleanup(p, sqlite3_free, z); +json_remove_patherror: + jsonBadPathError(ctx, zPath); - break; - } - case SQLITE_TEXT: { - const char *z = (const char*)sqlite3_value_text(pValue); - u32 n = (u32)sqlite3_value_bytes(pValue); - if( z==0 ){ - p->oom = 1; - break; - } - if( sqlite3_value_subtype(pValue)!=JSON_SUBTYPE ){ - char *zCopy = sqlite3DbStrDup(0, z); - int k; - if( zCopy ){ - jsonParseAddCleanup(p, sqlite3_free, zCopy); - }else{ - p->oom = 1; - sqlite3_result_error_nomem(pCtx); - } - k = jsonParseAddNode(p, JSON_STRING, n, zCopy); - assert( k>0 || p->oom ); - if( p->oom==0 ) p->aNode[k].jnFlags |= JNODE_RAW; - }else{ - JsonParse *pPatch = jsonParseCached(pCtx, pValue, pCtx, 1); - if( pPatch==0 ){ - p->oom = 1; - break; - } - jsonParseAddNodeArray(p, pPatch->aNode, pPatch->nNode); - /* The nodes copied out of pPatch and into p likely contain - ** u.zJContent pointers into pPatch->zJson. So preserve the - ** content of pPatch until p is destroyed. */ - assert( pPatch->nJPRef>=1 ); - pPatch->nJPRef++; - jsonParseAddCleanup(p, (void(*)(void*))jsonParseFree, pPatch); - } - break; - } - default: { - jsonParseAddNode(p, JSON_NULL, 0, 0); - sqlite3_result_error(pCtx, "JSON cannot hold BLOB values", -1); - p->nErr++; - break; - } - } +json_remove_done: + jsonParseFree(p); + return; } /* @@ -204124,30 +209133,12 @@ static void jsonReplaceFunc( int argc, sqlite3_value **argv ){ - JsonParse *pParse; /* The parse */ - JsonNode *pNode; - const char *zPath; - u32 i; - if( argc<1 ) return; if( (argc&1)==0 ) { jsonWrongNumArgs(ctx, "replace"); return; } - pParse = jsonParseCached(ctx, argv[0], ctx, argc>1); - if( pParse==0 ) return; - for(i=1; i<(u32)argc; i+=2){ - zPath = (const char*)sqlite3_value_text(argv[i]); - pParse->useMod = 1; - pNode = jsonLookup(pParse, zPath, 0, ctx); - if( pParse->nErr ) goto replace_err; - if( pNode ){ - jsonReplaceNode(ctx, pParse, (u32)(pNode - pParse->aNode), argv[i+1]); - } - } - jsonReturnJson(pParse, pParse->aNode, ctx, 1); -replace_err: - jsonDebugPrintParse(pParse); + jsonInsertIntoBlob(ctx, argc, argv, JEDIT_REPL); } @@ -204168,39 +209159,16 @@ static void jsonSetFunc( int argc, sqlite3_value **argv ){ - JsonParse *pParse; /* The parse */ - JsonNode *pNode; - const char *zPath; - u32 i; - int bApnd; - int bIsSet = sqlite3_user_data(ctx)!=0; + + int flags = SQLITE_PTR_TO_INT(sqlite3_user_data(ctx)); + int bIsSet = (flags&JSON_ISSET)!=0; if( argc<1 ) return; if( (argc&1)==0 ) { jsonWrongNumArgs(ctx, bIsSet ? "set" : "insert"); return; } - pParse = jsonParseCached(ctx, argv[0], ctx, argc>1); - if( pParse==0 ) return; - for(i=1; i<(u32)argc; i+=2){ - zPath = (const char*)sqlite3_value_text(argv[i]); - bApnd = 0; - pParse->useMod = 1; - pNode = jsonLookup(pParse, zPath, &bApnd, ctx); - if( pParse->oom ){ - sqlite3_result_error_nomem(ctx); - goto jsonSetDone; - }else if( pParse->nErr ){ - goto jsonSetDone; - }else if( pNode && (bApnd || bIsSet) ){ - jsonReplaceNode(ctx, pParse, (u32)(pNode - pParse->aNode), argv[i+1]); - } - } - jsonDebugPrintParse(pParse); - jsonReturnJson(pParse, pParse->aNode, ctx, 1); - -jsonSetDone: - /* no cleanup required */; + jsonInsertIntoBlob(ctx, argc, argv, bIsSet ? JEDIT_SET : JEDIT_INS); } /* @@ -204216,27 +209184,127 @@ static void jsonTypeFunc( sqlite3_value **argv ){ JsonParse *p; /* The parse */ - const char *zPath; - JsonNode *pNode; + const char *zPath = 0; + u32 i; - p = jsonParseCached(ctx, argv[0], ctx, 0); + p = jsonParseFuncArg(ctx, argv[0], 0); if( p==0 ) return; if( argc==2 ){ zPath = (const char*)sqlite3_value_text(argv[1]); - pNode = jsonLookup(p, zPath, 0, ctx); + if( zPath==0 ) goto json_type_done; + if( zPath[0]!='$' ){ + jsonBadPathError(ctx, zPath); + goto json_type_done; + } + i = jsonLookupStep(p, 0, zPath+1, 0); + if( JSON_LOOKUP_ISERROR(i) ){ + if( i==JSON_LOOKUP_NOTFOUND ){ + /* no-op */ + }else if( i==JSON_LOOKUP_PATHERROR ){ + jsonBadPathError(ctx, zPath); + }else{ + sqlite3_result_error(ctx, "malformed JSON", -1); + } + goto json_type_done; + } }else{ - pNode = p->aNode; + i = 0; } - if( pNode ){ - sqlite3_result_text(ctx, jsonType[pNode->eType], -1, SQLITE_STATIC); + sqlite3_result_text(ctx, jsonbType[p->aBlob[i]&0x0f], -1, SQLITE_STATIC); +json_type_done: + jsonParseFree(p); +} + +/* +** json_pretty(JSON) +** json_pretty(JSON, INDENT) +** +** Return text that is a pretty-printed rendering of the input JSON. +** If the argument is not valid JSON, return NULL. +** +** The INDENT argument is text that is used for indentation. If omitted, +** it defaults to four spaces (the same as PostgreSQL). +*/ +static void jsonPrettyFunc( + sqlite3_context *ctx, + int argc, + sqlite3_value **argv +){ + JsonString s; /* The output string */ + JsonPretty x; /* Pretty printing context */ + + memset(&x, 0, sizeof(x)); + x.pParse = jsonParseFuncArg(ctx, argv[0], 0); + if( x.pParse==0 ) return; + x.pOut = &s; + jsonStringInit(&s, ctx); + if( argc==1 || (x.zIndent = (const char*)sqlite3_value_text(argv[1]))==0 ){ + x.zIndent = " "; + x.szIndent = 4; + }else{ + x.szIndent = (u32)strlen(x.zIndent); } + jsonTranslateBlobToPrettyText(&x, 0); + jsonReturnString(&s, 0, 0); + jsonParseFree(x.pParse); } /* ** json_valid(JSON) -** -** Return 1 if JSON is a well-formed canonical JSON string according -** to RFC-7159. Return 0 otherwise. +** json_valid(JSON, FLAGS) +** +** Check the JSON argument to see if it is well-formed. The FLAGS argument +** encodes the various constraints on what is meant by "well-formed": +** +** 0x01 Canonical RFC-8259 JSON text +** 0x02 JSON text with optional JSON-5 extensions +** 0x04 Superficially appears to be JSONB +** 0x08 Strictly well-formed JSONB +** +** If the FLAGS argument is omitted, it defaults to 1. Useful values for +** FLAGS include: +** +** 1 Strict canonical JSON text +** 2 JSON text perhaps with JSON-5 extensions +** 4 Superficially appears to be JSONB +** 5 Canonical JSON text or superficial JSONB +** 6 JSON-5 text or superficial JSONB +** 8 Strict JSONB +** 9 Canonical JSON text or strict JSONB +** 10 JSON-5 text or strict JSONB +** +** Other flag combinations are redundant. For example, every canonical +** JSON text is also well-formed JSON-5 text, so FLAG values 2 and 3 +** are the same. Similarly, any input that passes a strict JSONB validation +** will also pass the superficial validation so 12 through 15 are the same +** as 8 through 11 respectively. +** +** This routine runs in linear time to validate text and when doing strict +** JSONB validation. Superficial JSONB validation is constant time, +** assuming the BLOB is already in memory. The performance advantage +** of superficial JSONB validation is why that option is provided. +** Application developers can choose to do fast superficial validation or +** slower strict validation, according to their specific needs. +** +** Only the lower four bits of the FLAGS argument are currently used. +** Higher bits are reserved for future expansion. To facilitate +** compatibility, the current implementation raises an error if any bit +** in FLAGS is set other than the lower four bits. +** +** The original circa 2015 implementation of the JSON routines in +** SQLite only supported canonical RFC-8259 JSON text and the json_valid() +** function only accepted one argument. That is why the default value +** for the FLAGS argument is 1, since FLAGS=1 causes this routine to only +** recognize canonical RFC-8259 JSON text as valid. The extra FLAGS +** argument was added when the JSON routines were extended to support +** JSON5-like extensions and binary JSONB stored in BLOBs. +** +** Return Values: +** +** * Raise an error if FLAGS is outside the range of 1 to 15. +** * Return NULL if the input is NULL +** * Return 1 if the input is well-formed. +** * Return 0 if the input is not well-formed. */ static void jsonValidFunc( sqlite3_context *ctx, @@ -204244,79 +209312,128 @@ static void jsonValidFunc( sqlite3_value **argv ){ JsonParse *p; /* The parse */ - UNUSED_PARAMETER(argc); - if( sqlite3_value_type(argv[0])==SQLITE_NULL ){ + u8 flags = 1; + u8 res = 0; + if( argc==2 ){ + i64 f = sqlite3_value_int64(argv[1]); + if( f<1 || f>15 ){ + sqlite3_result_error(ctx, "FLAGS parameter to json_valid() must be" + " between 1 and 15", -1); + return; + } + flags = f & 0x0f; + } + switch( sqlite3_value_type(argv[0]) ){ + case SQLITE_NULL: { #ifdef SQLITE_LEGACY_JSON_VALID - /* Incorrect legacy behavior was to return FALSE for a NULL input */ - sqlite3_result_int(ctx, 0); + /* Incorrect legacy behavior was to return FALSE for a NULL input */ + sqlite3_result_int(ctx, 0); #endif - return; - } - p = jsonParseCached(ctx, argv[0], 0, 0); - if( p==0 || p->oom ){ - sqlite3_result_error_nomem(ctx); - sqlite3_free(p); - }else{ - sqlite3_result_int(ctx, p->nErr==0 && (p->hasNonstd==0 || p->useMod)); - if( p->nErr ) jsonParseFree(p); + return; + } + case SQLITE_BLOB: { + if( jsonFuncArgMightBeBinary(argv[0]) ){ + if( flags & 0x04 ){ + /* Superficial checking only - accomplished by the + ** jsonFuncArgMightBeBinary() call above. */ + res = 1; + }else if( flags & 0x08 ){ + /* Strict checking. Check by translating BLOB->TEXT->BLOB. If + ** no errors occur, call that a "strict check". */ + JsonParse px; + u32 iErr; + memset(&px, 0, sizeof(px)); + px.aBlob = (u8*)sqlite3_value_blob(argv[0]); + px.nBlob = sqlite3_value_bytes(argv[0]); + iErr = jsonbValidityCheck(&px, 0, px.nBlob, 1); + res = iErr==0; + } + break; + } + /* Fall through into interpreting the input as text. See note + ** above at tag-20240123-a. */ + /* no break */ deliberate_fall_through + } + default: { + JsonParse px; + if( (flags & 0x3)==0 ) break; + memset(&px, 0, sizeof(px)); + + p = jsonParseFuncArg(ctx, argv[0], JSON_KEEPERROR); + if( p ){ + if( p->oom ){ + sqlite3_result_error_nomem(ctx); + }else if( p->nErr ){ + /* no-op */ + }else if( (flags & 0x02)!=0 || p->hasNonstd==0 ){ + res = 1; + } + jsonParseFree(p); + }else{ + sqlite3_result_error_nomem(ctx); + } + break; + } } + sqlite3_result_int(ctx, res); } /* ** json_error_position(JSON) ** -** If the argument is not an interpretable JSON string, then return the 1-based -** character position at which the parser first recognized that the input -** was in error. The left-most character is 1. If the string is valid -** JSON, then return 0. -** -** Note that json_valid() is only true for strictly conforming canonical JSON. -** But this routine returns zero if the input contains extension. Thus: -** -** (1) If the input X is strictly conforming canonical JSON: -** -** json_valid(X) returns true -** json_error_position(X) returns 0 +** If the argument is NULL, return NULL ** -** (2) If the input X is JSON but it includes extension (such as JSON5) that -** are not part of RFC-8259: +** If the argument is BLOB, do a full validity check and return non-zero +** if the check fails. The return value is the approximate 1-based offset +** to the byte of the element that contains the first error. ** -** json_valid(X) returns false -** json_error_position(X) return 0 -** -** (3) If the input X cannot be interpreted as JSON even taking extensions -** into account: -** -** json_valid(X) return false -** json_error_position(X) returns 1 or more +** Otherwise interpret the argument is TEXT (even if it is numeric) and +** return the 1-based character position for where the parser first recognized +** that the input was not valid JSON, or return 0 if the input text looks +** ok. JSON-5 extensions are accepted. */ static void jsonErrorFunc( sqlite3_context *ctx, int argc, sqlite3_value **argv ){ - JsonParse *p; /* The parse */ + i64 iErrPos = 0; /* Error position to be returned */ + JsonParse s; + + assert( argc==1 ); UNUSED_PARAMETER(argc); - if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; - p = jsonParseCached(ctx, argv[0], 0, 0); - if( p==0 || p->oom ){ + memset(&s, 0, sizeof(s)); + s.db = sqlite3_context_db_handle(ctx); + if( jsonFuncArgMightBeBinary(argv[0]) ){ + s.aBlob = (u8*)sqlite3_value_blob(argv[0]); + s.nBlob = sqlite3_value_bytes(argv[0]); + iErrPos = (i64)jsonbValidityCheck(&s, 0, s.nBlob, 1); + }else{ + s.zJson = (char*)sqlite3_value_text(argv[0]); + if( s.zJson==0 ) return; /* NULL input or OOM */ + s.nJson = sqlite3_value_bytes(argv[0]); + if( jsonConvertTextToBlob(&s,0) ){ + if( s.oom ){ + iErrPos = -1; + }else{ + /* Convert byte-offset s.iErr into a character offset */ + u32 k; + assert( s.zJson!=0 ); /* Because s.oom is false */ + for(k=0; knErr==0 ){ - sqlite3_result_int(ctx, 0); }else{ - int n = 1; - u32 i; - const char *z = (const char*)sqlite3_value_text(argv[0]); - for(i=0; iiErr && ALWAYS(z[i]); i++){ - if( (z[i]&0xc0)!=0x80 ) n++; - } - sqlite3_result_int(ctx, n); - jsonParseFree(p); + sqlite3_result_int64(ctx, iErrPos); } } - /**************************************************************************** ** Aggregate SQL function implementations ****************************************************************************/ @@ -204335,32 +209452,42 @@ static void jsonArrayStep( pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr)); if( pStr ){ if( pStr->zBuf==0 ){ - jsonInit(pStr, ctx); + jsonStringInit(pStr, ctx); jsonAppendChar(pStr, '['); }else if( pStr->nUsed>1 ){ jsonAppendChar(pStr, ','); } pStr->pCtx = ctx; - jsonAppendValue(pStr, argv[0]); + jsonAppendSqlValue(pStr, argv[0]); } } static void jsonArrayCompute(sqlite3_context *ctx, int isFinal){ JsonString *pStr; pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0); if( pStr ){ + int flags; pStr->pCtx = ctx; jsonAppendChar(pStr, ']'); - if( pStr->bErr ){ - if( pStr->bErr==1 ) sqlite3_result_error_nomem(ctx); - assert( pStr->bStatic ); + flags = SQLITE_PTR_TO_INT(sqlite3_user_data(ctx)); + if( pStr->eErr ){ + jsonReturnString(pStr, 0, 0); + return; + }else if( flags & JSON_BLOB ){ + jsonReturnStringAsBlob(pStr); + if( isFinal ){ + if( !pStr->bStatic ) sqlite3RCStrUnref(pStr->zBuf); + }else{ + jsonStringTrimOneChar(pStr); + } + return; }else if( isFinal ){ sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, pStr->bStatic ? SQLITE_TRANSIENT : - (void(*)(void*))sqlite3RCStrUnref); + sqlite3RCStrUnref); pStr->bStatic = 1; }else{ sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, SQLITE_TRANSIENT); - pStr->nUsed--; + jsonStringTrimOneChar(pStr); } }else{ sqlite3_result_text(ctx, "[]", 2, SQLITE_STATIC); @@ -204441,35 +209568,46 @@ static void jsonObjectStep( pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr)); if( pStr ){ if( pStr->zBuf==0 ){ - jsonInit(pStr, ctx); + jsonStringInit(pStr, ctx); jsonAppendChar(pStr, '{'); }else if( pStr->nUsed>1 ){ jsonAppendChar(pStr, ','); } pStr->pCtx = ctx; z = (const char*)sqlite3_value_text(argv[0]); - n = (u32)sqlite3_value_bytes(argv[0]); + n = sqlite3Strlen30(z); jsonAppendString(pStr, z, n); jsonAppendChar(pStr, ':'); - jsonAppendValue(pStr, argv[1]); + jsonAppendSqlValue(pStr, argv[1]); } } static void jsonObjectCompute(sqlite3_context *ctx, int isFinal){ JsonString *pStr; pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0); if( pStr ){ + int flags; jsonAppendChar(pStr, '}'); - if( pStr->bErr ){ - if( pStr->bErr==1 ) sqlite3_result_error_nomem(ctx); - assert( pStr->bStatic ); + pStr->pCtx = ctx; + flags = SQLITE_PTR_TO_INT(sqlite3_user_data(ctx)); + if( pStr->eErr ){ + jsonReturnString(pStr, 0, 0); + return; + }else if( flags & JSON_BLOB ){ + jsonReturnStringAsBlob(pStr); + if( isFinal ){ + if( !pStr->bStatic ) sqlite3RCStrUnref(pStr->zBuf); + }else{ + jsonStringTrimOneChar(pStr); + } + return; }else if( isFinal ){ sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, pStr->bStatic ? SQLITE_TRANSIENT : - (void(*)(void*))sqlite3RCStrUnref); + sqlite3RCStrUnref); pStr->bStatic = 1; }else{ sqlite3_result_text(ctx, pStr->zBuf, (int)pStr->nUsed, SQLITE_TRANSIENT); - pStr->nUsed--; + jsonStringTrimOneChar(pStr); } }else{ sqlite3_result_text(ctx, "{}", 2, SQLITE_STATIC); @@ -204489,19 +209627,37 @@ static void jsonObjectFinal(sqlite3_context *ctx){ /**************************************************************************** ** The json_each virtual table ****************************************************************************/ +typedef struct JsonParent JsonParent; +struct JsonParent { + u32 iHead; /* Start of object or array */ + u32 iValue; /* Start of the value */ + u32 iEnd; /* First byte past the end */ + u32 nPath; /* Length of path */ + i64 iKey; /* Key for JSONB_ARRAY */ +}; + typedef struct JsonEachCursor JsonEachCursor; struct JsonEachCursor { sqlite3_vtab_cursor base; /* Base class - must be first */ u32 iRowid; /* The rowid */ - u32 iBegin; /* The first node of the scan */ - u32 i; /* Index in sParse.aNode[] of current row */ + u32 i; /* Index in sParse.aBlob[] of current row */ u32 iEnd; /* EOF when i equals or exceeds this value */ - u8 eType; /* Type of top-level element */ + u32 nRoot; /* Size of the root path in bytes */ + u8 eType; /* Type of the container for element i */ u8 bRecursive; /* True for json_tree(). False for json_each() */ - char *zJson; /* Input JSON */ - char *zRoot; /* Path by which to filter zJson */ + u32 nParent; /* Current nesting depth */ + u32 nParentAlloc; /* Space allocated for aParent[] */ + JsonParent *aParent; /* Parent elements of i */ + sqlite3 *db; /* Database connection */ + JsonString path; /* Current path */ JsonParse sParse; /* Parse of the input JSON */ }; +typedef struct JsonEachConnection JsonEachConnection; +struct JsonEachConnection { + sqlite3_vtab base; /* Base class - must be first */ + sqlite3 *db; /* Database connection */ +}; + /* Constructor for the json_each virtual table */ static int jsonEachConnect( @@ -204511,7 +209667,7 @@ static int jsonEachConnect( sqlite3_vtab **ppVtab, char **pzErr ){ - sqlite3_vtab *pNew; + JsonEachConnection *pNew; int rc; /* Column numbers */ @@ -204537,28 +209693,32 @@ static int jsonEachConnect( "CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path," "json HIDDEN,root HIDDEN)"); if( rc==SQLITE_OK ){ - pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) ); + pNew = (JsonEachConnection*)sqlite3DbMallocZero(db, sizeof(*pNew)); + *ppVtab = (sqlite3_vtab*)pNew; if( pNew==0 ) return SQLITE_NOMEM; - memset(pNew, 0, sizeof(*pNew)); sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS); + pNew->db = db; } return rc; } /* destructor for json_each virtual table */ static int jsonEachDisconnect(sqlite3_vtab *pVtab){ - sqlite3_free(pVtab); + JsonEachConnection *p = (JsonEachConnection*)pVtab; + sqlite3DbFree(p->db, pVtab); return SQLITE_OK; } /* constructor for a JsonEachCursor object for json_each(). */ static int jsonEachOpenEach(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){ + JsonEachConnection *pVtab = (JsonEachConnection*)p; JsonEachCursor *pCur; UNUSED_PARAMETER(p); - pCur = sqlite3_malloc( sizeof(*pCur) ); + pCur = sqlite3DbMallocZero(pVtab->db, sizeof(*pCur)); if( pCur==0 ) return SQLITE_NOMEM; - memset(pCur, 0, sizeof(*pCur)); + pCur->db = pVtab->db; + jsonStringZero(&pCur->path); *ppCursor = &pCur->base; return SQLITE_OK; } @@ -204576,21 +209736,24 @@ static int jsonEachOpenTree(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){ /* Reset a JsonEachCursor back to its original state. Free any memory ** held. */ static void jsonEachCursorReset(JsonEachCursor *p){ - sqlite3_free(p->zRoot); jsonParseReset(&p->sParse); + jsonStringReset(&p->path); + sqlite3DbFree(p->db, p->aParent); p->iRowid = 0; p->i = 0; + p->aParent = 0; + p->nParent = 0; + p->nParentAlloc = 0; p->iEnd = 0; p->eType = 0; - p->zJson = 0; - p->zRoot = 0; } /* Destructor for a jsonEachCursor object */ static int jsonEachClose(sqlite3_vtab_cursor *cur){ JsonEachCursor *p = (JsonEachCursor*)cur; jsonEachCursorReset(p); - sqlite3_free(cur); + + sqlite3DbFree(p->db, cur); return SQLITE_OK; } @@ -204601,200 +209764,233 @@ static int jsonEachEof(sqlite3_vtab_cursor *cur){ return p->i >= p->iEnd; } -/* Advance the cursor to the next element for json_tree() */ -static int jsonEachNext(sqlite3_vtab_cursor *cur){ - JsonEachCursor *p = (JsonEachCursor*)cur; - if( p->bRecursive ){ - if( p->sParse.aNode[p->i].jnFlags & JNODE_LABEL ) p->i++; - p->i++; - p->iRowid++; - if( p->iiEnd ){ - u32 iUp = p->sParse.aUp[p->i]; - JsonNode *pUp = &p->sParse.aNode[iUp]; - p->eType = pUp->eType; - if( pUp->eType==JSON_ARRAY ){ - assert( pUp->eU==0 || pUp->eU==3 ); - testcase( pUp->eU==3 ); - VVA( pUp->eU = 3 ); - if( iUp==p->i-1 ){ - pUp->u.iKey = 0; - }else{ - pUp->u.iKey++; +/* +** If the cursor is currently pointing at the label of a object entry, +** then return the index of the value. For all other cases, return the +** current pointer position, which is the value. +*/ +static int jsonSkipLabel(JsonEachCursor *p){ + if( p->eType==JSONB_OBJECT ){ + u32 sz = 0; + u32 n = jsonbPayloadSize(&p->sParse, p->i, &sz); + return p->i + n + sz; + }else{ + return p->i; + } +} + +/* +** Append the path name for the current element. +*/ +static void jsonAppendPathName(JsonEachCursor *p){ + assert( p->nParent>0 ); + assert( p->eType==JSONB_ARRAY || p->eType==JSONB_OBJECT ); + if( p->eType==JSONB_ARRAY ){ + jsonPrintf(30, &p->path, "[%lld]", p->aParent[p->nParent-1].iKey); + }else{ + u32 n, sz = 0, k, i; + const char *z; + int needQuote = 0; + n = jsonbPayloadSize(&p->sParse, p->i, &sz); + k = p->i + n; + z = (const char*)&p->sParse.aBlob[k]; + if( sz==0 || !sqlite3Isalpha(z[0]) ){ + needQuote = 1; + }else{ + for(i=0; ieType ){ - case JSON_ARRAY: { - p->i += jsonNodeSize(&p->sParse.aNode[p->i]); - p->iRowid++; - break; - } - case JSON_OBJECT: { - p->i += 1 + jsonNodeSize(&p->sParse.aNode[p->i+1]); - p->iRowid++; - break; - } - default: { - p->i = p->iEnd; - break; - } + if( needQuote ){ + jsonPrintf(sz+4,&p->path,".\"%.*s\"", sz, z); + }else{ + jsonPrintf(sz+2,&p->path,".%.*s", sz, z); } } - return SQLITE_OK; } -/* Append an object label to the JSON Path being constructed -** in pStr. -*/ -static void jsonAppendObjectPathElement( - JsonString *pStr, - JsonNode *pNode -){ - int jj, nn; - const char *z; - assert( pNode->eType==JSON_STRING ); - assert( pNode->jnFlags & JNODE_LABEL ); - assert( pNode->eU==1 ); - z = pNode->u.zJContent; - nn = pNode->n; - if( (pNode->jnFlags & JNODE_RAW)==0 ){ - assert( nn>=2 ); - assert( z[0]=='"' || z[0]=='\'' ); - assert( z[nn-1]=='"' || z[0]=='\'' ); - if( nn>2 && sqlite3Isalpha(z[1]) ){ - for(jj=2; jjbRecursive ){ + u8 x; + u8 levelChange = 0; + u32 n, sz = 0; + u32 i = jsonSkipLabel(p); + x = p->sParse.aBlob[i] & 0x0f; + n = jsonbPayloadSize(&p->sParse, i, &sz); + if( x==JSONB_OBJECT || x==JSONB_ARRAY ){ + JsonParent *pParent; + if( p->nParent>=p->nParentAlloc ){ + JsonParent *pNew; + u64 nNew; + nNew = p->nParentAlloc*2 + 3; + pNew = sqlite3DbRealloc(p->db, p->aParent, sizeof(JsonParent)*nNew); + if( pNew==0 ) return SQLITE_NOMEM; + p->nParentAlloc = (u32)nNew; + p->aParent = pNew; + } + levelChange = 1; + pParent = &p->aParent[p->nParent]; + pParent->iHead = p->i; + pParent->iValue = i; + pParent->iEnd = i + n + sz; + pParent->iKey = -1; + pParent->nPath = (u32)p->path.nUsed; + if( p->eType && p->nParent ){ + jsonAppendPathName(p); + if( p->path.eErr ) rc = SQLITE_NOMEM; + } + p->nParent++; + p->i = i + n; + }else{ + p->i = i + n + sz; + } + while( p->nParent>0 && p->i >= p->aParent[p->nParent-1].iEnd ){ + p->nParent--; + p->path.nUsed = p->aParent[p->nParent].nPath; + levelChange = 1; + } + if( levelChange ){ + if( p->nParent>0 ){ + JsonParent *pParent = &p->aParent[p->nParent-1]; + u32 iVal = pParent->iValue; + p->eType = p->sParse.aBlob[iVal] & 0x0f; + }else{ + p->eType = 0; } } + }else{ + u32 n, sz = 0; + u32 i = jsonSkipLabel(p); + n = jsonbPayloadSize(&p->sParse, i, &sz); + p->i = i + n + sz; + } + if( p->eType==JSONB_ARRAY && p->nParent ){ + p->aParent[p->nParent-1].iKey++; } - jsonPrintf(nn+2, pStr, ".%.*s", nn, z); + p->iRowid++; + return rc; } -/* Append the name of the path for element i to pStr +/* Length of the path for rowid==0 in bRecursive mode. */ -static void jsonEachComputePath( - JsonEachCursor *p, /* The cursor */ - JsonString *pStr, /* Write the path here */ - u32 i /* Path to this element */ -){ - JsonNode *pNode, *pUp; - u32 iUp; - if( i==0 ){ - jsonAppendChar(pStr, '$'); - return; - } - iUp = p->sParse.aUp[i]; - jsonEachComputePath(p, pStr, iUp); - pNode = &p->sParse.aNode[i]; - pUp = &p->sParse.aNode[iUp]; - if( pUp->eType==JSON_ARRAY ){ - assert( pUp->eU==3 || (pUp->eU==0 && pUp->u.iKey==0) ); - testcase( pUp->eU==0 ); - jsonPrintf(30, pStr, "[%d]", pUp->u.iKey); - }else{ - assert( pUp->eType==JSON_OBJECT ); - if( (pNode->jnFlags & JNODE_LABEL)==0 ) pNode--; - jsonAppendObjectPathElement(pStr, pNode); +static int jsonEachPathLength(JsonEachCursor *p){ + u32 n = p->path.nUsed; + char *z = p->path.zBuf; + if( p->iRowid==0 && p->bRecursive && n>=2 ){ + while( n>1 ){ + n--; + if( z[n]=='[' || z[n]=='.' ){ + u32 x, sz = 0; + char cSaved = z[n]; + z[n] = 0; + assert( p->sParse.eEdit==0 ); + x = jsonLookupStep(&p->sParse, 0, z+1, 0); + z[n] = cSaved; + if( JSON_LOOKUP_ISERROR(x) ) continue; + if( x + jsonbPayloadSize(&p->sParse, x, &sz) == p->i ) break; + } + } } + return n; } /* Return the value of a column */ static int jsonEachColumn( sqlite3_vtab_cursor *cur, /* The cursor */ sqlite3_context *ctx, /* First argument to sqlite3_result_...() */ - int i /* Which column to return */ + int iColumn /* Which column to return */ ){ JsonEachCursor *p = (JsonEachCursor*)cur; - JsonNode *pThis = &p->sParse.aNode[p->i]; - switch( i ){ + switch( iColumn ){ case JEACH_KEY: { - if( p->i==0 ) break; - if( p->eType==JSON_OBJECT ){ - jsonReturn(&p->sParse, pThis, ctx); - }else if( p->eType==JSON_ARRAY ){ - u32 iKey; - if( p->bRecursive ){ - if( p->iRowid==0 ) break; - assert( p->sParse.aNode[p->sParse.aUp[p->i]].eU==3 ); - iKey = p->sParse.aNode[p->sParse.aUp[p->i]].u.iKey; + if( p->nParent==0 ){ + u32 n, j; + if( p->nRoot==1 ) break; + j = jsonEachPathLength(p); + n = p->nRoot - j; + if( n==0 ){ + break; + }else if( p->path.zBuf[j]=='[' ){ + i64 x; + sqlite3Atoi64(&p->path.zBuf[j+1], &x, n-1, SQLITE_UTF8); + sqlite3_result_int64(ctx, x); + }else if( p->path.zBuf[j+1]=='"' ){ + sqlite3_result_text(ctx, &p->path.zBuf[j+2], n-3, SQLITE_TRANSIENT); }else{ - iKey = p->iRowid; + sqlite3_result_text(ctx, &p->path.zBuf[j+1], n-1, SQLITE_TRANSIENT); } - sqlite3_result_int64(ctx, (sqlite3_int64)iKey); + break; + } + if( p->eType==JSONB_OBJECT ){ + jsonReturnFromBlob(&p->sParse, p->i, ctx, 1); + }else{ + assert( p->eType==JSONB_ARRAY ); + sqlite3_result_int64(ctx, p->aParent[p->nParent-1].iKey); } break; } case JEACH_VALUE: { - if( pThis->jnFlags & JNODE_LABEL ) pThis++; - jsonReturn(&p->sParse, pThis, ctx); + u32 i = jsonSkipLabel(p); + jsonReturnFromBlob(&p->sParse, i, ctx, 1); + if( (p->sParse.aBlob[i] & 0x0f)>=JSONB_ARRAY ){ + sqlite3_result_subtype(ctx, JSON_SUBTYPE); + } break; } case JEACH_TYPE: { - if( pThis->jnFlags & JNODE_LABEL ) pThis++; - sqlite3_result_text(ctx, jsonType[pThis->eType], -1, SQLITE_STATIC); + u32 i = jsonSkipLabel(p); + u8 eType = p->sParse.aBlob[i] & 0x0f; + sqlite3_result_text(ctx, jsonbType[eType], -1, SQLITE_STATIC); break; } case JEACH_ATOM: { - if( pThis->jnFlags & JNODE_LABEL ) pThis++; - if( pThis->eType>=JSON_ARRAY ) break; - jsonReturn(&p->sParse, pThis, ctx); + u32 i = jsonSkipLabel(p); + if( (p->sParse.aBlob[i] & 0x0f)sParse, i, ctx, 1); + } break; } case JEACH_ID: { - sqlite3_result_int64(ctx, - (sqlite3_int64)p->i + ((pThis->jnFlags & JNODE_LABEL)!=0)); + sqlite3_result_int64(ctx, (sqlite3_int64)p->i); break; } case JEACH_PARENT: { - if( p->i>p->iBegin && p->bRecursive ){ - sqlite3_result_int64(ctx, (sqlite3_int64)p->sParse.aUp[p->i]); + if( p->nParent>0 && p->bRecursive ){ + sqlite3_result_int64(ctx, p->aParent[p->nParent-1].iHead); } break; } case JEACH_FULLKEY: { - JsonString x; - jsonInit(&x, ctx); - if( p->bRecursive ){ - jsonEachComputePath(p, &x, p->i); - }else{ - if( p->zRoot ){ - jsonAppendRaw(&x, p->zRoot, (int)strlen(p->zRoot)); - }else{ - jsonAppendChar(&x, '$'); - } - if( p->eType==JSON_ARRAY ){ - jsonPrintf(30, &x, "[%d]", p->iRowid); - }else if( p->eType==JSON_OBJECT ){ - jsonAppendObjectPathElement(&x, pThis); - } - } - jsonResult(&x); + u64 nBase = p->path.nUsed; + if( p->nParent ) jsonAppendPathName(p); + sqlite3_result_text64(ctx, p->path.zBuf, p->path.nUsed, + SQLITE_TRANSIENT, SQLITE_UTF8); + p->path.nUsed = nBase; break; } case JEACH_PATH: { - if( p->bRecursive ){ - JsonString x; - jsonInit(&x, ctx); - jsonEachComputePath(p, &x, p->sParse.aUp[p->i]); - jsonResult(&x); - break; - } - /* For json_each() path and root are the same so fall through - ** into the root case */ - /* no break */ deliberate_fall_through + u32 n = jsonEachPathLength(p); + sqlite3_result_text64(ctx, p->path.zBuf, n, + SQLITE_TRANSIENT, SQLITE_UTF8); + break; } default: { - const char *zRoot = p->zRoot; - if( zRoot==0 ) zRoot = "$"; - sqlite3_result_text(ctx, zRoot, -1, SQLITE_STATIC); + sqlite3_result_text(ctx, p->path.zBuf, p->nRoot, SQLITE_STATIC); break; } case JEACH_JSON: { - assert( i==JEACH_JSON ); - sqlite3_result_text(ctx, p->sParse.zJson, -1, SQLITE_STATIC); + if( p->sParse.zJson==0 ){ + sqlite3_result_blob(ctx, p->sParse.aBlob, p->sParse.nBlob, + SQLITE_TRANSIENT); + }else{ + sqlite3_result_text(ctx, p->sParse.zJson, -1, SQLITE_TRANSIENT); + } break; } } @@ -204885,86 +210081,97 @@ static int jsonEachFilter( int argc, sqlite3_value **argv ){ JsonEachCursor *p = (JsonEachCursor*)cur; - const char *z; const char *zRoot = 0; - sqlite3_int64 n; + u32 i, n, sz; UNUSED_PARAMETER(idxStr); UNUSED_PARAMETER(argc); jsonEachCursorReset(p); if( idxNum==0 ) return SQLITE_OK; - z = (const char*)sqlite3_value_text(argv[0]); - if( z==0 ) return SQLITE_OK; memset(&p->sParse, 0, sizeof(p->sParse)); p->sParse.nJPRef = 1; - if( sqlite3ValueIsOfClass(argv[0], (void(*)(void*))sqlite3RCStrUnref) ){ - p->sParse.zJson = sqlite3RCStrRef((char*)z); - }else{ - n = sqlite3_value_bytes(argv[0]); - p->sParse.zJson = sqlite3RCStrNew( n+1 ); - if( p->sParse.zJson==0 ) return SQLITE_NOMEM; - memcpy(p->sParse.zJson, z, (size_t)n+1); - } - p->sParse.bJsonIsRCStr = 1; - p->zJson = p->sParse.zJson; - if( jsonParse(&p->sParse, 0) ){ - int rc = SQLITE_NOMEM; - if( p->sParse.oom==0 ){ - sqlite3_free(cur->pVtab->zErrMsg); - cur->pVtab->zErrMsg = sqlite3_mprintf("malformed JSON"); - if( cur->pVtab->zErrMsg ) rc = SQLITE_ERROR; + p->sParse.db = p->db; + if( jsonFuncArgMightBeBinary(argv[0]) ){ + p->sParse.nBlob = sqlite3_value_bytes(argv[0]); + p->sParse.aBlob = (u8*)sqlite3_value_blob(argv[0]); + }else{ + p->sParse.zJson = (char*)sqlite3_value_text(argv[0]); + p->sParse.nJson = sqlite3_value_bytes(argv[0]); + if( p->sParse.zJson==0 ){ + p->i = p->iEnd = 0; + return SQLITE_OK; } - jsonEachCursorReset(p); - return rc; - }else if( p->bRecursive && jsonParseFindParents(&p->sParse) ){ - jsonEachCursorReset(p); - return SQLITE_NOMEM; - }else{ - JsonNode *pNode = 0; - if( idxNum==3 ){ - const char *zErr = 0; - zRoot = (const char*)sqlite3_value_text(argv[1]); - if( zRoot==0 ) return SQLITE_OK; - n = sqlite3_value_bytes(argv[1]); - p->zRoot = sqlite3_malloc64( n+1 ); - if( p->zRoot==0 ) return SQLITE_NOMEM; - memcpy(p->zRoot, zRoot, (size_t)n+1); - if( zRoot[0]!='$' ){ - zErr = zRoot; - }else{ - pNode = jsonLookupStep(&p->sParse, 0, p->zRoot+1, 0, &zErr); + if( jsonConvertTextToBlob(&p->sParse, 0) ){ + if( p->sParse.oom ){ + return SQLITE_NOMEM; } - if( zErr ){ + goto json_each_malformed_input; + } + } + if( idxNum==3 ){ + zRoot = (const char*)sqlite3_value_text(argv[1]); + if( zRoot==0 ) return SQLITE_OK; + if( zRoot[0]!='$' ){ + sqlite3_free(cur->pVtab->zErrMsg); + cur->pVtab->zErrMsg = jsonBadPathError(0, zRoot); + jsonEachCursorReset(p); + return cur->pVtab->zErrMsg ? SQLITE_ERROR : SQLITE_NOMEM; + } + p->nRoot = sqlite3Strlen30(zRoot); + if( zRoot[1]==0 ){ + i = p->i = 0; + p->eType = 0; + }else{ + i = jsonLookupStep(&p->sParse, 0, zRoot+1, 0); + if( JSON_LOOKUP_ISERROR(i) ){ + if( i==JSON_LOOKUP_NOTFOUND ){ + p->i = 0; + p->eType = 0; + p->iEnd = 0; + return SQLITE_OK; + } sqlite3_free(cur->pVtab->zErrMsg); - cur->pVtab->zErrMsg = jsonPathSyntaxError(zErr); + cur->pVtab->zErrMsg = jsonBadPathError(0, zRoot); jsonEachCursorReset(p); return cur->pVtab->zErrMsg ? SQLITE_ERROR : SQLITE_NOMEM; - }else if( pNode==0 ){ - return SQLITE_OK; } - }else{ - pNode = p->sParse.aNode; - } - p->iBegin = p->i = (int)(pNode - p->sParse.aNode); - p->eType = pNode->eType; - if( p->eType>=JSON_ARRAY ){ - assert( pNode->eU==0 ); - VVA( pNode->eU = 3 ); - pNode->u.iKey = 0; - p->iEnd = p->i + pNode->n + 1; - if( p->bRecursive ){ - p->eType = p->sParse.aNode[p->sParse.aUp[p->i]].eType; - if( p->i>0 && (p->sParse.aNode[p->i-1].jnFlags & JNODE_LABEL)!=0 ){ - p->i--; - } + if( p->sParse.iLabel ){ + p->i = p->sParse.iLabel; + p->eType = JSONB_OBJECT; }else{ - p->i++; - } - }else{ - p->iEnd = p->i+1; - } + p->i = i; + p->eType = JSONB_ARRAY; + } + } + jsonAppendRaw(&p->path, zRoot, p->nRoot); + }else{ + i = p->i = 0; + p->eType = 0; + p->nRoot = 1; + jsonAppendRaw(&p->path, "$", 1); + } + p->nParent = 0; + n = jsonbPayloadSize(&p->sParse, i, &sz); + p->iEnd = i+n+sz; + if( (p->sParse.aBlob[i] & 0x0f)>=JSONB_ARRAY && !p->bRecursive ){ + p->i = i + n; + p->eType = p->sParse.aBlob[i] & 0x0f; + p->aParent = sqlite3DbMallocZero(p->db, sizeof(JsonParent)); + if( p->aParent==0 ) return SQLITE_NOMEM; + p->nParent = 1; + p->nParentAlloc = 1; + p->aParent[0].iKey = 0; + p->aParent[0].iEnd = p->iEnd; + p->aParent[0].iHead = p->i; + p->aParent[0].iValue = i; } return SQLITE_OK; + +json_each_malformed_input: + sqlite3_free(cur->pVtab->zErrMsg); + cur->pVtab->zErrMsg = sqlite3_mprintf("malformed JSON"); + jsonEachCursorReset(p); + return cur->pVtab->zErrMsg ? SQLITE_ERROR : SQLITE_NOMEM; } /* The methods of the json_each virtual table */ @@ -204992,7 +210199,8 @@ static sqlite3_module jsonEachModule = { 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; /* The methods of the json_tree virtual table. */ @@ -205020,7 +210228,8 @@ static sqlite3_module jsonTreeModule = { 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ #endif /* !defined(SQLITE_OMIT_JSON) */ @@ -205031,34 +210240,59 @@ static sqlite3_module jsonTreeModule = { SQLITE_PRIVATE void sqlite3RegisterJsonFunctions(void){ #ifndef SQLITE_OMIT_JSON static FuncDef aJsonFunc[] = { - JFUNCTION(json, 1, 0, jsonRemoveFunc), - JFUNCTION(json_array, -1, 0, jsonArrayFunc), - JFUNCTION(json_array_length, 1, 0, jsonArrayLengthFunc), - JFUNCTION(json_array_length, 2, 0, jsonArrayLengthFunc), - JFUNCTION(json_error_position,1, 0, jsonErrorFunc), - JFUNCTION(json_extract, -1, 0, jsonExtractFunc), - JFUNCTION(->, 2, JSON_JSON, jsonExtractFunc), - JFUNCTION(->>, 2, JSON_SQL, jsonExtractFunc), - JFUNCTION(json_insert, -1, 0, jsonSetFunc), - JFUNCTION(json_object, -1, 0, jsonObjectFunc), - JFUNCTION(json_patch, 2, 0, jsonPatchFunc), - JFUNCTION(json_quote, 1, 0, jsonQuoteFunc), - JFUNCTION(json_remove, -1, 0, jsonRemoveFunc), - JFUNCTION(json_replace, -1, 0, jsonReplaceFunc), - JFUNCTION(json_set, -1, JSON_ISSET, jsonSetFunc), - JFUNCTION(json_type, 1, 0, jsonTypeFunc), - JFUNCTION(json_type, 2, 0, jsonTypeFunc), - JFUNCTION(json_valid, 1, 0, jsonValidFunc), + /* sqlite3_result_subtype() ----, ,--- sqlite3_value_subtype() */ + /* | | */ + /* Uses cache ------, | | ,---- Returns JSONB */ + /* | | | | */ + /* Number of arguments ---, | | | | ,--- Flags */ + /* | | | | | | */ + JFUNCTION(json, 1,1,1, 0,0,0, jsonRemoveFunc), + JFUNCTION(jsonb, 1,1,0, 0,1,0, jsonRemoveFunc), + JFUNCTION(json_array, -1,0,1, 1,0,0, jsonArrayFunc), + JFUNCTION(jsonb_array, -1,0,1, 1,1,0, jsonArrayFunc), + JFUNCTION(json_array_length, 1,1,0, 0,0,0, jsonArrayLengthFunc), + JFUNCTION(json_array_length, 2,1,0, 0,0,0, jsonArrayLengthFunc), + JFUNCTION(json_error_position,1,1,0, 0,0,0, jsonErrorFunc), + JFUNCTION(json_extract, -1,1,1, 0,0,0, jsonExtractFunc), + JFUNCTION(jsonb_extract, -1,1,0, 0,1,0, jsonExtractFunc), + JFUNCTION(->, 2,1,1, 0,0,JSON_JSON, jsonExtractFunc), + JFUNCTION(->>, 2,1,0, 0,0,JSON_SQL, jsonExtractFunc), + JFUNCTION(json_insert, -1,1,1, 1,0,0, jsonSetFunc), + JFUNCTION(jsonb_insert, -1,1,0, 1,1,0, jsonSetFunc), + JFUNCTION(json_object, -1,0,1, 1,0,0, jsonObjectFunc), + JFUNCTION(jsonb_object, -1,0,1, 1,1,0, jsonObjectFunc), + JFUNCTION(json_patch, 2,1,1, 0,0,0, jsonPatchFunc), + JFUNCTION(jsonb_patch, 2,1,0, 0,1,0, jsonPatchFunc), + JFUNCTION(json_pretty, 1,1,0, 0,0,0, jsonPrettyFunc), + JFUNCTION(json_pretty, 2,1,0, 0,0,0, jsonPrettyFunc), + JFUNCTION(json_quote, 1,0,1, 1,0,0, jsonQuoteFunc), + JFUNCTION(json_remove, -1,1,1, 0,0,0, jsonRemoveFunc), + JFUNCTION(jsonb_remove, -1,1,0, 0,1,0, jsonRemoveFunc), + JFUNCTION(json_replace, -1,1,1, 1,0,0, jsonReplaceFunc), + JFUNCTION(jsonb_replace, -1,1,0, 1,1,0, jsonReplaceFunc), + JFUNCTION(json_set, -1,1,1, 1,0,JSON_ISSET, jsonSetFunc), + JFUNCTION(jsonb_set, -1,1,0, 1,1,JSON_ISSET, jsonSetFunc), + JFUNCTION(json_type, 1,1,0, 0,0,0, jsonTypeFunc), + JFUNCTION(json_type, 2,1,0, 0,0,0, jsonTypeFunc), + JFUNCTION(json_valid, 1,1,0, 0,0,0, jsonValidFunc), + JFUNCTION(json_valid, 2,1,0, 0,0,0, jsonValidFunc), #if SQLITE_DEBUG - JFUNCTION(json_parse, 1, 0, jsonParseFunc), - JFUNCTION(json_test1, 1, 0, jsonTest1Func), + JFUNCTION(json_parse, 1,1,0, 0,0,0, jsonParseFunc), #endif WAGGREGATE(json_group_array, 1, 0, 0, jsonArrayStep, jsonArrayFinal, jsonArrayValue, jsonGroupInverse, - SQLITE_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC), + SQLITE_SUBTYPE|SQLITE_RESULT_SUBTYPE|SQLITE_UTF8| + SQLITE_DETERMINISTIC), + WAGGREGATE(jsonb_group_array, 1, JSON_BLOB, 0, + jsonArrayStep, jsonArrayFinal, jsonArrayValue, jsonGroupInverse, + SQLITE_SUBTYPE|SQLITE_RESULT_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC), WAGGREGATE(json_group_object, 2, 0, 0, jsonObjectStep, jsonObjectFinal, jsonObjectValue, jsonGroupInverse, - SQLITE_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC) + SQLITE_SUBTYPE|SQLITE_RESULT_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC), + WAGGREGATE(jsonb_group_object,2, JSON_BLOB, 0, + jsonObjectStep, jsonObjectFinal, jsonObjectValue, jsonGroupInverse, + SQLITE_SUBTYPE|SQLITE_RESULT_SUBTYPE|SQLITE_UTF8| + SQLITE_DETERMINISTIC) }; sqlite3InsertBuiltinFuncs(aJsonFunc, ArraySize(aJsonFunc)); #endif @@ -205255,6 +210489,7 @@ struct Rtree { int iDepth; /* Current depth of the r-tree structure */ char *zDb; /* Name of database containing r-tree table */ char *zName; /* Name of r-tree table */ + char *zNodeName; /* Name of the %_node table */ u32 nBusy; /* Current number of users of this structure */ i64 nRowEst; /* Estimated number of rows in this table */ u32 nCursor; /* Number of open cursors */ @@ -205267,7 +210502,6 @@ struct Rtree { ** headed by the node (leaf nodes have RtreeNode.iNode==0). */ RtreeNode *pDeleted; - int iReinsertHeight; /* Height of sub-trees Reinsert() has run on */ /* Blob I/O on xxx_node */ sqlite3_blob *pNodeBlob; @@ -205564,15 +210798,20 @@ struct RtreeMatchArg { ** -DSQLITE_RUNTIME_BYTEORDER=1 is set, then byte-order is determined ** at run-time. */ -#ifndef SQLITE_BYTEORDER -# if defined(i386) || defined(__i386__) || defined(_M_IX86) || \ +#ifndef SQLITE_BYTEORDER /* Replicate changes at tag-20230904a */ +# if defined(__BYTE_ORDER__) && __BYTE_ORDER__==__ORDER_BIG_ENDIAN__ +# define SQLITE_BYTEORDER 4321 +# elif defined(__BYTE_ORDER__) && __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__ +# define SQLITE_BYTEORDER 1234 +# elif defined(__BIG_ENDIAN__) && __BIG_ENDIAN__==1 +# define SQLITE_BYTEORDER 4321 +# elif defined(i386) || defined(__i386__) || defined(_M_IX86) || \ defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) || \ defined(_M_AMD64) || defined(_M_ARM) || defined(__x86) || \ defined(__ARMEL__) || defined(__AARCH64EL__) || defined(_M_ARM64) -# define SQLITE_BYTEORDER 1234 -# elif defined(sparc) || defined(__ppc__) || \ - defined(__ARMEB__) || defined(__AARCH64EB__) -# define SQLITE_BYTEORDER 4321 +# define SQLITE_BYTEORDER 1234 +# elif defined(sparc) || defined(__ARMEB__) || defined(__AARCH64EB__) +# define SQLITE_BYTEORDER 4321 # else # define SQLITE_BYTEORDER 0 # endif @@ -205778,11 +211017,9 @@ static RtreeNode *nodeNew(Rtree *pRtree, RtreeNode *pParent){ ** Clear the Rtree.pNodeBlob object */ static void nodeBlobReset(Rtree *pRtree){ - if( pRtree->pNodeBlob && pRtree->inWrTrans==0 && pRtree->nCursor==0 ){ - sqlite3_blob *pBlob = pRtree->pNodeBlob; - pRtree->pNodeBlob = 0; - sqlite3_blob_close(pBlob); - } + sqlite3_blob *pBlob = pRtree->pNodeBlob; + pRtree->pNodeBlob = 0; + sqlite3_blob_close(pBlob); } /* @@ -205801,7 +211038,7 @@ static int nodeAcquire( ** increase its reference count and return it. */ if( (pNode = nodeHashLookup(pRtree, iNode))!=0 ){ - if( pParent && pParent!=pNode->pParent ){ + if( pParent && ALWAYS(pParent!=pNode->pParent) ){ RTREE_IS_CORRUPT(pRtree); return SQLITE_CORRUPT_VTAB; } @@ -205821,14 +211058,11 @@ static int nodeAcquire( } } if( pRtree->pNodeBlob==0 ){ - char *zTab = sqlite3_mprintf("%s_node", pRtree->zName); - if( zTab==0 ) return SQLITE_NOMEM; - rc = sqlite3_blob_open(pRtree->db, pRtree->zDb, zTab, "data", iNode, 0, + rc = sqlite3_blob_open(pRtree->db, pRtree->zDb, pRtree->zNodeName, + "data", iNode, 0, &pRtree->pNodeBlob); - sqlite3_free(zTab); } if( rc ){ - nodeBlobReset(pRtree); *ppNode = 0; /* If unable to open an sqlite3_blob on the desired row, that can only ** be because the shadow tables hold erroneous data. */ @@ -205888,6 +211122,7 @@ static int nodeAcquire( } *ppNode = pNode; }else{ + nodeBlobReset(pRtree); if( pNode ){ pRtree->nNodeRef--; sqlite3_free(pNode); @@ -206032,6 +211267,7 @@ static void nodeGetCoord( int iCoord, /* Which coordinate to extract */ RtreeCoord *pCoord /* OUT: Space to write result to */ ){ + assert( iCellzData[12 + pRtree->nBytesPerCell*iCell + 4*iCoord], pCoord); } @@ -206221,7 +211457,9 @@ static int rtreeClose(sqlite3_vtab_cursor *cur){ sqlite3_finalize(pCsr->pReadAux); sqlite3_free(pCsr); pRtree->nCursor--; - nodeBlobReset(pRtree); + if( pRtree->nCursor==0 && pRtree->inWrTrans==0 ){ + nodeBlobReset(pRtree); + } return SQLITE_OK; } @@ -206806,7 +212044,11 @@ static int rtreeRowid(sqlite3_vtab_cursor *pVtabCursor, sqlite_int64 *pRowid){ int rc = SQLITE_OK; RtreeNode *pNode = rtreeNodeOfFirstSearchPoint(pCsr, &rc); if( rc==SQLITE_OK && ALWAYS(p) ){ - *pRowid = nodeGetRowid(RTREE_OF_CURSOR(pCsr), pNode, p->iCell); + if( p->iCell>=NCELL(pNode) ){ + rc = SQLITE_ABORT; + }else{ + *pRowid = nodeGetRowid(RTREE_OF_CURSOR(pCsr), pNode, p->iCell); + } } return rc; } @@ -206824,6 +212066,7 @@ static int rtreeColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){ if( rc ) return rc; if( NEVER(p==0) ) return SQLITE_OK; + if( p->iCell>=NCELL(pNode) ) return SQLITE_ABORT; if( i==0 ){ sqlite3_result_int64(ctx, nodeGetRowid(pRtree, pNode, p->iCell)); }else if( i<=pRtree->nDim2 ){ @@ -206921,6 +212164,8 @@ static int deserializeGeometry(sqlite3_value *pValue, RtreeConstraint *pCons){ return SQLITE_OK; } +SQLITE_PRIVATE int sqlite3IntFloatCompare(i64,double); + /* ** Rtree virtual table module xFilter method. */ @@ -206950,7 +212195,8 @@ static int rtreeFilter( i64 iNode = 0; int eType = sqlite3_value_numeric_type(argv[0]); if( eType==SQLITE_INTEGER - || (eType==SQLITE_FLOAT && sqlite3_value_double(argv[0])==iRowid) + || (eType==SQLITE_FLOAT + && 0==sqlite3IntFloatCompare(iRowid,sqlite3_value_double(argv[0]))) ){ rc = findLeafNode(pRtree, iRowid, &pLeaf, &iNode); }else{ @@ -207166,8 +212412,12 @@ static int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ pIdxInfo->idxNum = 2; pIdxInfo->needToFreeIdxStr = 1; - if( iIdx>0 && 0==(pIdxInfo->idxStr = sqlite3_mprintf("%s", zIdxStr)) ){ - return SQLITE_NOMEM; + if( iIdx>0 ){ + pIdxInfo->idxStr = sqlite3_malloc( iIdx+1 ); + if( pIdxInfo->idxStr==0 ){ + return SQLITE_NOMEM; + } + memcpy(pIdxInfo->idxStr, zIdxStr, iIdx+1); } nRow = pRtree->nRowEst >> (iIdx/2); @@ -207246,31 +212496,22 @@ static void cellUnion(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){ */ static int cellContains(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){ int ii; - int isInt = (pRtree->eCoordType==RTREE_COORD_INT32); - for(ii=0; iinDim2; ii+=2){ - RtreeCoord *a1 = &p1->aCoord[ii]; - RtreeCoord *a2 = &p2->aCoord[ii]; - if( (!isInt && (a2[0].fa1[1].f)) - || ( isInt && (a2[0].ia1[1].i)) - ){ - return 0; + if( pRtree->eCoordType==RTREE_COORD_INT32 ){ + for(ii=0; iinDim2; ii+=2){ + RtreeCoord *a1 = &p1->aCoord[ii]; + RtreeCoord *a2 = &p2->aCoord[ii]; + if( a2[0].ia1[1].i ) return 0; + } + }else{ + for(ii=0; iinDim2; ii+=2){ + RtreeCoord *a1 = &p1->aCoord[ii]; + RtreeCoord *a2 = &p2->aCoord[ii]; + if( a2[0].fa1[1].f ) return 0; } } return 1; } -/* -** Return the amount cell p would grow by if it were unioned with pCell. -*/ -static RtreeDValue cellGrowth(Rtree *pRtree, RtreeCell *p, RtreeCell *pCell){ - RtreeDValue area; - RtreeCell cell; - memcpy(&cell, p, sizeof(RtreeCell)); - area = cellArea(pRtree, &cell); - cellUnion(pRtree, &cell, pCell); - return (cellArea(pRtree, &cell)-area); -} - static RtreeDValue cellOverlap( Rtree *pRtree, RtreeCell *p, @@ -207317,38 +212558,52 @@ static int ChooseLeaf( for(ii=0; rc==SQLITE_OK && ii<(pRtree->iDepth-iHeight); ii++){ int iCell; sqlite3_int64 iBest = 0; - + int bFound = 0; RtreeDValue fMinGrowth = RTREE_ZERO; RtreeDValue fMinArea = RTREE_ZERO; - int nCell = NCELL(pNode); - RtreeCell cell; RtreeNode *pChild = 0; - RtreeCell *aCell = 0; - - /* Select the child node which will be enlarged the least if pCell - ** is inserted into it. Resolve ties by choosing the entry with - ** the smallest area. + /* First check to see if there is are any cells in pNode that completely + ** contains pCell. If two or more cells in pNode completely contain pCell + ** then pick the smallest. */ for(iCell=0; iCell1 ){ - int iLeft = 0; - int iRight = 0; - - int nLeft = nIdx/2; - int nRight = nIdx-nLeft; - int *aLeft = aIdx; - int *aRight = &aIdx[nLeft]; - - SortByDistance(aLeft, nLeft, aDistance, aSpare); - SortByDistance(aRight, nRight, aDistance, aSpare); - - memcpy(aSpare, aLeft, sizeof(int)*nLeft); - aLeft = aSpare; - - while( iLeftnDim; iDim++){ - aCenterCoord[iDim] += DCOORD(aCell[ii].aCoord[iDim*2]); - aCenterCoord[iDim] += DCOORD(aCell[ii].aCoord[iDim*2+1]); - } - } - for(iDim=0; iDimnDim; iDim++){ - aCenterCoord[iDim] = (aCenterCoord[iDim]/(nCell*(RtreeDValue)2)); - } - - for(ii=0; iinDim; iDim++){ - RtreeDValue coord = (DCOORD(aCell[ii].aCoord[iDim*2+1]) - - DCOORD(aCell[ii].aCoord[iDim*2])); - aDistance[ii] += (coord-aCenterCoord[iDim])*(coord-aCenterCoord[iDim]); - } - } - - SortByDistance(aOrder, nCell, aDistance, aSpare); - nodeZero(pRtree, pNode); - - for(ii=0; rc==SQLITE_OK && ii<(nCell-(RTREE_MINCELLS(pRtree)+1)); ii++){ - RtreeCell *p = &aCell[aOrder[ii]]; - nodeInsertCell(pRtree, pNode, p); - if( p->iRowid==pCell->iRowid ){ - if( iHeight==0 ){ - rc = rowidWrite(pRtree, p->iRowid, pNode->iNode); - }else{ - rc = parentWrite(pRtree, p->iRowid, pNode->iNode); - } - } - } - if( rc==SQLITE_OK ){ - rc = fixBoundingBox(pRtree, pNode); - } - for(; rc==SQLITE_OK && iiiNode currently contains - ** the height of the sub-tree headed by the cell. - */ - RtreeNode *pInsert; - RtreeCell *p = &aCell[aOrder[ii]]; - rc = ChooseLeaf(pRtree, p, iHeight, &pInsert); - if( rc==SQLITE_OK ){ - int rc2; - rc = rtreeInsertCell(pRtree, pInsert, p, iHeight); - rc2 = nodeRelease(pRtree, pInsert); - if( rc==SQLITE_OK ){ - rc = rc2; - } - } - } - - sqlite3_free(aCell); - return rc; -} - /* ** Insert cell pCell into node pNode. Node pNode is the head of a ** subtree iHeight high (leaf nodes have iHeight==0). @@ -208097,12 +213180,7 @@ static int rtreeInsertCell( } } if( nodeInsertCell(pRtree, pNode, pCell) ){ - if( iHeight<=pRtree->iReinsertHeight || pNode->iNode==1){ - rc = SplitNode(pRtree, pNode, pCell, iHeight); - }else{ - pRtree->iReinsertHeight = iHeight; - rc = Reinsert(pRtree, pNode, pCell, iHeight); - } + rc = SplitNode(pRtree, pNode, pCell, iHeight); }else{ rc = AdjustTree(pRtree, pNode, pCell); if( ALWAYS(rc==SQLITE_OK) ){ @@ -208445,7 +213523,6 @@ static int rtreeUpdate( } if( rc==SQLITE_OK ){ int rc2; - pRtree->iReinsertHeight = -1; rc = rtreeInsertCell(pRtree, pLeaf, &cell, 0); rc2 = nodeRelease(pRtree, pLeaf); if( rc==SQLITE_OK ){ @@ -208475,7 +213552,7 @@ static int rtreeUpdate( static int rtreeBeginTransaction(sqlite3_vtab *pVtab){ Rtree *pRtree = (Rtree *)pVtab; assert( pRtree->inWrTrans==0 ); - pRtree->inWrTrans++; + pRtree->inWrTrans = 1; return SQLITE_OK; } @@ -208489,6 +213566,9 @@ static int rtreeEndTransaction(sqlite3_vtab *pVtab){ nodeBlobReset(pRtree); return SQLITE_OK; } +static int rtreeRollback(sqlite3_vtab *pVtab){ + return rtreeEndTransaction(pVtab); +} /* ** The xRename method for rtree module virtual tables. @@ -208586,8 +213666,11 @@ static int rtreeShadowName(const char *zName){ return 0; } +/* Forward declaration */ +static int rtreeIntegrity(sqlite3_vtab*, const char*, const char*, int, char**); + static sqlite3_module rtreeModule = { - 3, /* iVersion */ + 4, /* iVersion */ rtreeCreate, /* xCreate - create a table */ rtreeConnect, /* xConnect - connect to an existing table */ rtreeBestIndex, /* xBestIndex - Determine search strategy */ @@ -208604,13 +213687,14 @@ static sqlite3_module rtreeModule = { rtreeBeginTransaction, /* xBegin - begin transaction */ rtreeEndTransaction, /* xSync - sync transaction */ rtreeEndTransaction, /* xCommit - commit transaction */ - rtreeEndTransaction, /* xRollback - rollback transaction */ + rtreeRollback, /* xRollback - rollback transaction */ 0, /* xFindFunction - function overloading */ rtreeRename, /* xRename - rename the table */ rtreeSavepoint, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - rtreeShadowName /* xShadowName */ + rtreeShadowName, /* xShadowName */ + rtreeIntegrity /* xIntegrity */ }; static int rtreeSqlInit( @@ -208703,7 +213787,7 @@ static int rtreeSqlInit( } sqlite3_free(zSql); } - if( pRtree->nAux ){ + if( pRtree->nAux && rc!=SQLITE_NOMEM ){ pRtree->zReadAuxSql = sqlite3_mprintf( "SELECT * FROM \"%w\".\"%w_rowid\" WHERE rowid=?1", zDb, zPrefix); @@ -208866,22 +213950,27 @@ static int rtreeInit( } sqlite3_vtab_config(db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1); + sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS); + /* Allocate the sqlite3_vtab structure */ nDb = (int)strlen(argv[1]); nName = (int)strlen(argv[2]); - pRtree = (Rtree *)sqlite3_malloc64(sizeof(Rtree)+nDb+nName+2); + pRtree = (Rtree *)sqlite3_malloc64(sizeof(Rtree)+nDb+nName*2+8); if( !pRtree ){ return SQLITE_NOMEM; } - memset(pRtree, 0, sizeof(Rtree)+nDb+nName+2); + memset(pRtree, 0, sizeof(Rtree)+nDb+nName*2+8); pRtree->nBusy = 1; pRtree->base.pModule = &rtreeModule; pRtree->zDb = (char *)&pRtree[1]; pRtree->zName = &pRtree->zDb[nDb+1]; + pRtree->zNodeName = &pRtree->zName[nName+1]; pRtree->eCoordType = (u8)eCoordType; memcpy(pRtree->zDb, argv[1], nDb); memcpy(pRtree->zName, argv[2], nName); + memcpy(pRtree->zNodeName, argv[2], nName); + memcpy(&pRtree->zNodeName[nName], "_node", 6); /* Create/Connect to the underlying relational database schema. If @@ -209378,7 +214467,6 @@ static int rtreeCheckTable( ){ RtreeCheck check; /* Common context for various routines */ sqlite3_stmt *pStmt = 0; /* Used to find column count of rtree table */ - int bEnd = 0; /* True if transaction should be closed */ int nAux = 0; /* Number of extra columns. */ /* Initialize the context object */ @@ -209387,24 +214475,14 @@ static int rtreeCheckTable( check.zDb = zDb; check.zTab = zTab; - /* If there is not already an open transaction, open one now. This is - ** to ensure that the queries run as part of this integrity-check operate - ** on a consistent snapshot. */ - if( sqlite3_get_autocommit(db) ){ - check.rc = sqlite3_exec(db, "BEGIN", 0, 0, 0); - bEnd = 1; - } - /* Find the number of auxiliary columns */ - if( check.rc==SQLITE_OK ){ - pStmt = rtreeCheckPrepare(&check, "SELECT * FROM %Q.'%q_rowid'", zDb, zTab); - if( pStmt ){ - nAux = sqlite3_column_count(pStmt) - 2; - sqlite3_finalize(pStmt); - }else - if( check.rc!=SQLITE_NOMEM ){ - check.rc = SQLITE_OK; - } + pStmt = rtreeCheckPrepare(&check, "SELECT * FROM %Q.'%q_rowid'", zDb, zTab); + if( pStmt ){ + nAux = sqlite3_column_count(pStmt) - 2; + sqlite3_finalize(pStmt); + }else + if( check.rc!=SQLITE_NOMEM ){ + check.rc = SQLITE_OK; } /* Find number of dimensions in the rtree table. */ @@ -209435,15 +214513,35 @@ static int rtreeCheckTable( sqlite3_finalize(check.aCheckMapping[0]); sqlite3_finalize(check.aCheckMapping[1]); - /* If one was opened, close the transaction */ - if( bEnd ){ - int rc = sqlite3_exec(db, "END", 0, 0, 0); - if( check.rc==SQLITE_OK ) check.rc = rc; - } *pzReport = check.zReport; return check.rc; } +/* +** Implementation of the xIntegrity method for Rtree. +*/ +static int rtreeIntegrity( + sqlite3_vtab *pVtab, /* The virtual table to check */ + const char *zSchema, /* Schema in which the virtual table lives */ + const char *zName, /* Name of the virtual table */ + int isQuick, /* True for a quick_check */ + char **pzErr /* Write results here */ +){ + Rtree *pRtree = (Rtree*)pVtab; + int rc; + assert( pzErr!=0 && *pzErr==0 ); + UNUSED_PARAMETER(zSchema); + UNUSED_PARAMETER(zName); + UNUSED_PARAMETER(isQuick); + rc = rtreeCheckTable(pRtree->db, pRtree->zDb, pRtree->zName, pzErr); + if( rc==SQLITE_OK && *pzErr ){ + *pzErr = sqlite3_mprintf("In RTree %s.%s:\n%z", + pRtree->zDb, pRtree->zName, *pzErr); + if( (*pzErr)==0 ) rc = SQLITE_NOMEM; + } + return rc; +} + /* ** Usage: ** @@ -210765,24 +215863,28 @@ static int geopolyInit( (void)pAux; sqlite3_vtab_config(db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1); + sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS); /* Allocate the sqlite3_vtab structure */ nDb = strlen(argv[1]); nName = strlen(argv[2]); - pRtree = (Rtree *)sqlite3_malloc64(sizeof(Rtree)+nDb+nName+2); + pRtree = (Rtree *)sqlite3_malloc64(sizeof(Rtree)+nDb+nName*2+8); if( !pRtree ){ return SQLITE_NOMEM; } - memset(pRtree, 0, sizeof(Rtree)+nDb+nName+2); + memset(pRtree, 0, sizeof(Rtree)+nDb+nName*2+8); pRtree->nBusy = 1; pRtree->base.pModule = &rtreeModule; pRtree->zDb = (char *)&pRtree[1]; pRtree->zName = &pRtree->zDb[nDb+1]; + pRtree->zNodeName = &pRtree->zName[nName+1]; pRtree->eCoordType = RTREE_COORD_REAL32; pRtree->nDim = 2; pRtree->nDim2 = 4; memcpy(pRtree->zDb, argv[1], nDb); memcpy(pRtree->zName, argv[2], nName); + memcpy(pRtree->zNodeName, argv[2], nName); + memcpy(&pRtree->zNodeName[nName], "_node", 6); /* Create/Connect to the underlying relational database schema. If @@ -211196,7 +216298,6 @@ static int geopolyUpdate( } if( rc==SQLITE_OK ){ int rc2; - pRtree->iReinsertHeight = -1; rc = rtreeInsertCell(pRtree, pLeaf, &cell, 0); rc2 = nodeRelease(pRtree, pLeaf); if( rc==SQLITE_OK ){ @@ -211293,7 +216394,8 @@ static sqlite3_module geopolyModule = { rtreeSavepoint, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - rtreeShadowName /* xShadowName */ + rtreeShadowName, /* xShadowName */ + rtreeIntegrity /* xIntegrity */ }; static int sqlite3_geopoly_init(sqlite3 *db){ @@ -212004,7 +217106,7 @@ static void icuLoadCollation( UCollator *pUCollator; /* ICU library collation object */ int rc; /* Return code from sqlite3_create_collation_x() */ - assert(nArg==2); + assert(nArg==2 || nArg==3); (void)nArg; /* Unused parameter */ zLocale = (const char *)sqlite3_value_text(apArg[0]); zName = (const char *)sqlite3_value_text(apArg[1]); @@ -212019,7 +217121,39 @@ static void icuLoadCollation( return; } assert(p); - + if(nArg==3){ + const char *zOption = (const char*)sqlite3_value_text(apArg[2]); + static const struct { + const char *zName; + UColAttributeValue val; + } aStrength[] = { + { "PRIMARY", UCOL_PRIMARY }, + { "SECONDARY", UCOL_SECONDARY }, + { "TERTIARY", UCOL_TERTIARY }, + { "DEFAULT", UCOL_DEFAULT_STRENGTH }, + { "QUARTERNARY", UCOL_QUATERNARY }, + { "IDENTICAL", UCOL_IDENTICAL }, + }; + unsigned int i; + for(i=0; i=sizeof(aStrength)/sizeof(aStrength[0]) ){ + sqlite3_str *pStr = sqlite3_str_new(sqlite3_context_db_handle(p)); + sqlite3_str_appendf(pStr, + "unknown collation strength \"%s\" - should be one of:", + zOption); + for(i=0; ipTblIter, &p->zErrmsg); pIter->zTbl = 0; + pIter->zDataTbl = 0; }else{ pIter->zTbl = (const char*)sqlite3_column_text(pIter->pTblIter, 0); pIter->zDataTbl = (const char*)sqlite3_column_text(pIter->pTblIter,1); @@ -215972,7 +221109,7 @@ static i64 rbuShmChecksum(sqlite3rbu *p){ u32 volatile *ptr; p->rc = pDb->pMethods->xShmMap(pDb, 0, 32*1024, 0, (void volatile**)&ptr); if( p->rc==SQLITE_OK ){ - iRet = ((i64)ptr[10] << 32) + ptr[11]; + iRet = (i64)(((u64)ptr[10] << 32) + ptr[11]); } } return iRet; @@ -219307,7 +224444,8 @@ SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3 *db){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; return sqlite3_create_module(db, "dbstat", &dbstat_module, 0); } @@ -219744,7 +224882,8 @@ SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3 *db){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; return sqlite3_create_module(db, "sqlite_dbpage", &dbpage_module, 0); } @@ -219875,6 +225014,18 @@ struct sqlite3_changeset_iter { ** The data associated with each hash-table entry is a structure containing ** a subset of the initial values that the modified row contained at the ** start of the session. Or no initial values if the row was inserted. +** +** pDfltStmt: +** This is only used by the sqlite3changegroup_xxx() APIs, not by +** regular sqlite3_session objects. It is a SELECT statement that +** selects the default value for each table column. For example, +** if the table is +** +** CREATE TABLE xx(a DEFAULT 1, b, c DEFAULT 'abc') +** +** then this variable is the compiled version of: +** +** SELECT 1, NULL, 'abc' */ struct SessionTable { SessionTable *pNext; @@ -219883,10 +225034,12 @@ struct SessionTable { int bStat1; /* True if this is sqlite_stat1 */ int bRowid; /* True if this table uses rowid for PK */ const char **azCol; /* Column names */ + const char **azDflt; /* Default value expressions */ u8 *abPK; /* Array of primary key flags */ int nEntry; /* Total number of entries in hash table */ int nChange; /* Size of apChange[] array */ SessionChange **apChange; /* Hash table buckets */ + sqlite3_stmt *pDfltStmt; }; /* @@ -220055,6 +225208,7 @@ struct SessionTable { struct SessionChange { u8 op; /* One of UPDATE, DELETE, INSERT */ u8 bIndirect; /* True if this change is "indirect" */ + u16 nRecordField; /* Number of fields in aRecord[] */ int nMaxSize; /* Max size of eventual changeset record */ int nRecord; /* Number of bytes in buffer aRecord[] */ u8 *aRecord; /* Buffer containing old.* record */ @@ -220080,7 +225234,7 @@ static int sessionVarintLen(int iVal){ ** Read a varint value from aBuf[] into *piVal. Return the number of ** bytes read. */ -static int sessionVarintGet(u8 *aBuf, int *piVal){ +static int sessionVarintGet(const u8 *aBuf, int *piVal){ return getVarint32(aBuf, *piVal); } @@ -220343,9 +225497,11 @@ static int sessionPreupdateHash( ** Return the number of bytes of space occupied by the value (including ** the type byte). */ -static int sessionSerialLen(u8 *a){ - int e = *a; +static int sessionSerialLen(const u8 *a){ + int e; int n; + assert( a!=0 ); + e = *a; if( e==0 || e==0xFF ) return 1; if( e==SQLITE_NULL ) return 1; if( e==SQLITE_INTEGER || e==SQLITE_FLOAT ) return 9; @@ -220750,13 +225906,14 @@ static int sessionGrowHash( ** ** For example, if the table is declared as: ** -** CREATE TABLE tbl1(w, x, y, z, PRIMARY KEY(w, z)); +** CREATE TABLE tbl1(w, x DEFAULT 'abc', y, z, PRIMARY KEY(w, z)); ** -** Then the four output variables are populated as follows: +** Then the five output variables are populated as follows: ** ** *pnCol = 4 ** *pzTab = "tbl1" ** *pazCol = {"w", "x", "y", "z"} +** *pazDflt = {NULL, 'abc', NULL, NULL} ** *pabPK = {1, 0, 0, 1} ** ** All returned buffers are part of the same single allocation, which must @@ -220770,6 +225927,7 @@ static int sessionTableInfo( int *pnCol, /* OUT: number of columns */ const char **pzTab, /* OUT: Copy of zThis */ const char ***pazCol, /* OUT: Array of column names for table */ + const char ***pazDflt, /* OUT: Array of default value expressions */ u8 **pabPK, /* OUT: Array of booleans - true for PK col */ int *pbRowid /* OUT: True if only PK is a rowid */ ){ @@ -220782,11 +225940,18 @@ static int sessionTableInfo( int i; u8 *pAlloc = 0; char **azCol = 0; + char **azDflt = 0; u8 *abPK = 0; int bRowid = 0; /* Set to true to use rowid as PK */ assert( pazCol && pabPK ); + *pazCol = 0; + *pabPK = 0; + *pnCol = 0; + if( pzTab ) *pzTab = 0; + if( pazDflt ) *pazDflt = 0; + nThis = sqlite3Strlen30(zThis); if( nThis==12 && 0==sqlite3_stricmp("sqlite_stat1", zThis) ){ rc = sqlite3_table_column_metadata(db, zDb, zThis, 0, 0, 0, 0, 0, 0); @@ -220800,39 +225965,28 @@ static int sessionTableInfo( }else if( rc==SQLITE_ERROR ){ zPragma = sqlite3_mprintf(""); }else{ - *pazCol = 0; - *pabPK = 0; - *pnCol = 0; - if( pzTab ) *pzTab = 0; return rc; } }else{ zPragma = sqlite3_mprintf("PRAGMA '%q'.table_info('%q')", zDb, zThis); } if( !zPragma ){ - *pazCol = 0; - *pabPK = 0; - *pnCol = 0; - if( pzTab ) *pzTab = 0; return SQLITE_NOMEM; } rc = sqlite3_prepare_v2(db, zPragma, -1, &pStmt, 0); sqlite3_free(zPragma); if( rc!=SQLITE_OK ){ - *pazCol = 0; - *pabPK = 0; - *pnCol = 0; - if( pzTab ) *pzTab = 0; return rc; } nByte = nThis + 1; bRowid = (pbRowid!=0); while( SQLITE_ROW==sqlite3_step(pStmt) ){ - nByte += sqlite3_column_bytes(pStmt, 1); + nByte += sqlite3_column_bytes(pStmt, 1); /* name */ + nByte += sqlite3_column_bytes(pStmt, 4); /* dflt_value */ nDbCol++; - if( sqlite3_column_int(pStmt, 5) ) bRowid = 0; + if( sqlite3_column_int(pStmt, 5) ) bRowid = 0; /* pk */ } if( nDbCol==0 ) bRowid = 0; nDbCol += bRowid; @@ -220840,15 +225994,18 @@ static int sessionTableInfo( rc = sqlite3_reset(pStmt); if( rc==SQLITE_OK ){ - nByte += nDbCol * (sizeof(const char *) + sizeof(u8) + 1); + nByte += nDbCol * (sizeof(const char *)*2 + sizeof(u8) + 1 + 1); pAlloc = sessionMalloc64(pSession, nByte); if( pAlloc==0 ){ rc = SQLITE_NOMEM; + }else{ + memset(pAlloc, 0, nByte); } } if( rc==SQLITE_OK ){ azCol = (char **)pAlloc; - pAlloc = (u8 *)&azCol[nDbCol]; + azDflt = (char**)&azCol[nDbCol]; + pAlloc = (u8 *)&azDflt[nDbCol]; abPK = (u8 *)pAlloc; pAlloc = &abPK[nDbCol]; if( pzTab ){ @@ -220868,11 +226025,21 @@ static int sessionTableInfo( } while( SQLITE_ROW==sqlite3_step(pStmt) ){ int nName = sqlite3_column_bytes(pStmt, 1); + int nDflt = sqlite3_column_bytes(pStmt, 4); const unsigned char *zName = sqlite3_column_text(pStmt, 1); + const unsigned char *zDflt = sqlite3_column_text(pStmt, 4); + if( zName==0 ) break; memcpy(pAlloc, zName, nName+1); azCol[i] = (char *)pAlloc; pAlloc += nName+1; + if( zDflt ){ + memcpy(pAlloc, zDflt, nDflt+1); + azDflt[i] = (char *)pAlloc; + pAlloc += nDflt+1; + }else{ + azDflt[i] = 0; + } abPK[i] = sqlite3_column_int(pStmt, 5); i++; } @@ -220883,14 +226050,11 @@ static int sessionTableInfo( ** free any allocation made. An error code will be returned in this case. */ if( rc==SQLITE_OK ){ - *pazCol = (const char **)azCol; + *pazCol = (const char**)azCol; + if( pazDflt ) *pazDflt = (const char**)azDflt; *pabPK = abPK; *pnCol = nDbCol; }else{ - *pazCol = 0; - *pabPK = 0; - *pnCol = 0; - if( pzTab ) *pzTab = 0; sessionFree(pSession, azCol); } if( pbRowid ) *pbRowid = bRowid; @@ -220899,10 +226063,9 @@ static int sessionTableInfo( } /* -** This function is only called from within a pre-update handler for a -** write to table pTab, part of session pSession. If this is the first -** write to this table, initalize the SessionTable.nCol, azCol[] and -** abPK[] arrays accordingly. +** This function is called to initialize the SessionTable.nCol, azCol[] +** abPK[] and azDflt[] members of SessionTable object pTab. If these +** fields are already initilialized, this function is a no-op. ** ** If an error occurs, an error code is stored in sqlite3_session.rc and ** non-zero returned. Or, if no error occurs but the table has no primary @@ -220910,15 +226073,22 @@ static int sessionTableInfo( ** indicate that updates on this table should be ignored. SessionTable.abPK ** is set to NULL in this case. */ -static int sessionInitTable(sqlite3_session *pSession, SessionTable *pTab){ +static int sessionInitTable( + sqlite3_session *pSession, /* Optional session handle */ + SessionTable *pTab, /* Table object to initialize */ + sqlite3 *db, /* Database handle to read schema from */ + const char *zDb /* Name of db - "main", "temp" etc. */ +){ + int rc = SQLITE_OK; + if( pTab->nCol==0 ){ u8 *abPK; assert( pTab->azCol==0 || pTab->abPK==0 ); - pSession->rc = sessionTableInfo(pSession, pSession->db, pSession->zDb, - pTab->zName, &pTab->nCol, 0, &pTab->azCol, &abPK, - (pSession->bImplicitPK ? &pTab->bRowid : 0) + rc = sessionTableInfo(pSession, db, zDb, + pTab->zName, &pTab->nCol, 0, &pTab->azCol, &pTab->azDflt, &abPK, + ((pSession==0 || pSession->bImplicitPK) ? &pTab->bRowid : 0) ); - if( pSession->rc==SQLITE_OK ){ + if( rc==SQLITE_OK ){ int i; for(i=0; inCol; i++){ if( abPK[i] ){ @@ -220930,14 +226100,321 @@ static int sessionInitTable(sqlite3_session *pSession, SessionTable *pTab){ pTab->bStat1 = 1; } - if( pSession->bEnableSize ){ + if( pSession && pSession->bEnableSize ){ pSession->nMaxChangesetSize += ( 1 + sessionVarintLen(pTab->nCol) + pTab->nCol + strlen(pTab->zName)+1 ); } } } - return (pSession->rc || pTab->abPK==0); + + if( pSession ){ + pSession->rc = rc; + return (rc || pTab->abPK==0); + } + return rc; +} + +/* +** Re-initialize table object pTab. +*/ +static int sessionReinitTable(sqlite3_session *pSession, SessionTable *pTab){ + int nCol = 0; + const char **azCol = 0; + const char **azDflt = 0; + u8 *abPK = 0; + int bRowid = 0; + + assert( pSession->rc==SQLITE_OK ); + + pSession->rc = sessionTableInfo(pSession, pSession->db, pSession->zDb, + pTab->zName, &nCol, 0, &azCol, &azDflt, &abPK, + (pSession->bImplicitPK ? &bRowid : 0) + ); + if( pSession->rc==SQLITE_OK ){ + if( pTab->nCol>nCol || pTab->bRowid!=bRowid ){ + pSession->rc = SQLITE_SCHEMA; + }else{ + int ii; + int nOldCol = pTab->nCol; + for(ii=0; iinCol ){ + if( pTab->abPK[ii]!=abPK[ii] ){ + pSession->rc = SQLITE_SCHEMA; + } + }else if( abPK[ii] ){ + pSession->rc = SQLITE_SCHEMA; + } + } + + if( pSession->rc==SQLITE_OK ){ + const char **a = pTab->azCol; + pTab->azCol = azCol; + pTab->nCol = nCol; + pTab->azDflt = azDflt; + pTab->abPK = abPK; + azCol = a; + } + if( pSession->bEnableSize ){ + pSession->nMaxChangesetSize += (nCol - nOldCol); + pSession->nMaxChangesetSize += sessionVarintLen(nCol); + pSession->nMaxChangesetSize -= sessionVarintLen(nOldCol); + } + } + } + + sqlite3_free((char*)azCol); + return pSession->rc; +} + +/* +** Session-change object (*pp) contains an old.* record with fewer than +** nCol fields. This function updates it with the default values for +** the missing fields. +*/ +static void sessionUpdateOneChange( + sqlite3_session *pSession, /* For memory accounting */ + int *pRc, /* IN/OUT: Error code */ + SessionChange **pp, /* IN/OUT: Change object to update */ + int nCol, /* Number of columns now in table */ + sqlite3_stmt *pDflt /* SELECT */ +){ + SessionChange *pOld = *pp; + + while( pOld->nRecordFieldnRecordField; + int eType = sqlite3_column_type(pDflt, iField); + switch( eType ){ + case SQLITE_NULL: + nIncr = 1; + break; + case SQLITE_INTEGER: + case SQLITE_FLOAT: + nIncr = 9; + break; + default: { + int n = sqlite3_column_bytes(pDflt, iField); + nIncr = 1 + sessionVarintLen(n) + n; + assert( eType==SQLITE_TEXT || eType==SQLITE_BLOB ); + break; + } + } + + nByte = nIncr + (sizeof(SessionChange) + pOld->nRecord); + pNew = sessionMalloc64(pSession, nByte); + if( pNew==0 ){ + *pRc = SQLITE_NOMEM; + return; + }else{ + memcpy(pNew, pOld, sizeof(SessionChange)); + pNew->aRecord = (u8*)&pNew[1]; + memcpy(pNew->aRecord, pOld->aRecord, pOld->nRecord); + pNew->aRecord[pNew->nRecord++] = (u8)eType; + switch( eType ){ + case SQLITE_INTEGER: { + i64 iVal = sqlite3_column_int64(pDflt, iField); + sessionPutI64(&pNew->aRecord[pNew->nRecord], iVal); + pNew->nRecord += 8; + break; + } + + case SQLITE_FLOAT: { + double rVal = sqlite3_column_double(pDflt, iField); + i64 iVal = 0; + memcpy(&iVal, &rVal, sizeof(rVal)); + sessionPutI64(&pNew->aRecord[pNew->nRecord], iVal); + pNew->nRecord += 8; + break; + } + + case SQLITE_TEXT: { + int n = sqlite3_column_bytes(pDflt, iField); + const char *z = (const char*)sqlite3_column_text(pDflt, iField); + pNew->nRecord += sessionVarintPut(&pNew->aRecord[pNew->nRecord], n); + memcpy(&pNew->aRecord[pNew->nRecord], z, n); + pNew->nRecord += n; + break; + } + + case SQLITE_BLOB: { + int n = sqlite3_column_bytes(pDflt, iField); + const u8 *z = (const u8*)sqlite3_column_blob(pDflt, iField); + pNew->nRecord += sessionVarintPut(&pNew->aRecord[pNew->nRecord], n); + memcpy(&pNew->aRecord[pNew->nRecord], z, n); + pNew->nRecord += n; + break; + } + + default: + assert( eType==SQLITE_NULL ); + break; + } + + sessionFree(pSession, pOld); + *pp = pOld = pNew; + pNew->nRecordField++; + pNew->nMaxSize += nIncr; + if( pSession ){ + pSession->nMaxChangesetSize += nIncr; + } + } + } +} + +/* +** Ensure that there is room in the buffer to append nByte bytes of data. +** If not, use sqlite3_realloc() to grow the buffer so that there is. +** +** If successful, return zero. Otherwise, if an OOM condition is encountered, +** set *pRc to SQLITE_NOMEM and return non-zero. +*/ +static int sessionBufferGrow(SessionBuffer *p, i64 nByte, int *pRc){ +#define SESSION_MAX_BUFFER_SZ (0x7FFFFF00 - 1) + i64 nReq = p->nBuf + nByte; + if( *pRc==SQLITE_OK && nReq>p->nAlloc ){ + u8 *aNew; + i64 nNew = p->nAlloc ? p->nAlloc : 128; + + do { + nNew = nNew*2; + }while( nNewSESSION_MAX_BUFFER_SZ ){ + nNew = SESSION_MAX_BUFFER_SZ; + if( nNewaBuf, nNew); + if( 0==aNew ){ + *pRc = SQLITE_NOMEM; + }else{ + p->aBuf = aNew; + p->nAlloc = nNew; + } + } + return (*pRc!=SQLITE_OK); +} + + +/* +** This function is a no-op if *pRc is other than SQLITE_OK when it is +** called. Otherwise, append a string to the buffer. All bytes in the string +** up to (but not including) the nul-terminator are written to the buffer. +** +** If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before +** returning. +*/ +static void sessionAppendStr( + SessionBuffer *p, + const char *zStr, + int *pRc +){ + int nStr = sqlite3Strlen30(zStr); + if( 0==sessionBufferGrow(p, nStr+1, pRc) ){ + memcpy(&p->aBuf[p->nBuf], zStr, nStr); + p->nBuf += nStr; + p->aBuf[p->nBuf] = 0x00; + } +} + +/* +** Format a string using printf() style formatting and then append it to the +** buffer using sessionAppendString(). +*/ +static void sessionAppendPrintf( + SessionBuffer *p, /* Buffer to append to */ + int *pRc, + const char *zFmt, + ... +){ + if( *pRc==SQLITE_OK ){ + char *zApp = 0; + va_list ap; + va_start(ap, zFmt); + zApp = sqlite3_vmprintf(zFmt, ap); + if( zApp==0 ){ + *pRc = SQLITE_NOMEM; + }else{ + sessionAppendStr(p, zApp, pRc); + } + va_end(ap); + sqlite3_free(zApp); + } +} + +/* +** Prepare a statement against database handle db that SELECTs a single +** row containing the default values for each column in table pTab. For +** example, if pTab is declared as: +** +** CREATE TABLE pTab(a PRIMARY KEY, b DEFAULT 123, c DEFAULT 'abcd'); +** +** Then this function prepares and returns the SQL statement: +** +** SELECT NULL, 123, 'abcd'; +*/ +static int sessionPrepareDfltStmt( + sqlite3 *db, /* Database handle */ + SessionTable *pTab, /* Table to prepare statement for */ + sqlite3_stmt **ppStmt /* OUT: Statement handle */ +){ + SessionBuffer sql = {0,0,0}; + int rc = SQLITE_OK; + const char *zSep = " "; + int ii = 0; + + *ppStmt = 0; + sessionAppendPrintf(&sql, &rc, "SELECT"); + for(ii=0; iinCol; ii++){ + const char *zDflt = pTab->azDflt[ii] ? pTab->azDflt[ii] : "NULL"; + sessionAppendPrintf(&sql, &rc, "%s%s", zSep, zDflt); + zSep = ", "; + } + if( rc==SQLITE_OK ){ + rc = sqlite3_prepare_v2(db, (const char*)sql.aBuf, -1, ppStmt, 0); + } + sqlite3_free(sql.aBuf); + + return rc; +} + +/* +** Table pTab has one or more existing change-records with old.* records +** with fewer than pTab->nCol columns. This function updates all such +** change-records with the default values for the missing columns. +*/ +static int sessionUpdateChanges(sqlite3_session *pSession, SessionTable *pTab){ + sqlite3_stmt *pStmt = 0; + int rc = pSession->rc; + + rc = sessionPrepareDfltStmt(pSession->db, pTab, &pStmt); + if( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ + int ii = 0; + SessionChange **pp = 0; + for(ii=0; iinChange; ii++){ + for(pp=&pTab->apChange[ii]; *pp; pp=&((*pp)->pNext)){ + if( (*pp)->nRecordField!=pTab->nCol ){ + sessionUpdateOneChange(pSession, &rc, pp, pTab->nCol, pStmt); + } + } + } + } + + pSession->rc = rc; + rc = sqlite3_finalize(pStmt); + if( pSession->rc==SQLITE_OK ) pSession->rc = rc; + return pSession->rc; } /* @@ -221100,16 +226577,22 @@ static void sessionPreupdateOneChange( int iHash; int bNull = 0; int rc = SQLITE_OK; + int nExpect = 0; SessionStat1Ctx stat1 = {{0,0,0,0,0},0}; if( pSession->rc ) return; /* Load table details if required */ - if( sessionInitTable(pSession, pTab) ) return; + if( sessionInitTable(pSession, pTab, pSession->db, pSession->zDb) ) return; /* Check the number of columns in this xPreUpdate call matches the ** number of columns in the table. */ - if( (pTab->nCol-pTab->bRowid)!=pSession->hook.xCount(pSession->hook.pCtx) ){ + nExpect = pSession->hook.xCount(pSession->hook.pCtx); + if( (pTab->nCol-pTab->bRowid)nCol-pTab->bRowid)!=nExpect ){ pSession->rc = SQLITE_SCHEMA; return; } @@ -221186,7 +226669,7 @@ static void sessionPreupdateOneChange( } /* Allocate the change object */ - pC = (SessionChange *)sessionMalloc64(pSession, nByte); + pC = (SessionChange*)sessionMalloc64(pSession, nByte); if( !pC ){ rc = SQLITE_NOMEM; goto error_out; @@ -221219,6 +226702,7 @@ static void sessionPreupdateOneChange( if( pSession->bIndirect || pSession->hook.xDepth(pSession->hook.pCtx) ){ pC->bIndirect = 1; } + pC->nRecordField = pTab->nCol; pC->nRecord = nByte; pC->op = op; pC->pNext = pTab->apChange[iHash]; @@ -221598,7 +227082,7 @@ SQLITE_API int sqlite3session_diff( /* Locate and if necessary initialize the target table object */ rc = sessionFindTable(pSession, zTbl, &pTo); if( pTo==0 ) goto diff_out; - if( sessionInitTable(pSession, pTo) ){ + if( sessionInitTable(pSession, pTo, pSession->db, pSession->zDb) ){ rc = pSession->rc; goto diff_out; } @@ -221611,7 +227095,7 @@ SQLITE_API int sqlite3session_diff( int bRowid = 0; u8 *abPK; const char **azCol = 0; - rc = sessionTableInfo(0, db, zFrom, zTbl, &nCol, 0, &azCol, &abPK, + rc = sessionTableInfo(0, db, zFrom, zTbl, &nCol, 0, &azCol, 0, &abPK, pSession->bImplicitPK ? &bRowid : 0 ); if( rc==SQLITE_OK ){ @@ -221726,6 +227210,7 @@ static void sessionDeleteTable(sqlite3_session *pSession, SessionTable *pList){ sessionFree(pSession, p); } } + sqlite3_finalize(pTab->pDfltStmt); sessionFree(pSession, (char*)pTab->azCol); /* cast works around VC++ bug */ sessionFree(pSession, pTab->apChange); sessionFree(pSession, pTab); @@ -221758,9 +227243,7 @@ SQLITE_API void sqlite3session_delete(sqlite3_session *pSession){ ** associated hash-tables. */ sessionDeleteTable(pSession, pSession->pTable); - /* Assert that all allocations have been freed and then free the - ** session object itself. */ - assert( pSession->nMalloc==0 ); + /* Free the session object. */ sqlite3_free(pSession); } @@ -221831,48 +227314,6 @@ SQLITE_API int sqlite3session_attach( return rc; } -/* -** Ensure that there is room in the buffer to append nByte bytes of data. -** If not, use sqlite3_realloc() to grow the buffer so that there is. -** -** If successful, return zero. Otherwise, if an OOM condition is encountered, -** set *pRc to SQLITE_NOMEM and return non-zero. -*/ -static int sessionBufferGrow(SessionBuffer *p, i64 nByte, int *pRc){ -#define SESSION_MAX_BUFFER_SZ (0x7FFFFF00 - 1) - i64 nReq = p->nBuf + nByte; - if( *pRc==SQLITE_OK && nReq>p->nAlloc ){ - u8 *aNew; - i64 nNew = p->nAlloc ? p->nAlloc : 128; - - do { - nNew = nNew*2; - }while( nNewSESSION_MAX_BUFFER_SZ ){ - nNew = SESSION_MAX_BUFFER_SZ; - if( nNewaBuf, nNew); - if( 0==aNew ){ - *pRc = SQLITE_NOMEM; - }else{ - p->aBuf = aNew; - p->nAlloc = nNew; - } - } - return (*pRc!=SQLITE_OK); -} - /* ** Append the value passed as the second argument to the buffer passed ** as the first. @@ -221941,27 +227382,6 @@ static void sessionAppendBlob( } } -/* -** This function is a no-op if *pRc is other than SQLITE_OK when it is -** called. Otherwise, append a string to the buffer. All bytes in the string -** up to (but not including) the nul-terminator are written to the buffer. -** -** If an OOM condition is encountered, set *pRc to SQLITE_NOMEM before -** returning. -*/ -static void sessionAppendStr( - SessionBuffer *p, - const char *zStr, - int *pRc -){ - int nStr = sqlite3Strlen30(zStr); - if( 0==sessionBufferGrow(p, nStr+1, pRc) ){ - memcpy(&p->aBuf[p->nBuf], zStr, nStr); - p->nBuf += nStr; - p->aBuf[p->nBuf] = 0x00; - } -} - /* ** This function is a no-op if *pRc is other than SQLITE_OK when it is ** called. Otherwise, append the string representation of integer iVal @@ -221980,27 +227400,6 @@ static void sessionAppendInteger( sessionAppendStr(p, aBuf, pRc); } -static void sessionAppendPrintf( - SessionBuffer *p, /* Buffer to append to */ - int *pRc, - const char *zFmt, - ... -){ - if( *pRc==SQLITE_OK ){ - char *zApp = 0; - va_list ap; - va_start(ap, zFmt); - zApp = sqlite3_vmprintf(zFmt, ap); - if( zApp==0 ){ - *pRc = SQLITE_NOMEM; - }else{ - sessionAppendStr(p, zApp, pRc); - } - va_end(ap); - sqlite3_free(zApp); - } -} - /* ** This function is a no-op if *pRc is other than SQLITE_OK when it is ** called. Otherwise, append the string zStr enclosed in quotes (") and @@ -222491,26 +227890,16 @@ static int sessionGenerateChangeset( for(pTab=pSession->pTable; rc==SQLITE_OK && pTab; pTab=pTab->pNext){ if( pTab->nEntry ){ const char *zName = pTab->zName; - int nCol = 0; /* Number of columns in table */ - u8 *abPK = 0; /* Primary key array */ - const char **azCol = 0; /* Table columns */ int i; /* Used to iterate through hash buckets */ sqlite3_stmt *pSel = 0; /* SELECT statement to query table pTab */ int nRewind = buf.nBuf; /* Initial size of write buffer */ int nNoop; /* Size of buffer after writing tbl header */ - int bRowid = 0; + int nOldCol = pTab->nCol; /* Check the table schema is still Ok. */ - rc = sessionTableInfo( - 0, db, pSession->zDb, zName, &nCol, 0, &azCol, &abPK, - (pSession->bImplicitPK ? &bRowid : 0) - ); - if( rc==SQLITE_OK && ( - pTab->nCol!=nCol - || pTab->bRowid!=bRowid - || memcmp(abPK, pTab->abPK, nCol) - )){ - rc = SQLITE_SCHEMA; + rc = sessionReinitTable(pSession, pTab); + if( rc==SQLITE_OK && pTab->nCol!=nOldCol ){ + rc = sessionUpdateChanges(pSession, pTab); } /* Write a table header */ @@ -222518,8 +227907,8 @@ static int sessionGenerateChangeset( /* Build and compile a statement to execute: */ if( rc==SQLITE_OK ){ - rc = sessionSelectStmt( - db, 0, pSession->zDb, zName, bRowid, nCol, azCol, abPK, &pSel + rc = sessionSelectStmt(db, 0, pSession->zDb, + zName, pTab->bRowid, pTab->nCol, pTab->azCol, pTab->abPK, &pSel ); } @@ -222528,22 +227917,22 @@ static int sessionGenerateChangeset( SessionChange *p; /* Used to iterate through changes */ for(p=pTab->apChange[i]; rc==SQLITE_OK && p; p=p->pNext){ - rc = sessionSelectBind(pSel, nCol, abPK, p); + rc = sessionSelectBind(pSel, pTab->nCol, pTab->abPK, p); if( rc!=SQLITE_OK ) continue; if( sqlite3_step(pSel)==SQLITE_ROW ){ if( p->op==SQLITE_INSERT ){ int iCol; sessionAppendByte(&buf, SQLITE_INSERT, &rc); sessionAppendByte(&buf, p->bIndirect, &rc); - for(iCol=0; iColnCol; iCol++){ sessionAppendCol(&buf, pSel, iCol, &rc); } }else{ - assert( abPK!=0 ); /* Because sessionSelectStmt() returned ok */ - rc = sessionAppendUpdate(&buf, bPatchset, pSel, p, abPK); + assert( pTab->abPK!=0 ); + rc = sessionAppendUpdate(&buf, bPatchset, pSel, p, pTab->abPK); } }else if( p->op!=SQLITE_INSERT ){ - rc = sessionAppendDelete(&buf, bPatchset, p, nCol, abPK); + rc = sessionAppendDelete(&buf, bPatchset, p, pTab->nCol,pTab->abPK); } if( rc==SQLITE_OK ){ rc = sqlite3_reset(pSel); @@ -222568,7 +227957,6 @@ static int sessionGenerateChangeset( if( buf.nBuf==nNoop ){ buf.nBuf = nRewind; } - sqlite3_free((char*)azCol); /* cast works around VC++ bug */ } } @@ -223192,14 +228580,14 @@ static int sessionChangesetNextOne( p->rc = sessionInputBuffer(&p->in, 2); if( p->rc!=SQLITE_OK ) return p->rc; + sessionDiscardData(&p->in); + p->in.iCurrent = p->in.iNext; + /* If the iterator is already at the end of the changeset, return DONE. */ if( p->in.iNext>=p->in.nData ){ return SQLITE_DONE; } - sessionDiscardData(&p->in); - p->in.iCurrent = p->in.iNext; - op = p->in.aData[p->in.iNext++]; while( op=='T' || op=='P' ){ if( pbNew ) *pbNew = 1; @@ -224697,7 +230085,7 @@ static int sessionChangesetApply( sqlite3changeset_pk(pIter, &abPK, 0); rc = sessionTableInfo(0, db, "main", zNew, - &sApply.nCol, &zTab, &sApply.azCol, &sApply.abPK, &sApply.bRowid + &sApply.nCol, &zTab, &sApply.azCol, 0, &sApply.abPK, &sApply.bRowid ); if( rc!=SQLITE_OK ) break; for(i=0; iflags & SQLITE_FkNoAction; + + if( flags & SQLITE_CHANGESETAPPLY_FKNOACTION ){ + db->flags |= ((u64)SQLITE_FkNoAction); + db->aDb[0].pSchema->schema_cookie -= 32; + } + if( rc==SQLITE_OK ){ rc = sessionChangesetApply( db, pIter, xFilter, xConflict, pCtx, ppRebase, pnRebase, flags ); } + + if( (flags & SQLITE_CHANGESETAPPLY_FKNOACTION) && savedFlag==0 ){ + assert( db->flags & SQLITE_FkNoAction ); + db->flags &= ~((u64)SQLITE_FkNoAction); + db->aDb[0].pSchema->schema_cookie -= 32; + } return rc; } @@ -224921,6 +230322,10 @@ struct sqlite3_changegroup { int rc; /* Error code */ int bPatch; /* True to accumulate patchsets */ SessionTable *pList; /* List of tables in current patch */ + SessionBuffer rec; + + sqlite3 *db; /* Configured by changegroup_schema() */ + char *zDb; /* Configured by changegroup_schema() */ }; /* @@ -224941,6 +230346,7 @@ static int sessionChangeMerge( ){ SessionChange *pNew = 0; int rc = SQLITE_OK; + assert( aRec!=0 ); if( !pExist ){ pNew = (SessionChange *)sqlite3_malloc64(sizeof(SessionChange) + nRec); @@ -225107,84 +230513,236 @@ static int sessionChangeMerge( } /* -** Add all changes in the changeset traversed by the iterator passed as -** the first argument to the changegroup hash tables. +** Check if a changeset entry with nCol columns and the PK array passed +** as the final argument to this function is compatible with SessionTable +** pTab. If so, return 1. Otherwise, if they are incompatible in some way, +** return 0. */ -static int sessionChangesetToHash( - sqlite3_changeset_iter *pIter, /* Iterator to read from */ - sqlite3_changegroup *pGrp, /* Changegroup object to add changeset to */ - int bRebase /* True if hash table is for rebasing */ +static int sessionChangesetCheckCompat( + SessionTable *pTab, + int nCol, + u8 *abPK ){ - u8 *aRec; - int nRec; - int rc = SQLITE_OK; - SessionTable *pTab = 0; - - while( SQLITE_ROW==sessionChangesetNext(pIter, &aRec, &nRec, 0) ){ - const char *zNew; - int nCol; - int op; - int iHash; - int bIndirect; - SessionChange *pChange; - SessionChange *pExist = 0; - SessionChange **pp; - - if( pGrp->pList==0 ){ - pGrp->bPatch = pIter->bPatchset; - }else if( pIter->bPatchset!=pGrp->bPatch ){ - rc = SQLITE_ERROR; - break; + if( pTab->azCol && nColnCol ){ + int ii; + for(ii=0; iinCol; ii++){ + u8 bPK = (ii < nCol) ? abPK[ii] : 0; + if( pTab->abPK[ii]!=bPK ) return 0; } + return 1; + } + return (pTab->nCol==nCol && 0==memcmp(abPK, pTab->abPK, nCol)); +} - sqlite3changeset_op(pIter, &zNew, &nCol, &op, &bIndirect); - if( !pTab || sqlite3_stricmp(zNew, pTab->zName) ){ - /* Search the list for a matching table */ - int nNew = (int)strlen(zNew); - u8 *abPK; +static int sessionChangesetExtendRecord( + sqlite3_changegroup *pGrp, + SessionTable *pTab, + int nCol, + int op, + const u8 *aRec, + int nRec, + SessionBuffer *pOut +){ + int rc = SQLITE_OK; + int ii = 0; - sqlite3changeset_pk(pIter, &abPK, 0); - for(pTab = pGrp->pList; pTab; pTab=pTab->pNext){ - if( 0==sqlite3_strnicmp(pTab->zName, zNew, nNew+1) ) break; - } - if( !pTab ){ - SessionTable **ppTab; + assert( pTab->azCol ); + assert( nColnCol ); - pTab = sqlite3_malloc64(sizeof(SessionTable) + nCol + nNew+1); - if( !pTab ){ - rc = SQLITE_NOMEM; + pOut->nBuf = 0; + if( op==SQLITE_INSERT || (op==SQLITE_DELETE && pGrp->bPatch==0) ){ + /* Append the missing default column values to the record. */ + sessionAppendBlob(pOut, aRec, nRec, &rc); + if( rc==SQLITE_OK && pTab->pDfltStmt==0 ){ + rc = sessionPrepareDfltStmt(pGrp->db, pTab, &pTab->pDfltStmt); + } + for(ii=nCol; rc==SQLITE_OK && iinCol; ii++){ + int eType = sqlite3_column_type(pTab->pDfltStmt, ii); + sessionAppendByte(pOut, eType, &rc); + switch( eType ){ + case SQLITE_FLOAT: + case SQLITE_INTEGER: { + i64 iVal; + if( eType==SQLITE_INTEGER ){ + iVal = sqlite3_column_int64(pTab->pDfltStmt, ii); + }else{ + double rVal = sqlite3_column_int64(pTab->pDfltStmt, ii); + memcpy(&iVal, &rVal, sizeof(i64)); + } + if( SQLITE_OK==sessionBufferGrow(pOut, 8, &rc) ){ + sessionPutI64(&pOut->aBuf[pOut->nBuf], iVal); + } break; } - memset(pTab, 0, sizeof(SessionTable)); - pTab->nCol = nCol; - pTab->abPK = (u8*)&pTab[1]; - memcpy(pTab->abPK, abPK, nCol); - pTab->zName = (char*)&pTab->abPK[nCol]; - memcpy(pTab->zName, zNew, nNew+1); - - /* The new object must be linked on to the end of the list, not - ** simply added to the start of it. This is to ensure that the - ** tables within the output of sqlite3changegroup_output() are in - ** the right order. */ - for(ppTab=&pGrp->pList; *ppTab; ppTab=&(*ppTab)->pNext); - *ppTab = pTab; - }else if( pTab->nCol!=nCol || memcmp(pTab->abPK, abPK, nCol) ){ - rc = SQLITE_SCHEMA; - break; + + case SQLITE_BLOB: + case SQLITE_TEXT: { + int n = sqlite3_column_bytes(pTab->pDfltStmt, ii); + sessionAppendVarint(pOut, n, &rc); + if( eType==SQLITE_TEXT ){ + const u8 *z = (const u8*)sqlite3_column_text(pTab->pDfltStmt, ii); + sessionAppendBlob(pOut, z, n, &rc); + }else{ + const u8 *z = (const u8*)sqlite3_column_blob(pTab->pDfltStmt, ii); + sessionAppendBlob(pOut, z, n, &rc); + } + break; + } + + default: + assert( eType==SQLITE_NULL ); + break; + } + } + }else if( op==SQLITE_UPDATE ){ + /* Append missing "undefined" entries to the old.* record. And, if this + ** is an UPDATE, to the new.* record as well. */ + int iOff = 0; + if( pGrp->bPatch==0 ){ + for(ii=0; iinCol-nCol); ii++){ + sessionAppendByte(pOut, 0x00, &rc); } } - if( sessionGrowHash(0, pIter->bPatchset, pTab) ){ - rc = SQLITE_NOMEM; - break; + sessionAppendBlob(pOut, &aRec[iOff], nRec-iOff, &rc); + for(ii=0; ii<(pTab->nCol-nCol); ii++){ + sessionAppendByte(pOut, 0x00, &rc); } + }else{ + assert( op==SQLITE_DELETE && pGrp->bPatch ); + sessionAppendBlob(pOut, aRec, nRec, &rc); + } + + return rc; +} + +/* +** Locate or create a SessionTable object that may be used to add the +** change currently pointed to by iterator pIter to changegroup pGrp. +** If successful, set output variable (*ppTab) to point to the table +** object and return SQLITE_OK. Otherwise, if some error occurs, return +** an SQLite error code and leave (*ppTab) set to NULL. +*/ +static int sessionChangesetFindTable( + sqlite3_changegroup *pGrp, + const char *zTab, + sqlite3_changeset_iter *pIter, + SessionTable **ppTab +){ + int rc = SQLITE_OK; + SessionTable *pTab = 0; + int nTab = (int)strlen(zTab); + u8 *abPK = 0; + int nCol = 0; + + *ppTab = 0; + sqlite3changeset_pk(pIter, &abPK, &nCol); + + /* Search the list for an existing table */ + for(pTab = pGrp->pList; pTab; pTab=pTab->pNext){ + if( 0==sqlite3_strnicmp(pTab->zName, zTab, nTab+1) ) break; + } + + /* If one was not found above, create a new table now */ + if( !pTab ){ + SessionTable **ppNew; + + pTab = sqlite3_malloc64(sizeof(SessionTable) + nCol + nTab+1); + if( !pTab ){ + return SQLITE_NOMEM; + } + memset(pTab, 0, sizeof(SessionTable)); + pTab->nCol = nCol; + pTab->abPK = (u8*)&pTab[1]; + memcpy(pTab->abPK, abPK, nCol); + pTab->zName = (char*)&pTab->abPK[nCol]; + memcpy(pTab->zName, zTab, nTab+1); + + if( pGrp->db ){ + pTab->nCol = 0; + rc = sessionInitTable(0, pTab, pGrp->db, pGrp->zDb); + if( rc ){ + assert( pTab->azCol==0 ); + sqlite3_free(pTab); + return rc; + } + } + + /* The new object must be linked on to the end of the list, not + ** simply added to the start of it. This is to ensure that the + ** tables within the output of sqlite3changegroup_output() are in + ** the right order. */ + for(ppNew=&pGrp->pList; *ppNew; ppNew=&(*ppNew)->pNext); + *ppNew = pTab; + } + + /* Check that the table is compatible. */ + if( !sessionChangesetCheckCompat(pTab, nCol, abPK) ){ + rc = SQLITE_SCHEMA; + } + + *ppTab = pTab; + return rc; +} + +/* +** Add the change currently indicated by iterator pIter to the hash table +** belonging to changegroup pGrp. +*/ +static int sessionOneChangeToHash( + sqlite3_changegroup *pGrp, + sqlite3_changeset_iter *pIter, + int bRebase +){ + int rc = SQLITE_OK; + int nCol = 0; + int op = 0; + int iHash = 0; + int bIndirect = 0; + SessionChange *pChange = 0; + SessionChange *pExist = 0; + SessionChange **pp = 0; + SessionTable *pTab = 0; + u8 *aRec = &pIter->in.aData[pIter->in.iCurrent + 2]; + int nRec = (pIter->in.iNext - pIter->in.iCurrent) - 2; + + /* Ensure that only changesets, or only patchsets, but not a mixture + ** of both, are being combined. It is an error to try to combine a + ** changeset and a patchset. */ + if( pGrp->pList==0 ){ + pGrp->bPatch = pIter->bPatchset; + }else if( pIter->bPatchset!=pGrp->bPatch ){ + rc = SQLITE_ERROR; + } + + if( rc==SQLITE_OK ){ + const char *zTab = 0; + sqlite3changeset_op(pIter, &zTab, &nCol, &op, &bIndirect); + rc = sessionChangesetFindTable(pGrp, zTab, pIter, &pTab); + } + + if( rc==SQLITE_OK && nColnCol ){ + SessionBuffer *pBuf = &pGrp->rec; + rc = sessionChangesetExtendRecord(pGrp, pTab, nCol, op, aRec, nRec, pBuf); + aRec = pBuf->aBuf; + nRec = pBuf->nBuf; + assert( pGrp->db ); + } + + if( rc==SQLITE_OK && sessionGrowHash(0, pIter->bPatchset, pTab) ){ + rc = SQLITE_NOMEM; + } + + if( rc==SQLITE_OK ){ + /* Search for existing entry. If found, remove it from the hash table. + ** Code below may link it back in. */ iHash = sessionChangeHash( pTab, (pIter->bPatchset && op==SQLITE_DELETE), aRec, pTab->nChange ); - - /* Search for existing entry. If found, remove it from the hash table. - ** Code below may link it back in. - */ for(pp=&pTab->apChange[iHash]; *pp; pp=&(*pp)->pNext){ int bPkOnly1 = 0; int bPkOnly2 = 0; @@ -225199,16 +230757,39 @@ static int sessionChangesetToHash( break; } } + } + if( rc==SQLITE_OK ){ rc = sessionChangeMerge(pTab, bRebase, pIter->bPatchset, pExist, op, bIndirect, aRec, nRec, &pChange ); - if( rc ) break; - if( pChange ){ - pChange->pNext = pTab->apChange[iHash]; - pTab->apChange[iHash] = pChange; - pTab->nEntry++; - } + } + if( rc==SQLITE_OK && pChange ){ + pChange->pNext = pTab->apChange[iHash]; + pTab->apChange[iHash] = pChange; + pTab->nEntry++; + } + + if( rc==SQLITE_OK ) rc = pIter->rc; + return rc; +} + +/* +** Add all changes in the changeset traversed by the iterator passed as +** the first argument to the changegroup hash tables. +*/ +static int sessionChangesetToHash( + sqlite3_changeset_iter *pIter, /* Iterator to read from */ + sqlite3_changegroup *pGrp, /* Changegroup object to add changeset to */ + int bRebase /* True if hash table is for rebasing */ +){ + u8 *aRec; + int nRec; + int rc = SQLITE_OK; + + while( SQLITE_ROW==(sessionChangesetNext(pIter, &aRec, &nRec, 0)) ){ + rc = sessionOneChangeToHash(pGrp, pIter, bRebase); + if( rc!=SQLITE_OK ) break; } if( rc==SQLITE_OK ) rc = pIter->rc; @@ -225297,6 +230878,31 @@ SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp){ return rc; } +/* +** Provide a database schema to the changegroup object. +*/ +SQLITE_API int sqlite3changegroup_schema( + sqlite3_changegroup *pGrp, + sqlite3 *db, + const char *zDb +){ + int rc = SQLITE_OK; + + if( pGrp->pList || pGrp->db ){ + /* Cannot add a schema after one or more calls to sqlite3changegroup_add(), + ** or after sqlite3changegroup_schema() has already been called. */ + rc = SQLITE_MISUSE; + }else{ + pGrp->zDb = sqlite3_mprintf("%s", zDb); + if( pGrp->zDb==0 ){ + rc = SQLITE_NOMEM; + }else{ + pGrp->db = db; + } + } + return rc; +} + /* ** Add the changeset currently stored in buffer pData, size nData bytes, ** to changeset-group p. @@ -225313,6 +230919,23 @@ SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup *pGrp, int nData, void return rc; } +/* +** Add a single change to a changeset-group. +*/ +SQLITE_API int sqlite3changegroup_add_change( + sqlite3_changegroup *pGrp, + sqlite3_changeset_iter *pIter +){ + if( pIter->in.iCurrent==pIter->in.iNext + || pIter->rc!=SQLITE_OK + || pIter->bInvert + ){ + /* Iterator does not point to any valid entry or is an INVERT iterator. */ + return SQLITE_ERROR; + } + return sessionOneChangeToHash(pGrp, pIter, 0); +} + /* ** Obtain a buffer containing a changeset representing the concatenation ** of all changesets added to the group so far. @@ -225360,7 +230983,9 @@ SQLITE_API int sqlite3changegroup_output_strm( */ SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup *pGrp){ if( pGrp ){ + sqlite3_free(pGrp->zDb); sessionDeleteTable(0, pGrp->pList); + sqlite3_free(pGrp->rec.aBuf); sqlite3_free(pGrp); } } @@ -225762,6 +231387,7 @@ SQLITE_API int sqlite3rebaser_rebase_strm( SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p){ if( p ){ sessionDeleteTable(0, p->grp.pList); + sqlite3_free(p->grp.rec.aBuf); sqlite3_free(p); } } @@ -225859,8 +231485,8 @@ struct Fts5PhraseIter { ** EXTENSION API FUNCTIONS ** ** xUserData(pFts): -** Return a copy of the context pointer the extension function was -** registered with. +** Return a copy of the pUserData pointer passed to the xCreateFunction() +** API when the extension function was registered. ** ** xColumnTotalSize(pFts, iCol, pnToken): ** If parameter iCol is less than zero, set output variable *pnToken @@ -225892,8 +231518,11 @@ struct Fts5PhraseIter { ** created with the "columnsize=0" option. ** ** xColumnText: -** This function attempts to retrieve the text of column iCol of the -** current document. If successful, (*pz) is set to point to a buffer +** If parameter iCol is less than zero, or greater than or equal to the +** number of columns in the table, SQLITE_RANGE is returned. +** +** Otherwise, this function attempts to retrieve the text of column iCol of +** the current document. If successful, (*pz) is set to point to a buffer ** containing the text in utf-8 encoding, (*pn) is set to the size in bytes ** (not characters) of the buffer and SQLITE_OK is returned. Otherwise, ** if an error occurs, an SQLite error code is returned and the final values @@ -225903,8 +231532,10 @@ struct Fts5PhraseIter { ** Returns the number of phrases in the current query expression. ** ** xPhraseSize: -** Returns the number of tokens in phrase iPhrase of the query. Phrases -** are numbered starting from zero. +** If parameter iCol is less than zero, or greater than or equal to the +** number of phrases in the current query, as returned by xPhraseCount, +** 0 is returned. Otherwise, this function returns the number of tokens in +** phrase iPhrase of the query. Phrases are numbered starting from zero. ** ** xInstCount: ** Set *pnInst to the total number of occurrences of all phrases within @@ -225920,12 +231551,13 @@ struct Fts5PhraseIter { ** Query for the details of phrase match iIdx within the current row. ** Phrase matches are numbered starting from zero, so the iIdx argument ** should be greater than or equal to zero and smaller than the value -** output by xInstCount(). +** output by xInstCount(). If iIdx is less than zero or greater than +** or equal to the value returned by xInstCount(), SQLITE_RANGE is returned. ** -** Usually, output parameter *piPhrase is set to the phrase number, *piCol +** Otherwise, output parameter *piPhrase is set to the phrase number, *piCol ** to the column in which it occurs and *piOff the token offset of the -** first token of the phrase. Returns SQLITE_OK if successful, or an error -** code (i.e. SQLITE_NOMEM) if an error occurs. +** first token of the phrase. SQLITE_OK is returned if successful, or an +** error code (i.e. SQLITE_NOMEM) if an error occurs. ** ** This API can be quite slow if used with an FTS5 table created with the ** "detail=none" or "detail=column" option. @@ -225951,6 +231583,10 @@ struct Fts5PhraseIter { ** Invoking Api.xUserData() returns a copy of the pointer passed as ** the third argument to pUserData. ** +** If parameter iPhrase is less than zero, or greater than or equal to +** the number of phrases in the query, as returned by xPhraseCount(), +** this function returns SQLITE_RANGE. +** ** If the callback function returns any value other than SQLITE_OK, the ** query is abandoned and the xQueryPhrase function returns immediately. ** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK. @@ -226065,9 +231701,42 @@ struct Fts5PhraseIter { ** ** xPhraseNextColumn() ** See xPhraseFirstColumn above. +** +** xQueryToken(pFts5, iPhrase, iToken, ppToken, pnToken) +** This is used to access token iToken of phrase iPhrase of the current +** query. Before returning, output parameter *ppToken is set to point +** to a buffer containing the requested token, and *pnToken to the +** size of this buffer in bytes. +** +** If iPhrase or iToken are less than zero, or if iPhrase is greater than +** or equal to the number of phrases in the query as reported by +** xPhraseCount(), or if iToken is equal to or greater than the number of +** tokens in the phrase, SQLITE_RANGE is returned and *ppToken and *pnToken + are both zeroed. +** +** The output text is not a copy of the query text that specified the +** token. It is the output of the tokenizer module. For tokendata=1 +** tables, this includes any embedded 0x00 and trailing data. +** +** xInstToken(pFts5, iIdx, iToken, ppToken, pnToken) +** This is used to access token iToken of phrase hit iIdx within the +** current row. If iIdx is less than zero or greater than or equal to the +** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise, +** output variable (*ppToken) is set to point to a buffer containing the +** matching document token, and (*pnToken) to the size of that buffer in +** bytes. This API is not available if the specified token matches a +** prefix query term. In that case both output variables are always set +** to 0. +** +** The output text is not a copy of the document text that was tokenized. +** It is the output of the tokenizer module. For tokendata=1 tables, this +** includes any embedded 0x00 and trailing data. +** +** This API can be quite slow if used with an FTS5 table created with the +** "detail=none" or "detail=column" option. */ struct Fts5ExtensionApi { - int iVersion; /* Currently always set to 2 */ + int iVersion; /* Currently always set to 3 */ void *(*xUserData)(Fts5Context*); @@ -226102,6 +231771,13 @@ struct Fts5ExtensionApi { int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*); void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol); + + /* Below this point are iVersion>=3 only */ + int (*xQueryToken)(Fts5Context*, + int iPhrase, int iToken, + const char **ppToken, int *pnToken + ); + int (*xInstToken)(Fts5Context*, int iIdx, int iToken, const char**, int*); }; /* @@ -226576,6 +232252,7 @@ struct Fts5Config { char *zContent; /* content table */ char *zContentRowid; /* "content_rowid=" option value */ int bColumnsize; /* "columnsize=" option value (dflt==1) */ + int bTokendata; /* "tokendata=" option value (dflt==0) */ int eDetail; /* FTS5_DETAIL_XXX value */ char *zContentExprlist; Fts5Tokenizer *pTok; @@ -226764,17 +232441,19 @@ struct Fts5IndexIter { /* ** Values used as part of the flags argument passed to IndexQuery(). */ -#define FTS5INDEX_QUERY_PREFIX 0x0001 /* Prefix query */ -#define FTS5INDEX_QUERY_DESC 0x0002 /* Docs in descending rowid order */ -#define FTS5INDEX_QUERY_TEST_NOIDX 0x0004 /* Do not use prefix index */ -#define FTS5INDEX_QUERY_SCAN 0x0008 /* Scan query (fts5vocab) */ +#define FTS5INDEX_QUERY_PREFIX 0x0001 /* Prefix query */ +#define FTS5INDEX_QUERY_DESC 0x0002 /* Docs in descending rowid order */ +#define FTS5INDEX_QUERY_TEST_NOIDX 0x0004 /* Do not use prefix index */ +#define FTS5INDEX_QUERY_SCAN 0x0008 /* Scan query (fts5vocab) */ /* The following are used internally by the fts5_index.c module. They are ** defined here only to make it easier to avoid clashes with the flags ** above. */ -#define FTS5INDEX_QUERY_SKIPEMPTY 0x0010 -#define FTS5INDEX_QUERY_NOOUTPUT 0x0020 -#define FTS5INDEX_QUERY_SKIPHASH 0x0040 +#define FTS5INDEX_QUERY_SKIPEMPTY 0x0010 +#define FTS5INDEX_QUERY_NOOUTPUT 0x0020 +#define FTS5INDEX_QUERY_SKIPHASH 0x0040 +#define FTS5INDEX_QUERY_NOTOKENDATA 0x0080 +#define FTS5INDEX_QUERY_SCANONETERM 0x0100 /* ** Create/destroy an Fts5Index object. @@ -226843,6 +232522,10 @@ static void *sqlite3Fts5StructureRef(Fts5Index*); static void sqlite3Fts5StructureRelease(void*); static int sqlite3Fts5StructureTest(Fts5Index*, void*); +/* +** Used by xInstToken(): +*/ +static int sqlite3Fts5IterToken(Fts5IndexIter*, i64, int, int, const char**, int*); /* ** Insert or remove data to or from the index. Each time a document is @@ -226920,6 +232603,13 @@ static int sqlite3Fts5IndexLoadConfig(Fts5Index *p); static int sqlite3Fts5IndexGetOrigin(Fts5Index *p, i64 *piOrigin); static int sqlite3Fts5IndexContentlessDelete(Fts5Index *p, i64 iOrigin, i64 iRowid); +static void sqlite3Fts5IndexIterClearTokendata(Fts5IndexIter*); + +/* Used to populate hash tables for xInstToken in detail=none/column mode. */ +static int sqlite3Fts5IndexIterWriteTokendata( + Fts5IndexIter*, const char*, int, i64 iRowid, int iCol, int iOff +); + /* ** End of interface to code in fts5_index.c. **************************************************************************/ @@ -227025,6 +232715,7 @@ static void sqlite3Fts5HashScanNext(Fts5Hash*); static int sqlite3Fts5HashScanEof(Fts5Hash*); static void sqlite3Fts5HashScanEntry(Fts5Hash *, const char **pzTerm, /* OUT: term (nul-terminated) */ + int *pnTerm, /* OUT: Size of term in bytes */ const u8 **ppDoclist, /* OUT: pointer to doclist */ int *pnDoclist /* OUT: size of doclist in bytes */ ); @@ -227151,6 +232842,10 @@ static int sqlite3Fts5ExprClonePhrase(Fts5Expr*, int, Fts5Expr**); static int sqlite3Fts5ExprPhraseCollist(Fts5Expr *, int, const u8 **, int *); +static int sqlite3Fts5ExprQueryToken(Fts5Expr*, int, int, const char**, int*); +static int sqlite3Fts5ExprInstToken(Fts5Expr*, i64, int, int, int, int, const char**, int*); +static void sqlite3Fts5ExprClearTokens(Fts5Expr*); + /******************************************* ** The fts5_expr.c API above this point is used by the other hand-written ** C code in this module. The interfaces below this point are called by @@ -227387,6 +233082,9 @@ static void sqlite3Fts5UnicodeAscii(u8*, u8*); ** sqlite3Fts5ParserARG_STORE Code to store %extra_argument into fts5yypParser ** sqlite3Fts5ParserARG_FETCH Code to extract %extra_argument from fts5yypParser ** sqlite3Fts5ParserCTX_* As sqlite3Fts5ParserARG_ except for %extra_context +** fts5YYREALLOC Name of the realloc() function to use +** fts5YYFREE Name of the free() function to use +** fts5YYDYNSTACK True if stack space should be extended on heap ** fts5YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** fts5YYNSTATE the combined number of states. @@ -227400,6 +233098,8 @@ static void sqlite3Fts5UnicodeAscii(u8*, u8*); ** fts5YY_NO_ACTION The fts5yy_action[] code for no-op ** fts5YY_MIN_REDUCE Minimum value for reduce actions ** fts5YY_MAX_REDUCE Maximum value for reduce actions +** fts5YY_MIN_DSTRCTR Minimum symbol value that has a destructor +** fts5YY_MAX_DSTRCTR Maximum symbol value that has a destructor */ #ifndef INTERFACE # define INTERFACE 1 @@ -227426,6 +233126,9 @@ typedef union { #define sqlite3Fts5ParserARG_PARAM ,pParse #define sqlite3Fts5ParserARG_FETCH Fts5Parse *pParse=fts5yypParser->pParse; #define sqlite3Fts5ParserARG_STORE fts5yypParser->pParse=pParse; +#define fts5YYREALLOC realloc +#define fts5YYFREE free +#define fts5YYDYNSTACK 0 #define sqlite3Fts5ParserCTX_SDECL #define sqlite3Fts5ParserCTX_PDECL #define sqlite3Fts5ParserCTX_PARAM @@ -227443,6 +233146,8 @@ typedef union { #define fts5YY_NO_ACTION 82 #define fts5YY_MIN_REDUCE 83 #define fts5YY_MAX_REDUCE 110 +#define fts5YY_MIN_DSTRCTR 16 +#define fts5YY_MAX_DSTRCTR 24 /************* End control #defines *******************************************/ #define fts5YY_NLOOKAHEAD ((int)(sizeof(fts5yy_lookahead)/sizeof(fts5yy_lookahead[0]))) @@ -227458,6 +233163,22 @@ typedef union { # define fts5yytestcase(X) #endif +/* Macro to determine if stack space has the ability to grow using +** heap memory. +*/ +#if fts5YYSTACKDEPTH<=0 || fts5YYDYNSTACK +# define fts5YYGROWABLESTACK 1 +#else +# define fts5YYGROWABLESTACK 0 +#endif + +/* Guarantee a minimum number of initial stack slots. +*/ +#if fts5YYSTACKDEPTH<=0 +# undef fts5YYSTACKDEPTH +# define fts5YYSTACKDEPTH 2 /* Need a minimum stack size */ +#endif + /* Next are the tables used to determine what action to take based on the ** current state and lookahead token. These tables are used to implement @@ -227618,14 +233339,9 @@ struct fts5yyParser { #endif sqlite3Fts5ParserARG_SDECL /* A place to hold %extra_argument */ sqlite3Fts5ParserCTX_SDECL /* A place to hold %extra_context */ -#if fts5YYSTACKDEPTH<=0 - int fts5yystksz; /* Current side of the stack */ - fts5yyStackEntry *fts5yystack; /* The parser's stack */ - fts5yyStackEntry fts5yystk0; /* First stack entry */ -#else - fts5yyStackEntry fts5yystack[fts5YYSTACKDEPTH]; /* The parser's stack */ - fts5yyStackEntry *fts5yystackEnd; /* Last entry in the stack */ -#endif + fts5yyStackEntry *fts5yystackEnd; /* Last entry in the stack */ + fts5yyStackEntry *fts5yystack; /* The parser stack */ + fts5yyStackEntry fts5yystk0[fts5YYSTACKDEPTH]; /* Initial stack space */ }; typedef struct fts5yyParser fts5yyParser; @@ -227732,37 +233448,45 @@ static const char *const fts5yyRuleName[] = { #endif /* NDEBUG */ -#if fts5YYSTACKDEPTH<=0 +#if fts5YYGROWABLESTACK /* ** Try to increase the size of the parser stack. Return the number ** of errors. Return 0 on success. */ static int fts5yyGrowStack(fts5yyParser *p){ + int oldSize = 1 + (int)(p->fts5yystackEnd - p->fts5yystack); int newSize; int idx; fts5yyStackEntry *pNew; - newSize = p->fts5yystksz*2 + 100; - idx = p->fts5yytos ? (int)(p->fts5yytos - p->fts5yystack) : 0; - if( p->fts5yystack==&p->fts5yystk0 ){ - pNew = malloc(newSize*sizeof(pNew[0])); - if( pNew ) pNew[0] = p->fts5yystk0; + newSize = oldSize*2 + 100; + idx = (int)(p->fts5yytos - p->fts5yystack); + if( p->fts5yystack==p->fts5yystk0 ){ + pNew = fts5YYREALLOC(0, newSize*sizeof(pNew[0])); + if( pNew==0 ) return 1; + memcpy(pNew, p->fts5yystack, oldSize*sizeof(pNew[0])); }else{ - pNew = realloc(p->fts5yystack, newSize*sizeof(pNew[0])); + pNew = fts5YYREALLOC(p->fts5yystack, newSize*sizeof(pNew[0])); + if( pNew==0 ) return 1; } - if( pNew ){ - p->fts5yystack = pNew; - p->fts5yytos = &p->fts5yystack[idx]; + p->fts5yystack = pNew; + p->fts5yytos = &p->fts5yystack[idx]; #ifndef NDEBUG - if( fts5yyTraceFILE ){ - fprintf(fts5yyTraceFILE,"%sStack grows from %d to %d entries.\n", - fts5yyTracePrompt, p->fts5yystksz, newSize); - } -#endif - p->fts5yystksz = newSize; + if( fts5yyTraceFILE ){ + fprintf(fts5yyTraceFILE,"%sStack grows from %d to %d entries.\n", + fts5yyTracePrompt, oldSize, newSize); } - return pNew==0; +#endif + p->fts5yystackEnd = &p->fts5yystack[newSize-1]; + return 0; } +#endif /* fts5YYGROWABLESTACK */ + +#if !fts5YYGROWABLESTACK +/* For builds that do no have a growable stack, fts5yyGrowStack always +** returns an error. +*/ +# define fts5yyGrowStack(X) 1 #endif /* Datatype of the argument to the memory allocated passed as the @@ -227782,24 +233506,14 @@ static void sqlite3Fts5ParserInit(void *fts5yypRawParser sqlite3Fts5ParserCTX_PD #ifdef fts5YYTRACKMAXSTACKDEPTH fts5yypParser->fts5yyhwm = 0; #endif -#if fts5YYSTACKDEPTH<=0 - fts5yypParser->fts5yytos = NULL; - fts5yypParser->fts5yystack = NULL; - fts5yypParser->fts5yystksz = 0; - if( fts5yyGrowStack(fts5yypParser) ){ - fts5yypParser->fts5yystack = &fts5yypParser->fts5yystk0; - fts5yypParser->fts5yystksz = 1; - } -#endif + fts5yypParser->fts5yystack = fts5yypParser->fts5yystk0; + fts5yypParser->fts5yystackEnd = &fts5yypParser->fts5yystack[fts5YYSTACKDEPTH-1]; #ifndef fts5YYNOERRORRECOVERY fts5yypParser->fts5yyerrcnt = -1; #endif fts5yypParser->fts5yytos = fts5yypParser->fts5yystack; fts5yypParser->fts5yystack[0].stateno = 0; fts5yypParser->fts5yystack[0].major = 0; -#if fts5YYSTACKDEPTH>0 - fts5yypParser->fts5yystackEnd = &fts5yypParser->fts5yystack[fts5YYSTACKDEPTH-1]; -#endif } #ifndef sqlite3Fts5Parser_ENGINEALWAYSONSTACK @@ -227913,9 +233627,26 @@ static void fts5yy_pop_parser_stack(fts5yyParser *pParser){ */ static void sqlite3Fts5ParserFinalize(void *p){ fts5yyParser *pParser = (fts5yyParser*)p; - while( pParser->fts5yytos>pParser->fts5yystack ) fts5yy_pop_parser_stack(pParser); -#if fts5YYSTACKDEPTH<=0 - if( pParser->fts5yystack!=&pParser->fts5yystk0 ) free(pParser->fts5yystack); + + /* In-lined version of calling fts5yy_pop_parser_stack() for each + ** element left in the stack */ + fts5yyStackEntry *fts5yytos = pParser->fts5yytos; + while( fts5yytos>pParser->fts5yystack ){ +#ifndef NDEBUG + if( fts5yyTraceFILE ){ + fprintf(fts5yyTraceFILE,"%sPopping %s\n", + fts5yyTracePrompt, + fts5yyTokenName[fts5yytos->major]); + } +#endif + if( fts5yytos->major>=fts5YY_MIN_DSTRCTR ){ + fts5yy_destructor(pParser, fts5yytos->major, &fts5yytos->minor); + } + fts5yytos--; + } + +#if fts5YYGROWABLESTACK + if( pParser->fts5yystack!=pParser->fts5yystk0 ) fts5YYFREE(pParser->fts5yystack); #endif } @@ -228142,25 +233873,19 @@ static void fts5yy_shift( assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack) ); } #endif -#if fts5YYSTACKDEPTH>0 - if( fts5yypParser->fts5yytos>fts5yypParser->fts5yystackEnd ){ - fts5yypParser->fts5yytos--; - fts5yyStackOverflow(fts5yypParser); - return; - } -#else - if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz] ){ + fts5yytos = fts5yypParser->fts5yytos; + if( fts5yytos>fts5yypParser->fts5yystackEnd ){ if( fts5yyGrowStack(fts5yypParser) ){ fts5yypParser->fts5yytos--; fts5yyStackOverflow(fts5yypParser); return; } + fts5yytos = fts5yypParser->fts5yytos; + assert( fts5yytos <= fts5yypParser->fts5yystackEnd ); } -#endif if( fts5yyNewState > fts5YY_MAX_SHIFT ){ fts5yyNewState += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; } - fts5yytos = fts5yypParser->fts5yytos; fts5yytos->stateno = fts5yyNewState; fts5yytos->major = fts5yyMajor; fts5yytos->minor.fts5yy0 = fts5yyMinor; @@ -228597,19 +234322,12 @@ static void sqlite3Fts5Parser( (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)); } #endif -#if fts5YYSTACKDEPTH>0 if( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystackEnd ){ - fts5yyStackOverflow(fts5yypParser); - break; - } -#else - if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){ if( fts5yyGrowStack(fts5yypParser) ){ fts5yyStackOverflow(fts5yypParser); break; } } -#endif } fts5yyact = fts5yy_reduce(fts5yypParser,fts5yyruleno,fts5yymajor,fts5yyminor sqlite3Fts5ParserCTX_PARAM); }else if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){ @@ -228865,15 +234583,19 @@ static int fts5CInstIterInit( */ typedef struct HighlightContext HighlightContext; struct HighlightContext { - CInstIter iter; /* Coalesced Instance Iterator */ - int iPos; /* Current token offset in zIn[] */ + /* Constant parameters to fts5HighlightCb() */ int iRangeStart; /* First token to include */ int iRangeEnd; /* If non-zero, last token to include */ const char *zOpen; /* Opening highlight */ const char *zClose; /* Closing highlight */ const char *zIn; /* Input text */ int nIn; /* Size of input text in bytes */ - int iOff; /* Current offset within zIn[] */ + + /* Variables modified by fts5HighlightCb() */ + CInstIter iter; /* Coalesced Instance Iterator */ + int iPos; /* Current token offset in zIn[] */ + int iOff; /* Have copied up to this offset in zIn[] */ + int bOpen; /* True if highlight is open */ char *zOut; /* Output value */ }; @@ -228906,8 +234628,8 @@ static int fts5HighlightCb( int tflags, /* Mask of FTS5_TOKEN_* flags */ const char *pToken, /* Buffer containing token */ int nToken, /* Size of token in bytes */ - int iStartOff, /* Start offset of token */ - int iEndOff /* End offset of token */ + int iStartOff, /* Start byte offset of token */ + int iEndOff /* End byte offset of token */ ){ HighlightContext *p = (HighlightContext*)pContext; int rc = SQLITE_OK; @@ -228923,30 +234645,55 @@ static int fts5HighlightCb( if( p->iRangeStart && iPos==p->iRangeStart ) p->iOff = iStartOff; } - if( iPos==p->iter.iStart ){ + /* If the parenthesis is open, and this token is not part of the current + ** phrase, and the starting byte offset of this token is past the point + ** that has currently been copied into the output buffer, close the + ** parenthesis. */ + if( p->bOpen + && (iPos<=p->iter.iStart || p->iter.iStart<0) + && iStartOff>p->iOff + ){ + fts5HighlightAppend(&rc, p, p->zClose, -1); + p->bOpen = 0; + } + + /* If this is the start of a new phrase, and the highlight is not open: + ** + ** * copy text from the input up to the start of the phrase, and + ** * open the highlight. + */ + if( iPos==p->iter.iStart && p->bOpen==0 ){ fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iStartOff - p->iOff); fts5HighlightAppend(&rc, p, p->zOpen, -1); p->iOff = iStartOff; + p->bOpen = 1; } if( iPos==p->iter.iEnd ){ - if( p->iRangeEnd>=0 && p->iter.iStartiRangeStart ){ + if( p->bOpen==0 ){ + assert( p->iRangeEnd>=0 ); fts5HighlightAppend(&rc, p, p->zOpen, -1); + p->bOpen = 1; } fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff); - fts5HighlightAppend(&rc, p, p->zClose, -1); p->iOff = iEndOff; + if( rc==SQLITE_OK ){ rc = fts5CInstIterNext(&p->iter); } } - if( p->iRangeEnd>=0 && iPos==p->iRangeEnd ){ - fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff); - p->iOff = iEndOff; - if( iPos>=p->iter.iStart && iPositer.iEnd ){ + if( iPos==p->iRangeEnd ){ + if( p->bOpen ){ + if( p->iter.iStart>=0 && iPos>=p->iter.iStart ){ + fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff); + p->iOff = iEndOff; + } fts5HighlightAppend(&rc, p, p->zClose, -1); + p->bOpen = 0; } + fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff); + p->iOff = iEndOff; } return rc; @@ -228978,8 +234725,10 @@ static void fts5HighlightFunction( ctx.zClose = (const char*)sqlite3_value_text(apVal[2]); ctx.iRangeEnd = -1; rc = pApi->xColumnText(pFts, iCol, &ctx.zIn, &ctx.nIn); - - if( ctx.zIn ){ + if( rc==SQLITE_RANGE ){ + sqlite3_result_text(pCtx, "", -1, SQLITE_STATIC); + rc = SQLITE_OK; + }else if( ctx.zIn ){ if( rc==SQLITE_OK ){ rc = fts5CInstIterInit(pApi, pFts, iCol, &ctx.iter); } @@ -228987,6 +234736,9 @@ static void fts5HighlightFunction( if( rc==SQLITE_OK ){ rc = pApi->xTokenize(pFts, ctx.zIn, ctx.nIn, (void*)&ctx,fts5HighlightCb); } + if( ctx.bOpen ){ + fts5HighlightAppend(&rc, &ctx, ctx.zClose, -1); + } fts5HighlightAppend(&rc, &ctx, &ctx.zIn[ctx.iOff], ctx.nIn - ctx.iOff); if( rc==SQLITE_OK ){ @@ -229265,6 +235017,9 @@ static void fts5SnippetFunction( if( rc==SQLITE_OK ){ rc = pApi->xTokenize(pFts, ctx.zIn, ctx.nIn, (void*)&ctx,fts5HighlightCb); } + if( ctx.bOpen ){ + fts5HighlightAppend(&rc, &ctx, ctx.zClose, -1); + } if( ctx.iRangeEnd>=(nColSize-1) ){ fts5HighlightAppend(&rc, &ctx, &ctx.zIn[ctx.iOff], ctx.nIn - ctx.iOff); }else{ @@ -229540,6 +235295,7 @@ static void sqlite3Fts5BufferAppendBlob( ){ if( nData ){ if( fts5BufferGrow(pRc, pBuf, nData) ) return; + assert( pBuf->p!=0 ); memcpy(&pBuf->p[pBuf->n], pData, nData); pBuf->n += nData; } @@ -229641,6 +235397,7 @@ static int sqlite3Fts5PoslistNext64( i64 *piOff /* IN/OUT: Current offset */ ){ int i = *pi; + assert( a!=0 || i==0 ); if( i>=n ){ /* EOF */ *piOff = -1; @@ -229648,6 +235405,7 @@ static int sqlite3Fts5PoslistNext64( }else{ i64 iOff = *piOff; u32 iVal; + assert( a!=0 ); fts5FastGetVarint32(a, i, iVal); if( iVal<=1 ){ if( iVal==0 ){ @@ -230279,6 +236037,16 @@ static int fts5ConfigParseSpecial( return rc; } + if( sqlite3_strnicmp("tokendata", zCmd, nCmd)==0 ){ + if( (zArg[0]!='0' && zArg[0]!='1') || zArg[1]!='\0' ){ + *pzErr = sqlite3_mprintf("malformed tokendata=... directive"); + rc = SQLITE_ERROR; + }else{ + pConfig->bTokendata = (zArg[0]=='1'); + } + return rc; + } + *pzErr = sqlite3_mprintf("unrecognized option: \"%.*s\"", nCmd, zCmd); return SQLITE_ERROR; } @@ -231012,7 +236780,9 @@ struct Fts5ExprNode { struct Fts5ExprTerm { u8 bPrefix; /* True for a prefix term */ u8 bFirst; /* True if token must be first in column */ - char *zTerm; /* nul-terminated term */ + char *pTerm; /* Term data */ + int nQueryTerm; /* Effective size of term in bytes */ + int nFullTerm; /* Size of term in bytes incl. tokendata */ Fts5IndexIter *pIter; /* Iterator for this term */ Fts5ExprTerm *pSynonym; /* Pointer to first in list of synonyms */ }; @@ -231879,7 +237649,7 @@ static int fts5ExprNearInitAll( p->pIter = 0; } rc = sqlite3Fts5IndexQuery( - pExpr->pIndex, p->zTerm, (int)strlen(p->zTerm), + pExpr->pIndex, p->pTerm, p->nQueryTerm, (pTerm->bPrefix ? FTS5INDEX_QUERY_PREFIX : 0) | (pExpr->bDesc ? FTS5INDEX_QUERY_DESC : 0), pNear->pColset, @@ -232516,7 +238286,7 @@ static void fts5ExprPhraseFree(Fts5ExprPhrase *pPhrase){ Fts5ExprTerm *pSyn; Fts5ExprTerm *pNext; Fts5ExprTerm *pTerm = &pPhrase->aTerm[i]; - sqlite3_free(pTerm->zTerm); + sqlite3_free(pTerm->pTerm); sqlite3Fts5IterClose(pTerm->pIter); for(pSyn=pTerm->pSynonym; pSyn; pSyn=pNext){ pNext = pSyn->pSynonym; @@ -232614,6 +238384,7 @@ static Fts5ExprNearset *sqlite3Fts5ParseNearset( typedef struct TokenCtx TokenCtx; struct TokenCtx { Fts5ExprPhrase *pPhrase; + Fts5Config *pConfig; int rc; }; @@ -232647,8 +238418,12 @@ static int fts5ParseTokenize( rc = SQLITE_NOMEM; }else{ memset(pSyn, 0, (size_t)nByte); - pSyn->zTerm = ((char*)pSyn) + sizeof(Fts5ExprTerm) + sizeof(Fts5Buffer); - memcpy(pSyn->zTerm, pToken, nToken); + pSyn->pTerm = ((char*)pSyn) + sizeof(Fts5ExprTerm) + sizeof(Fts5Buffer); + pSyn->nFullTerm = pSyn->nQueryTerm = nToken; + if( pCtx->pConfig->bTokendata ){ + pSyn->nQueryTerm = (int)strlen(pSyn->pTerm); + } + memcpy(pSyn->pTerm, pToken, nToken); pSyn->pSynonym = pPhrase->aTerm[pPhrase->nTerm-1].pSynonym; pPhrase->aTerm[pPhrase->nTerm-1].pSynonym = pSyn; } @@ -232673,7 +238448,11 @@ static int fts5ParseTokenize( if( rc==SQLITE_OK ){ pTerm = &pPhrase->aTerm[pPhrase->nTerm++]; memset(pTerm, 0, sizeof(Fts5ExprTerm)); - pTerm->zTerm = sqlite3Fts5Strndup(&rc, pToken, nToken); + pTerm->pTerm = sqlite3Fts5Strndup(&rc, pToken, nToken); + pTerm->nFullTerm = pTerm->nQueryTerm = nToken; + if( pCtx->pConfig->bTokendata && rc==SQLITE_OK ){ + pTerm->nQueryTerm = (int)strlen(pTerm->pTerm); + } } } @@ -232740,6 +238519,7 @@ static Fts5ExprPhrase *sqlite3Fts5ParseTerm( memset(&sCtx, 0, sizeof(TokenCtx)); sCtx.pPhrase = pAppend; + sCtx.pConfig = pConfig; rc = fts5ParseStringFromToken(pToken, &z); if( rc==SQLITE_OK ){ @@ -232787,12 +238567,15 @@ static int sqlite3Fts5ExprClonePhrase( Fts5Expr **ppNew ){ int rc = SQLITE_OK; /* Return code */ - Fts5ExprPhrase *pOrig; /* The phrase extracted from pExpr */ + Fts5ExprPhrase *pOrig = 0; /* The phrase extracted from pExpr */ Fts5Expr *pNew = 0; /* Expression to return via *ppNew */ - TokenCtx sCtx = {0,0}; /* Context object for fts5ParseTokenize */ - - pOrig = pExpr->apExprPhrase[iPhrase]; - pNew = (Fts5Expr*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5Expr)); + TokenCtx sCtx = {0,0,0}; /* Context object for fts5ParseTokenize */ + if( iPhrase<0 || iPhrase>=pExpr->nPhrase ){ + rc = SQLITE_RANGE; + }else{ + pOrig = pExpr->apExprPhrase[iPhrase]; + pNew = (Fts5Expr*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5Expr)); + } if( rc==SQLITE_OK ){ pNew->apExprPhrase = (Fts5ExprPhrase**)sqlite3Fts5MallocZero(&rc, sizeof(Fts5ExprPhrase*)); @@ -232805,7 +238588,7 @@ static int sqlite3Fts5ExprClonePhrase( pNew->pRoot->pNear = (Fts5ExprNearset*)sqlite3Fts5MallocZero(&rc, sizeof(Fts5ExprNearset) + sizeof(Fts5ExprPhrase*)); } - if( rc==SQLITE_OK ){ + if( rc==SQLITE_OK && ALWAYS(pOrig!=0) ){ Fts5Colset *pColsetOrig = pOrig->pNode->pNear->pColset; if( pColsetOrig ){ sqlite3_int64 nByte; @@ -232819,26 +238602,27 @@ static int sqlite3Fts5ExprClonePhrase( } } - if( pOrig->nTerm ){ - int i; /* Used to iterate through phrase terms */ - for(i=0; rc==SQLITE_OK && inTerm; i++){ - int tflags = 0; - Fts5ExprTerm *p; - for(p=&pOrig->aTerm[i]; p && rc==SQLITE_OK; p=p->pSynonym){ - const char *zTerm = p->zTerm; - rc = fts5ParseTokenize((void*)&sCtx, tflags, zTerm, (int)strlen(zTerm), - 0, 0); - tflags = FTS5_TOKEN_COLOCATED; - } - if( rc==SQLITE_OK ){ - sCtx.pPhrase->aTerm[i].bPrefix = pOrig->aTerm[i].bPrefix; - sCtx.pPhrase->aTerm[i].bFirst = pOrig->aTerm[i].bFirst; + if( rc==SQLITE_OK ){ + if( pOrig->nTerm ){ + int i; /* Used to iterate through phrase terms */ + sCtx.pConfig = pExpr->pConfig; + for(i=0; rc==SQLITE_OK && inTerm; i++){ + int tflags = 0; + Fts5ExprTerm *p; + for(p=&pOrig->aTerm[i]; p && rc==SQLITE_OK; p=p->pSynonym){ + rc = fts5ParseTokenize((void*)&sCtx,tflags,p->pTerm,p->nFullTerm,0,0); + tflags = FTS5_TOKEN_COLOCATED; + } + if( rc==SQLITE_OK ){ + sCtx.pPhrase->aTerm[i].bPrefix = pOrig->aTerm[i].bPrefix; + sCtx.pPhrase->aTerm[i].bFirst = pOrig->aTerm[i].bFirst; + } } + }else{ + /* This happens when parsing a token or quoted phrase that contains + ** no token characters at all. (e.g ... MATCH '""'). */ + sCtx.pPhrase = sqlite3Fts5MallocZero(&rc, sizeof(Fts5ExprPhrase)); } - }else{ - /* This happens when parsing a token or quoted phrase that contains - ** no token characters at all. (e.g ... MATCH '""'). */ - sCtx.pPhrase = sqlite3Fts5MallocZero(&rc, sizeof(Fts5ExprPhrase)); } if( rc==SQLITE_OK && ALWAYS(sCtx.pPhrase) ){ @@ -233208,11 +238992,13 @@ static Fts5ExprNode *fts5ParsePhraseToAnd( if( parseGrowPhraseArray(pParse) ){ fts5ExprPhraseFree(pPhrase); }else{ + Fts5ExprTerm *p = &pNear->apPhrase[0]->aTerm[ii]; + Fts5ExprTerm *pTo = &pPhrase->aTerm[0]; pParse->apPhrase[pParse->nPhrase++] = pPhrase; pPhrase->nTerm = 1; - pPhrase->aTerm[0].zTerm = sqlite3Fts5Strndup( - &pParse->rc, pNear->apPhrase[0]->aTerm[ii].zTerm, -1 - ); + pTo->pTerm = sqlite3Fts5Strndup(&pParse->rc, p->pTerm, p->nFullTerm); + pTo->nQueryTerm = p->nQueryTerm; + pTo->nFullTerm = p->nFullTerm; pRet->apChild[ii] = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, sqlite3Fts5ParseNearset(pParse, 0, pPhrase) ); @@ -233397,16 +239183,17 @@ static char *fts5ExprTermPrint(Fts5ExprTerm *pTerm){ /* Determine the maximum amount of space required. */ for(p=pTerm; p; p=p->pSynonym){ - nByte += (int)strlen(pTerm->zTerm) * 2 + 3 + 2; + nByte += pTerm->nQueryTerm * 2 + 3 + 2; } zQuoted = sqlite3_malloc64(nByte); if( zQuoted ){ int i = 0; for(p=pTerm; p; p=p->pSynonym){ - char *zIn = p->zTerm; + char *zIn = p->pTerm; + char *zEnd = &zIn[p->nQueryTerm]; zQuoted[i++] = '"'; - while( *zIn ){ + while( zInnTerm; iTerm++){ - char *zTerm = pPhrase->aTerm[iTerm].zTerm; - zRet = fts5PrintfAppend(zRet, "%s%s", iTerm==0?"":" ", zTerm); + Fts5ExprTerm *p = &pPhrase->aTerm[iTerm]; + zRet = fts5PrintfAppend(zRet, "%s%.*s", iTerm==0?"":" ", + p->nQueryTerm, p->pTerm + ); if( pPhrase->aTerm[iTerm].bPrefix ){ zRet = fts5PrintfAppend(zRet, "*"); } @@ -233886,6 +239675,17 @@ static int fts5ExprColsetTest(Fts5Colset *pColset, int iCol){ return 0; } +/* +** pToken is a buffer nToken bytes in size that may or may not contain +** an embedded 0x00 byte. If it does, return the number of bytes in +** the buffer before the 0x00. If it does not, return nToken. +*/ +static int fts5QueryTerm(const char *pToken, int nToken){ + int ii; + for(ii=0; iipExpr; int i; + int nQuery = nToken; + i64 iRowid = pExpr->pRoot->iRowid; UNUSED_PARAM2(iUnused1, iUnused2); - if( nToken>FTS5_MAX_TOKEN_SIZE ) nToken = FTS5_MAX_TOKEN_SIZE; + if( nQuery>FTS5_MAX_TOKEN_SIZE ) nQuery = FTS5_MAX_TOKEN_SIZE; + if( pExpr->pConfig->bTokendata ){ + nQuery = fts5QueryTerm(pToken, nQuery); + } if( (tflags & FTS5_TOKEN_COLOCATED)==0 ) p->iOff++; for(i=0; inPhrase; i++){ - Fts5ExprTerm *pTerm; + Fts5ExprTerm *pT; if( p->aPopulator[i].bOk==0 ) continue; - for(pTerm=&pExpr->apExprPhrase[i]->aTerm[0]; pTerm; pTerm=pTerm->pSynonym){ - int nTerm = (int)strlen(pTerm->zTerm); - if( (nTerm==nToken || (nTermbPrefix)) - && memcmp(pTerm->zTerm, pToken, nTerm)==0 + for(pT=&pExpr->apExprPhrase[i]->aTerm[0]; pT; pT=pT->pSynonym){ + if( (pT->nQueryTerm==nQuery || (pT->nQueryTermbPrefix)) + && memcmp(pT->pTerm, pToken, pT->nQueryTerm)==0 ){ int rc = sqlite3Fts5PoslistWriterAppend( &pExpr->apExprPhrase[i]->poslist, &p->aPopulator[i].writer, p->iOff ); + if( rc==SQLITE_OK && pExpr->pConfig->bTokendata && !pT->bPrefix ){ + int iCol = p->iOff>>32; + int iTokOff = p->iOff & 0x7FFFFFFF; + rc = sqlite3Fts5IndexIterWriteTokendata( + pT->pIter, pToken, nToken, iRowid, iCol, iTokOff + ); + } if( rc ) return rc; break; } @@ -234048,6 +239859,83 @@ static int sqlite3Fts5ExprPhraseCollist( return rc; } +/* +** Does the work of the fts5_api.xQueryToken() API method. +*/ +static int sqlite3Fts5ExprQueryToken( + Fts5Expr *pExpr, + int iPhrase, + int iToken, + const char **ppOut, + int *pnOut +){ + Fts5ExprPhrase *pPhrase = 0; + + if( iPhrase<0 || iPhrase>=pExpr->nPhrase ){ + return SQLITE_RANGE; + } + pPhrase = pExpr->apExprPhrase[iPhrase]; + if( iToken<0 || iToken>=pPhrase->nTerm ){ + return SQLITE_RANGE; + } + + *ppOut = pPhrase->aTerm[iToken].pTerm; + *pnOut = pPhrase->aTerm[iToken].nFullTerm; + return SQLITE_OK; +} + +/* +** Does the work of the fts5_api.xInstToken() API method. +*/ +static int sqlite3Fts5ExprInstToken( + Fts5Expr *pExpr, + i64 iRowid, + int iPhrase, + int iCol, + int iOff, + int iToken, + const char **ppOut, + int *pnOut +){ + Fts5ExprPhrase *pPhrase = 0; + Fts5ExprTerm *pTerm = 0; + int rc = SQLITE_OK; + + if( iPhrase<0 || iPhrase>=pExpr->nPhrase ){ + return SQLITE_RANGE; + } + pPhrase = pExpr->apExprPhrase[iPhrase]; + if( iToken<0 || iToken>=pPhrase->nTerm ){ + return SQLITE_RANGE; + } + pTerm = &pPhrase->aTerm[iToken]; + if( pTerm->bPrefix==0 ){ + if( pExpr->pConfig->bTokendata ){ + rc = sqlite3Fts5IterToken( + pTerm->pIter, iRowid, iCol, iOff+iToken, ppOut, pnOut + ); + }else{ + *ppOut = pTerm->pTerm; + *pnOut = pTerm->nFullTerm; + } + } + return rc; +} + +/* +** Clear the token mappings for all Fts5IndexIter objects mannaged by +** the expression passed as the only argument. +*/ +static void sqlite3Fts5ExprClearTokens(Fts5Expr *pExpr){ + int ii; + for(ii=0; iinPhrase; ii++){ + Fts5ExprTerm *pT; + for(pT=&pExpr->apExprPhrase[ii]->aTerm[0]; pT; pT=pT->pSynonym){ + sqlite3Fts5IndexIterClearTokendata(pT->pIter); + } + } +} + /* ** 2014 August 11 ** @@ -234086,10 +239974,15 @@ struct Fts5Hash { /* ** Each entry in the hash table is represented by an object of the -** following type. Each object, its key (a nul-terminated string) and -** its current data are stored in a single memory allocation. The -** key immediately follows the object in memory. The position list -** data immediately follows the key data in memory. +** following type. Each object, its key, and its current data are stored +** in a single memory allocation. The key immediately follows the object +** in memory. The position list data immediately follows the key data +** in memory. +** +** The key is Fts5HashEntry.nKey bytes in size. It consists of a single +** byte identifying the index (either the main term index or a prefix-index), +** followed by the term data. For example: "0token". There is no +** nul-terminator - in this case nKey=6. ** ** The data that follows the key is in a similar, but not identical format ** to the doclist data stored in the database. It is: @@ -234224,8 +240117,7 @@ static int fts5HashResize(Fts5Hash *pHash){ unsigned int iHash; Fts5HashEntry *p = apOld[i]; apOld[i] = p->pHashNext; - iHash = fts5HashKey(nNew, (u8*)fts5EntryKey(p), - (int)strlen(fts5EntryKey(p))); + iHash = fts5HashKey(nNew, (u8*)fts5EntryKey(p), p->nKey); p->pHashNext = apNew[iHash]; apNew[iHash] = p; } @@ -234309,7 +240201,7 @@ static int sqlite3Fts5HashWrite( for(p=pHash->aSlot[iHash]; p; p=p->pHashNext){ char *zKey = fts5EntryKey(p); if( zKey[0]==bByte - && p->nKey==nToken + && p->nKey==nToken+1 && memcmp(&zKey[1], pToken, nToken)==0 ){ break; @@ -234339,9 +240231,9 @@ static int sqlite3Fts5HashWrite( zKey[0] = bByte; memcpy(&zKey[1], pToken, nToken); assert( iHash==fts5HashKey(pHash->nSlot, (u8*)zKey, nToken+1) ); - p->nKey = nToken; + p->nKey = nToken+1; zKey[nToken+1] = '\0'; - p->nData = nToken+1 + 1 + sizeof(Fts5HashEntry); + p->nData = nToken+1 + sizeof(Fts5HashEntry); p->pHashNext = pHash->aSlot[iHash]; pHash->aSlot[iHash] = p; pHash->nEntry++; @@ -234458,12 +240350,17 @@ static Fts5HashEntry *fts5HashEntryMerge( *ppOut = p1; p1 = 0; }else{ - int i = 0; char *zKey1 = fts5EntryKey(p1); char *zKey2 = fts5EntryKey(p2); - while( zKey1[i]==zKey2[i] ) i++; + int nMin = MIN(p1->nKey, p2->nKey); + + int cmp = memcmp(zKey1, zKey2, nMin); + if( cmp==0 ){ + cmp = p1->nKey - p2->nKey; + } + assert( cmp!=0 ); - if( ((u8)zKey1[i])>((u8)zKey2[i]) ){ + if( cmp>0 ){ /* p2 is smaller */ *ppOut = p2; ppOut = &p2->pScanNext; @@ -234482,10 +240379,8 @@ static Fts5HashEntry *fts5HashEntryMerge( } /* -** Extract all tokens from hash table iHash and link them into a list -** in sorted order. The hash table is cleared before returning. It is -** the responsibility of the caller to free the elements of the returned -** list. +** Link all tokens from hash table iHash into a list in sorted order. The +** tokens are not removed from the hash table. */ static int fts5HashEntrySort( Fts5Hash *pHash, @@ -234507,7 +240402,7 @@ static int fts5HashEntrySort( Fts5HashEntry *pIter; for(pIter=pHash->aSlot[iSlot]; pIter; pIter=pIter->pHashNext){ if( pTerm==0 - || (pIter->nKey+1>=nTerm && 0==memcmp(fts5EntryKey(pIter), pTerm, nTerm)) + || (pIter->nKey>=nTerm && 0==memcmp(fts5EntryKey(pIter), pTerm, nTerm)) ){ Fts5HashEntry *pEntry = pIter; pEntry->pScanNext = 0; @@ -234546,12 +240441,11 @@ static int sqlite3Fts5HashQuery( for(p=pHash->aSlot[iHash]; p; p=p->pHashNext){ zKey = fts5EntryKey(p); - assert( p->nKey+1==(int)strlen(zKey) ); - if( nTerm==p->nKey+1 && memcmp(zKey, pTerm, nTerm)==0 ) break; + if( nTerm==p->nKey && memcmp(zKey, pTerm, nTerm)==0 ) break; } if( p ){ - int nHashPre = sizeof(Fts5HashEntry) + nTerm + 1; + int nHashPre = sizeof(Fts5HashEntry) + nTerm; int nList = p->nData - nHashPre; u8 *pRet = (u8*)(*ppOut = sqlite3_malloc64(nPre + nList + 10)); if( pRet ){ @@ -234612,19 +240506,22 @@ static int sqlite3Fts5HashScanEof(Fts5Hash *p){ static void sqlite3Fts5HashScanEntry( Fts5Hash *pHash, const char **pzTerm, /* OUT: term (nul-terminated) */ + int *pnTerm, /* OUT: Size of term in bytes */ const u8 **ppDoclist, /* OUT: pointer to doclist */ int *pnDoclist /* OUT: size of doclist in bytes */ ){ Fts5HashEntry *p; if( (p = pHash->pScan) ){ char *zKey = fts5EntryKey(p); - int nTerm = (int)strlen(zKey); + int nTerm = p->nKey; fts5HashAddPoslistSize(pHash, p, 0); *pzTerm = zKey; - *ppDoclist = (const u8*)&zKey[nTerm+1]; - *pnDoclist = p->nData - (sizeof(Fts5HashEntry) + nTerm + 1); + *pnTerm = nTerm; + *ppDoclist = (const u8*)&zKey[nTerm]; + *pnDoclist = p->nData - (sizeof(Fts5HashEntry) + nTerm); }else{ *pzTerm = 0; + *pnTerm = 0; *ppDoclist = 0; *pnDoclist = 0; } @@ -234955,6 +240852,9 @@ typedef struct Fts5SegWriter Fts5SegWriter; typedef struct Fts5Structure Fts5Structure; typedef struct Fts5StructureLevel Fts5StructureLevel; typedef struct Fts5StructureSegment Fts5StructureSegment; +typedef struct Fts5TokenDataIter Fts5TokenDataIter; +typedef struct Fts5TokenDataMap Fts5TokenDataMap; +typedef struct Fts5TombstoneArray Fts5TombstoneArray; struct Fts5Data { u8 *p; /* Pointer to buffer containing record */ @@ -234989,6 +240889,7 @@ struct Fts5Index { /* Error state. */ int rc; /* Current error code */ + int flushRc; /* State used by the fts5DataXXX() functions. */ sqlite3_blob *pReader; /* RO incr-blob open on %_data table */ @@ -234997,6 +240898,7 @@ struct Fts5Index { sqlite3_stmt *pIdxWriter; /* "INSERT ... %_idx VALUES(?,?,?,?)" */ sqlite3_stmt *pIdxDeleter; /* "DELETE FROM %_idx WHERE segid=?" */ sqlite3_stmt *pIdxSelect; + sqlite3_stmt *pIdxNextSelect; int nRead; /* Total number of blocks read */ sqlite3_stmt *pDeleteFromIdx; @@ -235150,8 +241052,7 @@ struct Fts5SegIter { Fts5Data *pLeaf; /* Current leaf data */ Fts5Data *pNextLeaf; /* Leaf page (iLeafPgno+1) */ i64 iLeafOffset; /* Byte offset within current leaf */ - Fts5Data **apTombstone; /* Array of tombstone pages */ - int nTombstone; + Fts5TombstoneArray *pTombArray; /* Array of tombstone pages */ /* Next method */ void (*xNext)(Fts5Index*, Fts5SegIter*, int*); @@ -235178,6 +241079,15 @@ struct Fts5SegIter { u8 bDel; /* True if the delete flag is set */ }; +/* +** Array of tombstone pages. Reference counted. +*/ +struct Fts5TombstoneArray { + int nRef; /* Number of pointers to this object */ + int nTombstone; + Fts5Data *apTombstone[1]; /* Array of tombstone pages */ +}; + /* ** Argument is a pointer to an Fts5Data structure that contains a ** leaf page. @@ -235222,9 +241132,16 @@ struct Fts5SegIter { ** poslist: ** Used by sqlite3Fts5IterPoslist() when the poslist needs to be buffered. ** There is no way to tell if this is populated or not. +** +** pColset: +** If not NULL, points to an object containing a set of column indices. +** Only matches that occur in one of these columns will be returned. +** The Fts5Iter does not own the Fts5Colset object, and so it is not +** freed when the iterator is closed - it is owned by the upper layer. */ struct Fts5Iter { Fts5IndexIter base; /* Base class containing output vars */ + Fts5TokenDataIter *pTokenDataIter; Fts5Index *pIndex; /* Index that owns this iterator */ Fts5Buffer poslist; /* Buffer containing current poslist */ @@ -235242,7 +241159,6 @@ struct Fts5Iter { Fts5SegIter aSeg[1]; /* Array of segment iterators */ }; - /* ** An instance of the following type is used to iterate through the contents ** of a doclist-index record. @@ -236160,9 +242076,9 @@ static int fts5DlidxLvlNext(Fts5DlidxLvl *pLvl){ } if( iOffnn ){ - i64 iVal; + u64 iVal; pLvl->iLeafPgno += (iOff - pLvl->iOff) + 1; - iOff += fts5GetVarint(&pData->p[iOff], (u64*)&iVal); + iOff += fts5GetVarint(&pData->p[iOff], &iVal); pLvl->iRowid += iVal; pLvl->iOff = iOff; }else{ @@ -236541,18 +242457,20 @@ static void fts5SegIterSetNext(Fts5Index *p, Fts5SegIter *pIter){ } /* -** Allocate a tombstone hash page array (pIter->apTombstone) for the -** iterator passed as the second argument. If an OOM error occurs, leave -** an error in the Fts5Index object. +** Allocate a tombstone hash page array object (pIter->pTombArray) for +** the iterator passed as the second argument. If an OOM error occurs, +** leave an error in the Fts5Index object. */ static void fts5SegIterAllocTombstone(Fts5Index *p, Fts5SegIter *pIter){ const int nTomb = pIter->pSeg->nPgTombstone; if( nTomb>0 ){ - Fts5Data **apTomb = 0; - apTomb = (Fts5Data**)sqlite3Fts5MallocZero(&p->rc, sizeof(Fts5Data)*nTomb); - if( apTomb ){ - pIter->apTombstone = apTomb; - pIter->nTombstone = nTomb; + int nByte = nTomb * sizeof(Fts5Data*) + sizeof(Fts5TombstoneArray); + Fts5TombstoneArray *pNew; + pNew = (Fts5TombstoneArray*)sqlite3Fts5MallocZero(&p->rc, nByte); + if( pNew ){ + pNew->nTombstone = nTomb; + pNew->nRef = 1; + pIter->pTombArray = pNew; } } } @@ -236809,15 +242727,16 @@ static void fts5SegIterNext_None( }else{ const u8 *pList = 0; const char *zTerm = 0; + int nTerm = 0; int nList; sqlite3Fts5HashScanNext(p->pHash); - sqlite3Fts5HashScanEntry(p->pHash, &zTerm, &pList, &nList); + sqlite3Fts5HashScanEntry(p->pHash, &zTerm, &nTerm, &pList, &nList); if( pList==0 ) goto next_none_eof; pIter->pLeaf->p = (u8*)pList; pIter->pLeaf->nn = nList; pIter->pLeaf->szLeaf = nList; pIter->iEndofDoclist = nList; - sqlite3Fts5BufferSet(&p->rc,&pIter->term, (int)strlen(zTerm), (u8*)zTerm); + sqlite3Fts5BufferSet(&p->rc,&pIter->term, nTerm, (u8*)zTerm); pIter->iLeafOffset = fts5GetVarint(pList, (u64*)&pIter->iRowid); } @@ -236883,11 +242802,12 @@ static void fts5SegIterNext( }else if( pIter->pSeg==0 ){ const u8 *pList = 0; const char *zTerm = 0; + int nTerm = 0; int nList = 0; assert( (pIter->flags & FTS5_SEGITER_ONETERM) || pbNewTerm ); if( 0==(pIter->flags & FTS5_SEGITER_ONETERM) ){ sqlite3Fts5HashScanNext(p->pHash); - sqlite3Fts5HashScanEntry(p->pHash, &zTerm, &pList, &nList); + sqlite3Fts5HashScanEntry(p->pHash, &zTerm, &nTerm, &pList, &nList); } if( pList==0 ){ fts5DataRelease(pIter->pLeaf); @@ -236897,8 +242817,7 @@ static void fts5SegIterNext( pIter->pLeaf->nn = nList; pIter->pLeaf->szLeaf = nList; pIter->iEndofDoclist = nList+1; - sqlite3Fts5BufferSet(&p->rc, &pIter->term, (int)strlen(zTerm), - (u8*)zTerm); + sqlite3Fts5BufferSet(&p->rc, &pIter->term, nTerm, (u8*)zTerm); pIter->iLeafOffset = fts5GetVarint(pList, (u64*)&pIter->iRowid); *pbNewTerm = 1; } @@ -237284,7 +243203,7 @@ static void fts5SegIterSeekInit( fts5LeafSeek(p, bGe, pIter, pTerm, nTerm); } - if( p->rc==SQLITE_OK && bGe==0 ){ + if( p->rc==SQLITE_OK && (bGe==0 || (flags & FTS5INDEX_QUERY_SCANONETERM)) ){ pIter->flags |= FTS5_SEGITER_ONETERM; if( pIter->pLeaf ){ if( flags & FTS5INDEX_QUERY_DESC ){ @@ -237300,7 +243219,9 @@ static void fts5SegIterSeekInit( } fts5SegIterSetNext(p, pIter); - fts5SegIterAllocTombstone(p, pIter); + if( 0==(flags & FTS5INDEX_QUERY_SCANONETERM) ){ + fts5SegIterAllocTombstone(p, pIter); + } /* Either: ** @@ -237317,6 +243238,79 @@ static void fts5SegIterSeekInit( ); } + +/* +** SQL used by fts5SegIterNextInit() to find the page to open. +*/ +static sqlite3_stmt *fts5IdxNextStmt(Fts5Index *p){ + if( p->pIdxNextSelect==0 ){ + Fts5Config *pConfig = p->pConfig; + fts5IndexPrepareStmt(p, &p->pIdxNextSelect, sqlite3_mprintf( + "SELECT pgno FROM '%q'.'%q_idx' WHERE " + "segid=? AND term>? ORDER BY term ASC LIMIT 1", + pConfig->zDb, pConfig->zName + )); + + } + return p->pIdxNextSelect; +} + +/* +** This is similar to fts5SegIterSeekInit(), except that it initializes +** the segment iterator to point to the first term following the page +** with pToken/nToken on it. +*/ +static void fts5SegIterNextInit( + Fts5Index *p, + const char *pTerm, int nTerm, + Fts5StructureSegment *pSeg, /* Description of segment */ + Fts5SegIter *pIter /* Object to populate */ +){ + int iPg = -1; /* Page of segment to open */ + int bDlidx = 0; + sqlite3_stmt *pSel = 0; /* SELECT to find iPg */ + + pSel = fts5IdxNextStmt(p); + if( pSel ){ + assert( p->rc==SQLITE_OK ); + sqlite3_bind_int(pSel, 1, pSeg->iSegid); + sqlite3_bind_blob(pSel, 2, pTerm, nTerm, SQLITE_STATIC); + + if( sqlite3_step(pSel)==SQLITE_ROW ){ + i64 val = sqlite3_column_int64(pSel, 0); + iPg = (int)(val>>1); + bDlidx = (val & 0x0001); + } + p->rc = sqlite3_reset(pSel); + sqlite3_bind_null(pSel, 2); + if( p->rc ) return; + } + + memset(pIter, 0, sizeof(*pIter)); + pIter->pSeg = pSeg; + pIter->flags |= FTS5_SEGITER_ONETERM; + if( iPg>=0 ){ + pIter->iLeafPgno = iPg - 1; + fts5SegIterNextPage(p, pIter); + fts5SegIterSetNext(p, pIter); + } + if( pIter->pLeaf ){ + const u8 *a = pIter->pLeaf->p; + int iTermOff = 0; + + pIter->iPgidxOff = pIter->pLeaf->szLeaf; + pIter->iPgidxOff += fts5GetVarint32(&a[pIter->iPgidxOff], iTermOff); + pIter->iLeafOffset = iTermOff; + fts5SegIterLoadTerm(p, pIter, 0); + fts5SegIterLoadNPos(p, pIter); + if( bDlidx ) fts5SegIterLoadDlidx(p, pIter); + + assert( p->rc!=SQLITE_OK || + fts5BufferCompareBlob(&pIter->term, (const u8*)pTerm, nTerm)>0 + ); + } +} + /* ** Initialize the object pIter to point to term pTerm/nTerm within the ** in-memory hash table. If there is no such term in the hash-table, the @@ -237343,14 +243337,21 @@ static void fts5SegIterHashInit( const u8 *pList = 0; p->rc = sqlite3Fts5HashScanInit(p->pHash, (const char*)pTerm, nTerm); - sqlite3Fts5HashScanEntry(p->pHash, (const char**)&z, &pList, &nList); - n = (z ? (int)strlen((const char*)z) : 0); + sqlite3Fts5HashScanEntry(p->pHash, (const char**)&z, &n, &pList, &nList); if( pList ){ pLeaf = fts5IdxMalloc(p, sizeof(Fts5Data)); if( pLeaf ){ pLeaf->p = (u8*)pList; } } + + /* The call to sqlite3Fts5HashScanInit() causes the hash table to + ** fill the size field of all existing position lists. This means they + ** can no longer be appended to. Since the only scenario in which they + ** can be appended to is if the previous operation on this table was + ** a DELETE, by clearing the Fts5Index.bDelete flag we can avoid this + ** possibility altogether. */ + p->bDelete = 0; }else{ p->rc = sqlite3Fts5HashQuery(p->pHash, sizeof(Fts5Data), (const char*)pTerm, nTerm, (void**)&pLeaf, &nList @@ -237395,6 +243396,23 @@ static void fts5IndexFreeArray(Fts5Data **ap, int n){ } } +/* +** Decrement the ref-count of the object passed as the only argument. If it +** reaches 0, free it and its contents. +*/ +static void fts5TombstoneArrayDelete(Fts5TombstoneArray *p){ + if( p ){ + p->nRef--; + if( p->nRef<=0 ){ + int ii; + for(ii=0; iinTombstone; ii++){ + fts5DataRelease(p->apTombstone[ii]); + } + sqlite3_free(p); + } + } +} + /* ** Zero the iterator passed as the only argument. */ @@ -237402,7 +243420,7 @@ static void fts5SegIterClear(Fts5SegIter *pIter){ fts5BufferFree(&pIter->term); fts5DataRelease(pIter->pLeaf); fts5DataRelease(pIter->pNextLeaf); - fts5IndexFreeArray(pIter->apTombstone, pIter->nTombstone); + fts5TombstoneArrayDelete(pIter->pTombArray); fts5DlidxIterFree(pIter->pDlidx); sqlite3_free(pIter->aRowidOffset); memset(pIter, 0, sizeof(Fts5SegIter)); @@ -237536,7 +243554,6 @@ static int fts5MultiIterDoCompare(Fts5Iter *pIter, int iOut){ assert_nc( i2!=0 ); pRes->bTermEq = 1; if( p1->iRowid==p2->iRowid ){ - p1->bDel = p2->bDel; return i2; } res = ((p1->iRowid > p2->iRowid)==pIter->bRev) ? -1 : +1; @@ -237648,7 +243665,6 @@ static void fts5SegIterNextFrom( }while( p->rc==SQLITE_OK ); } - /* ** Free the iterator object passed as the second argument. */ @@ -237793,24 +243809,25 @@ static int fts5IndexTombstoneQuery( static int fts5MultiIterIsDeleted(Fts5Iter *pIter){ int iFirst = pIter->aFirst[1].iFirst; Fts5SegIter *pSeg = &pIter->aSeg[iFirst]; + Fts5TombstoneArray *pArray = pSeg->pTombArray; - if( pSeg->pLeaf && pSeg->nTombstone ){ + if( pSeg->pLeaf && pArray ){ /* Figure out which page the rowid might be present on. */ - int iPg = ((u64)pSeg->iRowid) % pSeg->nTombstone; + int iPg = ((u64)pSeg->iRowid) % pArray->nTombstone; assert( iPg>=0 ); /* If tombstone hash page iPg has not yet been loaded from the ** database, load it now. */ - if( pSeg->apTombstone[iPg]==0 ){ - pSeg->apTombstone[iPg] = fts5DataRead(pIter->pIndex, + if( pArray->apTombstone[iPg]==0 ){ + pArray->apTombstone[iPg] = fts5DataRead(pIter->pIndex, FTS5_TOMBSTONE_ROWID(pSeg->pSeg->iSegid, iPg) ); - if( pSeg->apTombstone[iPg]==0 ) return 0; + if( pArray->apTombstone[iPg]==0 ) return 0; } return fts5IndexTombstoneQuery( - pSeg->apTombstone[iPg], - pSeg->nTombstone, + pArray->apTombstone[iPg], + pArray->nTombstone, pSeg->iRowid ); } @@ -237904,7 +243921,7 @@ static Fts5Iter *fts5MultiIterAlloc( int nSeg ){ Fts5Iter *pNew; - int nSlot; /* Power of two >= nSeg */ + i64 nSlot; /* Power of two >= nSeg */ for(nSlot=2; nSlotnSeg-1; iIter>0; iIter--){ + int iEq; + if( (iEq = fts5MultiIterDoCompare(pIter, iIter)) ){ + Fts5SegIter *pSeg = &pIter->aSeg[iEq]; + if( p->rc==SQLITE_OK ) pSeg->xNext(p, pSeg, 0); + fts5MultiIterAdvanced(p, pIter, iEq, iIter); + } + } + fts5MultiIterSetEof(pIter); + fts5AssertMultiIterSetup(p, pIter); + + if( (pIter->bSkipEmpty && fts5MultiIterIsEmpty(p, pIter)) + || fts5MultiIterIsDeleted(pIter) + ){ + fts5MultiIterNext(p, pIter, 0, 0); + }else if( pIter->base.bEof==0 ){ + Fts5SegIter *pSeg = &pIter->aSeg[pIter->aFirst[1].iFirst]; + pIter->xSetOutputs(pIter, pSeg); + } +} /* ** Allocate a new Fts5Iter object. @@ -238430,31 +244473,12 @@ static void fts5MultiIterNew( assert( iIter==nSeg ); } - /* If the above was successful, each component iterators now points + /* If the above was successful, each component iterator now points ** to the first entry in its segment. In this case initialize the ** aFirst[] array. Or, if an error has occurred, free the iterator ** object and set the output variable to NULL. */ if( p->rc==SQLITE_OK ){ - for(iIter=pNew->nSeg-1; iIter>0; iIter--){ - int iEq; - if( (iEq = fts5MultiIterDoCompare(pNew, iIter)) ){ - Fts5SegIter *pSeg = &pNew->aSeg[iEq]; - if( p->rc==SQLITE_OK ) pSeg->xNext(p, pSeg, 0); - fts5MultiIterAdvanced(p, pNew, iEq, iIter); - } - } - fts5MultiIterSetEof(pNew); - fts5AssertMultiIterSetup(p, pNew); - - if( (pNew->bSkipEmpty && fts5MultiIterIsEmpty(p, pNew)) - || fts5MultiIterIsDeleted(pNew) - ){ - fts5MultiIterNext(p, pNew, 0, 0); - }else if( pNew->base.bEof==0 ){ - Fts5SegIter *pSeg = &pNew->aSeg[pNew->aFirst[1].iFirst]; - pNew->xSetOutputs(pNew, pSeg); - } - + fts5MultiIterFinishSetup(p, pNew); }else{ fts5MultiIterFree(pNew); *ppOut = 0; @@ -238479,7 +244503,6 @@ static void fts5MultiIterNew2( pNew = fts5MultiIterAlloc(p, 2); if( pNew ){ Fts5SegIter *pIter = &pNew->aSeg[1]; - pIter->flags = FTS5_SEGITER_ONETERM; if( pData->szLeaf>0 ){ pIter->pLeaf = pData; @@ -238627,6 +244650,7 @@ static void fts5IndexDiscardData(Fts5Index *p){ sqlite3Fts5HashClear(p->pHash); p->nPendingData = 0; p->nPendingRow = 0; + p->flushRc = SQLITE_OK; } p->nContentlessDelete = 0; } @@ -238842,7 +244866,7 @@ static void fts5WriteDlidxAppend( } if( pDlidx->bPrevValid ){ - iVal = iRowid - pDlidx->iPrev; + iVal = (u64)iRowid - (u64)pDlidx->iPrev; }else{ i64 iPgno = (i==0 ? pWriter->writer.pgno : pDlidx[-1].pgno); assert( pDlidx->buf.n==0 ); @@ -239029,7 +245053,7 @@ static void fts5WriteAppendPoslistData( const u8 *a = aData; int n = nData; - assert( p->pConfig->pgsz>0 ); + assert( p->pConfig->pgsz>0 || p->rc!=SQLITE_OK ); while( p->rc==SQLITE_OK && (pPage->buf.n + pPage->pgidx.n + n)>=p->pConfig->pgsz ){ @@ -239680,7 +245704,6 @@ static void fts5DoSecureDelete( int iPgIdx = pSeg->pLeaf->szLeaf; u64 iDelta = 0; - u64 iNextDelta = 0; int iNextOff = 0; int iOff = 0; int nIdx = 0; @@ -239688,8 +245711,6 @@ static void fts5DoSecureDelete( int bLastInDoclist = 0; int iIdx = 0; int iStart = 0; - int iKeyOff = 0; - int iPrevKeyOff = 0; int iDelKeyOff = 0; /* Offset of deleted key, if any */ nIdx = nPg-iPgIdx; @@ -239714,10 +245735,21 @@ static void fts5DoSecureDelete( ** This block sets the following variables: ** ** iStart: + ** The offset of the first byte of the rowid or delta-rowid + ** value for the doclist entry being removed. + ** ** iDelta: + ** The value of the rowid or delta-rowid value for the doclist + ** entry being removed. + ** + ** iNextOff: + ** The offset of the next entry following the position list + ** for the one being removed. If the position list for this + ** entry overflows onto the next leaf page, this value will be + ** greater than pLeaf->szLeaf. */ { - int iSOP; + int iSOP; /* Start-Of-Position-list */ if( pSeg->iLeafPgno==pSeg->iTermLeafPgno ){ iStart = pSeg->iTermLeafOffset; }else{ @@ -239753,47 +245785,81 @@ static void fts5DoSecureDelete( } iOff = iStart; + + /* If the position-list for the entry being removed flows over past + ** the end of this page, delete the portion of the position-list on the + ** next page and beyond. + ** + ** Set variable bLastInDoclist to true if this entry happens + ** to be the last rowid in the doclist for its term. */ if( iNextOff>=iPgIdx ){ int pgno = pSeg->iLeafPgno+1; fts5SecureDeleteOverflow(p, pSeg->pSeg, pgno, &bLastInDoclist); iNextOff = iPgIdx; - }else{ - /* Set bLastInDoclist to true if the entry being removed is the last - ** in its doclist. */ - for(iIdx=0, iKeyOff=0; iIdxbDel==0 ){ + if( iNextOff!=iPgIdx ){ + /* Loop through the page-footer. If iNextOff (offset of the + ** entry following the one we are removing) is equal to the + ** offset of a key on this page, then the entry is the last + ** in its doclist. */ + int iKeyOff = 0; + for(iIdx=0; iIdxbDel ){ + iOff += sqlite3Fts5PutVarint(&aPg[iOff], iDelta); + aPg[iOff++] = 0x01; + }else if( bLastInDoclist==0 ){ if( iNextOff!=iPgIdx ){ + u64 iNextDelta = 0; iNextOff += fts5GetVarint(&aPg[iNextOff], &iNextDelta); iOff += sqlite3Fts5PutVarint(&aPg[iOff], iDelta + iNextDelta); } }else if( - iStart==pSeg->iTermLeafOffset && pSeg->iLeafPgno==pSeg->iTermLeafPgno + pSeg->iLeafPgno==pSeg->iTermLeafPgno + && iStart==pSeg->iTermLeafOffset ){ /* The entry being removed was the only position list in its ** doclist. Therefore the term needs to be removed as well. */ int iKey = 0; - for(iIdx=0, iKeyOff=0; iIdx(u32)iStart ) break; iKeyOff += iVal; } + assert_nc( iKey>=1 ); + /* Set iDelKeyOff to the value of the footer entry to remove from + ** the page. */ iDelKeyOff = iOff = iKeyOff; + if( iNextOff!=iPgIdx ){ + /* This is the only position-list associated with the term, and there + ** is another term following it on this page. So the subsequent term + ** needs to be moved to replace the term associated with the entry + ** being removed. */ int nPrefix = 0; int nSuffix = 0; int nPrefix2 = 0; @@ -239872,6 +245938,15 @@ static void fts5DoSecureDelete( } } + /* Assuming no error has occurred, this block does final edits to the + ** leaf page before writing it back to disk. Input variables are: + ** + ** nPg: Total initial size of leaf page. + ** iPgIdx: Initial offset of page footer. + ** + ** iOff: Offset to move data to + ** iNextOff: Offset to move data from + */ if( p->rc==SQLITE_OK ){ const int nMove = nPg - iNextOff; /* Number of bytes to move */ int nShift = iNextOff - iOff; /* Distance to move them */ @@ -239914,10 +245989,10 @@ static void fts5FlushSecureDelete( Fts5Index *p, Fts5Structure *pStruct, const char *zTerm, + int nTerm, i64 iRowid ){ const int f = FTS5INDEX_QUERY_SKIPHASH; - int nTerm = (int)strlen(zTerm); Fts5Iter *pIter = 0; /* Used to find term instance */ fts5MultiIterNew(p, pStruct, f, 0, (const u8*)zTerm, nTerm, -1, 0, &pIter); @@ -239991,8 +246066,7 @@ static void fts5FlushOneHash(Fts5Index *p){ int nDoclist; /* Size of doclist in bytes */ /* Get the term and doclist for this entry. */ - sqlite3Fts5HashScanEntry(pHash, &zTerm, &pDoclist, &nDoclist); - nTerm = (int)strlen(zTerm); + sqlite3Fts5HashScanEntry(pHash, &zTerm, &nTerm, &pDoclist, &nDoclist); if( bSecureDelete==0 ){ fts5WriteAppendTerm(p, &writer, nTerm, (const u8*)zTerm); if( p->rc!=SQLITE_OK ) break; @@ -240022,7 +246096,7 @@ static void fts5FlushOneHash(Fts5Index *p){ if( bSecureDelete ){ if( eDetail==FTS5_DETAIL_NONE ){ if( iOffrc!=SQLITE_OK || pDoclist[iOff]==0x01 ){ iOff++; continue; @@ -240072,10 +246146,16 @@ static void fts5FlushOneHash(Fts5Index *p){ fts5WriteFlushLeaf(p, &writer); } }else{ - int bDummy; - int nPos; - int nCopy = fts5GetPoslistSize(&pDoclist[iOff], &nPos, &bDummy); - nCopy += nPos; + int bDel = 0; + int nPos = 0; + int nCopy = fts5GetPoslistSize(&pDoclist[iOff], &nPos, &bDel); + if( bDel && bSecureDelete ){ + fts5BufferAppendVarint(&p->rc, pBuf, nPos*2); + iOff += nCopy; + nCopy = nPos; + }else{ + nCopy += nPos; + } if( (pBuf->n + pPgidx->n + nCopy) <= pgsz ){ /* The entire poslist will fit on the current leaf. So copy ** it in one go. */ @@ -240113,7 +246193,6 @@ static void fts5FlushOneHash(Fts5Index *p){ assert( pBuf->n<=pBuf->nSpace ); if( p->rc==SQLITE_OK ) sqlite3Fts5HashScanNext(pHash); } - sqlite3Fts5HashClear(pHash); fts5WriteFinish(p, &writer, &pgnoLast); assert( p->rc!=SQLITE_OK || bSecureDelete || pgnoLast>0 ); @@ -240146,7 +246225,6 @@ static void fts5FlushOneHash(Fts5Index *p){ fts5IndexCrisismerge(p, &pStruct); fts5StructureWrite(p, pStruct); fts5StructureRelease(pStruct); - p->nContentlessDelete = 0; } /* @@ -240154,11 +246232,21 @@ static void fts5FlushOneHash(Fts5Index *p){ */ static void fts5IndexFlush(Fts5Index *p){ /* Unless it is empty, flush the hash table to disk */ + if( p->flushRc ){ + p->rc = p->flushRc; + return; + } if( p->nPendingData || p->nContentlessDelete ){ assert( p->pHash ); fts5FlushOneHash(p); - p->nPendingData = 0; - p->nPendingRow = 0; + if( p->rc==SQLITE_OK ){ + sqlite3Fts5HashClear(p->pHash); + p->nPendingData = 0; + p->nPendingRow = 0; + p->nContentlessDelete = 0; + }else if( p->nPendingData || p->nContentlessDelete ){ + p->flushRc = p->rc; + } } } @@ -240236,8 +246324,9 @@ static int sqlite3Fts5IndexOptimize(Fts5Index *p){ assert( p->rc==SQLITE_OK ); fts5IndexFlush(p); - assert( p->nContentlessDelete==0 ); + assert( p->rc!=SQLITE_OK || p->nContentlessDelete==0 ); pStruct = fts5StructureRead(p); + assert( p->rc!=SQLITE_OK || pStruct!=0 ); fts5StructureInvalidate(p); if( pStruct ){ @@ -240643,7 +246732,7 @@ static void fts5SetupPrefixIter( u8 *pToken, /* Buffer containing prefix to match */ int nToken, /* Size of buffer pToken in bytes */ Fts5Colset *pColset, /* Restrict matches to these columns */ - Fts5Iter **ppIter /* OUT: New iterator */ + Fts5Iter **ppIter /* OUT: New iterator */ ){ Fts5Structure *pStruct; Fts5Buffer *aBuf; @@ -240664,8 +246753,9 @@ static void fts5SetupPrefixIter( aBuf = (Fts5Buffer*)fts5IdxMalloc(p, sizeof(Fts5Buffer)*nBuf); pStruct = fts5StructureRead(p); + assert( p->rc!=SQLITE_OK || (aBuf && pStruct) ); - if( aBuf && pStruct ){ + if( p->rc==SQLITE_OK ){ const int flags = FTS5INDEX_QUERY_SCAN | FTS5INDEX_QUERY_SKIPEMPTY | FTS5INDEX_QUERY_NOOUTPUT; @@ -240677,6 +246767,12 @@ static void fts5SetupPrefixIter( int bNewTerm = 1; memset(&doclist, 0, sizeof(doclist)); + + /* If iIdx is non-zero, then it is the number of a prefix-index for + ** prefixes 1 character longer than the prefix being queried for. That + ** index contains all the doclists required, except for the one + ** corresponding to the prefix itself. That one is extracted from the + ** main term index here. */ if( iIdx!=0 ){ int dummy = 0; const int f2 = FTS5INDEX_QUERY_SKIPEMPTY|FTS5INDEX_QUERY_NOOUTPUT; @@ -240700,6 +246796,7 @@ static void fts5SetupPrefixIter( pToken[0] = FTS5_MAIN_PREFIX + iIdx; fts5MultiIterNew(p, pStruct, flags, pColset, pToken, nToken, -1, 0, &p1); fts5IterSetOutputCb(&p->rc, p1); + for( /* no-op */ ; fts5MultiIterEof(p, p1)==0; fts5MultiIterNext2(p, p1, &bNewTerm) @@ -240715,7 +246812,6 @@ static void fts5SetupPrefixIter( } if( p1->base.nData==0 ) continue; - if( p1->base.iRowid<=iLastRowid && doclist.n>0 ){ for(i=0; p->rc==SQLITE_OK && doclist.n; i++){ int i1 = i*nMerge; @@ -240754,7 +246850,7 @@ static void fts5SetupPrefixIter( } fts5MultiIterFree(p1); - pData = fts5IdxMalloc(p, sizeof(Fts5Data)+doclist.n+FTS5_DATA_ZERO_PADDING); + pData = fts5IdxMalloc(p, sizeof(*pData)+doclist.n+FTS5_DATA_ZERO_PADDING); if( pData ){ pData->p = (u8*)&pData[1]; pData->nn = pData->szLeaf = doclist.n; @@ -240897,6 +246993,7 @@ static int sqlite3Fts5IndexClose(Fts5Index *p){ sqlite3_finalize(p->pIdxWriter); sqlite3_finalize(p->pIdxDeleter); sqlite3_finalize(p->pIdxSelect); + sqlite3_finalize(p->pIdxNextSelect); sqlite3_finalize(p->pDataVersion); sqlite3_finalize(p->pDeleteFromIdx); sqlite3Fts5HashFree(p->pHash); @@ -240992,6 +247089,457 @@ static int sqlite3Fts5IndexWrite( return rc; } +/* +** pToken points to a buffer of size nToken bytes containing a search +** term, including the index number at the start, used on a tokendata=1 +** table. This function returns true if the term in buffer pBuf matches +** token pToken/nToken. +*/ +static int fts5IsTokendataPrefix( + Fts5Buffer *pBuf, + const u8 *pToken, + int nToken +){ + return ( + pBuf->n>=nToken + && 0==memcmp(pBuf->p, pToken, nToken) + && (pBuf->n==nToken || pBuf->p[nToken]==0x00) + ); +} + +/* +** Ensure the segment-iterator passed as the only argument points to EOF. +*/ +static void fts5SegIterSetEOF(Fts5SegIter *pSeg){ + fts5DataRelease(pSeg->pLeaf); + pSeg->pLeaf = 0; +} + +/* +** Usually, a tokendata=1 iterator (struct Fts5TokenDataIter) accumulates an +** array of these for each row it visits. Or, for an iterator used by an +** "ORDER BY rank" query, it accumulates an array of these for the entire +** query. +** +** Each instance in the array indicates the iterator (and therefore term) +** associated with position iPos of rowid iRowid. This is used by the +** xInstToken() API. +*/ +struct Fts5TokenDataMap { + i64 iRowid; /* Row this token is located in */ + i64 iPos; /* Position of token */ + int iIter; /* Iterator token was read from */ +}; + +/* +** An object used to supplement Fts5Iter for tokendata=1 iterators. +*/ +struct Fts5TokenDataIter { + int nIter; + int nIterAlloc; + + int nMap; + int nMapAlloc; + Fts5TokenDataMap *aMap; + + Fts5PoslistReader *aPoslistReader; + int *aPoslistToIter; + Fts5Iter *apIter[1]; +}; + +/* +** This function appends iterator pAppend to Fts5TokenDataIter pIn and +** returns the result. +*/ +static Fts5TokenDataIter *fts5AppendTokendataIter( + Fts5Index *p, /* Index object (for error code) */ + Fts5TokenDataIter *pIn, /* Current Fts5TokenDataIter struct */ + Fts5Iter *pAppend /* Append this iterator */ +){ + Fts5TokenDataIter *pRet = pIn; + + if( p->rc==SQLITE_OK ){ + if( pIn==0 || pIn->nIter==pIn->nIterAlloc ){ + int nAlloc = pIn ? pIn->nIterAlloc*2 : 16; + int nByte = nAlloc * sizeof(Fts5Iter*) + sizeof(Fts5TokenDataIter); + Fts5TokenDataIter *pNew = (Fts5TokenDataIter*)sqlite3_realloc(pIn, nByte); + + if( pNew==0 ){ + p->rc = SQLITE_NOMEM; + }else{ + if( pIn==0 ) memset(pNew, 0, nByte); + pRet = pNew; + pNew->nIterAlloc = nAlloc; + } + } + } + if( p->rc ){ + sqlite3Fts5IterClose((Fts5IndexIter*)pAppend); + }else{ + pRet->apIter[pRet->nIter++] = pAppend; + } + assert( pRet==0 || pRet->nIter<=pRet->nIterAlloc ); + + return pRet; +} + +/* +** Delete an Fts5TokenDataIter structure and its contents. +*/ +static void fts5TokendataIterDelete(Fts5TokenDataIter *pSet){ + if( pSet ){ + int ii; + for(ii=0; iinIter; ii++){ + fts5MultiIterFree(pSet->apIter[ii]); + } + sqlite3_free(pSet->aPoslistReader); + sqlite3_free(pSet->aMap); + sqlite3_free(pSet); + } +} + +/* +** Append a mapping to the token-map belonging to object pT. +*/ +static void fts5TokendataIterAppendMap( + Fts5Index *p, + Fts5TokenDataIter *pT, + int iIter, + i64 iRowid, + i64 iPos +){ + if( p->rc==SQLITE_OK ){ + if( pT->nMap==pT->nMapAlloc ){ + int nNew = pT->nMapAlloc ? pT->nMapAlloc*2 : 64; + int nByte = nNew * sizeof(Fts5TokenDataMap); + Fts5TokenDataMap *aNew; + + aNew = (Fts5TokenDataMap*)sqlite3_realloc(pT->aMap, nByte); + if( aNew==0 ){ + p->rc = SQLITE_NOMEM; + return; + } + + pT->aMap = aNew; + pT->nMapAlloc = nNew; + } + + pT->aMap[pT->nMap].iRowid = iRowid; + pT->aMap[pT->nMap].iPos = iPos; + pT->aMap[pT->nMap].iIter = iIter; + pT->nMap++; + } +} + +/* +** The iterator passed as the only argument must be a tokendata=1 iterator +** (pIter->pTokenDataIter!=0). This function sets the iterator output +** variables (pIter->base.*) according to the contents of the current +** row. +*/ +static void fts5IterSetOutputsTokendata(Fts5Iter *pIter){ + int ii; + int nHit = 0; + i64 iRowid = SMALLEST_INT64; + int iMin = 0; + + Fts5TokenDataIter *pT = pIter->pTokenDataIter; + + pIter->base.nData = 0; + pIter->base.pData = 0; + + for(ii=0; iinIter; ii++){ + Fts5Iter *p = pT->apIter[ii]; + if( p->base.bEof==0 ){ + if( nHit==0 || p->base.iRowidbase.iRowid; + nHit = 1; + pIter->base.pData = p->base.pData; + pIter->base.nData = p->base.nData; + iMin = ii; + }else if( p->base.iRowid==iRowid ){ + nHit++; + } + } + } + + if( nHit==0 ){ + pIter->base.bEof = 1; + }else{ + int eDetail = pIter->pIndex->pConfig->eDetail; + pIter->base.bEof = 0; + pIter->base.iRowid = iRowid; + + if( nHit==1 && eDetail==FTS5_DETAIL_FULL ){ + fts5TokendataIterAppendMap(pIter->pIndex, pT, iMin, iRowid, -1); + }else + if( nHit>1 && eDetail!=FTS5_DETAIL_NONE ){ + int nReader = 0; + int nByte = 0; + i64 iPrev = 0; + + /* Allocate array of iterators if they are not already allocated. */ + if( pT->aPoslistReader==0 ){ + pT->aPoslistReader = (Fts5PoslistReader*)sqlite3Fts5MallocZero( + &pIter->pIndex->rc, + pT->nIter * (sizeof(Fts5PoslistReader) + sizeof(int)) + ); + if( pT->aPoslistReader==0 ) return; + pT->aPoslistToIter = (int*)&pT->aPoslistReader[pT->nIter]; + } + + /* Populate an iterator for each poslist that will be merged */ + for(ii=0; iinIter; ii++){ + Fts5Iter *p = pT->apIter[ii]; + if( iRowid==p->base.iRowid ){ + pT->aPoslistToIter[nReader] = ii; + sqlite3Fts5PoslistReaderInit( + p->base.pData, p->base.nData, &pT->aPoslistReader[nReader++] + ); + nByte += p->base.nData; + } + } + + /* Ensure the output buffer is large enough */ + if( fts5BufferGrow(&pIter->pIndex->rc, &pIter->poslist, nByte+nHit*10) ){ + return; + } + + /* Ensure the token-mapping is large enough */ + if( eDetail==FTS5_DETAIL_FULL && pT->nMapAlloc<(pT->nMap + nByte) ){ + int nNew = (pT->nMapAlloc + nByte) * 2; + Fts5TokenDataMap *aNew = (Fts5TokenDataMap*)sqlite3_realloc( + pT->aMap, nNew*sizeof(Fts5TokenDataMap) + ); + if( aNew==0 ){ + pIter->pIndex->rc = SQLITE_NOMEM; + return; + } + pT->aMap = aNew; + pT->nMapAlloc = nNew; + } + + pIter->poslist.n = 0; + + while( 1 ){ + i64 iMinPos = LARGEST_INT64; + + /* Find smallest position */ + iMin = 0; + for(ii=0; iiaPoslistReader[ii]; + if( pReader->bEof==0 ){ + if( pReader->iPosiPos; + iMin = ii; + } + } + } + + /* If all readers were at EOF, break out of the loop. */ + if( iMinPos==LARGEST_INT64 ) break; + + sqlite3Fts5PoslistSafeAppend(&pIter->poslist, &iPrev, iMinPos); + sqlite3Fts5PoslistReaderNext(&pT->aPoslistReader[iMin]); + + if( eDetail==FTS5_DETAIL_FULL ){ + pT->aMap[pT->nMap].iPos = iMinPos; + pT->aMap[pT->nMap].iIter = pT->aPoslistToIter[iMin]; + pT->aMap[pT->nMap].iRowid = iRowid; + pT->nMap++; + } + } + + pIter->base.pData = pIter->poslist.p; + pIter->base.nData = pIter->poslist.n; + } + } +} + +/* +** The iterator passed as the only argument must be a tokendata=1 iterator +** (pIter->pTokenDataIter!=0). This function advances the iterator. If +** argument bFrom is false, then the iterator is advanced to the next +** entry. Or, if bFrom is true, it is advanced to the first entry with +** a rowid of iFrom or greater. +*/ +static void fts5TokendataIterNext(Fts5Iter *pIter, int bFrom, i64 iFrom){ + int ii; + Fts5TokenDataIter *pT = pIter->pTokenDataIter; + Fts5Index *pIndex = pIter->pIndex; + + for(ii=0; iinIter; ii++){ + Fts5Iter *p = pT->apIter[ii]; + if( p->base.bEof==0 + && (p->base.iRowid==pIter->base.iRowid || (bFrom && p->base.iRowidbase.bEof==0 + && p->base.iRowidrc==SQLITE_OK + ){ + fts5MultiIterNext(pIndex, p, 0, 0); + } + } + } + + if( pIndex->rc==SQLITE_OK ){ + fts5IterSetOutputsTokendata(pIter); + } +} + +/* +** If the segment-iterator passed as the first argument is at EOF, then +** set pIter->term to a copy of buffer pTerm. +*/ +static void fts5TokendataSetTermIfEof(Fts5Iter *pIter, Fts5Buffer *pTerm){ + if( pIter && pIter->aSeg[0].pLeaf==0 ){ + fts5BufferSet(&pIter->pIndex->rc, &pIter->aSeg[0].term, pTerm->n, pTerm->p); + } +} + +/* +** This function sets up an iterator to use for a non-prefix query on a +** tokendata=1 table. +*/ +static Fts5Iter *fts5SetupTokendataIter( + Fts5Index *p, /* FTS index to query */ + const u8 *pToken, /* Buffer containing query term */ + int nToken, /* Size of buffer pToken in bytes */ + Fts5Colset *pColset /* Colset to filter on */ +){ + Fts5Iter *pRet = 0; + Fts5TokenDataIter *pSet = 0; + Fts5Structure *pStruct = 0; + const int flags = FTS5INDEX_QUERY_SCANONETERM | FTS5INDEX_QUERY_SCAN; + + Fts5Buffer bSeek = {0, 0, 0}; + Fts5Buffer *pSmall = 0; + + fts5IndexFlush(p); + pStruct = fts5StructureRead(p); + + while( p->rc==SQLITE_OK ){ + Fts5Iter *pPrev = pSet ? pSet->apIter[pSet->nIter-1] : 0; + Fts5Iter *pNew = 0; + Fts5SegIter *pNewIter = 0; + Fts5SegIter *pPrevIter = 0; + + int iLvl, iSeg, ii; + + pNew = fts5MultiIterAlloc(p, pStruct->nSegment); + if( pSmall ){ + fts5BufferSet(&p->rc, &bSeek, pSmall->n, pSmall->p); + fts5BufferAppendBlob(&p->rc, &bSeek, 1, (const u8*)"\0"); + }else{ + fts5BufferSet(&p->rc, &bSeek, nToken, pToken); + } + if( p->rc ){ + sqlite3Fts5IterClose((Fts5IndexIter*)pNew); + break; + } + + pNewIter = &pNew->aSeg[0]; + pPrevIter = (pPrev ? &pPrev->aSeg[0] : 0); + for(iLvl=0; iLvlnLevel; iLvl++){ + for(iSeg=pStruct->aLevel[iLvl].nSeg-1; iSeg>=0; iSeg--){ + Fts5StructureSegment *pSeg = &pStruct->aLevel[iLvl].aSeg[iSeg]; + int bDone = 0; + + if( pPrevIter ){ + if( fts5BufferCompare(pSmall, &pPrevIter->term) ){ + memcpy(pNewIter, pPrevIter, sizeof(Fts5SegIter)); + memset(pPrevIter, 0, sizeof(Fts5SegIter)); + bDone = 1; + }else if( pPrevIter->iEndofDoclist>pPrevIter->pLeaf->szLeaf ){ + fts5SegIterNextInit(p,(const char*)bSeek.p,bSeek.n-1,pSeg,pNewIter); + bDone = 1; + } + } + + if( bDone==0 ){ + fts5SegIterSeekInit(p, bSeek.p, bSeek.n, flags, pSeg, pNewIter); + } + + if( pPrevIter ){ + if( pPrevIter->pTombArray ){ + pNewIter->pTombArray = pPrevIter->pTombArray; + pNewIter->pTombArray->nRef++; + } + }else{ + fts5SegIterAllocTombstone(p, pNewIter); + } + + pNewIter++; + if( pPrevIter ) pPrevIter++; + if( p->rc ) break; + } + } + fts5TokendataSetTermIfEof(pPrev, pSmall); + + pNew->bSkipEmpty = 1; + pNew->pColset = pColset; + fts5IterSetOutputCb(&p->rc, pNew); + + /* Loop through all segments in the new iterator. Find the smallest + ** term that any segment-iterator points to. Iterator pNew will be + ** used for this term. Also, set any iterator that points to a term that + ** does not match pToken/nToken to point to EOF */ + pSmall = 0; + for(ii=0; iinSeg; ii++){ + Fts5SegIter *pII = &pNew->aSeg[ii]; + if( 0==fts5IsTokendataPrefix(&pII->term, pToken, nToken) ){ + fts5SegIterSetEOF(pII); + } + if( pII->pLeaf && (!pSmall || fts5BufferCompare(pSmall, &pII->term)>0) ){ + pSmall = &pII->term; + } + } + + /* If pSmall is still NULL at this point, then the new iterator does + ** not point to any terms that match the query. So delete it and break + ** out of the loop - all required iterators have been collected. */ + if( pSmall==0 ){ + sqlite3Fts5IterClose((Fts5IndexIter*)pNew); + break; + } + + /* Append this iterator to the set and continue. */ + pSet = fts5AppendTokendataIter(p, pSet, pNew); + } + + if( p->rc==SQLITE_OK && pSet ){ + int ii; + for(ii=0; iinIter; ii++){ + Fts5Iter *pIter = pSet->apIter[ii]; + int iSeg; + for(iSeg=0; iSegnSeg; iSeg++){ + pIter->aSeg[iSeg].flags |= FTS5_SEGITER_ONETERM; + } + fts5MultiIterFinishSetup(p, pIter); + } + } + + if( p->rc==SQLITE_OK ){ + pRet = fts5MultiIterAlloc(p, 0); + } + if( pRet ){ + pRet->pTokenDataIter = pSet; + if( pSet ){ + fts5IterSetOutputsTokendata(pRet); + }else{ + pRet->base.bEof = 1; + } + }else{ + fts5TokendataIterDelete(pSet); + } + + fts5StructureRelease(pStruct); + fts5BufferFree(&bSeek); + return pRet; +} + + /* ** Open a new iterator to iterate though all rowid that match the ** specified token or token prefix. @@ -241013,8 +247561,13 @@ static int sqlite3Fts5IndexQuery( if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){ int iIdx = 0; /* Index to search */ int iPrefixIdx = 0; /* +1 prefix index */ + int bTokendata = pConfig->bTokendata; if( nToken>0 ) memcpy(&buf.p[1], pToken, nToken); + if( flags & (FTS5INDEX_QUERY_NOTOKENDATA|FTS5INDEX_QUERY_SCAN) ){ + bTokendata = 0; + } + /* Figure out which index to search and set iIdx accordingly. If this ** is a prefix query for which there is no prefix index, set iIdx to ** greater than pConfig->nPrefix to indicate that the query will be @@ -241040,7 +247593,10 @@ static int sqlite3Fts5IndexQuery( } } - if( iIdx<=pConfig->nPrefix ){ + if( bTokendata && iIdx==0 ){ + buf.p[0] = '0'; + pRet = fts5SetupTokendataIter(p, buf.p, nToken+1, pColset); + }else if( iIdx<=pConfig->nPrefix ){ /* Straight index lookup */ Fts5Structure *pStruct = fts5StructureRead(p); buf.p[0] = (u8)(FTS5_MAIN_PREFIX + iIdx); @@ -241087,7 +247643,11 @@ static int sqlite3Fts5IndexQuery( static int sqlite3Fts5IterNext(Fts5IndexIter *pIndexIter){ Fts5Iter *pIter = (Fts5Iter*)pIndexIter; assert( pIter->pIndex->rc==SQLITE_OK ); - fts5MultiIterNext(pIter->pIndex, pIter, 0, 0); + if( pIter->pTokenDataIter ){ + fts5TokendataIterNext(pIter, 0, 0); + }else{ + fts5MultiIterNext(pIter->pIndex, pIter, 0, 0); + } return fts5IndexReturn(pIter->pIndex); } @@ -241120,7 +247680,11 @@ static int sqlite3Fts5IterNextScan(Fts5IndexIter *pIndexIter){ */ static int sqlite3Fts5IterNextFrom(Fts5IndexIter *pIndexIter, i64 iMatch){ Fts5Iter *pIter = (Fts5Iter*)pIndexIter; - fts5MultiIterNextFrom(pIter->pIndex, pIter, iMatch); + if( pIter->pTokenDataIter ){ + fts5TokendataIterNext(pIter, 1, iMatch); + }else{ + fts5MultiIterNextFrom(pIter->pIndex, pIter, iMatch); + } return fts5IndexReturn(pIter->pIndex); } @@ -241135,6 +247699,99 @@ static const char *sqlite3Fts5IterTerm(Fts5IndexIter *pIndexIter, int *pn){ return (z ? &z[1] : 0); } +/* +** This is used by xInstToken() to access the token at offset iOff, column +** iCol of row iRowid. The token is returned via output variables *ppOut +** and *pnOut. The iterator passed as the first argument must be a tokendata=1 +** iterator (pIter->pTokenDataIter!=0). +*/ +static int sqlite3Fts5IterToken( + Fts5IndexIter *pIndexIter, + i64 iRowid, + int iCol, + int iOff, + const char **ppOut, int *pnOut +){ + Fts5Iter *pIter = (Fts5Iter*)pIndexIter; + Fts5TokenDataIter *pT = pIter->pTokenDataIter; + Fts5TokenDataMap *aMap = pT->aMap; + i64 iPos = (((i64)iCol)<<32) + iOff; + + int i1 = 0; + int i2 = pT->nMap; + int iTest = 0; + + while( i2>i1 ){ + iTest = (i1 + i2) / 2; + + if( aMap[iTest].iRowidiRowid ){ + i2 = iTest; + }else{ + if( aMap[iTest].iPosiPos ){ + i2 = iTest; + }else{ + break; + } + } + } + + if( i2>i1 ){ + Fts5Iter *pMap = pT->apIter[aMap[iTest].iIter]; + *ppOut = (const char*)pMap->aSeg[0].term.p+1; + *pnOut = pMap->aSeg[0].term.n-1; + } + + return SQLITE_OK; +} + +/* +** Clear any existing entries from the token-map associated with the +** iterator passed as the only argument. +*/ +static void sqlite3Fts5IndexIterClearTokendata(Fts5IndexIter *pIndexIter){ + Fts5Iter *pIter = (Fts5Iter*)pIndexIter; + if( pIter && pIter->pTokenDataIter ){ + pIter->pTokenDataIter->nMap = 0; + } +} + +/* +** Set a token-mapping for the iterator passed as the first argument. This +** is used in detail=column or detail=none mode when a token is requested +** using the xInstToken() API. In this case the caller tokenizers the +** current row and configures the token-mapping via multiple calls to this +** function. +*/ +static int sqlite3Fts5IndexIterWriteTokendata( + Fts5IndexIter *pIndexIter, + const char *pToken, int nToken, + i64 iRowid, int iCol, int iOff +){ + Fts5Iter *pIter = (Fts5Iter*)pIndexIter; + Fts5TokenDataIter *pT = pIter->pTokenDataIter; + Fts5Index *p = pIter->pIndex; + int ii; + + assert( p->pConfig->eDetail!=FTS5_DETAIL_FULL ); + assert( pIter->pTokenDataIter ); + + for(ii=0; iinIter; ii++){ + Fts5Buffer *pTerm = &pT->apIter[ii]->aSeg[0].term; + if( nToken==pTerm->n-1 && memcmp(pToken, pTerm->p+1, nToken)==0 ) break; + } + if( iinIter ){ + fts5TokendataIterAppendMap(p, pT, ii, iRowid, (((i64)iCol)<<32) + iOff); + } + return fts5IndexReturn(p); +} + /* ** Close an iterator opened by an earlier call to sqlite3Fts5IndexQuery(). */ @@ -241142,6 +247799,7 @@ static void sqlite3Fts5IterClose(Fts5IndexIter *pIndexIter){ if( pIndexIter ){ Fts5Iter *pIter = (Fts5Iter*)pIndexIter; Fts5Index *pIndex = pIter->pIndex; + fts5TokendataIterDelete(pIter->pTokenDataIter); fts5MultiIterFree(pIter); sqlite3Fts5IndexCloseReader(pIndex); } @@ -241649,7 +248307,9 @@ static int fts5QueryCksum( int eDetail = p->pConfig->eDetail; u64 cksum = *pCksum; Fts5IndexIter *pIter = 0; - int rc = sqlite3Fts5IndexQuery(p, z, n, flags, 0, &pIter); + int rc = sqlite3Fts5IndexQuery( + p, z, n, (flags | FTS5INDEX_QUERY_NOTOKENDATA), 0, &pIter + ); while( rc==SQLITE_OK && ALWAYS(pIter!=0) && 0==sqlite3Fts5IterEof(pIter) ){ i64 rowid = pIter->iRowid; @@ -241816,7 +248476,7 @@ static void fts5IndexIntegrityCheckEmpty( } static void fts5IntegrityCheckPgidx(Fts5Index *p, Fts5Data *pLeaf){ - int iTermOff = 0; + i64 iTermOff = 0; int ii; Fts5Buffer buf1 = {0,0,0}; @@ -241825,7 +248485,7 @@ static void fts5IntegrityCheckPgidx(Fts5Index *p, Fts5Data *pLeaf){ ii = pLeaf->szLeaf; while( iinn && p->rc==SQLITE_OK ){ int res; - int iOff; + i64 iOff; int nIncr; ii += fts5GetVarint32(&pLeaf->p[ii], nIncr); @@ -242347,6 +249007,24 @@ static void fts5DecodeRowidList( } #endif /* SQLITE_TEST || SQLITE_FTS5_DEBUG */ +#if defined(SQLITE_TEST) || defined(SQLITE_FTS5_DEBUG) +static void fts5BufferAppendTerm(int *pRc, Fts5Buffer *pBuf, Fts5Buffer *pTerm){ + int ii; + fts5BufferGrow(pRc, pBuf, pTerm->n*2 + 1); + if( *pRc==SQLITE_OK ){ + for(ii=0; iin; ii++){ + if( pTerm->p[ii]==0x00 ){ + pBuf->p[pBuf->n++] = '\\'; + pBuf->p[pBuf->n++] = '0'; + }else{ + pBuf->p[pBuf->n++] = pTerm->p[ii]; + } + } + pBuf->p[pBuf->n] = 0x00; + } +} +#endif /* SQLITE_TEST || SQLITE_FTS5_DEBUG */ + #if defined(SQLITE_TEST) || defined(SQLITE_FTS5_DEBUG) /* ** The implementation of user-defined scalar function fts5_decode(). @@ -242454,9 +249132,8 @@ static void fts5DecodeFunction( iOff += fts5GetVarint32(&a[iOff], nAppend); term.n = nKeep; fts5BufferAppendBlob(&rc, &term, nAppend, &a[iOff]); - sqlite3Fts5BufferAppendPrintf( - &rc, &s, " term=%.*s", term.n, (const char*)term.p - ); + sqlite3Fts5BufferAppendPrintf(&rc, &s, " term="); + fts5BufferAppendTerm(&rc, &s, &term); iOff += nAppend; /* Figure out where the doclist for this term ends */ @@ -242564,9 +249241,8 @@ static void fts5DecodeFunction( fts5BufferAppendBlob(&rc, &term, nByte, &a[iOff]); iOff += nByte; - sqlite3Fts5BufferAppendPrintf( - &rc, &s, " term=%.*s", term.n, (const char*)term.p - ); + sqlite3Fts5BufferAppendPrintf(&rc, &s, " term="); + fts5BufferAppendTerm(&rc, &s, &term); iOff += fts5DecodeDoclist(&rc, &s, &a[iOff], iEnd-iOff); } @@ -242900,7 +249576,8 @@ static int sqlite3Fts5IndexInit(sqlite3 *db){ 0, /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ - 0 /* xShadowName */ + 0, /* xShadowName */ + 0 /* xIntegrity */ }; rc = sqlite3_create_module(db, "fts5_structure", &fts5structure_module, 0); } @@ -243039,6 +249716,8 @@ struct Fts5FullTable { Fts5Storage *pStorage; /* Document store */ Fts5Global *pGlobal; /* Global (connection wide) data */ Fts5Cursor *pSortCsr; /* Sort data from this cursor */ + int iSavepoint; /* Successful xSavepoint()+1 */ + #ifdef SQLITE_DEBUG struct Fts5TransactionState ts; #endif @@ -243327,6 +250006,13 @@ static int fts5InitVtab( pConfig->pzErrmsg = 0; } + if( rc==SQLITE_OK && pConfig->eContent==FTS5_CONTENT_NORMAL ){ + rc = sqlite3_vtab_config(db, SQLITE_VTAB_CONSTRAINT_SUPPORT, (int)1); + } + if( rc==SQLITE_OK ){ + rc = sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS); + } + if( rc!=SQLITE_OK ){ fts5FreeVtab(pTab); pTab = 0; @@ -243569,12 +250255,15 @@ static int fts5BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){ } idxStr[iIdxStr] = '\0'; - /* Set idxFlags flags for the ORDER BY clause */ + /* Set idxFlags flags for the ORDER BY clause + ** + ** Note that tokendata=1 tables cannot currently handle "ORDER BY rowid DESC". + */ if( pInfo->nOrderBy==1 ){ int iSort = pInfo->aOrderBy[0].iColumn; if( iSort==(pConfig->nCol+1) && bSeenMatch ){ idxFlags |= FTS5_BI_ORDER_RANK; - }else if( iSort==-1 ){ + }else if( iSort==-1 && (!pInfo->aOrderBy[0].desc || !pConfig->bTokendata) ){ idxFlags |= FTS5_BI_ORDER_ROWID; } if( BitFlagTest(idxFlags, FTS5_BI_ORDER_RANK|FTS5_BI_ORDER_ROWID) ){ @@ -243826,6 +250515,16 @@ static int fts5NextMethod(sqlite3_vtab_cursor *pCursor){ ); assert( !CsrFlagTest(pCsr, FTS5CSR_EOF) ); + /* If this cursor uses FTS5_PLAN_MATCH and this is a tokendata=1 table, + ** clear any token mappings accumulated at the fts5_index.c level. In + ** other cases, specifically FTS5_PLAN_SOURCE and FTS5_PLAN_SORTED_MATCH, + ** we need to retain the mappings for the entire query. */ + if( pCsr->ePlan==FTS5_PLAN_MATCH + && ((Fts5Table*)pCursor->pVtab)->pConfig->bTokendata + ){ + sqlite3Fts5ExprClearTokens(pCsr->pExpr); + } + if( pCsr->ePlan<3 ){ int bSkip = 0; if( (rc = fts5CursorReseek(pCsr, &bSkip)) || bSkip ) return rc; @@ -244251,6 +250950,9 @@ static int fts5FilterMethod( pCsr->iFirstRowid = fts5GetRowidLimit(pRowidGe, SMALLEST_INT64); } + rc = sqlite3Fts5IndexLoadConfig(pTab->p.pIndex); + if( rc!=SQLITE_OK ) goto filter_out; + if( pTab->pSortCsr ){ /* If pSortCsr is non-NULL, then this call is being made as part of ** processing for a "... MATCH ORDER BY rank" query (ePlan is @@ -244273,6 +250975,7 @@ static int fts5FilterMethod( pCsr->pExpr = pTab->pSortCsr->pExpr; rc = fts5CursorFirst(pTab, pCsr, bDesc); }else if( pCsr->pExpr ){ + assert( rc==SQLITE_OK ); rc = fts5CursorParseRank(pConfig, pCsr, pRank); if( rc==SQLITE_OK ){ if( bOrderByRank ){ @@ -244444,6 +251147,7 @@ static int fts5SpecialInsert( Fts5Config *pConfig = pTab->p.pConfig; int rc = SQLITE_OK; int bError = 0; + int bLoadConfig = 0; if( 0==sqlite3_stricmp("delete-all", zCmd) ){ if( pConfig->eContent==FTS5_CONTENT_NORMAL ){ @@ -244455,6 +251159,7 @@ static int fts5SpecialInsert( }else{ rc = sqlite3Fts5StorageDeleteAll(pTab->pStorage); } + bLoadConfig = 1; }else if( 0==sqlite3_stricmp("rebuild", zCmd) ){ if( pConfig->eContent==FTS5_CONTENT_NONE ){ fts5SetVtabError(pTab, @@ -244464,6 +251169,7 @@ static int fts5SpecialInsert( }else{ rc = sqlite3Fts5StorageRebuild(pTab->pStorage); } + bLoadConfig = 1; }else if( 0==sqlite3_stricmp("optimize", zCmd) ){ rc = sqlite3Fts5StorageOptimize(pTab->pStorage); }else if( 0==sqlite3_stricmp("merge", zCmd) ){ @@ -244476,8 +251182,13 @@ static int fts5SpecialInsert( }else if( 0==sqlite3_stricmp("prefix-index", zCmd) ){ pConfig->bPrefixIndex = sqlite3_value_int(pVal); #endif + }else if( 0==sqlite3_stricmp("flush", zCmd) ){ + rc = sqlite3Fts5FlushToDisk(&pTab->p); }else{ - rc = sqlite3Fts5IndexLoadConfig(pTab->p.pIndex); + rc = sqlite3Fts5FlushToDisk(&pTab->p); + if( rc==SQLITE_OK ){ + rc = sqlite3Fts5IndexLoadConfig(pTab->p.pIndex); + } if( rc==SQLITE_OK ){ rc = sqlite3Fts5ConfigSetValue(pTab->p.pConfig, zCmd, pVal, &bError); } @@ -244489,6 +251200,12 @@ static int fts5SpecialInsert( } } } + + if( rc==SQLITE_OK && bLoadConfig ){ + pTab->p.pConfig->iCookie--; + rc = sqlite3Fts5IndexLoadConfig(pTab->p.pIndex); + } + return rc; } @@ -244607,7 +251324,7 @@ static int fts5UpdateMethod( assert( nArg!=1 || eType0==SQLITE_INTEGER ); /* Filter out attempts to run UPDATE or DELETE on contentless tables. - ** This is not suported. Except - DELETE is supported if the CREATE + ** This is not suported. Except - they are both supported if the CREATE ** VIRTUAL TABLE statement contained "contentless_delete=1". */ if( eType0==SQLITE_INTEGER && pConfig->eContent==FTS5_CONTENT_NONE @@ -244636,7 +251353,8 @@ static int fts5UpdateMethod( } else if( eType0!=SQLITE_INTEGER ){ - /* If this is a REPLACE, first remove the current entry (if any) */ + /* An INSERT statement. If the conflict-mode is REPLACE, first remove + ** the current entry (if any). */ if( eConflict==SQLITE_REPLACE && eType1==SQLITE_INTEGER ){ i64 iNew = sqlite3_value_int64(apVal[1]); /* Rowid to delete */ rc = sqlite3Fts5StorageDelete(pTab->pStorage, iNew, 0); @@ -244795,7 +251513,10 @@ static int fts5ApiColumnText( ){ int rc = SQLITE_OK; Fts5Cursor *pCsr = (Fts5Cursor*)pCtx; - if( fts5IsContentless((Fts5FullTable*)(pCsr->base.pVtab)) + Fts5Table *pTab = (Fts5Table*)(pCsr->base.pVtab); + if( iCol<0 || iCol>=pTab->pConfig->nCol ){ + rc = SQLITE_RANGE; + }else if( fts5IsContentless((Fts5FullTable*)(pCsr->base.pVtab)) || pCsr->ePlan==FTS5_PLAN_SPECIAL ){ *pz = 0; @@ -244820,8 +251541,9 @@ static int fts5CsrPoslist( int rc = SQLITE_OK; int bLive = (pCsr->pSorter==0); - if( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_POSLIST) ){ - + if( iPhrase<0 || iPhrase>=sqlite3Fts5ExprPhraseCount(pCsr->pExpr) ){ + rc = SQLITE_RANGE; + }else if( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_POSLIST) ){ if( pConfig->eDetail!=FTS5_DETAIL_FULL ){ Fts5PoslistPopulator *aPopulator; int i; @@ -244845,15 +251567,21 @@ static int fts5CsrPoslist( CsrFlagClear(pCsr, FTS5CSR_REQUIRE_POSLIST); } - if( pCsr->pSorter && pConfig->eDetail==FTS5_DETAIL_FULL ){ - Fts5Sorter *pSorter = pCsr->pSorter; - int i1 = (iPhrase==0 ? 0 : pSorter->aIdx[iPhrase-1]); - *pn = pSorter->aIdx[iPhrase] - i1; - *pa = &pSorter->aPoslist[i1]; + if( rc==SQLITE_OK ){ + if( pCsr->pSorter && pConfig->eDetail==FTS5_DETAIL_FULL ){ + Fts5Sorter *pSorter = pCsr->pSorter; + int i1 = (iPhrase==0 ? 0 : pSorter->aIdx[iPhrase-1]); + *pn = pSorter->aIdx[iPhrase] - i1; + *pa = &pSorter->aPoslist[i1]; + }else{ + *pn = sqlite3Fts5ExprPoslist(pCsr->pExpr, iPhrase, pa); + } }else{ - *pn = sqlite3Fts5ExprPoslist(pCsr->pExpr, iPhrase, pa); + *pa = 0; + *pn = 0; } + return rc; } @@ -244960,12 +251688,6 @@ static int fts5ApiInst( ){ if( iIdx<0 || iIdx>=pCsr->nInstCount ){ rc = SQLITE_RANGE; -#if 0 - }else if( fts5IsOffsetless((Fts5Table*)pCsr->base.pVtab) ){ - *piPhrase = pCsr->aInst[iIdx*3]; - *piCol = pCsr->aInst[iIdx*3 + 2]; - *piOff = -1; -#endif }else{ *piPhrase = pCsr->aInst[iIdx*3]; *piCol = pCsr->aInst[iIdx*3 + 1]; @@ -245220,13 +251942,56 @@ static int fts5ApiPhraseFirstColumn( return rc; } +/* +** xQueryToken() API implemenetation. +*/ +static int fts5ApiQueryToken( + Fts5Context* pCtx, + int iPhrase, + int iToken, + const char **ppOut, + int *pnOut +){ + Fts5Cursor *pCsr = (Fts5Cursor*)pCtx; + return sqlite3Fts5ExprQueryToken(pCsr->pExpr, iPhrase, iToken, ppOut, pnOut); +} + +/* +** xInstToken() API implemenetation. +*/ +static int fts5ApiInstToken( + Fts5Context *pCtx, + int iIdx, + int iToken, + const char **ppOut, int *pnOut +){ + Fts5Cursor *pCsr = (Fts5Cursor*)pCtx; + int rc = SQLITE_OK; + if( CsrFlagTest(pCsr, FTS5CSR_REQUIRE_INST)==0 + || SQLITE_OK==(rc = fts5CacheInstArray(pCsr)) + ){ + if( iIdx<0 || iIdx>=pCsr->nInstCount ){ + rc = SQLITE_RANGE; + }else{ + int iPhrase = pCsr->aInst[iIdx*3]; + int iCol = pCsr->aInst[iIdx*3 + 1]; + int iOff = pCsr->aInst[iIdx*3 + 2]; + i64 iRowid = fts5CursorRowid(pCsr); + rc = sqlite3Fts5ExprInstToken( + pCsr->pExpr, iRowid, iPhrase, iCol, iOff, iToken, ppOut, pnOut + ); + } + } + return rc; +} + static int fts5ApiQueryPhrase(Fts5Context*, int, void*, int(*)(const Fts5ExtensionApi*, Fts5Context*, void*) ); static const Fts5ExtensionApi sFts5Api = { - 2, /* iVersion */ + 3, /* iVersion */ fts5ApiUserData, fts5ApiColumnCount, fts5ApiRowCount, @@ -245246,6 +252011,8 @@ static const Fts5ExtensionApi sFts5Api = { fts5ApiPhraseNext, fts5ApiPhraseFirstColumn, fts5ApiPhraseNextColumn, + fts5ApiQueryToken, + fts5ApiInstToken }; /* @@ -245510,8 +252277,10 @@ static int fts5RenameMethod( sqlite3_vtab *pVtab, /* Virtual table handle */ const char *zName /* New name of table */ ){ + int rc; Fts5FullTable *pTab = (Fts5FullTable*)pVtab; - return sqlite3Fts5StorageRename(pTab->pStorage, zName); + rc = sqlite3Fts5StorageRename(pTab->pStorage, zName); + return rc; } static int sqlite3Fts5FlushToDisk(Fts5Table *pTab){ @@ -245525,9 +252294,15 @@ static int sqlite3Fts5FlushToDisk(Fts5Table *pTab){ ** Flush the contents of the pending-terms table to disk. */ static int fts5SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){ - UNUSED_PARAM(iSavepoint); /* Call below is a no-op for NDEBUG builds */ - fts5CheckTransactionState((Fts5FullTable*)pVtab, FTS5_SAVEPOINT, iSavepoint); - return sqlite3Fts5FlushToDisk((Fts5Table*)pVtab); + Fts5FullTable *pTab = (Fts5FullTable*)pVtab; + int rc = SQLITE_OK; + + fts5CheckTransactionState(pTab, FTS5_SAVEPOINT, iSavepoint); + rc = sqlite3Fts5FlushToDisk((Fts5Table*)pVtab); + if( rc==SQLITE_OK ){ + pTab->iSavepoint = iSavepoint+1; + } + return rc; } /* @@ -245536,9 +252311,16 @@ static int fts5SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){ ** This is a no-op. */ static int fts5ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){ - UNUSED_PARAM(iSavepoint); /* Call below is a no-op for NDEBUG builds */ - fts5CheckTransactionState((Fts5FullTable*)pVtab, FTS5_RELEASE, iSavepoint); - return sqlite3Fts5FlushToDisk((Fts5Table*)pVtab); + Fts5FullTable *pTab = (Fts5FullTable*)pVtab; + int rc = SQLITE_OK; + fts5CheckTransactionState(pTab, FTS5_RELEASE, iSavepoint); + if( (iSavepoint+1)iSavepoint ){ + rc = sqlite3Fts5FlushToDisk(&pTab->p); + if( rc==SQLITE_OK ){ + pTab->iSavepoint = iSavepoint; + } + } + return rc; } /* @@ -245548,11 +252330,14 @@ static int fts5ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){ */ static int fts5RollbackToMethod(sqlite3_vtab *pVtab, int iSavepoint){ Fts5FullTable *pTab = (Fts5FullTable*)pVtab; - UNUSED_PARAM(iSavepoint); /* Call below is a no-op for NDEBUG builds */ + int rc = SQLITE_OK; fts5CheckTransactionState(pTab, FTS5_ROLLBACKTO, iSavepoint); fts5TripCursors(pTab); - pTab->p.pConfig->pgsz = 0; - return sqlite3Fts5StorageRollback(pTab->pStorage); + if( (iSavepoint+1)<=pTab->iSavepoint ){ + pTab->p.pConfig->pgsz = 0; + rc = sqlite3Fts5StorageRollback(pTab->pStorage); + } + return rc; } /* @@ -245754,7 +252539,7 @@ static void fts5SourceIdFunc( ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); - sqlite3_result_text(pCtx, "fts5: 2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0", -1, SQLITE_TRANSIENT); + sqlite3_result_text(pCtx, "fts5: 2024-05-23 13:25:27 96c92aba00c8375bc32fafcdf12429c58bd8aabfcadab6683e35bbb9cdebf19e", -1, SQLITE_TRANSIENT); } /* @@ -245772,9 +252557,41 @@ static int fts5ShadowName(const char *zName){ return 0; } +/* +** Run an integrity check on the FTS5 data structures. Return a string +** if anything is found amiss. Return a NULL pointer if everything is +** OK. +*/ +static int fts5IntegrityMethod( + sqlite3_vtab *pVtab, /* the FTS5 virtual table to check */ + const char *zSchema, /* Name of schema in which this table lives */ + const char *zTabname, /* Name of the table itself */ + int isQuick, /* True if this is a quick-check */ + char **pzErr /* Write error message here */ +){ + Fts5FullTable *pTab = (Fts5FullTable*)pVtab; + int rc; + + assert( pzErr!=0 && *pzErr==0 ); + UNUSED_PARAM(isQuick); + rc = sqlite3Fts5StorageIntegrity(pTab->pStorage, 0); + if( (rc&0xff)==SQLITE_CORRUPT ){ + *pzErr = sqlite3_mprintf("malformed inverted index for FTS5 table %s.%s", + zSchema, zTabname); + rc = (*pzErr) ? SQLITE_OK : SQLITE_NOMEM; + }else if( rc!=SQLITE_OK ){ + *pzErr = sqlite3_mprintf("unable to validate the inverted index for" + " FTS5 table %s.%s: %s", + zSchema, zTabname, sqlite3_errstr(rc)); + } + sqlite3Fts5IndexCloseReader(pTab->p.pIndex); + + return rc; +} + static int fts5Init(sqlite3 *db){ static const sqlite3_module fts5Mod = { - /* iVersion */ 3, + /* iVersion */ 4, /* xCreate */ fts5CreateMethod, /* xConnect */ fts5ConnectMethod, /* xBestIndex */ fts5BestIndexMethod, @@ -245797,7 +252614,8 @@ static int fts5Init(sqlite3 *db){ /* xSavepoint */ fts5SavepointMethod, /* xRelease */ fts5ReleaseMethod, /* xRollbackTo */ fts5RollbackToMethod, - /* xShadowName */ fts5ShadowName + /* xShadowName */ fts5ShadowName, + /* xIntegrity */ fts5IntegrityMethod }; int rc; @@ -246563,7 +253381,7 @@ static int sqlite3Fts5StorageRebuild(Fts5Storage *p){ } if( rc==SQLITE_OK ){ - rc = fts5StorageGetStmt(p, FTS5_STMT_SCAN, &pScan, 0); + rc = fts5StorageGetStmt(p, FTS5_STMT_SCAN, &pScan, pConfig->pzErrmsg); } while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pScan) ){ @@ -247074,7 +253892,9 @@ static int sqlite3Fts5StorageSync(Fts5Storage *p){ i64 iLastRowid = sqlite3_last_insert_rowid(p->pConfig->db); if( p->bTotalsValid ){ rc = fts5StorageSaveTotals(p); - p->bTotalsValid = 0; + if( rc==SQLITE_OK ){ + p->bTotalsValid = 0; + } } if( rc==SQLITE_OK ){ rc = sqlite3Fts5IndexSync(p->pIndex); @@ -247348,6 +254168,12 @@ static const unsigned char sqlite3Utf8Trans1[] = { #endif /* ifndef SQLITE_AMALGAMATION */ +#define FTS5_SKIP_UTF8(zIn) { \ + if( ((unsigned char)(*(zIn++)))>=0xc0 ){ \ + while( (((unsigned char)*zIn) & 0xc0)==0x80 ){ zIn++; } \ + } \ +} + typedef struct Unicode61Tokenizer Unicode61Tokenizer; struct Unicode61Tokenizer { unsigned char aTokenChar[128]; /* ASCII range token characters */ @@ -248383,6 +255209,7 @@ static int fts5PorterTokenize( typedef struct TrigramTokenizer TrigramTokenizer; struct TrigramTokenizer { int bFold; /* True to fold to lower-case */ + int iFoldParam; /* Parameter to pass to Fts5UnicodeFold() */ }; /* @@ -248409,6 +255236,7 @@ static int fts5TriCreate( }else{ int i; pNew->bFold = 1; + pNew->iFoldParam = 0; for(i=0; rc==SQLITE_OK && ibFold = (zArg[0]=='0'); } + }else if( 0==sqlite3_stricmp(azArg[i], "remove_diacritics") ){ + if( (zArg[0]!='0' && zArg[0]!='1' && zArg[0]!='2') || zArg[1] ){ + rc = SQLITE_ERROR; + }else{ + pNew->iFoldParam = (zArg[0]!='0') ? 2 : 0; + } }else{ rc = SQLITE_ERROR; } } + + if( pNew->iFoldParam!=0 && pNew->bFold==0 ){ + rc = SQLITE_ERROR; + } + if( rc!=SQLITE_OK ){ fts5TriDelete((Fts5Tokenizer*)pNew); pNew = 0; @@ -248443,40 +255282,62 @@ static int fts5TriTokenize( TrigramTokenizer *p = (TrigramTokenizer*)pTok; int rc = SQLITE_OK; char aBuf[32]; + char *zOut = aBuf; + int ii; const unsigned char *zIn = (const unsigned char*)pText; const unsigned char *zEof = &zIn[nText]; u32 iCode; + int aStart[3]; /* Input offset of each character in aBuf[] */ UNUSED_PARAM(unusedFlags); - while( 1 ){ - char *zOut = aBuf; - int iStart = zIn - (const unsigned char*)pText; - const unsigned char *zNext; - - READ_UTF8(zIn, zEof, iCode); - if( iCode==0 ) break; - zNext = zIn; - if( zInbFold ) iCode = sqlite3Fts5UnicodeFold(iCode, 0); - WRITE_UTF8(zOut, iCode); + + /* Populate aBuf[] with the characters for the first trigram. */ + for(ii=0; ii<3; ii++){ + do { + aStart[ii] = zIn - (const unsigned char*)pText; READ_UTF8(zIn, zEof, iCode); - if( iCode==0 ) break; - }else{ - break; - } - if( zInbFold ) iCode = sqlite3Fts5UnicodeFold(iCode, 0); - WRITE_UTF8(zOut, iCode); + if( iCode==0 ) return SQLITE_OK; + if( p->bFold ) iCode = sqlite3Fts5UnicodeFold(iCode, p->iFoldParam); + }while( iCode==0 ); + WRITE_UTF8(zOut, iCode); + } + + /* At the start of each iteration of this loop: + ** + ** aBuf: Contains 3 characters. The 3 characters of the next trigram. + ** zOut: Points to the byte following the last character in aBuf. + ** aStart[3]: Contains the byte offset in the input text corresponding + ** to the start of each of the three characters in the buffer. + */ + assert( zIn<=zEof ); + while( 1 ){ + int iNext; /* Start of character following current tri */ + const char *z1; + + /* Read characters from the input up until the first non-diacritic */ + do { + iNext = zIn - (const unsigned char*)pText; READ_UTF8(zIn, zEof, iCode); if( iCode==0 ) break; - if( p->bFold ) iCode = sqlite3Fts5UnicodeFold(iCode, 0); - WRITE_UTF8(zOut, iCode); - }else{ - break; - } - rc = xToken(pCtx, 0, aBuf, zOut-aBuf, iStart, iStart + zOut-aBuf); - if( rc!=SQLITE_OK ) break; - zIn = zNext; + if( p->bFold ) iCode = sqlite3Fts5UnicodeFold(iCode, p->iFoldParam); + }while( iCode==0 ); + + /* Pass the current trigram back to fts5 */ + rc = xToken(pCtx, 0, aBuf, zOut-aBuf, aStart[0], iNext); + if( iCode==0 || rc!=SQLITE_OK ) break; + + /* Remove the first character from buffer aBuf[]. Append the character + ** with codepoint iCode. */ + z1 = aBuf; + FTS5_SKIP_UTF8(z1); + memmove(aBuf, z1, zOut - z1); + zOut -= (z1 - aBuf); + WRITE_UTF8(zOut, iCode); + + /* Update the aStart[] array */ + aStart[0] = aStart[1]; + aStart[1] = aStart[2]; + aStart[2] = iNext; } return rc; @@ -248499,7 +255360,9 @@ static int sqlite3Fts5TokenizerPattern( ){ if( xCreate==fts5TriCreate ){ TrigramTokenizer *p = (TrigramTokenizer*)pTok; - return p->bFold ? FTS5_PATTERN_LIKE : FTS5_PATTERN_GLOB; + if( p->iFoldParam==0 ){ + return p->bFold ? FTS5_PATTERN_LIKE : FTS5_PATTERN_GLOB; + } } return FTS5_PATTERN_NONE; } @@ -250288,7 +257151,7 @@ static int fts5VocabFilterMethod( if( pEq ){ zTerm = (const char *)sqlite3_value_text(pEq); nTerm = sqlite3_value_bytes(pEq); - f = 0; + f = FTS5INDEX_QUERY_NOTOKENDATA; }else{ if( pGe ){ zTerm = (const char *)sqlite3_value_text(pGe); @@ -250442,7 +257305,8 @@ static int sqlite3Fts5VocabInit(Fts5Global *pGlobal, sqlite3 *db){ /* xSavepoint */ 0, /* xRelease */ 0, /* xRollbackTo */ 0, - /* xShadowName */ 0 + /* xShadowName */ 0, + /* xIntegrity */ 0 }; void *p = (void*)pGlobal; @@ -250771,6 +257635,7 @@ static sqlite3_module stmtModule = { 0, /* xRelease */ 0, /* xRollbackTo */ 0, /* xShadowName */ + 0 /* xIntegrity */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ diff --git a/src/sqlite/SQLite-3.43.1/sqlite3.h b/src/sqlite/SQLite-3.46.0/sqlite3.h similarity index 96% rename from src/sqlite/SQLite-3.43.1/sqlite3.h rename to src/sqlite/SQLite-3.46.0/sqlite3.h index b9d069298..57df8dcf2 100644 --- a/src/sqlite/SQLite-3.43.1/sqlite3.h +++ b/src/sqlite/SQLite-3.46.0/sqlite3.h @@ -146,9 +146,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.43.1" -#define SQLITE_VERSION_NUMBER 3043001 -#define SQLITE_SOURCE_ID "2023-09-11 12:01:27 2d3a40c05c49e1a49264912b1a05bc2143ac0e7c3df588276ce80a4cbc9bd1b0" +#define SQLITE_VERSION "3.46.0" +#define SQLITE_VERSION_NUMBER 3046000 +#define SQLITE_SOURCE_ID "2024-05-23 13:25:27 96c92aba00c8375bc32fafcdf12429c58bd8aabfcadab6683e35bbb9cdebf19e" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -420,6 +420,8 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**); ** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running. **
  • The application must not modify the SQL statement text passed into ** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running. +**
  • The application must not dereference the arrays or string pointers +** passed as the 3rd and 4th callback parameters after it returns. ** */ SQLITE_API int sqlite3_exec( @@ -762,11 +764,11 @@ struct sqlite3_file { ** ** xLock() upgrades the database file lock. In other words, xLock() moves the ** database file lock in the direction NONE toward EXCLUSIVE. The argument to -** xLock() is always on of SHARED, RESERVED, PENDING, or EXCLUSIVE, never +** xLock() is always one of SHARED, RESERVED, PENDING, or EXCLUSIVE, never ** SQLITE_LOCK_NONE. If the database file lock is already at or above the ** requested lock, then the call to xLock() is a no-op. ** xUnlock() downgrades the database file lock to either SHARED or NONE. -* If the lock is already at or below the requested lock state, then the call +** If the lock is already at or below the requested lock state, then the call ** to xUnlock() is a no-op. ** The xCheckReservedLock() method checks whether any database connection, ** either in this process or in some other process, is holding a RESERVED, @@ -2127,7 +2129,7 @@ struct sqlite3_mem_methods { ** is stored in each sorted record and the required column values loaded ** from the database as records are returned in sorted order. The default ** value for this option is to never use this optimization. Specifying a -** negative value for this option restores the default behaviour. +** negative value for this option restores the default behavior. ** This option is only available if SQLite is compiled with the ** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option. ** @@ -2141,6 +2143,22 @@ struct sqlite3_mem_methods { ** configuration setting is never used, then the default maximum is determined ** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that ** compile-time option is not set, then the default maximum is 1073741824. +** +** [[SQLITE_CONFIG_ROWID_IN_VIEW]] +**
    SQLITE_CONFIG_ROWID_IN_VIEW +**
    The SQLITE_CONFIG_ROWID_IN_VIEW option enables or disables the ability +** for VIEWs to have a ROWID. The capability can only be enabled if SQLite is +** compiled with -DSQLITE_ALLOW_ROWID_IN_VIEW, in which case the capability +** defaults to on. This configuration option queries the current setting or +** changes the setting to off or on. The argument is a pointer to an integer. +** If that integer initially holds a value of 1, then the ability for VIEWs to +** have ROWIDs is activated. If the integer initially holds zero, then the +** ability is deactivated. Any other initial value for the integer leaves the +** setting unchanged. After changes, if any, the integer is written with +** a 1 or 0, if the ability for VIEWs to have ROWIDs is on or off. If SQLite +** is compiled without -DSQLITE_ALLOW_ROWID_IN_VIEW (which is the usual and +** recommended case) then the integer is always filled with zero, regardless +** if its initial value. ** */ #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ @@ -2172,6 +2190,7 @@ struct sqlite3_mem_methods { #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */ #define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */ #define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */ +#define SQLITE_CONFIG_ROWID_IN_VIEW 30 /* int* */ /* ** CAPI3REF: Database Connection Configuration Options @@ -2302,7 +2321,7 @@ struct sqlite3_mem_methods { ** database handle, SQLite checks if this will mean that there are now no ** connections at all to the database. If so, it performs a checkpoint ** operation before closing the connection. This option may be used to -** override this behaviour. The first parameter passed to this operation +** override this behavior. The first parameter passed to this operation ** is an integer - positive to disable checkpoints-on-close, or zero (the ** default) to enable them, and negative to leave the setting unchanged. ** The second parameter is a pointer to an integer @@ -3286,8 +3305,8 @@ SQLITE_API int sqlite3_set_authorizer( #define SQLITE_RECURSIVE 33 /* NULL NULL */ /* -** CAPI3REF: Tracing And Profiling Functions -** METHOD: sqlite3 +** CAPI3REF: Deprecated Tracing And Profiling Functions +** DEPRECATED ** ** These routines are deprecated. Use the [sqlite3_trace_v2()] interface ** instead of the routines described here. @@ -3954,14 +3973,17 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename); ** ** ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language -** text that describes the error, as either UTF-8 or UTF-16 respectively. +** text that describes the error, as either UTF-8 or UTF-16 respectively, +** or NULL if no error message is available. +** (See how SQLite handles [invalid UTF] for exceptions to this rule.) ** ^(Memory to hold the error message string is managed internally. ** The application does not need to worry about freeing the result. ** However, the error string might be overwritten or deallocated by ** subsequent calls to other SQLite interface functions.)^ ** -** ^The sqlite3_errstr() interface returns the English-language text -** that describes the [result code], as UTF-8. +** ^The sqlite3_errstr(E) interface returns the English-language text +** that describes the [result code] E, as UTF-8, or NULL if E is not an +** result code for which a text error message is available. ** ^(Memory to hold the error message string is managed internally ** and must not be freed by the application)^. ** @@ -5325,6 +5347,7 @@ SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt); */ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); + /* ** CAPI3REF: Create Or Redefine SQL Functions ** KEYWORDS: {function creation routines} @@ -5571,13 +5594,27 @@ SQLITE_API int sqlite3_create_window_function( **
    ** ** [[SQLITE_SUBTYPE]]
    SQLITE_SUBTYPE
    -** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call +** The SQLITE_SUBTYPE flag indicates to SQLite that a function might call ** [sqlite3_value_subtype()] to inspect the sub-types of its arguments. -** Specifying this flag makes no difference for scalar or aggregate user -** functions. However, if it is not specified for a user-defined window -** function, then any sub-types belonging to arguments passed to the window -** function may be discarded before the window function is called (i.e. -** sqlite3_value_subtype() will always return 0). +** This flag instructs SQLite to omit some corner-case optimizations that +** might disrupt the operation of the [sqlite3_value_subtype()] function, +** causing it to return zero rather than the correct subtype(). +** SQL functions that invokes [sqlite3_value_subtype()] should have this +** property. If the SQLITE_SUBTYPE property is omitted, then the return +** value from [sqlite3_value_subtype()] might sometimes be zero even though +** a non-zero subtype was specified by the function argument expression. +** +** [[SQLITE_RESULT_SUBTYPE]]
    SQLITE_RESULT_SUBTYPE
    +** The SQLITE_RESULT_SUBTYPE flag indicates to SQLite that a function might call +** [sqlite3_result_subtype()] to cause a sub-type to be associated with its +** result. +** Every function that invokes [sqlite3_result_subtype()] should have this +** property. If it does not, then the call to [sqlite3_result_subtype()] +** might become a no-op if the function is used as term in an +** [expression index]. On the other hand, SQL functions that never invoke +** [sqlite3_result_subtype()] should avoid setting this property, as the +** purpose of this property is to disable certain optimizations that are +** incompatible with subtypes. **
    ** */ @@ -5585,6 +5622,7 @@ SQLITE_API int sqlite3_create_window_function( #define SQLITE_DIRECTONLY 0x000080000 #define SQLITE_SUBTYPE 0x000100000 #define SQLITE_INNOCUOUS 0x000200000 +#define SQLITE_RESULT_SUBTYPE 0x001000000 /* ** CAPI3REF: Deprecated Functions @@ -5781,6 +5819,12 @@ SQLITE_API int sqlite3_value_encoding(sqlite3_value*); ** information can be used to pass a limited amount of context from ** one SQL function to another. Use the [sqlite3_result_subtype()] ** routine to set the subtype for the return value of an SQL function. +** +** Every [application-defined SQL function] that invoke this interface +** should include the [SQLITE_SUBTYPE] property in the text +** encoding argument when the function is [sqlite3_create_function|registered]. +** If the [SQLITE_SUBTYPE] property is omitted, then sqlite3_value_subtype() +** might return zero instead of the upstream subtype in some corner cases. */ SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*); @@ -5879,48 +5923,56 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); ** METHOD: sqlite3_context ** ** These functions may be used by (non-aggregate) SQL functions to -** associate metadata with argument values. If the same value is passed to -** multiple invocations of the same SQL function during query execution, under -** some circumstances the associated metadata may be preserved. An example -** of where this might be useful is in a regular-expression matching -** function. The compiled version of the regular expression can be stored as -** metadata associated with the pattern string. +** associate auxiliary data with argument values. If the same argument +** value is passed to multiple invocations of the same SQL function during +** query execution, under some circumstances the associated auxiliary data +** might be preserved. An example of where this might be useful is in a +** regular-expression matching function. The compiled version of the regular +** expression can be stored as auxiliary data associated with the pattern string. ** Then as long as the pattern string remains the same, ** the compiled regular expression can be reused on multiple ** invocations of the same function. ** -** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the metadata +** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the auxiliary data ** associated by the sqlite3_set_auxdata(C,N,P,X) function with the Nth argument ** value to the application-defined function. ^N is zero for the left-most -** function argument. ^If there is no metadata +** function argument. ^If there is no auxiliary data ** associated with the function argument, the sqlite3_get_auxdata(C,N) interface ** returns a NULL pointer. ** -** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th -** argument of the application-defined function. ^Subsequent +** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as auxiliary data for the +** N-th argument of the application-defined function. ^Subsequent ** calls to sqlite3_get_auxdata(C,N) return P from the most recent -** sqlite3_set_auxdata(C,N,P,X) call if the metadata is still valid or -** NULL if the metadata has been discarded. +** sqlite3_set_auxdata(C,N,P,X) call if the auxiliary data is still valid or +** NULL if the auxiliary data has been discarded. ** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL, ** SQLite will invoke the destructor function X with parameter P exactly -** once, when the metadata is discarded. -** SQLite is free to discard the metadata at any time, including:
      +** once, when the auxiliary data is discarded. +** SQLite is free to discard the auxiliary data at any time, including:
        **
      • ^(when the corresponding function parameter changes)^, or **
      • ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the ** SQL statement)^, or **
      • ^(when sqlite3_set_auxdata() is invoked again on the same ** parameter)^, or **
      • ^(during the original sqlite3_set_auxdata() call when a memory -** allocation error occurs.)^
      +** allocation error occurs.)^ +**
    • ^(during the original sqlite3_set_auxdata() call if the function +** is evaluated during query planning instead of during query execution, +** as sometimes happens with [SQLITE_ENABLE_STAT4].)^
    ** -** Note the last bullet in particular. The destructor X in +** Note the last two bullets in particular. The destructor X in ** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the ** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata() ** should be called near the end of the function implementation and the ** function implementation should not make any use of P after -** sqlite3_set_auxdata() has been called. -** -** ^(In practice, metadata is preserved between function calls for +** sqlite3_set_auxdata() has been called. Furthermore, a call to +** sqlite3_get_auxdata() that occurs immediately after a corresponding call +** to sqlite3_set_auxdata() might still return NULL if an out-of-memory +** condition occurred during the sqlite3_set_auxdata() call or if the +** function is being evaluated during query planning rather than during +** query execution. +** +** ^(In practice, auxiliary data is preserved between function calls for ** function parameters that are compile-time constants, including literal ** values and [parameters] and expressions composed from the same.)^ ** @@ -5930,10 +5982,67 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); ** ** These routines must be called from the same thread in which ** the SQL function is running. +** +** See also: [sqlite3_get_clientdata()] and [sqlite3_set_clientdata()]. */ SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N); SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*)); +/* +** CAPI3REF: Database Connection Client Data +** METHOD: sqlite3 +** +** These functions are used to associate one or more named pointers +** with a [database connection]. +** A call to sqlite3_set_clientdata(D,N,P,X) causes the pointer P +** to be attached to [database connection] D using name N. Subsequent +** calls to sqlite3_get_clientdata(D,N) will return a copy of pointer P +** or a NULL pointer if there were no prior calls to +** sqlite3_set_clientdata() with the same values of D and N. +** Names are compared using strcmp() and are thus case sensitive. +** +** If P and X are both non-NULL, then the destructor X is invoked with +** argument P on the first of the following occurrences: +**
      +**
    • An out-of-memory error occurs during the call to +** sqlite3_set_clientdata() which attempts to register pointer P. +**
    • A subsequent call to sqlite3_set_clientdata(D,N,P,X) is made +** with the same D and N parameters. +**
    • The database connection closes. SQLite does not make any guarantees +** about the order in which destructors are called, only that all +** destructors will be called exactly once at some point during the +** database connection closing process. +**
    +** +** SQLite does not do anything with client data other than invoke +** destructors on the client data at the appropriate time. The intended +** use for client data is to provide a mechanism for wrapper libraries +** to store additional information about an SQLite database connection. +** +** There is no limit (other than available memory) on the number of different +** client data pointers (with different names) that can be attached to a +** single database connection. However, the implementation is optimized +** for the case of having only one or two different client data names. +** Applications and wrapper libraries are discouraged from using more than +** one client data name each. +** +** There is no way to enumerate the client data pointers +** associated with a database connection. The N parameter can be thought +** of as a secret key such that only code that knows the secret key is able +** to access the associated data. +** +** Security Warning: These interfaces should not be exposed in scripting +** languages or in other circumstances where it might be possible for an +** an attacker to invoke them. Any agent that can invoke these interfaces +** can probably also take control of the process. +** +** Database connection client data is only available for SQLite +** version 3.44.0 ([dateof:3.44.0]) and later. +** +** See also: [sqlite3_set_auxdata()] and [sqlite3_get_auxdata()]. +*/ +SQLITE_API void *sqlite3_get_clientdata(sqlite3*,const char*); +SQLITE_API int sqlite3_set_clientdata(sqlite3*, const char*, void*, void(*)(void*)); /* ** CAPI3REF: Constants Defining Special Destructor Behavior @@ -6135,6 +6244,20 @@ SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n); ** higher order bits are discarded. ** The number of subtype bytes preserved by SQLite might increase ** in future releases of SQLite. +** +** Every [application-defined SQL function] that invokes this interface +** should include the [SQLITE_RESULT_SUBTYPE] property in its +** text encoding argument when the SQL function is +** [sqlite3_create_function|registered]. If the [SQLITE_RESULT_SUBTYPE] +** property is omitted from the function that invokes sqlite3_result_subtype(), +** then in some cases the sqlite3_result_subtype() might fail to set +** the result subtype. +** +** If SQLite is compiled with -DSQLITE_STRICT_SUBTYPE=1, then any +** SQL function that invokes the sqlite3_result_subtype() interface +** and that does not have the SQLITE_RESULT_SUBTYPE property will raise +** an error. Future versions of SQLite might enable -DSQLITE_STRICT_SUBTYPE=1 +** by default. */ SQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int); @@ -6566,7 +6689,7 @@ SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName); SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema); /* -** CAPI3REF: Allowed return values from [sqlite3_txn_state()] +** CAPI3REF: Allowed return values from sqlite3_txn_state() ** KEYWORDS: {transaction state} ** ** These constants define the current transaction state of a database file. @@ -6698,7 +6821,7 @@ SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); ** ^Each call to the sqlite3_autovacuum_pages() interface overrides all ** previous invocations for that database connection. ^If the callback ** argument (C) to sqlite3_autovacuum_pages(D,C,P,X) is a NULL pointer, -** then the autovacuum steps callback is cancelled. The return value +** then the autovacuum steps callback is canceled. The return value ** from sqlite3_autovacuum_pages() is normally SQLITE_OK, but might ** be some other error code if something goes wrong. The current ** implementation will only return SQLITE_OK or SQLITE_MISUSE, but other @@ -6764,6 +6887,12 @@ SQLITE_API int sqlite3_autovacuum_pages( ** The exceptions defined in this paragraph might change in a future ** release of SQLite. ** +** Whether the update hook is invoked before or after the +** corresponding change is currently unspecified and may differ +** depending on the type of change. Do not rely on the order of the +** hook call with regards to the final result of the operation which +** triggers the hook. +** ** The update hook implementation must not do anything that will modify ** the database connection that invoked the update hook. Any actions ** to modify the database connection must be deferred until after the @@ -7217,6 +7346,10 @@ struct sqlite3_module { /* The methods above are in versions 1 and 2 of the sqlite_module object. ** Those below are for version 3 and greater. */ int (*xShadowName)(const char*); + /* The methods above are in versions 1 through 3 of the sqlite_module object. + ** Those below are for version 4 and greater. */ + int (*xIntegrity)(sqlite3_vtab *pVTab, const char *zSchema, + const char *zTabName, int mFlags, char **pzErr); }; /* @@ -7704,7 +7837,7 @@ SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); ** code is returned and the transaction rolled back. ** ** Calling this function with an argument that is not a NULL pointer or an -** open blob handle results in undefined behaviour. ^Calling this routine +** open blob handle results in undefined behavior. ^Calling this routine ** with a null pointer (such as would be returned by a failed call to ** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function ** is passed a valid open blob handle, the values returned by the @@ -7931,9 +8064,11 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*); ** ** ^(Some systems (for example, Windows 95) do not support the operation ** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try() -** will always return SQLITE_BUSY. The SQLite core only ever uses -** sqlite3_mutex_try() as an optimization so this is acceptable -** behavior.)^ +** will always return SQLITE_BUSY. In most cases the SQLite core only uses +** sqlite3_mutex_try() as an optimization, so this is acceptable +** behavior. The exceptions are unix builds that set the +** SQLITE_ENABLE_SETLK_TIMEOUT build option. In that case a working +** sqlite3_mutex_try() is required.)^ ** ** ^The sqlite3_mutex_leave() routine exits a mutex that was ** previously entered by the same thread. The behavior @@ -8184,6 +8319,7 @@ SQLITE_API int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_PRNG_SAVE 5 #define SQLITE_TESTCTRL_PRNG_RESTORE 6 #define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */ +#define SQLITE_TESTCTRL_FK_NO_ACTION 7 #define SQLITE_TESTCTRL_BITVEC_TEST 8 #define SQLITE_TESTCTRL_FAULT_INSTALL 9 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 @@ -8191,6 +8327,7 @@ SQLITE_API int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_ASSERT 12 #define SQLITE_TESTCTRL_ALWAYS 13 #define SQLITE_TESTCTRL_RESERVE 14 /* NOT USED */ +#define SQLITE_TESTCTRL_JSON_SELFCHECK 14 #define SQLITE_TESTCTRL_OPTIMIZATIONS 15 #define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */ #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */ @@ -8226,7 +8363,7 @@ SQLITE_API int sqlite3_test_control(int op, ...); ** The sqlite3_keyword_count() interface returns the number of distinct ** keywords understood by SQLite. ** -** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and +** The sqlite3_keyword_name(N,Z,L) interface finds the 0-based N-th keyword and ** makes *Z point to that keyword expressed as UTF8 and writes the number ** of bytes in the keyword into *L. The string that *Z points to is not ** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns @@ -9245,8 +9382,8 @@ SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); ** blocked connection already has a registered unlock-notify callback, ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is ** called with a NULL pointer as its second argument, then any existing -** unlock-notify callback is cancelled. ^The blocked connections -** unlock-notify callback may also be cancelled by closing the blocked +** unlock-notify callback is canceled. ^The blocked connections +** unlock-notify callback may also be canceled by closing the blocked ** connection using [sqlite3_close()]. ** ** The unlock-notify callback is not reentrant. If an application invokes @@ -9805,24 +9942,45 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int); **
  • ** ^(If the sqlite3_vtab_distinct() interface returns 2, that means ** that the query planner does not need the rows returned in any particular -** order, as long as rows with the same values in all "aOrderBy" columns -** are adjacent.)^ ^(Furthermore, only a single row for each particular -** combination of values in the columns identified by the "aOrderBy" field -** needs to be returned.)^ ^It is always ok for two or more rows with the same -** values in all "aOrderBy" columns to be returned, as long as all such rows -** are adjacent. ^The virtual table may, if it chooses, omit extra rows -** that have the same value for all columns identified by "aOrderBy". -** ^However omitting the extra rows is optional. +** order, as long as rows with the same values in all columns identified +** by "aOrderBy" are adjacent.)^ ^(Furthermore, when two or more rows +** contain the same values for all columns identified by "colUsed", all but +** one such row may optionally be omitted from the result.)^ +** The virtual table is not required to omit rows that are duplicates +** over the "colUsed" columns, but if the virtual table can do that without +** too much extra effort, it could potentially help the query to run faster. ** This mode is used for a DISTINCT query. **

  • -** ^(If the sqlite3_vtab_distinct() interface returns 3, that means -** that the query planner needs only distinct rows but it does need the -** rows to be sorted.)^ ^The virtual table implementation is free to omit -** rows that are identical in all aOrderBy columns, if it wants to, but -** it is not required to omit any rows. This mode is used for queries +** ^(If the sqlite3_vtab_distinct() interface returns 3, that means the +** virtual table must return rows in the order defined by "aOrderBy" as +** if the sqlite3_vtab_distinct() interface had returned 0. However if +** two or more rows in the result have the same values for all columns +** identified by "colUsed", then all but one such row may optionally be +** omitted.)^ Like when the return value is 2, the virtual table +** is not required to omit rows that are duplicates over the "colUsed" +** columns, but if the virtual table can do that without +** too much extra effort, it could potentially help the query to run faster. +** This mode is used for queries ** that have both DISTINCT and ORDER BY clauses. ** ** +**

    The following table summarizes the conditions under which the +** virtual table is allowed to set the "orderByConsumed" flag based on +** the value returned by sqlite3_vtab_distinct(). This table is a +** restatement of the previous four paragraphs: +** +** +** +**
    sqlite3_vtab_distinct() return value +** Rows are returned in aOrderBy order +** Rows with the same value in all aOrderBy columns are adjacent +** Duplicates over all colUsed columns may be omitted +**
    0yesyesno +**
    1noyesno +**
    2noyesyes +**
    3yesyesyes +**
    +** ** ^For the purposes of comparing virtual table output values to see if the ** values are same value for sorting purposes, two NULL values are considered ** to be the same. In other words, the comparison operator is "IS" @@ -10549,6 +10707,13 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c ** SQLITE_SERIALIZE_NOCOPY bit is set but no contiguous copy ** of the database exists. ** +** After the call, if the SQLITE_SERIALIZE_NOCOPY bit had been set, +** the returned buffer content will remain accessible and unchanged +** until either the next write operation on the connection or when +** the connection is closed, and applications must not modify the +** buffer. If the bit had been clear, the returned buffer will not +** be accessed by SQLite after the call. +** ** A call to sqlite3_serialize(D,S,P,F) might return NULL even if the ** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory ** allocation error occurs. @@ -10597,6 +10762,9 @@ SQLITE_API unsigned char *sqlite3_serialize( ** SQLite will try to increase the buffer size using sqlite3_realloc64() ** if writes on the database cause it to grow larger than M bytes. ** +** Applications must not modify the buffer P or invalidate it before +** the database connection D is closed. +** ** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the ** database is currently in a read transaction or is involved in a backup ** operation. @@ -10605,6 +10773,13 @@ SQLITE_API unsigned char *sqlite3_serialize( ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the ** function returns SQLITE_ERROR. ** +** The deserialized database should not be in [WAL mode]. If the database +** is in WAL mode, then any attempt to use the database file will result +** in an [SQLITE_CANTOPEN] error. The application can set the +** [file format version numbers] (bytes 18 and 19) of the input database P +** to 0x01 prior to invoking sqlite3_deserialize(D,S,P,N,M,F) to force the +** database file into rollback mode and work around this limitation. +** ** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the ** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then ** [sqlite3_free()] is invoked on argument P prior to returning. @@ -11677,6 +11852,18 @@ SQLITE_API int sqlite3changeset_concat( ); +/* +** CAPI3REF: Upgrade the Schema of a Changeset/Patchset +*/ +SQLITE_API int sqlite3changeset_upgrade( + sqlite3 *db, + const char *zDb, + int nIn, const void *pIn, /* Input changeset */ + int *pnOut, void **ppOut /* OUT: Inverse of input */ +); + + + /* ** CAPI3REF: Changegroup Handle ** @@ -11723,6 +11910,38 @@ typedef struct sqlite3_changegroup sqlite3_changegroup; */ SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp); +/* +** CAPI3REF: Add a Schema to a Changegroup +** METHOD: sqlite3_changegroup_schema +** +** This method may be used to optionally enforce the rule that the changesets +** added to the changegroup handle must match the schema of database zDb +** ("main", "temp", or the name of an attached database). If +** sqlite3changegroup_add() is called to add a changeset that is not compatible +** with the configured schema, SQLITE_SCHEMA is returned and the changegroup +** object is left in an undefined state. +** +** A changeset schema is considered compatible with the database schema in +** the same way as for sqlite3changeset_apply(). Specifically, for each +** table in the changeset, there exists a database table with: +** +**

      +**
    • The name identified by the changeset, and +**
    • at least as many columns as recorded in the changeset, and +**
    • the primary key columns in the same position as recorded in +** the changeset. +**
    +** +** The output of the changegroup object always has the same schema as the +** database nominated using this function. In cases where changesets passed +** to sqlite3changegroup_add() have fewer columns than the corresponding table +** in the database schema, these are filled in using the default column +** values from the database schema. This makes it possible to combined +** changesets that have different numbers of columns for a single table +** within a changegroup, provided that they are otherwise compatible. +*/ +SQLITE_API int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const char *zDb); + /* ** CAPI3REF: Add A Changeset To A Changegroup ** METHOD: sqlite3_changegroup @@ -11791,16 +12010,45 @@ SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp); ** If the new changeset contains changes to a table that is already present ** in the changegroup, then the number of columns and the position of the ** primary key columns for the table must be consistent. If this is not the -** case, this function fails with SQLITE_SCHEMA. If the input changeset -** appears to be corrupt and the corruption is detected, SQLITE_CORRUPT is -** returned. Or, if an out-of-memory condition occurs during processing, this -** function returns SQLITE_NOMEM. In all cases, if an error occurs the state -** of the final contents of the changegroup is undefined. +** case, this function fails with SQLITE_SCHEMA. Except, if the changegroup +** object has been configured with a database schema using the +** sqlite3changegroup_schema() API, then it is possible to combine changesets +** with different numbers of columns for a single table, provided that +** they are otherwise compatible. +** +** If the input changeset appears to be corrupt and the corruption is +** detected, SQLITE_CORRUPT is returned. Or, if an out-of-memory condition +** occurs during processing, this function returns SQLITE_NOMEM. ** -** If no error occurs, SQLITE_OK is returned. +** In all cases, if an error occurs the state of the final contents of the +** changegroup is undefined. If no error occurs, SQLITE_OK is returned. */ SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); +/* +** CAPI3REF: Add A Single Change To A Changegroup +** METHOD: sqlite3_changegroup +** +** This function adds the single change currently indicated by the iterator +** passed as the second argument to the changegroup object. The rules for +** adding the change are just as described for [sqlite3changegroup_add()]. +** +** If the change is successfully added to the changegroup, SQLITE_OK is +** returned. Otherwise, an SQLite error code is returned. +** +** The iterator must point to a valid entry when this function is called. +** If it does not, SQLITE_ERROR is returned and no change is added to the +** changegroup. Additionally, the iterator must not have been opened with +** the SQLITE_CHANGESETAPPLY_INVERT flag. In this case SQLITE_ERROR is also +** returned. +*/ +SQLITE_API int sqlite3changegroup_add_change( + sqlite3_changegroup*, + sqlite3_changeset_iter* +); + + + /* ** CAPI3REF: Obtain A Composite Changeset From A Changegroup ** METHOD: sqlite3_changegroup @@ -12062,10 +12310,17 @@ SQLITE_API int sqlite3changeset_apply_v2( **
  • an insert change if all fields of the conflicting row match ** the row being inserted. ** +** +**
    SQLITE_CHANGESETAPPLY_FKNOACTION
    +** If this flag it set, then all foreign key constraints in the target +** database behave as if they were declared with "ON UPDATE NO ACTION ON +** DELETE NO ACTION", even if they are actually CASCADE, RESTRICT, SET NULL +** or SET DEFAULT. */ #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001 #define SQLITE_CHANGESETAPPLY_INVERT 0x0002 #define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004 +#define SQLITE_CHANGESETAPPLY_FKNOACTION 0x0008 /* ** CAPI3REF: Constants Passed To The Conflict Handler @@ -12598,8 +12853,8 @@ struct Fts5PhraseIter { ** EXTENSION API FUNCTIONS ** ** xUserData(pFts): -** Return a copy of the context pointer the extension function was -** registered with. +** Return a copy of the pUserData pointer passed to the xCreateFunction() +** API when the extension function was registered. ** ** xColumnTotalSize(pFts, iCol, pnToken): ** If parameter iCol is less than zero, set output variable *pnToken @@ -12631,8 +12886,11 @@ struct Fts5PhraseIter { ** created with the "columnsize=0" option. ** ** xColumnText: -** This function attempts to retrieve the text of column iCol of the -** current document. If successful, (*pz) is set to point to a buffer +** If parameter iCol is less than zero, or greater than or equal to the +** number of columns in the table, SQLITE_RANGE is returned. +** +** Otherwise, this function attempts to retrieve the text of column iCol of +** the current document. If successful, (*pz) is set to point to a buffer ** containing the text in utf-8 encoding, (*pn) is set to the size in bytes ** (not characters) of the buffer and SQLITE_OK is returned. Otherwise, ** if an error occurs, an SQLite error code is returned and the final values @@ -12642,8 +12900,10 @@ struct Fts5PhraseIter { ** Returns the number of phrases in the current query expression. ** ** xPhraseSize: -** Returns the number of tokens in phrase iPhrase of the query. Phrases -** are numbered starting from zero. +** If parameter iCol is less than zero, or greater than or equal to the +** number of phrases in the current query, as returned by xPhraseCount, +** 0 is returned. Otherwise, this function returns the number of tokens in +** phrase iPhrase of the query. Phrases are numbered starting from zero. ** ** xInstCount: ** Set *pnInst to the total number of occurrences of all phrases within @@ -12659,12 +12919,13 @@ struct Fts5PhraseIter { ** Query for the details of phrase match iIdx within the current row. ** Phrase matches are numbered starting from zero, so the iIdx argument ** should be greater than or equal to zero and smaller than the value -** output by xInstCount(). +** output by xInstCount(). If iIdx is less than zero or greater than +** or equal to the value returned by xInstCount(), SQLITE_RANGE is returned. ** -** Usually, output parameter *piPhrase is set to the phrase number, *piCol +** Otherwise, output parameter *piPhrase is set to the phrase number, *piCol ** to the column in which it occurs and *piOff the token offset of the -** first token of the phrase. Returns SQLITE_OK if successful, or an error -** code (i.e. SQLITE_NOMEM) if an error occurs. +** first token of the phrase. SQLITE_OK is returned if successful, or an +** error code (i.e. SQLITE_NOMEM) if an error occurs. ** ** This API can be quite slow if used with an FTS5 table created with the ** "detail=none" or "detail=column" option. @@ -12690,6 +12951,10 @@ struct Fts5PhraseIter { ** Invoking Api.xUserData() returns a copy of the pointer passed as ** the third argument to pUserData. ** +** If parameter iPhrase is less than zero, or greater than or equal to +** the number of phrases in the query, as returned by xPhraseCount(), +** this function returns SQLITE_RANGE. +** ** If the callback function returns any value other than SQLITE_OK, the ** query is abandoned and the xQueryPhrase function returns immediately. ** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK. @@ -12804,9 +13069,42 @@ struct Fts5PhraseIter { ** ** xPhraseNextColumn() ** See xPhraseFirstColumn above. +** +** xQueryToken(pFts5, iPhrase, iToken, ppToken, pnToken) +** This is used to access token iToken of phrase iPhrase of the current +** query. Before returning, output parameter *ppToken is set to point +** to a buffer containing the requested token, and *pnToken to the +** size of this buffer in bytes. +** +** If iPhrase or iToken are less than zero, or if iPhrase is greater than +** or equal to the number of phrases in the query as reported by +** xPhraseCount(), or if iToken is equal to or greater than the number of +** tokens in the phrase, SQLITE_RANGE is returned and *ppToken and *pnToken + are both zeroed. +** +** The output text is not a copy of the query text that specified the +** token. It is the output of the tokenizer module. For tokendata=1 +** tables, this includes any embedded 0x00 and trailing data. +** +** xInstToken(pFts5, iIdx, iToken, ppToken, pnToken) +** This is used to access token iToken of phrase hit iIdx within the +** current row. If iIdx is less than zero or greater than or equal to the +** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise, +** output variable (*ppToken) is set to point to a buffer containing the +** matching document token, and (*pnToken) to the size of that buffer in +** bytes. This API is not available if the specified token matches a +** prefix query term. In that case both output variables are always set +** to 0. +** +** The output text is not a copy of the document text that was tokenized. +** It is the output of the tokenizer module. For tokendata=1 tables, this +** includes any embedded 0x00 and trailing data. +** +** This API can be quite slow if used with an FTS5 table created with the +** "detail=none" or "detail=column" option. */ struct Fts5ExtensionApi { - int iVersion; /* Currently always set to 2 */ + int iVersion; /* Currently always set to 3 */ void *(*xUserData)(Fts5Context*); @@ -12841,6 +13139,13 @@ struct Fts5ExtensionApi { int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*); void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol); + + /* Below this point are iVersion>=3 only */ + int (*xQueryToken)(Fts5Context*, + int iPhrase, int iToken, + const char **ppToken, int *pnToken + ); + int (*xInstToken)(Fts5Context*, int iIdx, int iToken, const char**, int*); }; /* diff --git a/src/sqlite/SQLite-3.43.1/sqlite3.pc.in b/src/sqlite/SQLite-3.46.0/sqlite3.pc.in similarity index 100% rename from src/sqlite/SQLite-3.43.1/sqlite3.pc.in rename to src/sqlite/SQLite-3.46.0/sqlite3.pc.in diff --git a/src/sqlite/SQLite-3.43.1/sqlite3.rc b/src/sqlite/SQLite-3.46.0/sqlite3.rc similarity index 100% rename from src/sqlite/SQLite-3.43.1/sqlite3.rc rename to src/sqlite/SQLite-3.46.0/sqlite3.rc diff --git a/src/sqlite/SQLite-3.43.1/sqlite3ext.h b/src/sqlite/SQLite-3.46.0/sqlite3ext.h similarity index 99% rename from src/sqlite/SQLite-3.43.1/sqlite3ext.h rename to src/sqlite/SQLite-3.46.0/sqlite3ext.h index 711638099..ae0949baf 100644 --- a/src/sqlite/SQLite-3.43.1/sqlite3ext.h +++ b/src/sqlite/SQLite-3.46.0/sqlite3ext.h @@ -363,6 +363,9 @@ struct sqlite3_api_routines { int (*is_interrupted)(sqlite3*); /* Version 3.43.0 and later */ int (*stmt_explain)(sqlite3_stmt*,int); + /* Version 3.44.0 and later */ + void *(*get_clientdata)(sqlite3*,const char*); + int (*set_clientdata)(sqlite3*, const char*, void*, void(*)(void*)); }; /* @@ -693,6 +696,9 @@ typedef int (*sqlite3_loadext_entry)( #define sqlite3_is_interrupted sqlite3_api->is_interrupted /* Version 3.43.0 and later */ #define sqlite3_stmt_explain sqlite3_api->stmt_explain +/* Version 3.44.0 and later */ +#define sqlite3_get_clientdata sqlite3_api->get_clientdata +#define sqlite3_set_clientdata sqlite3_api->set_clientdata #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) diff --git a/src/sqlite/SQLite-3.43.1/sqlite3rc.h b/src/sqlite/SQLite-3.46.0/sqlite3rc.h similarity index 50% rename from src/sqlite/SQLite-3.43.1/sqlite3rc.h rename to src/sqlite/SQLite-3.46.0/sqlite3rc.h index 9fe5a4812..eb16b8fff 100644 --- a/src/sqlite/SQLite-3.43.1/sqlite3rc.h +++ b/src/sqlite/SQLite-3.46.0/sqlite3rc.h @@ -1,3 +1,3 @@ #ifndef SQLITE_RESOURCE_VERSION -#define SQLITE_RESOURCE_VERSION 3,43,1 +#define SQLITE_RESOURCE_VERSION 3,46,0 #endif diff --git a/src/sqlite/SQLite-3.43.1/tea/Makefile.in b/src/sqlite/SQLite-3.46.0/tea/Makefile.in similarity index 100% rename from src/sqlite/SQLite-3.43.1/tea/Makefile.in rename to src/sqlite/SQLite-3.46.0/tea/Makefile.in diff --git a/src/sqlite/SQLite-3.43.1/tea/README b/src/sqlite/SQLite-3.46.0/tea/README similarity index 100% rename from src/sqlite/SQLite-3.43.1/tea/README rename to src/sqlite/SQLite-3.46.0/tea/README diff --git a/src/sqlite/SQLite-3.43.1/tea/aclocal.m4 b/src/sqlite/SQLite-3.46.0/tea/aclocal.m4 similarity index 100% rename from src/sqlite/SQLite-3.43.1/tea/aclocal.m4 rename to src/sqlite/SQLite-3.46.0/tea/aclocal.m4 diff --git a/src/sqlite/SQLite-3.43.1/tea/configure b/src/sqlite/SQLite-3.46.0/tea/configure similarity index 99% rename from src/sqlite/SQLite-3.43.1/tea/configure rename to src/sqlite/SQLite-3.46.0/tea/configure index 91d3e953e..011ef2101 100755 --- a/src/sqlite/SQLite-3.43.1/tea/configure +++ b/src/sqlite/SQLite-3.46.0/tea/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for sqlite 3.43.1. +# Generated by GNU Autoconf 2.71 for sqlite 3.46.0. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, @@ -608,8 +608,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.43.1' -PACKAGE_STRING='sqlite 3.43.1' +PACKAGE_VERSION='3.46.0' +PACKAGE_STRING='sqlite 3.46.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1331,7 +1331,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.43.1 to adapt to many kinds of systems. +\`configure' configures sqlite 3.46.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1393,7 +1393,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.43.1:";; + short | recursive ) echo "Configuration of sqlite 3.46.0:";; esac cat <<\_ACEOF @@ -1496,7 +1496,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.43.1 +sqlite configure 3.46.0 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1795,7 +1795,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.43.1, which was +It was created by sqlite $as_me 3.46.0, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -9560,7 +9560,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.43.1, which was +This file was extended by sqlite $as_me 3.46.0, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -9615,7 +9615,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -sqlite config.status 3.43.1 +sqlite config.status 3.46.0 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" @@ -10175,3 +10175,5 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi + + diff --git a/src/sqlite/SQLite-3.43.1/tea/configure.ac b/src/sqlite/SQLite-3.46.0/tea/configure.ac similarity index 99% rename from src/sqlite/SQLite-3.43.1/tea/configure.ac rename to src/sqlite/SQLite-3.46.0/tea/configure.ac index 24c2c0577..f188f2203 100644 --- a/src/sqlite/SQLite-3.43.1/tea/configure.ac +++ b/src/sqlite/SQLite-3.46.0/tea/configure.ac @@ -19,7 +19,7 @@ dnl to configure the system for the local environment. # so that we create the export library with the dll. #----------------------------------------------------------------------- -AC_INIT([sqlite],[3.43.1]) +AC_INIT([sqlite],[3.46.0]) #-------------------------------------------------------------------- # Call TEA_INIT as the first TEA_ macro to set up initial vars. diff --git a/src/sqlite/SQLite-3.43.1/tea/doc/sqlite3.n b/src/sqlite/SQLite-3.46.0/tea/doc/sqlite3.n similarity index 100% rename from src/sqlite/SQLite-3.43.1/tea/doc/sqlite3.n rename to src/sqlite/SQLite-3.46.0/tea/doc/sqlite3.n diff --git a/src/sqlite/SQLite-3.43.1/tea/generic/tclsqlite3.c b/src/sqlite/SQLite-3.46.0/tea/generic/tclsqlite3.c similarity index 100% rename from src/sqlite/SQLite-3.43.1/tea/generic/tclsqlite3.c rename to src/sqlite/SQLite-3.46.0/tea/generic/tclsqlite3.c diff --git a/src/sqlite/SQLite-3.43.1/tea/license.terms b/src/sqlite/SQLite-3.46.0/tea/license.terms similarity index 100% rename from src/sqlite/SQLite-3.43.1/tea/license.terms rename to src/sqlite/SQLite-3.46.0/tea/license.terms diff --git a/src/sqlite/SQLite-3.43.1/tea/pkgIndex.tcl.in b/src/sqlite/SQLite-3.46.0/tea/pkgIndex.tcl.in similarity index 100% rename from src/sqlite/SQLite-3.43.1/tea/pkgIndex.tcl.in rename to src/sqlite/SQLite-3.46.0/tea/pkgIndex.tcl.in diff --git a/src/sqlite/SQLite-3.43.1/tea/tclconfig/install-sh b/src/sqlite/SQLite-3.46.0/tea/tclconfig/install-sh similarity index 100% rename from src/sqlite/SQLite-3.43.1/tea/tclconfig/install-sh rename to src/sqlite/SQLite-3.46.0/tea/tclconfig/install-sh diff --git a/src/sqlite/SQLite-3.43.1/tea/tclconfig/tcl.m4 b/src/sqlite/SQLite-3.46.0/tea/tclconfig/tcl.m4 similarity index 100% rename from src/sqlite/SQLite-3.43.1/tea/tclconfig/tcl.m4 rename to src/sqlite/SQLite-3.46.0/tea/tclconfig/tcl.m4 diff --git a/src/sqlite/SQLite-3.43.1/tea/win/makefile.vc b/src/sqlite/SQLite-3.46.0/tea/win/makefile.vc similarity index 100% rename from src/sqlite/SQLite-3.43.1/tea/win/makefile.vc rename to src/sqlite/SQLite-3.46.0/tea/win/makefile.vc diff --git a/src/sqlite/SQLite-3.43.1/tea/win/nmakehlp.c b/src/sqlite/SQLite-3.46.0/tea/win/nmakehlp.c similarity index 100% rename from src/sqlite/SQLite-3.43.1/tea/win/nmakehlp.c rename to src/sqlite/SQLite-3.46.0/tea/win/nmakehlp.c diff --git a/src/sqlite/SQLite-3.43.1/tea/win/rules.vc b/src/sqlite/SQLite-3.46.0/tea/win/rules.vc similarity index 100% rename from src/sqlite/SQLite-3.43.1/tea/win/rules.vc rename to src/sqlite/SQLite-3.46.0/tea/win/rules.vc diff --git a/src/sqlite/sqlite3-3.43.1-x64.dll b/src/sqlite/sqlite3-3.43.1-x64.dll deleted file mode 100644 index e12305932..000000000 Binary files a/src/sqlite/sqlite3-3.43.1-x64.dll and /dev/null differ diff --git a/src/sqlite/sqlite3-3.43.1-x86.dll b/src/sqlite/sqlite3-3.43.1-x86.dll deleted file mode 100755 index 66280532c..000000000 Binary files a/src/sqlite/sqlite3-3.43.1-x86.dll and /dev/null differ diff --git a/src/sqlite/sqlite3-3.46.0-x64.dll b/src/sqlite/sqlite3-3.46.0-x64.dll new file mode 100644 index 000000000..e8c59551e Binary files /dev/null and b/src/sqlite/sqlite3-3.46.0-x64.dll differ diff --git a/src/sqlite/sqlite3-3.46.0-x86.dll b/src/sqlite/sqlite3-3.46.0-x86.dll new file mode 100644 index 000000000..0cc2a3b95 Binary files /dev/null and b/src/sqlite/sqlite3-3.46.0-x86.dll differ diff --git a/src/zlib/zlib-1.3/CMakeLists.txt b/src/zlib/zlib-1.3.1/CMakeLists.txt similarity index 86% rename from src/zlib/zlib-1.3/CMakeLists.txt rename to src/zlib/zlib-1.3.1/CMakeLists.txt index 7f1b69f4a..15ceebe78 100644 --- a/src/zlib/zlib-1.3/CMakeLists.txt +++ b/src/zlib/zlib-1.3.1/CMakeLists.txt @@ -3,7 +3,9 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) project(zlib C) -set(VERSION "1.3") +set(VERSION "1.3.1") + +option(ZLIB_BUILD_EXAMPLES "Enable Zlib Examples" ON) set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") @@ -148,7 +150,9 @@ if(MINGW) endif(MINGW) add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +target_include_directories(zlib PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +target_include_directories(zlibstatic PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) set_target_properties(zlib PROPERTIES SOVERSION 1) @@ -166,7 +170,7 @@ endif() if(UNIX) # On unix-like platforms the library is almost always called libz set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) - if(NOT APPLE) + if(NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX)) set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") endif() elseif(BUILD_SHARED_LIBS AND WIN32) @@ -193,21 +197,22 @@ endif() #============================================================================ # Example binaries #============================================================================ - -add_executable(example test/example.c) -target_link_libraries(example zlib) -add_test(example example) - -add_executable(minigzip test/minigzip.c) -target_link_libraries(minigzip zlib) - -if(HAVE_OFF64_T) - add_executable(example64 test/example.c) - target_link_libraries(example64 zlib) - set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") - add_test(example64 example64) - - add_executable(minigzip64 test/minigzip.c) - target_link_libraries(minigzip64 zlib) - set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") +if(ZLIB_BUILD_EXAMPLES) + add_executable(example test/example.c) + target_link_libraries(example zlib) + add_test(example example) + + add_executable(minigzip test/minigzip.c) + target_link_libraries(minigzip zlib) + + if(HAVE_OFF64_T) + add_executable(example64 test/example.c) + target_link_libraries(example64 zlib) + set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + add_test(example64 example64) + + add_executable(minigzip64 test/minigzip.c) + target_link_libraries(minigzip64 zlib) + set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + endif() endif() diff --git a/src/zlib/zlib-1.3/ChangeLog b/src/zlib/zlib-1.3.1/ChangeLog similarity index 99% rename from src/zlib/zlib-1.3/ChangeLog rename to src/zlib/zlib-1.3.1/ChangeLog index 8707988ac..b801a1031 100644 --- a/src/zlib/zlib-1.3/ChangeLog +++ b/src/zlib/zlib-1.3.1/ChangeLog @@ -1,6 +1,16 @@ ChangeLog file for zlib +Changes in 1.3.1 (22 Jan 2024) +- Reject overflows of zip header fields in minizip +- Fix bug in inflateSync() for data held in bit buffer +- Add LIT_MEM define to use more memory for a small deflate speedup +- Fix decision on the emission of Zip64 end records in minizip +- Add bounds checking to ERR_MSG() macro, used by zError() +- Neutralize zip file traversal attacks in miniunz +- Fix a bug in ZLIB_DEBUG compiles in check_match() +- Various portability and appearance improvements + Changes in 1.3 (18 Aug 2023) - Remove K&R function definitions and zlib2ansi - Fix bug in deflateBound() for level 0 and memLevel 9 diff --git a/src/zlib/zlib-1.3/FAQ b/src/zlib/zlib-1.3.1/FAQ similarity index 99% rename from src/zlib/zlib-1.3/FAQ rename to src/zlib/zlib-1.3.1/FAQ index 55f1cdc22..92f5d3e29 100644 --- a/src/zlib/zlib-1.3/FAQ +++ b/src/zlib/zlib-1.3.1/FAQ @@ -14,8 +14,7 @@ The latest zlib FAQ is at http://zlib.net/zlib_faq.html 2. Where can I get a Windows DLL version? The zlib sources can be compiled without change to produce a DLL. See the - file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the - precompiled DLL are found in the zlib web site at http://zlib.net/ . + file win32/DLL_FAQ.txt in the zlib distribution. 3. Where can I get a Visual Basic interface to zlib? diff --git a/src/zlib/zlib-1.3/INDEX b/src/zlib/zlib-1.3.1/INDEX similarity index 100% rename from src/zlib/zlib-1.3/INDEX rename to src/zlib/zlib-1.3.1/INDEX diff --git a/src/zlib/zlib-1.3/LICENSE b/src/zlib/zlib-1.3.1/LICENSE similarity index 100% rename from src/zlib/zlib-1.3/LICENSE rename to src/zlib/zlib-1.3.1/LICENSE diff --git a/src/zlib/zlib-1.3/Makefile b/src/zlib/zlib-1.3.1/Makefile similarity index 100% rename from src/zlib/zlib-1.3/Makefile rename to src/zlib/zlib-1.3.1/Makefile diff --git a/src/zlib/zlib-1.3/Makefile.in b/src/zlib/zlib-1.3.1/Makefile.in similarity index 96% rename from src/zlib/zlib-1.3/Makefile.in rename to src/zlib/zlib-1.3.1/Makefile.in index 34d3cd722..cb8b00a9b 100644 --- a/src/zlib/zlib-1.3/Makefile.in +++ b/src/zlib/zlib-1.3.1/Makefile.in @@ -1,5 +1,5 @@ # Makefile for zlib -# Copyright (C) 1995-2017 Jean-loup Gailly, Mark Adler +# Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler # For conditions of distribution and use, see copyright notice in zlib.h # To compile and test, type: @@ -22,13 +22,13 @@ CFLAGS=-O SFLAGS=-O LDFLAGS= -TEST_LDFLAGS=$(LDFLAGS) -L. libz.a +TEST_LIBS=-L. libz.a LDSHARED=$(CC) CPP=$(CC) -E STATICLIB=libz.a SHAREDLIB=libz.so -SHAREDLIBV=libz.so.1.3 +SHAREDLIBV=libz.so.1.3.1 SHAREDLIBM=libz.so.1 LIBS=$(STATICLIB) $(SHAREDLIBV) @@ -282,10 +282,10 @@ placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a -@rmdir objs example$(EXE): example.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(TEST_LIBS) minigzip$(EXE): minigzip.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(TEST_LIBS) examplesh$(EXE): example.o $(SHAREDLIBV) $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV) @@ -294,10 +294,10 @@ minigzipsh$(EXE): minigzip.o $(SHAREDLIBV) $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV) example64$(EXE): example64.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example64.o $(TEST_LIBS) minigzip64$(EXE): minigzip64.o $(STATICLIB) - $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip64.o $(TEST_LIBS) install-libs: $(LIBS) -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi @@ -360,7 +360,7 @@ zconf: $(SRCDIR)zconf.h.in cp -p $(SRCDIR)zconf.h.in zconf.h minizip-test: static - cd contrib/minizip && { CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; } + cd contrib/minizip && { CC="$(CC)" CFLAGS="$(CFLAGS)" $(MAKE) test ; cd ../.. ; } minizip-clean: cd contrib/minizip && { $(MAKE) clean ; cd ../.. ; } diff --git a/src/zlib/zlib-1.3/README b/src/zlib/zlib-1.3.1/README similarity index 96% rename from src/zlib/zlib-1.3/README rename to src/zlib/zlib-1.3.1/README index e02fc5aa2..c5f917540 100644 --- a/src/zlib/zlib-1.3/README +++ b/src/zlib/zlib-1.3.1/README @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.3 is a general purpose data compression library. All the code is +zlib 1.3.1 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and @@ -31,7 +31,7 @@ Mark Nelson wrote an article about zlib for the Jan. 1997 issue of Dr. Dobb's Journal; a copy of the article is available at https://marknelson.us/posts/1997/01/01/zlib-engine.html . -The changes made in version 1.3 are documented in the file ChangeLog. +The changes made in version 1.3.1 are documented in the file ChangeLog. Unsupported third party contributions are provided in directory contrib/ . @@ -83,7 +83,7 @@ Acknowledgments: Copyright notice: - (C) 1995-2023 Jean-loup Gailly and Mark Adler + (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/zlib/zlib-1.3/adler32.c b/src/zlib/zlib-1.3.1/adler32.c similarity index 100% rename from src/zlib/zlib-1.3/adler32.c rename to src/zlib/zlib-1.3.1/adler32.c diff --git a/src/zlib/zlib-1.3/amiga/Makefile.pup b/src/zlib/zlib-1.3.1/amiga/Makefile.pup similarity index 100% rename from src/zlib/zlib-1.3/amiga/Makefile.pup rename to src/zlib/zlib-1.3.1/amiga/Makefile.pup diff --git a/src/zlib/zlib-1.3/amiga/Makefile.sas b/src/zlib/zlib-1.3.1/amiga/Makefile.sas similarity index 100% rename from src/zlib/zlib-1.3/amiga/Makefile.sas rename to src/zlib/zlib-1.3.1/amiga/Makefile.sas diff --git a/src/zlib/zlib-1.3/compress.c b/src/zlib/zlib-1.3.1/compress.c similarity index 100% rename from src/zlib/zlib-1.3/compress.c rename to src/zlib/zlib-1.3.1/compress.c diff --git a/src/zlib/zlib-1.3/configure b/src/zlib/zlib-1.3.1/configure similarity index 99% rename from src/zlib/zlib-1.3/configure rename to src/zlib/zlib-1.3.1/configure index cc867c944..c55098afc 100755 --- a/src/zlib/zlib-1.3/configure +++ b/src/zlib/zlib-1.3.1/configure @@ -25,7 +25,7 @@ if test $SRCDIR = "."; then ZINCOUT="-I." SRCDIR="" else - ZINC='-include zconf.h' + ZINC='-I. -include zconf.h' ZINCOUT='-I. -I$(SRCDIR)' SRCDIR="$SRCDIR/" fi @@ -44,7 +44,8 @@ STATICLIB=libz.a # extract zlib version numbers from zlib.h VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h` -VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h` +VER3=`echo ${VER}|sed -n -e 's/\([0-9]\{1,\}\(\\.[0-9]\{1,\}\)\{1,2\}\).*/\1/p'` +VER1=`echo ${VER}|sed -n -e 's/\([0-9]\{1,\}\)\\..*/\1/p'` # establish commands for library building if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then @@ -263,7 +264,7 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then SHAREDLIB=libz$shared_ext SHAREDLIBV=libz.$VER$shared_ext SHAREDLIBM=libz.$VER1$shared_ext - LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER"} + LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} if "${CROSS_PREFIX}libtool" -V 2>&1 | grep Apple > /dev/null; then AR="${CROSS_PREFIX}libtool" elif libtool -V 2>&1 | grep Apple > /dev/null; then @@ -441,7 +442,7 @@ EOF if test $shared -eq 1; then echo Checking for shared library support... | tee -a configure.log # we must test in two steps (cc then ld), required at least on SunOS 4.x - if try $CC -w -c $SFLAGS $test.c && + if try $CC -c $SFLAGS $test.c && try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log elif test -z "$old_cc" -a -z "$old_cflags"; then diff --git a/src/zlib/zlib-1.3/contrib/README.contrib b/src/zlib/zlib-1.3.1/contrib/README.contrib similarity index 100% rename from src/zlib/zlib-1.3/contrib/README.contrib rename to src/zlib/zlib-1.3.1/contrib/README.contrib diff --git a/src/zlib/zlib-1.3/contrib/ada/buffer_demo.adb b/src/zlib/zlib-1.3.1/contrib/ada/buffer_demo.adb similarity index 100% rename from src/zlib/zlib-1.3/contrib/ada/buffer_demo.adb rename to src/zlib/zlib-1.3.1/contrib/ada/buffer_demo.adb diff --git a/src/zlib/zlib-1.3/contrib/ada/mtest.adb b/src/zlib/zlib-1.3.1/contrib/ada/mtest.adb similarity index 100% rename from src/zlib/zlib-1.3/contrib/ada/mtest.adb rename to src/zlib/zlib-1.3.1/contrib/ada/mtest.adb diff --git a/src/zlib/zlib-1.3/contrib/ada/read.adb b/src/zlib/zlib-1.3.1/contrib/ada/read.adb similarity index 100% rename from src/zlib/zlib-1.3/contrib/ada/read.adb rename to src/zlib/zlib-1.3.1/contrib/ada/read.adb diff --git a/src/zlib/zlib-1.3/contrib/ada/readme.txt b/src/zlib/zlib-1.3.1/contrib/ada/readme.txt similarity index 100% rename from src/zlib/zlib-1.3/contrib/ada/readme.txt rename to src/zlib/zlib-1.3.1/contrib/ada/readme.txt diff --git a/src/zlib/zlib-1.3/contrib/ada/test.adb b/src/zlib/zlib-1.3.1/contrib/ada/test.adb similarity index 100% rename from src/zlib/zlib-1.3/contrib/ada/test.adb rename to src/zlib/zlib-1.3.1/contrib/ada/test.adb diff --git a/src/zlib/zlib-1.3/contrib/ada/zlib-streams.adb b/src/zlib/zlib-1.3.1/contrib/ada/zlib-streams.adb similarity index 100% rename from src/zlib/zlib-1.3/contrib/ada/zlib-streams.adb rename to src/zlib/zlib-1.3.1/contrib/ada/zlib-streams.adb diff --git a/src/zlib/zlib-1.3/contrib/ada/zlib-streams.ads b/src/zlib/zlib-1.3.1/contrib/ada/zlib-streams.ads similarity index 100% rename from src/zlib/zlib-1.3/contrib/ada/zlib-streams.ads rename to src/zlib/zlib-1.3.1/contrib/ada/zlib-streams.ads diff --git a/src/zlib/zlib-1.3/contrib/ada/zlib-thin.adb b/src/zlib/zlib-1.3.1/contrib/ada/zlib-thin.adb similarity index 100% rename from src/zlib/zlib-1.3/contrib/ada/zlib-thin.adb rename to src/zlib/zlib-1.3.1/contrib/ada/zlib-thin.adb diff --git a/src/zlib/zlib-1.3/contrib/ada/zlib-thin.ads b/src/zlib/zlib-1.3.1/contrib/ada/zlib-thin.ads similarity index 100% rename from src/zlib/zlib-1.3/contrib/ada/zlib-thin.ads rename to src/zlib/zlib-1.3.1/contrib/ada/zlib-thin.ads diff --git a/src/zlib/zlib-1.3/contrib/ada/zlib.adb b/src/zlib/zlib-1.3.1/contrib/ada/zlib.adb similarity index 100% rename from src/zlib/zlib-1.3/contrib/ada/zlib.adb rename to src/zlib/zlib-1.3.1/contrib/ada/zlib.adb diff --git a/src/zlib/zlib-1.3/contrib/ada/zlib.ads b/src/zlib/zlib-1.3.1/contrib/ada/zlib.ads similarity index 100% rename from src/zlib/zlib-1.3/contrib/ada/zlib.ads rename to src/zlib/zlib-1.3.1/contrib/ada/zlib.ads diff --git a/src/zlib/zlib-1.3/contrib/ada/zlib.gpr b/src/zlib/zlib-1.3.1/contrib/ada/zlib.gpr similarity index 100% rename from src/zlib/zlib-1.3/contrib/ada/zlib.gpr rename to src/zlib/zlib-1.3.1/contrib/ada/zlib.gpr diff --git a/src/zlib/zlib-1.3/contrib/blast/Makefile b/src/zlib/zlib-1.3.1/contrib/blast/Makefile similarity index 100% rename from src/zlib/zlib-1.3/contrib/blast/Makefile rename to src/zlib/zlib-1.3.1/contrib/blast/Makefile diff --git a/src/zlib/zlib-1.3/contrib/blast/README b/src/zlib/zlib-1.3.1/contrib/blast/README similarity index 100% rename from src/zlib/zlib-1.3/contrib/blast/README rename to src/zlib/zlib-1.3.1/contrib/blast/README diff --git a/src/zlib/zlib-1.3/contrib/blast/blast.c b/src/zlib/zlib-1.3.1/contrib/blast/blast.c similarity index 100% rename from src/zlib/zlib-1.3/contrib/blast/blast.c rename to src/zlib/zlib-1.3.1/contrib/blast/blast.c diff --git a/src/zlib/zlib-1.3/contrib/blast/blast.h b/src/zlib/zlib-1.3.1/contrib/blast/blast.h similarity index 100% rename from src/zlib/zlib-1.3/contrib/blast/blast.h rename to src/zlib/zlib-1.3.1/contrib/blast/blast.h diff --git a/src/zlib/zlib-1.3/contrib/blast/test.pk b/src/zlib/zlib-1.3.1/contrib/blast/test.pk similarity index 100% rename from src/zlib/zlib-1.3/contrib/blast/test.pk rename to src/zlib/zlib-1.3.1/contrib/blast/test.pk diff --git a/src/zlib/zlib-1.3/contrib/blast/test.txt b/src/zlib/zlib-1.3.1/contrib/blast/test.txt similarity index 100% rename from src/zlib/zlib-1.3/contrib/blast/test.txt rename to src/zlib/zlib-1.3.1/contrib/blast/test.txt diff --git a/src/zlib/zlib-1.3/contrib/delphi/ZLib.pas b/src/zlib/zlib-1.3.1/contrib/delphi/ZLib.pas similarity index 99% rename from src/zlib/zlib-1.3/contrib/delphi/ZLib.pas rename to src/zlib/zlib-1.3.1/contrib/delphi/ZLib.pas index 814ffa670..93fa4c9ed 100644 --- a/src/zlib/zlib-1.3/contrib/delphi/ZLib.pas +++ b/src/zlib/zlib-1.3.1/contrib/delphi/ZLib.pas @@ -152,7 +152,7 @@ procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer; const OutBuf: Pointer; BufSize: Integer); const - zlib_version = '1.3.0'; + zlib_version = '1.3.1'; type EZlibError = class(Exception); diff --git a/src/zlib/zlib-1.3/contrib/delphi/ZLibConst.pas b/src/zlib/zlib-1.3.1/contrib/delphi/ZLibConst.pas similarity index 100% rename from src/zlib/zlib-1.3/contrib/delphi/ZLibConst.pas rename to src/zlib/zlib-1.3.1/contrib/delphi/ZLibConst.pas diff --git a/src/zlib/zlib-1.3/contrib/delphi/readme.txt b/src/zlib/zlib-1.3.1/contrib/delphi/readme.txt similarity index 100% rename from src/zlib/zlib-1.3/contrib/delphi/readme.txt rename to src/zlib/zlib-1.3.1/contrib/delphi/readme.txt diff --git a/src/zlib/zlib-1.3/contrib/delphi/zlibd32.mak b/src/zlib/zlib-1.3.1/contrib/delphi/zlibd32.mak similarity index 100% rename from src/zlib/zlib-1.3/contrib/delphi/zlibd32.mak rename to src/zlib/zlib-1.3.1/contrib/delphi/zlibd32.mak diff --git a/src/zlib/zlib-1.3/contrib/dotzlib/DotZLib.build b/src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib.build similarity index 100% rename from src/zlib/zlib-1.3/contrib/dotzlib/DotZLib.build rename to src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib.build diff --git a/src/zlib/zlib-1.3/contrib/dotzlib/DotZLib.chm b/src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib.chm similarity index 100% rename from src/zlib/zlib-1.3/contrib/dotzlib/DotZLib.chm rename to src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib.chm diff --git a/src/zlib/zlib-1.3/contrib/dotzlib/DotZLib.sln b/src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib.sln similarity index 100% rename from src/zlib/zlib-1.3/contrib/dotzlib/DotZLib.sln rename to src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib.sln diff --git a/src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/AssemblyInfo.cs b/src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/AssemblyInfo.cs similarity index 100% rename from src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/AssemblyInfo.cs rename to src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/AssemblyInfo.cs diff --git a/src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/ChecksumImpl.cs b/src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/ChecksumImpl.cs similarity index 97% rename from src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/ChecksumImpl.cs rename to src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/ChecksumImpl.cs index c1230bf03..de88dcf11 100644 --- a/src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/ChecksumImpl.cs +++ b/src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/ChecksumImpl.cs @@ -34,7 +34,7 @@ public ChecksumGeneratorBase() } /// - /// Initializes a new instance of the checksum generator basewith a specified value + /// Initializes a new instance of the checksum generator base with a specified value /// /// The value to set the current checksum to public ChecksumGeneratorBase(uint initialValue) diff --git a/src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/CircularBuffer.cs b/src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/CircularBuffer.cs similarity index 100% rename from src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/CircularBuffer.cs rename to src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/CircularBuffer.cs diff --git a/src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/CodecBase.cs b/src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/CodecBase.cs similarity index 100% rename from src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/CodecBase.cs rename to src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/CodecBase.cs diff --git a/src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/Deflater.cs b/src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/Deflater.cs similarity index 100% rename from src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/Deflater.cs rename to src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/Deflater.cs diff --git a/src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/DotZLib.cs b/src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/DotZLib.cs similarity index 100% rename from src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/DotZLib.cs rename to src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/DotZLib.cs diff --git a/src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/DotZLib.csproj b/src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/DotZLib.csproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/DotZLib.csproj rename to src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/DotZLib.csproj diff --git a/src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/GZipStream.cs b/src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/GZipStream.cs similarity index 100% rename from src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/GZipStream.cs rename to src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/GZipStream.cs diff --git a/src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/Inflater.cs b/src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/Inflater.cs similarity index 100% rename from src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/Inflater.cs rename to src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/Inflater.cs diff --git a/src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/UnitTests.cs b/src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/UnitTests.cs similarity index 95% rename from src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/UnitTests.cs rename to src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/UnitTests.cs index c5fce221a..d4f098023 100644 --- a/src/zlib/zlib-1.3/contrib/dotzlib/DotZLib/UnitTests.cs +++ b/src/zlib/zlib-1.3.1/contrib/dotzlib/DotZLib/UnitTests.cs @@ -156,7 +156,7 @@ public class InfoTests public void Info_Version() { Info info = new Info(); - Assert.AreEqual("1.3.0", Info.Version); + Assert.AreEqual("1.3.1", Info.Version); Assert.AreEqual(32, info.SizeOfUInt); Assert.AreEqual(32, info.SizeOfULong); Assert.AreEqual(32, info.SizeOfPointer); diff --git a/src/zlib/zlib-1.3/contrib/dotzlib/LICENSE_1_0.txt b/src/zlib/zlib-1.3.1/contrib/dotzlib/LICENSE_1_0.txt similarity index 100% rename from src/zlib/zlib-1.3/contrib/dotzlib/LICENSE_1_0.txt rename to src/zlib/zlib-1.3.1/contrib/dotzlib/LICENSE_1_0.txt diff --git a/src/zlib/zlib-1.3/contrib/dotzlib/readme.txt b/src/zlib/zlib-1.3.1/contrib/dotzlib/readme.txt similarity index 100% rename from src/zlib/zlib-1.3/contrib/dotzlib/readme.txt rename to src/zlib/zlib-1.3.1/contrib/dotzlib/readme.txt diff --git a/src/zlib/zlib-1.3/contrib/gcc_gvmat64/gvmat64.S b/src/zlib/zlib-1.3.1/contrib/gcc_gvmat64/gvmat64.S similarity index 100% rename from src/zlib/zlib-1.3/contrib/gcc_gvmat64/gvmat64.S rename to src/zlib/zlib-1.3.1/contrib/gcc_gvmat64/gvmat64.S diff --git a/src/zlib/zlib-1.3/contrib/infback9/README b/src/zlib/zlib-1.3.1/contrib/infback9/README similarity index 100% rename from src/zlib/zlib-1.3/contrib/infback9/README rename to src/zlib/zlib-1.3.1/contrib/infback9/README diff --git a/src/zlib/zlib-1.3/contrib/infback9/infback9.c b/src/zlib/zlib-1.3.1/contrib/infback9/infback9.c similarity index 100% rename from src/zlib/zlib-1.3/contrib/infback9/infback9.c rename to src/zlib/zlib-1.3.1/contrib/infback9/infback9.c diff --git a/src/zlib/zlib-1.3/contrib/infback9/infback9.h b/src/zlib/zlib-1.3.1/contrib/infback9/infback9.h similarity index 100% rename from src/zlib/zlib-1.3/contrib/infback9/infback9.h rename to src/zlib/zlib-1.3.1/contrib/infback9/infback9.h diff --git a/src/zlib/zlib-1.3/contrib/infback9/inffix9.h b/src/zlib/zlib-1.3.1/contrib/infback9/inffix9.h similarity index 100% rename from src/zlib/zlib-1.3/contrib/infback9/inffix9.h rename to src/zlib/zlib-1.3.1/contrib/infback9/inffix9.h diff --git a/src/zlib/zlib-1.3/contrib/infback9/inflate9.h b/src/zlib/zlib-1.3.1/contrib/infback9/inflate9.h similarity index 100% rename from src/zlib/zlib-1.3/contrib/infback9/inflate9.h rename to src/zlib/zlib-1.3.1/contrib/infback9/inflate9.h diff --git a/src/zlib/zlib-1.3/contrib/infback9/inftree9.c b/src/zlib/zlib-1.3.1/contrib/infback9/inftree9.c similarity index 98% rename from src/zlib/zlib-1.3/contrib/infback9/inftree9.c rename to src/zlib/zlib-1.3.1/contrib/infback9/inftree9.c index dc38f24de..ac707ed3f 100644 --- a/src/zlib/zlib-1.3/contrib/infback9/inftree9.c +++ b/src/zlib/zlib-1.3.1/contrib/infback9/inftree9.c @@ -1,5 +1,5 @@ /* inftree9.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2023 Mark Adler + * Copyright (C) 1995-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate9_copyright[] = - " inflate9 1.3 Copyright 1995-2023 Mark Adler "; + " inflate9 1.3.1 Copyright 1995-2024 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -59,7 +59,7 @@ int inflate_table9(codetype type, unsigned short FAR *lens, unsigned codes, static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132, - 133, 133, 133, 133, 144, 198, 203}; + 133, 133, 133, 133, 144, 203, 77}; static const unsigned short dbase[32] = { /* Distance codes 0..31 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, diff --git a/src/zlib/zlib-1.3/contrib/infback9/inftree9.h b/src/zlib/zlib-1.3.1/contrib/infback9/inftree9.h similarity index 94% rename from src/zlib/zlib-1.3/contrib/infback9/inftree9.h rename to src/zlib/zlib-1.3.1/contrib/infback9/inftree9.h index 2c1252f57..ab2ea28b2 100644 --- a/src/zlib/zlib-1.3/contrib/infback9/inftree9.h +++ b/src/zlib/zlib-1.3.1/contrib/infback9/inftree9.h @@ -41,8 +41,8 @@ typedef struct { examples/enough.c found in the zlib distribution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 32 6 15" for distance codes returns 594. - The initial root table size (9 or 6) is found in the fifth argument of the + returns 852, and "enough 32 6 15" for distance codes returns 594. The + initial root table size (9 or 6) is found in the fifth argument of the inflate_table() calls in infback9.c. If the root table size is changed, then these maximum sizes would be need to be recalculated and updated. */ #define ENOUGH_LENS 852 diff --git a/src/zlib/zlib-1.3/contrib/iostream/test.cpp b/src/zlib/zlib-1.3.1/contrib/iostream/test.cpp similarity index 100% rename from src/zlib/zlib-1.3/contrib/iostream/test.cpp rename to src/zlib/zlib-1.3.1/contrib/iostream/test.cpp diff --git a/src/zlib/zlib-1.3/contrib/iostream/zfstream.cpp b/src/zlib/zlib-1.3.1/contrib/iostream/zfstream.cpp similarity index 100% rename from src/zlib/zlib-1.3/contrib/iostream/zfstream.cpp rename to src/zlib/zlib-1.3.1/contrib/iostream/zfstream.cpp diff --git a/src/zlib/zlib-1.3/contrib/iostream/zfstream.h b/src/zlib/zlib-1.3.1/contrib/iostream/zfstream.h similarity index 100% rename from src/zlib/zlib-1.3/contrib/iostream/zfstream.h rename to src/zlib/zlib-1.3.1/contrib/iostream/zfstream.h diff --git a/src/zlib/zlib-1.3/contrib/iostream2/zstream.h b/src/zlib/zlib-1.3.1/contrib/iostream2/zstream.h similarity index 100% rename from src/zlib/zlib-1.3/contrib/iostream2/zstream.h rename to src/zlib/zlib-1.3.1/contrib/iostream2/zstream.h diff --git a/src/zlib/zlib-1.3/contrib/iostream2/zstream_test.cpp b/src/zlib/zlib-1.3.1/contrib/iostream2/zstream_test.cpp similarity index 100% rename from src/zlib/zlib-1.3/contrib/iostream2/zstream_test.cpp rename to src/zlib/zlib-1.3.1/contrib/iostream2/zstream_test.cpp diff --git a/src/zlib/zlib-1.3/contrib/iostream3/README b/src/zlib/zlib-1.3.1/contrib/iostream3/README similarity index 100% rename from src/zlib/zlib-1.3/contrib/iostream3/README rename to src/zlib/zlib-1.3.1/contrib/iostream3/README diff --git a/src/zlib/zlib-1.3/contrib/iostream3/TODO b/src/zlib/zlib-1.3.1/contrib/iostream3/TODO similarity index 100% rename from src/zlib/zlib-1.3/contrib/iostream3/TODO rename to src/zlib/zlib-1.3.1/contrib/iostream3/TODO diff --git a/src/zlib/zlib-1.3/contrib/iostream3/test.cc b/src/zlib/zlib-1.3.1/contrib/iostream3/test.cc similarity index 100% rename from src/zlib/zlib-1.3/contrib/iostream3/test.cc rename to src/zlib/zlib-1.3.1/contrib/iostream3/test.cc diff --git a/src/zlib/zlib-1.3/contrib/iostream3/zfstream.cc b/src/zlib/zlib-1.3.1/contrib/iostream3/zfstream.cc similarity index 100% rename from src/zlib/zlib-1.3/contrib/iostream3/zfstream.cc rename to src/zlib/zlib-1.3.1/contrib/iostream3/zfstream.cc diff --git a/src/zlib/zlib-1.3/contrib/iostream3/zfstream.h b/src/zlib/zlib-1.3.1/contrib/iostream3/zfstream.h similarity index 99% rename from src/zlib/zlib-1.3/contrib/iostream3/zfstream.h rename to src/zlib/zlib-1.3.1/contrib/iostream3/zfstream.h index 8574479ae..3dabc0f97 100644 --- a/src/zlib/zlib-1.3/contrib/iostream3/zfstream.h +++ b/src/zlib/zlib-1.3.1/contrib/iostream3/zfstream.h @@ -413,7 +413,7 @@ template class gzomanip2 { public: - // Allows insertor to peek at internals + // Allows inserter to peek at internals template friend gzofstream& operator<<(gzofstream&, @@ -452,7 +452,7 @@ template : func(f), val1(v1), val2(v2) { } -// Insertor applies underlying manipulator function to stream +// Inserter applies underlying manipulator function to stream template inline gzofstream& operator<<(gzofstream& s, const gzomanip2& m) diff --git a/src/zlib/zlib-1.3/contrib/minizip/Makefile b/src/zlib/zlib-1.3.1/contrib/minizip/Makefile similarity index 98% rename from src/zlib/zlib-1.3/contrib/minizip/Makefile rename to src/zlib/zlib-1.3.1/contrib/minizip/Makefile index aac76e07f..3d927ec14 100644 --- a/src/zlib/zlib-1.3/contrib/minizip/Makefile +++ b/src/zlib/zlib-1.3.1/contrib/minizip/Makefile @@ -1,4 +1,4 @@ -CC=cc +CC?=cc CFLAGS := $(CFLAGS) -O -I../.. UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a diff --git a/src/zlib/zlib-1.3/contrib/minizip/Makefile.am b/src/zlib/zlib-1.3.1/contrib/minizip/Makefile.am similarity index 100% rename from src/zlib/zlib-1.3/contrib/minizip/Makefile.am rename to src/zlib/zlib-1.3.1/contrib/minizip/Makefile.am diff --git a/src/zlib/zlib-1.3/contrib/minizip/MiniZip64_Changes.txt b/src/zlib/zlib-1.3.1/contrib/minizip/MiniZip64_Changes.txt similarity index 100% rename from src/zlib/zlib-1.3/contrib/minizip/MiniZip64_Changes.txt rename to src/zlib/zlib-1.3.1/contrib/minizip/MiniZip64_Changes.txt diff --git a/src/zlib/zlib-1.3/contrib/minizip/MiniZip64_info.txt b/src/zlib/zlib-1.3.1/contrib/minizip/MiniZip64_info.txt similarity index 100% rename from src/zlib/zlib-1.3/contrib/minizip/MiniZip64_info.txt rename to src/zlib/zlib-1.3.1/contrib/minizip/MiniZip64_info.txt diff --git a/src/zlib/zlib-1.3/contrib/minizip/configure.ac b/src/zlib/zlib-1.3.1/contrib/minizip/configure.ac similarity index 93% rename from src/zlib/zlib-1.3/contrib/minizip/configure.ac rename to src/zlib/zlib-1.3.1/contrib/minizip/configure.ac index df80e5b7e..15ec91718 100644 --- a/src/zlib/zlib-1.3/contrib/minizip/configure.ac +++ b/src/zlib/zlib-1.3.1/contrib/minizip/configure.ac @@ -1,7 +1,7 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_INIT([minizip], [1.3.0], [bugzilla.redhat.com]) +AC_INIT([minizip], [1.3.1], [bugzilla.redhat.com]) AC_CONFIG_SRCDIR([minizip.c]) AM_INIT_AUTOMAKE([foreign]) LT_INIT diff --git a/src/zlib/zlib-1.3/contrib/minizip/crypt.h b/src/zlib/zlib-1.3.1/contrib/minizip/crypt.h similarity index 100% rename from src/zlib/zlib-1.3/contrib/minizip/crypt.h rename to src/zlib/zlib-1.3.1/contrib/minizip/crypt.h diff --git a/src/zlib/zlib-1.3/contrib/minizip/ioapi.c b/src/zlib/zlib-1.3.1/contrib/minizip/ioapi.c similarity index 100% rename from src/zlib/zlib-1.3/contrib/minizip/ioapi.c rename to src/zlib/zlib-1.3.1/contrib/minizip/ioapi.c diff --git a/src/zlib/zlib-1.3/contrib/minizip/ioapi.h b/src/zlib/zlib-1.3.1/contrib/minizip/ioapi.h similarity index 99% rename from src/zlib/zlib-1.3/contrib/minizip/ioapi.h rename to src/zlib/zlib-1.3.1/contrib/minizip/ioapi.h index c588a18d0..a2d2e6e60 100644 --- a/src/zlib/zlib-1.3/contrib/minizip/ioapi.h +++ b/src/zlib/zlib-1.3.1/contrib/minizip/ioapi.h @@ -144,7 +144,7 @@ typedef long (ZCALLBACK *tell_file_func) (voidpf opaque, voidpf stream) typedef long (ZCALLBACK *seek_file_func) (voidpf opaque, voidpf stream, uLong offset, int origin); -/* here is the "old" 32 bits structure structure */ +/* here is the "old" 32 bits structure */ typedef struct zlib_filefunc_def_s { open_file_func zopen_file; diff --git a/src/zlib/zlib-1.3/contrib/minizip/iowin32.c b/src/zlib/zlib-1.3.1/contrib/minizip/iowin32.c similarity index 100% rename from src/zlib/zlib-1.3/contrib/minizip/iowin32.c rename to src/zlib/zlib-1.3.1/contrib/minizip/iowin32.c diff --git a/src/zlib/zlib-1.3/contrib/minizip/iowin32.h b/src/zlib/zlib-1.3.1/contrib/minizip/iowin32.h similarity index 100% rename from src/zlib/zlib-1.3/contrib/minizip/iowin32.h rename to src/zlib/zlib-1.3.1/contrib/minizip/iowin32.h diff --git a/src/zlib/zlib-1.3/contrib/minizip/make_vms.com b/src/zlib/zlib-1.3.1/contrib/minizip/make_vms.com similarity index 100% rename from src/zlib/zlib-1.3/contrib/minizip/make_vms.com rename to src/zlib/zlib-1.3.1/contrib/minizip/make_vms.com diff --git a/src/zlib/zlib-1.3/contrib/minizip/miniunz.c b/src/zlib/zlib-1.3.1/contrib/minizip/miniunz.c similarity index 96% rename from src/zlib/zlib-1.3/contrib/minizip/miniunz.c rename to src/zlib/zlib-1.3.1/contrib/minizip/miniunz.c index a12aec8be..d627c4226 100644 --- a/src/zlib/zlib-1.3/contrib/minizip/miniunz.c +++ b/src/zlib/zlib-1.3.1/contrib/minizip/miniunz.c @@ -79,7 +79,7 @@ /* change_file_date : change the date/time of a file filename : the filename of the file where date/time must be modified - dosdate : the new date at the MSDos format (4 bytes) + dosdate : the new date at the MSDOS format (4 bytes) tmu_date : the SAME new date at the tm_unz format */ static void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date) { #ifdef _WIN32 @@ -186,7 +186,7 @@ static int makedir(const char *newdir) { } static void do_banner(void) { - printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n"); + printf("MiniUnz 1.1, demo of zLib + Unz package written by Gilles Vollant\n"); printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); } @@ -356,6 +356,20 @@ static int do_extract_currentfile(unzFile uf, const int* popt_extract_without_pa else write_filename = filename_withoutpath; + if (write_filename[0]!='\0') + { + const char* relative_check = write_filename; + while (relative_check[1]!='\0') + { + if (relative_check[0]=='.' && relative_check[1]=='.') + write_filename = relative_check; + relative_check++; + } + } + + while (write_filename[0]=='/' || write_filename[0]=='.') + write_filename++; + err = unzOpenCurrentFilePassword(uf,password); if (err!=UNZ_OK) { diff --git a/src/zlib/zlib-1.3/contrib/minizip/miniunzip.1 b/src/zlib/zlib-1.3.1/contrib/minizip/miniunzip.1 similarity index 100% rename from src/zlib/zlib-1.3/contrib/minizip/miniunzip.1 rename to src/zlib/zlib-1.3.1/contrib/minizip/miniunzip.1 diff --git a/src/zlib/zlib-1.3/contrib/minizip/minizip.1 b/src/zlib/zlib-1.3.1/contrib/minizip/minizip.1 similarity index 100% rename from src/zlib/zlib-1.3/contrib/minizip/minizip.1 rename to src/zlib/zlib-1.3.1/contrib/minizip/minizip.1 diff --git a/src/zlib/zlib-1.3/contrib/minizip/minizip.c b/src/zlib/zlib-1.3.1/contrib/minizip/minizip.c similarity index 100% rename from src/zlib/zlib-1.3/contrib/minizip/minizip.c rename to src/zlib/zlib-1.3.1/contrib/minizip/minizip.c diff --git a/src/zlib/zlib-1.3/contrib/minizip/minizip.pc.in b/src/zlib/zlib-1.3.1/contrib/minizip/minizip.pc.in similarity index 100% rename from src/zlib/zlib-1.3/contrib/minizip/minizip.pc.in rename to src/zlib/zlib-1.3.1/contrib/minizip/minizip.pc.in diff --git a/src/zlib/zlib-1.3/contrib/minizip/mztools.c b/src/zlib/zlib-1.3.1/contrib/minizip/mztools.c similarity index 100% rename from src/zlib/zlib-1.3/contrib/minizip/mztools.c rename to src/zlib/zlib-1.3.1/contrib/minizip/mztools.c diff --git a/src/zlib/zlib-1.3/contrib/minizip/mztools.h b/src/zlib/zlib-1.3.1/contrib/minizip/mztools.h similarity index 100% rename from src/zlib/zlib-1.3/contrib/minizip/mztools.h rename to src/zlib/zlib-1.3.1/contrib/minizip/mztools.h diff --git a/src/zlib/zlib-1.3/contrib/minizip/unzip.c b/src/zlib/zlib-1.3.1/contrib/minizip/unzip.c similarity index 99% rename from src/zlib/zlib-1.3/contrib/minizip/unzip.c rename to src/zlib/zlib-1.3.1/contrib/minizip/unzip.c index ed763f89f..ea05b7d62 100644 --- a/src/zlib/zlib-1.3/contrib/minizip/unzip.c +++ b/src/zlib/zlib-1.3.1/contrib/minizip/unzip.c @@ -117,7 +117,7 @@ const char unz_copyright[] = " unzip 1.01 Copyright 1998-2004 Gilles Vollant - http://www.winimage.com/zLibDll"; -/* unz_file_info_interntal contain internal info about a file in zipfile*/ +/* unz_file_info64_internal contain internal info about a file in zipfile*/ typedef struct unz_file_info64_internal_s { ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */ @@ -450,7 +450,7 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (unz64local_getLong(pzlib_filefunc_def,filestream,&uL)!=UNZ_OK) return CENTRALDIRINVALID; if (uL != 0) @@ -497,9 +497,9 @@ local unzFile unzOpenInternal(const void *path, ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry_CD; /* total number of entries in the central dir diff --git a/src/zlib/zlib-1.3/contrib/minizip/unzip.h b/src/zlib/zlib-1.3.1/contrib/minizip/unzip.h similarity index 99% rename from src/zlib/zlib-1.3/contrib/minizip/unzip.h rename to src/zlib/zlib-1.3.1/contrib/minizip/unzip.h index 14105840f..5cfc9c627 100644 --- a/src/zlib/zlib-1.3/contrib/minizip/unzip.h +++ b/src/zlib/zlib-1.3.1/contrib/minizip/unzip.h @@ -306,7 +306,7 @@ extern int ZEXPORT unzGetCurrentFileInfo(unzFile file, Get Info about the current file if pfile_info!=NULL, the *pfile_info structure will contain some info about the current file - if szFileName!=NULL, the filemane string will be copied in szFileName + if szFileName!=NULL, the filename string will be copied in szFileName (fileNameBufferSize is the size of the buffer) if extraField!=NULL, the extra field information will be copied in extraField (extraFieldBufferSize is the size of the buffer). diff --git a/src/zlib/zlib-1.3/contrib/minizip/zip.c b/src/zlib/zlib-1.3.1/contrib/minizip/zip.c similarity index 98% rename from src/zlib/zlib-1.3/contrib/minizip/zip.c rename to src/zlib/zlib-1.3.1/contrib/minizip/zip.c index 3d3d4cadd..60bdffac3 100644 --- a/src/zlib/zlib-1.3/contrib/minizip/zip.c +++ b/src/zlib/zlib-1.3.1/contrib/minizip/zip.c @@ -575,7 +575,7 @@ local ZPOS64_T zip64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; - /* number of the disk with the start of the zip64 end of central directory */ + /* number of the disk with the start of the zip64 end of central directory */ if (zip64local_getLong(pzlib_filefunc_def,filestream,&uL)!=ZIP_OK) return 0; if (uL != 0) @@ -614,9 +614,9 @@ local int LoadCentralDirectoryRecord(zip64_internal* pziinit) { ZPOS64_T central_pos; uLong uL; - uLong number_disk; /* number of the current dist, used for + uLong number_disk; /* number of the current disk, used for spanning ZIP, unsupported, always 0*/ - uLong number_disk_with_CD; /* number the the disk with central dir, used + uLong number_disk_with_CD; /* number of the disk with central dir, used for spanning ZIP, unsupported, always 0*/ ZPOS64_T number_entry; ZPOS64_T number_entry_CD; /* total number of entries in @@ -1043,6 +1043,17 @@ extern int ZEXPORT zipOpenNewFileInZip4_64(zipFile file, const char* filename, c return ZIP_PARAMERROR; #endif + // The filename and comment length must fit in 16 bits. + if ((filename!=NULL) && (strlen(filename)>0xffff)) + return ZIP_PARAMERROR; + if ((comment!=NULL) && (strlen(comment)>0xffff)) + return ZIP_PARAMERROR; + // The extra field length must fit in 16 bits. If the member also requires + // a Zip64 extra block, that will also need to fit within that 16-bit + // length, but that will be checked for later. + if ((size_extrafield_local>0xffff) || (size_extrafield_global>0xffff)) + return ZIP_PARAMERROR; + zi = (zip64_internal*)file; if (zi->in_opened_file_inzip == 1) @@ -1597,7 +1608,7 @@ extern int ZEXPORT zipCloseFileInZipRaw64(zipFile file, ZPOS64_T uncompressed_si if((uLong)(datasize + 4) > zi->ci.size_centralExtraFree) { - // we can not write more data to the buffer that we have room for. + // we cannot write more data to the buffer that we have room for. return ZIP_BADZIPFILE; } @@ -1861,7 +1872,7 @@ extern int ZEXPORT zipClose(zipFile file, const char* global_comment) { free_linkedlist(&(zi->central_dir)); pos = centraldir_pos_inzip - zi->add_position_when_writing_offset; - if(pos >= 0xffffffff || zi->number_entry > 0xFFFF) + if(pos >= 0xffffffff || zi->number_entry >= 0xFFFF) { ZPOS64_T Zip64EOCDpos = ZTELL64(zi->z_filefunc,zi->filestream); Write_Zip64EndOfCentralDirectoryRecord(zi, size_centraldir, centraldir_pos_inzip); diff --git a/src/zlib/zlib-1.3/contrib/minizip/zip.h b/src/zlib/zlib-1.3.1/contrib/minizip/zip.h similarity index 99% rename from src/zlib/zlib-1.3/contrib/minizip/zip.h rename to src/zlib/zlib-1.3.1/contrib/minizip/zip.h index 5fc084132..3e230d340 100644 --- a/src/zlib/zlib-1.3/contrib/minizip/zip.h +++ b/src/zlib/zlib-1.3.1/contrib/minizip/zip.h @@ -177,9 +177,9 @@ extern int ZEXPORT zipOpenNewFileInZip64(zipFile file, filename : the filename in zip (if NULL, '-' without quote will be used *zipfi contain supplemental information if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local - contains the extrafield data the the local header + contains the extrafield data for the local header if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global - contains the extrafield data the the local header + contains the extrafield data for the global header if comment != NULL, comment contain the comment string method contain the compression method (0 for store, Z_DEFLATED for deflate) level contain the level of compression (can be Z_DEFAULT_COMPRESSION) diff --git a/src/zlib/zlib-1.3.1/contrib/nuget/nuget.csproj b/src/zlib/zlib-1.3.1/contrib/nuget/nuget.csproj new file mode 100644 index 000000000..68627f034 --- /dev/null +++ b/src/zlib/zlib-1.3.1/contrib/nuget/nuget.csproj @@ -0,0 +1,43 @@ + + + + net6.0 + madler.zlib.redist + $(PackageId).win + $(PackageId).linux + $(PackageId).osx + (C) 1995-2024 Jean-loup Gailly and Mark Adler + 1.3.1 + NuGet Package for consuming native builds of zlib into .NET without complexity. + + NU5128 + $(MSBuildProjectDirectory) + Jean-loup Gailly and Mark Adler + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/zlib/zlib-1.3.1/contrib/nuget/nuget.sln b/src/zlib/zlib-1.3.1/contrib/nuget/nuget.sln new file mode 100644 index 000000000..46ee8deab --- /dev/null +++ b/src/zlib/zlib-1.3.1/contrib/nuget/nuget.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nuget", "nuget.csproj", "{B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B1BD3984-EF8F-4E9D-9A94-EB784E5EB1E8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/src/zlib/zlib-1.3/contrib/pascal/example.pas b/src/zlib/zlib-1.3.1/contrib/pascal/example.pas similarity index 100% rename from src/zlib/zlib-1.3/contrib/pascal/example.pas rename to src/zlib/zlib-1.3.1/contrib/pascal/example.pas diff --git a/src/zlib/zlib-1.3/contrib/pascal/readme.txt b/src/zlib/zlib-1.3.1/contrib/pascal/readme.txt similarity index 100% rename from src/zlib/zlib-1.3/contrib/pascal/readme.txt rename to src/zlib/zlib-1.3.1/contrib/pascal/readme.txt diff --git a/src/zlib/zlib-1.3/contrib/pascal/zlibd32.mak b/src/zlib/zlib-1.3.1/contrib/pascal/zlibd32.mak similarity index 100% rename from src/zlib/zlib-1.3/contrib/pascal/zlibd32.mak rename to src/zlib/zlib-1.3.1/contrib/pascal/zlibd32.mak diff --git a/src/zlib/zlib-1.3/contrib/pascal/zlibpas.pas b/src/zlib/zlib-1.3.1/contrib/pascal/zlibpas.pas similarity index 99% rename from src/zlib/zlib-1.3/contrib/pascal/zlibpas.pas rename to src/zlib/zlib-1.3.1/contrib/pascal/zlibpas.pas index a2b24a593..0cf0e7b82 100644 --- a/src/zlib/zlib-1.3/contrib/pascal/zlibpas.pas +++ b/src/zlib/zlib-1.3.1/contrib/pascal/zlibpas.pas @@ -10,7 +10,7 @@ interface const - ZLIB_VERSION = '1.3.0'; + ZLIB_VERSION = '1.3.1'; ZLIB_VERNUM = $12a0; type diff --git a/src/zlib/zlib-1.3/contrib/puff/Makefile b/src/zlib/zlib-1.3.1/contrib/puff/Makefile similarity index 100% rename from src/zlib/zlib-1.3/contrib/puff/Makefile rename to src/zlib/zlib-1.3.1/contrib/puff/Makefile diff --git a/src/zlib/zlib-1.3/contrib/puff/README b/src/zlib/zlib-1.3.1/contrib/puff/README similarity index 100% rename from src/zlib/zlib-1.3/contrib/puff/README rename to src/zlib/zlib-1.3.1/contrib/puff/README diff --git a/src/zlib/zlib-1.3/contrib/puff/puff.c b/src/zlib/zlib-1.3.1/contrib/puff/puff.c similarity index 99% rename from src/zlib/zlib-1.3/contrib/puff/puff.c rename to src/zlib/zlib-1.3.1/contrib/puff/puff.c index 6737ff615..d759825ab 100644 --- a/src/zlib/zlib-1.3/contrib/puff/puff.c +++ b/src/zlib/zlib-1.3.1/contrib/puff/puff.c @@ -593,10 +593,10 @@ local int fixed(struct state *s) * provided for each of the literal/length symbols, and for each of the * distance symbols. * - * - If a symbol is not used in the block, this is represented by a zero as - * as the code length. This does not mean a zero-length code, but rather - * that no code should be created for this symbol. There is no way in the - * deflate format to represent a zero-length code. + * - If a symbol is not used in the block, this is represented by a zero as the + * code length. This does not mean a zero-length code, but rather that no + * code should be created for this symbol. There is no way in the deflate + * format to represent a zero-length code. * * - The maximum number of bits in a code is 15, so the possible lengths for * any code are 1..15. diff --git a/src/zlib/zlib-1.3/contrib/puff/puff.h b/src/zlib/zlib-1.3.1/contrib/puff/puff.h similarity index 100% rename from src/zlib/zlib-1.3/contrib/puff/puff.h rename to src/zlib/zlib-1.3.1/contrib/puff/puff.h diff --git a/src/zlib/zlib-1.3/contrib/puff/pufftest.c b/src/zlib/zlib-1.3.1/contrib/puff/pufftest.c similarity index 100% rename from src/zlib/zlib-1.3/contrib/puff/pufftest.c rename to src/zlib/zlib-1.3.1/contrib/puff/pufftest.c diff --git a/src/zlib/zlib-1.3/contrib/puff/zeros.raw b/src/zlib/zlib-1.3.1/contrib/puff/zeros.raw similarity index 100% rename from src/zlib/zlib-1.3/contrib/puff/zeros.raw rename to src/zlib/zlib-1.3.1/contrib/puff/zeros.raw diff --git a/src/zlib/zlib-1.3/contrib/testzlib/testzlib.c b/src/zlib/zlib-1.3.1/contrib/testzlib/testzlib.c similarity index 100% rename from src/zlib/zlib-1.3/contrib/testzlib/testzlib.c rename to src/zlib/zlib-1.3.1/contrib/testzlib/testzlib.c diff --git a/src/zlib/zlib-1.3/contrib/testzlib/testzlib.txt b/src/zlib/zlib-1.3.1/contrib/testzlib/testzlib.txt similarity index 100% rename from src/zlib/zlib-1.3/contrib/testzlib/testzlib.txt rename to src/zlib/zlib-1.3.1/contrib/testzlib/testzlib.txt diff --git a/src/zlib/zlib-1.3/contrib/untgz/Makefile b/src/zlib/zlib-1.3.1/contrib/untgz/Makefile similarity index 100% rename from src/zlib/zlib-1.3/contrib/untgz/Makefile rename to src/zlib/zlib-1.3.1/contrib/untgz/Makefile diff --git a/src/zlib/zlib-1.3/contrib/untgz/Makefile.msc b/src/zlib/zlib-1.3.1/contrib/untgz/Makefile.msc similarity index 100% rename from src/zlib/zlib-1.3/contrib/untgz/Makefile.msc rename to src/zlib/zlib-1.3.1/contrib/untgz/Makefile.msc diff --git a/src/zlib/zlib-1.3/contrib/untgz/untgz.c b/src/zlib/zlib-1.3.1/contrib/untgz/untgz.c similarity index 100% rename from src/zlib/zlib-1.3/contrib/untgz/untgz.c rename to src/zlib/zlib-1.3.1/contrib/untgz/untgz.c diff --git a/src/zlib/zlib-1.3/contrib/vstudio/readme.txt b/src/zlib/zlib-1.3.1/contrib/vstudio/readme.txt similarity index 88% rename from src/zlib/zlib-1.3/contrib/vstudio/readme.txt rename to src/zlib/zlib-1.3.1/contrib/vstudio/readme.txt index 05ba487c9..061bbc0e2 100644 --- a/src/zlib/zlib-1.3/contrib/vstudio/readme.txt +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/readme.txt @@ -1,75 +1,81 @@ -Building instructions for the DLL versions of Zlib 1.3.0 -======================================================== - -This directory contains projects that build zlib and minizip using -Microsoft Visual C++ 9.0/10.0. - -You don't need to build these projects yourself. You can download the -binaries from: - http://www.winimage.com/zLibDll - -More information can be found at this site. - - - - - -Build instructions for Visual Studio 2008 (32 bits or 64 bits) --------------------------------------------------------------- -- Decompress current zlib, including all contrib/* files -- Open contrib\vstudio\vc9\zlibvc.sln with Microsoft Visual C++ 2008 -- Or run: vcbuild /rebuild contrib\vstudio\vc9\zlibvc.sln "Release|Win32" - -Build instructions for Visual Studio 2010 (32 bits or 64 bits) --------------------------------------------------------------- -- Decompress current zlib, including all contrib/* files -- Open contrib\vstudio\vc10\zlibvc.sln with Microsoft Visual C++ 2010 - -Build instructions for Visual Studio 2012 (32 bits or 64 bits) --------------------------------------------------------------- -- Decompress current zlib, including all contrib/* files -- Open contrib\vstudio\vc11\zlibvc.sln with Microsoft Visual C++ 2012 - -Build instructions for Visual Studio 2013 (32 bits or 64 bits) --------------------------------------------------------------- -- Decompress current zlib, including all contrib/* files -- Open contrib\vstudio\vc12\zlibvc.sln with Microsoft Visual C++ 2013 - -Build instructions for Visual Studio 2015 (32 bits or 64 bits) --------------------------------------------------------------- -- Decompress current zlib, including all contrib/* files -- Open contrib\vstudio\vc14\zlibvc.sln with Microsoft Visual C++ 2015 - - -Important ---------- -- To use zlibwapi.dll in your application, you must define the - macro ZLIB_WINAPI when compiling your application's source files. - - -Additional notes ----------------- -- This DLL, named zlibwapi.dll, is compatible to the old zlib.dll built - by Gilles Vollant from the zlib 1.1.x sources, and distributed at - http://www.winimage.com/zLibDll - It uses the WINAPI calling convention for the exported functions, and - includes the minizip functionality. If your application needs that - particular build of zlib.dll, you can rename zlibwapi.dll to zlib.dll. - -- The new DLL was renamed because there exist several incompatible - versions of zlib.dll on the Internet. - -- There is also an official DLL build of zlib, named zlib1.dll. This one - is exporting the functions using the CDECL convention. See the file - win32\DLL_FAQ.txt found in this zlib distribution. - -- There used to be a ZLIB_DLL macro in zlib 1.1.x, but now this symbol - has a slightly different effect. To avoid compatibility problems, do - not define it here. - - -Gilles Vollant -info@winimage.com - -Visual Studio 2013 and 2015 Projects from Sean Hunt -seandhunt_7@yahoo.com +Building instructions for the DLL versions of Zlib 1.3.1 +======================================================== + +This directory contains projects that build zlib and minizip using +Microsoft Visual C++ 9.0/10.0. + +You don't need to build these projects yourself. You can download the +binaries from: + http://www.winimage.com/zLibDll + +More information can be found at this site. + + + + + +Build instructions for Visual Studio 2008 (32 bits or 64 bits) +-------------------------------------------------------------- +- Decompress current zlib, including all contrib/* files +- Open contrib\vstudio\vc9\zlibvc.sln with Microsoft Visual C++ 2008 +- Or run: vcbuild /rebuild contrib\vstudio\vc9\zlibvc.sln "Release|Win32" + +Build instructions for Visual Studio 2010 (32 bits or 64 bits) +-------------------------------------------------------------- +- Decompress current zlib, including all contrib/* files +- Open contrib\vstudio\vc10\zlibvc.sln with Microsoft Visual C++ 2010 + +Build instructions for Visual Studio 2012 (32 bits or 64 bits) +-------------------------------------------------------------- +- Decompress current zlib, including all contrib/* files +- Open contrib\vstudio\vc11\zlibvc.sln with Microsoft Visual C++ 2012 + +Build instructions for Visual Studio 2013 (32 bits or 64 bits) +-------------------------------------------------------------- +- Decompress current zlib, including all contrib/* files +- Open contrib\vstudio\vc12\zlibvc.sln with Microsoft Visual C++ 2013 + +Build instructions for Visual Studio 2015 (32 bits or 64 bits) +-------------------------------------------------------------- +- Decompress current zlib, including all contrib/* files +- Open contrib\vstudio\vc14\zlibvc.sln with Microsoft Visual C++ 2015 + +Build instructions for Visual Studio 2022 (64 bits) +-------------------------------------------------------------- +- Decompress current zlib, including all contrib/* files +- Open contrib\vstudio\vc143\zlibvc.sln with Microsoft Visual C++ 2022 + + + +Important +--------- +- To use zlibwapi.dll in your application, you must define the + macro ZLIB_WINAPI when compiling your application's source files. + + +Additional notes +---------------- +- This DLL, named zlibwapi.dll, is compatible to the old zlib.dll built + by Gilles Vollant from the zlib 1.1.x sources, and distributed at + http://www.winimage.com/zLibDll + It uses the WINAPI calling convention for the exported functions, and + includes the minizip functionality. If your application needs that + particular build of zlib.dll, you can rename zlibwapi.dll to zlib.dll. + +- The new DLL was renamed because there exist several incompatible + versions of zlib.dll on the Internet. + +- There is also an official DLL build of zlib, named zlib1.dll. This one + is exporting the functions using the CDECL convention. See the file + win32\DLL_FAQ.txt found in this zlib distribution. + +- There used to be a ZLIB_DLL macro in zlib 1.1.x, but now this symbol + has a slightly different effect. To avoid compatibility problems, do + not define it here. + + +Gilles Vollant +info@winimage.com + +Visual Studio 2013, 2015, and 2022 Projects from Sean Hunt +seandhunt_7@yahoo.com diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc10/miniunz.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc10/miniunz.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc10/miniunz.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc10/miniunz.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc10/miniunz.vcxproj.filters b/src/zlib/zlib-1.3.1/contrib/vstudio/vc10/miniunz.vcxproj.filters similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc10/miniunz.vcxproj.filters rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc10/miniunz.vcxproj.filters diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc10/minizip.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc10/minizip.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc10/minizip.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc10/minizip.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc10/minizip.vcxproj.filters b/src/zlib/zlib-1.3.1/contrib/vstudio/vc10/minizip.vcxproj.filters similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc10/minizip.vcxproj.filters rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc10/minizip.vcxproj.filters diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc10/testzlib.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc10/testzlib.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc10/testzlib.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc10/testzlib.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc10/testzlib.vcxproj.filters b/src/zlib/zlib-1.3.1/contrib/vstudio/vc10/testzlib.vcxproj.filters similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc10/testzlib.vcxproj.filters rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc10/testzlib.vcxproj.filters diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc10/testzlibdll.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc10/testzlibdll.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc10/testzlibdll.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc10/testzlibdll.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc10/testzlibdll.vcxproj.filters b/src/zlib/zlib-1.3.1/contrib/vstudio/vc10/testzlibdll.vcxproj.filters similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc10/testzlibdll.vcxproj.filters rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc10/testzlibdll.vcxproj.filters diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc10/zlib.rc b/src/zlib/zlib-1.3.1/contrib/vstudio/vc10/zlib.rc similarity index 80% rename from src/zlib/zlib-1.3/contrib/vstudio/vc10/zlib.rc rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc10/zlib.rc index 29af8e11a..856bd11f0 100644 --- a/src/zlib/zlib-1.3/contrib/vstudio/vc10/zlib.rc +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc10/zlib.rc @@ -2,8 +2,8 @@ #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 3, 0, 0 - PRODUCTVERSION 1, 3, 0, 0 + FILEVERSION 1, 3, 1, 0 + PRODUCTVERSION 1, 3, 1, 0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 @@ -17,12 +17,12 @@ BEGIN BEGIN VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.3.0\0" + VALUE "FileVersion", "1.3.1\0" VALUE "InternalName", "zlib\0" VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "ProductName", "ZLib.DLL\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2023 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc10/zlibstat.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc10/zlibstat.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc10/zlibstat.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc10/zlibstat.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc10/zlibstat.vcxproj.filters b/src/zlib/zlib-1.3.1/contrib/vstudio/vc10/zlibstat.vcxproj.filters similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc10/zlibstat.vcxproj.filters rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc10/zlibstat.vcxproj.filters diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc10/zlibvc.def b/src/zlib/zlib-1.3.1/contrib/vstudio/vc10/zlibvc.def similarity index 97% rename from src/zlib/zlib-1.3/contrib/vstudio/vc10/zlibvc.def rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc10/zlibvc.def index f28aa6c73..3234a02d9 100644 --- a/src/zlib/zlib-1.3/contrib/vstudio/vc10/zlibvc.def +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc10/zlibvc.def @@ -1,7 +1,7 @@ LIBRARY ; zlib data compression and ZIP file I/O library -VERSION 1.3 +VERSION 1.3.1 EXPORTS adler32 @1 diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc10/zlibvc.sln b/src/zlib/zlib-1.3.1/contrib/vstudio/vc10/zlibvc.sln similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc10/zlibvc.sln rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc10/zlibvc.sln diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc10/zlibvc.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc10/zlibvc.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc10/zlibvc.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc10/zlibvc.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc10/zlibvc.vcxproj.filters b/src/zlib/zlib-1.3.1/contrib/vstudio/vc10/zlibvc.vcxproj.filters similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc10/zlibvc.vcxproj.filters rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc10/zlibvc.vcxproj.filters diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc11/miniunz.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc11/miniunz.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc11/miniunz.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc11/miniunz.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc11/minizip.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc11/minizip.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc11/minizip.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc11/minizip.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc11/testzlib.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc11/testzlib.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc11/testzlib.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc11/testzlib.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc11/testzlibdll.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc11/testzlibdll.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc11/testzlibdll.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc11/testzlibdll.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc11/zlib.rc b/src/zlib/zlib-1.3.1/contrib/vstudio/vc11/zlib.rc similarity index 80% rename from src/zlib/zlib-1.3/contrib/vstudio/vc11/zlib.rc rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc11/zlib.rc index 29af8e11a..856bd11f0 100644 --- a/src/zlib/zlib-1.3/contrib/vstudio/vc11/zlib.rc +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc11/zlib.rc @@ -2,8 +2,8 @@ #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 3, 0, 0 - PRODUCTVERSION 1, 3, 0, 0 + FILEVERSION 1, 3, 1, 0 + PRODUCTVERSION 1, 3, 1, 0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 @@ -17,12 +17,12 @@ BEGIN BEGIN VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.3.0\0" + VALUE "FileVersion", "1.3.1\0" VALUE "InternalName", "zlib\0" VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "ProductName", "ZLib.DLL\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2023 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc11/zlibstat.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc11/zlibstat.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc11/zlibstat.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc11/zlibstat.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc11/zlibvc.def b/src/zlib/zlib-1.3.1/contrib/vstudio/vc11/zlibvc.def similarity index 97% rename from src/zlib/zlib-1.3/contrib/vstudio/vc11/zlibvc.def rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc11/zlibvc.def index f28aa6c73..3234a02d9 100644 --- a/src/zlib/zlib-1.3/contrib/vstudio/vc11/zlibvc.def +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc11/zlibvc.def @@ -1,7 +1,7 @@ LIBRARY ; zlib data compression and ZIP file I/O library -VERSION 1.3 +VERSION 1.3.1 EXPORTS adler32 @1 diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc11/zlibvc.sln b/src/zlib/zlib-1.3.1/contrib/vstudio/vc11/zlibvc.sln similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc11/zlibvc.sln rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc11/zlibvc.sln diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc11/zlibvc.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc11/zlibvc.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc11/zlibvc.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc11/zlibvc.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc12/miniunz.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc12/miniunz.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc12/miniunz.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc12/miniunz.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc12/minizip.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc12/minizip.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc12/minizip.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc12/minizip.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc12/testzlib.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc12/testzlib.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc12/testzlib.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc12/testzlib.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc12/testzlibdll.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc12/testzlibdll.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc12/testzlibdll.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc12/testzlibdll.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc14/zlib.rc b/src/zlib/zlib-1.3.1/contrib/vstudio/vc12/zlib.rc similarity index 83% rename from src/zlib/zlib-1.3/contrib/vstudio/vc14/zlib.rc rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc12/zlib.rc index 57fb31a32..a55f341c7 100644 --- a/src/zlib/zlib-1.3/contrib/vstudio/vc14/zlib.rc +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc12/zlib.rc @@ -2,8 +2,8 @@ #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 3, 0, 0 - PRODUCTVERSION 1, 3, 0, 0 + FILEVERSION 1, 3, 1, 0 + PRODUCTVERSION 1, 3, 1, 0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 @@ -17,12 +17,12 @@ BEGIN BEGIN VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.3.0\0" + VALUE "FileVersion", "1.3.1\0" VALUE "InternalName", "zlib\0" VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "ProductName", "ZLib.DLL\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2023 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc12/zlibstat.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc12/zlibstat.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc12/zlibstat.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc12/zlibstat.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc14/zlibvc.def b/src/zlib/zlib-1.3.1/contrib/vstudio/vc12/zlibvc.def similarity index 97% rename from src/zlib/zlib-1.3/contrib/vstudio/vc14/zlibvc.def rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc12/zlibvc.def index f28aa6c73..3234a02d9 100644 --- a/src/zlib/zlib-1.3/contrib/vstudio/vc14/zlibvc.def +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc12/zlibvc.def @@ -1,7 +1,7 @@ LIBRARY ; zlib data compression and ZIP file I/O library -VERSION 1.3 +VERSION 1.3.1 EXPORTS adler32 @1 diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc12/zlibvc.sln b/src/zlib/zlib-1.3.1/contrib/vstudio/vc12/zlibvc.sln similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc12/zlibvc.sln rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc12/zlibvc.sln diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc12/zlibvc.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc12/zlibvc.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc12/zlibvc.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc12/zlibvc.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc14/miniunz.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc14/miniunz.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc14/miniunz.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc14/miniunz.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc14/minizip.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc14/minizip.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc14/minizip.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc14/minizip.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc14/testzlib.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc14/testzlib.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc14/testzlib.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc14/testzlib.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc14/testzlibdll.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc14/testzlibdll.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc14/testzlibdll.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc14/testzlibdll.vcxproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc12/zlib.rc b/src/zlib/zlib-1.3.1/contrib/vstudio/vc14/zlib.rc similarity index 83% rename from src/zlib/zlib-1.3/contrib/vstudio/vc12/zlib.rc rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc14/zlib.rc index 57fb31a32..a55f341c7 100644 --- a/src/zlib/zlib-1.3/contrib/vstudio/vc12/zlib.rc +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc14/zlib.rc @@ -2,8 +2,8 @@ #define IDR_VERSION1 1 IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 3, 0, 0 - PRODUCTVERSION 1, 3, 0, 0 + FILEVERSION 1, 3, 1, 0 + PRODUCTVERSION 1, 3, 1, 0 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK FILEFLAGS 0 FILEOS VOS_DOS_WINDOWS32 @@ -17,12 +17,12 @@ BEGIN BEGIN VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.3.0\0" + VALUE "FileVersion", "1.3.1\0" VALUE "InternalName", "zlib\0" VALUE "OriginalFilename", "zlibwapi.dll\0" VALUE "ProductName", "ZLib.DLL\0" VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2023 Jean-loup Gailly & Mark Adler\0" + VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0" END END BLOCK "VarFileInfo" diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc14/zlibstat.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc14/zlibstat.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc14/zlibstat.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc14/zlibstat.vcxproj diff --git a/src/zlib/zlib-1.3.1/contrib/vstudio/vc14/zlibvc.def b/src/zlib/zlib-1.3.1/contrib/vstudio/vc14/zlibvc.def new file mode 100644 index 000000000..3234a02d9 --- /dev/null +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc14/zlibvc.def @@ -0,0 +1,158 @@ +LIBRARY +; zlib data compression and ZIP file I/O library + +VERSION 1.3.1 + +EXPORTS + adler32 @1 + compress @2 + crc32 @3 + deflate @4 + deflateCopy @5 + deflateEnd @6 + deflateInit2_ @7 + deflateInit_ @8 + deflateParams @9 + deflateReset @10 + deflateSetDictionary @11 + gzclose @12 + gzdopen @13 + gzerror @14 + gzflush @15 + gzopen @16 + gzread @17 + gzwrite @18 + inflate @19 + inflateEnd @20 + inflateInit2_ @21 + inflateInit_ @22 + inflateReset @23 + inflateSetDictionary @24 + inflateSync @25 + uncompress @26 + zlibVersion @27 + gzprintf @28 + gzputc @29 + gzgetc @30 + gzseek @31 + gzrewind @32 + gztell @33 + gzeof @34 + gzsetparams @35 + zError @36 + inflateSyncPoint @37 + get_crc_table @38 + compress2 @39 + gzputs @40 + gzgets @41 + inflateCopy @42 + inflateBackInit_ @43 + inflateBack @44 + inflateBackEnd @45 + compressBound @46 + deflateBound @47 + gzclearerr @48 + gzungetc @49 + zlibCompileFlags @50 + deflatePrime @51 + deflatePending @52 + + unzOpen @61 + unzClose @62 + unzGetGlobalInfo @63 + unzGetCurrentFileInfo @64 + unzGoToFirstFile @65 + unzGoToNextFile @66 + unzOpenCurrentFile @67 + unzReadCurrentFile @68 + unzOpenCurrentFile3 @69 + unztell @70 + unzeof @71 + unzCloseCurrentFile @72 + unzGetGlobalComment @73 + unzStringFileNameCompare @74 + unzLocateFile @75 + unzGetLocalExtrafield @76 + unzOpen2 @77 + unzOpenCurrentFile2 @78 + unzOpenCurrentFilePassword @79 + + zipOpen @80 + zipOpenNewFileInZip @81 + zipWriteInFileInZip @82 + zipCloseFileInZip @83 + zipClose @84 + zipOpenNewFileInZip2 @86 + zipCloseFileInZipRaw @87 + zipOpen2 @88 + zipOpenNewFileInZip3 @89 + + unzGetFilePos @100 + unzGoToFilePos @101 + + fill_win32_filefunc @110 + +; zlibwapi v1.2.4 added: + fill_win32_filefunc64 @111 + fill_win32_filefunc64A @112 + fill_win32_filefunc64W @113 + + unzOpen64 @120 + unzOpen2_64 @121 + unzGetGlobalInfo64 @122 + unzGetCurrentFileInfo64 @124 + unzGetCurrentFileZStreamPos64 @125 + unztell64 @126 + unzGetFilePos64 @127 + unzGoToFilePos64 @128 + + zipOpen64 @130 + zipOpen2_64 @131 + zipOpenNewFileInZip64 @132 + zipOpenNewFileInZip2_64 @133 + zipOpenNewFileInZip3_64 @134 + zipOpenNewFileInZip4_64 @135 + zipCloseFileInZipRaw64 @136 + +; zlib1 v1.2.4 added: + adler32_combine @140 + crc32_combine @142 + deflateSetHeader @144 + deflateTune @145 + gzbuffer @146 + gzclose_r @147 + gzclose_w @148 + gzdirect @149 + gzoffset @150 + inflateGetHeader @156 + inflateMark @157 + inflatePrime @158 + inflateReset2 @159 + inflateUndermine @160 + +; zlib1 v1.2.6 added: + gzgetc_ @161 + inflateResetKeep @163 + deflateResetKeep @164 + +; zlib1 v1.2.7 added: + gzopen_w @165 + +; zlib1 v1.2.8 added: + inflateGetDictionary @166 + gzvprintf @167 + +; zlib1 v1.2.9 added: + inflateCodesUsed @168 + inflateValidate @169 + uncompress2 @170 + gzfread @171 + gzfwrite @172 + deflateGetDictionary @173 + adler32_z @174 + crc32_z @175 + +; zlib1 v1.2.12 added: + crc32_combine_gen @176 + crc32_combine_gen64 @177 + crc32_combine_op @178 diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc14/zlibvc.sln b/src/zlib/zlib-1.3.1/contrib/vstudio/vc14/zlibvc.sln similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc14/zlibvc.sln rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc14/zlibvc.sln diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc14/zlibvc.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc14/zlibvc.vcxproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc14/zlibvc.vcxproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc14/zlibvc.vcxproj diff --git a/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/miniunz.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/miniunz.vcxproj new file mode 100644 index 000000000..68ef16588 --- /dev/null +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/miniunz.vcxproj @@ -0,0 +1,409 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {C52F9E7B-498A-42BE-8DB4-85A15694382A} + Win32Proj + 10.0 + + + + Application + MultiByte + v143 + + + Application + Unicode + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\MiniUnzip$(Configuration)\ + x86\MiniUnzip$(Configuration)\Tmp\ + true + false + x86\MiniUnzip$(Configuration)\ + x86\MiniUnzip$(Configuration)\Tmp\ + false + false + x64\MiniUnzip$(Configuration)\ + x64\MiniUnzip$(Configuration)\Tmp\ + true + true + true + false + false + false + x64\MiniUnzip$(Configuration)\ + x64\MiniUnzip$(Configuration)\Tmp\ + false + false + false + false + false + false + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + arm64\MiniUnzip$(Configuration)\ + arm64\MiniUnzip$(Configuration)\Tmp\ + + + arm64\MiniUnzip$(Configuration)\ + arm64\MiniUnzip$(Configuration)\Tmp\ + + + arm\MiniUnzip$(Configuration)\ + arm\MiniUnzip$(Configuration)\Tmp\ + + + arm\MiniUnzip$(Configuration)\ + arm\MiniUnzip$(Configuration)\Tmp\ + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + false + + + MachineX86 + + + + + X64 + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + MachineX64 + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + $(OutDir)miniunz.pdb + Console + + + + + X64 + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + MachineX64 + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)miniunz.exe + true + Console + true + true + + + + + + + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + + + + + \ No newline at end of file diff --git a/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/minizip.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/minizip.vcxproj new file mode 100644 index 000000000..dd3c52e70 --- /dev/null +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/minizip.vcxproj @@ -0,0 +1,405 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B} + Win32Proj + 10.0 + + + + Application + MultiByte + v143 + + + Application + Unicode + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\MiniZip$(Configuration)\ + x86\MiniZip$(Configuration)\Tmp\ + true + false + x86\MiniZip$(Configuration)\ + x86\MiniZip$(Configuration)\Tmp\ + false + x64\$(Configuration)\ + x64\$(Configuration)\ + true + true + true + false + false + false + x64\$(Configuration)\ + x64\$(Configuration)\ + false + false + false + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + arm64\MiniZip$(Configuration)\ + arm64\MiniZip$(Configuration)\Tmp\ + + + arm64\MiniZip$(Configuration)\ + arm64\MiniZip$(Configuration)\Tmp\ + + + arm\MiniZip$(Configuration)\ + arm\MiniZip$(Configuration)\Tmp\ + + + arm\MiniZip$(Configuration)\ + arm\MiniZip$(Configuration)\Tmp\ + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + false + + + MachineX86 + + + + + X64 + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + MachineX64 + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + $(OutDir)minizip.pdb + Console + + + + + X64 + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + MachineX64 + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)minizip.exe + true + Console + true + true + + + + + + + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + + + + + \ No newline at end of file diff --git a/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/testzlib.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/testzlib.vcxproj new file mode 100644 index 000000000..4cc99b3ff --- /dev/null +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/testzlib.vcxproj @@ -0,0 +1,473 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + ReleaseWithoutAsm + ARM + + + ReleaseWithoutAsm + ARM64 + + + ReleaseWithoutAsm + Win32 + + + ReleaseWithoutAsm + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B} + testzlib + Win32Proj + 10.0 + + + + Application + MultiByte + true + v143 + + + Application + MultiByte + true + v143 + + + Application + Unicode + v143 + + + Application + true + v143 + + + Application + true + v143 + + + Application + true + v143 + + + Application + true + v143 + + + Application + true + v143 + + + Application + true + v143 + + + Application + v143 + + + Application + v143 + + + Application + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\TestZlib$(Configuration)\ + x86\TestZlib$(Configuration)\Tmp\ + true + false + x86\TestZlib$(Configuration)\ + x86\TestZlib$(Configuration)\Tmp\ + false + false + x86\TestZlib$(Configuration)\ + x86\TestZlib$(Configuration)\Tmp\ + false + false + x64\TestZlib$(Configuration)\ + x64\TestZlib$(Configuration)\Tmp\ + false + false + false + x64\TestZlib$(Configuration)\ + x64\TestZlib$(Configuration)\Tmp\ + false + false + false + x64\TestZlib$(Configuration)\ + x64\TestZlib$(Configuration)\Tmp\ + false + false + false + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + arm64\TestZlib$(Configuration)\ + arm64\TestZlib$(Configuration)\Tmp\ + + + arm64\TestZlib$(Configuration)\ + arm64\TestZlib$(Configuration)\Tmp\ + + + arm64\TestZlib$(Configuration)\ + arm64\TestZlib$(Configuration)\Tmp\ + + + arm\TestZlib$(Configuration)\ + arm\TestZlib$(Configuration)\Tmp\ + + + arm\TestZlib$(Configuration)\ + arm\TestZlib$(Configuration)\Tmp\ + + + arm\TestZlib$(Configuration)\ + arm\TestZlib$(Configuration)\Tmp\ + + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + AssemblyAndSourceCode + $(IntDir) + Level3 + ProgramDatabase + + + %(AdditionalDependencies) + $(OutDir)testzlib.exe + true + $(OutDir)testzlib.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + $(OutDir)testzlib.exe + true + Console + true + true + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + %(AdditionalDependencies) + $(OutDir)testzlib.exe + true + Console + true + true + false + + + MachineX86 + false + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDebugDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDebugDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_DEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDebugDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;NDEBUG;_CONSOLE;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + Default + MultiThreadedDLL + false + $(IntDir) + + + %(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/testzlibdll.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/testzlibdll.vcxproj new file mode 100644 index 000000000..73bba55da --- /dev/null +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/testzlibdll.vcxproj @@ -0,0 +1,409 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {C52F9E7B-498A-42BE-8DB4-85A15694366A} + Win32Proj + 10.0 + + + + Application + MultiByte + v143 + + + Application + Unicode + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + Application + MultiByte + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\TestZlibDll$(Configuration)\ + x86\TestZlibDll$(Configuration)\Tmp\ + true + false + x86\TestZlibDll$(Configuration)\ + x86\TestZlibDll$(Configuration)\Tmp\ + false + false + x64\TestZlibDll$(Configuration)\ + x64\TestZlibDll$(Configuration)\Tmp\ + true + true + true + false + false + false + x64\TestZlibDll$(Configuration)\ + x64\TestZlibDll$(Configuration)\Tmp\ + false + false + false + false + false + false + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + arm64\TestZlibDll$(Configuration)\ + arm64\TestZlibDll$(Configuration)\Tmp\ + + + arm64\TestZlibDll$(Configuration)\ + arm64\TestZlibDll$(Configuration)\Tmp\ + + + arm\TestZlibDll$(Configuration)\ + arm\TestZlibDll$(Configuration)\Tmp\ + + + arm\TestZlibDll$(Configuration)\ + arm\TestZlibDll$(Configuration)\Tmp\ + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + false + + + MachineX86 + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + Default + MultiThreaded + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x86\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + false + + + MachineX86 + + + + + X64 + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + MachineX64 + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + + + + + + Disabled + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;_DEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDebugDLL + false + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllDebug\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + $(OutDir)testzlib.pdb + Console + + + + + X64 + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + MachineX64 + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + + + + + + MaxSpeed + OnlyExplicitInline + true + ..\..\..;..\..\minizip;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;ZLIB_WINAPI;NDEBUG;_CONSOLE;WIN64;%(PreprocessorDefinitions) + true + Default + MultiThreadedDLL + false + true + + + $(IntDir) + Level3 + ProgramDatabase + + + x64\ZlibDllRelease\zlibwapi.lib;%(AdditionalDependencies) + $(OutDir)testzlibdll.exe + true + Console + true + true + + + + + + + + {8fd826f8-3739-44e6-8cc8-997122e53b8d} + + + + + + \ No newline at end of file diff --git a/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/zlib.rc b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/zlib.rc new file mode 100644 index 000000000..a55f341c7 --- /dev/null +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/zlib.rc @@ -0,0 +1,32 @@ +#include + +#define IDR_VERSION1 1 +IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE + FILEVERSION 1, 3, 1, 0 + PRODUCTVERSION 1, 3, 1, 0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS 0 + FILEOS VOS_DOS_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0 // not used +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + //language ID = U.S. English, char set = Windows, Multilingual + + BEGIN + VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" + VALUE "FileVersion", "1.3.1\0" + VALUE "InternalName", "zlib\0" + VALUE "OriginalFilename", "zlibwapi.dll\0" + VALUE "ProductName", "ZLib.DLL\0" + VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" + VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1252 + END +END diff --git a/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/zlibstat.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/zlibstat.vcxproj new file mode 100644 index 000000000..b946ac2a9 --- /dev/null +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/zlibstat.vcxproj @@ -0,0 +1,602 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + ReleaseWithoutAsm + ARM + + + ReleaseWithoutAsm + ARM64 + + + ReleaseWithoutAsm + Win32 + + + ReleaseWithoutAsm + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8} + 10.0 + + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + Unicode + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + StaticLibrary + false + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\ZlibStat$(Configuration)\ + x86\ZlibStat$(Configuration)\Tmp\ + x86\ZlibStat$(Configuration)\ + x86\ZlibStat$(Configuration)\Tmp\ + x86\ZlibStat$(Configuration)\ + x86\ZlibStat$(Configuration)\Tmp\ + x64\ZlibStat$(Configuration)\ + x64\ZlibStat$(Configuration)\Tmp\ + x64\ZlibStat$(Configuration)\ + x64\ZlibStat$(Configuration)\Tmp\ + x64\ZlibStat$(Configuration)\ + x64\ZlibStat$(Configuration)\Tmp\ + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + arm64\ZlibStat$(Configuration)\ + arm64\ZlibStat$(Configuration)\Tmp\ + + + arm64\ZlibStat$(Configuration)\ + arm64\ZlibStat$(Configuration)\Tmp\ + + + arm64\ZlibStat$(Configuration)\ + arm64\ZlibStat$(Configuration)\Tmp\ + + + arm\ZlibStat$(Configuration)\ + arm\ZlibStat$(Configuration)\Tmp\ + + + arm\ZlibStat$(Configuration)\ + arm\ZlibStat$(Configuration)\Tmp\ + + + arm\ZlibStat$(Configuration)\ + arm\ZlibStat$(Configuration)\Tmp\ + + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + MultiThreaded + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibstat.lib + true + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;%(PreprocessorDefinitions) + true + + + MultiThreaded + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:X86 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + X64 + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:ARM64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + OldStyle + + + 0x040c + + + /MACHINE:ARM /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + X64 + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibstat.lib + true + + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:ARM64 /NODEFAULTLIB %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibstat.lib + true + + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:ARM /NODEFAULTLIB %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibstat.lib + true + + + + + X64 + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:AMD64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:ARM64 /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + ZLIB_WINAPI;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibstat.pch + $(IntDir) + $(IntDir) + $(OutDir) + Level3 + true + + + 0x040c + + + /MACHINE:ARM /NODEFAULTLIB %(AdditionalOptions) + $(OutDir)zlibstat.lib + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc12/zlibvc.def b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/zlibvc.def similarity index 97% rename from src/zlib/zlib-1.3/contrib/vstudio/vc12/zlibvc.def rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc17/zlibvc.def index f28aa6c73..53947cc31 100644 --- a/src/zlib/zlib-1.3/contrib/vstudio/vc12/zlibvc.def +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/zlibvc.def @@ -1,158 +1,158 @@ -LIBRARY -; zlib data compression and ZIP file I/O library - -VERSION 1.3 - -EXPORTS - adler32 @1 - compress @2 - crc32 @3 - deflate @4 - deflateCopy @5 - deflateEnd @6 - deflateInit2_ @7 - deflateInit_ @8 - deflateParams @9 - deflateReset @10 - deflateSetDictionary @11 - gzclose @12 - gzdopen @13 - gzerror @14 - gzflush @15 - gzopen @16 - gzread @17 - gzwrite @18 - inflate @19 - inflateEnd @20 - inflateInit2_ @21 - inflateInit_ @22 - inflateReset @23 - inflateSetDictionary @24 - inflateSync @25 - uncompress @26 - zlibVersion @27 - gzprintf @28 - gzputc @29 - gzgetc @30 - gzseek @31 - gzrewind @32 - gztell @33 - gzeof @34 - gzsetparams @35 - zError @36 - inflateSyncPoint @37 - get_crc_table @38 - compress2 @39 - gzputs @40 - gzgets @41 - inflateCopy @42 - inflateBackInit_ @43 - inflateBack @44 - inflateBackEnd @45 - compressBound @46 - deflateBound @47 - gzclearerr @48 - gzungetc @49 - zlibCompileFlags @50 - deflatePrime @51 - deflatePending @52 - - unzOpen @61 - unzClose @62 - unzGetGlobalInfo @63 - unzGetCurrentFileInfo @64 - unzGoToFirstFile @65 - unzGoToNextFile @66 - unzOpenCurrentFile @67 - unzReadCurrentFile @68 - unzOpenCurrentFile3 @69 - unztell @70 - unzeof @71 - unzCloseCurrentFile @72 - unzGetGlobalComment @73 - unzStringFileNameCompare @74 - unzLocateFile @75 - unzGetLocalExtrafield @76 - unzOpen2 @77 - unzOpenCurrentFile2 @78 - unzOpenCurrentFilePassword @79 - - zipOpen @80 - zipOpenNewFileInZip @81 - zipWriteInFileInZip @82 - zipCloseFileInZip @83 - zipClose @84 - zipOpenNewFileInZip2 @86 - zipCloseFileInZipRaw @87 - zipOpen2 @88 - zipOpenNewFileInZip3 @89 - - unzGetFilePos @100 - unzGoToFilePos @101 - - fill_win32_filefunc @110 - -; zlibwapi v1.2.4 added: - fill_win32_filefunc64 @111 - fill_win32_filefunc64A @112 - fill_win32_filefunc64W @113 - - unzOpen64 @120 - unzOpen2_64 @121 - unzGetGlobalInfo64 @122 - unzGetCurrentFileInfo64 @124 - unzGetCurrentFileZStreamPos64 @125 - unztell64 @126 - unzGetFilePos64 @127 - unzGoToFilePos64 @128 - - zipOpen64 @130 - zipOpen2_64 @131 - zipOpenNewFileInZip64 @132 - zipOpenNewFileInZip2_64 @133 - zipOpenNewFileInZip3_64 @134 - zipOpenNewFileInZip4_64 @135 - zipCloseFileInZipRaw64 @136 - -; zlib1 v1.2.4 added: - adler32_combine @140 - crc32_combine @142 - deflateSetHeader @144 - deflateTune @145 - gzbuffer @146 - gzclose_r @147 - gzclose_w @148 - gzdirect @149 - gzoffset @150 - inflateGetHeader @156 - inflateMark @157 - inflatePrime @158 - inflateReset2 @159 - inflateUndermine @160 - -; zlib1 v1.2.6 added: - gzgetc_ @161 - inflateResetKeep @163 - deflateResetKeep @164 - -; zlib1 v1.2.7 added: - gzopen_w @165 - -; zlib1 v1.2.8 added: - inflateGetDictionary @166 - gzvprintf @167 - -; zlib1 v1.2.9 added: - inflateCodesUsed @168 - inflateValidate @169 - uncompress2 @170 - gzfread @171 - gzfwrite @172 - deflateGetDictionary @173 - adler32_z @174 - crc32_z @175 - -; zlib1 v1.2.12 added: - crc32_combine_gen @176 - crc32_combine_gen64 @177 - crc32_combine_op @178 +LIBRARY +; zlib data compression and ZIP file I/O library + +VERSION 1.3.1 + +EXPORTS + adler32 @1 + compress @2 + crc32 @3 + deflate @4 + deflateCopy @5 + deflateEnd @6 + deflateInit2_ @7 + deflateInit_ @8 + deflateParams @9 + deflateReset @10 + deflateSetDictionary @11 + gzclose @12 + gzdopen @13 + gzerror @14 + gzflush @15 + gzopen @16 + gzread @17 + gzwrite @18 + inflate @19 + inflateEnd @20 + inflateInit2_ @21 + inflateInit_ @22 + inflateReset @23 + inflateSetDictionary @24 + inflateSync @25 + uncompress @26 + zlibVersion @27 + gzprintf @28 + gzputc @29 + gzgetc @30 + gzseek @31 + gzrewind @32 + gztell @33 + gzeof @34 + gzsetparams @35 + zError @36 + inflateSyncPoint @37 + get_crc_table @38 + compress2 @39 + gzputs @40 + gzgets @41 + inflateCopy @42 + inflateBackInit_ @43 + inflateBack @44 + inflateBackEnd @45 + compressBound @46 + deflateBound @47 + gzclearerr @48 + gzungetc @49 + zlibCompileFlags @50 + deflatePrime @51 + deflatePending @52 + + unzOpen @61 + unzClose @62 + unzGetGlobalInfo @63 + unzGetCurrentFileInfo @64 + unzGoToFirstFile @65 + unzGoToNextFile @66 + unzOpenCurrentFile @67 + unzReadCurrentFile @68 + unzOpenCurrentFile3 @69 + unztell @70 + unzeof @71 + unzCloseCurrentFile @72 + unzGetGlobalComment @73 + unzStringFileNameCompare @74 + unzLocateFile @75 + unzGetLocalExtrafield @76 + unzOpen2 @77 + unzOpenCurrentFile2 @78 + unzOpenCurrentFilePassword @79 + + zipOpen @80 + zipOpenNewFileInZip @81 + zipWriteInFileInZip @82 + zipCloseFileInZip @83 + zipClose @84 + zipOpenNewFileInZip2 @86 + zipCloseFileInZipRaw @87 + zipOpen2 @88 + zipOpenNewFileInZip3 @89 + + unzGetFilePos @100 + unzGoToFilePos @101 + + fill_win32_filefunc @110 + +; zlibwapi v1.2.4 added: + fill_win32_filefunc64 @111 + fill_win32_filefunc64A @112 + fill_win32_filefunc64W @113 + + unzOpen64 @120 + unzOpen2_64 @121 + unzGetGlobalInfo64 @122 + unzGetCurrentFileInfo64 @124 + unzGetCurrentFileZStreamPos64 @125 + unztell64 @126 + unzGetFilePos64 @127 + unzGoToFilePos64 @128 + + zipOpen64 @130 + zipOpen2_64 @131 + zipOpenNewFileInZip64 @132 + zipOpenNewFileInZip2_64 @133 + zipOpenNewFileInZip3_64 @134 + zipOpenNewFileInZip4_64 @135 + zipCloseFileInZipRaw64 @136 + +; zlib1 v1.2.4 added: + adler32_combine @140 + crc32_combine @142 + deflateSetHeader @144 + deflateTune @145 + gzbuffer @146 + gzclose_r @147 + gzclose_w @148 + gzdirect @149 + gzoffset @150 + inflateGetHeader @156 + inflateMark @157 + inflatePrime @158 + inflateReset2 @159 + inflateUndermine @160 + +; zlib1 v1.2.6 added: + gzgetc_ @161 + inflateResetKeep @163 + deflateResetKeep @164 + +; zlib1 v1.2.7 added: + gzopen_w @165 + +; zlib1 v1.2.8 added: + inflateGetDictionary @166 + gzvprintf @167 + +; zlib1 v1.2.9 added: + inflateCodesUsed @168 + inflateValidate @169 + uncompress2 @170 + gzfread @171 + gzfwrite @172 + deflateGetDictionary @173 + adler32_z @174 + crc32_z @175 + +; zlib1 v1.2.12 added: + crc32_combine_gen @176 + crc32_combine_gen64 @177 + crc32_combine_op @178 diff --git a/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/zlibvc.sln b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/zlibvc.sln new file mode 100644 index 000000000..67896b747 --- /dev/null +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/zlibvc.sln @@ -0,0 +1,179 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33015.44 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "zlibvc.vcxproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcxproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlib", "testzlib.vcxproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlibdll", "testzlibdll.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694366A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcxproj", "{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcxproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + ReleaseWithoutAsm|ARM = ReleaseWithoutAsm|ARM + ReleaseWithoutAsm|ARM64 = ReleaseWithoutAsm|ARM64 + ReleaseWithoutAsm|Win32 = ReleaseWithoutAsm|Win32 + ReleaseWithoutAsm|x64 = ReleaseWithoutAsm|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|ARM.ActiveCfg = Debug|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|ARM.Build.0 = Debug|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|ARM64.Build.0 = Debug|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.ActiveCfg = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.ActiveCfg = Debug|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.Build.0 = Debug|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|ARM.ActiveCfg = Release|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|ARM.Build.0 = Release|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|ARM64.ActiveCfg = Release|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|ARM64.Build.0 = Release|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.ActiveCfg = Release|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.Build.0 = Release|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|ARM.ActiveCfg = ReleaseWithoutAsm|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|ARM.Build.0 = ReleaseWithoutAsm|ARM + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|ARM64.ActiveCfg = ReleaseWithoutAsm|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|ARM64.Build.0 = ReleaseWithoutAsm|ARM64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|ARM.ActiveCfg = Debug|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|ARM.Build.0 = Debug|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|ARM64.Build.0 = Debug|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.ActiveCfg = Debug|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.Build.0 = Debug|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.ActiveCfg = Debug|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.Build.0 = Debug|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|ARM.ActiveCfg = Release|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|ARM.Build.0 = Release|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|ARM64.ActiveCfg = Release|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|ARM64.Build.0 = Release|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.ActiveCfg = Release|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.ActiveCfg = Release|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.Build.0 = Release|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|ARM.ActiveCfg = ReleaseWithoutAsm|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|ARM.Build.0 = ReleaseWithoutAsm|ARM + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|ARM64.ActiveCfg = ReleaseWithoutAsm|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|ARM64.Build.0 = ReleaseWithoutAsm|ARM64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM.ActiveCfg = Debug|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM.Build.0 = Debug|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM64.Build.0 = Debug|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM.ActiveCfg = Release|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM.Build.0 = Release|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM64.ActiveCfg = Release|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM64.Build.0 = Release|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM.ActiveCfg = ReleaseWithoutAsm|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM.Build.0 = ReleaseWithoutAsm|ARM + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM64.ActiveCfg = ReleaseWithoutAsm|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM64.Build.0 = ReleaseWithoutAsm|ARM64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 + {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|ARM.ActiveCfg = Debug|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|ARM.Build.0 = Debug|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|ARM64.Build.0 = Debug|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.ActiveCfg = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.Build.0 = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.ActiveCfg = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.Build.0 = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|ARM.ActiveCfg = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|ARM.Build.0 = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|ARM64.ActiveCfg = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|ARM64.Build.0 = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.Build.0 = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.ActiveCfg = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.Build.0 = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|ARM.ActiveCfg = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|ARM.Build.0 = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|ARM64.ActiveCfg = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|ARM64.Build.0 = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM.ActiveCfg = Debug|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM.Build.0 = Debug|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|ARM64.Build.0 = Debug|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM.ActiveCfg = Release|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM.Build.0 = Release|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM64.ActiveCfg = Release|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|ARM64.Build.0 = Release|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM.ActiveCfg = Release|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM.Build.0 = Release|ARM + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM64.ActiveCfg = Release|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|ARM64.Build.0 = Release|ARM64 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 + {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|ARM.ActiveCfg = Debug|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|ARM.Build.0 = Debug|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|ARM64.Build.0 = Debug|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.ActiveCfg = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.Build.0 = Debug|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.ActiveCfg = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.Build.0 = Debug|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|ARM.ActiveCfg = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|ARM.Build.0 = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|ARM64.ActiveCfg = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|ARM64.Build.0 = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.Build.0 = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.ActiveCfg = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.Build.0 = Release|x64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|ARM.ActiveCfg = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|ARM.Build.0 = Release|ARM + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|ARM64.ActiveCfg = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|ARM64.Build.0 = Release|ARM64 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Win32 + {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EAA58685-56D9-43F2-8703-FD2CB020745E} + EndGlobalSection +EndGlobal diff --git a/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/zlibvc.vcxproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/zlibvc.vcxproj new file mode 100644 index 000000000..10a7a901e --- /dev/null +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc17/zlibvc.vcxproj @@ -0,0 +1,875 @@ + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + ReleaseWithoutAsm + ARM + + + ReleaseWithoutAsm + ARM64 + + + ReleaseWithoutAsm + Win32 + + + ReleaseWithoutAsm + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + {8FD826F8-3739-44E6-8CC8-997122E53B8D} + 10.0 + + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + v143 + Unicode + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + true + v143 + + + DynamicLibrary + false + v143 + + + DynamicLibrary + false + v143 + + + DynamicLibrary + false + v143 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + x86\ZlibDll$(Configuration)\ + x86\ZlibDll$(Configuration)\Tmp\ + true + false + x86\ZlibDll$(Configuration)\ + x86\ZlibDll$(Configuration)\Tmp\ + false + false + x86\ZlibDll$(Configuration)\ + x86\ZlibDll$(Configuration)\Tmp\ + false + false + x64\ZlibDll$(Configuration)\ + x64\ZlibDll$(Configuration)\Tmp\ + true + true + true + false + false + false + x64\ZlibDll$(Configuration)\ + x64\ZlibDll$(Configuration)\Tmp\ + false + false + false + false + false + false + x64\ZlibDll$(Configuration)\ + x64\ZlibDll$(Configuration)\Tmp\ + false + false + false + false + false + false + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + zlibwapi + + + arm64\ZlibDll$(Configuration)\ + arm64\ZlibDll$(Configuration)\Tmp\ + + + arm\ZlibDll$(Configuration)\ + arm\ZlibDll$(Configuration)\Tmp\ + + + arm64\ZlibDll$(Configuration)\ + arm64\ZlibDll$(Configuration)\Tmp\ + + + arm64\ZlibDll$(Configuration)\ + arm64\ZlibDll$(Configuration)\Tmp\ + + + arm\ZlibDll$(Configuration)\ + arm\ZlibDll$(Configuration)\Tmp\ + + + arm\ZlibDll$(Configuration)\ + arm\ZlibDll$(Configuration)\Tmp\ + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + /MACHINE:I386 %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + false + + + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + /MACHINE:I386 %(AdditionalOptions) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + false + + + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions) + true + + + MultiThreaded + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + /MACHINE:I386 %(AdditionalOptions) + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + false + + + $(OutDir)zlibwapi.lib + false + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + X64 + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineX64 + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + Disabled + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + + + MultiThreadedDebugDLL + false + $(IntDir)zlibvc.pch + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + ProgramDatabase + + + _DEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + .\zlibvc.def + true + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + X64 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineX64 + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + WIN32;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + X64 + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + MachineX64 + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN64;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + $(OutDir)zlibvc.tlb + + + OnlyExplicitInline + ..\..\..;%(AdditionalIncludeDirectories) + _CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;ZLIB_WINAPI;WIN32;%(PreprocessorDefinitions) + true + + + MultiThreadedDLL + false + true + $(IntDir)zlibvc.pch + All + $(IntDir) + $(IntDir) + $(OutDir) + + + Level3 + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x040c + + + %(AdditionalDependencies) + $(OutDir)zlibwapi.dll + true + false + .\zlibvc.def + $(OutDir)zlibwapi.pdb + true + $(OutDir)zlibwapi.map + Windows + $(OutDir)zlibwapi.lib + + + + + + + + + + + + + + + + + + + + + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + + + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + ZLIB_INTERNAL;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc9/miniunz.vcproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc9/miniunz.vcproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc9/miniunz.vcproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc9/miniunz.vcproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc9/minizip.vcproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc9/minizip.vcproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc9/minizip.vcproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc9/minizip.vcproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc9/testzlib.vcproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc9/testzlib.vcproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc9/testzlib.vcproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc9/testzlib.vcproj diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc9/testzlibdll.vcproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc9/testzlibdll.vcproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc9/testzlibdll.vcproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc9/testzlibdll.vcproj diff --git a/src/zlib/zlib-1.3.1/contrib/vstudio/vc9/zlib.rc b/src/zlib/zlib-1.3.1/contrib/vstudio/vc9/zlib.rc new file mode 100644 index 000000000..856bd11f0 --- /dev/null +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc9/zlib.rc @@ -0,0 +1,32 @@ +#include + +#define IDR_VERSION1 1 +IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE + FILEVERSION 1, 3, 1, 0 + PRODUCTVERSION 1, 3, 1, 0 + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + FILEFLAGS 0 + FILEOS VOS_DOS_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE 0 // not used +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + //language ID = U.S. English, char set = Windows, Multilingual + + BEGIN + VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" + VALUE "FileVersion", "1.3.1\0" + VALUE "InternalName", "zlib\0" + VALUE "OriginalFilename", "zlibwapi.dll\0" + VALUE "ProductName", "ZLib.DLL\0" + VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" + VALUE "LegalCopyright", "(C) 1995-2024 Jean-loup Gailly & Mark Adler\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 1252 + END +END diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc9/zlibstat.vcproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc9/zlibstat.vcproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc9/zlibstat.vcproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc9/zlibstat.vcproj diff --git a/src/zlib/zlib-1.3.1/contrib/vstudio/vc9/zlibvc.def b/src/zlib/zlib-1.3.1/contrib/vstudio/vc9/zlibvc.def new file mode 100644 index 000000000..3234a02d9 --- /dev/null +++ b/src/zlib/zlib-1.3.1/contrib/vstudio/vc9/zlibvc.def @@ -0,0 +1,158 @@ +LIBRARY +; zlib data compression and ZIP file I/O library + +VERSION 1.3.1 + +EXPORTS + adler32 @1 + compress @2 + crc32 @3 + deflate @4 + deflateCopy @5 + deflateEnd @6 + deflateInit2_ @7 + deflateInit_ @8 + deflateParams @9 + deflateReset @10 + deflateSetDictionary @11 + gzclose @12 + gzdopen @13 + gzerror @14 + gzflush @15 + gzopen @16 + gzread @17 + gzwrite @18 + inflate @19 + inflateEnd @20 + inflateInit2_ @21 + inflateInit_ @22 + inflateReset @23 + inflateSetDictionary @24 + inflateSync @25 + uncompress @26 + zlibVersion @27 + gzprintf @28 + gzputc @29 + gzgetc @30 + gzseek @31 + gzrewind @32 + gztell @33 + gzeof @34 + gzsetparams @35 + zError @36 + inflateSyncPoint @37 + get_crc_table @38 + compress2 @39 + gzputs @40 + gzgets @41 + inflateCopy @42 + inflateBackInit_ @43 + inflateBack @44 + inflateBackEnd @45 + compressBound @46 + deflateBound @47 + gzclearerr @48 + gzungetc @49 + zlibCompileFlags @50 + deflatePrime @51 + deflatePending @52 + + unzOpen @61 + unzClose @62 + unzGetGlobalInfo @63 + unzGetCurrentFileInfo @64 + unzGoToFirstFile @65 + unzGoToNextFile @66 + unzOpenCurrentFile @67 + unzReadCurrentFile @68 + unzOpenCurrentFile3 @69 + unztell @70 + unzeof @71 + unzCloseCurrentFile @72 + unzGetGlobalComment @73 + unzStringFileNameCompare @74 + unzLocateFile @75 + unzGetLocalExtrafield @76 + unzOpen2 @77 + unzOpenCurrentFile2 @78 + unzOpenCurrentFilePassword @79 + + zipOpen @80 + zipOpenNewFileInZip @81 + zipWriteInFileInZip @82 + zipCloseFileInZip @83 + zipClose @84 + zipOpenNewFileInZip2 @86 + zipCloseFileInZipRaw @87 + zipOpen2 @88 + zipOpenNewFileInZip3 @89 + + unzGetFilePos @100 + unzGoToFilePos @101 + + fill_win32_filefunc @110 + +; zlibwapi v1.2.4 added: + fill_win32_filefunc64 @111 + fill_win32_filefunc64A @112 + fill_win32_filefunc64W @113 + + unzOpen64 @120 + unzOpen2_64 @121 + unzGetGlobalInfo64 @122 + unzGetCurrentFileInfo64 @124 + unzGetCurrentFileZStreamPos64 @125 + unztell64 @126 + unzGetFilePos64 @127 + unzGoToFilePos64 @128 + + zipOpen64 @130 + zipOpen2_64 @131 + zipOpenNewFileInZip64 @132 + zipOpenNewFileInZip2_64 @133 + zipOpenNewFileInZip3_64 @134 + zipOpenNewFileInZip4_64 @135 + zipCloseFileInZipRaw64 @136 + +; zlib1 v1.2.4 added: + adler32_combine @140 + crc32_combine @142 + deflateSetHeader @144 + deflateTune @145 + gzbuffer @146 + gzclose_r @147 + gzclose_w @148 + gzdirect @149 + gzoffset @150 + inflateGetHeader @156 + inflateMark @157 + inflatePrime @158 + inflateReset2 @159 + inflateUndermine @160 + +; zlib1 v1.2.6 added: + gzgetc_ @161 + inflateResetKeep @163 + deflateResetKeep @164 + +; zlib1 v1.2.7 added: + gzopen_w @165 + +; zlib1 v1.2.8 added: + inflateGetDictionary @166 + gzvprintf @167 + +; zlib1 v1.2.9 added: + inflateCodesUsed @168 + inflateValidate @169 + uncompress2 @170 + gzfread @171 + gzfwrite @172 + deflateGetDictionary @173 + adler32_z @174 + crc32_z @175 + +; zlib1 v1.2.12 added: + crc32_combine_gen @176 + crc32_combine_gen64 @177 + crc32_combine_op @178 diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc9/zlibvc.sln b/src/zlib/zlib-1.3.1/contrib/vstudio/vc9/zlibvc.sln similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc9/zlibvc.sln rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc9/zlibvc.sln diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc9/zlibvc.vcproj b/src/zlib/zlib-1.3.1/contrib/vstudio/vc9/zlibvc.vcproj similarity index 100% rename from src/zlib/zlib-1.3/contrib/vstudio/vc9/zlibvc.vcproj rename to src/zlib/zlib-1.3.1/contrib/vstudio/vc9/zlibvc.vcproj diff --git a/src/zlib/zlib-1.3/crc32.c b/src/zlib/zlib-1.3.1/crc32.c similarity index 100% rename from src/zlib/zlib-1.3/crc32.c rename to src/zlib/zlib-1.3.1/crc32.c diff --git a/src/zlib/zlib-1.3/crc32.h b/src/zlib/zlib-1.3.1/crc32.h similarity index 100% rename from src/zlib/zlib-1.3/crc32.h rename to src/zlib/zlib-1.3.1/crc32.h diff --git a/src/zlib/zlib-1.3/deflate.c b/src/zlib/zlib-1.3.1/deflate.c similarity index 98% rename from src/zlib/zlib-1.3/deflate.c rename to src/zlib/zlib-1.3.1/deflate.c index bd0117519..012ea8148 100644 --- a/src/zlib/zlib-1.3/deflate.c +++ b/src/zlib/zlib-1.3.1/deflate.c @@ -1,5 +1,5 @@ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -52,7 +52,7 @@ #include "deflate.h" const char deflate_copyright[] = - " deflate 1.3 Copyright 1995-2023 Jean-loup Gailly and Mark Adler "; + " deflate 1.3.1 Copyright 1995-2024 Jean-loup Gailly and Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -493,7 +493,7 @@ int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, * symbols from which it is being constructed. */ - s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4); + s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS); s->pending_buf_size = (ulg)s->lit_bufsize * 4; if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || @@ -503,8 +503,14 @@ int ZEXPORT deflateInit2_(z_streamp strm, int level, int method, deflateEnd (strm); return Z_MEM_ERROR; } +#ifdef LIT_MEM + s->d_buf = (ushf *)(s->pending_buf + (s->lit_bufsize << 1)); + s->l_buf = s->pending_buf + (s->lit_bufsize << 2); + s->sym_end = s->lit_bufsize - 1; +#else s->sym_buf = s->pending_buf + s->lit_bufsize; s->sym_end = (s->lit_bufsize - 1) * 3; +#endif /* We avoid equality with lit_bufsize*3 because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. @@ -720,9 +726,15 @@ int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) { if (deflateStateCheck(strm)) return Z_STREAM_ERROR; s = strm->state; +#ifdef LIT_MEM + if (bits < 0 || bits > 16 || + (uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3)) + return Z_BUF_ERROR; +#else if (bits < 0 || bits > 16 || s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3)) return Z_BUF_ERROR; +#endif do { put = Buf_size - s->bi_valid; if (put > bits) @@ -1294,7 +1306,7 @@ int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) { ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4); + ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS); if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || ds->pending_buf == Z_NULL) { @@ -1305,10 +1317,15 @@ int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) { zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos)); zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos)); - zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + zmemcpy(ds->pending_buf, ss->pending_buf, ds->lit_bufsize * LIT_BUFS); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); +#ifdef LIT_MEM + ds->d_buf = (ushf *)(ds->pending_buf + (ds->lit_bufsize << 1)); + ds->l_buf = ds->pending_buf + (ds->lit_bufsize << 2); +#else ds->sym_buf = ds->pending_buf + ds->lit_bufsize; +#endif ds->l_desc.dyn_tree = ds->dyn_ltree; ds->d_desc.dyn_tree = ds->dyn_dtree; @@ -1539,13 +1556,21 @@ local uInt longest_match(deflate_state *s, IPos cur_match) { */ local void check_match(deflate_state *s, IPos start, IPos match, int length) { /* check that the match is indeed a match */ - if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { - fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); + Bytef *back = s->window + (int)match, *here = s->window + start; + IPos len = length; + if (match == (IPos)-1) { + /* match starts one byte before the current window -- just compare the + subsequent length-1 bytes */ + back++; + here++; + len--; + } + if (zmemcmp(back, here, len) != EQUAL) { + fprintf(stderr, " start %u, match %d, length %d\n", + start, (int)match, length); do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); + fprintf(stderr, "(%02x %02x)", *back++, *here++); + } while (--len != 0); z_error("invalid match"); } if (z_verbose > 1) { diff --git a/src/zlib/zlib-1.3/deflate.h b/src/zlib/zlib-1.3.1/deflate.h similarity index 92% rename from src/zlib/zlib-1.3/deflate.h rename to src/zlib/zlib-1.3.1/deflate.h index 869679142..300c6ada6 100644 --- a/src/zlib/zlib-1.3/deflate.h +++ b/src/zlib/zlib-1.3.1/deflate.h @@ -1,5 +1,5 @@ /* deflate.h -- internal compression state - * Copyright (C) 1995-2018 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -23,6 +23,10 @@ # define GZIP #endif +/* define LIT_MEM to slightly increase the speed of deflate (order 1% to 2%) at + the cost of a larger memory footprint */ +/* #define LIT_MEM */ + /* =========================================================================== * Internal compression state. */ @@ -217,7 +221,14 @@ typedef struct internal_state { /* Depth of each subtree used as tie breaker for trees of equal frequency */ +#ifdef LIT_MEM +# define LIT_BUFS 5 + ushf *d_buf; /* buffer for distances */ + uchf *l_buf; /* buffer for literals/lengths */ +#else +# define LIT_BUFS 4 uchf *sym_buf; /* buffer for distances and literals/lengths */ +#endif uInt lit_bufsize; /* Size of match buffer for literals/lengths. There are 4 reasons for @@ -239,7 +250,7 @@ typedef struct internal_state { * - I can't count above 4 */ - uInt sym_next; /* running index in sym_buf */ + uInt sym_next; /* running index in symbol buffer */ uInt sym_end; /* symbol table full when sym_next reaches this */ ulg opt_len; /* bit length of current block with optimal trees */ @@ -318,6 +329,25 @@ void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf, extern const uch ZLIB_INTERNAL _dist_code[]; #endif +#ifdef LIT_MEM +# define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ + s->d_buf[s->sym_next] = 0; \ + s->l_buf[s->sym_next++] = cc; \ + s->dyn_ltree[cc].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +# define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (uch)(length); \ + ush dist = (ush)(distance); \ + s->d_buf[s->sym_next] = dist; \ + s->l_buf[s->sym_next++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ + flush = (s->sym_next == s->sym_end); \ + } +#else # define _tr_tally_lit(s, c, flush) \ { uch cc = (c); \ s->sym_buf[s->sym_next++] = 0; \ @@ -337,6 +367,7 @@ void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf, s->dyn_dtree[d_code(dist)].Freq++; \ flush = (s->sym_next == s->sym_end); \ } +#endif #else # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) # define _tr_tally_dist(s, distance, length, flush) \ diff --git a/src/zlib/zlib-1.3/doc/algorithm.txt b/src/zlib/zlib-1.3.1/doc/algorithm.txt similarity index 99% rename from src/zlib/zlib-1.3/doc/algorithm.txt rename to src/zlib/zlib-1.3.1/doc/algorithm.txt index c97f49502..029e5a313 100644 --- a/src/zlib/zlib-1.3/doc/algorithm.txt +++ b/src/zlib/zlib-1.3.1/doc/algorithm.txt @@ -77,7 +77,7 @@ table took no time (and if you had infinite memory), then there would only be a first level table to cover all the way to the longest code. However, building the table ends up taking a lot longer for more bits since short codes are replicated many times in such a table. What inflate() does is -simply to make the number of bits in the first table a variable, and then +simply to make the number of bits in the first table a variable, and then to set that variable for the maximum speed. For inflate, which has 286 possible codes for the literal/length tree, the size diff --git a/src/zlib/zlib-1.3/doc/crc-doc.1.0.pdf b/src/zlib/zlib-1.3.1/doc/crc-doc.1.0.pdf similarity index 100% rename from src/zlib/zlib-1.3/doc/crc-doc.1.0.pdf rename to src/zlib/zlib-1.3.1/doc/crc-doc.1.0.pdf diff --git a/src/zlib/zlib-1.3/doc/rfc1950.txt b/src/zlib/zlib-1.3.1/doc/rfc1950.txt similarity index 100% rename from src/zlib/zlib-1.3/doc/rfc1950.txt rename to src/zlib/zlib-1.3.1/doc/rfc1950.txt diff --git a/src/zlib/zlib-1.3/doc/rfc1951.txt b/src/zlib/zlib-1.3.1/doc/rfc1951.txt similarity index 100% rename from src/zlib/zlib-1.3/doc/rfc1951.txt rename to src/zlib/zlib-1.3.1/doc/rfc1951.txt diff --git a/src/zlib/zlib-1.3/doc/rfc1952.txt b/src/zlib/zlib-1.3.1/doc/rfc1952.txt similarity index 100% rename from src/zlib/zlib-1.3/doc/rfc1952.txt rename to src/zlib/zlib-1.3.1/doc/rfc1952.txt diff --git a/src/zlib/zlib-1.3/doc/txtvsbin.txt b/src/zlib/zlib-1.3.1/doc/txtvsbin.txt similarity index 100% rename from src/zlib/zlib-1.3/doc/txtvsbin.txt rename to src/zlib/zlib-1.3.1/doc/txtvsbin.txt diff --git a/src/zlib/zlib-1.3/examples/README.examples b/src/zlib/zlib-1.3.1/examples/README.examples similarity index 100% rename from src/zlib/zlib-1.3/examples/README.examples rename to src/zlib/zlib-1.3.1/examples/README.examples diff --git a/src/zlib/zlib-1.3/examples/enough.c b/src/zlib/zlib-1.3.1/examples/enough.c similarity index 100% rename from src/zlib/zlib-1.3/examples/enough.c rename to src/zlib/zlib-1.3.1/examples/enough.c diff --git a/src/zlib/zlib-1.3/examples/fitblk.c b/src/zlib/zlib-1.3.1/examples/fitblk.c similarity index 100% rename from src/zlib/zlib-1.3/examples/fitblk.c rename to src/zlib/zlib-1.3.1/examples/fitblk.c diff --git a/src/zlib/zlib-1.3/examples/gun.c b/src/zlib/zlib-1.3.1/examples/gun.c similarity index 100% rename from src/zlib/zlib-1.3/examples/gun.c rename to src/zlib/zlib-1.3.1/examples/gun.c diff --git a/src/zlib/zlib-1.3/examples/gzappend.c b/src/zlib/zlib-1.3.1/examples/gzappend.c similarity index 100% rename from src/zlib/zlib-1.3/examples/gzappend.c rename to src/zlib/zlib-1.3.1/examples/gzappend.c diff --git a/src/zlib/zlib-1.3/examples/gzjoin.c b/src/zlib/zlib-1.3.1/examples/gzjoin.c similarity index 100% rename from src/zlib/zlib-1.3/examples/gzjoin.c rename to src/zlib/zlib-1.3.1/examples/gzjoin.c diff --git a/src/zlib/zlib-1.3/examples/gzlog.c b/src/zlib/zlib-1.3.1/examples/gzlog.c similarity index 99% rename from src/zlib/zlib-1.3/examples/gzlog.c rename to src/zlib/zlib-1.3.1/examples/gzlog.c index b977802dd..da1b02e73 100644 --- a/src/zlib/zlib-1.3/examples/gzlog.c +++ b/src/zlib/zlib-1.3.1/examples/gzlog.c @@ -212,8 +212,8 @@ to the appropriate recovery below. If there is no foo.add file, provide a zero data length to the recovery. In that case, the append recovery restores the foo.gz to the previous compressed + uncompressed data state. - For the the compress recovery, a missing foo.add file results in foo.gz - being restored to the previous compressed-only data state. + For the compress recovery, a missing foo.add file results in foo.gz being + restored to the previous compressed-only data state. - Append recovery: - Pick up append at + step above - Compress recovery: diff --git a/src/zlib/zlib-1.3/examples/gzlog.h b/src/zlib/zlib-1.3.1/examples/gzlog.h similarity index 100% rename from src/zlib/zlib-1.3/examples/gzlog.h rename to src/zlib/zlib-1.3.1/examples/gzlog.h diff --git a/src/zlib/zlib-1.3/examples/gznorm.c b/src/zlib/zlib-1.3.1/examples/gznorm.c similarity index 100% rename from src/zlib/zlib-1.3/examples/gznorm.c rename to src/zlib/zlib-1.3.1/examples/gznorm.c diff --git a/src/zlib/zlib-1.3/examples/zlib_how.html b/src/zlib/zlib-1.3.1/examples/zlib_how.html similarity index 100% rename from src/zlib/zlib-1.3/examples/zlib_how.html rename to src/zlib/zlib-1.3.1/examples/zlib_how.html diff --git a/src/zlib/zlib-1.3/examples/zpipe.c b/src/zlib/zlib-1.3.1/examples/zpipe.c similarity index 100% rename from src/zlib/zlib-1.3/examples/zpipe.c rename to src/zlib/zlib-1.3.1/examples/zpipe.c diff --git a/src/zlib/zlib-1.3/examples/zran.c b/src/zlib/zlib-1.3.1/examples/zran.c similarity index 99% rename from src/zlib/zlib-1.3/examples/zran.c rename to src/zlib/zlib-1.3.1/examples/zran.c index 32c93686c..d3135955b 100644 --- a/src/zlib/zlib-1.3/examples/zran.c +++ b/src/zlib/zlib-1.3.1/examples/zran.c @@ -267,7 +267,7 @@ static inline void append_bits(unsigned value, int bits, } } -// Insert enough bits in the form of empty deflate blocks in front of the the +// Insert enough bits in the form of empty deflate blocks in front of the // low bits bits of value, in order to bring the sequence to a byte boundary. // Then feed that to inflate(). This does what inflatePrime() does, except that // a negative value of bits is not supported. bits must be in 0..16. If the diff --git a/src/zlib/zlib-1.3/examples/zran.h b/src/zlib/zlib-1.3.1/examples/zran.h similarity index 100% rename from src/zlib/zlib-1.3/examples/zran.h rename to src/zlib/zlib-1.3.1/examples/zran.h diff --git a/src/zlib/zlib-1.3/gzclose.c b/src/zlib/zlib-1.3.1/gzclose.c similarity index 100% rename from src/zlib/zlib-1.3/gzclose.c rename to src/zlib/zlib-1.3.1/gzclose.c diff --git a/src/zlib/zlib-1.3/gzguts.h b/src/zlib/zlib-1.3.1/gzguts.h similarity index 96% rename from src/zlib/zlib-1.3/gzguts.h rename to src/zlib/zlib-1.3.1/gzguts.h index f9375047e..eba72085b 100644 --- a/src/zlib/zlib-1.3/gzguts.h +++ b/src/zlib/zlib-1.3.1/gzguts.h @@ -1,5 +1,5 @@ /* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -210,9 +210,5 @@ char ZLIB_INTERNAL *gz_strwinerror(DWORD error); /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t value -- needed when comparing unsigned to z_off64_t, which is signed (possible z_off64_t types off_t, off64_t, and long are all signed) */ -#ifdef INT_MAX -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) -#else unsigned ZLIB_INTERNAL gz_intmax(void); -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) -#endif +#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) diff --git a/src/zlib/zlib-1.3/gzlib.c b/src/zlib/zlib-1.3.1/gzlib.c similarity index 99% rename from src/zlib/zlib-1.3/gzlib.c rename to src/zlib/zlib-1.3.1/gzlib.c index 29fc4486f..983153cc8 100644 --- a/src/zlib/zlib-1.3/gzlib.c +++ b/src/zlib/zlib-1.3.1/gzlib.c @@ -1,5 +1,5 @@ /* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004-2019 Mark Adler + * Copyright (C) 2004-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -563,20 +563,20 @@ void ZLIB_INTERNAL gz_error(gz_statep state, int err, const char *msg) { #endif } -#ifndef INT_MAX /* portably return maximum value for an int (when limits.h presumed not available) -- we need to do this to cover cases where 2's complement not used, since C standard permits 1's complement and sign-bit representations, otherwise we could just use ((unsigned)-1) >> 1 */ unsigned ZLIB_INTERNAL gz_intmax(void) { - unsigned p, q; - - p = 1; +#ifdef INT_MAX + return INT_MAX; +#else + unsigned p = 1, q; do { q = p; p <<= 1; p++; } while (p > q); return q >> 1; -} #endif +} diff --git a/src/zlib/zlib-1.3/gzread.c b/src/zlib/zlib-1.3.1/gzread.c similarity index 100% rename from src/zlib/zlib-1.3/gzread.c rename to src/zlib/zlib-1.3.1/gzread.c diff --git a/src/zlib/zlib-1.3/gzwrite.c b/src/zlib/zlib-1.3.1/gzwrite.c similarity index 100% rename from src/zlib/zlib-1.3/gzwrite.c rename to src/zlib/zlib-1.3.1/gzwrite.c diff --git a/src/zlib/zlib-1.3/infback.c b/src/zlib/zlib-1.3.1/infback.c similarity index 100% rename from src/zlib/zlib-1.3/infback.c rename to src/zlib/zlib-1.3.1/infback.c diff --git a/src/zlib/zlib-1.3/inffast.c b/src/zlib/zlib-1.3.1/inffast.c similarity index 100% rename from src/zlib/zlib-1.3/inffast.c rename to src/zlib/zlib-1.3.1/inffast.c diff --git a/src/zlib/zlib-1.3/inffast.h b/src/zlib/zlib-1.3.1/inffast.h similarity index 100% rename from src/zlib/zlib-1.3/inffast.h rename to src/zlib/zlib-1.3.1/inffast.h diff --git a/src/zlib/zlib-1.3/inffixed.h b/src/zlib/zlib-1.3.1/inffixed.h similarity index 100% rename from src/zlib/zlib-1.3/inffixed.h rename to src/zlib/zlib-1.3.1/inffixed.h diff --git a/src/zlib/zlib-1.3/inflate.c b/src/zlib/zlib-1.3.1/inflate.c similarity index 99% rename from src/zlib/zlib-1.3/inflate.c rename to src/zlib/zlib-1.3.1/inflate.c index b0757a9b2..94ecff015 100644 --- a/src/zlib/zlib-1.3/inflate.c +++ b/src/zlib/zlib-1.3.1/inflate.c @@ -1387,7 +1387,7 @@ int ZEXPORT inflateSync(z_streamp strm) { /* if first time, start search in bit buffer */ if (state->mode != SYNC) { state->mode = SYNC; - state->hold <<= state->bits & 7; + state->hold >>= state->bits & 7; state->bits -= state->bits & 7; len = 0; while (state->bits >= 8) { diff --git a/src/zlib/zlib-1.3/inflate.h b/src/zlib/zlib-1.3.1/inflate.h similarity index 100% rename from src/zlib/zlib-1.3/inflate.h rename to src/zlib/zlib-1.3.1/inflate.h diff --git a/src/zlib/zlib-1.3/inftrees.c b/src/zlib/zlib-1.3.1/inftrees.c similarity index 98% rename from src/zlib/zlib-1.3/inftrees.c rename to src/zlib/zlib-1.3.1/inftrees.c index 8a208c2da..98cfe1644 100644 --- a/src/zlib/zlib-1.3/inftrees.c +++ b/src/zlib/zlib-1.3.1/inftrees.c @@ -1,5 +1,5 @@ /* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2023 Mark Adler + * Copyright (C) 1995-2024 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -9,7 +9,7 @@ #define MAXBITS 15 const char inflate_copyright[] = - " inflate 1.3 Copyright 1995-2023 Mark Adler "; + " inflate 1.3.1 Copyright 1995-2024 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot @@ -57,7 +57,7 @@ int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 198, 203}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 77}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, diff --git a/src/zlib/zlib-1.3/inftrees.h b/src/zlib/zlib-1.3.1/inftrees.h similarity index 94% rename from src/zlib/zlib-1.3/inftrees.h rename to src/zlib/zlib-1.3.1/inftrees.h index a10712d8c..396f74b5d 100644 --- a/src/zlib/zlib-1.3/inftrees.h +++ b/src/zlib/zlib-1.3.1/inftrees.h @@ -41,8 +41,8 @@ typedef struct { examples/enough.c found in the zlib distribution. The arguments to that program are the number of symbols, the initial root table size, and the maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 30 6 15" for distance codes returns 592. - The initial root table size (9 or 6) is found in the fifth argument of the + returns 852, and "enough 30 6 15" for distance codes returns 592. The + initial root table size (9 or 6) is found in the fifth argument of the inflate_table() calls in inflate.c and infback.c. If the root table size is changed, then these maximum sizes would be need to be recalculated and updated. */ diff --git a/src/zlib/zlib-1.3/make_vms.com b/src/zlib/zlib-1.3.1/make_vms.com similarity index 100% rename from src/zlib/zlib-1.3/make_vms.com rename to src/zlib/zlib-1.3.1/make_vms.com diff --git a/src/zlib/zlib-1.3/msdos/Makefile.bor b/src/zlib/zlib-1.3.1/msdos/Makefile.bor similarity index 100% rename from src/zlib/zlib-1.3/msdos/Makefile.bor rename to src/zlib/zlib-1.3.1/msdos/Makefile.bor diff --git a/src/zlib/zlib-1.3/msdos/Makefile.dj2 b/src/zlib/zlib-1.3.1/msdos/Makefile.dj2 similarity index 100% rename from src/zlib/zlib-1.3/msdos/Makefile.dj2 rename to src/zlib/zlib-1.3.1/msdos/Makefile.dj2 diff --git a/src/zlib/zlib-1.3/msdos/Makefile.emx b/src/zlib/zlib-1.3.1/msdos/Makefile.emx similarity index 100% rename from src/zlib/zlib-1.3/msdos/Makefile.emx rename to src/zlib/zlib-1.3.1/msdos/Makefile.emx diff --git a/src/zlib/zlib-1.3/msdos/Makefile.msc b/src/zlib/zlib-1.3.1/msdos/Makefile.msc similarity index 100% rename from src/zlib/zlib-1.3/msdos/Makefile.msc rename to src/zlib/zlib-1.3.1/msdos/Makefile.msc diff --git a/src/zlib/zlib-1.3/msdos/Makefile.tc b/src/zlib/zlib-1.3.1/msdos/Makefile.tc similarity index 100% rename from src/zlib/zlib-1.3/msdos/Makefile.tc rename to src/zlib/zlib-1.3.1/msdos/Makefile.tc diff --git a/src/zlib/zlib-1.3/nintendods/Makefile b/src/zlib/zlib-1.3.1/nintendods/Makefile similarity index 100% rename from src/zlib/zlib-1.3/nintendods/Makefile rename to src/zlib/zlib-1.3.1/nintendods/Makefile diff --git a/src/zlib/zlib-1.3/nintendods/README b/src/zlib/zlib-1.3.1/nintendods/README similarity index 100% rename from src/zlib/zlib-1.3/nintendods/README rename to src/zlib/zlib-1.3.1/nintendods/README diff --git a/src/zlib/zlib-1.3/old/Makefile.emx b/src/zlib/zlib-1.3.1/old/Makefile.emx similarity index 100% rename from src/zlib/zlib-1.3/old/Makefile.emx rename to src/zlib/zlib-1.3.1/old/Makefile.emx diff --git a/src/zlib/zlib-1.3/old/Makefile.riscos b/src/zlib/zlib-1.3.1/old/Makefile.riscos similarity index 100% rename from src/zlib/zlib-1.3/old/Makefile.riscos rename to src/zlib/zlib-1.3.1/old/Makefile.riscos diff --git a/src/zlib/zlib-1.3/old/README b/src/zlib/zlib-1.3.1/old/README similarity index 100% rename from src/zlib/zlib-1.3/old/README rename to src/zlib/zlib-1.3.1/old/README diff --git a/src/zlib/zlib-1.3/old/descrip.mms b/src/zlib/zlib-1.3.1/old/descrip.mms similarity index 100% rename from src/zlib/zlib-1.3/old/descrip.mms rename to src/zlib/zlib-1.3.1/old/descrip.mms diff --git a/src/zlib/zlib-1.3/old/os2/Makefile.os2 b/src/zlib/zlib-1.3.1/old/os2/Makefile.os2 similarity index 100% rename from src/zlib/zlib-1.3/old/os2/Makefile.os2 rename to src/zlib/zlib-1.3.1/old/os2/Makefile.os2 diff --git a/src/zlib/zlib-1.3/old/os2/zlib.def b/src/zlib/zlib-1.3.1/old/os2/zlib.def similarity index 100% rename from src/zlib/zlib-1.3/old/os2/zlib.def rename to src/zlib/zlib-1.3.1/old/os2/zlib.def diff --git a/src/zlib/zlib-1.3/old/visual-basic.txt b/src/zlib/zlib-1.3.1/old/visual-basic.txt similarity index 98% rename from src/zlib/zlib-1.3/old/visual-basic.txt rename to src/zlib/zlib-1.3.1/old/visual-basic.txt index 57efe5812..3c8d2a42d 100644 --- a/src/zlib/zlib-1.3/old/visual-basic.txt +++ b/src/zlib/zlib-1.3.1/old/visual-basic.txt @@ -115,7 +115,7 @@ SUCCESS Then ReDim Preserve bytaryCpr(lngCprSiz - 1) Open strCprPth For Binary Access Write As #1 Put #1, , bytaryCpr() - Put #1, , lngOriSiz 'Add the the original size value to the end + Put #1, , lngOriSiz 'Add the original size value to the end (last 4 bytes) Close #1 Else diff --git a/src/zlib/zlib-1.3/os400/README400 b/src/zlib/zlib-1.3.1/os400/README400 similarity index 96% rename from src/zlib/zlib-1.3/os400/README400 rename to src/zlib/zlib-1.3.1/os400/README400 index 6dd41aa65..30ed5a12c 100644 --- a/src/zlib/zlib-1.3/os400/README400 +++ b/src/zlib/zlib-1.3.1/os400/README400 @@ -1,4 +1,4 @@ - ZLIB version 1.3.0 for OS/400 installation instructions + ZLIB version 1.3.1 for OS/400 installation instructions 1) Download and unpack the zlib tarball to some IFS directory. (i.e.: /path/to/the/zlib/ifs/source/directory) diff --git a/src/zlib/zlib-1.3/os400/bndsrc b/src/zlib/zlib-1.3.1/os400/bndsrc similarity index 100% rename from src/zlib/zlib-1.3/os400/bndsrc rename to src/zlib/zlib-1.3.1/os400/bndsrc diff --git a/src/zlib/zlib-1.3/os400/make.sh b/src/zlib/zlib-1.3.1/os400/make.sh similarity index 100% rename from src/zlib/zlib-1.3/os400/make.sh rename to src/zlib/zlib-1.3.1/os400/make.sh diff --git a/src/zlib/zlib-1.3/os400/zlib.inc b/src/zlib/zlib-1.3.1/os400/zlib.inc similarity index 99% rename from src/zlib/zlib-1.3/os400/zlib.inc rename to src/zlib/zlib-1.3.1/os400/zlib.inc index 0d9e2f209..744729ab9 100644 --- a/src/zlib/zlib-1.3/os400/zlib.inc +++ b/src/zlib/zlib-1.3.1/os400/zlib.inc @@ -1,7 +1,7 @@ * ZLIB.INC - Interface to the general purpose compression library * * ILE RPG400 version by Patrick Monnerat, DATASPHERE. - * Version 1.3.0 + * Version 1.3.1 * * * WARNING: @@ -22,12 +22,12 @@ * * Versioning information. * - D ZLIB_VERSION C '1.3.0' + D ZLIB_VERSION C '1.3.1' D ZLIB_VERNUM C X'12a0' D ZLIB_VER_MAJOR C 1 D ZLIB_VER_MINOR C 3 D ZLIB_VER_REVISION... - D C 0 + D C 1 D ZLIB_VER_SUBREVISION... D C 0 * diff --git a/src/zlib/zlib-1.3/qnx/package.qpg b/src/zlib/zlib-1.3.1/qnx/package.qpg similarity index 95% rename from src/zlib/zlib-1.3/qnx/package.qpg rename to src/zlib/zlib-1.3.1/qnx/package.qpg index d882af2bf..4877e0ef0 100644 --- a/src/zlib/zlib-1.3/qnx/package.qpg +++ b/src/zlib/zlib-1.3.1/qnx/package.qpg @@ -25,10 +25,10 @@ - - - - + + + + @@ -63,7 +63,7 @@ - 1.3.0 + 1.3.1 Medium Stable diff --git a/src/zlib/zlib-1.3/test/example.c b/src/zlib/zlib-1.3.1/test/example.c similarity index 94% rename from src/zlib/zlib-1.3/test/example.c rename to src/zlib/zlib-1.3.1/test/example.c index 582a17a3c..c3521dd59 100644 --- a/src/zlib/zlib-1.3/test/example.c +++ b/src/zlib/zlib-1.3.1/test/example.c @@ -36,12 +36,12 @@ static uLong dictId; /* Adler32 value of the dictionary */ #ifdef Z_SOLO -void *myalloc(void *q, unsigned n, unsigned m) { +static void *myalloc(void *q, unsigned n, unsigned m) { (void)q; return calloc(n, m); } -void myfree(void *q, void *p) { +static void myfree(void *q, void *p) { (void)q; free(p); } @@ -57,7 +57,7 @@ static free_func zfree = (free_func)0; /* =========================================================================== * Test compress() and uncompress() */ -void test_compress(Byte *compr, uLong comprLen, Byte *uncompr, +static void test_compress(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen) { int err; uLong len = (uLong)strlen(hello)+1; @@ -81,7 +81,7 @@ void test_compress(Byte *compr, uLong comprLen, Byte *uncompr, /* =========================================================================== * Test read/write of .gz files */ -void test_gzio(const char *fname, Byte *uncompr, uLong uncomprLen) { +static void test_gzio(const char *fname, Byte *uncompr, uLong uncomprLen) { #ifdef NO_GZCOMPRESS fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n"); #else @@ -163,7 +163,7 @@ void test_gzio(const char *fname, Byte *uncompr, uLong uncomprLen) { /* =========================================================================== * Test deflate() with small buffers */ -void test_deflate(Byte *compr, uLong comprLen) { +static void test_deflate(Byte *compr, uLong comprLen) { z_stream c_stream; /* compression stream */ int err; uLong len = (uLong)strlen(hello)+1; @@ -198,7 +198,7 @@ void test_deflate(Byte *compr, uLong comprLen) { /* =========================================================================== * Test inflate() with small buffers */ -void test_inflate(Byte *compr, uLong comprLen, Byte *uncompr, +static void test_inflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen) { int err; z_stream d_stream; /* decompression stream */ @@ -237,7 +237,7 @@ void test_inflate(Byte *compr, uLong comprLen, Byte *uncompr, /* =========================================================================== * Test deflate() with large buffers and dynamic change of compression level */ -void test_large_deflate(Byte *compr, uLong comprLen, Byte *uncompr, +static void test_large_deflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen) { z_stream c_stream; /* compression stream */ int err; @@ -290,7 +290,7 @@ void test_large_deflate(Byte *compr, uLong comprLen, Byte *uncompr, /* =========================================================================== * Test inflate() with large buffers */ -void test_large_inflate(Byte *compr, uLong comprLen, Byte *uncompr, +static void test_large_inflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen) { int err; z_stream d_stream; /* decompression stream */ @@ -329,7 +329,7 @@ void test_large_inflate(Byte *compr, uLong comprLen, Byte *uncompr, /* =========================================================================== * Test deflate() with full flush */ -void test_flush(Byte *compr, uLong *comprLen) { +static void test_flush(Byte *compr, uLong *comprLen) { z_stream c_stream; /* compression stream */ int err; uInt len = (uInt)strlen(hello)+1; @@ -364,7 +364,8 @@ void test_flush(Byte *compr, uLong *comprLen) { /* =========================================================================== * Test inflateSync() */ -void test_sync(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen) { +static void test_sync(Byte *compr, uLong comprLen, Byte *uncompr, + uLong uncomprLen) { int err; z_stream d_stream; /* decompression stream */ @@ -404,7 +405,7 @@ void test_sync(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen) { /* =========================================================================== * Test deflate() with preset dictionary */ -void test_dict_deflate(Byte *compr, uLong comprLen) { +static void test_dict_deflate(Byte *compr, uLong comprLen) { z_stream c_stream; /* compression stream */ int err; @@ -438,7 +439,7 @@ void test_dict_deflate(Byte *compr, uLong comprLen) { /* =========================================================================== * Test inflate() with a preset dictionary */ -void test_dict_inflate(Byte *compr, uLong comprLen, Byte *uncompr, +static void test_dict_inflate(Byte *compr, uLong comprLen, Byte *uncompr, uLong uncomprLen) { int err; z_stream d_stream; /* decompression stream */ diff --git a/src/zlib/zlib-1.3/test/infcover.c b/src/zlib/zlib-1.3.1/test/infcover.c similarity index 100% rename from src/zlib/zlib-1.3/test/infcover.c rename to src/zlib/zlib-1.3.1/test/infcover.c diff --git a/src/zlib/zlib-1.3/test/minigzip.c b/src/zlib/zlib-1.3.1/test/minigzip.c similarity index 94% rename from src/zlib/zlib-1.3/test/minigzip.c rename to src/zlib/zlib-1.3.1/test/minigzip.c index 8a21ddfb5..134e10e6c 100644 --- a/src/zlib/zlib-1.3/test/minigzip.c +++ b/src/zlib/zlib-1.3.1/test/minigzip.c @@ -149,12 +149,12 @@ static void pwinerror (s) # include /* for unlink() */ #endif -void *myalloc(void *q, unsigned n, unsigned m) { +static void *myalloc(void *q, unsigned n, unsigned m) { (void)q; return calloc(n, m); } -void myfree(void *q, void *p) { +static void myfree(void *q, void *p) { (void)q; free(p); } @@ -167,7 +167,7 @@ typedef struct gzFile_s { z_stream strm; } *gzFile; -gzFile gz_open(const char *path, int fd, const char *mode) { +static gzFile gz_open(const char *path, int fd, const char *mode) { gzFile gz; int ret; @@ -201,15 +201,15 @@ gzFile gz_open(const char *path, int fd, const char *mode) { return gz; } -gzFile gzopen(const char *path, const char *mode) { +static gzFile gzopen(const char *path, const char *mode) { return gz_open(path, -1, mode); } -gzFile gzdopen(int fd, const char *mode) { +static gzFile gzdopen(int fd, const char *mode) { return gz_open(NULL, fd, mode); } -int gzwrite(gzFile gz, const void *buf, unsigned len) { +static int gzwrite(gzFile gz, const void *buf, unsigned len) { z_stream *strm; unsigned char out[BUFLEN]; @@ -227,7 +227,7 @@ int gzwrite(gzFile gz, const void *buf, unsigned len) { return len; } -int gzread(gzFile gz, void *buf, unsigned len) { +static int gzread(gzFile gz, void *buf, unsigned len) { int ret; unsigned got; unsigned char in[1]; @@ -258,7 +258,7 @@ int gzread(gzFile gz, void *buf, unsigned len) { return len - strm->avail_out; } -int gzclose(gzFile gz) { +static int gzclose(gzFile gz) { z_stream *strm; unsigned char out[BUFLEN]; @@ -283,7 +283,7 @@ int gzclose(gzFile gz) { return Z_OK; } -const char *gzerror(gzFile gz, int *err) { +static const char *gzerror(gzFile gz, int *err) { *err = gz->err; return gz->msg; } @@ -295,7 +295,7 @@ static char *prog; /* =========================================================================== * Display error message and exit */ -void error(const char *msg) { +static void error(const char *msg) { fprintf(stderr, "%s: %s\n", prog, msg); exit(1); } @@ -303,9 +303,9 @@ void error(const char *msg) { #ifdef USE_MMAP /* MMAP version, Miguel Albrecht */ /* Try compressing the input file at once using mmap. Return Z_OK if - * if success, Z_ERRNO otherwise. + * success, Z_ERRNO otherwise. */ -int gz_compress_mmap(FILE *in, gzFile out) { +static int gz_compress_mmap(FILE *in, gzFile out) { int len; int err; int ifd = fileno(in); @@ -338,7 +338,7 @@ int gz_compress_mmap(FILE *in, gzFile out) { * Compress input to output then close both files. */ -void gz_compress(FILE *in, gzFile out) { +static void gz_compress(FILE *in, gzFile out) { local char buf[BUFLEN]; int len; int err; @@ -366,7 +366,7 @@ void gz_compress(FILE *in, gzFile out) { /* =========================================================================== * Uncompress input to output then close both files. */ -void gz_uncompress(gzFile in, FILE *out) { +static void gz_uncompress(gzFile in, FILE *out) { local char buf[BUFLEN]; int len; int err; @@ -390,7 +390,7 @@ void gz_uncompress(gzFile in, FILE *out) { * Compress the given file: create a corresponding .gz file and remove the * original. */ -void file_compress(char *file, char *mode) { +static void file_compress(char *file, char *mode) { local char outfile[MAX_NAME_LEN]; FILE *in; gzFile out; @@ -426,7 +426,7 @@ void file_compress(char *file, char *mode) { /* =========================================================================== * Uncompress the given file and remove the original. */ -void file_uncompress(char *file) { +static void file_uncompress(char *file) { local char buf[MAX_NAME_LEN]; char *infile, *outfile; FILE *out; diff --git a/src/zlib/zlib-1.3/treebuild.xml b/src/zlib/zlib-1.3.1/treebuild.xml similarity index 97% rename from src/zlib/zlib-1.3/treebuild.xml rename to src/zlib/zlib-1.3.1/treebuild.xml index 1d1b00770..930b00be4 100644 --- a/src/zlib/zlib-1.3/treebuild.xml +++ b/src/zlib/zlib-1.3.1/treebuild.xml @@ -1,6 +1,6 @@ - - + + zip compression library diff --git a/src/zlib/zlib-1.3/trees.c b/src/zlib/zlib-1.3.1/trees.c similarity index 98% rename from src/zlib/zlib-1.3/trees.c rename to src/zlib/zlib-1.3.1/trees.c index 8dbdc40ba..6a523ef34 100644 --- a/src/zlib/zlib-1.3/trees.c +++ b/src/zlib/zlib-1.3.1/trees.c @@ -1,5 +1,5 @@ /* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2021 Jean-loup Gailly + * Copyright (C) 1995-2024 Jean-loup Gailly * detect_data_type() function provided freely by Cosmin Truta, 2006 * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -899,14 +899,19 @@ local void compress_block(deflate_state *s, const ct_data *ltree, const ct_data *dtree) { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ - unsigned sx = 0; /* running index in sym_buf */ + unsigned sx = 0; /* running index in symbol buffers */ unsigned code; /* the code to send */ int extra; /* number of extra bits to send */ if (s->sym_next != 0) do { +#ifdef LIT_MEM + dist = s->d_buf[sx]; + lc = s->l_buf[sx++]; +#else dist = s->sym_buf[sx++] & 0xff; dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8; lc = s->sym_buf[sx++]; +#endif if (dist == 0) { send_code(s, lc, ltree); /* send a literal byte */ Tracecv(isgraph(lc), (stderr," '%c' ", lc)); @@ -931,8 +936,12 @@ local void compress_block(deflate_state *s, const ct_data *ltree, } } /* literal or match pair ? */ - /* Check that the overlay between pending_buf and sym_buf is ok: */ + /* Check for no overlay of pending_buf on needed symbols */ +#ifdef LIT_MEM + Assert(s->pending < 2 * (s->lit_bufsize + sx), "pendingBuf overflow"); +#else Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow"); +#endif } while (sx < s->sym_next); @@ -1082,9 +1091,14 @@ void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf, * the current block must be flushed. */ int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc) { +#ifdef LIT_MEM + s->d_buf[s->sym_next] = (ush)dist; + s->l_buf[s->sym_next++] = (uch)lc; +#else s->sym_buf[s->sym_next++] = (uch)dist; s->sym_buf[s->sym_next++] = (uch)(dist >> 8); s->sym_buf[s->sym_next++] = (uch)lc; +#endif if (dist == 0) { /* lc is the unmatched char */ s->dyn_ltree[lc].Freq++; diff --git a/src/zlib/zlib-1.3/trees.h b/src/zlib/zlib-1.3.1/trees.h similarity index 100% rename from src/zlib/zlib-1.3/trees.h rename to src/zlib/zlib-1.3.1/trees.h diff --git a/src/zlib/zlib-1.3/uncompr.c b/src/zlib/zlib-1.3.1/uncompr.c similarity index 100% rename from src/zlib/zlib-1.3/uncompr.c rename to src/zlib/zlib-1.3.1/uncompr.c diff --git a/src/zlib/zlib-1.3/watcom/watcom_f.mak b/src/zlib/zlib-1.3.1/watcom/watcom_f.mak similarity index 100% rename from src/zlib/zlib-1.3/watcom/watcom_f.mak rename to src/zlib/zlib-1.3.1/watcom/watcom_f.mak diff --git a/src/zlib/zlib-1.3/watcom/watcom_l.mak b/src/zlib/zlib-1.3.1/watcom/watcom_l.mak similarity index 100% rename from src/zlib/zlib-1.3/watcom/watcom_l.mak rename to src/zlib/zlib-1.3.1/watcom/watcom_l.mak diff --git a/src/zlib/zlib-1.3/win32/DLL_FAQ.txt b/src/zlib/zlib-1.3.1/win32/DLL_FAQ.txt similarity index 95% rename from src/zlib/zlib-1.3/win32/DLL_FAQ.txt rename to src/zlib/zlib-1.3.1/win32/DLL_FAQ.txt index 12c009018..d8cf5f31e 100644 --- a/src/zlib/zlib-1.3/win32/DLL_FAQ.txt +++ b/src/zlib/zlib-1.3.1/win32/DLL_FAQ.txt @@ -3,7 +3,7 @@ This document describes the design, the rationale, and the usage -of the official DLL build of zlib, named ZLIB1.DLL. If you have +of the common DLL build of zlib, named ZLIB1.DLL. If you have general questions about zlib, you should see the file "FAQ" found in the zlib distribution, or at the following location: http://www.gzip.org/zlib/zlib_faq.html @@ -11,13 +11,9 @@ in the zlib distribution, or at the following location: 1. What is ZLIB1.DLL, and how can I get it? - - ZLIB1.DLL is the official build of zlib as a DLL. + - ZLIB1.DLL is the common build of zlib as a DLL. (Please remark the character '1' in the name.) - Pointers to a precompiled ZLIB1.DLL can be found in the zlib - web site at: - http://www.zlib.net/ - Applications that link to ZLIB1.DLL can rely on the following specification: @@ -379,18 +375,6 @@ in the zlib distribution, or at the following location: code. But you can make your own private DLL build, under a different file name, as suggested in the previous answer. - -17. I made my own ZLIB1.DLL build. Can I test it for compliance? - - - We prefer that you download the official DLL from the zlib - web site. If you need something peculiar from this DLL, you - can send your suggestion to the zlib mailing list. - - However, in case you do rebuild the DLL yourself, you can run - it with the test programs found in the DLL distribution. - Running these test programs is not a guarantee of compliance, - but a failure can imply a detected problem. - ** This document is written and maintained by diff --git a/src/zlib/zlib-1.3/win32/Makefile.bor b/src/zlib/zlib-1.3.1/win32/Makefile.bor similarity index 100% rename from src/zlib/zlib-1.3/win32/Makefile.bor rename to src/zlib/zlib-1.3.1/win32/Makefile.bor diff --git a/src/zlib/zlib-1.3/win32/Makefile.gcc b/src/zlib/zlib-1.3.1/win32/Makefile.gcc similarity index 100% rename from src/zlib/zlib-1.3/win32/Makefile.gcc rename to src/zlib/zlib-1.3.1/win32/Makefile.gcc diff --git a/src/zlib/zlib-1.3/win32/Makefile.msc b/src/zlib/zlib-1.3.1/win32/Makefile.msc similarity index 100% rename from src/zlib/zlib-1.3/win32/Makefile.msc rename to src/zlib/zlib-1.3.1/win32/Makefile.msc diff --git a/src/zlib/zlib-1.3/win32/README-WIN32.txt b/src/zlib/zlib-1.3.1/win32/README-WIN32.txt similarity index 95% rename from src/zlib/zlib-1.3/win32/README-WIN32.txt rename to src/zlib/zlib-1.3.1/win32/README-WIN32.txt index 384c988fa..14e6398ef 100644 --- a/src/zlib/zlib-1.3/win32/README-WIN32.txt +++ b/src/zlib/zlib-1.3.1/win32/README-WIN32.txt @@ -1,6 +1,6 @@ ZLIB DATA COMPRESSION LIBRARY -zlib 1.3.0 is a general purpose data compression library. All the code is +zlib 1.3.1 is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) @@ -16,13 +16,13 @@ is http://zlib.net/ . Before reporting a problem, please check this site to verify that you have the latest version of zlib; otherwise get the latest version and check whether the problem still exists or not. -PLEASE read DLL_FAQ.txt, and the the zlib FAQ http://zlib.net/zlib_faq.html -before asking for help. +PLEASE read DLL_FAQ.txt, and the zlib FAQ http://zlib.net/zlib_faq.html before +asking for help. Manifest: -The package zlib-1.3.0-win32-x86.zip will contain the following files: +The package zlib-1.3.1-win32-x86.zip will contain the following files: README-WIN32.txt This document ChangeLog Changes since previous zlib packages diff --git a/src/zlib/zlib-1.3/win32/VisualC.txt b/src/zlib/zlib-1.3.1/win32/VisualC.txt similarity index 100% rename from src/zlib/zlib-1.3/win32/VisualC.txt rename to src/zlib/zlib-1.3.1/win32/VisualC.txt diff --git a/src/zlib/zlib-1.3/win32/zlib.def b/src/zlib/zlib-1.3.1/win32/zlib.def similarity index 100% rename from src/zlib/zlib-1.3/win32/zlib.def rename to src/zlib/zlib-1.3.1/win32/zlib.def diff --git a/src/zlib/zlib-1.3/win32/zlib1.rc b/src/zlib/zlib-1.3.1/win32/zlib1.rc similarity index 100% rename from src/zlib/zlib-1.3/win32/zlib1.rc rename to src/zlib/zlib-1.3.1/win32/zlib1.rc diff --git a/src/zlib/zlib-1.3/zconf.h b/src/zlib/zlib-1.3.1/zconf.h similarity index 98% rename from src/zlib/zlib-1.3/zconf.h rename to src/zlib/zlib-1.3.1/zconf.h index fb76ffe31..62adc8d84 100644 --- a/src/zlib/zlib-1.3/zconf.h +++ b/src/zlib/zlib-1.3.1/zconf.h @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -300,14 +300,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have diff --git a/src/zlib/zlib-1.3/zconf.h.cmakein b/src/zlib/zlib-1.3.1/zconf.h.cmakein similarity index 98% rename from src/zlib/zlib-1.3/zconf.h.cmakein rename to src/zlib/zlib-1.3.1/zconf.h.cmakein index 310c43928..0abe3bc9d 100644 --- a/src/zlib/zlib-1.3/zconf.h.cmakein +++ b/src/zlib/zlib-1.3.1/zconf.h.cmakein @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -302,14 +302,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have diff --git a/src/zlib/zlib-1.3/zconf.h.in b/src/zlib/zlib-1.3.1/zconf.h.in similarity index 98% rename from src/zlib/zlib-1.3/zconf.h.in rename to src/zlib/zlib-1.3.1/zconf.h.in index fb76ffe31..62adc8d84 100644 --- a/src/zlib/zlib-1.3/zconf.h.in +++ b/src/zlib/zlib-1.3.1/zconf.h.in @@ -1,5 +1,5 @@ /* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -300,14 +300,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have diff --git a/src/zlib/zlib-1.3/zlib.3 b/src/zlib/zlib-1.3.1/zlib.3 similarity index 97% rename from src/zlib/zlib-1.3/zlib.3 rename to src/zlib/zlib-1.3.1/zlib.3 index 4dd289675..c716020ea 100644 --- a/src/zlib/zlib-1.3/zlib.3 +++ b/src/zlib/zlib-1.3.1/zlib.3 @@ -1,4 +1,4 @@ -.TH ZLIB 3 "18 Aug 2023" +.TH ZLIB 3 "22 Jan 2024" .SH NAME zlib \- compression/decompression library .SH SYNOPSIS @@ -105,9 +105,9 @@ before asking for help. Send questions and/or comments to zlib@gzip.org, or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). .SH AUTHORS AND LICENSE -Version 1.3 +Version 1.3.1 .LP -Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler +Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler .LP This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/src/zlib/zlib-1.3.1/zlib.3.pdf b/src/zlib/zlib-1.3.1/zlib.3.pdf new file mode 100644 index 000000000..b224532bd Binary files /dev/null and b/src/zlib/zlib-1.3.1/zlib.3.pdf differ diff --git a/src/zlib/zlib-1.3/zlib.h b/src/zlib/zlib-1.3.1/zlib.h similarity index 99% rename from src/zlib/zlib-1.3/zlib.h rename to src/zlib/zlib-1.3.1/zlib.h index 6b7244f99..8d4b932ea 100644 --- a/src/zlib/zlib-1.3/zlib.h +++ b/src/zlib/zlib-1.3.1/zlib.h @@ -1,7 +1,7 @@ /* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.3, August 18th, 2023 + version 1.3.1, January 22nd, 2024 - Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler + Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,11 +37,11 @@ extern "C" { #endif -#define ZLIB_VERSION "1.3" -#define ZLIB_VERNUM 0x1300 +#define ZLIB_VERSION "1.3.1" +#define ZLIB_VERNUM 0x1310 #define ZLIB_VER_MAJOR 1 #define ZLIB_VER_MINOR 3 -#define ZLIB_VER_REVISION 0 +#define ZLIB_VER_REVISION 1 #define ZLIB_VER_SUBREVISION 0 /* @@ -936,10 +936,10 @@ ZEXTERN int ZEXPORT inflateSync(z_streamp strm); inflateSync returns Z_OK if a possible full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current current value of - total_in which indicates where valid compressed data was found. In the - error case, the application may repeatedly call inflateSync, providing more - input each time, until success or end of the input data. + In the success case, the application may save the current value of total_in + which indicates where valid compressed data was found. In the error case, + the application may repeatedly call inflateSync, providing more input each + time, until success or end of the input data. */ ZEXTERN int ZEXPORT inflateCopy(z_streamp dest, @@ -1758,14 +1758,14 @@ ZEXTERN uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2); seq1 and seq2 with lengths len1 and len2, CRC-32 check values were calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. + len2. len2 must be non-negative. */ /* ZEXTERN uLong ZEXPORT crc32_combine_gen(z_off_t len2); Return the operator corresponding to length len2, to be used with - crc32_combine_op(). + crc32_combine_op(). len2 must be non-negative. */ ZEXTERN uLong ZEXPORT crc32_combine_op(uLong crc1, uLong crc2, uLong op); diff --git a/src/zlib/zlib-1.3/zlib.map b/src/zlib/zlib-1.3.1/zlib.map similarity index 93% rename from src/zlib/zlib-1.3/zlib.map rename to src/zlib/zlib-1.3.1/zlib.map index b330b606f..31544f2e9 100644 --- a/src/zlib/zlib-1.3/zlib.map +++ b/src/zlib/zlib-1.3.1/zlib.map @@ -1,100 +1,100 @@ -ZLIB_1.2.0 { - global: - compressBound; - deflateBound; - inflateBack; - inflateBackEnd; - inflateBackInit_; - inflateCopy; - local: - deflate_copyright; - inflate_copyright; - inflate_fast; - inflate_table; - zcalloc; - zcfree; - z_errmsg; - gz_error; - gz_intmax; - _*; -}; - -ZLIB_1.2.0.2 { - gzclearerr; - gzungetc; - zlibCompileFlags; -} ZLIB_1.2.0; - -ZLIB_1.2.0.8 { - deflatePrime; -} ZLIB_1.2.0.2; - -ZLIB_1.2.2 { - adler32_combine; - crc32_combine; - deflateSetHeader; - inflateGetHeader; -} ZLIB_1.2.0.8; - -ZLIB_1.2.2.3 { - deflateTune; - gzdirect; -} ZLIB_1.2.2; - -ZLIB_1.2.2.4 { - inflatePrime; -} ZLIB_1.2.2.3; - -ZLIB_1.2.3.3 { - adler32_combine64; - crc32_combine64; - gzopen64; - gzseek64; - gztell64; - inflateUndermine; -} ZLIB_1.2.2.4; - -ZLIB_1.2.3.4 { - inflateReset2; - inflateMark; -} ZLIB_1.2.3.3; - -ZLIB_1.2.3.5 { - gzbuffer; - gzoffset; - gzoffset64; - gzclose_r; - gzclose_w; -} ZLIB_1.2.3.4; - -ZLIB_1.2.5.1 { - deflatePending; -} ZLIB_1.2.3.5; - -ZLIB_1.2.5.2 { - deflateResetKeep; - gzgetc_; - inflateResetKeep; -} ZLIB_1.2.5.1; - -ZLIB_1.2.7.1 { - inflateGetDictionary; - gzvprintf; -} ZLIB_1.2.5.2; - -ZLIB_1.2.9 { - inflateCodesUsed; - inflateValidate; - uncompress2; - gzfread; - gzfwrite; - deflateGetDictionary; - adler32_z; - crc32_z; -} ZLIB_1.2.7.1; - -ZLIB_1.2.12 { - crc32_combine_gen; - crc32_combine_gen64; - crc32_combine_op; -} ZLIB_1.2.9; +ZLIB_1.2.0 { + global: + compressBound; + deflateBound; + inflateBack; + inflateBackEnd; + inflateBackInit_; + inflateCopy; + local: + deflate_copyright; + inflate_copyright; + inflate_fast; + inflate_table; + zcalloc; + zcfree; + z_errmsg; + gz_error; + gz_intmax; + _*; +}; + +ZLIB_1.2.0.2 { + gzclearerr; + gzungetc; + zlibCompileFlags; +} ZLIB_1.2.0; + +ZLIB_1.2.0.8 { + deflatePrime; +} ZLIB_1.2.0.2; + +ZLIB_1.2.2 { + adler32_combine; + crc32_combine; + deflateSetHeader; + inflateGetHeader; +} ZLIB_1.2.0.8; + +ZLIB_1.2.2.3 { + deflateTune; + gzdirect; +} ZLIB_1.2.2; + +ZLIB_1.2.2.4 { + inflatePrime; +} ZLIB_1.2.2.3; + +ZLIB_1.2.3.3 { + adler32_combine64; + crc32_combine64; + gzopen64; + gzseek64; + gztell64; + inflateUndermine; +} ZLIB_1.2.2.4; + +ZLIB_1.2.3.4 { + inflateReset2; + inflateMark; +} ZLIB_1.2.3.3; + +ZLIB_1.2.3.5 { + gzbuffer; + gzoffset; + gzoffset64; + gzclose_r; + gzclose_w; +} ZLIB_1.2.3.4; + +ZLIB_1.2.5.1 { + deflatePending; +} ZLIB_1.2.3.5; + +ZLIB_1.2.5.2 { + deflateResetKeep; + gzgetc_; + inflateResetKeep; +} ZLIB_1.2.5.1; + +ZLIB_1.2.7.1 { + inflateGetDictionary; + gzvprintf; +} ZLIB_1.2.5.2; + +ZLIB_1.2.9 { + inflateCodesUsed; + inflateValidate; + uncompress2; + gzfread; + gzfwrite; + deflateGetDictionary; + adler32_z; + crc32_z; +} ZLIB_1.2.7.1; + +ZLIB_1.2.12 { + crc32_combine_gen; + crc32_combine_gen64; + crc32_combine_op; +} ZLIB_1.2.9; diff --git a/src/zlib/zlib-1.3/zlib.pc.cmakein b/src/zlib/zlib-1.3.1/zlib.pc.cmakein similarity index 100% rename from src/zlib/zlib-1.3/zlib.pc.cmakein rename to src/zlib/zlib-1.3.1/zlib.pc.cmakein diff --git a/src/zlib/zlib-1.3/zlib.pc.in b/src/zlib/zlib-1.3.1/zlib.pc.in similarity index 100% rename from src/zlib/zlib-1.3/zlib.pc.in rename to src/zlib/zlib-1.3.1/zlib.pc.in diff --git a/src/zlib/zlib-1.3/zutil.c b/src/zlib/zlib-1.3.1/zutil.c similarity index 100% rename from src/zlib/zlib-1.3/zutil.c rename to src/zlib/zlib-1.3.1/zutil.c diff --git a/src/zlib/zlib-1.3/zutil.h b/src/zlib/zlib-1.3.1/zutil.h similarity index 90% rename from src/zlib/zlib-1.3/zutil.h rename to src/zlib/zlib-1.3.1/zutil.h index 902a304cc..48dd7feba 100644 --- a/src/zlib/zlib-1.3/zutil.h +++ b/src/zlib/zlib-1.3.1/zutil.h @@ -1,5 +1,5 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2022 Jean-loup Gailly, Mark Adler + * Copyright (C) 1995-2024 Jean-loup Gailly, Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -56,7 +56,7 @@ typedef unsigned long ulg; extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] +#define ERR_MSG(err) z_errmsg[(err) < -6 || (err) > 2 ? 9 : 2 - (err)] #define ERR_RETURN(strm,err) \ return (strm->msg = ERR_MSG(err), (err)) @@ -137,17 +137,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # endif #endif -#if defined(MACOS) || defined(TARGET_OS_MAC) +#if defined(MACOS) # define OS_CODE 7 -# ifndef Z_SOLO -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -# endif #endif #ifdef __acorn @@ -170,18 +161,6 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # define OS_CODE 19 #endif -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - #if defined(__BORLANDC__) && !defined(MSDOS) #pragma warn -8004 #pragma warn -8008 diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc9/zlib.rc b/src/zlib/zlib-1.3/contrib/vstudio/vc9/zlib.rc deleted file mode 100644 index 29af8e11a..000000000 --- a/src/zlib/zlib-1.3/contrib/vstudio/vc9/zlib.rc +++ /dev/null @@ -1,32 +0,0 @@ -#include - -#define IDR_VERSION1 1 -IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1, 3, 0, 0 - PRODUCTVERSION 1, 3, 0, 0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK - FILEFLAGS 0 - FILEOS VOS_DOS_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE 0 // not used -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - //language ID = U.S. English, char set = Windows, Multilingual - - BEGIN - VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0" - VALUE "FileVersion", "1.3.0\0" - VALUE "InternalName", "zlib\0" - VALUE "OriginalFilename", "zlibwapi.dll\0" - VALUE "ProductName", "ZLib.DLL\0" - VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2023 Jean-loup Gailly & Mark Adler\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1252 - END -END diff --git a/src/zlib/zlib-1.3/contrib/vstudio/vc9/zlibvc.def b/src/zlib/zlib-1.3/contrib/vstudio/vc9/zlibvc.def deleted file mode 100644 index f28aa6c73..000000000 --- a/src/zlib/zlib-1.3/contrib/vstudio/vc9/zlibvc.def +++ /dev/null @@ -1,158 +0,0 @@ -LIBRARY -; zlib data compression and ZIP file I/O library - -VERSION 1.3 - -EXPORTS - adler32 @1 - compress @2 - crc32 @3 - deflate @4 - deflateCopy @5 - deflateEnd @6 - deflateInit2_ @7 - deflateInit_ @8 - deflateParams @9 - deflateReset @10 - deflateSetDictionary @11 - gzclose @12 - gzdopen @13 - gzerror @14 - gzflush @15 - gzopen @16 - gzread @17 - gzwrite @18 - inflate @19 - inflateEnd @20 - inflateInit2_ @21 - inflateInit_ @22 - inflateReset @23 - inflateSetDictionary @24 - inflateSync @25 - uncompress @26 - zlibVersion @27 - gzprintf @28 - gzputc @29 - gzgetc @30 - gzseek @31 - gzrewind @32 - gztell @33 - gzeof @34 - gzsetparams @35 - zError @36 - inflateSyncPoint @37 - get_crc_table @38 - compress2 @39 - gzputs @40 - gzgets @41 - inflateCopy @42 - inflateBackInit_ @43 - inflateBack @44 - inflateBackEnd @45 - compressBound @46 - deflateBound @47 - gzclearerr @48 - gzungetc @49 - zlibCompileFlags @50 - deflatePrime @51 - deflatePending @52 - - unzOpen @61 - unzClose @62 - unzGetGlobalInfo @63 - unzGetCurrentFileInfo @64 - unzGoToFirstFile @65 - unzGoToNextFile @66 - unzOpenCurrentFile @67 - unzReadCurrentFile @68 - unzOpenCurrentFile3 @69 - unztell @70 - unzeof @71 - unzCloseCurrentFile @72 - unzGetGlobalComment @73 - unzStringFileNameCompare @74 - unzLocateFile @75 - unzGetLocalExtrafield @76 - unzOpen2 @77 - unzOpenCurrentFile2 @78 - unzOpenCurrentFilePassword @79 - - zipOpen @80 - zipOpenNewFileInZip @81 - zipWriteInFileInZip @82 - zipCloseFileInZip @83 - zipClose @84 - zipOpenNewFileInZip2 @86 - zipCloseFileInZipRaw @87 - zipOpen2 @88 - zipOpenNewFileInZip3 @89 - - unzGetFilePos @100 - unzGoToFilePos @101 - - fill_win32_filefunc @110 - -; zlibwapi v1.2.4 added: - fill_win32_filefunc64 @111 - fill_win32_filefunc64A @112 - fill_win32_filefunc64W @113 - - unzOpen64 @120 - unzOpen2_64 @121 - unzGetGlobalInfo64 @122 - unzGetCurrentFileInfo64 @124 - unzGetCurrentFileZStreamPos64 @125 - unztell64 @126 - unzGetFilePos64 @127 - unzGoToFilePos64 @128 - - zipOpen64 @130 - zipOpen2_64 @131 - zipOpenNewFileInZip64 @132 - zipOpenNewFileInZip2_64 @133 - zipOpenNewFileInZip3_64 @134 - zipOpenNewFileInZip4_64 @135 - zipCloseFileInZipRaw64 @136 - -; zlib1 v1.2.4 added: - adler32_combine @140 - crc32_combine @142 - deflateSetHeader @144 - deflateTune @145 - gzbuffer @146 - gzclose_r @147 - gzclose_w @148 - gzdirect @149 - gzoffset @150 - inflateGetHeader @156 - inflateMark @157 - inflatePrime @158 - inflateReset2 @159 - inflateUndermine @160 - -; zlib1 v1.2.6 added: - gzgetc_ @161 - inflateResetKeep @163 - deflateResetKeep @164 - -; zlib1 v1.2.7 added: - gzopen_w @165 - -; zlib1 v1.2.8 added: - inflateGetDictionary @166 - gzvprintf @167 - -; zlib1 v1.2.9 added: - inflateCodesUsed @168 - inflateValidate @169 - uncompress2 @170 - gzfread @171 - gzfwrite @172 - deflateGetDictionary @173 - adler32_z @174 - crc32_z @175 - -; zlib1 v1.2.12 added: - crc32_combine_gen @176 - crc32_combine_gen64 @177 - crc32_combine_op @178 diff --git a/src/zlib/zlib-1.3/zlib.3.pdf b/src/zlib/zlib-1.3/zlib.3.pdf deleted file mode 100644 index da12d3718..000000000 Binary files a/src/zlib/zlib-1.3/zlib.3.pdf and /dev/null differ