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.
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
  /* deflate.c -- compress data using the deflation algorithm
2
- * Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
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.12 Copyright 1995-2022 Jean-loup Gailly and Mark Adler ";
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
- do { \
194
- s->head[s->hash_size-1] = NIL; \
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
- /* We overlay pending_buf and sym_buf. This works since the average size
333
- * for length/distance pairs over any compressed block is assured to be 31
334
- * bits or less.
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->sym_buf = s->pending_buf + s->lit_bufsize;
382
- s->sym_end = (s->lit_bufsize - 1) * 3;
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 = -2;
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 (bits < 0 || bits > 16 ||
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->last_flush != -2) {
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->avail_in || (s->strstart - s->block_start) + s->lookahead)
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
- ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4);
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->sym_buf = ds->pending_buf + ds->lit_bufsize;
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->sym_next)
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->sym_next)
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->sym_next)
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->sym_next)
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-2018 Jean-loup Gailly
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 *sym_buf; /* buffer for distances and literals/lengths */
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 sym_next; /* running index in sym_buf */
243
- uInt sym_end; /* symbol table full when sym_next reaches this */
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->sym_buf[s->sym_next++] = 0; \
324
- s->sym_buf[s->sym_next++] = 0; \
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->sym_next == s->sym_end); \
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->sym_buf[s->sym_next++] = (uch)dist; \
333
- s->sym_buf[s->sym_next++] = (uch)(dist >> 8); \
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->sym_next == s->sym_end); \
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-2019 Mark Adler
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-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
 
@@ -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 const *here; /* retrieved table entry */
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 + (hold & lmask);
110
+ here = lcode[hold & lmask];
111
111
  dolen:
112
- op = (unsigned)(here->bits);
112
+ op = (unsigned)(here.bits);
113
113
  hold >>= op;
114
114
  bits -= op;
115
- op = (unsigned)(here->op);
115
+ op = (unsigned)(here.op);
116
116
  if (op == 0) { /* literal */
117
- Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
117
+ Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
118
118
  "inflate: literal '%c'\n" :
119
- "inflate: literal 0x%02x\n", here->val));
120
- *out++ = (unsigned char)(here->val);
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->val);
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 + (hold & dmask);
141
+ here = dcode[hold & dmask];
142
142
  dodist:
143
- op = (unsigned)(here->bits);
143
+ op = (unsigned)(here.bits);
144
144
  hold >>= op;
145
145
  bits -= op;
146
- op = (unsigned)(here->op);
146
+ op = (unsigned)(here.op);
147
147
  if (op & 16) { /* distance base */
148
- dist = (unsigned)(here->val);
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 + here->val + (hold & ((1U << op) - 1));
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 + here->val + (hold & ((1U << op) - 1));
277
+ here = lcode[here.val + (hold & ((1U << op) - 1))];
278
278
  goto dolen;
279
279
  }
280
280
  else if (op & 32) { /* end-of-block */