rugged 1.3.2.3 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rugged/extconf.rb +1 -1
- data/ext/rugged/rugged_config.c +7 -2
- data/ext/rugged/rugged_remote.c +17 -0
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +103 -276
- data/vendor/libgit2/COPYING +36 -19
- data/vendor/libgit2/cmake/AddCFlagIfSupported.cmake +21 -21
- data/vendor/libgit2/cmake/DefaultCFlags.cmake +154 -0
- data/vendor/libgit2/cmake/EnableWarnings.cmake +13 -13
- data/vendor/libgit2/cmake/FindCoreFoundation.cmake +13 -13
- data/vendor/libgit2/cmake/FindGSSAPI.cmake +171 -287
- data/vendor/libgit2/cmake/FindGSSFramework.cmake +13 -13
- data/vendor/libgit2/cmake/{FindHTTP_Parser.cmake → FindHTTPParser.cmake} +17 -17
- data/vendor/libgit2/cmake/FindIconv.cmake +27 -27
- data/vendor/libgit2/cmake/FindLibSSH2.cmake +5 -5
- data/vendor/libgit2/cmake/FindPCRE.cmake +13 -13
- data/vendor/libgit2/cmake/FindPCRE2.cmake +12 -12
- data/vendor/libgit2/cmake/FindPkgLibraries.cmake +19 -19
- data/vendor/libgit2/cmake/FindSecurity.cmake +14 -14
- data/vendor/libgit2/cmake/FindStatNsec.cmake +12 -18
- data/vendor/libgit2/cmake/Findfutimens.cmake +8 -8
- data/vendor/libgit2/cmake/FindmbedTLS.cmake +63 -70
- data/vendor/libgit2/cmake/IdeSplitSources.cmake +18 -18
- data/vendor/libgit2/cmake/PkgBuildConfig.cmake +60 -60
- data/vendor/libgit2/cmake/SanitizeBool.cmake +20 -20
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +37 -37
- data/vendor/libgit2/cmake/SelectHTTPParser.cmake +19 -0
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +100 -100
- data/vendor/libgit2/cmake/SelectHashes.cmake +39 -49
- data/vendor/libgit2/cmake/SelectRegex.cmake +51 -0
- data/vendor/libgit2/cmake/SelectSSH.cmake +41 -0
- data/vendor/libgit2/cmake/SelectWinHTTP.cmake +17 -0
- data/vendor/libgit2/cmake/SelectZlib.cmake +34 -0
- data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +6 -6
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +31 -31
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +1 -1
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +4 -4
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +4 -4
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +2 -2
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +88 -88
- data/vendor/libgit2/deps/winhttp/CMakeLists.txt +14 -16
- data/vendor/libgit2/deps/zlib/adler32.c +0 -7
- data/vendor/libgit2/deps/zlib/crc32.c +288 -975
- data/vendor/libgit2/deps/zlib/crc32.h +436 -9441
- data/vendor/libgit2/deps/zlib/deflate.c +31 -83
- data/vendor/libgit2/deps/zlib/deflate.h +15 -12
- data/vendor/libgit2/deps/zlib/gzguts.h +2 -3
- data/vendor/libgit2/deps/zlib/infback.c +1 -2
- data/vendor/libgit2/deps/zlib/inffast.c +14 -14
- data/vendor/libgit2/deps/zlib/inflate.c +8 -39
- data/vendor/libgit2/deps/zlib/inflate.h +2 -3
- data/vendor/libgit2/deps/zlib/inftrees.c +3 -3
- data/vendor/libgit2/deps/zlib/trees.c +48 -27
- data/vendor/libgit2/deps/zlib/zlib.h +100 -126
- data/vendor/libgit2/deps/zlib/zutil.c +2 -2
- data/vendor/libgit2/deps/zlib/zutil.h +9 -12
- data/vendor/libgit2/include/git2/apply.h +16 -2
- data/vendor/libgit2/include/git2/attr.h +11 -2
- data/vendor/libgit2/include/git2/blame.h +4 -1
- data/vendor/libgit2/include/git2/blob.h +14 -1
- data/vendor/libgit2/include/git2/branch.h +2 -0
- data/vendor/libgit2/include/git2/buffer.h +18 -78
- data/vendor/libgit2/include/git2/cert.h +2 -2
- data/vendor/libgit2/include/git2/checkout.h +5 -2
- data/vendor/libgit2/include/git2/clone.h +3 -3
- data/vendor/libgit2/include/git2/commit.h +2 -0
- data/vendor/libgit2/include/git2/common.h +5 -12
- data/vendor/libgit2/include/git2/config.h +19 -3
- data/vendor/libgit2/include/git2/credential.h +2 -1
- data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
- data/vendor/libgit2/include/git2/deprecated.h +1 -1
- data/vendor/libgit2/include/git2/describe.h +7 -2
- data/vendor/libgit2/include/git2/diff.h +17 -9
- data/vendor/libgit2/include/git2/email.h +1 -1
- data/vendor/libgit2/include/git2/errors.h +1 -2
- data/vendor/libgit2/include/git2/filter.h +7 -2
- data/vendor/libgit2/include/git2/graph.h +1 -0
- data/vendor/libgit2/include/git2/ignore.h +1 -1
- data/vendor/libgit2/include/git2/index.h +11 -5
- data/vendor/libgit2/include/git2/indexer.h +19 -0
- data/vendor/libgit2/include/git2/merge.h +23 -3
- data/vendor/libgit2/include/git2/message.h +2 -0
- data/vendor/libgit2/include/git2/object.h +23 -0
- data/vendor/libgit2/include/git2/odb.h +37 -7
- data/vendor/libgit2/include/git2/odb_backend.h +1 -1
- data/vendor/libgit2/include/git2/pack.h +24 -8
- data/vendor/libgit2/include/git2/patch.h +8 -0
- data/vendor/libgit2/include/git2/pathspec.h +1 -1
- data/vendor/libgit2/include/git2/proxy.h +1 -1
- data/vendor/libgit2/include/git2/rebase.h +9 -1
- data/vendor/libgit2/include/git2/refdb.h +3 -0
- data/vendor/libgit2/include/git2/reflog.h +1 -1
- data/vendor/libgit2/include/git2/refs.h +2 -2
- data/vendor/libgit2/include/git2/remote.h +184 -37
- data/vendor/libgit2/include/git2/repository.h +14 -9
- data/vendor/libgit2/include/git2/reset.h +2 -2
- data/vendor/libgit2/include/git2/revparse.h +1 -1
- data/vendor/libgit2/include/git2/revwalk.h +4 -1
- data/vendor/libgit2/include/git2/signature.h +1 -1
- data/vendor/libgit2/include/git2/stash.h +3 -3
- data/vendor/libgit2/include/git2/status.h +9 -3
- data/vendor/libgit2/include/git2/submodule.h +7 -2
- data/vendor/libgit2/include/git2/sys/commit_graph.h +1 -1
- data/vendor/libgit2/include/git2/sys/odb_backend.h +2 -5
- data/vendor/libgit2/include/git2/sys/remote.h +31 -0
- data/vendor/libgit2/include/git2/sys/stream.h +1 -1
- data/vendor/libgit2/include/git2/sys/transport.h +25 -34
- data/vendor/libgit2/include/git2/tag.h +1 -0
- data/vendor/libgit2/include/git2/tree.h +4 -3
- data/vendor/libgit2/include/git2/types.h +7 -7
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/include/git2/worktree.h +12 -2
- data/vendor/libgit2/src/CMakeLists.txt +189 -315
- data/vendor/libgit2/src/annotated_commit.h +1 -1
- data/vendor/libgit2/src/apply.c +18 -18
- data/vendor/libgit2/src/apply.h +2 -2
- data/vendor/libgit2/src/attr.c +18 -18
- data/vendor/libgit2/src/attr_file.c +17 -17
- data/vendor/libgit2/src/attr_file.h +4 -4
- data/vendor/libgit2/src/attrcache.c +17 -12
- data/vendor/libgit2/src/blame_git.c +1 -1
- data/vendor/libgit2/src/blob.c +33 -26
- data/vendor/libgit2/src/blob.h +1 -1
- data/vendor/libgit2/src/branch.c +150 -109
- data/vendor/libgit2/src/branch.h +15 -3
- data/vendor/libgit2/src/buf.c +126 -0
- data/vendor/libgit2/src/buf.h +50 -0
- data/vendor/libgit2/src/cc-compat.h +1 -1
- data/vendor/libgit2/src/checkout.c +74 -68
- data/vendor/libgit2/src/cherrypick.c +10 -10
- data/vendor/libgit2/src/clone.c +66 -66
- data/vendor/libgit2/src/commit.c +128 -58
- data/vendor/libgit2/src/commit.h +24 -1
- data/vendor/libgit2/src/commit_graph.c +68 -53
- data/vendor/libgit2/src/commit_graph.h +10 -3
- data/vendor/libgit2/src/commit_list.c +2 -3
- data/vendor/libgit2/src/common.h +10 -3
- data/vendor/libgit2/src/config.c +99 -77
- data/vendor/libgit2/src/config.h +15 -2
- data/vendor/libgit2/src/config_file.c +103 -91
- data/vendor/libgit2/src/config_mem.c +9 -9
- data/vendor/libgit2/src/config_parse.c +27 -23
- data/vendor/libgit2/src/crlf.c +24 -21
- data/vendor/libgit2/src/date.c +10 -17
- data/vendor/libgit2/src/date.h +33 -0
- data/vendor/libgit2/src/describe.c +27 -19
- data/vendor/libgit2/src/diff.c +25 -8
- data/vendor/libgit2/src/diff.h +2 -4
- data/vendor/libgit2/src/diff_driver.c +34 -36
- data/vendor/libgit2/src/diff_driver.h +3 -3
- data/vendor/libgit2/src/diff_file.c +29 -20
- data/vendor/libgit2/src/diff_generate.c +30 -6
- data/vendor/libgit2/src/diff_generate.h +5 -3
- data/vendor/libgit2/src/diff_print.c +102 -95
- data/vendor/libgit2/src/diff_stats.c +40 -29
- data/vendor/libgit2/src/{message.h → diff_stats.h} +7 -6
- data/vendor/libgit2/src/diff_tform.c +9 -8
- data/vendor/libgit2/src/diff_xdiff.c +3 -8
- data/vendor/libgit2/src/email.c +54 -38
- data/vendor/libgit2/src/email.h +1 -1
- data/vendor/libgit2/src/errors.c +18 -18
- data/vendor/libgit2/src/features.h.in +6 -1
- data/vendor/libgit2/src/fetch.c +69 -24
- data/vendor/libgit2/src/fetch.h +1 -1
- data/vendor/libgit2/src/fetchhead.c +19 -19
- data/vendor/libgit2/src/filebuf.c +28 -28
- data/vendor/libgit2/src/filebuf.h +1 -1
- data/vendor/libgit2/src/filter.c +96 -52
- data/vendor/libgit2/src/filter.h +26 -5
- data/vendor/libgit2/src/fs_path.c +1912 -0
- data/vendor/libgit2/src/fs_path.h +752 -0
- data/vendor/libgit2/src/futils.c +91 -85
- data/vendor/libgit2/src/futils.h +26 -14
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +2 -2
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +2 -2
- data/vendor/libgit2/src/hash/sha1/generic.c +2 -2
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +2 -2
- data/vendor/libgit2/src/hash/sha1/openssl.c +2 -2
- data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +1 -1
- data/vendor/libgit2/src/hash/sha1/win32.c +6 -6
- data/vendor/libgit2/src/hash/sha1.h +3 -1
- data/vendor/libgit2/src/hash.c +67 -35
- data/vendor/libgit2/src/hash.h +12 -12
- data/vendor/libgit2/src/ident.c +18 -18
- data/vendor/libgit2/src/ignore.c +35 -34
- data/vendor/libgit2/src/ignore.h +2 -2
- data/vendor/libgit2/src/index.c +79 -80
- data/vendor/libgit2/src/index.h +6 -3
- data/vendor/libgit2/src/indexer.c +75 -57
- data/vendor/libgit2/src/iterator.c +64 -56
- data/vendor/libgit2/src/iterator.h +5 -5
- data/vendor/libgit2/src/khash.h +1 -1
- data/vendor/libgit2/src/libgit2.c +22 -19
- data/vendor/libgit2/src/mailmap.c +38 -36
- data/vendor/libgit2/src/merge.c +27 -27
- data/vendor/libgit2/src/merge.h +1 -14
- data/vendor/libgit2/src/merge_driver.c +2 -2
- data/vendor/libgit2/src/merge_file.c +13 -3
- data/vendor/libgit2/src/message.c +21 -10
- data/vendor/libgit2/src/midx.c +83 -66
- data/vendor/libgit2/src/midx.h +3 -3
- data/vendor/libgit2/src/mwindow.c +1 -1
- data/vendor/libgit2/src/net.c +278 -68
- data/vendor/libgit2/src/net.h +10 -3
- data/vendor/libgit2/src/netops.c +1 -1
- data/vendor/libgit2/src/netops.h +1 -1
- data/vendor/libgit2/src/notes.c +20 -29
- data/vendor/libgit2/src/object.c +49 -9
- data/vendor/libgit2/src/object.h +1 -1
- data/vendor/libgit2/src/odb.c +35 -32
- data/vendor/libgit2/src/odb.h +1 -1
- data/vendor/libgit2/src/odb_loose.c +68 -68
- data/vendor/libgit2/src/odb_mempack.c +18 -5
- data/vendor/libgit2/src/odb_pack.c +43 -43
- data/vendor/libgit2/src/oid.c +11 -4
- data/vendor/libgit2/src/oid.h +15 -0
- data/vendor/libgit2/src/pack-objects.c +41 -26
- data/vendor/libgit2/src/pack-objects.h +11 -6
- data/vendor/libgit2/src/pack.c +10 -10
- data/vendor/libgit2/src/patch.c +3 -3
- data/vendor/libgit2/src/patch.h +1 -0
- data/vendor/libgit2/src/patch_generate.c +27 -11
- data/vendor/libgit2/src/patch_generate.h +5 -5
- data/vendor/libgit2/src/patch_parse.c +24 -24
- data/vendor/libgit2/src/path.c +76 -1951
- data/vendor/libgit2/src/path.h +34 -741
- data/vendor/libgit2/src/pathspec.c +6 -6
- data/vendor/libgit2/src/pathspec.h +2 -2
- data/vendor/libgit2/src/posix.c +3 -3
- data/vendor/libgit2/src/posix.h +1 -0
- data/vendor/libgit2/src/pqueue.h +1 -1
- data/vendor/libgit2/src/proxy.c +4 -1
- data/vendor/libgit2/src/proxy.h +1 -1
- data/vendor/libgit2/src/push.c +30 -35
- data/vendor/libgit2/src/push.h +4 -16
- data/vendor/libgit2/src/rand.c +226 -0
- data/vendor/libgit2/src/rand.h +37 -0
- data/vendor/libgit2/src/reader.c +8 -8
- data/vendor/libgit2/src/reader.h +2 -2
- data/vendor/libgit2/src/rebase.c +89 -88
- data/vendor/libgit2/src/refdb_fs.c +447 -173
- data/vendor/libgit2/src/refs.c +32 -32
- data/vendor/libgit2/src/refs.h +2 -2
- data/vendor/libgit2/src/refspec.c +32 -37
- data/vendor/libgit2/src/refspec.h +5 -2
- data/vendor/libgit2/src/regexp.c +1 -1
- data/vendor/libgit2/src/remote.c +713 -419
- data/vendor/libgit2/src/remote.h +15 -10
- data/vendor/libgit2/src/repository.c +350 -467
- data/vendor/libgit2/src/repository.h +11 -10
- data/vendor/libgit2/src/reset.c +8 -5
- data/vendor/libgit2/src/revert.c +10 -10
- data/vendor/libgit2/src/revparse.c +48 -35
- data/vendor/libgit2/src/revwalk.c +7 -7
- data/vendor/libgit2/src/signature.c +12 -6
- data/vendor/libgit2/src/signature.h +1 -1
- data/vendor/libgit2/src/sortedcache.c +1 -1
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +36 -37
- data/vendor/libgit2/src/status.c +4 -1
- data/vendor/libgit2/src/{buffer.c → str.c} +157 -151
- data/vendor/libgit2/src/str.h +357 -0
- data/vendor/libgit2/src/streams/mbedtls.c +8 -6
- data/vendor/libgit2/src/streams/openssl_dynamic.h +3 -3
- data/vendor/libgit2/src/submodule.c +171 -159
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +68 -52
- data/vendor/libgit2/src/sysdir.h +15 -10
- data/vendor/libgit2/src/tag.c +29 -27
- data/vendor/libgit2/src/thread.h +3 -3
- data/vendor/libgit2/src/threadstate.c +3 -3
- data/vendor/libgit2/src/threadstate.h +1 -1
- data/vendor/libgit2/src/trace.c +1 -14
- data/vendor/libgit2/src/trace.h +5 -22
- data/vendor/libgit2/src/trailer.c +1 -1
- data/vendor/libgit2/src/transaction.c +1 -1
- data/vendor/libgit2/src/transport.c +10 -10
- data/vendor/libgit2/src/transports/auth.c +7 -9
- data/vendor/libgit2/src/transports/auth.h +2 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +12 -13
- data/vendor/libgit2/src/transports/auth_ntlm.c +10 -10
- data/vendor/libgit2/src/transports/auth_ntlm.h +0 -1
- data/vendor/libgit2/src/transports/git.c +9 -11
- data/vendor/libgit2/src/transports/http.c +37 -17
- data/vendor/libgit2/src/transports/http.h +2 -3
- data/vendor/libgit2/src/transports/httpclient.c +65 -65
- data/vendor/libgit2/src/transports/local.c +124 -116
- data/vendor/libgit2/src/transports/smart.c +51 -139
- data/vendor/libgit2/src/transports/smart.h +25 -31
- data/vendor/libgit2/src/transports/smart_pkt.c +33 -33
- data/vendor/libgit2/src/transports/smart_protocol.c +57 -39
- data/vendor/libgit2/src/transports/ssh.c +47 -112
- data/vendor/libgit2/src/transports/winhttp.c +50 -56
- data/vendor/libgit2/src/tree-cache.c +5 -5
- data/vendor/libgit2/src/tree-cache.h +2 -2
- data/vendor/libgit2/src/tree.c +59 -48
- data/vendor/libgit2/src/tree.h +1 -1
- data/vendor/libgit2/src/unix/map.c +0 -2
- data/vendor/libgit2/src/unix/posix.h +1 -4
- data/vendor/libgit2/src/unix/realpath.c +0 -2
- data/vendor/libgit2/src/util.c +14 -14
- data/vendor/libgit2/src/util.h +2 -28
- data/vendor/libgit2/src/vector.h +1 -1
- data/vendor/libgit2/src/win32/findfile.c +172 -116
- data/vendor/libgit2/src/win32/findfile.h +7 -4
- data/vendor/libgit2/src/win32/path_w32.c +140 -9
- data/vendor/libgit2/src/win32/path_w32.h +2 -0
- data/vendor/libgit2/src/win32/posix.h +0 -1
- data/vendor/libgit2/src/win32/posix_w32.c +11 -27
- data/vendor/libgit2/src/win32/w32_buffer.c +2 -3
- data/vendor/libgit2/src/win32/w32_buffer.h +2 -3
- data/vendor/libgit2/src/win32/w32_leakcheck.c +1 -1
- data/vendor/libgit2/src/worktree.c +116 -94
- data/vendor/libgit2/src/worktree.h +1 -1
- data/vendor/libgit2/src/xdiff/git-xdiff.h +53 -0
- data/vendor/libgit2/src/xdiff/xdiff.h +15 -15
- data/vendor/libgit2/src/xdiff/xdiffi.c +134 -108
- data/vendor/libgit2/src/xdiff/xemit.c +23 -7
- data/vendor/libgit2/src/xdiff/xhistogram.c +87 -78
- data/vendor/libgit2/src/xdiff/xinclude.h +1 -12
- data/vendor/libgit2/src/xdiff/xmerge.c +104 -117
- data/vendor/libgit2/src/xdiff/xpatience.c +6 -17
- data/vendor/libgit2/src/xdiff/xprepare.c +15 -20
- data/vendor/libgit2/src/xdiff/xutils.c +18 -7
- data/vendor/libgit2/src/zstream.c +5 -5
- data/vendor/libgit2/src/zstream.h +4 -4
- metadata +25 -10
- data/vendor/libgit2/src/buffer.h +0 -374
@@ -1,5 +1,5 @@
|
|
1
1
|
/* deflate.c -- compress data using the deflation algorithm
|
2
|
-
* Copyright (C) 1995-
|
2
|
+
* Copyright (C) 1995-2017 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.2.
|
55
|
+
" deflate 1.2.11 Copyright 1995-2017 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
|
@@ -190,22 +190,14 @@ local const config configuration_table[10] = {
|
|
190
190
|
* prev[] will be initialized on the fly.
|
191
191
|
*/
|
192
192
|
#define CLEAR_HASH(s) \
|
193
|
-
|
194
|
-
|
195
|
-
zmemzero((Bytef *)s->head, \
|
196
|
-
(unsigned)(s->hash_size-1)*sizeof(*s->head)); \
|
197
|
-
} while (0)
|
193
|
+
s->head[s->hash_size-1] = NIL; \
|
194
|
+
zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
|
198
195
|
|
199
196
|
/* ===========================================================================
|
200
197
|
* Slide the hash table when sliding the window down (could be avoided with 32
|
201
198
|
* bit values at the expense of memory usage). We slide even when level == 0 to
|
202
199
|
* keep the hash table consistent if we switch back to level > 0 later.
|
203
200
|
*/
|
204
|
-
#if defined(__has_feature)
|
205
|
-
# if __has_feature(memory_sanitizer)
|
206
|
-
__attribute__((no_sanitize("memory")))
|
207
|
-
# endif
|
208
|
-
#endif
|
209
201
|
local void slide_hash(s)
|
210
202
|
deflate_state *s;
|
211
203
|
{
|
@@ -260,6 +252,11 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|
260
252
|
int wrap = 1;
|
261
253
|
static const char my_version[] = ZLIB_VERSION;
|
262
254
|
|
255
|
+
ushf *overlay;
|
256
|
+
/* We overlay pending_buf and d_buf+l_buf. This works since the average
|
257
|
+
* output size for (length,distance) codes is <= 24 bits.
|
258
|
+
*/
|
259
|
+
|
263
260
|
if (version == Z_NULL || version[0] != my_version[0] ||
|
264
261
|
stream_size != sizeof(z_stream)) {
|
265
262
|
return Z_VERSION_ERROR;
|
@@ -323,53 +320,16 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|
323
320
|
|
324
321
|
s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
|
325
322
|
s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
|
323
|
+
memset(s->prev, 0, s->w_size * sizeof(Pos));
|
326
324
|
s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
|
327
325
|
|
328
326
|
s->high_water = 0; /* nothing written to s->window yet */
|
329
327
|
|
330
328
|
s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
|
331
329
|
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
*
|
336
|
-
* Analysis: The longest fixed codes are a length code of 8 bits plus 5
|
337
|
-
* extra bits, for lengths 131 to 257. The longest fixed distance codes are
|
338
|
-
* 5 bits plus 13 extra bits, for distances 16385 to 32768. The longest
|
339
|
-
* possible fixed-codes length/distance pair is then 31 bits total.
|
340
|
-
*
|
341
|
-
* sym_buf starts one-fourth of the way into pending_buf. So there are
|
342
|
-
* three bytes in sym_buf for every four bytes in pending_buf. Each symbol
|
343
|
-
* in sym_buf is three bytes -- two for the distance and one for the
|
344
|
-
* literal/length. As each symbol is consumed, the pointer to the next
|
345
|
-
* sym_buf value to read moves forward three bytes. From that symbol, up to
|
346
|
-
* 31 bits are written to pending_buf. The closest the written pending_buf
|
347
|
-
* 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
|
351
|
-
* 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
|
353
|
-
* can range from 128 to 32768.
|
354
|
-
*
|
355
|
-
* Therefore, at a minimum, there are 142 bits of space between what is
|
356
|
-
* written and what is read in the overlain buffers, so the symbols cannot
|
357
|
-
* be overwritten by the compressed data. That space is actually 139 bits,
|
358
|
-
* due to the three-bit fixed-code block header.
|
359
|
-
*
|
360
|
-
* That covers the case where either Z_FIXED is specified, forcing fixed
|
361
|
-
* codes, or when the use of fixed codes is chosen, because that choice
|
362
|
-
* results in a smaller compressed block than dynamic codes. That latter
|
363
|
-
* condition then assures that the above analysis also covers all dynamic
|
364
|
-
* blocks. A dynamic-code block will only be chosen to be emitted if it has
|
365
|
-
* fewer bits than a fixed-code block would for the same set of symbols.
|
366
|
-
* Therefore its average symbol length is assured to be less than 31. So
|
367
|
-
* the compressed data for a dynamic block also cannot overwrite the
|
368
|
-
* symbols from which it is being constructed.
|
369
|
-
*/
|
370
|
-
|
371
|
-
s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4);
|
372
|
-
s->pending_buf_size = (ulg)s->lit_bufsize * 4;
|
330
|
+
overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
|
331
|
+
s->pending_buf = (uchf *) overlay;
|
332
|
+
s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
|
373
333
|
|
374
334
|
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
|
375
335
|
s->pending_buf == Z_NULL) {
|
@@ -378,12 +338,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|
378
338
|
deflateEnd (strm);
|
379
339
|
return Z_MEM_ERROR;
|
380
340
|
}
|
381
|
-
s->
|
382
|
-
s->
|
383
|
-
/* We avoid equality with lit_bufsize*3 because of wraparound at 64K
|
384
|
-
* on 16 bit machines and because stored blocks are restricted to
|
385
|
-
* 64K-1 bytes.
|
386
|
-
*/
|
341
|
+
s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
|
342
|
+
s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
|
387
343
|
|
388
344
|
s->level = level;
|
389
345
|
s->strategy = strategy;
|
@@ -533,13 +489,13 @@ int ZEXPORT deflateResetKeep (strm)
|
|
533
489
|
#ifdef GZIP
|
534
490
|
s->wrap == 2 ? GZIP_STATE :
|
535
491
|
#endif
|
536
|
-
INIT_STATE;
|
492
|
+
s->wrap ? INIT_STATE : BUSY_STATE;
|
537
493
|
strm->adler =
|
538
494
|
#ifdef GZIP
|
539
495
|
s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
|
540
496
|
#endif
|
541
497
|
adler32(0L, Z_NULL, 0);
|
542
|
-
s->last_flush =
|
498
|
+
s->last_flush = Z_NO_FLUSH;
|
543
499
|
|
544
500
|
_tr_init(s);
|
545
501
|
|
@@ -594,8 +550,7 @@ int ZEXPORT deflatePrime (strm, bits, value)
|
|
594
550
|
|
595
551
|
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
|
596
552
|
s = strm->state;
|
597
|
-
if (
|
598
|
-
s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
|
553
|
+
if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3))
|
599
554
|
return Z_BUF_ERROR;
|
600
555
|
do {
|
601
556
|
put = Buf_size - s->bi_valid;
|
@@ -633,12 +588,12 @@ int ZEXPORT deflateParams(strm, level, strategy)
|
|
633
588
|
func = configuration_table[s->level].func;
|
634
589
|
|
635
590
|
if ((strategy != s->strategy || func != configuration_table[level].func) &&
|
636
|
-
s->
|
591
|
+
s->high_water) {
|
637
592
|
/* Flush the last buffer: */
|
638
593
|
int err = deflate(strm, Z_BLOCK);
|
639
594
|
if (err == Z_STREAM_ERROR)
|
640
595
|
return err;
|
641
|
-
if (strm->
|
596
|
+
if (strm->avail_out == 0)
|
642
597
|
return Z_BUF_ERROR;
|
643
598
|
}
|
644
599
|
if (s->level != level) {
|
@@ -857,8 +812,6 @@ int ZEXPORT deflate (strm, flush)
|
|
857
812
|
}
|
858
813
|
|
859
814
|
/* Write the header */
|
860
|
-
if (s->status == INIT_STATE && s->wrap == 0)
|
861
|
-
s->status = BUSY_STATE;
|
862
815
|
if (s->status == INIT_STATE) {
|
863
816
|
/* zlib header */
|
864
817
|
uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
|
@@ -1156,6 +1109,7 @@ int ZEXPORT deflateCopy (dest, source)
|
|
1156
1109
|
#else
|
1157
1110
|
deflate_state *ds;
|
1158
1111
|
deflate_state *ss;
|
1112
|
+
ushf *overlay;
|
1159
1113
|
|
1160
1114
|
|
1161
1115
|
if (deflateStateCheck(source) || dest == Z_NULL) {
|
@@ -1175,7 +1129,8 @@ int ZEXPORT deflateCopy (dest, source)
|
|
1175
1129
|
ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
|
1176
1130
|
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
|
1177
1131
|
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
|
1178
|
-
|
1132
|
+
overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
|
1133
|
+
ds->pending_buf = (uchf *) overlay;
|
1179
1134
|
|
1180
1135
|
if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
|
1181
1136
|
ds->pending_buf == Z_NULL) {
|
@@ -1189,7 +1144,8 @@ int ZEXPORT deflateCopy (dest, source)
|
|
1189
1144
|
zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
|
1190
1145
|
|
1191
1146
|
ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
|
1192
|
-
ds->
|
1147
|
+
ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
|
1148
|
+
ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
|
1193
1149
|
|
1194
1150
|
ds->l_desc.dyn_tree = ds->dyn_ltree;
|
1195
1151
|
ds->d_desc.dyn_tree = ds->dyn_dtree;
|
@@ -1558,8 +1514,6 @@ local void fill_window(s)
|
|
1558
1514
|
s->match_start -= wsize;
|
1559
1515
|
s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
|
1560
1516
|
s->block_start -= (long) wsize;
|
1561
|
-
if (s->insert > s->strstart)
|
1562
|
-
s->insert = s->strstart;
|
1563
1517
|
slide_hash(s);
|
1564
1518
|
more += wsize;
|
1565
1519
|
}
|
@@ -1789,7 +1743,6 @@ local block_state deflate_stored(s, flush)
|
|
1789
1743
|
s->matches = 2; /* clear hash */
|
1790
1744
|
zmemcpy(s->window, s->strm->next_in - s->w_size, s->w_size);
|
1791
1745
|
s->strstart = s->w_size;
|
1792
|
-
s->insert = s->strstart;
|
1793
1746
|
}
|
1794
1747
|
else {
|
1795
1748
|
if (s->window_size - s->strstart <= used) {
|
@@ -1798,14 +1751,12 @@ local block_state deflate_stored(s, flush)
|
|
1798
1751
|
zmemcpy(s->window, s->window + s->w_size, s->strstart);
|
1799
1752
|
if (s->matches < 2)
|
1800
1753
|
s->matches++; /* add a pending slide_hash() */
|
1801
|
-
if (s->insert > s->strstart)
|
1802
|
-
s->insert = s->strstart;
|
1803
1754
|
}
|
1804
1755
|
zmemcpy(s->window + s->strstart, s->strm->next_in - used, used);
|
1805
1756
|
s->strstart += used;
|
1806
|
-
s->insert += MIN(used, s->w_size - s->insert);
|
1807
1757
|
}
|
1808
1758
|
s->block_start = s->strstart;
|
1759
|
+
s->insert += MIN(used, s->w_size - s->insert);
|
1809
1760
|
}
|
1810
1761
|
if (s->high_water < s->strstart)
|
1811
1762
|
s->high_water = s->strstart;
|
@@ -1820,7 +1771,7 @@ local block_state deflate_stored(s, flush)
|
|
1820
1771
|
return block_done;
|
1821
1772
|
|
1822
1773
|
/* Fill the window with any remaining input. */
|
1823
|
-
have = s->window_size - s->strstart;
|
1774
|
+
have = s->window_size - s->strstart - 1;
|
1824
1775
|
if (s->strm->avail_in > have && s->block_start >= (long)s->w_size) {
|
1825
1776
|
/* Slide the window down. */
|
1826
1777
|
s->block_start -= s->w_size;
|
@@ -1829,15 +1780,12 @@ local block_state deflate_stored(s, flush)
|
|
1829
1780
|
if (s->matches < 2)
|
1830
1781
|
s->matches++; /* add a pending slide_hash() */
|
1831
1782
|
have += s->w_size; /* more space now */
|
1832
|
-
if (s->insert > s->strstart)
|
1833
|
-
s->insert = s->strstart;
|
1834
1783
|
}
|
1835
1784
|
if (have > s->strm->avail_in)
|
1836
1785
|
have = s->strm->avail_in;
|
1837
1786
|
if (have) {
|
1838
1787
|
read_buf(s->strm, s->window + s->strstart, have);
|
1839
1788
|
s->strstart += have;
|
1840
|
-
s->insert += MIN(have, s->w_size - s->insert);
|
1841
1789
|
}
|
1842
1790
|
if (s->high_water < s->strstart)
|
1843
1791
|
s->high_water = s->strstart;
|
@@ -1965,7 +1913,7 @@ local block_state deflate_fast(s, flush)
|
|
1965
1913
|
FLUSH_BLOCK(s, 1);
|
1966
1914
|
return finish_done;
|
1967
1915
|
}
|
1968
|
-
if (s->
|
1916
|
+
if (s->last_lit)
|
1969
1917
|
FLUSH_BLOCK(s, 0);
|
1970
1918
|
return block_done;
|
1971
1919
|
}
|
@@ -2096,7 +2044,7 @@ local block_state deflate_slow(s, flush)
|
|
2096
2044
|
FLUSH_BLOCK(s, 1);
|
2097
2045
|
return finish_done;
|
2098
2046
|
}
|
2099
|
-
if (s->
|
2047
|
+
if (s->last_lit)
|
2100
2048
|
FLUSH_BLOCK(s, 0);
|
2101
2049
|
return block_done;
|
2102
2050
|
}
|
@@ -2171,7 +2119,7 @@ local block_state deflate_rle(s, flush)
|
|
2171
2119
|
FLUSH_BLOCK(s, 1);
|
2172
2120
|
return finish_done;
|
2173
2121
|
}
|
2174
|
-
if (s->
|
2122
|
+
if (s->last_lit)
|
2175
2123
|
FLUSH_BLOCK(s, 0);
|
2176
2124
|
return block_done;
|
2177
2125
|
}
|
@@ -2210,7 +2158,7 @@ local block_state deflate_huff(s, flush)
|
|
2210
2158
|
FLUSH_BLOCK(s, 1);
|
2211
2159
|
return finish_done;
|
2212
2160
|
}
|
2213
|
-
if (s->
|
2161
|
+
if (s->last_lit)
|
2214
2162
|
FLUSH_BLOCK(s, 0);
|
2215
2163
|
return block_done;
|
2216
2164
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* deflate.h -- internal compression state
|
2
|
-
* Copyright (C) 1995-
|
2
|
+
* Copyright (C) 1995-2016 Jean-loup Gailly
|
3
3
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
4
|
*/
|
5
5
|
|
@@ -217,7 +217,7 @@ typedef struct internal_state {
|
|
217
217
|
/* Depth of each subtree used as tie breaker for trees of equal frequency
|
218
218
|
*/
|
219
219
|
|
220
|
-
uchf *
|
220
|
+
uchf *l_buf; /* buffer for literals or lengths */
|
221
221
|
|
222
222
|
uInt lit_bufsize;
|
223
223
|
/* Size of match buffer for literals/lengths. There are 4 reasons for
|
@@ -239,8 +239,13 @@ typedef struct internal_state {
|
|
239
239
|
* - I can't count above 4
|
240
240
|
*/
|
241
241
|
|
242
|
-
uInt
|
243
|
-
|
242
|
+
uInt last_lit; /* running index in l_buf */
|
243
|
+
|
244
|
+
ushf *d_buf;
|
245
|
+
/* Buffer for distances. To simplify the code, d_buf and l_buf have
|
246
|
+
* the same number of elements. To use different lengths, an extra flag
|
247
|
+
* array would be necessary.
|
248
|
+
*/
|
244
249
|
|
245
250
|
ulg opt_len; /* bit length of current block with optimal trees */
|
246
251
|
ulg static_len; /* bit length of current block with static trees */
|
@@ -320,22 +325,20 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
|
|
320
325
|
|
321
326
|
# define _tr_tally_lit(s, c, flush) \
|
322
327
|
{ uch cc = (c); \
|
323
|
-
s->
|
324
|
-
s->
|
325
|
-
s->sym_buf[s->sym_next++] = cc; \
|
328
|
+
s->d_buf[s->last_lit] = 0; \
|
329
|
+
s->l_buf[s->last_lit++] = cc; \
|
326
330
|
s->dyn_ltree[cc].Freq++; \
|
327
|
-
flush = (s->
|
331
|
+
flush = (s->last_lit == s->lit_bufsize-1); \
|
328
332
|
}
|
329
333
|
# define _tr_tally_dist(s, distance, length, flush) \
|
330
334
|
{ uch len = (uch)(length); \
|
331
335
|
ush dist = (ush)(distance); \
|
332
|
-
s->
|
333
|
-
s->
|
334
|
-
s->sym_buf[s->sym_next++] = len; \
|
336
|
+
s->d_buf[s->last_lit] = dist; \
|
337
|
+
s->l_buf[s->last_lit++] = len; \
|
335
338
|
dist--; \
|
336
339
|
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
|
337
340
|
s->dyn_dtree[d_code(dist)].Freq++; \
|
338
|
-
flush = (s->
|
341
|
+
flush = (s->last_lit == s->lit_bufsize-1); \
|
339
342
|
}
|
340
343
|
#else
|
341
344
|
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* gzguts.h -- zlib internal header definitions for gz* operations
|
2
|
-
* Copyright (C) 2004
|
2
|
+
* Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
|
3
3
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
4
|
*/
|
5
5
|
|
@@ -39,7 +39,7 @@
|
|
39
39
|
# include <io.h>
|
40
40
|
#endif
|
41
41
|
|
42
|
-
#if defined(_WIN32)
|
42
|
+
#if defined(_WIN32) || defined(__CYGWIN__)
|
43
43
|
# define WIDECHAR
|
44
44
|
#endif
|
45
45
|
|
@@ -190,7 +190,6 @@ typedef struct {
|
|
190
190
|
/* just for writing */
|
191
191
|
int level; /* compression level */
|
192
192
|
int strategy; /* compression strategy */
|
193
|
-
int reset; /* true if a reset is pending after a Z_FINISH */
|
194
193
|
/* seek request */
|
195
194
|
z_off64_t skip; /* amount to skip (already rewound if backwards) */
|
196
195
|
int seek; /* true if seek request pending */
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/* infback.c -- inflate using a call-back interface
|
2
|
-
* Copyright (C) 1995-
|
2
|
+
* Copyright (C) 1995-2016 Mark Adler
|
3
3
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
4
4
|
*/
|
5
5
|
|
@@ -477,7 +477,6 @@ void FAR *out_desc;
|
|
477
477
|
}
|
478
478
|
Tracev((stderr, "inflate: codes ok\n"));
|
479
479
|
state->mode = LEN;
|
480
|
-
/* fallthrough */
|
481
480
|
|
482
481
|
case LEN:
|
483
482
|
/* use inflate_fast() if we have enough input and output */
|
@@ -70,7 +70,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
70
70
|
code const FAR *dcode; /* local strm->distcode */
|
71
71
|
unsigned lmask; /* mask for first level of length codes */
|
72
72
|
unsigned dmask; /* mask for first level of distance codes */
|
73
|
-
code
|
73
|
+
code here; /* retrieved table entry */
|
74
74
|
unsigned op; /* code bits, operation, extra bits, or */
|
75
75
|
/* window position, window bytes to copy */
|
76
76
|
unsigned len; /* match length, unused bytes */
|
@@ -107,20 +107,20 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
107
107
|
hold += (unsigned long)(*in++) << bits;
|
108
108
|
bits += 8;
|
109
109
|
}
|
110
|
-
here = lcode
|
110
|
+
here = lcode[hold & lmask];
|
111
111
|
dolen:
|
112
|
-
op = (unsigned)(here
|
112
|
+
op = (unsigned)(here.bits);
|
113
113
|
hold >>= op;
|
114
114
|
bits -= op;
|
115
|
-
op = (unsigned)(here
|
115
|
+
op = (unsigned)(here.op);
|
116
116
|
if (op == 0) { /* literal */
|
117
|
-
Tracevv((stderr, here
|
117
|
+
Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
118
118
|
"inflate: literal '%c'\n" :
|
119
|
-
"inflate: literal 0x%02x\n", here
|
120
|
-
*out++ = (unsigned char)(here
|
119
|
+
"inflate: literal 0x%02x\n", here.val));
|
120
|
+
*out++ = (unsigned char)(here.val);
|
121
121
|
}
|
122
122
|
else if (op & 16) { /* length base */
|
123
|
-
len = (unsigned)(here
|
123
|
+
len = (unsigned)(here.val);
|
124
124
|
op &= 15; /* number of extra bits */
|
125
125
|
if (op) {
|
126
126
|
if (bits < op) {
|
@@ -138,14 +138,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
138
138
|
hold += (unsigned long)(*in++) << bits;
|
139
139
|
bits += 8;
|
140
140
|
}
|
141
|
-
here = dcode
|
141
|
+
here = dcode[hold & dmask];
|
142
142
|
dodist:
|
143
|
-
op = (unsigned)(here
|
143
|
+
op = (unsigned)(here.bits);
|
144
144
|
hold >>= op;
|
145
145
|
bits -= op;
|
146
|
-
op = (unsigned)(here
|
146
|
+
op = (unsigned)(here.op);
|
147
147
|
if (op & 16) { /* distance base */
|
148
|
-
dist = (unsigned)(here
|
148
|
+
dist = (unsigned)(here.val);
|
149
149
|
op &= 15; /* number of extra bits */
|
150
150
|
if (bits < op) {
|
151
151
|
hold += (unsigned long)(*in++) << bits;
|
@@ -264,7 +264,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
264
264
|
}
|
265
265
|
}
|
266
266
|
else if ((op & 64) == 0) { /* 2nd level distance code */
|
267
|
-
here = dcode
|
267
|
+
here = dcode[here.val + (hold & ((1U << op) - 1))];
|
268
268
|
goto dodist;
|
269
269
|
}
|
270
270
|
else {
|
@@ -274,7 +274,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
|
274
274
|
}
|
275
275
|
}
|
276
276
|
else if ((op & 64) == 0) { /* 2nd level length code */
|
277
|
-
here = lcode
|
277
|
+
here = lcode[here.val + (hold & ((1U << op) - 1))];
|
278
278
|
goto dolen;
|
279
279
|
}
|
280
280
|
else if (op & 32) { /* end-of-block */
|