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.
Files changed (329) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/extconf.rb +1 -1
  3. data/ext/rugged/rugged_config.c +7 -2
  4. data/ext/rugged/rugged_remote.c +17 -0
  5. data/lib/rugged/version.rb +1 -1
  6. data/vendor/libgit2/CMakeLists.txt +103 -276
  7. data/vendor/libgit2/COPYING +36 -19
  8. data/vendor/libgit2/cmake/AddCFlagIfSupported.cmake +21 -21
  9. data/vendor/libgit2/cmake/DefaultCFlags.cmake +154 -0
  10. data/vendor/libgit2/cmake/EnableWarnings.cmake +13 -13
  11. data/vendor/libgit2/cmake/FindCoreFoundation.cmake +13 -13
  12. data/vendor/libgit2/cmake/FindGSSAPI.cmake +171 -287
  13. data/vendor/libgit2/cmake/FindGSSFramework.cmake +13 -13
  14. data/vendor/libgit2/cmake/{FindHTTP_Parser.cmake → FindHTTPParser.cmake} +17 -17
  15. data/vendor/libgit2/cmake/FindIconv.cmake +27 -27
  16. data/vendor/libgit2/cmake/FindLibSSH2.cmake +5 -5
  17. data/vendor/libgit2/cmake/FindPCRE.cmake +13 -13
  18. data/vendor/libgit2/cmake/FindPCRE2.cmake +12 -12
  19. data/vendor/libgit2/cmake/FindPkgLibraries.cmake +19 -19
  20. data/vendor/libgit2/cmake/FindSecurity.cmake +14 -14
  21. data/vendor/libgit2/cmake/FindStatNsec.cmake +12 -18
  22. data/vendor/libgit2/cmake/Findfutimens.cmake +8 -8
  23. data/vendor/libgit2/cmake/FindmbedTLS.cmake +63 -70
  24. data/vendor/libgit2/cmake/IdeSplitSources.cmake +18 -18
  25. data/vendor/libgit2/cmake/PkgBuildConfig.cmake +60 -60
  26. data/vendor/libgit2/cmake/SanitizeBool.cmake +20 -20
  27. data/vendor/libgit2/cmake/SelectGSSAPI.cmake +37 -37
  28. data/vendor/libgit2/cmake/SelectHTTPParser.cmake +19 -0
  29. data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +100 -100
  30. data/vendor/libgit2/cmake/SelectHashes.cmake +39 -49
  31. data/vendor/libgit2/cmake/SelectRegex.cmake +51 -0
  32. data/vendor/libgit2/cmake/SelectSSH.cmake +41 -0
  33. data/vendor/libgit2/cmake/SelectWinHTTP.cmake +17 -0
  34. data/vendor/libgit2/cmake/SelectZlib.cmake +34 -0
  35. data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +6 -6
  36. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +31 -31
  37. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +1 -1
  38. data/vendor/libgit2/deps/ntlmclient/ntlm.c +4 -4
  39. data/vendor/libgit2/deps/ntlmclient/ntlm.h +4 -4
  40. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +2 -2
  41. data/vendor/libgit2/deps/pcre/CMakeLists.txt +88 -88
  42. data/vendor/libgit2/deps/winhttp/CMakeLists.txt +14 -16
  43. data/vendor/libgit2/deps/zlib/adler32.c +0 -7
  44. data/vendor/libgit2/deps/zlib/crc32.c +288 -975
  45. data/vendor/libgit2/deps/zlib/crc32.h +436 -9441
  46. data/vendor/libgit2/deps/zlib/deflate.c +31 -83
  47. data/vendor/libgit2/deps/zlib/deflate.h +15 -12
  48. data/vendor/libgit2/deps/zlib/gzguts.h +2 -3
  49. data/vendor/libgit2/deps/zlib/infback.c +1 -2
  50. data/vendor/libgit2/deps/zlib/inffast.c +14 -14
  51. data/vendor/libgit2/deps/zlib/inflate.c +8 -39
  52. data/vendor/libgit2/deps/zlib/inflate.h +2 -3
  53. data/vendor/libgit2/deps/zlib/inftrees.c +3 -3
  54. data/vendor/libgit2/deps/zlib/trees.c +48 -27
  55. data/vendor/libgit2/deps/zlib/zlib.h +100 -126
  56. data/vendor/libgit2/deps/zlib/zutil.c +2 -2
  57. data/vendor/libgit2/deps/zlib/zutil.h +9 -12
  58. data/vendor/libgit2/include/git2/apply.h +16 -2
  59. data/vendor/libgit2/include/git2/attr.h +11 -2
  60. data/vendor/libgit2/include/git2/blame.h +4 -1
  61. data/vendor/libgit2/include/git2/blob.h +14 -1
  62. data/vendor/libgit2/include/git2/branch.h +2 -0
  63. data/vendor/libgit2/include/git2/buffer.h +18 -78
  64. data/vendor/libgit2/include/git2/cert.h +2 -2
  65. data/vendor/libgit2/include/git2/checkout.h +5 -2
  66. data/vendor/libgit2/include/git2/clone.h +3 -3
  67. data/vendor/libgit2/include/git2/commit.h +2 -0
  68. data/vendor/libgit2/include/git2/common.h +5 -12
  69. data/vendor/libgit2/include/git2/config.h +19 -3
  70. data/vendor/libgit2/include/git2/credential.h +2 -1
  71. data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
  72. data/vendor/libgit2/include/git2/deprecated.h +1 -1
  73. data/vendor/libgit2/include/git2/describe.h +7 -2
  74. data/vendor/libgit2/include/git2/diff.h +17 -9
  75. data/vendor/libgit2/include/git2/email.h +1 -1
  76. data/vendor/libgit2/include/git2/errors.h +1 -2
  77. data/vendor/libgit2/include/git2/filter.h +7 -2
  78. data/vendor/libgit2/include/git2/graph.h +1 -0
  79. data/vendor/libgit2/include/git2/ignore.h +1 -1
  80. data/vendor/libgit2/include/git2/index.h +11 -5
  81. data/vendor/libgit2/include/git2/indexer.h +19 -0
  82. data/vendor/libgit2/include/git2/merge.h +23 -3
  83. data/vendor/libgit2/include/git2/message.h +2 -0
  84. data/vendor/libgit2/include/git2/object.h +23 -0
  85. data/vendor/libgit2/include/git2/odb.h +37 -7
  86. data/vendor/libgit2/include/git2/odb_backend.h +1 -1
  87. data/vendor/libgit2/include/git2/pack.h +24 -8
  88. data/vendor/libgit2/include/git2/patch.h +8 -0
  89. data/vendor/libgit2/include/git2/pathspec.h +1 -1
  90. data/vendor/libgit2/include/git2/proxy.h +1 -1
  91. data/vendor/libgit2/include/git2/rebase.h +9 -1
  92. data/vendor/libgit2/include/git2/refdb.h +3 -0
  93. data/vendor/libgit2/include/git2/reflog.h +1 -1
  94. data/vendor/libgit2/include/git2/refs.h +2 -2
  95. data/vendor/libgit2/include/git2/remote.h +184 -37
  96. data/vendor/libgit2/include/git2/repository.h +14 -9
  97. data/vendor/libgit2/include/git2/reset.h +2 -2
  98. data/vendor/libgit2/include/git2/revparse.h +1 -1
  99. data/vendor/libgit2/include/git2/revwalk.h +4 -1
  100. data/vendor/libgit2/include/git2/signature.h +1 -1
  101. data/vendor/libgit2/include/git2/stash.h +3 -3
  102. data/vendor/libgit2/include/git2/status.h +9 -3
  103. data/vendor/libgit2/include/git2/submodule.h +7 -2
  104. data/vendor/libgit2/include/git2/sys/commit_graph.h +1 -1
  105. data/vendor/libgit2/include/git2/sys/odb_backend.h +2 -5
  106. data/vendor/libgit2/include/git2/sys/remote.h +31 -0
  107. data/vendor/libgit2/include/git2/sys/stream.h +1 -1
  108. data/vendor/libgit2/include/git2/sys/transport.h +25 -34
  109. data/vendor/libgit2/include/git2/tag.h +1 -0
  110. data/vendor/libgit2/include/git2/tree.h +4 -3
  111. data/vendor/libgit2/include/git2/types.h +7 -7
  112. data/vendor/libgit2/include/git2/version.h +3 -3
  113. data/vendor/libgit2/include/git2/worktree.h +12 -2
  114. data/vendor/libgit2/src/CMakeLists.txt +189 -315
  115. data/vendor/libgit2/src/annotated_commit.h +1 -1
  116. data/vendor/libgit2/src/apply.c +18 -18
  117. data/vendor/libgit2/src/apply.h +2 -2
  118. data/vendor/libgit2/src/attr.c +18 -18
  119. data/vendor/libgit2/src/attr_file.c +17 -17
  120. data/vendor/libgit2/src/attr_file.h +4 -4
  121. data/vendor/libgit2/src/attrcache.c +17 -12
  122. data/vendor/libgit2/src/blame_git.c +1 -1
  123. data/vendor/libgit2/src/blob.c +33 -26
  124. data/vendor/libgit2/src/blob.h +1 -1
  125. data/vendor/libgit2/src/branch.c +150 -109
  126. data/vendor/libgit2/src/branch.h +15 -3
  127. data/vendor/libgit2/src/buf.c +126 -0
  128. data/vendor/libgit2/src/buf.h +50 -0
  129. data/vendor/libgit2/src/cc-compat.h +1 -1
  130. data/vendor/libgit2/src/checkout.c +74 -68
  131. data/vendor/libgit2/src/cherrypick.c +10 -10
  132. data/vendor/libgit2/src/clone.c +66 -66
  133. data/vendor/libgit2/src/commit.c +128 -58
  134. data/vendor/libgit2/src/commit.h +24 -1
  135. data/vendor/libgit2/src/commit_graph.c +68 -53
  136. data/vendor/libgit2/src/commit_graph.h +10 -3
  137. data/vendor/libgit2/src/commit_list.c +2 -3
  138. data/vendor/libgit2/src/common.h +10 -3
  139. data/vendor/libgit2/src/config.c +99 -77
  140. data/vendor/libgit2/src/config.h +15 -2
  141. data/vendor/libgit2/src/config_file.c +103 -91
  142. data/vendor/libgit2/src/config_mem.c +9 -9
  143. data/vendor/libgit2/src/config_parse.c +27 -23
  144. data/vendor/libgit2/src/crlf.c +24 -21
  145. data/vendor/libgit2/src/date.c +10 -17
  146. data/vendor/libgit2/src/date.h +33 -0
  147. data/vendor/libgit2/src/describe.c +27 -19
  148. data/vendor/libgit2/src/diff.c +25 -8
  149. data/vendor/libgit2/src/diff.h +2 -4
  150. data/vendor/libgit2/src/diff_driver.c +34 -36
  151. data/vendor/libgit2/src/diff_driver.h +3 -3
  152. data/vendor/libgit2/src/diff_file.c +29 -20
  153. data/vendor/libgit2/src/diff_generate.c +30 -6
  154. data/vendor/libgit2/src/diff_generate.h +5 -3
  155. data/vendor/libgit2/src/diff_print.c +102 -95
  156. data/vendor/libgit2/src/diff_stats.c +40 -29
  157. data/vendor/libgit2/src/{message.h → diff_stats.h} +7 -6
  158. data/vendor/libgit2/src/diff_tform.c +9 -8
  159. data/vendor/libgit2/src/diff_xdiff.c +3 -8
  160. data/vendor/libgit2/src/email.c +54 -38
  161. data/vendor/libgit2/src/email.h +1 -1
  162. data/vendor/libgit2/src/errors.c +18 -18
  163. data/vendor/libgit2/src/features.h.in +6 -1
  164. data/vendor/libgit2/src/fetch.c +69 -24
  165. data/vendor/libgit2/src/fetch.h +1 -1
  166. data/vendor/libgit2/src/fetchhead.c +19 -19
  167. data/vendor/libgit2/src/filebuf.c +28 -28
  168. data/vendor/libgit2/src/filebuf.h +1 -1
  169. data/vendor/libgit2/src/filter.c +96 -52
  170. data/vendor/libgit2/src/filter.h +26 -5
  171. data/vendor/libgit2/src/fs_path.c +1912 -0
  172. data/vendor/libgit2/src/fs_path.h +752 -0
  173. data/vendor/libgit2/src/futils.c +91 -85
  174. data/vendor/libgit2/src/futils.h +26 -14
  175. data/vendor/libgit2/src/hash/sha1/collisiondetect.c +2 -2
  176. data/vendor/libgit2/src/hash/sha1/common_crypto.c +2 -2
  177. data/vendor/libgit2/src/hash/sha1/generic.c +2 -2
  178. data/vendor/libgit2/src/hash/sha1/mbedtls.c +2 -2
  179. data/vendor/libgit2/src/hash/sha1/openssl.c +2 -2
  180. data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +1 -1
  181. data/vendor/libgit2/src/hash/sha1/win32.c +6 -6
  182. data/vendor/libgit2/src/hash/sha1.h +3 -1
  183. data/vendor/libgit2/src/hash.c +67 -35
  184. data/vendor/libgit2/src/hash.h +12 -12
  185. data/vendor/libgit2/src/ident.c +18 -18
  186. data/vendor/libgit2/src/ignore.c +35 -34
  187. data/vendor/libgit2/src/ignore.h +2 -2
  188. data/vendor/libgit2/src/index.c +79 -80
  189. data/vendor/libgit2/src/index.h +6 -3
  190. data/vendor/libgit2/src/indexer.c +75 -57
  191. data/vendor/libgit2/src/iterator.c +64 -56
  192. data/vendor/libgit2/src/iterator.h +5 -5
  193. data/vendor/libgit2/src/khash.h +1 -1
  194. data/vendor/libgit2/src/libgit2.c +22 -19
  195. data/vendor/libgit2/src/mailmap.c +38 -36
  196. data/vendor/libgit2/src/merge.c +27 -27
  197. data/vendor/libgit2/src/merge.h +1 -14
  198. data/vendor/libgit2/src/merge_driver.c +2 -2
  199. data/vendor/libgit2/src/merge_file.c +13 -3
  200. data/vendor/libgit2/src/message.c +21 -10
  201. data/vendor/libgit2/src/midx.c +83 -66
  202. data/vendor/libgit2/src/midx.h +3 -3
  203. data/vendor/libgit2/src/mwindow.c +1 -1
  204. data/vendor/libgit2/src/net.c +278 -68
  205. data/vendor/libgit2/src/net.h +10 -3
  206. data/vendor/libgit2/src/netops.c +1 -1
  207. data/vendor/libgit2/src/netops.h +1 -1
  208. data/vendor/libgit2/src/notes.c +20 -29
  209. data/vendor/libgit2/src/object.c +49 -9
  210. data/vendor/libgit2/src/object.h +1 -1
  211. data/vendor/libgit2/src/odb.c +35 -32
  212. data/vendor/libgit2/src/odb.h +1 -1
  213. data/vendor/libgit2/src/odb_loose.c +68 -68
  214. data/vendor/libgit2/src/odb_mempack.c +18 -5
  215. data/vendor/libgit2/src/odb_pack.c +43 -43
  216. data/vendor/libgit2/src/oid.c +11 -4
  217. data/vendor/libgit2/src/oid.h +15 -0
  218. data/vendor/libgit2/src/pack-objects.c +41 -26
  219. data/vendor/libgit2/src/pack-objects.h +11 -6
  220. data/vendor/libgit2/src/pack.c +10 -10
  221. data/vendor/libgit2/src/patch.c +3 -3
  222. data/vendor/libgit2/src/patch.h +1 -0
  223. data/vendor/libgit2/src/patch_generate.c +27 -11
  224. data/vendor/libgit2/src/patch_generate.h +5 -5
  225. data/vendor/libgit2/src/patch_parse.c +24 -24
  226. data/vendor/libgit2/src/path.c +76 -1951
  227. data/vendor/libgit2/src/path.h +34 -741
  228. data/vendor/libgit2/src/pathspec.c +6 -6
  229. data/vendor/libgit2/src/pathspec.h +2 -2
  230. data/vendor/libgit2/src/posix.c +3 -3
  231. data/vendor/libgit2/src/posix.h +1 -0
  232. data/vendor/libgit2/src/pqueue.h +1 -1
  233. data/vendor/libgit2/src/proxy.c +4 -1
  234. data/vendor/libgit2/src/proxy.h +1 -1
  235. data/vendor/libgit2/src/push.c +30 -35
  236. data/vendor/libgit2/src/push.h +4 -16
  237. data/vendor/libgit2/src/rand.c +226 -0
  238. data/vendor/libgit2/src/rand.h +37 -0
  239. data/vendor/libgit2/src/reader.c +8 -8
  240. data/vendor/libgit2/src/reader.h +2 -2
  241. data/vendor/libgit2/src/rebase.c +89 -88
  242. data/vendor/libgit2/src/refdb_fs.c +447 -173
  243. data/vendor/libgit2/src/refs.c +32 -32
  244. data/vendor/libgit2/src/refs.h +2 -2
  245. data/vendor/libgit2/src/refspec.c +32 -37
  246. data/vendor/libgit2/src/refspec.h +5 -2
  247. data/vendor/libgit2/src/regexp.c +1 -1
  248. data/vendor/libgit2/src/remote.c +713 -419
  249. data/vendor/libgit2/src/remote.h +15 -10
  250. data/vendor/libgit2/src/repository.c +350 -467
  251. data/vendor/libgit2/src/repository.h +11 -10
  252. data/vendor/libgit2/src/reset.c +8 -5
  253. data/vendor/libgit2/src/revert.c +10 -10
  254. data/vendor/libgit2/src/revparse.c +48 -35
  255. data/vendor/libgit2/src/revwalk.c +7 -7
  256. data/vendor/libgit2/src/signature.c +12 -6
  257. data/vendor/libgit2/src/signature.h +1 -1
  258. data/vendor/libgit2/src/sortedcache.c +1 -1
  259. data/vendor/libgit2/src/sortedcache.h +1 -1
  260. data/vendor/libgit2/src/stash.c +36 -37
  261. data/vendor/libgit2/src/status.c +4 -1
  262. data/vendor/libgit2/src/{buffer.c → str.c} +157 -151
  263. data/vendor/libgit2/src/str.h +357 -0
  264. data/vendor/libgit2/src/streams/mbedtls.c +8 -6
  265. data/vendor/libgit2/src/streams/openssl_dynamic.h +3 -3
  266. data/vendor/libgit2/src/submodule.c +171 -159
  267. data/vendor/libgit2/src/submodule.h +1 -1
  268. data/vendor/libgit2/src/sysdir.c +68 -52
  269. data/vendor/libgit2/src/sysdir.h +15 -10
  270. data/vendor/libgit2/src/tag.c +29 -27
  271. data/vendor/libgit2/src/thread.h +3 -3
  272. data/vendor/libgit2/src/threadstate.c +3 -3
  273. data/vendor/libgit2/src/threadstate.h +1 -1
  274. data/vendor/libgit2/src/trace.c +1 -14
  275. data/vendor/libgit2/src/trace.h +5 -22
  276. data/vendor/libgit2/src/trailer.c +1 -1
  277. data/vendor/libgit2/src/transaction.c +1 -1
  278. data/vendor/libgit2/src/transport.c +10 -10
  279. data/vendor/libgit2/src/transports/auth.c +7 -9
  280. data/vendor/libgit2/src/transports/auth.h +2 -3
  281. data/vendor/libgit2/src/transports/auth_negotiate.c +12 -13
  282. data/vendor/libgit2/src/transports/auth_ntlm.c +10 -10
  283. data/vendor/libgit2/src/transports/auth_ntlm.h +0 -1
  284. data/vendor/libgit2/src/transports/git.c +9 -11
  285. data/vendor/libgit2/src/transports/http.c +37 -17
  286. data/vendor/libgit2/src/transports/http.h +2 -3
  287. data/vendor/libgit2/src/transports/httpclient.c +65 -65
  288. data/vendor/libgit2/src/transports/local.c +124 -116
  289. data/vendor/libgit2/src/transports/smart.c +51 -139
  290. data/vendor/libgit2/src/transports/smart.h +25 -31
  291. data/vendor/libgit2/src/transports/smart_pkt.c +33 -33
  292. data/vendor/libgit2/src/transports/smart_protocol.c +57 -39
  293. data/vendor/libgit2/src/transports/ssh.c +47 -112
  294. data/vendor/libgit2/src/transports/winhttp.c +50 -56
  295. data/vendor/libgit2/src/tree-cache.c +5 -5
  296. data/vendor/libgit2/src/tree-cache.h +2 -2
  297. data/vendor/libgit2/src/tree.c +59 -48
  298. data/vendor/libgit2/src/tree.h +1 -1
  299. data/vendor/libgit2/src/unix/map.c +0 -2
  300. data/vendor/libgit2/src/unix/posix.h +1 -4
  301. data/vendor/libgit2/src/unix/realpath.c +0 -2
  302. data/vendor/libgit2/src/util.c +14 -14
  303. data/vendor/libgit2/src/util.h +2 -28
  304. data/vendor/libgit2/src/vector.h +1 -1
  305. data/vendor/libgit2/src/win32/findfile.c +172 -116
  306. data/vendor/libgit2/src/win32/findfile.h +7 -4
  307. data/vendor/libgit2/src/win32/path_w32.c +140 -9
  308. data/vendor/libgit2/src/win32/path_w32.h +2 -0
  309. data/vendor/libgit2/src/win32/posix.h +0 -1
  310. data/vendor/libgit2/src/win32/posix_w32.c +11 -27
  311. data/vendor/libgit2/src/win32/w32_buffer.c +2 -3
  312. data/vendor/libgit2/src/win32/w32_buffer.h +2 -3
  313. data/vendor/libgit2/src/win32/w32_leakcheck.c +1 -1
  314. data/vendor/libgit2/src/worktree.c +116 -94
  315. data/vendor/libgit2/src/worktree.h +1 -1
  316. data/vendor/libgit2/src/xdiff/git-xdiff.h +53 -0
  317. data/vendor/libgit2/src/xdiff/xdiff.h +15 -15
  318. data/vendor/libgit2/src/xdiff/xdiffi.c +134 -108
  319. data/vendor/libgit2/src/xdiff/xemit.c +23 -7
  320. data/vendor/libgit2/src/xdiff/xhistogram.c +87 -78
  321. data/vendor/libgit2/src/xdiff/xinclude.h +1 -12
  322. data/vendor/libgit2/src/xdiff/xmerge.c +104 -117
  323. data/vendor/libgit2/src/xdiff/xpatience.c +6 -17
  324. data/vendor/libgit2/src/xdiff/xprepare.c +15 -20
  325. data/vendor/libgit2/src/xdiff/xutils.c +18 -7
  326. data/vendor/libgit2/src/zstream.c +5 -5
  327. data/vendor/libgit2/src/zstream.h +4 -4
  328. metadata +25 -10
  329. data/vendor/libgit2/src/buffer.h +0 -374
