rugged 1.3.2.3 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
/* inflate.c -- zlib decompression
|
|
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
|
|
|
@@ -130,7 +130,6 @@ z_streamp strm;
|
|
|
130
130
|
state->mode = HEAD;
|
|
131
131
|
state->last = 0;
|
|
132
132
|
state->havedict = 0;
|
|
133
|
-
state->flags = -1;
|
|
134
133
|
state->dmax = 32768U;
|
|
135
134
|
state->head = Z_NULL;
|
|
136
135
|
state->hold = 0;
|
|
@@ -448,10 +447,10 @@ unsigned copy;
|
|
|
448
447
|
|
|
449
448
|
/* check function to use adler32() for zlib or crc32() for gzip */
|
|
450
449
|
#ifdef GUNZIP
|
|
451
|
-
# define
|
|
450
|
+
# define UPDATE(check, buf, len) \
|
|
452
451
|
(state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
|
|
453
452
|
#else
|
|
454
|
-
# define
|
|
453
|
+
# define UPDATE(check, buf, len) adler32(check, buf, len)
|
|
455
454
|
#endif
|
|
456
455
|
|
|
457
456
|
/* check macros for header crc */
|
|
@@ -671,6 +670,7 @@ int flush;
|
|
|
671
670
|
state->mode = FLAGS;
|
|
672
671
|
break;
|
|
673
672
|
}
|
|
673
|
+
state->flags = 0; /* expect zlib header */
|
|
674
674
|
if (state->head != Z_NULL)
|
|
675
675
|
state->head->done = -1;
|
|
676
676
|
if (!(state->wrap & 1) || /* check if zlib header allowed */
|
|
@@ -697,7 +697,6 @@ int flush;
|
|
|
697
697
|
break;
|
|
698
698
|
}
|
|
699
699
|
state->dmax = 1U << len;
|
|
700
|
-
state->flags = 0; /* indicate zlib header */
|
|
701
700
|
Tracev((stderr, "inflate: zlib header ok\n"));
|
|
702
701
|
strm->adler = state->check = adler32(0L, Z_NULL, 0);
|
|
703
702
|
state->mode = hold & 0x200 ? DICTID : TYPE;
|
|
@@ -723,7 +722,6 @@ int flush;
|
|
|
723
722
|
CRC2(state->check, hold);
|
|
724
723
|
INITBITS();
|
|
725
724
|
state->mode = TIME;
|
|
726
|
-
/* fallthrough */
|
|
727
725
|
case TIME:
|
|
728
726
|
NEEDBITS(32);
|
|
729
727
|
if (state->head != Z_NULL)
|
|
@@ -732,7 +730,6 @@ int flush;
|
|
|
732
730
|
CRC4(state->check, hold);
|
|
733
731
|
INITBITS();
|
|
734
732
|
state->mode = OS;
|
|
735
|
-
/* fallthrough */
|
|
736
733
|
case OS:
|
|
737
734
|
NEEDBITS(16);
|
|
738
735
|
if (state->head != Z_NULL) {
|
|
@@ -743,7 +740,6 @@ int flush;
|
|
|
743
740
|
CRC2(state->check, hold);
|
|
744
741
|
INITBITS();
|
|
745
742
|
state->mode = EXLEN;
|
|
746
|
-
/* fallthrough */
|
|
747
743
|
case EXLEN:
|
|
748
744
|
if (state->flags & 0x0400) {
|
|
749
745
|
NEEDBITS(16);
|
|
@@ -757,7 +753,6 @@ int flush;
|
|
|
757
753
|
else if (state->head != Z_NULL)
|
|
758
754
|
state->head->extra = Z_NULL;
|
|
759
755
|
state->mode = EXTRA;
|
|
760
|
-
/* fallthrough */
|
|
761
756
|
case EXTRA:
|
|
762
757
|
if (state->flags & 0x0400) {
|
|
763
758
|
copy = state->length;
|
|
@@ -780,7 +775,6 @@ int flush;
|
|
|
780
775
|
}
|
|
781
776
|
state->length = 0;
|
|
782
777
|
state->mode = NAME;
|
|
783
|
-
/* fallthrough */
|
|
784
778
|
case NAME:
|
|
785
779
|
if (state->flags & 0x0800) {
|
|
786
780
|
if (have == 0) goto inf_leave;
|
|
@@ -802,7 +796,6 @@ int flush;
|
|
|
802
796
|
state->head->name = Z_NULL;
|
|
803
797
|
state->length = 0;
|
|
804
798
|
state->mode = COMMENT;
|
|
805
|
-
/* fallthrough */
|
|
806
799
|
case COMMENT:
|
|
807
800
|
if (state->flags & 0x1000) {
|
|
808
801
|
if (have == 0) goto inf_leave;
|
|
@@ -823,7 +816,6 @@ int flush;
|
|
|
823
816
|
else if (state->head != Z_NULL)
|
|
824
817
|
state->head->comment = Z_NULL;
|
|
825
818
|
state->mode = HCRC;
|
|
826
|
-
/* fallthrough */
|
|
827
819
|
case HCRC:
|
|
828
820
|
if (state->flags & 0x0200) {
|
|
829
821
|
NEEDBITS(16);
|
|
@@ -847,7 +839,6 @@ int flush;
|
|
|
847
839
|
strm->adler = state->check = ZSWAP32(hold);
|
|
848
840
|
INITBITS();
|
|
849
841
|
state->mode = DICT;
|
|
850
|
-
/* fallthrough */
|
|
851
842
|
case DICT:
|
|
852
843
|
if (state->havedict == 0) {
|
|
853
844
|
RESTORE();
|
|
@@ -855,10 +846,8 @@ int flush;
|
|
|
855
846
|
}
|
|
856
847
|
strm->adler = state->check = adler32(0L, Z_NULL, 0);
|
|
857
848
|
state->mode = TYPE;
|
|
858
|
-
/* fallthrough */
|
|
859
849
|
case TYPE:
|
|
860
850
|
if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
|
|
861
|
-
/* fallthrough */
|
|
862
851
|
case TYPEDO:
|
|
863
852
|
if (state->last) {
|
|
864
853
|
BYTEBITS();
|
|
@@ -909,10 +898,8 @@ int flush;
|
|
|
909
898
|
INITBITS();
|
|
910
899
|
state->mode = COPY_;
|
|
911
900
|
if (flush == Z_TREES) goto inf_leave;
|
|
912
|
-
/* fallthrough */
|
|
913
901
|
case COPY_:
|
|
914
902
|
state->mode = COPY;
|
|
915
|
-
/* fallthrough */
|
|
916
903
|
case COPY:
|
|
917
904
|
copy = state->length;
|
|
918
905
|
if (copy) {
|
|
@@ -948,7 +935,6 @@ int flush;
|
|
|
948
935
|
Tracev((stderr, "inflate: table sizes ok\n"));
|
|
949
936
|
state->have = 0;
|
|
950
937
|
state->mode = LENLENS;
|
|
951
|
-
/* fallthrough */
|
|
952
938
|
case LENLENS:
|
|
953
939
|
while (state->have < state->ncode) {
|
|
954
940
|
NEEDBITS(3);
|
|
@@ -970,7 +956,6 @@ int flush;
|
|
|
970
956
|
Tracev((stderr, "inflate: code lengths ok\n"));
|
|
971
957
|
state->have = 0;
|
|
972
958
|
state->mode = CODELENS;
|
|
973
|
-
/* fallthrough */
|
|
974
959
|
case CODELENS:
|
|
975
960
|
while (state->have < state->nlen + state->ndist) {
|
|
976
961
|
for (;;) {
|
|
@@ -1054,10 +1039,8 @@ int flush;
|
|
|
1054
1039
|
Tracev((stderr, "inflate: codes ok\n"));
|
|
1055
1040
|
state->mode = LEN_;
|
|
1056
1041
|
if (flush == Z_TREES) goto inf_leave;
|
|
1057
|
-
/* fallthrough */
|
|
1058
1042
|
case LEN_:
|
|
1059
1043
|
state->mode = LEN;
|
|
1060
|
-
/* fallthrough */
|
|
1061
1044
|
case LEN:
|
|
1062
1045
|
if (have >= 6 && left >= 258) {
|
|
1063
1046
|
RESTORE();
|
|
@@ -1107,7 +1090,6 @@ int flush;
|
|
|
1107
1090
|
}
|
|
1108
1091
|
state->extra = (unsigned)(here.op) & 15;
|
|
1109
1092
|
state->mode = LENEXT;
|
|
1110
|
-
/* fallthrough */
|
|
1111
1093
|
case LENEXT:
|
|
1112
1094
|
if (state->extra) {
|
|
1113
1095
|
NEEDBITS(state->extra);
|
|
@@ -1118,7 +1100,6 @@ int flush;
|
|
|
1118
1100
|
Tracevv((stderr, "inflate: length %u\n", state->length));
|
|
1119
1101
|
state->was = state->length;
|
|
1120
1102
|
state->mode = DIST;
|
|
1121
|
-
/* fallthrough */
|
|
1122
1103
|
case DIST:
|
|
1123
1104
|
for (;;) {
|
|
1124
1105
|
here = state->distcode[BITS(state->distbits)];
|
|
@@ -1146,7 +1127,6 @@ int flush;
|
|
|
1146
1127
|
state->offset = (unsigned)here.val;
|
|
1147
1128
|
state->extra = (unsigned)(here.op) & 15;
|
|
1148
1129
|
state->mode = DISTEXT;
|
|
1149
|
-
/* fallthrough */
|
|
1150
1130
|
case DISTEXT:
|
|
1151
1131
|
if (state->extra) {
|
|
1152
1132
|
NEEDBITS(state->extra);
|
|
@@ -1163,7 +1143,6 @@ int flush;
|
|
|
1163
1143
|
#endif
|
|
1164
1144
|
Tracevv((stderr, "inflate: distance %u\n", state->offset));
|
|
1165
1145
|
state->mode = MATCH;
|
|
1166
|
-
/* fallthrough */
|
|
1167
1146
|
case MATCH:
|
|
1168
1147
|
if (left == 0) goto inf_leave;
|
|
1169
1148
|
copy = out - left;
|
|
@@ -1223,7 +1202,7 @@ int flush;
|
|
|
1223
1202
|
state->total += out;
|
|
1224
1203
|
if ((state->wrap & 4) && out)
|
|
1225
1204
|
strm->adler = state->check =
|
|
1226
|
-
|
|
1205
|
+
UPDATE(state->check, put - out, out);
|
|
1227
1206
|
out = left;
|
|
1228
1207
|
if ((state->wrap & 4) && (
|
|
1229
1208
|
#ifdef GUNZIP
|
|
@@ -1239,11 +1218,10 @@ int flush;
|
|
|
1239
1218
|
}
|
|
1240
1219
|
#ifdef GUNZIP
|
|
1241
1220
|
state->mode = LENGTH;
|
|
1242
|
-
/* fallthrough */
|
|
1243
1221
|
case LENGTH:
|
|
1244
1222
|
if (state->wrap && state->flags) {
|
|
1245
1223
|
NEEDBITS(32);
|
|
1246
|
-
if (
|
|
1224
|
+
if (hold != (state->total & 0xffffffffUL)) {
|
|
1247
1225
|
strm->msg = (char *)"incorrect length check";
|
|
1248
1226
|
state->mode = BAD;
|
|
1249
1227
|
break;
|
|
@@ -1253,7 +1231,6 @@ int flush;
|
|
|
1253
1231
|
}
|
|
1254
1232
|
#endif
|
|
1255
1233
|
state->mode = DONE;
|
|
1256
|
-
/* fallthrough */
|
|
1257
1234
|
case DONE:
|
|
1258
1235
|
ret = Z_STREAM_END;
|
|
1259
1236
|
goto inf_leave;
|
|
@@ -1263,7 +1240,6 @@ int flush;
|
|
|
1263
1240
|
case MEM:
|
|
1264
1241
|
return Z_MEM_ERROR;
|
|
1265
1242
|
case SYNC:
|
|
1266
|
-
/* fallthrough */
|
|
1267
1243
|
default:
|
|
1268
1244
|
return Z_STREAM_ERROR;
|
|
1269
1245
|
}
|
|
@@ -1289,7 +1265,7 @@ int flush;
|
|
|
1289
1265
|
state->total += out;
|
|
1290
1266
|
if ((state->wrap & 4) && out)
|
|
1291
1267
|
strm->adler = state->check =
|
|
1292
|
-
|
|
1268
|
+
UPDATE(state->check, strm->next_out - out, out);
|
|
1293
1269
|
strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
|
|
1294
1270
|
(state->mode == TYPE ? 128 : 0) +
|
|
1295
1271
|
(state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
|
|
@@ -1425,7 +1401,6 @@ int ZEXPORT inflateSync(strm)
|
|
|
1425
1401
|
z_streamp strm;
|
|
1426
1402
|
{
|
|
1427
1403
|
unsigned len; /* number of bytes to look at or looked at */
|
|
1428
|
-
int flags; /* temporary to save header status */
|
|
1429
1404
|
unsigned long in, out; /* temporary to save total_in and total_out */
|
|
1430
1405
|
unsigned char buf[4]; /* to restore bit buffer to byte string */
|
|
1431
1406
|
struct inflate_state FAR *state;
|
|
@@ -1458,15 +1433,9 @@ z_streamp strm;
|
|
|
1458
1433
|
|
|
1459
1434
|
/* return no joy or set up to restart inflate() on a new block */
|
|
1460
1435
|
if (state->have != 4) return Z_DATA_ERROR;
|
|
1461
|
-
if (state->flags == -1)
|
|
1462
|
-
state->wrap = 0; /* if no header yet, treat as raw */
|
|
1463
|
-
else
|
|
1464
|
-
state->wrap &= ~4; /* no point in computing a check value now */
|
|
1465
|
-
flags = state->flags;
|
|
1466
1436
|
in = strm->total_in; out = strm->total_out;
|
|
1467
1437
|
inflateReset(strm);
|
|
1468
1438
|
strm->total_in = in; strm->total_out = out;
|
|
1469
|
-
state->flags = flags;
|
|
1470
1439
|
state->mode = TYPE;
|
|
1471
1440
|
return Z_OK;
|
|
1472
1441
|
}
|
|
@@ -1562,7 +1531,7 @@ int check;
|
|
|
1562
1531
|
|
|
1563
1532
|
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
|
|
1564
1533
|
state = (struct inflate_state FAR *)strm->state;
|
|
1565
|
-
if (check
|
|
1534
|
+
if (check)
|
|
1566
1535
|
state->wrap |= 4;
|
|
1567
1536
|
else
|
|
1568
1537
|
state->wrap &= ~4;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* inflate.h -- internal inflate state definition
|
|
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
|
|
|
@@ -86,8 +86,7 @@ struct inflate_state {
|
|
|
86
86
|
int wrap; /* bit 0 true for zlib, bit 1 true for gzip,
|
|
87
87
|
bit 2 true to validate check value */
|
|
88
88
|
int havedict; /* true if dictionary provided */
|
|
89
|
-
int flags; /* gzip header method and flags
|
|
90
|
-
-1 if raw or no header yet */
|
|
89
|
+
int flags; /* gzip header method and flags (0 if zlib) */
|
|
91
90
|
unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
|
|
92
91
|
unsigned long check; /* protected copy of check value */
|
|
93
92
|
unsigned long total; /* protected copy of output count */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* inftrees.c -- generate Huffman trees for efficient decoding
|
|
2
|
-
* Copyright (C) 1995-
|
|
2
|
+
* Copyright (C) 1995-2017 Mark Adler
|
|
3
3
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
#define MAXBITS 15
|
|
10
10
|
|
|
11
11
|
const char inflate_copyright[] =
|
|
12
|
-
" inflate 1.2.
|
|
12
|
+
" inflate 1.2.11 Copyright 1995-2017 Mark Adler ";
|
|
13
13
|
/*
|
|
14
14
|
If you use the zlib library in a product, an acknowledgment is welcome
|
|
15
15
|
in the documentation of your product. If for some reason you cannot
|
|
@@ -62,7 +62,7 @@ unsigned short FAR *work;
|
|
|
62
62
|
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
|
|
63
63
|
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
|
64
64
|
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
|
65
|
-
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16,
|
|
65
|
+
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 202};
|
|
66
66
|
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
|
|
67
67
|
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
|
68
68
|
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* trees.c -- output deflated data using Huffman coding
|
|
2
|
-
* Copyright (C) 1995-
|
|
2
|
+
* Copyright (C) 1995-2017 Jean-loup Gailly
|
|
3
3
|
* detect_data_type() function provided freely by Cosmin Truta, 2006
|
|
4
4
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
5
5
|
*/
|
|
@@ -149,7 +149,7 @@ local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
|
|
|
149
149
|
local void compress_block OF((deflate_state *s, const ct_data *ltree,
|
|
150
150
|
const ct_data *dtree));
|
|
151
151
|
local int detect_data_type OF((deflate_state *s));
|
|
152
|
-
local unsigned bi_reverse OF((unsigned
|
|
152
|
+
local unsigned bi_reverse OF((unsigned value, int length));
|
|
153
153
|
local void bi_windup OF((deflate_state *s));
|
|
154
154
|
local void bi_flush OF((deflate_state *s));
|
|
155
155
|
|
|
@@ -416,7 +416,7 @@ local void init_block(s)
|
|
|
416
416
|
|
|
417
417
|
s->dyn_ltree[END_BLOCK].Freq = 1;
|
|
418
418
|
s->opt_len = s->static_len = 0L;
|
|
419
|
-
s->
|
|
419
|
+
s->last_lit = s->matches = 0;
|
|
420
420
|
}
|
|
421
421
|
|
|
422
422
|
#define SMALLEST 1
|
|
@@ -870,8 +870,7 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
|
|
|
870
870
|
bi_windup(s); /* align on byte boundary */
|
|
871
871
|
put_short(s, (ush)stored_len);
|
|
872
872
|
put_short(s, (ush)~stored_len);
|
|
873
|
-
|
|
874
|
-
zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len);
|
|
873
|
+
zmemcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len);
|
|
875
874
|
s->pending += stored_len;
|
|
876
875
|
#ifdef ZLIB_DEBUG
|
|
877
876
|
s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
|
|
@@ -948,7 +947,7 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
|
|
|
948
947
|
|
|
949
948
|
Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
|
|
950
949
|
opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
|
951
|
-
s->
|
|
950
|
+
s->last_lit));
|
|
952
951
|
|
|
953
952
|
if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
|
|
954
953
|
|
|
@@ -1017,9 +1016,8 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
|
|
|
1017
1016
|
unsigned dist; /* distance of matched string */
|
|
1018
1017
|
unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
|
|
1019
1018
|
{
|
|
1020
|
-
s->
|
|
1021
|
-
s->
|
|
1022
|
-
s->sym_buf[s->sym_next++] = (uch)lc;
|
|
1019
|
+
s->d_buf[s->last_lit] = (ush)dist;
|
|
1020
|
+
s->l_buf[s->last_lit++] = (uch)lc;
|
|
1023
1021
|
if (dist == 0) {
|
|
1024
1022
|
/* lc is the unmatched char */
|
|
1025
1023
|
s->dyn_ltree[lc].Freq++;
|
|
@@ -1034,7 +1032,30 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc)
|
|
|
1034
1032
|
s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
|
|
1035
1033
|
s->dyn_dtree[d_code(dist)].Freq++;
|
|
1036
1034
|
}
|
|
1037
|
-
|
|
1035
|
+
|
|
1036
|
+
#ifdef TRUNCATE_BLOCK
|
|
1037
|
+
/* Try to guess if it is profitable to stop the current block here */
|
|
1038
|
+
if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
|
|
1039
|
+
/* Compute an upper bound for the compressed length */
|
|
1040
|
+
ulg out_length = (ulg)s->last_lit*8L;
|
|
1041
|
+
ulg in_length = (ulg)((long)s->strstart - s->block_start);
|
|
1042
|
+
int dcode;
|
|
1043
|
+
for (dcode = 0; dcode < D_CODES; dcode++) {
|
|
1044
|
+
out_length += (ulg)s->dyn_dtree[dcode].Freq *
|
|
1045
|
+
(5L+extra_dbits[dcode]);
|
|
1046
|
+
}
|
|
1047
|
+
out_length >>= 3;
|
|
1048
|
+
Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
|
|
1049
|
+
s->last_lit, in_length, out_length,
|
|
1050
|
+
100L - out_length*100L/in_length));
|
|
1051
|
+
if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
|
|
1052
|
+
}
|
|
1053
|
+
#endif
|
|
1054
|
+
return (s->last_lit == s->lit_bufsize-1);
|
|
1055
|
+
/* We avoid equality with lit_bufsize because of wraparound at 64K
|
|
1056
|
+
* on 16 bit machines and because stored blocks are restricted to
|
|
1057
|
+
* 64K-1 bytes.
|
|
1058
|
+
*/
|
|
1038
1059
|
}
|
|
1039
1060
|
|
|
1040
1061
|
/* ===========================================================================
|
|
@@ -1047,14 +1068,13 @@ local void compress_block(s, ltree, dtree)
|
|
|
1047
1068
|
{
|
|
1048
1069
|
unsigned dist; /* distance of matched string */
|
|
1049
1070
|
int lc; /* match length or unmatched char (if dist == 0) */
|
|
1050
|
-
unsigned
|
|
1071
|
+
unsigned lx = 0; /* running index in l_buf */
|
|
1051
1072
|
unsigned code; /* the code to send */
|
|
1052
1073
|
int extra; /* number of extra bits to send */
|
|
1053
1074
|
|
|
1054
|
-
if (s->
|
|
1055
|
-
dist = s->
|
|
1056
|
-
|
|
1057
|
-
lc = s->sym_buf[sx++];
|
|
1075
|
+
if (s->last_lit != 0) do {
|
|
1076
|
+
dist = s->d_buf[lx];
|
|
1077
|
+
lc = s->l_buf[lx++];
|
|
1058
1078
|
if (dist == 0) {
|
|
1059
1079
|
send_code(s, lc, ltree); /* send a literal byte */
|
|
1060
1080
|
Tracecv(isgraph(lc), (stderr," '%c' ", lc));
|
|
@@ -1079,10 +1099,11 @@ local void compress_block(s, ltree, dtree)
|
|
|
1079
1099
|
}
|
|
1080
1100
|
} /* literal or match pair ? */
|
|
1081
1101
|
|
|
1082
|
-
/* Check that the overlay between pending_buf and
|
|
1083
|
-
Assert(s->pending < s->lit_bufsize +
|
|
1102
|
+
/* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
|
|
1103
|
+
Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
|
|
1104
|
+
"pendingBuf overflow");
|
|
1084
1105
|
|
|
1085
|
-
} while (
|
|
1106
|
+
} while (lx < s->last_lit);
|
|
1086
1107
|
|
|
1087
1108
|
send_code(s, END_BLOCK, ltree);
|
|
1088
1109
|
}
|
|
@@ -1091,9 +1112,9 @@ local void compress_block(s, ltree, dtree)
|
|
|
1091
1112
|
* Check if the data type is TEXT or BINARY, using the following algorithm:
|
|
1092
1113
|
* - TEXT if the two conditions below are satisfied:
|
|
1093
1114
|
* a) There are no non-portable control characters belonging to the
|
|
1094
|
-
* "
|
|
1115
|
+
* "black list" (0..6, 14..25, 28..31).
|
|
1095
1116
|
* b) There is at least one printable character belonging to the
|
|
1096
|
-
* "
|
|
1117
|
+
* "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
|
|
1097
1118
|
* - BINARY otherwise.
|
|
1098
1119
|
* - The following partially-portable control characters form a
|
|
1099
1120
|
* "gray list" that is ignored in this detection algorithm:
|
|
@@ -1103,19 +1124,19 @@ local void compress_block(s, ltree, dtree)
|
|
|
1103
1124
|
local int detect_data_type(s)
|
|
1104
1125
|
deflate_state *s;
|
|
1105
1126
|
{
|
|
1106
|
-
/*
|
|
1127
|
+
/* black_mask is the bit mask of black-listed bytes
|
|
1107
1128
|
* set bits 0..6, 14..25, and 28..31
|
|
1108
1129
|
* 0xf3ffc07f = binary 11110011111111111100000001111111
|
|
1109
1130
|
*/
|
|
1110
|
-
unsigned long
|
|
1131
|
+
unsigned long black_mask = 0xf3ffc07fUL;
|
|
1111
1132
|
int n;
|
|
1112
1133
|
|
|
1113
|
-
/* Check for non-textual ("
|
|
1114
|
-
for (n = 0; n <= 31; n++,
|
|
1115
|
-
if ((
|
|
1134
|
+
/* Check for non-textual ("black-listed") bytes. */
|
|
1135
|
+
for (n = 0; n <= 31; n++, black_mask >>= 1)
|
|
1136
|
+
if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0))
|
|
1116
1137
|
return Z_BINARY;
|
|
1117
1138
|
|
|
1118
|
-
/* Check for textual ("
|
|
1139
|
+
/* Check for textual ("white-listed") bytes. */
|
|
1119
1140
|
if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
|
|
1120
1141
|
|| s->dyn_ltree[13].Freq != 0)
|
|
1121
1142
|
return Z_TEXT;
|
|
@@ -1123,7 +1144,7 @@ local int detect_data_type(s)
|
|
|
1123
1144
|
if (s->dyn_ltree[n].Freq != 0)
|
|
1124
1145
|
return Z_TEXT;
|
|
1125
1146
|
|
|
1126
|
-
/* There are no "
|
|
1147
|
+
/* There are no "black-listed" or "white-listed" bytes:
|
|
1127
1148
|
* this stream either is empty or has tolerated ("gray-listed") bytes only.
|
|
1128
1149
|
*/
|
|
1129
1150
|
return Z_BINARY;
|