rugged 1.7.2 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +1 -0
- data/vendor/libgit2/CMakeLists.txt +23 -10
- data/vendor/libgit2/COPYING +195 -1
- data/vendor/libgit2/cmake/{FindIconv.cmake → FindIntlIconv.cmake} +6 -0
- data/vendor/libgit2/cmake/FindLLHTTP.cmake +39 -0
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +1 -1
- data/vendor/libgit2/cmake/SelectHTTPParser.cmake +23 -8
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +17 -8
- data/vendor/libgit2/cmake/SelectHashes.cmake +28 -11
- data/vendor/libgit2/cmake/SelectRegex.cmake +6 -1
- data/vendor/libgit2/cmake/SelectSSH.cmake +22 -17
- data/vendor/libgit2/cmake/SelectZlib.cmake +4 -0
- data/vendor/libgit2/deps/llhttp/CMakeLists.txt +8 -0
- data/vendor/libgit2/deps/llhttp/LICENSE-MIT +22 -0
- data/vendor/libgit2/deps/llhttp/api.c +510 -0
- data/vendor/libgit2/deps/llhttp/http.c +170 -0
- data/vendor/libgit2/deps/llhttp/llhttp.c +10168 -0
- data/vendor/libgit2/deps/llhttp/llhttp.h +897 -0
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +1 -1
- data/vendor/libgit2/deps/ntlmclient/crypt_builtin_md4.c +311 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +2 -1
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -20
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +4 -4
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +21 -21
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +5 -4
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +2 -1
- data/vendor/libgit2/deps/ntlmclient/utf8.h +1176 -721
- data/vendor/libgit2/deps/ntlmclient/util.h +11 -0
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +1 -0
- data/vendor/libgit2/deps/xdiff/xmerge.c +2 -2
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -1
- data/vendor/libgit2/deps/zlib/LICENSE +22 -0
- data/vendor/libgit2/deps/zlib/adler32.c +5 -27
- data/vendor/libgit2/deps/zlib/crc32.c +94 -167
- data/vendor/libgit2/deps/zlib/deflate.c +358 -435
- data/vendor/libgit2/deps/zlib/deflate.h +41 -10
- data/vendor/libgit2/deps/zlib/gzguts.h +13 -18
- data/vendor/libgit2/deps/zlib/infback.c +17 -30
- data/vendor/libgit2/deps/zlib/inffast.c +1 -4
- data/vendor/libgit2/deps/zlib/inffast.h +1 -1
- data/vendor/libgit2/deps/zlib/inflate.c +36 -102
- data/vendor/libgit2/deps/zlib/inftrees.c +6 -11
- data/vendor/libgit2/deps/zlib/inftrees.h +6 -6
- data/vendor/libgit2/deps/zlib/trees.c +287 -352
- data/vendor/libgit2/deps/zlib/zconf.h +23 -14
- data/vendor/libgit2/deps/zlib/zlib.h +202 -202
- data/vendor/libgit2/deps/zlib/zutil.c +18 -44
- data/vendor/libgit2/deps/zlib/zutil.h +13 -33
- data/vendor/libgit2/include/git2/annotated_commit.h +12 -5
- data/vendor/libgit2/include/git2/apply.h +27 -6
- data/vendor/libgit2/include/git2/attr.h +17 -4
- data/vendor/libgit2/include/git2/blame.h +133 -28
- data/vendor/libgit2/include/git2/blob.h +71 -28
- data/vendor/libgit2/include/git2/branch.h +22 -15
- data/vendor/libgit2/include/git2/buffer.h +6 -4
- data/vendor/libgit2/include/git2/cert.h +2 -1
- data/vendor/libgit2/include/git2/checkout.h +83 -32
- data/vendor/libgit2/include/git2/cherrypick.h +10 -3
- data/vendor/libgit2/include/git2/clone.h +25 -9
- data/vendor/libgit2/include/git2/commit.h +132 -3
- data/vendor/libgit2/include/git2/common.h +120 -63
- data/vendor/libgit2/include/git2/config.h +93 -23
- data/vendor/libgit2/include/git2/credential.h +30 -2
- data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
- data/vendor/libgit2/include/git2/deprecated.h +133 -3
- data/vendor/libgit2/include/git2/describe.h +13 -1
- data/vendor/libgit2/include/git2/diff.h +38 -8
- data/vendor/libgit2/include/git2/email.h +9 -29
- data/vendor/libgit2/include/git2/errors.h +46 -73
- data/vendor/libgit2/include/git2/filter.h +14 -7
- data/vendor/libgit2/include/git2/global.h +8 -1
- data/vendor/libgit2/include/git2/graph.h +3 -2
- data/vendor/libgit2/include/git2/ignore.h +10 -0
- data/vendor/libgit2/include/git2/index.h +99 -14
- data/vendor/libgit2/include/git2/indexer.h +21 -4
- data/vendor/libgit2/include/git2/mailmap.h +7 -1
- data/vendor/libgit2/include/git2/merge.h +46 -1
- data/vendor/libgit2/include/git2/message.h +2 -2
- data/vendor/libgit2/include/git2/net.h +3 -1
- data/vendor/libgit2/include/git2/notes.h +9 -6
- data/vendor/libgit2/include/git2/object.h +9 -8
- data/vendor/libgit2/include/git2/odb.h +91 -49
- data/vendor/libgit2/include/git2/odb_backend.h +80 -52
- data/vendor/libgit2/include/git2/oid.h +23 -24
- data/vendor/libgit2/include/git2/oidarray.h +7 -1
- data/vendor/libgit2/include/git2/pack.h +13 -1
- data/vendor/libgit2/include/git2/patch.h +2 -3
- data/vendor/libgit2/include/git2/pathspec.h +9 -0
- data/vendor/libgit2/include/git2/proxy.h +10 -0
- data/vendor/libgit2/include/git2/rebase.h +9 -6
- data/vendor/libgit2/include/git2/refdb.h +2 -2
- data/vendor/libgit2/include/git2/reflog.h +3 -2
- data/vendor/libgit2/include/git2/refs.h +9 -6
- data/vendor/libgit2/include/git2/refspec.h +14 -4
- data/vendor/libgit2/include/git2/remote.h +94 -18
- data/vendor/libgit2/include/git2/repository.h +57 -21
- data/vendor/libgit2/include/git2/reset.h +16 -3
- data/vendor/libgit2/include/git2/revert.h +9 -4
- data/vendor/libgit2/include/git2/revparse.h +3 -3
- data/vendor/libgit2/include/git2/revwalk.h +3 -2
- data/vendor/libgit2/include/git2/signature.h +46 -1
- data/vendor/libgit2/include/git2/stash.h +17 -3
- data/vendor/libgit2/include/git2/status.h +10 -6
- data/vendor/libgit2/include/git2/stdint.h +87 -85
- data/vendor/libgit2/include/git2/strarray.h +2 -3
- data/vendor/libgit2/include/git2/submodule.h +20 -9
- data/vendor/libgit2/include/git2/sys/alloc.h +12 -0
- data/vendor/libgit2/include/git2/sys/commit.h +77 -3
- data/vendor/libgit2/include/git2/sys/commit_graph.h +103 -62
- data/vendor/libgit2/include/git2/sys/config.h +80 -4
- data/vendor/libgit2/include/git2/sys/credential.h +4 -3
- data/vendor/libgit2/include/git2/sys/diff.h +21 -1
- data/vendor/libgit2/include/git2/sys/email.h +7 -0
- data/vendor/libgit2/include/git2/sys/errors.h +76 -0
- data/vendor/libgit2/include/git2/sys/filter.h +66 -3
- data/vendor/libgit2/include/git2/sys/hashsig.h +11 -0
- data/vendor/libgit2/include/git2/sys/index.h +3 -2
- data/vendor/libgit2/include/git2/sys/mempack.h +32 -2
- data/vendor/libgit2/include/git2/sys/merge.h +55 -7
- data/vendor/libgit2/include/git2/sys/midx.h +43 -4
- data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -3
- data/vendor/libgit2/include/git2/sys/openssl.h +8 -1
- data/vendor/libgit2/include/git2/sys/path.h +12 -1
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +40 -36
- data/vendor/libgit2/include/git2/sys/refs.h +3 -2
- data/vendor/libgit2/include/git2/sys/remote.h +8 -1
- data/vendor/libgit2/include/git2/sys/repository.h +63 -3
- data/vendor/libgit2/include/git2/sys/stream.h +11 -2
- data/vendor/libgit2/include/git2/sys/transport.h +24 -3
- data/vendor/libgit2/include/git2/tag.h +3 -1
- data/vendor/libgit2/include/git2/trace.h +9 -3
- data/vendor/libgit2/include/git2/transaction.h +3 -2
- data/vendor/libgit2/include/git2/transport.h +11 -3
- data/vendor/libgit2/include/git2/tree.h +16 -5
- data/vendor/libgit2/include/git2/types.h +19 -3
- data/vendor/libgit2/include/git2/version.h +44 -8
- data/vendor/libgit2/include/git2/worktree.h +16 -6
- data/vendor/libgit2/src/CMakeLists.txt +6 -4
- data/vendor/libgit2/src/cli/CMakeLists.txt +2 -2
- data/vendor/libgit2/src/cli/cmd.c +1 -1
- data/vendor/libgit2/src/cli/cmd.h +4 -0
- data/vendor/libgit2/src/cli/cmd_blame.c +287 -0
- data/vendor/libgit2/src/cli/cmd_cat_file.c +6 -8
- data/vendor/libgit2/src/cli/cmd_clone.c +5 -7
- data/vendor/libgit2/src/cli/cmd_config.c +241 -0
- data/vendor/libgit2/src/cli/cmd_hash_object.c +6 -8
- data/vendor/libgit2/src/cli/cmd_help.c +6 -7
- data/vendor/libgit2/src/cli/cmd_index_pack.c +114 -0
- data/vendor/libgit2/src/cli/cmd_init.c +102 -0
- data/vendor/libgit2/src/cli/common.c +168 -0
- data/vendor/libgit2/src/cli/common.h +63 -0
- data/vendor/libgit2/src/cli/error.h +1 -1
- data/vendor/libgit2/src/cli/main.c +52 -24
- data/vendor/libgit2/src/cli/opt.c +29 -3
- data/vendor/libgit2/src/cli/opt.h +21 -3
- data/vendor/libgit2/src/cli/opt_usage.c +102 -33
- data/vendor/libgit2/src/cli/opt_usage.h +6 -1
- data/vendor/libgit2/src/cli/progress.c +51 -2
- data/vendor/libgit2/src/cli/progress.h +12 -0
- data/vendor/libgit2/src/cli/unix/sighandler.c +2 -1
- data/vendor/libgit2/src/cli/win32/precompiled.h +1 -1
- data/vendor/libgit2/src/cli/win32/sighandler.c +1 -1
- data/vendor/libgit2/src/libgit2/CMakeLists.txt +26 -8
- data/vendor/libgit2/src/libgit2/apply.c +10 -13
- data/vendor/libgit2/src/libgit2/attr.c +30 -13
- data/vendor/libgit2/src/libgit2/attr_file.c +7 -2
- data/vendor/libgit2/src/libgit2/attr_file.h +2 -0
- data/vendor/libgit2/src/libgit2/attrcache.c +69 -33
- data/vendor/libgit2/src/libgit2/attrcache.h +5 -9
- data/vendor/libgit2/src/libgit2/blame.c +130 -44
- data/vendor/libgit2/src/libgit2/blame.h +1 -0
- data/vendor/libgit2/src/libgit2/cache.c +22 -17
- data/vendor/libgit2/src/libgit2/cache.h +7 -9
- data/vendor/libgit2/src/libgit2/checkout.c +34 -24
- data/vendor/libgit2/src/libgit2/checkout.h +0 -2
- data/vendor/libgit2/src/libgit2/cherrypick.c +1 -2
- data/vendor/libgit2/src/libgit2/clone.c +186 -166
- data/vendor/libgit2/src/libgit2/clone.h +4 -1
- data/vendor/libgit2/src/libgit2/commit.c +92 -0
- data/vendor/libgit2/src/libgit2/commit_graph.c +67 -56
- data/vendor/libgit2/src/libgit2/commit_graph.h +1 -2
- data/vendor/libgit2/src/libgit2/config.c +389 -298
- data/vendor/libgit2/src/libgit2/config.cmake.in +3 -0
- data/vendor/libgit2/src/libgit2/config.h +9 -4
- data/vendor/libgit2/src/libgit2/config_backend.h +8 -10
- data/vendor/libgit2/src/libgit2/config_cache.c +4 -5
- data/vendor/libgit2/src/libgit2/config_file.c +99 -88
- data/vendor/libgit2/src/libgit2/config_list.c +285 -0
- data/vendor/libgit2/src/libgit2/config_list.h +32 -0
- data/vendor/libgit2/src/libgit2/config_mem.c +194 -40
- data/vendor/libgit2/src/libgit2/config_parse.c +10 -9
- data/vendor/libgit2/src/libgit2/config_snapshot.c +24 -31
- data/vendor/libgit2/src/libgit2/describe.c +24 -24
- data/vendor/libgit2/src/libgit2/diff.c +1 -1
- data/vendor/libgit2/src/libgit2/diff_driver.c +12 -19
- data/vendor/libgit2/src/libgit2/diff_driver.h +2 -2
- data/vendor/libgit2/src/libgit2/diff_generate.c +3 -3
- data/vendor/libgit2/src/libgit2/diff_parse.c +2 -2
- data/vendor/libgit2/src/libgit2/diff_print.c +65 -9
- data/vendor/libgit2/src/libgit2/diff_tform.c +36 -8
- data/vendor/libgit2/src/libgit2/email.c +1 -0
- data/vendor/libgit2/src/libgit2/fetch.c +5 -3
- data/vendor/libgit2/src/libgit2/filter.c +5 -5
- data/vendor/libgit2/src/libgit2/git2.rc +3 -3
- data/vendor/libgit2/src/libgit2/grafts.c +18 -20
- data/vendor/libgit2/src/libgit2/grafts.h +0 -1
- data/vendor/libgit2/src/libgit2/graph.c +1 -1
- data/vendor/libgit2/src/libgit2/hashmap_oid.h +30 -0
- data/vendor/libgit2/src/libgit2/ignore.c +9 -5
- data/vendor/libgit2/src/libgit2/index.c +68 -90
- data/vendor/libgit2/src/libgit2/index.h +2 -2
- data/vendor/libgit2/src/libgit2/index_map.c +95 -0
- data/vendor/libgit2/src/libgit2/index_map.h +28 -0
- data/vendor/libgit2/src/libgit2/indexer.c +34 -38
- data/vendor/libgit2/src/libgit2/iterator.c +14 -8
- data/vendor/libgit2/src/libgit2/libgit2.c +153 -368
- data/vendor/libgit2/src/libgit2/mailmap.c +1 -1
- data/vendor/libgit2/src/libgit2/merge.c +42 -37
- data/vendor/libgit2/src/libgit2/merge_driver.c +2 -2
- data/vendor/libgit2/src/libgit2/midx.c +28 -15
- data/vendor/libgit2/src/libgit2/mwindow.c +38 -45
- data/vendor/libgit2/src/libgit2/mwindow.h +4 -0
- data/vendor/libgit2/src/libgit2/object.c +6 -5
- data/vendor/libgit2/src/libgit2/odb.c +5 -4
- data/vendor/libgit2/src/libgit2/odb_mempack.c +49 -17
- data/vendor/libgit2/src/libgit2/odb_pack.c +13 -5
- data/vendor/libgit2/src/libgit2/oid.c +32 -5
- data/vendor/libgit2/src/libgit2/oid.h +11 -0
- data/vendor/libgit2/src/libgit2/pack-objects.c +58 -31
- data/vendor/libgit2/src/libgit2/pack-objects.h +12 -4
- data/vendor/libgit2/src/libgit2/pack.c +30 -24
- data/vendor/libgit2/src/libgit2/pack.h +15 -10
- data/vendor/libgit2/src/libgit2/patch_parse.c +2 -2
- data/vendor/libgit2/src/libgit2/path.c +1 -1
- data/vendor/libgit2/src/libgit2/pathspec.c +1 -1
- data/vendor/libgit2/src/libgit2/push.c +79 -28
- data/vendor/libgit2/src/libgit2/push.h +1 -0
- data/vendor/libgit2/src/libgit2/refdb_fs.c +128 -61
- data/vendor/libgit2/src/libgit2/reflog.c +1 -2
- data/vendor/libgit2/src/libgit2/reflog.h +2 -0
- data/vendor/libgit2/src/libgit2/refs.c +26 -7
- data/vendor/libgit2/src/libgit2/refs.h +6 -1
- data/vendor/libgit2/src/libgit2/refspec.c +28 -1
- data/vendor/libgit2/src/libgit2/refspec.h +8 -0
- data/vendor/libgit2/src/libgit2/remote.c +121 -61
- data/vendor/libgit2/src/libgit2/repository.c +231 -51
- data/vendor/libgit2/src/libgit2/repository.h +10 -6
- data/vendor/libgit2/src/libgit2/revert.c +1 -2
- data/vendor/libgit2/src/libgit2/revparse.c +2 -2
- data/vendor/libgit2/src/libgit2/revwalk.c +13 -10
- data/vendor/libgit2/src/libgit2/revwalk.h +3 -3
- data/vendor/libgit2/src/libgit2/settings.c +468 -0
- data/vendor/libgit2/src/libgit2/settings.h +6 -2
- data/vendor/libgit2/src/libgit2/signature.c +132 -15
- data/vendor/libgit2/src/libgit2/signature.h +0 -1
- data/vendor/libgit2/src/libgit2/status.c +1 -1
- data/vendor/libgit2/src/libgit2/streams/mbedtls.c +54 -60
- data/vendor/libgit2/src/libgit2/streams/openssl.c +32 -7
- data/vendor/libgit2/src/libgit2/streams/openssl.h +2 -0
- data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.c +4 -0
- data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.h +3 -0
- data/vendor/libgit2/src/libgit2/streams/stransport.c +39 -7
- data/vendor/libgit2/src/libgit2/submodule.c +106 -63
- data/vendor/libgit2/src/libgit2/submodule.h +6 -7
- data/vendor/libgit2/src/libgit2/tag.c +1 -1
- data/vendor/libgit2/src/libgit2/trailer.c +6 -6
- data/vendor/libgit2/src/libgit2/transaction.c +26 -20
- data/vendor/libgit2/src/libgit2/transaction.h +4 -1
- data/vendor/libgit2/src/libgit2/transport.c +4 -1
- data/vendor/libgit2/src/libgit2/transports/credential.c +1 -1
- data/vendor/libgit2/src/libgit2/transports/http.c +1 -2
- data/vendor/libgit2/src/libgit2/transports/http.h +0 -10
- data/vendor/libgit2/src/libgit2/transports/httpclient.c +112 -72
- data/vendor/libgit2/src/libgit2/transports/httpparser.c +128 -0
- data/vendor/libgit2/src/libgit2/transports/httpparser.h +99 -0
- data/vendor/libgit2/src/libgit2/transports/local.c +8 -7
- data/vendor/libgit2/src/libgit2/transports/smart.c +20 -8
- data/vendor/libgit2/src/libgit2/transports/smart.h +4 -2
- data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +2 -2
- data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +55 -10
- data/vendor/libgit2/src/libgit2/transports/ssh.c +41 -1103
- data/vendor/libgit2/src/libgit2/transports/ssh_exec.c +347 -0
- data/vendor/libgit2/src/libgit2/transports/ssh_exec.h +26 -0
- data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.c +1126 -0
- data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.h +28 -0
- data/vendor/libgit2/src/libgit2/transports/winhttp.c +35 -7
- data/vendor/libgit2/src/libgit2/tree.c +34 -26
- data/vendor/libgit2/src/libgit2/tree.h +3 -2
- data/vendor/libgit2/src/libgit2/worktree.c +14 -17
- data/vendor/libgit2/src/util/CMakeLists.txt +4 -6
- data/vendor/libgit2/src/util/alloc.c +4 -1
- data/vendor/libgit2/src/util/allocators/debugalloc.c +73 -0
- data/vendor/libgit2/src/{cli/cli.h → util/allocators/debugalloc.h} +6 -9
- data/vendor/libgit2/src/util/allocators/stdalloc.c +0 -10
- data/vendor/libgit2/src/util/array.h +18 -17
- data/vendor/libgit2/src/util/cc-compat.h +2 -0
- data/vendor/libgit2/src/util/ctype_compat.h +70 -0
- data/vendor/libgit2/src/util/date.c +22 -14
- data/vendor/libgit2/src/util/date.h +12 -0
- data/vendor/libgit2/src/util/errors.c +401 -0
- data/vendor/libgit2/src/{libgit2 → util}/errors.h +21 -17
- data/vendor/libgit2/src/util/fs_path.c +15 -4
- data/vendor/libgit2/src/util/fs_path.h +23 -0
- data/vendor/libgit2/src/util/futils.c +6 -5
- data/vendor/libgit2/src/util/futils.h +13 -4
- data/vendor/libgit2/src/util/git2_features.h.in +12 -1
- data/vendor/libgit2/src/util/git2_util.h +6 -0
- data/vendor/libgit2/src/util/hash/openssl.c +152 -0
- data/vendor/libgit2/src/util/hash/openssl.h +17 -1
- data/vendor/libgit2/src/util/hash/sha.h +4 -1
- data/vendor/libgit2/src/util/hashmap.h +424 -0
- data/vendor/libgit2/src/util/hashmap_str.h +43 -0
- data/vendor/libgit2/src/util/integer.h +3 -1
- data/vendor/libgit2/src/util/net.c +13 -7
- data/vendor/libgit2/src/util/net.h +2 -0
- data/vendor/libgit2/src/util/pool.c +1 -1
- data/vendor/libgit2/src/util/pool.h +5 -0
- data/vendor/libgit2/src/util/pqueue.h +1 -1
- data/vendor/libgit2/src/util/process.h +222 -0
- data/vendor/libgit2/src/util/rand.c +1 -7
- data/vendor/libgit2/src/util/regexp.c +1 -1
- data/vendor/libgit2/src/util/sortedcache.c +14 -13
- data/vendor/libgit2/src/util/sortedcache.h +3 -3
- data/vendor/libgit2/src/util/str.c +2 -2
- data/vendor/libgit2/src/util/strlist.c +108 -0
- data/vendor/libgit2/src/util/strlist.h +36 -0
- data/vendor/libgit2/src/util/unix/posix.h +0 -2
- data/vendor/libgit2/src/util/unix/process.c +629 -0
- data/vendor/libgit2/src/util/unix/realpath.c +23 -5
- data/vendor/libgit2/src/util/util.c +2 -2
- data/vendor/libgit2/src/util/util.h +4 -38
- data/vendor/libgit2/src/util/vector.c +3 -3
- data/vendor/libgit2/src/util/vector.h +2 -2
- data/vendor/libgit2/src/util/win32/posix_w32.c +29 -6
- data/vendor/libgit2/src/util/win32/process.c +506 -0
- metadata +45 -28
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -6
- data/vendor/libgit2/deps/http-parser/COPYING +0 -23
- data/vendor/libgit2/deps/http-parser/http_parser.c +0 -2182
- data/vendor/libgit2/deps/http-parser/http_parser.h +0 -305
- data/vendor/libgit2/deps/zlib/COPYING +0 -27
- data/vendor/libgit2/include/git2/sys/reflog.h +0 -21
- data/vendor/libgit2/src/libgit2/config_entries.c +0 -237
- data/vendor/libgit2/src/libgit2/config_entries.h +0 -24
- data/vendor/libgit2/src/libgit2/errors.c +0 -293
- data/vendor/libgit2/src/libgit2/idxmap.c +0 -157
- data/vendor/libgit2/src/libgit2/idxmap.h +0 -177
- data/vendor/libgit2/src/libgit2/libgit2.h +0 -15
- data/vendor/libgit2/src/libgit2/offmap.c +0 -101
- data/vendor/libgit2/src/libgit2/offmap.h +0 -133
- data/vendor/libgit2/src/libgit2/oidmap.c +0 -107
- data/vendor/libgit2/src/libgit2/oidmap.h +0 -128
- data/vendor/libgit2/src/libgit2/threadstate.c +0 -97
- data/vendor/libgit2/src/libgit2/threadstate.h +0 -22
- data/vendor/libgit2/src/libgit2/transports/ssh.h +0 -14
- data/vendor/libgit2/src/util/khash.h +0 -615
- data/vendor/libgit2/src/util/strmap.c +0 -100
- data/vendor/libgit2/src/util/strmap.h +0 -131
- /data/vendor/libgit2/cmake/{FindHTTPParser.cmake → FindHTTP_Parser.cmake} +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
/* deflate.c -- compress data using the deflation algorithm
|
2
|
-
* Copyright (C) 1995-
|
2
|
+
* Copyright (C) 1995-2024 Jean-loup Gailly and Mark Adler
|
3
3
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
4
|
*/
|
5
5
|
|
@@ -52,7 +52,7 @@
|
|
52
52
|
#include "deflate.h"
|
53
53
|
|
54
54
|
const char deflate_copyright[] =
|
55
|
-
" deflate 1.
|
55
|
+
" deflate 1.3.1 Copyright 1995-2024 Jean-loup Gailly and Mark Adler ";
|
56
56
|
/*
|
57
57
|
If you use the zlib library in a product, an acknowledgment is welcome
|
58
58
|
in the documentation of your product. If for some reason you cannot
|
@@ -60,9 +60,6 @@ const char deflate_copyright[] =
|
|
60
60
|
copyright string in the executable of your product.
|
61
61
|
*/
|
62
62
|
|
63
|
-
/* ===========================================================================
|
64
|
-
* Function prototypes.
|
65
|
-
*/
|
66
63
|
typedef enum {
|
67
64
|
need_more, /* block not completed, need more input or more output */
|
68
65
|
block_done, /* block flush performed */
|
@@ -70,35 +67,16 @@ typedef enum {
|
|
70
67
|
finish_done /* finish done, accept no more input or output */
|
71
68
|
} block_state;
|
72
69
|
|
73
|
-
typedef block_state (*compress_func)
|
70
|
+
typedef block_state (*compress_func)(deflate_state *s, int flush);
|
74
71
|
/* Compression function. Returns the block state after the call. */
|
75
72
|
|
76
|
-
local
|
77
|
-
local
|
78
|
-
local void fill_window OF((deflate_state *s));
|
79
|
-
local block_state deflate_stored OF((deflate_state *s, int flush));
|
80
|
-
local block_state deflate_fast OF((deflate_state *s, int flush));
|
73
|
+
local block_state deflate_stored(deflate_state *s, int flush);
|
74
|
+
local block_state deflate_fast(deflate_state *s, int flush);
|
81
75
|
#ifndef FASTEST
|
82
|
-
local block_state deflate_slow
|
83
|
-
#endif
|
84
|
-
local block_state deflate_rle OF((deflate_state *s, int flush));
|
85
|
-
local block_state deflate_huff OF((deflate_state *s, int flush));
|
86
|
-
local void lm_init OF((deflate_state *s));
|
87
|
-
local void putShortMSB OF((deflate_state *s, uInt b));
|
88
|
-
local void flush_pending OF((z_streamp strm));
|
89
|
-
local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
|
90
|
-
#ifdef ASMV
|
91
|
-
# pragma message("Assembler code may have bugs -- use at your own risk")
|
92
|
-
void match_init OF((void)); /* asm code initialization */
|
93
|
-
uInt longest_match OF((deflate_state *s, IPos cur_match));
|
94
|
-
#else
|
95
|
-
local uInt longest_match OF((deflate_state *s, IPos cur_match));
|
96
|
-
#endif
|
97
|
-
|
98
|
-
#ifdef ZLIB_DEBUG
|
99
|
-
local void check_match OF((deflate_state *s, IPos start, IPos match,
|
100
|
-
int length));
|
76
|
+
local block_state deflate_slow(deflate_state *s, int flush);
|
101
77
|
#endif
|
78
|
+
local block_state deflate_rle(deflate_state *s, int flush);
|
79
|
+
local block_state deflate_huff(deflate_state *s, int flush);
|
102
80
|
|
103
81
|
/* ===========================================================================
|
104
82
|
* Local data
|
@@ -160,7 +138,7 @@ local const config configuration_table[10] = {
|
|
160
138
|
* characters, so that a running hash key can be computed from the previous
|
161
139
|
* key instead of complete recalculation each time.
|
162
140
|
*/
|
163
|
-
#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
|
141
|
+
#define UPDATE_HASH(s,h,c) (h = (((h) << s->hash_shift) ^ (c)) & s->hash_mask)
|
164
142
|
|
165
143
|
|
166
144
|
/* ===========================================================================
|
@@ -191,9 +169,9 @@ local const config configuration_table[10] = {
|
|
191
169
|
*/
|
192
170
|
#define CLEAR_HASH(s) \
|
193
171
|
do { \
|
194
|
-
s->head[s->hash_size-1] = NIL; \
|
172
|
+
s->head[s->hash_size - 1] = NIL; \
|
195
173
|
zmemzero((Bytef *)s->head, \
|
196
|
-
(unsigned)(s->hash_size-1)*sizeof(*s->head)); \
|
174
|
+
(unsigned)(s->hash_size - 1)*sizeof(*s->head)); \
|
197
175
|
} while (0)
|
198
176
|
|
199
177
|
/* ===========================================================================
|
@@ -203,12 +181,10 @@ local const config configuration_table[10] = {
|
|
203
181
|
*/
|
204
182
|
#if defined(__has_feature)
|
205
183
|
# if __has_feature(memory_sanitizer)
|
206
|
-
__attribute__((no_sanitize("memory")))
|
184
|
+
__attribute__((no_sanitize("memory")))
|
207
185
|
# endif
|
208
186
|
#endif
|
209
|
-
local void slide_hash(s)
|
210
|
-
deflate_state *s;
|
211
|
-
{
|
187
|
+
local void slide_hash(deflate_state *s) {
|
212
188
|
unsigned n, m;
|
213
189
|
Posf *p;
|
214
190
|
uInt wsize = s->w_size;
|
@@ -232,30 +208,177 @@ local void slide_hash(s)
|
|
232
208
|
#endif
|
233
209
|
}
|
234
210
|
|
211
|
+
/* ===========================================================================
|
212
|
+
* Read a new buffer from the current input stream, update the adler32
|
213
|
+
* and total number of bytes read. All deflate() input goes through
|
214
|
+
* this function so some applications may wish to modify it to avoid
|
215
|
+
* allocating a large strm->next_in buffer and copying from it.
|
216
|
+
* (See also flush_pending()).
|
217
|
+
*/
|
218
|
+
local unsigned read_buf(z_streamp strm, Bytef *buf, unsigned size) {
|
219
|
+
unsigned len = strm->avail_in;
|
220
|
+
|
221
|
+
if (len > size) len = size;
|
222
|
+
if (len == 0) return 0;
|
223
|
+
|
224
|
+
strm->avail_in -= len;
|
225
|
+
|
226
|
+
zmemcpy(buf, strm->next_in, len);
|
227
|
+
if (strm->state->wrap == 1) {
|
228
|
+
strm->adler = adler32(strm->adler, buf, len);
|
229
|
+
}
|
230
|
+
#ifdef GZIP
|
231
|
+
else if (strm->state->wrap == 2) {
|
232
|
+
strm->adler = crc32(strm->adler, buf, len);
|
233
|
+
}
|
234
|
+
#endif
|
235
|
+
strm->next_in += len;
|
236
|
+
strm->total_in += len;
|
237
|
+
|
238
|
+
return len;
|
239
|
+
}
|
240
|
+
|
241
|
+
/* ===========================================================================
|
242
|
+
* Fill the window when the lookahead becomes insufficient.
|
243
|
+
* Updates strstart and lookahead.
|
244
|
+
*
|
245
|
+
* IN assertion: lookahead < MIN_LOOKAHEAD
|
246
|
+
* OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
|
247
|
+
* At least one byte has been read, or avail_in == 0; reads are
|
248
|
+
* performed for at least two bytes (required for the zip translate_eol
|
249
|
+
* option -- not supported here).
|
250
|
+
*/
|
251
|
+
local void fill_window(deflate_state *s) {
|
252
|
+
unsigned n;
|
253
|
+
unsigned more; /* Amount of free space at the end of the window. */
|
254
|
+
uInt wsize = s->w_size;
|
255
|
+
|
256
|
+
Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
|
257
|
+
|
258
|
+
do {
|
259
|
+
more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
|
260
|
+
|
261
|
+
/* Deal with !@#$% 64K limit: */
|
262
|
+
if (sizeof(int) <= 2) {
|
263
|
+
if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
|
264
|
+
more = wsize;
|
265
|
+
|
266
|
+
} else if (more == (unsigned)(-1)) {
|
267
|
+
/* Very unlikely, but possible on 16 bit machine if
|
268
|
+
* strstart == 0 && lookahead == 1 (input done a byte at time)
|
269
|
+
*/
|
270
|
+
more--;
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
/* If the window is almost full and there is insufficient lookahead,
|
275
|
+
* move the upper half to the lower one to make room in the upper half.
|
276
|
+
*/
|
277
|
+
if (s->strstart >= wsize + MAX_DIST(s)) {
|
278
|
+
|
279
|
+
zmemcpy(s->window, s->window + wsize, (unsigned)wsize - more);
|
280
|
+
s->match_start -= wsize;
|
281
|
+
s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
|
282
|
+
s->block_start -= (long) wsize;
|
283
|
+
if (s->insert > s->strstart)
|
284
|
+
s->insert = s->strstart;
|
285
|
+
slide_hash(s);
|
286
|
+
more += wsize;
|
287
|
+
}
|
288
|
+
if (s->strm->avail_in == 0) break;
|
289
|
+
|
290
|
+
/* If there was no sliding:
|
291
|
+
* strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
|
292
|
+
* more == window_size - lookahead - strstart
|
293
|
+
* => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
|
294
|
+
* => more >= window_size - 2*WSIZE + 2
|
295
|
+
* In the BIG_MEM or MMAP case (not yet supported),
|
296
|
+
* window_size == input_size + MIN_LOOKAHEAD &&
|
297
|
+
* strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
|
298
|
+
* Otherwise, window_size == 2*WSIZE so more >= 2.
|
299
|
+
* If there was sliding, more >= WSIZE. So in all cases, more >= 2.
|
300
|
+
*/
|
301
|
+
Assert(more >= 2, "more < 2");
|
302
|
+
|
303
|
+
n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
|
304
|
+
s->lookahead += n;
|
305
|
+
|
306
|
+
/* Initialize the hash value now that we have some input: */
|
307
|
+
if (s->lookahead + s->insert >= MIN_MATCH) {
|
308
|
+
uInt str = s->strstart - s->insert;
|
309
|
+
s->ins_h = s->window[str];
|
310
|
+
UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
|
311
|
+
#if MIN_MATCH != 3
|
312
|
+
Call UPDATE_HASH() MIN_MATCH-3 more times
|
313
|
+
#endif
|
314
|
+
while (s->insert) {
|
315
|
+
UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
|
316
|
+
#ifndef FASTEST
|
317
|
+
s->prev[str & s->w_mask] = s->head[s->ins_h];
|
318
|
+
#endif
|
319
|
+
s->head[s->ins_h] = (Pos)str;
|
320
|
+
str++;
|
321
|
+
s->insert--;
|
322
|
+
if (s->lookahead + s->insert < MIN_MATCH)
|
323
|
+
break;
|
324
|
+
}
|
325
|
+
}
|
326
|
+
/* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
|
327
|
+
* but this is not important since only literal bytes will be emitted.
|
328
|
+
*/
|
329
|
+
|
330
|
+
} while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
|
331
|
+
|
332
|
+
/* If the WIN_INIT bytes after the end of the current data have never been
|
333
|
+
* written, then zero those bytes in order to avoid memory check reports of
|
334
|
+
* the use of uninitialized (or uninitialised as Julian writes) bytes by
|
335
|
+
* the longest match routines. Update the high water mark for the next
|
336
|
+
* time through here. WIN_INIT is set to MAX_MATCH since the longest match
|
337
|
+
* routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
|
338
|
+
*/
|
339
|
+
if (s->high_water < s->window_size) {
|
340
|
+
ulg curr = s->strstart + (ulg)(s->lookahead);
|
341
|
+
ulg init;
|
342
|
+
|
343
|
+
if (s->high_water < curr) {
|
344
|
+
/* Previous high water mark below current data -- zero WIN_INIT
|
345
|
+
* bytes or up to end of window, whichever is less.
|
346
|
+
*/
|
347
|
+
init = s->window_size - curr;
|
348
|
+
if (init > WIN_INIT)
|
349
|
+
init = WIN_INIT;
|
350
|
+
zmemzero(s->window + curr, (unsigned)init);
|
351
|
+
s->high_water = curr + init;
|
352
|
+
}
|
353
|
+
else if (s->high_water < (ulg)curr + WIN_INIT) {
|
354
|
+
/* High water mark at or above current data, but below current data
|
355
|
+
* plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
|
356
|
+
* to end of window, whichever is less.
|
357
|
+
*/
|
358
|
+
init = (ulg)curr + WIN_INIT - s->high_water;
|
359
|
+
if (init > s->window_size - s->high_water)
|
360
|
+
init = s->window_size - s->high_water;
|
361
|
+
zmemzero(s->window + s->high_water, (unsigned)init);
|
362
|
+
s->high_water += init;
|
363
|
+
}
|
364
|
+
}
|
365
|
+
|
366
|
+
Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
|
367
|
+
"not enough room for search");
|
368
|
+
}
|
369
|
+
|
235
370
|
/* ========================================================================= */
|
236
|
-
int ZEXPORT deflateInit_(strm, level, version,
|
237
|
-
|
238
|
-
int level;
|
239
|
-
const char *version;
|
240
|
-
int stream_size;
|
241
|
-
{
|
371
|
+
int ZEXPORT deflateInit_(z_streamp strm, int level, const char *version,
|
372
|
+
int stream_size) {
|
242
373
|
return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
|
243
374
|
Z_DEFAULT_STRATEGY, version, stream_size);
|
244
375
|
/* To do: ignore strm->next_in if we use it as window */
|
245
376
|
}
|
246
377
|
|
247
378
|
/* ========================================================================= */
|
248
|
-
int ZEXPORT deflateInit2_(strm, level, method,
|
249
|
-
|
250
|
-
|
251
|
-
int level;
|
252
|
-
int method;
|
253
|
-
int windowBits;
|
254
|
-
int memLevel;
|
255
|
-
int strategy;
|
256
|
-
const char *version;
|
257
|
-
int stream_size;
|
258
|
-
{
|
379
|
+
int ZEXPORT deflateInit2_(z_streamp strm, int level, int method,
|
380
|
+
int windowBits, int memLevel, int strategy,
|
381
|
+
const char *version, int stream_size) {
|
259
382
|
deflate_state *s;
|
260
383
|
int wrap = 1;
|
261
384
|
static const char my_version[] = ZLIB_VERSION;
|
@@ -290,6 +413,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|
290
413
|
|
291
414
|
if (windowBits < 0) { /* suppress zlib wrapper */
|
292
415
|
wrap = 0;
|
416
|
+
if (windowBits < -15)
|
417
|
+
return Z_STREAM_ERROR;
|
293
418
|
windowBits = -windowBits;
|
294
419
|
}
|
295
420
|
#ifdef GZIP
|
@@ -319,7 +444,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|
319
444
|
s->hash_bits = (uInt)memLevel + 7;
|
320
445
|
s->hash_size = 1 << s->hash_bits;
|
321
446
|
s->hash_mask = s->hash_size - 1;
|
322
|
-
s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
|
447
|
+
s->hash_shift = ((s->hash_bits + MIN_MATCH-1) / MIN_MATCH);
|
323
448
|
|
324
449
|
s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
|
325
450
|
s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
|
@@ -345,11 +470,11 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|
345
470
|
* sym_buf value to read moves forward three bytes. From that symbol, up to
|
346
471
|
* 31 bits are written to pending_buf. The closest the written pending_buf
|
347
472
|
* bits gets to the next sym_buf symbol to read is just before the last
|
348
|
-
* code is written. At that time, 31*(n-2) bits have been written, just
|
349
|
-
* after 24*(n-2) bits have been consumed from sym_buf. sym_buf starts at
|
350
|
-
* 8*n bits into pending_buf. (Note that the symbol buffer fills when n-1
|
473
|
+
* code is written. At that time, 31*(n - 2) bits have been written, just
|
474
|
+
* after 24*(n - 2) bits have been consumed from sym_buf. sym_buf starts at
|
475
|
+
* 8*n bits into pending_buf. (Note that the symbol buffer fills when n - 1
|
351
476
|
* symbols are written.) The closest the writing gets to what is unread is
|
352
|
-
* then n+14 bits. Here n is lit_bufsize, which is 16384 by default, and
|
477
|
+
* then n + 14 bits. Here n is lit_bufsize, which is 16384 by default, and
|
353
478
|
* can range from 128 to 32768.
|
354
479
|
*
|
355
480
|
* Therefore, at a minimum, there are 142 bits of space between what is
|
@@ -368,7 +493,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|
368
493
|
* symbols from which it is being constructed.
|
369
494
|
*/
|
370
495
|
|
371
|
-
s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize,
|
496
|
+
s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, LIT_BUFS);
|
372
497
|
s->pending_buf_size = (ulg)s->lit_bufsize * 4;
|
373
498
|
|
374
499
|
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
|
@@ -378,8 +503,14 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|
378
503
|
deflateEnd (strm);
|
379
504
|
return Z_MEM_ERROR;
|
380
505
|
}
|
506
|
+
#ifdef LIT_MEM
|
507
|
+
s->d_buf = (ushf *)(s->pending_buf + (s->lit_bufsize << 1));
|
508
|
+
s->l_buf = s->pending_buf + (s->lit_bufsize << 2);
|
509
|
+
s->sym_end = s->lit_bufsize - 1;
|
510
|
+
#else
|
381
511
|
s->sym_buf = s->pending_buf + s->lit_bufsize;
|
382
512
|
s->sym_end = (s->lit_bufsize - 1) * 3;
|
513
|
+
#endif
|
383
514
|
/* We avoid equality with lit_bufsize*3 because of wraparound at 64K
|
384
515
|
* on 16 bit machines and because stored blocks are restricted to
|
385
516
|
* 64K-1 bytes.
|
@@ -395,9 +526,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|
395
526
|
/* =========================================================================
|
396
527
|
* Check for a valid deflate stream state. Return 0 if ok, 1 if not.
|
397
528
|
*/
|
398
|
-
local int deflateStateCheck
|
399
|
-
z_streamp strm;
|
400
|
-
{
|
529
|
+
local int deflateStateCheck(z_streamp strm) {
|
401
530
|
deflate_state *s;
|
402
531
|
if (strm == Z_NULL ||
|
403
532
|
strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
|
@@ -418,11 +547,8 @@ local int deflateStateCheck (strm)
|
|
418
547
|
}
|
419
548
|
|
420
549
|
/* ========================================================================= */
|
421
|
-
int ZEXPORT deflateSetDictionary
|
422
|
-
|
423
|
-
const Bytef *dictionary;
|
424
|
-
uInt dictLength;
|
425
|
-
{
|
550
|
+
int ZEXPORT deflateSetDictionary(z_streamp strm, const Bytef *dictionary,
|
551
|
+
uInt dictLength) {
|
426
552
|
deflate_state *s;
|
427
553
|
uInt str, n;
|
428
554
|
int wrap;
|
@@ -487,11 +613,8 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
|
|
487
613
|
}
|
488
614
|
|
489
615
|
/* ========================================================================= */
|
490
|
-
int ZEXPORT deflateGetDictionary
|
491
|
-
|
492
|
-
Bytef *dictionary;
|
493
|
-
uInt *dictLength;
|
494
|
-
{
|
616
|
+
int ZEXPORT deflateGetDictionary(z_streamp strm, Bytef *dictionary,
|
617
|
+
uInt *dictLength) {
|
495
618
|
deflate_state *s;
|
496
619
|
uInt len;
|
497
620
|
|
@@ -509,9 +632,7 @@ int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength)
|
|
509
632
|
}
|
510
633
|
|
511
634
|
/* ========================================================================= */
|
512
|
-
int ZEXPORT deflateResetKeep
|
513
|
-
z_streamp strm;
|
514
|
-
{
|
635
|
+
int ZEXPORT deflateResetKeep(z_streamp strm) {
|
515
636
|
deflate_state *s;
|
516
637
|
|
517
638
|
if (deflateStateCheck(strm)) {
|
@@ -546,10 +667,32 @@ int ZEXPORT deflateResetKeep (strm)
|
|
546
667
|
return Z_OK;
|
547
668
|
}
|
548
669
|
|
670
|
+
/* ===========================================================================
|
671
|
+
* Initialize the "longest match" routines for a new zlib stream
|
672
|
+
*/
|
673
|
+
local void lm_init(deflate_state *s) {
|
674
|
+
s->window_size = (ulg)2L*s->w_size;
|
675
|
+
|
676
|
+
CLEAR_HASH(s);
|
677
|
+
|
678
|
+
/* Set the default configuration parameters:
|
679
|
+
*/
|
680
|
+
s->max_lazy_match = configuration_table[s->level].max_lazy;
|
681
|
+
s->good_match = configuration_table[s->level].good_length;
|
682
|
+
s->nice_match = configuration_table[s->level].nice_length;
|
683
|
+
s->max_chain_length = configuration_table[s->level].max_chain;
|
684
|
+
|
685
|
+
s->strstart = 0;
|
686
|
+
s->block_start = 0L;
|
687
|
+
s->lookahead = 0;
|
688
|
+
s->insert = 0;
|
689
|
+
s->match_length = s->prev_length = MIN_MATCH-1;
|
690
|
+
s->match_available = 0;
|
691
|
+
s->ins_h = 0;
|
692
|
+
}
|
693
|
+
|
549
694
|
/* ========================================================================= */
|
550
|
-
int ZEXPORT deflateReset
|
551
|
-
z_streamp strm;
|
552
|
-
{
|
695
|
+
int ZEXPORT deflateReset(z_streamp strm) {
|
553
696
|
int ret;
|
554
697
|
|
555
698
|
ret = deflateResetKeep(strm);
|
@@ -559,10 +702,7 @@ int ZEXPORT deflateReset (strm)
|
|
559
702
|
}
|
560
703
|
|
561
704
|
/* ========================================================================= */
|
562
|
-
int ZEXPORT deflateSetHeader
|
563
|
-
z_streamp strm;
|
564
|
-
gz_headerp head;
|
565
|
-
{
|
705
|
+
int ZEXPORT deflateSetHeader(z_streamp strm, gz_headerp head) {
|
566
706
|
if (deflateStateCheck(strm) || strm->state->wrap != 2)
|
567
707
|
return Z_STREAM_ERROR;
|
568
708
|
strm->state->gzhead = head;
|
@@ -570,11 +710,7 @@ int ZEXPORT deflateSetHeader (strm, head)
|
|
570
710
|
}
|
571
711
|
|
572
712
|
/* ========================================================================= */
|
573
|
-
int ZEXPORT deflatePending
|
574
|
-
unsigned *pending;
|
575
|
-
int *bits;
|
576
|
-
z_streamp strm;
|
577
|
-
{
|
713
|
+
int ZEXPORT deflatePending(z_streamp strm, unsigned *pending, int *bits) {
|
578
714
|
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
|
579
715
|
if (pending != Z_NULL)
|
580
716
|
*pending = strm->state->pending;
|
@@ -584,19 +720,21 @@ int ZEXPORT deflatePending (strm, pending, bits)
|
|
584
720
|
}
|
585
721
|
|
586
722
|
/* ========================================================================= */
|
587
|
-
int ZEXPORT deflatePrime
|
588
|
-
z_streamp strm;
|
589
|
-
int bits;
|
590
|
-
int value;
|
591
|
-
{
|
723
|
+
int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) {
|
592
724
|
deflate_state *s;
|
593
725
|
int put;
|
594
726
|
|
595
727
|
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
|
596
728
|
s = strm->state;
|
729
|
+
#ifdef LIT_MEM
|
730
|
+
if (bits < 0 || bits > 16 ||
|
731
|
+
(uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3))
|
732
|
+
return Z_BUF_ERROR;
|
733
|
+
#else
|
597
734
|
if (bits < 0 || bits > 16 ||
|
598
735
|
s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
|
599
736
|
return Z_BUF_ERROR;
|
737
|
+
#endif
|
600
738
|
do {
|
601
739
|
put = Buf_size - s->bi_valid;
|
602
740
|
if (put > bits)
|
@@ -611,11 +749,7 @@ int ZEXPORT deflatePrime (strm, bits, value)
|
|
611
749
|
}
|
612
750
|
|
613
751
|
/* ========================================================================= */
|
614
|
-
int ZEXPORT deflateParams(strm, level, strategy)
|
615
|
-
z_streamp strm;
|
616
|
-
int level;
|
617
|
-
int strategy;
|
618
|
-
{
|
752
|
+
int ZEXPORT deflateParams(z_streamp strm, int level, int strategy) {
|
619
753
|
deflate_state *s;
|
620
754
|
compress_func func;
|
621
755
|
|
@@ -660,13 +794,8 @@ int ZEXPORT deflateParams(strm, level, strategy)
|
|
660
794
|
}
|
661
795
|
|
662
796
|
/* ========================================================================= */
|
663
|
-
int ZEXPORT deflateTune(strm, good_length, max_lazy,
|
664
|
-
|
665
|
-
int good_length;
|
666
|
-
int max_lazy;
|
667
|
-
int nice_length;
|
668
|
-
int max_chain;
|
669
|
-
{
|
797
|
+
int ZEXPORT deflateTune(z_streamp strm, int good_length, int max_lazy,
|
798
|
+
int nice_length, int max_chain) {
|
670
799
|
deflate_state *s;
|
671
800
|
|
672
801
|
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
|
@@ -679,36 +808,47 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
|
|
679
808
|
}
|
680
809
|
|
681
810
|
/* =========================================================================
|
682
|
-
* For the default windowBits of 15 and memLevel of 8, this function returns
|
683
|
-
*
|
684
|
-
*
|
685
|
-
*
|
686
|
-
*
|
811
|
+
* For the default windowBits of 15 and memLevel of 8, this function returns a
|
812
|
+
* close to exact, as well as small, upper bound on the compressed size. This
|
813
|
+
* is an expansion of ~0.03%, plus a small constant.
|
814
|
+
*
|
815
|
+
* For any setting other than those defaults for windowBits and memLevel, one
|
816
|
+
* of two worst case bounds is returned. This is at most an expansion of ~4% or
|
817
|
+
* ~13%, plus a small constant.
|
818
|
+
*
|
819
|
+
* Both the 0.03% and 4% derive from the overhead of stored blocks. The first
|
820
|
+
* one is for stored blocks of 16383 bytes (memLevel == 8), whereas the second
|
821
|
+
* is for stored blocks of 127 bytes (the worst case memLevel == 1). The
|
822
|
+
* expansion results from five bytes of header for each stored block.
|
687
823
|
*
|
688
|
-
*
|
689
|
-
* the
|
690
|
-
*
|
691
|
-
*
|
824
|
+
* The larger expansion of 13% results from a window size less than or equal to
|
825
|
+
* the symbols buffer size (windowBits <= memLevel + 7). In that case some of
|
826
|
+
* the data being compressed may have slid out of the sliding window, impeding
|
827
|
+
* a stored block from being emitted. Then the only choice is a fixed or
|
828
|
+
* dynamic block, where a fixed block limits the maximum expansion to 9 bits
|
829
|
+
* per 8-bit byte, plus 10 bits for every block. The smallest block size for
|
830
|
+
* which this can occur is 255 (memLevel == 2).
|
692
831
|
*
|
693
|
-
*
|
694
|
-
* every combination of windowBits and memLevel. But even the conservative
|
695
|
-
* upper bound of about 14% expansion does not seem onerous for output buffer
|
696
|
-
* allocation.
|
832
|
+
* Shifts are used to approximate divisions, for speed.
|
697
833
|
*/
|
698
|
-
uLong ZEXPORT deflateBound(strm, sourceLen)
|
699
|
-
z_streamp strm;
|
700
|
-
uLong sourceLen;
|
701
|
-
{
|
834
|
+
uLong ZEXPORT deflateBound(z_streamp strm, uLong sourceLen) {
|
702
835
|
deflate_state *s;
|
703
|
-
uLong
|
836
|
+
uLong fixedlen, storelen, wraplen;
|
704
837
|
|
705
|
-
/*
|
706
|
-
|
707
|
-
|
838
|
+
/* upper bound for fixed blocks with 9-bit literals and length 255
|
839
|
+
(memLevel == 2, which is the lowest that may not use stored blocks) --
|
840
|
+
~13% overhead plus a small constant */
|
841
|
+
fixedlen = sourceLen + (sourceLen >> 3) + (sourceLen >> 8) +
|
842
|
+
(sourceLen >> 9) + 4;
|
708
843
|
|
709
|
-
/*
|
844
|
+
/* upper bound for stored blocks with length 127 (memLevel == 1) --
|
845
|
+
~4% overhead plus a small constant */
|
846
|
+
storelen = sourceLen + (sourceLen >> 5) + (sourceLen >> 7) +
|
847
|
+
(sourceLen >> 11) + 7;
|
848
|
+
|
849
|
+
/* if can't get parameters, return larger bound plus a zlib wrapper */
|
710
850
|
if (deflateStateCheck(strm))
|
711
|
-
return
|
851
|
+
return (fixedlen > storelen ? fixedlen : storelen) + 6;
|
712
852
|
|
713
853
|
/* compute wrapper length */
|
714
854
|
s = strm->state;
|
@@ -745,11 +885,13 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
|
|
745
885
|
wraplen = 6;
|
746
886
|
}
|
747
887
|
|
748
|
-
/* if not default parameters, return conservative
|
888
|
+
/* if not default parameters, return one of the conservative bounds */
|
749
889
|
if (s->w_bits != 15 || s->hash_bits != 8 + 7)
|
750
|
-
return
|
890
|
+
return (s->w_bits <= s->hash_bits && s->level ? fixedlen : storelen) +
|
891
|
+
wraplen;
|
751
892
|
|
752
|
-
/* default settings: return tight bound for that case
|
893
|
+
/* default settings: return tight bound for that case -- ~0.03% overhead
|
894
|
+
plus a small constant */
|
753
895
|
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
|
754
896
|
(sourceLen >> 25) + 13 - 6 + wraplen;
|
755
897
|
}
|
@@ -759,10 +901,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
|
|
759
901
|
* IN assertion: the stream state is correct and there is enough room in
|
760
902
|
* pending_buf.
|
761
903
|
*/
|
762
|
-
local void putShortMSB
|
763
|
-
deflate_state *s;
|
764
|
-
uInt b;
|
765
|
-
{
|
904
|
+
local void putShortMSB(deflate_state *s, uInt b) {
|
766
905
|
put_byte(s, (Byte)(b >> 8));
|
767
906
|
put_byte(s, (Byte)(b & 0xff));
|
768
907
|
}
|
@@ -773,9 +912,7 @@ local void putShortMSB (s, b)
|
|
773
912
|
* applications may wish to modify it to avoid allocating a large
|
774
913
|
* strm->next_out buffer and copying into it. (See also read_buf()).
|
775
914
|
*/
|
776
|
-
local void flush_pending(strm)
|
777
|
-
z_streamp strm;
|
778
|
-
{
|
915
|
+
local void flush_pending(z_streamp strm) {
|
779
916
|
unsigned len;
|
780
917
|
deflate_state *s = strm->state;
|
781
918
|
|
@@ -806,10 +943,7 @@ local void flush_pending(strm)
|
|
806
943
|
} while (0)
|
807
944
|
|
808
945
|
/* ========================================================================= */
|
809
|
-
int ZEXPORT deflate
|
810
|
-
z_streamp strm;
|
811
|
-
int flush;
|
812
|
-
{
|
946
|
+
int ZEXPORT deflate(z_streamp strm, int flush) {
|
813
947
|
int old_flush; /* value of flush param for previous deflate call */
|
814
948
|
deflate_state *s;
|
815
949
|
|
@@ -861,7 +995,7 @@ int ZEXPORT deflate (strm, flush)
|
|
861
995
|
s->status = BUSY_STATE;
|
862
996
|
if (s->status == INIT_STATE) {
|
863
997
|
/* zlib header */
|
864
|
-
uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
|
998
|
+
uInt header = (Z_DEFLATED + ((s->w_bits - 8) << 4)) << 8;
|
865
999
|
uInt level_flags;
|
866
1000
|
|
867
1001
|
if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
|
@@ -1121,9 +1255,7 @@ int ZEXPORT deflate (strm, flush)
|
|
1121
1255
|
}
|
1122
1256
|
|
1123
1257
|
/* ========================================================================= */
|
1124
|
-
int ZEXPORT deflateEnd
|
1125
|
-
z_streamp strm;
|
1126
|
-
{
|
1258
|
+
int ZEXPORT deflateEnd(z_streamp strm) {
|
1127
1259
|
int status;
|
1128
1260
|
|
1129
1261
|
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
|
@@ -1147,11 +1279,10 @@ int ZEXPORT deflateEnd (strm)
|
|
1147
1279
|
* To simplify the source, this is not supported for 16-bit MSDOS (which
|
1148
1280
|
* doesn't have enough memory anyway to duplicate compression states).
|
1149
1281
|
*/
|
1150
|
-
int ZEXPORT deflateCopy
|
1151
|
-
z_streamp dest;
|
1152
|
-
z_streamp source;
|
1153
|
-
{
|
1282
|
+
int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {
|
1154
1283
|
#ifdef MAXSEG_64K
|
1284
|
+
(void)dest;
|
1285
|
+
(void)source;
|
1155
1286
|
return Z_STREAM_ERROR;
|
1156
1287
|
#else
|
1157
1288
|
deflate_state *ds;
|
@@ -1175,7 +1306,7 @@ int ZEXPORT deflateCopy (dest, source)
|
|
1175
1306
|
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
|
1176
1307
|
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
|
1177
1308
|
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
|
1178
|
-
ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize,
|
1309
|
+
ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, LIT_BUFS);
|
1179
1310
|
|
1180
1311
|
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
|
1181
1312
|
ds->pending_buf == Z_NULL) {
|
@@ -1186,10 +1317,15 @@ int ZEXPORT deflateCopy (dest, source)
|
|
1186
1317
|
zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
|
1187
1318
|
zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos));
|
1188
1319
|
zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos));
|
1189
|
-
zmemcpy(ds->pending_buf, ss->pending_buf,
|
1320
|
+
zmemcpy(ds->pending_buf, ss->pending_buf, ds->lit_bufsize * LIT_BUFS);
|
1190
1321
|
|
1191
1322
|
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
|
1323
|
+
#ifdef LIT_MEM
|
1324
|
+
ds->d_buf = (ushf *)(ds->pending_buf + (ds->lit_bufsize << 1));
|
1325
|
+
ds->l_buf = ds->pending_buf + (ds->lit_bufsize << 2);
|
1326
|
+
#else
|
1192
1327
|
ds->sym_buf = ds->pending_buf + ds->lit_bufsize;
|
1328
|
+
#endif
|
1193
1329
|
|
1194
1330
|
ds->l_desc.dyn_tree = ds->dyn_ltree;
|
1195
1331
|
ds->d_desc.dyn_tree = ds->dyn_dtree;
|
@@ -1199,71 +1335,6 @@ int ZEXPORT deflateCopy (dest, source)
|
|
1199
1335
|
#endif /* MAXSEG_64K */
|
1200
1336
|
}
|
1201
1337
|
|
1202
|
-
/* ===========================================================================
|
1203
|
-
* Read a new buffer from the current input stream, update the adler32
|
1204
|
-
* and total number of bytes read. All deflate() input goes through
|
1205
|
-
* this function so some applications may wish to modify it to avoid
|
1206
|
-
* allocating a large strm->next_in buffer and copying from it.
|
1207
|
-
* (See also flush_pending()).
|
1208
|
-
*/
|
1209
|
-
local unsigned read_buf(strm, buf, size)
|
1210
|
-
z_streamp strm;
|
1211
|
-
Bytef *buf;
|
1212
|
-
unsigned size;
|
1213
|
-
{
|
1214
|
-
unsigned len = strm->avail_in;
|
1215
|
-
|
1216
|
-
if (len > size) len = size;
|
1217
|
-
if (len == 0) return 0;
|
1218
|
-
|
1219
|
-
strm->avail_in -= len;
|
1220
|
-
|
1221
|
-
zmemcpy(buf, strm->next_in, len);
|
1222
|
-
if (strm->state->wrap == 1) {
|
1223
|
-
strm->adler = adler32(strm->adler, buf, len);
|
1224
|
-
}
|
1225
|
-
#ifdef GZIP
|
1226
|
-
else if (strm->state->wrap == 2) {
|
1227
|
-
strm->adler = crc32(strm->adler, buf, len);
|
1228
|
-
}
|
1229
|
-
#endif
|
1230
|
-
strm->next_in += len;
|
1231
|
-
strm->total_in += len;
|
1232
|
-
|
1233
|
-
return len;
|
1234
|
-
}
|
1235
|
-
|
1236
|
-
/* ===========================================================================
|
1237
|
-
* Initialize the "longest match" routines for a new zlib stream
|
1238
|
-
*/
|
1239
|
-
local void lm_init (s)
|
1240
|
-
deflate_state *s;
|
1241
|
-
{
|
1242
|
-
s->window_size = (ulg)2L*s->w_size;
|
1243
|
-
|
1244
|
-
CLEAR_HASH(s);
|
1245
|
-
|
1246
|
-
/* Set the default configuration parameters:
|
1247
|
-
*/
|
1248
|
-
s->max_lazy_match = configuration_table[s->level].max_lazy;
|
1249
|
-
s->good_match = configuration_table[s->level].good_length;
|
1250
|
-
s->nice_match = configuration_table[s->level].nice_length;
|
1251
|
-
s->max_chain_length = configuration_table[s->level].max_chain;
|
1252
|
-
|
1253
|
-
s->strstart = 0;
|
1254
|
-
s->block_start = 0L;
|
1255
|
-
s->lookahead = 0;
|
1256
|
-
s->insert = 0;
|
1257
|
-
s->match_length = s->prev_length = MIN_MATCH-1;
|
1258
|
-
s->match_available = 0;
|
1259
|
-
s->ins_h = 0;
|
1260
|
-
#ifndef FASTEST
|
1261
|
-
#ifdef ASMV
|
1262
|
-
match_init(); /* initialize the asm code */
|
1263
|
-
#endif
|
1264
|
-
#endif
|
1265
|
-
}
|
1266
|
-
|
1267
1338
|
#ifndef FASTEST
|
1268
1339
|
/* ===========================================================================
|
1269
1340
|
* Set match_start to the longest match starting at the given string and
|
@@ -1274,14 +1345,7 @@ local void lm_init (s)
|
|
1274
1345
|
* string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
|
1275
1346
|
* OUT assertion: the match length is not greater than s->lookahead.
|
1276
1347
|
*/
|
1277
|
-
|
1278
|
-
/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
|
1279
|
-
* match.S. The code will be functionally equivalent.
|
1280
|
-
*/
|
1281
|
-
local uInt longest_match(s, cur_match)
|
1282
|
-
deflate_state *s;
|
1283
|
-
IPos cur_match; /* current match */
|
1284
|
-
{
|
1348
|
+
local uInt longest_match(deflate_state *s, IPos cur_match) {
|
1285
1349
|
unsigned chain_length = s->max_chain_length;/* max hash chain length */
|
1286
1350
|
register Bytef *scan = s->window + s->strstart; /* current string */
|
1287
1351
|
register Bytef *match; /* matched string */
|
@@ -1302,10 +1366,10 @@ local uInt longest_match(s, cur_match)
|
|
1302
1366
|
*/
|
1303
1367
|
register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
|
1304
1368
|
register ush scan_start = *(ushf*)scan;
|
1305
|
-
register ush scan_end = *(ushf*)(scan+best_len-1);
|
1369
|
+
register ush scan_end = *(ushf*)(scan + best_len - 1);
|
1306
1370
|
#else
|
1307
1371
|
register Bytef *strend = s->window + s->strstart + MAX_MATCH;
|
1308
|
-
register Byte scan_end1 = scan[best_len-1];
|
1372
|
+
register Byte scan_end1 = scan[best_len - 1];
|
1309
1373
|
register Byte scan_end = scan[best_len];
|
1310
1374
|
#endif
|
1311
1375
|
|
@@ -1323,7 +1387,8 @@ local uInt longest_match(s, cur_match)
|
|
1323
1387
|
*/
|
1324
1388
|
if ((uInt)nice_match > s->lookahead) nice_match = (int)s->lookahead;
|
1325
1389
|
|
1326
|
-
Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD,
|
1390
|
+
Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
|
1391
|
+
"need lookahead");
|
1327
1392
|
|
1328
1393
|
do {
|
1329
1394
|
Assert(cur_match < s->strstart, "no future");
|
@@ -1341,43 +1406,44 @@ local uInt longest_match(s, cur_match)
|
|
1341
1406
|
/* This code assumes sizeof(unsigned short) == 2. Do not use
|
1342
1407
|
* UNALIGNED_OK if your compiler uses a different size.
|
1343
1408
|
*/
|
1344
|
-
if (*(ushf*)(match+best_len-1) != scan_end ||
|
1409
|
+
if (*(ushf*)(match + best_len - 1) != scan_end ||
|
1345
1410
|
*(ushf*)match != scan_start) continue;
|
1346
1411
|
|
1347
1412
|
/* It is not necessary to compare scan[2] and match[2] since they are
|
1348
1413
|
* always equal when the other bytes match, given that the hash keys
|
1349
1414
|
* are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
|
1350
|
-
* strstart+3, +5,
|
1415
|
+
* strstart + 3, + 5, up to strstart + 257. We check for insufficient
|
1351
1416
|
* lookahead only every 4th comparison; the 128th check will be made
|
1352
|
-
* at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
|
1417
|
+
* at strstart + 257. If MAX_MATCH-2 is not a multiple of 8, it is
|
1353
1418
|
* necessary to put more guard bytes at the end of the window, or
|
1354
1419
|
* to check more often for insufficient lookahead.
|
1355
1420
|
*/
|
1356
1421
|
Assert(scan[2] == match[2], "scan[2]?");
|
1357
1422
|
scan++, match++;
|
1358
1423
|
do {
|
1359
|
-
} while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
|
1360
|
-
*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
|
1361
|
-
*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
|
1362
|
-
*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
|
1424
|
+
} while (*(ushf*)(scan += 2) == *(ushf*)(match += 2) &&
|
1425
|
+
*(ushf*)(scan += 2) == *(ushf*)(match += 2) &&
|
1426
|
+
*(ushf*)(scan += 2) == *(ushf*)(match += 2) &&
|
1427
|
+
*(ushf*)(scan += 2) == *(ushf*)(match += 2) &&
|
1363
1428
|
scan < strend);
|
1364
1429
|
/* The funny "do {}" generates better code on most compilers */
|
1365
1430
|
|
1366
|
-
/* Here, scan <= window+strstart+257 */
|
1367
|
-
Assert(scan <= s->window+(unsigned)(s->window_size-1),
|
1431
|
+
/* Here, scan <= window + strstart + 257 */
|
1432
|
+
Assert(scan <= s->window + (unsigned)(s->window_size - 1),
|
1433
|
+
"wild scan");
|
1368
1434
|
if (*scan == *match) scan++;
|
1369
1435
|
|
1370
|
-
len = (MAX_MATCH - 1) - (int)(strend-scan);
|
1436
|
+
len = (MAX_MATCH - 1) - (int)(strend - scan);
|
1371
1437
|
scan = strend - (MAX_MATCH-1);
|
1372
1438
|
|
1373
1439
|
#else /* UNALIGNED_OK */
|
1374
1440
|
|
1375
|
-
if (match[best_len]
|
1376
|
-
match[best_len-1] != scan_end1 ||
|
1377
|
-
*match
|
1378
|
-
*++match
|
1441
|
+
if (match[best_len] != scan_end ||
|
1442
|
+
match[best_len - 1] != scan_end1 ||
|
1443
|
+
*match != *scan ||
|
1444
|
+
*++match != scan[1]) continue;
|
1379
1445
|
|
1380
|
-
/* The check at best_len-1 can be removed because it will be made
|
1446
|
+
/* The check at best_len - 1 can be removed because it will be made
|
1381
1447
|
* again later. (This heuristic is not always a win.)
|
1382
1448
|
* It is not necessary to compare scan[2] and match[2] since they
|
1383
1449
|
* are always equal when the other bytes match, given that
|
@@ -1387,7 +1453,7 @@ local uInt longest_match(s, cur_match)
|
|
1387
1453
|
Assert(*scan == *match, "match[2]?");
|
1388
1454
|
|
1389
1455
|
/* We check for insufficient lookahead only every 8th comparison;
|
1390
|
-
* the 256th check will be made at strstart+258.
|
1456
|
+
* the 256th check will be made at strstart + 258.
|
1391
1457
|
*/
|
1392
1458
|
do {
|
1393
1459
|
} while (*++scan == *++match && *++scan == *++match &&
|
@@ -1396,7 +1462,8 @@ local uInt longest_match(s, cur_match)
|
|
1396
1462
|
*++scan == *++match && *++scan == *++match &&
|
1397
1463
|
scan < strend);
|
1398
1464
|
|
1399
|
-
Assert(scan <= s->window+(unsigned)(s->window_size-1),
|
1465
|
+
Assert(scan <= s->window + (unsigned)(s->window_size - 1),
|
1466
|
+
"wild scan");
|
1400
1467
|
|
1401
1468
|
len = MAX_MATCH - (int)(strend - scan);
|
1402
1469
|
scan = strend - MAX_MATCH;
|
@@ -1408,9 +1475,9 @@ local uInt longest_match(s, cur_match)
|
|
1408
1475
|
best_len = len;
|
1409
1476
|
if (len >= nice_match) break;
|
1410
1477
|
#ifdef UNALIGNED_OK
|
1411
|
-
scan_end = *(ushf*)(scan+best_len-1);
|
1478
|
+
scan_end = *(ushf*)(scan + best_len - 1);
|
1412
1479
|
#else
|
1413
|
-
scan_end1 = scan[best_len-1];
|
1480
|
+
scan_end1 = scan[best_len - 1];
|
1414
1481
|
scan_end = scan[best_len];
|
1415
1482
|
#endif
|
1416
1483
|
}
|
@@ -1420,17 +1487,13 @@ local uInt longest_match(s, cur_match)
|
|
1420
1487
|
if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
|
1421
1488
|
return s->lookahead;
|
1422
1489
|
}
|
1423
|
-
#endif /* ASMV */
|
1424
1490
|
|
1425
1491
|
#else /* FASTEST */
|
1426
1492
|
|
1427
1493
|
/* ---------------------------------------------------------------------------
|
1428
1494
|
* Optimized version for FASTEST only
|
1429
1495
|
*/
|
1430
|
-
local uInt longest_match(s, cur_match)
|
1431
|
-
deflate_state *s;
|
1432
|
-
IPos cur_match; /* current match */
|
1433
|
-
{
|
1496
|
+
local uInt longest_match(deflate_state *s, IPos cur_match) {
|
1434
1497
|
register Bytef *scan = s->window + s->strstart; /* current string */
|
1435
1498
|
register Bytef *match; /* matched string */
|
1436
1499
|
register int len; /* length of current match */
|
@@ -1441,7 +1504,8 @@ local uInt longest_match(s, cur_match)
|
|
1441
1504
|
*/
|
1442
1505
|
Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
|
1443
1506
|
|
1444
|
-
Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD,
|
1507
|
+
Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
|
1508
|
+
"need lookahead");
|
1445
1509
|
|
1446
1510
|
Assert(cur_match < s->strstart, "no future");
|
1447
1511
|
|
@@ -1451,7 +1515,7 @@ local uInt longest_match(s, cur_match)
|
|
1451
1515
|
*/
|
1452
1516
|
if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
|
1453
1517
|
|
1454
|
-
/* The check at best_len-1 can be removed because it will be made
|
1518
|
+
/* The check at best_len - 1 can be removed because it will be made
|
1455
1519
|
* again later. (This heuristic is not always a win.)
|
1456
1520
|
* It is not necessary to compare scan[2] and match[2] since they
|
1457
1521
|
* are always equal when the other bytes match, given that
|
@@ -1461,7 +1525,7 @@ local uInt longest_match(s, cur_match)
|
|
1461
1525
|
Assert(*scan == *match, "match[2]?");
|
1462
1526
|
|
1463
1527
|
/* We check for insufficient lookahead only every 8th comparison;
|
1464
|
-
* the 256th check will be made at strstart+258.
|
1528
|
+
* the 256th check will be made at strstart + 258.
|
1465
1529
|
*/
|
1466
1530
|
do {
|
1467
1531
|
} while (*++scan == *++match && *++scan == *++match &&
|
@@ -1470,7 +1534,7 @@ local uInt longest_match(s, cur_match)
|
|
1470
1534
|
*++scan == *++match && *++scan == *++match &&
|
1471
1535
|
scan < strend);
|
1472
1536
|
|
1473
|
-
Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
|
1537
|
+
Assert(scan <= s->window + (unsigned)(s->window_size - 1), "wild scan");
|
1474
1538
|
|
1475
1539
|
len = MAX_MATCH - (int)(strend - scan);
|
1476
1540
|
|
@@ -1490,23 +1554,27 @@ local uInt longest_match(s, cur_match)
|
|
1490
1554
|
/* ===========================================================================
|
1491
1555
|
* Check that the match at match_start is indeed a match.
|
1492
1556
|
*/
|
1493
|
-
local void check_match(s, start, match, length)
|
1494
|
-
deflate_state *s;
|
1495
|
-
IPos start, match;
|
1496
|
-
int length;
|
1497
|
-
{
|
1557
|
+
local void check_match(deflate_state *s, IPos start, IPos match, int length) {
|
1498
1558
|
/* check that the match is indeed a match */
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1559
|
+
Bytef *back = s->window + (int)match, *here = s->window + start;
|
1560
|
+
IPos len = length;
|
1561
|
+
if (match == (IPos)-1) {
|
1562
|
+
/* match starts one byte before the current window -- just compare the
|
1563
|
+
subsequent length-1 bytes */
|
1564
|
+
back++;
|
1565
|
+
here++;
|
1566
|
+
len--;
|
1567
|
+
}
|
1568
|
+
if (zmemcmp(back, here, len) != EQUAL) {
|
1569
|
+
fprintf(stderr, " start %u, match %d, length %d\n",
|
1570
|
+
start, (int)match, length);
|
1503
1571
|
do {
|
1504
|
-
fprintf(stderr, "%
|
1505
|
-
} while (--
|
1572
|
+
fprintf(stderr, "(%02x %02x)", *back++, *here++);
|
1573
|
+
} while (--len != 0);
|
1506
1574
|
z_error("invalid match");
|
1507
1575
|
}
|
1508
1576
|
if (z_verbose > 1) {
|
1509
|
-
fprintf(stderr,"\\[%d,%d]", start-match, length);
|
1577
|
+
fprintf(stderr,"\\[%d,%d]", start - match, length);
|
1510
1578
|
do { putc(s->window[start++], stderr); } while (--length != 0);
|
1511
1579
|
}
|
1512
1580
|
}
|
@@ -1514,137 +1582,6 @@ local void check_match(s, start, match, length)
|
|
1514
1582
|
# define check_match(s, start, match, length)
|
1515
1583
|
#endif /* ZLIB_DEBUG */
|
1516
1584
|
|
1517
|
-
/* ===========================================================================
|
1518
|
-
* Fill the window when the lookahead becomes insufficient.
|
1519
|
-
* Updates strstart and lookahead.
|
1520
|
-
*
|
1521
|
-
* IN assertion: lookahead < MIN_LOOKAHEAD
|
1522
|
-
* OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
|
1523
|
-
* At least one byte has been read, or avail_in == 0; reads are
|
1524
|
-
* performed for at least two bytes (required for the zip translate_eol
|
1525
|
-
* option -- not supported here).
|
1526
|
-
*/
|
1527
|
-
local void fill_window(s)
|
1528
|
-
deflate_state *s;
|
1529
|
-
{
|
1530
|
-
unsigned n;
|
1531
|
-
unsigned more; /* Amount of free space at the end of the window. */
|
1532
|
-
uInt wsize = s->w_size;
|
1533
|
-
|
1534
|
-
Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
|
1535
|
-
|
1536
|
-
do {
|
1537
|
-
more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
|
1538
|
-
|
1539
|
-
/* Deal with !@#$% 64K limit: */
|
1540
|
-
if (sizeof(int) <= 2) {
|
1541
|
-
if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
|
1542
|
-
more = wsize;
|
1543
|
-
|
1544
|
-
} else if (more == (unsigned)(-1)) {
|
1545
|
-
/* Very unlikely, but possible on 16 bit machine if
|
1546
|
-
* strstart == 0 && lookahead == 1 (input done a byte at time)
|
1547
|
-
*/
|
1548
|
-
more--;
|
1549
|
-
}
|
1550
|
-
}
|
1551
|
-
|
1552
|
-
/* If the window is almost full and there is insufficient lookahead,
|
1553
|
-
* move the upper half to the lower one to make room in the upper half.
|
1554
|
-
*/
|
1555
|
-
if (s->strstart >= wsize+MAX_DIST(s)) {
|
1556
|
-
|
1557
|
-
zmemcpy(s->window, s->window+wsize, (unsigned)wsize - more);
|
1558
|
-
s->match_start -= wsize;
|
1559
|
-
s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
|
1560
|
-
s->block_start -= (long) wsize;
|
1561
|
-
if (s->insert > s->strstart)
|
1562
|
-
s->insert = s->strstart;
|
1563
|
-
slide_hash(s);
|
1564
|
-
more += wsize;
|
1565
|
-
}
|
1566
|
-
if (s->strm->avail_in == 0) break;
|
1567
|
-
|
1568
|
-
/* If there was no sliding:
|
1569
|
-
* strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
|
1570
|
-
* more == window_size - lookahead - strstart
|
1571
|
-
* => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
|
1572
|
-
* => more >= window_size - 2*WSIZE + 2
|
1573
|
-
* In the BIG_MEM or MMAP case (not yet supported),
|
1574
|
-
* window_size == input_size + MIN_LOOKAHEAD &&
|
1575
|
-
* strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
|
1576
|
-
* Otherwise, window_size == 2*WSIZE so more >= 2.
|
1577
|
-
* If there was sliding, more >= WSIZE. So in all cases, more >= 2.
|
1578
|
-
*/
|
1579
|
-
Assert(more >= 2, "more < 2");
|
1580
|
-
|
1581
|
-
n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
|
1582
|
-
s->lookahead += n;
|
1583
|
-
|
1584
|
-
/* Initialize the hash value now that we have some input: */
|
1585
|
-
if (s->lookahead + s->insert >= MIN_MATCH) {
|
1586
|
-
uInt str = s->strstart - s->insert;
|
1587
|
-
s->ins_h = s->window[str];
|
1588
|
-
UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
|
1589
|
-
#if MIN_MATCH != 3
|
1590
|
-
Call UPDATE_HASH() MIN_MATCH-3 more times
|
1591
|
-
#endif
|
1592
|
-
while (s->insert) {
|
1593
|
-
UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
|
1594
|
-
#ifndef FASTEST
|
1595
|
-
s->prev[str & s->w_mask] = s->head[s->ins_h];
|
1596
|
-
#endif
|
1597
|
-
s->head[s->ins_h] = (Pos)str;
|
1598
|
-
str++;
|
1599
|
-
s->insert--;
|
1600
|
-
if (s->lookahead + s->insert < MIN_MATCH)
|
1601
|
-
break;
|
1602
|
-
}
|
1603
|
-
}
|
1604
|
-
/* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
|
1605
|
-
* but this is not important since only literal bytes will be emitted.
|
1606
|
-
*/
|
1607
|
-
|
1608
|
-
} while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
|
1609
|
-
|
1610
|
-
/* If the WIN_INIT bytes after the end of the current data have never been
|
1611
|
-
* written, then zero those bytes in order to avoid memory check reports of
|
1612
|
-
* the use of uninitialized (or uninitialised as Julian writes) bytes by
|
1613
|
-
* the longest match routines. Update the high water mark for the next
|
1614
|
-
* time through here. WIN_INIT is set to MAX_MATCH since the longest match
|
1615
|
-
* routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
|
1616
|
-
*/
|
1617
|
-
if (s->high_water < s->window_size) {
|
1618
|
-
ulg curr = s->strstart + (ulg)(s->lookahead);
|
1619
|
-
ulg init;
|
1620
|
-
|
1621
|
-
if (s->high_water < curr) {
|
1622
|
-
/* Previous high water mark below current data -- zero WIN_INIT
|
1623
|
-
* bytes or up to end of window, whichever is less.
|
1624
|
-
*/
|
1625
|
-
init = s->window_size - curr;
|
1626
|
-
if (init > WIN_INIT)
|
1627
|
-
init = WIN_INIT;
|
1628
|
-
zmemzero(s->window + curr, (unsigned)init);
|
1629
|
-
s->high_water = curr + init;
|
1630
|
-
}
|
1631
|
-
else if (s->high_water < (ulg)curr + WIN_INIT) {
|
1632
|
-
/* High water mark at or above current data, but below current data
|
1633
|
-
* plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
|
1634
|
-
* to end of window, whichever is less.
|
1635
|
-
*/
|
1636
|
-
init = (ulg)curr + WIN_INIT - s->high_water;
|
1637
|
-
if (init > s->window_size - s->high_water)
|
1638
|
-
init = s->window_size - s->high_water;
|
1639
|
-
zmemzero(s->window + s->high_water, (unsigned)init);
|
1640
|
-
s->high_water += init;
|
1641
|
-
}
|
1642
|
-
}
|
1643
|
-
|
1644
|
-
Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
|
1645
|
-
"not enough room for search");
|
1646
|
-
}
|
1647
|
-
|
1648
1585
|
/* ===========================================================================
|
1649
1586
|
* Flush the current block, with given end-of-file flag.
|
1650
1587
|
* IN assertion: strstart is set to the end of the current match.
|
@@ -1685,12 +1622,9 @@ local void fill_window(s)
|
|
1685
1622
|
*
|
1686
1623
|
* deflate_stored() is written to minimize the number of times an input byte is
|
1687
1624
|
* copied. It is most efficient with large input and output buffers, which
|
1688
|
-
* maximizes the
|
1625
|
+
* maximizes the opportunities to have a single copy from next_in to next_out.
|
1689
1626
|
*/
|
1690
|
-
local block_state deflate_stored(s, flush)
|
1691
|
-
deflate_state *s;
|
1692
|
-
int flush;
|
1693
|
-
{
|
1627
|
+
local block_state deflate_stored(deflate_state *s, int flush) {
|
1694
1628
|
/* Smallest worthy block size when not flushing or finishing. By default
|
1695
1629
|
* this is 32K. This can be as small as 507 bytes for memLevel == 1. For
|
1696
1630
|
* large input and output buffers, the stored block size will be larger.
|
@@ -1874,10 +1808,7 @@ local block_state deflate_stored(s, flush)
|
|
1874
1808
|
* new strings in the dictionary only for unmatched strings or for short
|
1875
1809
|
* matches. It is used only for the fast compression options.
|
1876
1810
|
*/
|
1877
|
-
local block_state deflate_fast(s, flush)
|
1878
|
-
deflate_state *s;
|
1879
|
-
int flush;
|
1880
|
-
{
|
1811
|
+
local block_state deflate_fast(deflate_state *s, int flush) {
|
1881
1812
|
IPos hash_head; /* head of the hash chain */
|
1882
1813
|
int bflush; /* set if current block must be flushed */
|
1883
1814
|
|
@@ -1895,7 +1826,7 @@ local block_state deflate_fast(s, flush)
|
|
1895
1826
|
if (s->lookahead == 0) break; /* flush the current block */
|
1896
1827
|
}
|
1897
1828
|
|
1898
|
-
/* Insert the string window[strstart .. strstart+2] in the
|
1829
|
+
/* Insert the string window[strstart .. strstart + 2] in the
|
1899
1830
|
* dictionary, and set hash_head to the head of the hash chain:
|
1900
1831
|
*/
|
1901
1832
|
hash_head = NIL;
|
@@ -1943,7 +1874,7 @@ local block_state deflate_fast(s, flush)
|
|
1943
1874
|
s->strstart += s->match_length;
|
1944
1875
|
s->match_length = 0;
|
1945
1876
|
s->ins_h = s->window[s->strstart];
|
1946
|
-
UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
|
1877
|
+
UPDATE_HASH(s, s->ins_h, s->window[s->strstart + 1]);
|
1947
1878
|
#if MIN_MATCH != 3
|
1948
1879
|
Call UPDATE_HASH() MIN_MATCH-3 more times
|
1949
1880
|
#endif
|
@@ -1954,7 +1885,7 @@ local block_state deflate_fast(s, flush)
|
|
1954
1885
|
} else {
|
1955
1886
|
/* No match, output a literal byte */
|
1956
1887
|
Tracevv((stderr,"%c", s->window[s->strstart]));
|
1957
|
-
_tr_tally_lit
|
1888
|
+
_tr_tally_lit(s, s->window[s->strstart], bflush);
|
1958
1889
|
s->lookahead--;
|
1959
1890
|
s->strstart++;
|
1960
1891
|
}
|
@@ -1976,10 +1907,7 @@ local block_state deflate_fast(s, flush)
|
|
1976
1907
|
* evaluation for matches: a match is finally adopted only if there is
|
1977
1908
|
* no better match at the next window position.
|
1978
1909
|
*/
|
1979
|
-
local block_state deflate_slow(s, flush)
|
1980
|
-
deflate_state *s;
|
1981
|
-
int flush;
|
1982
|
-
{
|
1910
|
+
local block_state deflate_slow(deflate_state *s, int flush) {
|
1983
1911
|
IPos hash_head; /* head of hash chain */
|
1984
1912
|
int bflush; /* set if current block must be flushed */
|
1985
1913
|
|
@@ -1998,7 +1926,7 @@ local block_state deflate_slow(s, flush)
|
|
1998
1926
|
if (s->lookahead == 0) break; /* flush the current block */
|
1999
1927
|
}
|
2000
1928
|
|
2001
|
-
/* Insert the string window[strstart .. strstart+2] in the
|
1929
|
+
/* Insert the string window[strstart .. strstart + 2] in the
|
2002
1930
|
* dictionary, and set hash_head to the head of the hash chain:
|
2003
1931
|
*/
|
2004
1932
|
hash_head = NIL;
|
@@ -2040,17 +1968,17 @@ local block_state deflate_slow(s, flush)
|
|
2040
1968
|
uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
|
2041
1969
|
/* Do not insert strings in hash table beyond this. */
|
2042
1970
|
|
2043
|
-
check_match(s, s->strstart-1, s->prev_match, s->prev_length);
|
1971
|
+
check_match(s, s->strstart - 1, s->prev_match, s->prev_length);
|
2044
1972
|
|
2045
|
-
_tr_tally_dist(s, s->strstart -1 - s->prev_match,
|
1973
|
+
_tr_tally_dist(s, s->strstart - 1 - s->prev_match,
|
2046
1974
|
s->prev_length - MIN_MATCH, bflush);
|
2047
1975
|
|
2048
1976
|
/* Insert in hash table all strings up to the end of the match.
|
2049
|
-
* strstart-1 and strstart are already inserted. If there is not
|
1977
|
+
* strstart - 1 and strstart are already inserted. If there is not
|
2050
1978
|
* enough lookahead, the last two strings are not inserted in
|
2051
1979
|
* the hash table.
|
2052
1980
|
*/
|
2053
|
-
s->lookahead -= s->prev_length-1;
|
1981
|
+
s->lookahead -= s->prev_length - 1;
|
2054
1982
|
s->prev_length -= 2;
|
2055
1983
|
do {
|
2056
1984
|
if (++s->strstart <= max_insert) {
|
@@ -2068,8 +1996,8 @@ local block_state deflate_slow(s, flush)
|
|
2068
1996
|
* single literal. If there was a match but the current match
|
2069
1997
|
* is longer, truncate the previous match to a single literal.
|
2070
1998
|
*/
|
2071
|
-
Tracevv((stderr,"%c", s->window[s->strstart-1]));
|
2072
|
-
_tr_tally_lit(s, s->window[s->strstart-1], bflush);
|
1999
|
+
Tracevv((stderr,"%c", s->window[s->strstart - 1]));
|
2000
|
+
_tr_tally_lit(s, s->window[s->strstart - 1], bflush);
|
2073
2001
|
if (bflush) {
|
2074
2002
|
FLUSH_BLOCK_ONLY(s, 0);
|
2075
2003
|
}
|
@@ -2087,8 +2015,8 @@ local block_state deflate_slow(s, flush)
|
|
2087
2015
|
}
|
2088
2016
|
Assert (flush != Z_NO_FLUSH, "no flush?");
|
2089
2017
|
if (s->match_available) {
|
2090
|
-
Tracevv((stderr,"%c", s->window[s->strstart-1]));
|
2091
|
-
_tr_tally_lit(s, s->window[s->strstart-1], bflush);
|
2018
|
+
Tracevv((stderr,"%c", s->window[s->strstart - 1]));
|
2019
|
+
_tr_tally_lit(s, s->window[s->strstart - 1], bflush);
|
2092
2020
|
s->match_available = 0;
|
2093
2021
|
}
|
2094
2022
|
s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
|
@@ -2107,10 +2035,7 @@ local block_state deflate_slow(s, flush)
|
|
2107
2035
|
* one. Do not maintain a hash table. (It will be regenerated if this run of
|
2108
2036
|
* deflate switches away from Z_RLE.)
|
2109
2037
|
*/
|
2110
|
-
local block_state deflate_rle(s, flush)
|
2111
|
-
deflate_state *s;
|
2112
|
-
int flush;
|
2113
|
-
{
|
2038
|
+
local block_state deflate_rle(deflate_state *s, int flush) {
|
2114
2039
|
int bflush; /* set if current block must be flushed */
|
2115
2040
|
uInt prev; /* byte at distance one to match */
|
2116
2041
|
Bytef *scan, *strend; /* scan goes up to strend for length of run */
|
@@ -2145,7 +2070,8 @@ local block_state deflate_rle(s, flush)
|
|
2145
2070
|
if (s->match_length > s->lookahead)
|
2146
2071
|
s->match_length = s->lookahead;
|
2147
2072
|
}
|
2148
|
-
Assert(scan <= s->window+(uInt)(s->window_size-1),
|
2073
|
+
Assert(scan <= s->window + (uInt)(s->window_size - 1),
|
2074
|
+
"wild scan");
|
2149
2075
|
}
|
2150
2076
|
|
2151
2077
|
/* Emit match if have run of MIN_MATCH or longer, else emit literal */
|
@@ -2160,7 +2086,7 @@ local block_state deflate_rle(s, flush)
|
|
2160
2086
|
} else {
|
2161
2087
|
/* No match, output a literal byte */
|
2162
2088
|
Tracevv((stderr,"%c", s->window[s->strstart]));
|
2163
|
-
_tr_tally_lit
|
2089
|
+
_tr_tally_lit(s, s->window[s->strstart], bflush);
|
2164
2090
|
s->lookahead--;
|
2165
2091
|
s->strstart++;
|
2166
2092
|
}
|
@@ -2180,10 +2106,7 @@ local block_state deflate_rle(s, flush)
|
|
2180
2106
|
* For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.
|
2181
2107
|
* (It will be regenerated if this run of deflate switches away from Huffman.)
|
2182
2108
|
*/
|
2183
|
-
local block_state deflate_huff(s, flush)
|
2184
|
-
deflate_state *s;
|
2185
|
-
int flush;
|
2186
|
-
{
|
2109
|
+
local block_state deflate_huff(deflate_state *s, int flush) {
|
2187
2110
|
int bflush; /* set if current block must be flushed */
|
2188
2111
|
|
2189
2112
|
for (;;) {
|
@@ -2200,7 +2123,7 @@ local block_state deflate_huff(s, flush)
|
|
2200
2123
|
/* Output a literal byte */
|
2201
2124
|
s->match_length = 0;
|
2202
2125
|
Tracevv((stderr,"%c", s->window[s->strstart]));
|
2203
|
-
_tr_tally_lit
|
2126
|
+
_tr_tally_lit(s, s->window[s->strstart], bflush);
|
2204
2127
|
s->lookahead--;
|
2205
2128
|
s->strstart++;
|
2206
2129
|
if (bflush) FLUSH_BLOCK(s, 0);
|