@@ -1,5 +1,5 @@
1
1
  /* inflate.c -- zlib decompression
2
- * Copyright (C) 1995-2022 Mark Adler
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 UPDATE_CHECK(check, buf, len) \
450
+ # define UPDATE(check, buf, len) \
452
451
  (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
453
452
  #else
454
- # define UPDATE_CHECK(check, buf, len) adler32(check, buf, len)
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
- UPDATE_CHECK(state->check, put - out, out);
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 ((state->wrap & 4) && hold != (state->total & 0xffffffff)) {
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
- UPDATE_CHECK(state->check, strm->next_out - out, out);
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 && state->wrap)
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-2019 Mark Adler
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, 0 if zlib, or
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-2022 Mark Adler
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 Copyright 1995-2022 Mark Adler ";
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, 199, 202};
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-2021 Jean-loup Gailly
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 code, int len));
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->sym_next = s->matches = 0;
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
- if (stored_len)
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->sym_next / 3));
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->sym_buf[s->sym_next++] = (uch)dist;
1021
- s->sym_buf[s->sym_next++] = (uch)(dist >> 8);
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
- return (s->sym_next == s->sym_end);
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 sx = 0; /* running index in sym_buf */
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->sym_next != 0) do {
1055
- dist = s->sym_buf[sx++] & 0xff;
1056
- dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
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 sym_buf is ok: */
1083
- Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
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 (sx < s->sym_next);
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
- * "block list" (0..6, 14..25, 28..31).
1115
+ * "black list" (0..6, 14..25, 28..31).
1095
1116
  * b) There is at least one printable character belonging to the
1096
- * "allow list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
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
- /* block_mask is the bit mask of block-listed bytes
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 block_mask = 0xf3ffc07fUL;
1131
+ unsigned long black_mask = 0xf3ffc07fUL;
1111
1132
  int n;
1112
1133
 
1113
- /* Check for non-textual ("block-listed") bytes. */
1114
- for (n = 0; n <= 31; n++, block_mask >>= 1)
1115
- if ((block_mask & 1) && (s->dyn_ltree[n].Freq != 0))
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 ("allow-listed") bytes. */
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 "block-listed" or "allow-listed" bytes:
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;