rugged 0.19.0 → 0.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (668) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +1 -1
  3. data/README.md +184 -33
  4. data/ext/rugged/extconf.rb +111 -28
  5. data/ext/rugged/rugged.c +327 -89
  6. data/ext/rugged/rugged.h +64 -28
  7. data/ext/rugged/rugged_allocator.c +89 -0
  8. data/ext/rugged/rugged_backend.c +17 -0
  9. data/ext/rugged/rugged_blame.c +278 -0
  10. data/ext/rugged/rugged_blob.c +301 -75
  11. data/ext/rugged/rugged_branch.c +92 -242
  12. data/ext/rugged/rugged_branch_collection.c +388 -0
  13. data/ext/rugged/rugged_commit.c +575 -79
  14. data/ext/rugged/rugged_config.c +129 -36
  15. data/ext/rugged/rugged_cred.c +131 -0
  16. data/ext/rugged/rugged_diff.c +291 -122
  17. data/ext/rugged/rugged_diff_delta.c +16 -22
  18. data/ext/rugged/rugged_diff_hunk.c +35 -51
  19. data/ext/rugged/rugged_diff_line.c +23 -36
  20. data/ext/rugged/rugged_index.c +289 -152
  21. data/ext/rugged/rugged_note.c +50 -60
  22. data/ext/rugged/rugged_object.c +13 -30
  23. data/ext/rugged/rugged_patch.c +400 -0
  24. data/ext/rugged/rugged_rebase.c +397 -0
  25. data/ext/rugged/rugged_reference.c +76 -346
  26. data/ext/rugged/rugged_reference_collection.c +423 -0
  27. data/ext/rugged/rugged_remote.c +438 -461
  28. data/ext/rugged/rugged_remote_collection.c +435 -0
  29. data/ext/rugged/rugged_repo.c +1548 -365
  30. data/ext/rugged/rugged_revwalk.c +378 -99
  31. data/ext/rugged/rugged_settings.c +86 -23
  32. data/ext/rugged/rugged_signature.c +47 -37
  33. data/ext/rugged/rugged_submodule.c +835 -0
  34. data/ext/rugged/rugged_submodule_collection.c +366 -0
  35. data/ext/rugged/rugged_tag.c +88 -210
  36. data/ext/rugged/rugged_tag_collection.c +326 -0
  37. data/ext/rugged/rugged_tree.c +460 -217
  38. data/lib/rugged/attributes.rb +46 -0
  39. data/lib/rugged/blob.rb +33 -0
  40. data/lib/rugged/branch.rb +12 -16
  41. data/lib/rugged/commit.rb +9 -0
  42. data/lib/rugged/console.rb +5 -0
  43. data/lib/rugged/credentials.rb +48 -0
  44. data/lib/rugged/diff/delta.rb +6 -2
  45. data/lib/rugged/diff/hunk.rb +9 -9
  46. data/lib/rugged/diff/line.rb +28 -5
  47. data/lib/rugged/diff.rb +7 -1
  48. data/lib/rugged/index.rb +120 -0
  49. data/lib/rugged/object.rb +5 -0
  50. data/lib/rugged/patch.rb +41 -0
  51. data/lib/rugged/reference.rb +6 -3
  52. data/lib/rugged/remote.rb +5 -9
  53. data/lib/rugged/repository.rb +126 -14
  54. data/lib/rugged/submodule_collection.rb +53 -0
  55. data/lib/rugged/tag.rb +45 -16
  56. data/lib/rugged/tree.rb +163 -1
  57. data/lib/rugged/version.rb +6 -1
  58. data/lib/rugged/walker.rb +5 -0
  59. data/lib/rugged.rb +16 -1
  60. data/vendor/libgit2/AUTHORS +77 -0
  61. data/vendor/libgit2/CMakeLists.txt +317 -0
  62. data/vendor/libgit2/COPYING +993 -0
  63. data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +30 -0
  64. data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +29 -0
  65. data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +96 -0
  66. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +11 -0
  67. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +26 -0
  68. data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +324 -0
  69. data/vendor/libgit2/cmake/Modules/FindHTTP_Parser.cmake +39 -0
  70. data/vendor/libgit2/cmake/Modules/FindIconv.cmake +45 -0
  71. data/vendor/libgit2/cmake/Modules/FindPkgLibraries.cmake +28 -0
  72. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +28 -0
  73. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +20 -0
  74. data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +93 -0
  75. data/vendor/libgit2/cmake/Modules/IdeSplitSources.cmake +22 -0
  76. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +5 -0
  77. data/vendor/libgit2/deps/http-parser/COPYING +23 -0
  78. data/vendor/libgit2/deps/http-parser/http_parser.c +5 -2
  79. data/vendor/libgit2/deps/http-parser/http_parser.h +2 -0
  80. data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
  81. data/vendor/libgit2/deps/regex/COPYING +502 -0
  82. data/vendor/libgit2/deps/regex/regex.c +10 -3
  83. data/vendor/libgit2/deps/winhttp/CMakeLists.txt +26 -0
  84. data/vendor/libgit2/deps/winhttp/COPYING.GPL +993 -0
  85. data/vendor/libgit2/deps/winhttp/COPYING.LGPL +502 -0
  86. data/vendor/libgit2/deps/winhttp/urlmon.h +45 -0
  87. data/vendor/libgit2/deps/winhttp/winhttp.def +29 -0
  88. data/vendor/libgit2/deps/winhttp/winhttp.h +594 -0
  89. data/vendor/libgit2/deps/winhttp/winhttp64.def +29 -0
  90. data/vendor/libgit2/deps/zlib/CMakeLists.txt +5 -0
  91. data/vendor/libgit2/deps/zlib/COPYING +27 -0
  92. data/vendor/libgit2/deps/zlib/adler32.c +51 -34
  93. data/vendor/libgit2/deps/zlib/crc32.c +61 -61
  94. data/vendor/libgit2/deps/zlib/crc32.h +1 -1
  95. data/vendor/libgit2/deps/zlib/deflate.c +681 -352
  96. data/vendor/libgit2/deps/zlib/deflate.h +25 -18
  97. data/vendor/libgit2/deps/zlib/gzguts.h +218 -0
  98. data/vendor/libgit2/deps/zlib/infback.c +640 -0
  99. data/vendor/libgit2/deps/zlib/inffast.c +36 -53
  100. data/vendor/libgit2/deps/zlib/inffixed.h +3 -3
  101. data/vendor/libgit2/deps/zlib/inflate.c +167 -86
  102. data/vendor/libgit2/deps/zlib/inflate.h +7 -4
  103. data/vendor/libgit2/deps/zlib/inftrees.c +24 -50
  104. data/vendor/libgit2/deps/zlib/trees.c +55 -96
  105. data/vendor/libgit2/deps/zlib/zconf.h +499 -19
  106. data/vendor/libgit2/deps/zlib/zlib.h +526 -227
  107. data/vendor/libgit2/deps/zlib/zutil.c +39 -32
  108. data/vendor/libgit2/deps/zlib/zutil.h +75 -78
  109. data/vendor/libgit2/include/git2/annotated_commit.h +125 -0
  110. data/vendor/libgit2/include/git2/apply.h +129 -0
  111. data/vendor/libgit2/include/git2/attr.h +36 -21
  112. data/vendor/libgit2/include/git2/blame.h +229 -0
  113. data/vendor/libgit2/include/git2/blob.h +81 -44
  114. data/vendor/libgit2/include/git2/branch.h +81 -42
  115. data/vendor/libgit2/include/git2/buffer.h +128 -0
  116. data/vendor/libgit2/include/git2/checkout.h +141 -67
  117. data/vendor/libgit2/include/git2/cherrypick.h +92 -0
  118. data/vendor/libgit2/include/git2/clone.h +157 -58
  119. data/vendor/libgit2/include/git2/commit.h +231 -12
  120. data/vendor/libgit2/include/git2/common.h +216 -30
  121. data/vendor/libgit2/include/git2/config.h +274 -48
  122. data/vendor/libgit2/include/git2/cred_helpers.h +4 -4
  123. data/vendor/libgit2/include/git2/deprecated.h +253 -0
  124. data/vendor/libgit2/include/git2/describe.h +189 -0
  125. data/vendor/libgit2/include/git2/diff.h +985 -575
  126. data/vendor/libgit2/include/git2/errors.h +93 -52
  127. data/vendor/libgit2/include/git2/filter.h +217 -0
  128. data/vendor/libgit2/include/git2/global.h +44 -0
  129. data/vendor/libgit2/include/git2/graph.h +17 -0
  130. data/vendor/libgit2/include/git2/ignore.h +2 -2
  131. data/vendor/libgit2/include/git2/index.h +269 -94
  132. data/vendor/libgit2/include/git2/indexer.h +44 -12
  133. data/vendor/libgit2/include/git2/mailmap.h +115 -0
  134. data/vendor/libgit2/include/git2/merge.h +501 -64
  135. data/vendor/libgit2/include/git2/message.h +52 -17
  136. data/vendor/libgit2/include/git2/net.h +11 -5
  137. data/vendor/libgit2/include/git2/notes.h +120 -16
  138. data/vendor/libgit2/include/git2/object.h +62 -23
  139. data/vendor/libgit2/include/git2/odb.h +140 -24
  140. data/vendor/libgit2/include/git2/odb_backend.h +56 -12
  141. data/vendor/libgit2/include/git2/oid.h +17 -18
  142. data/vendor/libgit2/include/git2/oidarray.h +40 -0
  143. data/vendor/libgit2/include/git2/pack.h +86 -7
  144. data/vendor/libgit2/include/git2/patch.h +274 -0
  145. data/vendor/libgit2/include/git2/pathspec.h +280 -0
  146. data/vendor/libgit2/include/git2/proxy.h +96 -0
  147. data/vendor/libgit2/include/git2/rebase.h +323 -0
  148. data/vendor/libgit2/include/git2/reflog.h +12 -9
  149. data/vendor/libgit2/include/git2/refs.h +241 -46
  150. data/vendor/libgit2/include/git2/refspec.h +20 -4
  151. data/vendor/libgit2/include/git2/remote.h +636 -209
  152. data/vendor/libgit2/include/git2/repository.h +267 -57
  153. data/vendor/libgit2/include/git2/reset.h +36 -6
  154. data/vendor/libgit2/include/git2/revert.h +91 -0
  155. data/vendor/libgit2/include/git2/revparse.h +27 -16
  156. data/vendor/libgit2/include/git2/revwalk.h +78 -35
  157. data/vendor/libgit2/include/git2/signature.h +32 -5
  158. data/vendor/libgit2/include/git2/stash.h +160 -21
  159. data/vendor/libgit2/include/git2/status.h +92 -30
  160. data/vendor/libgit2/include/git2/submodule.h +226 -133
  161. data/vendor/libgit2/include/git2/sys/alloc.h +101 -0
  162. data/vendor/libgit2/include/git2/sys/commit.h +38 -4
  163. data/vendor/libgit2/include/git2/sys/config.h +68 -9
  164. data/vendor/libgit2/include/git2/sys/diff.h +94 -0
  165. data/vendor/libgit2/include/git2/sys/filter.h +332 -0
  166. data/vendor/libgit2/include/git2/sys/hashsig.h +106 -0
  167. data/vendor/libgit2/include/git2/sys/index.h +6 -5
  168. data/vendor/libgit2/include/git2/sys/mempack.h +86 -0
  169. data/vendor/libgit2/include/git2/sys/merge.h +182 -0
  170. data/vendor/libgit2/include/git2/sys/odb_backend.h +66 -28
  171. data/vendor/libgit2/include/git2/sys/openssl.h +38 -0
  172. data/vendor/libgit2/include/git2/sys/path.h +64 -0
  173. data/vendor/libgit2/include/git2/sys/refdb_backend.h +79 -19
  174. data/vendor/libgit2/include/git2/sys/reflog.h +21 -0
  175. data/vendor/libgit2/include/git2/sys/refs.h +13 -2
  176. data/vendor/libgit2/include/git2/sys/repository.h +64 -1
  177. data/vendor/libgit2/include/git2/sys/stream.h +138 -0
  178. data/vendor/libgit2/include/git2/sys/time.h +31 -0
  179. data/vendor/libgit2/include/git2/sys/transport.h +439 -0
  180. data/vendor/libgit2/include/git2/tag.h +11 -2
  181. data/vendor/libgit2/include/git2/trace.h +1 -1
  182. data/vendor/libgit2/include/git2/transaction.h +121 -0
  183. data/vendor/libgit2/include/git2/transport.h +261 -292
  184. data/vendor/libgit2/include/git2/tree.h +111 -21
  185. data/vendor/libgit2/include/git2/types.h +244 -32
  186. data/vendor/libgit2/include/git2/version.h +5 -2
  187. data/vendor/libgit2/include/git2/worktree.h +255 -0
  188. data/vendor/libgit2/include/git2.h +50 -40
  189. data/vendor/libgit2/libgit2.pc.in +13 -0
  190. data/vendor/libgit2/src/CMakeLists.txt +525 -0
  191. data/vendor/libgit2/src/alloc.c +55 -0
  192. data/vendor/libgit2/src/alloc.h +40 -0
  193. data/vendor/libgit2/src/annotated_commit.c +228 -0
  194. data/vendor/libgit2/src/annotated_commit.h +52 -0
  195. data/vendor/libgit2/src/apply.c +855 -0
  196. data/vendor/libgit2/src/apply.h +25 -0
  197. data/vendor/libgit2/src/array.h +74 -16
  198. data/vendor/libgit2/src/attr.c +239 -408
  199. data/vendor/libgit2/src/attr.h +3 -33
  200. data/vendor/libgit2/src/attr_file.c +424 -156
  201. data/vendor/libgit2/src/attr_file.h +95 -23
  202. data/vendor/libgit2/src/attrcache.c +469 -0
  203. data/vendor/libgit2/src/attrcache.h +37 -5
  204. data/vendor/libgit2/src/bitvec.h +75 -0
  205. data/vendor/libgit2/src/blame.c +532 -0
  206. data/vendor/libgit2/src/blame.h +95 -0
  207. data/vendor/libgit2/src/blame_git.c +668 -0
  208. data/vendor/libgit2/src/blame_git.h +22 -0
  209. data/vendor/libgit2/src/blob.c +233 -129
  210. data/vendor/libgit2/src/blob.h +29 -1
  211. data/vendor/libgit2/src/branch.c +295 -197
  212. data/vendor/libgit2/src/branch.h +2 -0
  213. data/vendor/libgit2/src/buf_text.c +52 -27
  214. data/vendor/libgit2/src/buf_text.h +7 -7
  215. data/vendor/libgit2/src/buffer.c +609 -52
  216. data/vendor/libgit2/src/buffer.h +68 -23
  217. data/vendor/libgit2/src/cache.c +48 -51
  218. data/vendor/libgit2/src/cache.h +6 -4
  219. data/vendor/libgit2/src/cc-compat.h +35 -7
  220. data/vendor/libgit2/src/checkout.c +1827 -483
  221. data/vendor/libgit2/src/checkout.h +4 -1
  222. data/vendor/libgit2/src/cherrypick.c +230 -0
  223. data/vendor/libgit2/src/clone.c +338 -258
  224. data/vendor/libgit2/src/{compress.h → clone.h} +5 -5
  225. data/vendor/libgit2/src/commit.c +711 -124
  226. data/vendor/libgit2/src/commit.h +10 -3
  227. data/vendor/libgit2/src/commit_list.c +21 -14
  228. data/vendor/libgit2/src/commit_list.h +9 -3
  229. data/vendor/libgit2/src/common.h +153 -13
  230. data/vendor/libgit2/src/config.c +871 -242
  231. data/vendor/libgit2/src/config.h +58 -14
  232. data/vendor/libgit2/src/config_backend.h +84 -0
  233. data/vendor/libgit2/src/config_cache.c +44 -18
  234. data/vendor/libgit2/src/config_entries.c +259 -0
  235. data/vendor/libgit2/src/config_entries.h +23 -0
  236. data/vendor/libgit2/src/config_file.c +837 -1113
  237. data/vendor/libgit2/src/config_mem.c +224 -0
  238. data/vendor/libgit2/src/config_parse.c +558 -0
  239. data/vendor/libgit2/src/config_parse.h +64 -0
  240. data/vendor/libgit2/src/crlf.c +290 -195
  241. data/vendor/libgit2/src/date.c +35 -7
  242. data/vendor/libgit2/src/delta.c +275 -71
  243. data/vendor/libgit2/src/delta.h +80 -58
  244. data/vendor/libgit2/src/describe.c +893 -0
  245. data/vendor/libgit2/src/diff.c +330 -1128
  246. data/vendor/libgit2/src/diff.h +25 -67
  247. data/vendor/libgit2/src/diff_driver.c +225 -109
  248. data/vendor/libgit2/src/diff_driver.h +5 -2
  249. data/vendor/libgit2/src/diff_file.c +128 -103
  250. data/vendor/libgit2/src/diff_file.h +17 -12
  251. data/vendor/libgit2/src/diff_generate.c +1622 -0
  252. data/vendor/libgit2/src/diff_generate.h +128 -0
  253. data/vendor/libgit2/src/diff_parse.c +108 -0
  254. data/vendor/libgit2/src/diff_parse.h +20 -0
  255. data/vendor/libgit2/src/diff_print.c +578 -218
  256. data/vendor/libgit2/src/diff_stats.c +362 -0
  257. data/vendor/libgit2/src/diff_tform.c +429 -257
  258. data/vendor/libgit2/src/diff_tform.h +25 -0
  259. data/vendor/libgit2/src/diff_xdiff.c +143 -46
  260. data/vendor/libgit2/src/diff_xdiff.h +12 -5
  261. data/vendor/libgit2/src/errors.c +150 -34
  262. data/vendor/libgit2/src/features.h.in +37 -0
  263. data/vendor/libgit2/src/fetch.c +69 -46
  264. data/vendor/libgit2/src/fetch.h +6 -12
  265. data/vendor/libgit2/src/fetchhead.c +40 -33
  266. data/vendor/libgit2/src/fetchhead.h +5 -4
  267. data/vendor/libgit2/src/filebuf.c +163 -61
  268. data/vendor/libgit2/src/filebuf.h +13 -7
  269. data/vendor/libgit2/src/fileops.c +549 -407
  270. data/vendor/libgit2/src/fileops.h +97 -106
  271. data/vendor/libgit2/src/filter.c +989 -46
  272. data/vendor/libgit2/src/filter.h +21 -70
  273. data/vendor/libgit2/src/fnmatch.c +67 -11
  274. data/vendor/libgit2/src/fnmatch.h +27 -7
  275. data/vendor/libgit2/src/global.c +257 -63
  276. data/vendor/libgit2/src/global.h +19 -0
  277. data/vendor/libgit2/src/graph.c +39 -23
  278. data/vendor/libgit2/src/hash/hash_collisiondetect.h +51 -0
  279. data/vendor/libgit2/src/hash/hash_common_crypto.h +61 -0
  280. data/vendor/libgit2/src/hash/hash_generic.c +3 -3
  281. data/vendor/libgit2/src/hash/hash_generic.h +10 -5
  282. data/vendor/libgit2/src/hash/hash_mbedtls.c +38 -0
  283. data/vendor/libgit2/src/hash/hash_mbedtls.h +24 -0
  284. data/vendor/libgit2/src/hash/hash_openssl.h +26 -8
  285. data/vendor/libgit2/src/hash/hash_win32.c +71 -43
  286. data/vendor/libgit2/src/hash/hash_win32.h +4 -3
  287. data/vendor/libgit2/src/hash/sha1dc/sha1.c +1900 -0
  288. data/vendor/libgit2/src/hash/sha1dc/sha1.h +110 -0
  289. data/vendor/libgit2/src/hash/sha1dc/ubc_check.c +372 -0
  290. data/vendor/libgit2/src/hash/sha1dc/ubc_check.h +52 -0
  291. data/vendor/libgit2/src/hash.c +0 -1
  292. data/vendor/libgit2/src/hash.h +13 -6
  293. data/vendor/libgit2/src/hashsig.c +121 -126
  294. data/vendor/libgit2/src/ident.c +129 -0
  295. data/vendor/libgit2/src/idxmap.c +153 -0
  296. data/vendor/libgit2/src/idxmap.h +41 -0
  297. data/vendor/libgit2/src/ignore.c +362 -123
  298. data/vendor/libgit2/src/ignore.h +16 -4
  299. data/vendor/libgit2/src/index.c +2131 -692
  300. data/vendor/libgit2/src/index.h +138 -6
  301. data/vendor/libgit2/src/indexer.c +866 -266
  302. data/vendor/libgit2/src/indexer.h +16 -0
  303. data/vendor/libgit2/src/integer.h +106 -0
  304. data/vendor/libgit2/src/iterator.c +1888 -967
  305. data/vendor/libgit2/src/iterator.h +130 -67
  306. data/vendor/libgit2/src/khash.h +43 -29
  307. data/vendor/libgit2/src/mailmap.c +485 -0
  308. data/vendor/libgit2/src/mailmap.h +35 -0
  309. data/vendor/libgit2/src/map.h +1 -1
  310. data/vendor/libgit2/src/merge.c +1679 -479
  311. data/vendor/libgit2/src/merge.h +89 -22
  312. data/vendor/libgit2/src/merge_driver.c +426 -0
  313. data/vendor/libgit2/src/merge_driver.h +62 -0
  314. data/vendor/libgit2/src/merge_file.c +238 -101
  315. data/vendor/libgit2/src/message.c +4 -28
  316. data/vendor/libgit2/src/message.h +3 -1
  317. data/vendor/libgit2/src/mwindow.c +123 -15
  318. data/vendor/libgit2/src/mwindow.h +10 -1
  319. data/vendor/libgit2/src/netops.c +178 -499
  320. data/vendor/libgit2/src/netops.h +51 -27
  321. data/vendor/libgit2/src/notes.c +251 -94
  322. data/vendor/libgit2/src/notes.h +5 -2
  323. data/vendor/libgit2/src/object.c +253 -67
  324. data/vendor/libgit2/src/object.h +40 -2
  325. data/vendor/libgit2/src/object_api.c +30 -11
  326. data/vendor/libgit2/src/odb.c +765 -201
  327. data/vendor/libgit2/src/odb.h +40 -8
  328. data/vendor/libgit2/src/odb_loose.c +560 -346
  329. data/vendor/libgit2/src/odb_mempack.c +185 -0
  330. data/vendor/libgit2/src/odb_pack.c +117 -73
  331. data/vendor/libgit2/src/offmap.c +113 -0
  332. data/vendor/libgit2/src/offmap.h +32 -42
  333. data/vendor/libgit2/src/oid.c +45 -25
  334. data/vendor/libgit2/src/oid.h +26 -8
  335. data/vendor/libgit2/src/oidarray.c +34 -0
  336. data/vendor/libgit2/src/oidarray.h +20 -0
  337. data/vendor/libgit2/src/oidmap.c +125 -0
  338. data/vendor/libgit2/src/oidmap.h +30 -17
  339. data/vendor/libgit2/src/pack-objects.c +688 -265
  340. data/vendor/libgit2/src/pack-objects.h +27 -13
  341. data/vendor/libgit2/src/pack.c +418 -202
  342. data/vendor/libgit2/src/pack.h +25 -16
  343. data/vendor/libgit2/src/parse.c +124 -0
  344. data/vendor/libgit2/src/parse.h +61 -0
  345. data/vendor/libgit2/src/patch.c +223 -0
  346. data/vendor/libgit2/src/patch.h +68 -0
  347. data/vendor/libgit2/src/patch_generate.c +901 -0
  348. data/vendor/libgit2/src/patch_generate.h +69 -0
  349. data/vendor/libgit2/src/patch_parse.c +1136 -0
  350. data/vendor/libgit2/src/patch_parse.h +51 -0
  351. data/vendor/libgit2/src/path.c +1247 -241
  352. data/vendor/libgit2/src/path.h +353 -57
  353. data/vendor/libgit2/src/pathspec.c +586 -58
  354. data/vendor/libgit2/src/pathspec.h +37 -15
  355. data/vendor/libgit2/src/pool.c +134 -221
  356. data/vendor/libgit2/src/pool.h +38 -50
  357. data/vendor/libgit2/src/posix.c +76 -10
  358. data/vendor/libgit2/src/posix.h +74 -32
  359. data/vendor/libgit2/src/pqueue.c +79 -117
  360. data/vendor/libgit2/src/pqueue.h +38 -82
  361. data/vendor/libgit2/src/proxy.c +39 -0
  362. data/vendor/libgit2/src/proxy.h +17 -0
  363. data/vendor/libgit2/src/push.c +178 -279
  364. data/vendor/libgit2/src/push.h +93 -4
  365. data/vendor/libgit2/src/reader.c +265 -0
  366. data/vendor/libgit2/src/reader.h +107 -0
  367. data/vendor/libgit2/src/rebase.c +1364 -0
  368. data/vendor/libgit2/src/refdb.c +74 -19
  369. data/vendor/libgit2/src/refdb.h +16 -3
  370. data/vendor/libgit2/src/refdb_fs.c +1472 -603
  371. data/vendor/libgit2/src/refdb_fs.h +4 -0
  372. data/vendor/libgit2/src/reflog.c +40 -330
  373. data/vendor/libgit2/src/reflog.h +8 -2
  374. data/vendor/libgit2/src/refs.c +641 -225
  375. data/vendor/libgit2/src/refs.h +53 -6
  376. data/vendor/libgit2/src/refspec.c +175 -62
  377. data/vendor/libgit2/src/refspec.h +10 -25
  378. data/vendor/libgit2/src/remote.c +1741 -723
  379. data/vendor/libgit2/src/remote.h +17 -5
  380. data/vendor/libgit2/src/repository.c +1505 -421
  381. data/vendor/libgit2/src/repository.h +95 -15
  382. data/vendor/libgit2/src/reset.c +63 -26
  383. data/vendor/libgit2/src/revert.c +232 -0
  384. data/vendor/libgit2/src/revparse.c +94 -80
  385. data/vendor/libgit2/src/revwalk.c +427 -194
  386. data/vendor/libgit2/src/revwalk.h +14 -5
  387. data/vendor/libgit2/src/settings.c +290 -0
  388. data/vendor/libgit2/src/sha1_lookup.c +16 -159
  389. data/vendor/libgit2/src/sha1_lookup.h +5 -4
  390. data/vendor/libgit2/src/signature.c +138 -26
  391. data/vendor/libgit2/src/signature.h +5 -0
  392. data/vendor/libgit2/src/sortedcache.c +395 -0
  393. data/vendor/libgit2/src/sortedcache.h +180 -0
  394. data/vendor/libgit2/src/stash.c +629 -168
  395. data/vendor/libgit2/src/status.c +125 -75
  396. data/vendor/libgit2/src/status.h +4 -2
  397. data/vendor/libgit2/src/stdalloc.c +120 -0
  398. data/vendor/libgit2/src/stdalloc.h +17 -0
  399. data/vendor/libgit2/src/stream.h +86 -0
  400. data/vendor/libgit2/src/streams/mbedtls.c +483 -0
  401. data/vendor/libgit2/src/streams/mbedtls.h +23 -0
  402. data/vendor/libgit2/src/streams/openssl.c +789 -0
  403. data/vendor/libgit2/src/streams/openssl.h +23 -0
  404. data/vendor/libgit2/src/streams/registry.c +118 -0
  405. data/vendor/libgit2/src/streams/registry.h +19 -0
  406. data/vendor/libgit2/src/streams/socket.c +235 -0
  407. data/vendor/libgit2/src/streams/socket.h +23 -0
  408. data/vendor/libgit2/src/streams/stransport.c +323 -0
  409. data/vendor/libgit2/src/streams/stransport.h +21 -0
  410. data/vendor/libgit2/src/streams/tls.c +73 -0
  411. data/vendor/libgit2/src/streams/tls.h +31 -0
  412. data/vendor/libgit2/src/strmap.c +147 -0
  413. data/vendor/libgit2/src/strmap.h +46 -51
  414. data/vendor/libgit2/src/strnlen.h +24 -0
  415. data/vendor/libgit2/src/submodule.c +1633 -877
  416. data/vendor/libgit2/src/submodule.h +83 -21
  417. data/vendor/libgit2/src/sysdir.c +355 -0
  418. data/vendor/libgit2/src/sysdir.h +119 -0
  419. data/vendor/libgit2/src/tag.c +87 -62
  420. data/vendor/libgit2/src/tag.h +4 -1
  421. data/vendor/libgit2/src/thread-utils.c +3 -0
  422. data/vendor/libgit2/src/thread-utils.h +71 -35
  423. data/vendor/libgit2/src/trace.c +4 -4
  424. data/vendor/libgit2/src/trace.h +11 -3
  425. data/vendor/libgit2/src/trailer.c +416 -0
  426. data/vendor/libgit2/src/transaction.c +382 -0
  427. data/vendor/libgit2/src/transaction.h +14 -0
  428. data/vendor/libgit2/src/transport.c +133 -67
  429. data/vendor/libgit2/src/transports/auth.c +75 -0
  430. data/vendor/libgit2/src/transports/auth.h +64 -0
  431. data/vendor/libgit2/src/transports/auth_negotiate.c +277 -0
  432. data/vendor/libgit2/src/transports/auth_negotiate.h +27 -0
  433. data/vendor/libgit2/src/transports/cred.c +296 -68
  434. data/vendor/libgit2/src/transports/cred.h +16 -0
  435. data/vendor/libgit2/src/transports/cred_helpers.c +4 -0
  436. data/vendor/libgit2/src/transports/git.c +108 -90
  437. data/vendor/libgit2/src/transports/http.c +803 -258
  438. data/vendor/libgit2/src/transports/http.h +25 -0
  439. data/vendor/libgit2/src/transports/local.c +265 -169
  440. data/vendor/libgit2/src/transports/smart.c +255 -45
  441. data/vendor/libgit2/src/transports/smart.h +42 -22
  442. data/vendor/libgit2/src/transports/smart_pkt.c +250 -159
  443. data/vendor/libgit2/src/transports/smart_protocol.c +414 -196
  444. data/vendor/libgit2/src/transports/ssh.c +645 -236
  445. data/vendor/libgit2/src/transports/ssh.h +14 -0
  446. data/vendor/libgit2/src/transports/winhttp.c +809 -353
  447. data/vendor/libgit2/src/tree-cache.c +138 -52
  448. data/vendor/libgit2/src/tree-cache.h +14 -7
  449. data/vendor/libgit2/src/tree.c +620 -259
  450. data/vendor/libgit2/src/tree.h +12 -19
  451. data/vendor/libgit2/src/tsort.c +3 -2
  452. data/vendor/libgit2/src/unix/map.c +25 -7
  453. data/vendor/libgit2/src/unix/posix.h +77 -12
  454. data/vendor/libgit2/src/unix/pthread.h +56 -0
  455. data/vendor/libgit2/src/unix/realpath.c +12 -8
  456. data/vendor/libgit2/src/userdiff.h +208 -0
  457. data/vendor/libgit2/src/util.c +349 -165
  458. data/vendor/libgit2/src/util.h +167 -85
  459. data/vendor/libgit2/src/varint.c +43 -0
  460. data/vendor/libgit2/src/varint.h +17 -0
  461. data/vendor/libgit2/src/vector.c +156 -33
  462. data/vendor/libgit2/src/vector.h +41 -5
  463. data/vendor/libgit2/src/win32/dir.c +22 -42
  464. data/vendor/libgit2/src/win32/dir.h +7 -5
  465. data/vendor/libgit2/src/win32/error.c +6 -32
  466. data/vendor/libgit2/src/win32/error.h +4 -2
  467. data/vendor/libgit2/src/win32/findfile.c +62 -69
  468. data/vendor/libgit2/src/win32/findfile.h +5 -13
  469. data/vendor/libgit2/src/win32/git2.rc +44 -0
  470. data/vendor/libgit2/src/win32/map.c +39 -11
  471. data/vendor/libgit2/src/win32/mingw-compat.h +10 -11
  472. data/vendor/libgit2/src/win32/msvc-compat.h +10 -33
  473. data/vendor/libgit2/src/win32/path_w32.c +476 -0
  474. data/vendor/libgit2/src/win32/path_w32.h +104 -0
  475. data/vendor/libgit2/src/win32/posix.h +35 -30
  476. data/vendor/libgit2/src/win32/posix_w32.c +659 -327
  477. data/vendor/libgit2/src/win32/precompiled.h +7 -2
  478. data/vendor/libgit2/src/win32/reparse.h +57 -0
  479. data/vendor/libgit2/src/win32/thread.c +258 -0
  480. data/vendor/libgit2/src/win32/thread.h +64 -0
  481. data/vendor/libgit2/src/win32/utf-conv.c +127 -62
  482. data/vendor/libgit2/src/win32/utf-conv.h +47 -6
  483. data/vendor/libgit2/src/win32/version.h +21 -4
  484. data/vendor/libgit2/src/win32/w32_buffer.c +54 -0
  485. data/vendor/libgit2/src/win32/w32_buffer.h +20 -0
  486. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +438 -0
  487. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +129 -0
  488. data/vendor/libgit2/src/win32/w32_stack.c +193 -0
  489. data/vendor/libgit2/src/win32/w32_stack.h +140 -0
  490. data/vendor/libgit2/src/win32/w32_util.c +95 -0
  491. data/vendor/libgit2/src/win32/w32_util.h +170 -0
  492. data/vendor/libgit2/src/win32/win32-compat.h +52 -0
  493. data/vendor/libgit2/src/worktree.c +578 -0
  494. data/vendor/libgit2/src/worktree.h +39 -0
  495. data/vendor/libgit2/src/xdiff/xdiff.h +33 -18
  496. data/vendor/libgit2/src/xdiff/xdiffi.c +578 -88
  497. data/vendor/libgit2/src/xdiff/xdiffi.h +3 -2
  498. data/vendor/libgit2/src/xdiff/xemit.c +106 -45
  499. data/vendor/libgit2/src/xdiff/xemit.h +3 -3
  500. data/vendor/libgit2/src/xdiff/xhistogram.c +5 -4
  501. data/vendor/libgit2/src/xdiff/xinclude.h +3 -2
  502. data/vendor/libgit2/src/xdiff/xmacros.h +2 -2
  503. data/vendor/libgit2/src/xdiff/xmerge.c +167 -48
  504. data/vendor/libgit2/src/xdiff/xpatience.c +42 -10
  505. data/vendor/libgit2/src/xdiff/xprepare.c +14 -14
  506. data/vendor/libgit2/src/xdiff/xprepare.h +2 -2
  507. data/vendor/libgit2/src/xdiff/xtypes.h +2 -2
  508. data/vendor/libgit2/src/xdiff/xutils.c +60 -56
  509. data/vendor/libgit2/src/xdiff/xutils.h +3 -5
  510. data/vendor/libgit2/src/zstream.c +205 -0
  511. data/vendor/libgit2/src/zstream.h +53 -0
  512. metadata +281 -233
  513. data/Rakefile +0 -61
  514. data/ext/rugged/rugged_diff_patch.c +0 -169
  515. data/lib/rugged/diff/patch.rb +0 -28
  516. data/test/blob_test.rb +0 -341
  517. data/test/branch_test.rb +0 -199
  518. data/test/commit_test.rb +0 -104
  519. data/test/config_test.rb +0 -45
  520. data/test/coverage/cover.rb +0 -133
  521. data/test/diff_test.rb +0 -777
  522. data/test/errors_test.rb +0 -34
  523. data/test/fixtures/alternate/objects/14/6ae76773c91e3b1d00cf7a338ec55ae58297e2 +0 -0
  524. data/test/fixtures/alternate/objects/14/9c32d47e99d0a3572ff1e70a2e0051bbf347a9 +0 -0
  525. data/test/fixtures/alternate/objects/14/fb3108588f9421bf764041e5e3ac305eb6277f +0 -0
  526. data/test/fixtures/archive.tar.gz +0 -0
  527. data/test/fixtures/attr/attr0 +0 -1
  528. data/test/fixtures/attr/attr1 +0 -29
  529. data/test/fixtures/attr/attr2 +0 -21
  530. data/test/fixtures/attr/attr3 +0 -4
  531. data/test/fixtures/attr/binfile +0 -1
  532. data/test/fixtures/attr/dir/file +0 -0
  533. data/test/fixtures/attr/file +0 -1
  534. data/test/fixtures/attr/gitattributes +0 -29
  535. data/test/fixtures/attr/gitignore +0 -2
  536. data/test/fixtures/attr/ign +0 -1
  537. data/test/fixtures/attr/macro_bad +0 -1
  538. data/test/fixtures/attr/macro_test +0 -1
  539. data/test/fixtures/attr/root_test1 +0 -1
  540. data/test/fixtures/attr/root_test2 +0 -6
  541. data/test/fixtures/attr/root_test3 +0 -19
  542. data/test/fixtures/attr/root_test4.txt +0 -14
  543. data/test/fixtures/attr/sub/abc +0 -37
  544. data/test/fixtures/attr/sub/dir/file +0 -0
  545. data/test/fixtures/attr/sub/file +0 -1
  546. data/test/fixtures/attr/sub/ign/file +0 -1
  547. data/test/fixtures/attr/sub/ign/sub/file +0 -1
  548. data/test/fixtures/attr/sub/sub/dir +0 -0
  549. data/test/fixtures/attr/sub/sub/file +0 -1
  550. data/test/fixtures/attr/sub/sub/subsub.txt +0 -1
  551. data/test/fixtures/attr/sub/subdir_test1 +0 -2
  552. data/test/fixtures/attr/sub/subdir_test2.txt +0 -1
  553. data/test/fixtures/diff/another.txt +0 -38
  554. data/test/fixtures/diff/readme.txt +0 -36
  555. data/test/fixtures/mergedrepo/conflicts-one.txt +0 -5
  556. data/test/fixtures/mergedrepo/conflicts-two.txt +0 -5
  557. data/test/fixtures/mergedrepo/one.txt +0 -10
  558. data/test/fixtures/mergedrepo/two.txt +0 -12
  559. data/test/fixtures/status/current_file +0 -1
  560. data/test/fixtures/status/ignored_file +0 -1
  561. data/test/fixtures/status/modified_file +0 -2
  562. data/test/fixtures/status/new_file +0 -1
  563. data/test/fixtures/status/staged_changes +0 -2
  564. data/test/fixtures/status/staged_changes_modified_file +0 -3
  565. data/test/fixtures/status/staged_delete_modified_file +0 -1
  566. data/test/fixtures/status/staged_new_file +0 -1
  567. data/test/fixtures/status/staged_new_file_modified_file +0 -2
  568. data/test/fixtures/status/subdir/current_file +0 -1
  569. data/test/fixtures/status/subdir/modified_file +0 -2
  570. data/test/fixtures/status/subdir/new_file +0 -1
  571. data/test/fixtures/status/subdir.txt +0 -2
  572. data/test/fixtures/status//350/277/231 +0 -1
  573. data/test/fixtures/testrepo.git/HEAD +0 -1
  574. data/test/fixtures/testrepo.git/config +0 -13
  575. data/test/fixtures/testrepo.git/description +0 -1
  576. data/test/fixtures/testrepo.git/index +0 -0
  577. data/test/fixtures/testrepo.git/info/exclude +0 -6
  578. data/test/fixtures/testrepo.git/logs/HEAD +0 -3
  579. data/test/fixtures/testrepo.git/logs/refs/heads/master +0 -3
  580. data/test/fixtures/testrepo.git/logs/refs/notes/commits +0 -1
  581. data/test/fixtures/testrepo.git/objects/0c/37a5391bbff43c37f0d0371823a5509eed5b1d +0 -0
  582. data/test/fixtures/testrepo.git/objects/13/85f264afb75a56a5bec74243be9b367ba4ca08 +0 -0
  583. data/test/fixtures/testrepo.git/objects/18/1037049a54a1eb5fab404658a3a250b44335d7 +0 -0
  584. data/test/fixtures/testrepo.git/objects/18/10dff58d8a660512d4832e740f692884338ccd +0 -0
  585. data/test/fixtures/testrepo.git/objects/2d/2eff63372b08adf0a9eb84109ccf7d19e2f3a2 +0 -0
  586. data/test/fixtures/testrepo.git/objects/36/060c58702ed4c2a40832c51758d5344201d89a +0 -2
  587. data/test/fixtures/testrepo.git/objects/44/1034f860c1d5d90e4188d11ae0d325176869a8 +0 -1
  588. data/test/fixtures/testrepo.git/objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057 +0 -0
  589. data/test/fixtures/testrepo.git/objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045 +0 -2
  590. data/test/fixtures/testrepo.git/objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644 +0 -2
  591. data/test/fixtures/testrepo.git/objects/60/d415052a33de2150bf68757f6461df4f563ae4 +0 -0
  592. data/test/fixtures/testrepo.git/objects/61/9f9935957e010c419cb9d15621916ddfcc0b96 +0 -0
  593. data/test/fixtures/testrepo.git/objects/68/8a8f4ef7496901d15322972f96e212a9e466cc +0 -1
  594. data/test/fixtures/testrepo.git/objects/75/057dd4114e74cca1d750d0aee1647c903cb60a +0 -0
  595. data/test/fixtures/testrepo.git/objects/77/71329dfa3002caf8c61a0ceb62a31d09023f37 +0 -0
  596. data/test/fixtures/testrepo.git/objects/81/4889a078c031f61ed08ab5fa863aea9314344d +0 -0
  597. data/test/fixtures/testrepo.git/objects/84/96071c1b46c854b31185ea97743be6a8774479 +0 -0
  598. data/test/fixtures/testrepo.git/objects/94/eca2de348d5f672faf56b0decafa5937e3235e +0 -0
  599. data/test/fixtures/testrepo.git/objects/9b/7384fe1676186192842f5d3e129457b62db9e3 +0 -0
  600. data/test/fixtures/testrepo.git/objects/9f/d738e8f7967c078dceed8190330fc8648ee56a +0 -3
  601. data/test/fixtures/testrepo.git/objects/a4/a7dce85cf63874e984719f4fdd239f5145052f +0 -2
  602. data/test/fixtures/testrepo.git/objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd +0 -0
  603. data/test/fixtures/testrepo.git/objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6 +0 -0
  604. data/test/fixtures/testrepo.git/objects/b7/4713326bc972cc15751ed504dca6f6f3b91f7a +0 -3
  605. data/test/fixtures/testrepo.git/objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644 +0 -3
  606. data/test/fixtures/testrepo.git/objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd +0 -3
  607. data/test/fixtures/testrepo.git/objects/c4/dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b +0 -0
  608. data/test/fixtures/testrepo.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
  609. data/test/fixtures/testrepo.git/objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1 +0 -0
  610. data/test/fixtures/testrepo.git/objects/fa/49b077972391ad58037050f2a75f74e3671e92 +0 -0
  611. data/test/fixtures/testrepo.git/objects/fd/093bff70906175335656e6ce6ae05783708765 +0 -0
  612. data/test/fixtures/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx +0 -0
  613. data/test/fixtures/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack +0 -0
  614. data/test/fixtures/testrepo.git/packed-refs +0 -2
  615. data/test/fixtures/testrepo.git/refs/heads/master +0 -1
  616. data/test/fixtures/testrepo.git/refs/notes/commits +0 -1
  617. data/test/fixtures/testrepo.git/refs/tags/v0.9 +0 -1
  618. data/test/fixtures/testrepo.git/refs/tags/v1.0 +0 -1
  619. data/test/fixtures/text_file.md +0 -464
  620. data/test/fixtures/unsymlinked.git/HEAD +0 -1
  621. data/test/fixtures/unsymlinked.git/config +0 -6
  622. data/test/fixtures/unsymlinked.git/description +0 -1
  623. data/test/fixtures/unsymlinked.git/info/exclude +0 -2
  624. data/test/fixtures/unsymlinked.git/objects/08/8b64704e0d6b8bd061dea879418cb5442a3fbf +0 -0
  625. data/test/fixtures/unsymlinked.git/objects/13/a5e939bca25940c069fd2169d993dba328e30b +0 -0
  626. data/test/fixtures/unsymlinked.git/objects/19/bf568e59e3a0b363cafb4106226e62d4a4c41c +0 -0
  627. data/test/fixtures/unsymlinked.git/objects/58/1fadd35b4cf320d102a152f918729011604773 +0 -0
  628. data/test/fixtures/unsymlinked.git/objects/5c/87b6791e8b13da658a14d1ef7e09b5dc3bac8c +0 -0
  629. data/test/fixtures/unsymlinked.git/objects/6f/e5f5398af85fb3de8a6aba0339b6d3bfa26a27 +0 -0
  630. data/test/fixtures/unsymlinked.git/objects/7f/ccd75616ec188b8f1b23d67506a334cc34a49d +0 -0
  631. data/test/fixtures/unsymlinked.git/objects/80/6999882bf91d24241e4077906b9017605eb1f3 +0 -0
  632. data/test/fixtures/unsymlinked.git/objects/83/7d176303c5005505ec1e4a30231c40930c0230 +0 -0
  633. data/test/fixtures/unsymlinked.git/objects/a8/595ccca04f40818ae0155c8f9c77a230e597b6 +0 -2
  634. data/test/fixtures/unsymlinked.git/objects/cf/8f1cf5cce859c438d6cc067284cb5e161206e7 +0 -0
  635. data/test/fixtures/unsymlinked.git/objects/d5/278d05c8607ec420bfee4cf219fbc0eeebfd6a +0 -0
  636. data/test/fixtures/unsymlinked.git/objects/f4/e16fb76536591a41454194058d048d8e4dd2e9 +0 -0
  637. data/test/fixtures/unsymlinked.git/objects/f9/e65619d93fdf2673882e0a261c5e93b1a84006 +0 -0
  638. data/test/fixtures/unsymlinked.git/refs/heads/exe-file +0 -1
  639. data/test/fixtures/unsymlinked.git/refs/heads/master +0 -1
  640. data/test/fixtures/unsymlinked.git/refs/heads/reg-file +0 -1
  641. data/test/index_test.rb +0 -333
  642. data/test/lib_test.rb +0 -127
  643. data/test/note_test.rb +0 -158
  644. data/test/object_test.rb +0 -43
  645. data/test/reference_test.rb +0 -207
  646. data/test/remote_test.rb +0 -324
  647. data/test/repo_pack_test.rb +0 -24
  648. data/test/repo_reset_test.rb +0 -82
  649. data/test/repo_test.rb +0 -402
  650. data/test/tag_test.rb +0 -68
  651. data/test/test_helper.rb +0 -92
  652. data/test/tree_test.rb +0 -91
  653. data/test/walker_test.rb +0 -88
  654. data/vendor/libgit2/Makefile.embed +0 -42
  655. data/vendor/libgit2/include/git2/push.h +0 -131
  656. data/vendor/libgit2/include/git2/threads.h +0 -50
  657. data/vendor/libgit2/src/amiga/map.c +0 -48
  658. data/vendor/libgit2/src/bswap.h +0 -97
  659. data/vendor/libgit2/src/compress.c +0 -53
  660. data/vendor/libgit2/src/config_file.h +0 -60
  661. data/vendor/libgit2/src/delta-apply.c +0 -134
  662. data/vendor/libgit2/src/delta-apply.h +0 -50
  663. data/vendor/libgit2/src/diff_patch.c +0 -995
  664. data/vendor/libgit2/src/diff_patch.h +0 -46
  665. data/vendor/libgit2/src/hashsig.h +0 -72
  666. data/vendor/libgit2/src/merge_file.h +0 -71
  667. data/vendor/libgit2/src/win32/pthread.c +0 -144
  668. data/vendor/libgit2/src/win32/pthread.h +0 -50
@@ -1,7 +1,7 @@
1
1
  /* zlib.h -- interface of the 'zlib' general purpose compression library
2
- version 1.2.5, April 19th, 2010
2
+ version 1.2.11, January 15th, 2017
3
3
 
4
- Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
4
+ Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
5
5
 
6
6
  This software is provided 'as-is', without any express or implied
7
7
  warranty. In no event will the authors be held liable for any damages
@@ -24,8 +24,8 @@
24
24
 
25
25
 
26
26
  The data format used by the zlib library is described by RFCs (Request for
27
- Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
28
- (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
27
+ Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
28
+ (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
29
29
  */
30
30
 
31
31
  #ifndef ZLIB_H
@@ -37,11 +37,11 @@
37
37
  extern "C" {
38
38
  #endif
39
39
 
40
- #define ZLIB_VERSION "1.2.5"
41
- #define ZLIB_VERNUM 0x1250
40
+ #define ZLIB_VERSION "1.2.11"
41
+ #define ZLIB_VERNUM 0x12b0
42
42
  #define ZLIB_VER_MAJOR 1
43
43
  #define ZLIB_VER_MINOR 2
44
- #define ZLIB_VER_REVISION 5
44
+ #define ZLIB_VER_REVISION 11
45
45
  #define ZLIB_VER_SUBREVISION 0
46
46
 
47
47
  /*
@@ -65,7 +65,8 @@ extern "C" {
65
65
  with "gz". The gzip format is different from the zlib format. gzip is a
66
66
  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
67
67
 
68
- This library can optionally read and write gzip streams in memory as well.
68
+ This library can optionally read and write gzip and raw deflate streams in
69
+ memory as well.
69
70
 
70
71
  The zlib format was designed to be compact and fast for use in memory
71
72
  and on communications channels. The gzip format was designed for single-
@@ -74,7 +75,7 @@ extern "C" {
74
75
 
75
76
  The library does not install any signal handler. The decoder checks
76
77
  the consistency of the compressed data, so the library should never crash
77
- even in case of corrupted input.
78
+ even in the case of corrupted input.
78
79
  */
79
80
 
80
81
  typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
@@ -83,23 +84,24 @@ typedef void (*free_func) OF((voidpf opaque, voidpf address));
83
84
  struct internal_state;
84
85
 
85
86
  typedef struct z_stream_s {
86
- Bytef *next_in; /* next input byte */
87
+ z_const Bytef *next_in; /* next input byte */
87
88
  uInt avail_in; /* number of bytes available at next_in */
88
- uLong total_in; /* total nb of input bytes read so far */
89
+ uLong total_in; /* total number of input bytes read so far */
89
90
 
90
- Bytef *next_out; /* next output byte should be put there */
91
+ Bytef *next_out; /* next output byte will go here */
91
92
  uInt avail_out; /* remaining free space at next_out */
92
- uLong total_out; /* total nb of bytes output so far */
93
+ uLong total_out; /* total number of bytes output so far */
93
94
 
94
- char *msg; /* last error message, NULL if no error */
95
+ z_const char *msg; /* last error message, NULL if no error */
95
96
  struct internal_state FAR *state; /* not visible by applications */
96
97
 
97
98
  alloc_func zalloc; /* used to allocate the internal state */
98
99
  free_func zfree; /* used to free the internal state */
99
100
  voidpf opaque; /* private data object passed to zalloc and zfree */
100
101
 
101
- int data_type; /* best guess about the data type: binary or text */
102
- uLong adler; /* adler32 value of the uncompressed data */
102
+ int data_type; /* best guess about the data type: binary or text
103
+ for deflate, or the decoding state for inflate */
104
+ uLong adler; /* Adler-32 or CRC-32 value of the uncompressed data */
103
105
  uLong reserved; /* reserved for future use */
104
106
  } z_stream;
105
107
 
@@ -142,7 +144,9 @@ typedef gz_header FAR *gz_headerp;
142
144
 
143
145
  zalloc must return Z_NULL if there is not enough memory for the object.
144
146
  If zlib is used in a multi-threaded application, zalloc and zfree must be
145
- thread safe.
147
+ thread safe. In that case, zlib is thread-safe. When zalloc and zfree are
148
+ Z_NULL on entry to the initialization function, they are set to internal
149
+ routines that use the standard library functions malloc() and free().
146
150
 
147
151
  On 16-bit systems, the functions zalloc and zfree must be able to allocate
148
152
  exactly 65536 bytes, but will not be required to allocate more than this if
@@ -155,7 +159,7 @@ typedef gz_header FAR *gz_headerp;
155
159
 
156
160
  The fields total_in and total_out can be used for statistics or progress
157
161
  reports. After compression, total_in holds the total size of the
158
- uncompressed data and may be saved for use in the decompressor (particularly
162
+ uncompressed data and may be saved for use by the decompressor (particularly
159
163
  if the decompressor wants to decompress everything in a single step).
160
164
  */
161
165
 
@@ -200,7 +204,7 @@ typedef gz_header FAR *gz_headerp;
200
204
  #define Z_TEXT 1
201
205
  #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */
202
206
  #define Z_UNKNOWN 2
203
- /* Possible values of the data_type field (though see inflate()) */
207
+ /* Possible values of the data_type field for deflate() */
204
208
 
205
209
  #define Z_DEFLATED 8
206
210
  /* The deflate compression method (the only one supported in this version) */
@@ -258,11 +262,11 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
258
262
  enough room in the output buffer), next_in and avail_in are updated and
259
263
  processing will resume at this point for the next call of deflate().
260
264
 
261
- - Provide more output starting at next_out and update next_out and avail_out
265
+ - Generate more output starting at next_out and update next_out and avail_out
262
266
  accordingly. This action is forced if the parameter flush is non zero.
263
267
  Forcing flush frequently degrades the compression ratio, so this parameter
264
- should be set only when necessary (in interactive applications). Some
265
- output may be provided even if flush is not set.
268
+ should be set only when necessary. Some output may be provided even if
269
+ flush is zero.
266
270
 
267
271
  Before the call of deflate(), the application should ensure that at least
268
272
  one of the actions is possible, by providing more input and/or consuming more
@@ -271,7 +275,9 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
271
275
  output when it wants, for example when the output buffer is full (avail_out
272
276
  == 0), or after each call of deflate(). If deflate returns Z_OK and with
273
277
  zero avail_out, it must be called again after making room in the output
274
- buffer because there might be more output pending.
278
+ buffer because there might be more output pending. See deflatePending(),
279
+ which can be used if desired to determine whether or not there is more ouput
280
+ in that case.
275
281
 
276
282
  Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
277
283
  decide how much data to accumulate before producing output, in order to
@@ -292,8 +298,8 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
292
298
  input data so far will be available to the decompressor, as for Z_SYNC_FLUSH.
293
299
  This completes the current deflate block and follows it with an empty fixed
294
300
  codes block that is 10 bits long. This assures that enough bytes are output
295
- in order for the decompressor to finish the block before the empty fixed code
296
- block.
301
+ in order for the decompressor to finish the block before the empty fixed
302
+ codes block.
297
303
 
298
304
  If flush is set to Z_BLOCK, a deflate block is completed and emitted, as
299
305
  for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to
@@ -319,33 +325,38 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
319
325
 
320
326
  If the parameter flush is set to Z_FINISH, pending input is processed,
321
327
  pending output is flushed and deflate returns with Z_STREAM_END if there was
322
- enough output space; if deflate returns with Z_OK, this function must be
323
- called again with Z_FINISH and more output space (updated avail_out) but no
324
- more input data, until it returns with Z_STREAM_END or an error. After
325
- deflate has returned Z_STREAM_END, the only possible operations on the stream
326
- are deflateReset or deflateEnd.
327
-
328
- Z_FINISH can be used immediately after deflateInit if all the compression
329
- is to be done in a single step. In this case, avail_out must be at least the
330
- value returned by deflateBound (see below). If deflate does not return
331
- Z_STREAM_END, then it must be called again as described above.
332
-
333
- deflate() sets strm->adler to the adler32 checksum of all input read
334
- so far (that is, total_in bytes).
328
+ enough output space. If deflate returns with Z_OK or Z_BUF_ERROR, this
329
+ function must be called again with Z_FINISH and more output space (updated
330
+ avail_out) but no more input data, until it returns with Z_STREAM_END or an
331
+ error. After deflate has returned Z_STREAM_END, the only possible operations
332
+ on the stream are deflateReset or deflateEnd.
333
+
334
+ Z_FINISH can be used in the first deflate call after deflateInit if all the
335
+ compression is to be done in a single step. In order to complete in one
336
+ call, avail_out must be at least the value returned by deflateBound (see
337
+ below). Then deflate is guaranteed to return Z_STREAM_END. If not enough
338
+ output space is provided, deflate will not return Z_STREAM_END, and it must
339
+ be called again as described above.
340
+
341
+ deflate() sets strm->adler to the Adler-32 checksum of all input read
342
+ so far (that is, total_in bytes). If a gzip stream is being generated, then
343
+ strm->adler will be the CRC-32 checksum of the input read so far. (See
344
+ deflateInit2 below.)
335
345
 
336
346
  deflate() may update strm->data_type if it can make a good guess about
337
- the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
338
- binary. This field is only for information purposes and does not affect the
339
- compression algorithm in any manner.
347
+ the input data type (Z_BINARY or Z_TEXT). If in doubt, the data is
348
+ considered binary. This field is only for information purposes and does not
349
+ affect the compression algorithm in any manner.
340
350
 
341
351
  deflate() returns Z_OK if some progress has been made (more input
342
352
  processed or more output produced), Z_STREAM_END if all input has been
343
353
  consumed and all output has been produced (only when flush is set to
344
354
  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
345
- if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible
346
- (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
347
- fatal, and deflate() can be called again with more input and more output
348
- space to continue compressing.
355
+ if next_in or next_out was Z_NULL or the state was inadvertently written over
356
+ by the application), or Z_BUF_ERROR if no progress is possible (for example
357
+ avail_in or avail_out was zero). Note that Z_BUF_ERROR is not fatal, and
358
+ deflate() can be called again with more input and more output space to
359
+ continue compressing.
349
360
  */
350
361
 
351
362
 
@@ -368,23 +379,21 @@ ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
368
379
 
369
380
  Initializes the internal stream state for decompression. The fields
370
381
  next_in, avail_in, zalloc, zfree and opaque must be initialized before by
371
- the caller. If next_in is not Z_NULL and avail_in is large enough (the
372
- exact value depends on the compression method), inflateInit determines the
373
- compression method from the zlib header and allocates all data structures
374
- accordingly; otherwise the allocation will be deferred to the first call of
375
- inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
376
- use default allocation functions.
382
+ the caller. In the current version of inflate, the provided input is not
383
+ read or consumed. The allocation of a sliding window will be deferred to
384
+ the first call of inflate (if the decompression does not complete on the
385
+ first call). If zalloc and zfree are set to Z_NULL, inflateInit updates
386
+ them to use default allocation functions.
377
387
 
378
388
  inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
379
389
  memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
380
390
  version assumed by the caller, or Z_STREAM_ERROR if the parameters are
381
391
  invalid, such as a null pointer to the structure. msg is set to null if
382
- there is no error message. inflateInit does not perform any decompression
383
- apart from possibly reading the zlib header if present: actual decompression
384
- will be done by inflate(). (So next_in and avail_in may be modified, but
385
- next_out and avail_out are unused and unchanged.) The current implementation
386
- of inflateInit() does not process any header information -- that is deferred
387
- until inflate() is called.
392
+ there is no error message. inflateInit does not perform any decompression.
393
+ Actual decompression will be done by inflate(). So next_in, and avail_in,
394
+ next_out, and avail_out are unused and unchanged. The current
395
+ implementation of inflateInit() does not process any header information --
396
+ that is deferred until inflate() is called.
388
397
  */
389
398
 
390
399
 
@@ -400,17 +409,20 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
400
409
 
401
410
  - Decompress more input starting at next_in and update next_in and avail_in
402
411
  accordingly. If not all input can be processed (because there is not
403
- enough room in the output buffer), next_in is updated and processing will
404
- resume at this point for the next call of inflate().
412
+ enough room in the output buffer), then next_in and avail_in are updated
413
+ accordingly, and processing will resume at this point for the next call of
414
+ inflate().
405
415
 
406
- - Provide more output starting at next_out and update next_out and avail_out
416
+ - Generate more output starting at next_out and update next_out and avail_out
407
417
  accordingly. inflate() provides as much output as possible, until there is
408
418
  no more input data or no more space in the output buffer (see below about
409
419
  the flush parameter).
410
420
 
411
421
  Before the call of inflate(), the application should ensure that at least
412
422
  one of the actions is possible, by providing more input and/or consuming more
413
- output, and updating the next_* and avail_* values accordingly. The
423
+ output, and updating the next_* and avail_* values accordingly. If the
424
+ caller of inflate() does not provide both available input and available
425
+ output space, it is possible that there will be no progress made. The
414
426
  application can consume the uncompressed output when it wants, for example
415
427
  when the output buffer is full (avail_out == 0), or after each call of
416
428
  inflate(). If inflate returns Z_OK and with zero avail_out, it must be
@@ -427,7 +439,7 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
427
439
  gets to the end of that block, or when it runs out of data.
428
440
 
429
441
  The Z_BLOCK option assists in appending to or combining deflate streams.
430
- Also to assist in this, on return inflate() will set strm->data_type to the
442
+ To assist in this, on return inflate() always sets strm->data_type to the
431
443
  number of unused bits in the last byte taken from strm->next_in, plus 64 if
432
444
  inflate() is currently decoding the last block in the deflate stream, plus
433
445
  128 if inflate() returned immediately after decoding an end-of-block code or
@@ -451,48 +463,57 @@ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
451
463
  error. However if all decompression is to be performed in a single step (a
452
464
  single call of inflate), the parameter flush should be set to Z_FINISH. In
453
465
  this case all pending input is processed and all pending output is flushed;
454
- avail_out must be large enough to hold all the uncompressed data. (The size
455
- of the uncompressed data may have been saved by the compressor for this
456
- purpose.) The next operation on this stream must be inflateEnd to deallocate
457
- the decompression state. The use of Z_FINISH is never required, but can be
458
- used to inform inflate that a faster approach may be used for the single
459
- inflate() call.
466
+ avail_out must be large enough to hold all of the uncompressed data for the
467
+ operation to complete. (The size of the uncompressed data may have been
468
+ saved by the compressor for this purpose.) The use of Z_FINISH is not
469
+ required to perform an inflation in one step. However it may be used to
470
+ inform inflate that a faster approach can be used for the single inflate()
471
+ call. Z_FINISH also informs inflate to not maintain a sliding window if the
472
+ stream completes, which reduces inflate's memory footprint. If the stream
473
+ does not complete, either because not all of the stream is provided or not
474
+ enough output space is provided, then a sliding window will be allocated and
475
+ inflate() can be called again to continue the operation as if Z_NO_FLUSH had
476
+ been used.
460
477
 
461
478
  In this implementation, inflate() always flushes as much output as
462
479
  possible to the output buffer, and always uses the faster approach on the
463
- first call. So the only effect of the flush parameter in this implementation
464
- is on the return value of inflate(), as noted below, or when it returns early
465
- because Z_BLOCK or Z_TREES is used.
480
+ first call. So the effects of the flush parameter in this implementation are
481
+ on the return value of inflate() as noted below, when inflate() returns early
482
+ when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of
483
+ memory for a sliding window when Z_FINISH is used.
466
484
 
467
485
  If a preset dictionary is needed after this call (see inflateSetDictionary
468
- below), inflate sets strm->adler to the adler32 checksum of the dictionary
486
+ below), inflate sets strm->adler to the Adler-32 checksum of the dictionary
469
487
  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
470
- strm->adler to the adler32 checksum of all output produced so far (that is,
488
+ strm->adler to the Adler-32 checksum of all output produced so far (that is,
471
489
  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
472
- below. At the end of the stream, inflate() checks that its computed adler32
490
+ below. At the end of the stream, inflate() checks that its computed Adler-32
473
491
  checksum is equal to that saved by the compressor and returns Z_STREAM_END
474
492
  only if the checksum is correct.
475
493
 
476
494
  inflate() can decompress and check either zlib-wrapped or gzip-wrapped
477
495
  deflate data. The header type is detected automatically, if requested when
478
496
  initializing with inflateInit2(). Any information contained in the gzip
479
- header is not retained, so applications that need that information should
480
- instead use raw inflate, see inflateInit2() below, or inflateBack() and
481
- perform their own processing of the gzip header and trailer.
497
+ header is not retained unless inflateGetHeader() is used. When processing
498
+ gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output
499
+ produced so far. The CRC-32 is checked against the gzip trailer, as is the
500
+ uncompressed length, modulo 2^32.
482
501
 
483
502
  inflate() returns Z_OK if some progress has been made (more input processed
484
503
  or more output produced), Z_STREAM_END if the end of the compressed data has
485
504
  been reached and all uncompressed output has been produced, Z_NEED_DICT if a
486
505
  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
487
506
  corrupted (input stream not conforming to the zlib format or incorrect check
488
- value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
489
- next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory,
490
- Z_BUF_ERROR if no progress is possible or if there was not enough room in the
491
- output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
507
+ value, in which case strm->msg points to a string with a more specific
508
+ error), Z_STREAM_ERROR if the stream structure was inconsistent (for example
509
+ next_in or next_out was Z_NULL, or the state was inadvertently written over
510
+ by the application), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR
511
+ if no progress was possible or if there was not enough room in the output
512
+ buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
492
513
  inflate() can be called again with more input and more output space to
493
514
  continue decompressing. If Z_DATA_ERROR is returned, the application may
494
515
  then call inflateSync() to look for a good compression block if a partial
495
- recovery of the data is desired.
516
+ recovery of the data is to be attempted.
496
517
  */
497
518
 
498
519
 
@@ -502,9 +523,8 @@ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
502
523
  This function discards any unprocessed input and does not flush any pending
503
524
  output.
504
525
 
505
- inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
506
- was inconsistent. In the error case, msg may be set but then points to a
507
- static string (which must not be deallocated).
526
+ inflateEnd returns Z_OK if success, or Z_STREAM_ERROR if the stream state
527
+ was inconsistent.
508
528
  */
509
529
 
510
530
 
@@ -535,16 +555,29 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
535
555
  compression at the expense of memory usage. The default value is 15 if
536
556
  deflateInit is used instead.
537
557
 
558
+ For the current implementation of deflate(), a windowBits value of 8 (a
559
+ window size of 256 bytes) is not supported. As a result, a request for 8
560
+ will result in 9 (a 512-byte window). In that case, providing 8 to
561
+ inflateInit2() will result in an error when the zlib header with 9 is
562
+ checked against the initialization of inflate(). The remedy is to not use 8
563
+ with deflateInit2() with this initialization, or at least in that case use 9
564
+ with inflateInit2().
565
+
538
566
  windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
539
567
  determines the window size. deflate() will then generate raw deflate data
540
- with no zlib header or trailer, and will not compute an adler32 check value.
568
+ with no zlib header or trailer, and will not compute a check value.
541
569
 
542
570
  windowBits can also be greater than 15 for optional gzip encoding. Add
543
571
  16 to windowBits to write a simple gzip header and trailer around the
544
572
  compressed data instead of a zlib wrapper. The gzip header will have no
545
573
  file name, no extra data, no comment, no modification time (set to zero), no
546
- header crc, and the operating system will be set to 255 (unknown). If a
547
- gzip stream is being written, strm->adler is a crc32 instead of an adler32.
574
+ header crc, and the operating system will be set to the appropriate value,
575
+ if the operating system was determined at compile time. If a gzip stream is
576
+ being written, strm->adler is a CRC-32 instead of an Adler-32.
577
+
578
+ For raw deflate or gzip encoding, a request for a 256-byte window is
579
+ rejected as invalid, since only the zlib header provides a means of
580
+ transmitting the window size to the decompressor.
548
581
 
549
582
  The memLevel parameter specifies how much memory should be allocated
550
583
  for the internal compression state. memLevel=1 uses minimum memory but is
@@ -580,10 +613,15 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
580
613
  uInt dictLength));
581
614
  /*
582
615
  Initializes the compression dictionary from the given byte sequence
583
- without producing any compressed output. This function must be called
584
- immediately after deflateInit, deflateInit2 or deflateReset, before any call
585
- of deflate. The compressor and decompressor must use exactly the same
586
- dictionary (see inflateSetDictionary).
616
+ without producing any compressed output. When using the zlib format, this
617
+ function must be called immediately after deflateInit, deflateInit2 or
618
+ deflateReset, and before any call of deflate. When doing raw deflate, this
619
+ function must be called either before any call of deflate, or immediately
620
+ after the completion of a deflate block, i.e. after all input has been
621
+ consumed and all output has been delivered when using any of the flush
622
+ options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The
623
+ compressor and decompressor must use exactly the same dictionary (see
624
+ inflateSetDictionary).
587
625
 
588
626
  The dictionary should consist of strings (byte sequences) that are likely
589
627
  to be encountered later in the data to be compressed, with the most commonly
@@ -600,18 +638,40 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
600
638
  addition, the current implementation of deflate will use at most the window
601
639
  size minus 262 bytes of the provided dictionary.
602
640
 
603
- Upon return of this function, strm->adler is set to the adler32 value
641
+ Upon return of this function, strm->adler is set to the Adler-32 value
604
642
  of the dictionary; the decompressor may later use this value to determine
605
- which dictionary has been used by the compressor. (The adler32 value
643
+ which dictionary has been used by the compressor. (The Adler-32 value
606
644
  applies to the whole dictionary even if only a subset of the dictionary is
607
645
  actually used by the compressor.) If a raw deflate was requested, then the
608
- adler32 value is not computed and strm->adler is not set.
646
+ Adler-32 value is not computed and strm->adler is not set.
609
647
 
610
648
  deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
611
649
  parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
612
650
  inconsistent (for example if deflate has already been called for this stream
613
- or if the compression method is bsort). deflateSetDictionary does not
614
- perform any compression: this will be done by deflate().
651
+ or if not at a block boundary for raw deflate). deflateSetDictionary does
652
+ not perform any compression: this will be done by deflate().
653
+ */
654
+
655
+ ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm,
656
+ Bytef *dictionary,
657
+ uInt *dictLength));
658
+ /*
659
+ Returns the sliding dictionary being maintained by deflate. dictLength is
660
+ set to the number of bytes in the dictionary, and that many bytes are copied
661
+ to dictionary. dictionary must have enough space, where 32768 bytes is
662
+ always enough. If deflateGetDictionary() is called with dictionary equal to
663
+ Z_NULL, then only the dictionary length is returned, and nothing is copied.
664
+ Similary, if dictLength is Z_NULL, then it is not set.
665
+
666
+ deflateGetDictionary() may return a length less than the window size, even
667
+ when more than the window size in input has been provided. It may return up
668
+ to 258 bytes less in that case, due to how zlib's implementation of deflate
669
+ manages the sliding window and lookahead for matches, where matches can be
670
+ up to 258 bytes long. If the application needs the last window-size bytes of
671
+ input, then that would need to be saved by the application outside of zlib.
672
+
673
+ deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
674
+ stream state is inconsistent.
615
675
  */
616
676
 
617
677
  ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
@@ -634,10 +694,10 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
634
694
 
635
695
  ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
636
696
  /*
637
- This function is equivalent to deflateEnd followed by deflateInit,
638
- but does not free and reallocate all the internal compression state. The
639
- stream will keep the same compression level and any other attributes that
640
- may have been set by deflateInit2.
697
+ This function is equivalent to deflateEnd followed by deflateInit, but
698
+ does not free and reallocate the internal compression state. The stream
699
+ will leave the compression level and any other attributes that may have been
700
+ set unchanged.
641
701
 
642
702
  deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
643
703
  stream state was inconsistent (such as zalloc or state being Z_NULL).
@@ -648,20 +708,36 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
648
708
  int strategy));
649
709
  /*
650
710
  Dynamically update the compression level and compression strategy. The
651
- interpretation of level and strategy is as in deflateInit2. This can be
711
+ interpretation of level and strategy is as in deflateInit2(). This can be
652
712
  used to switch between compression and straight copy of the input data, or
653
713
  to switch to a different kind of input data requiring a different strategy.
654
- If the compression level is changed, the input available so far is
655
- compressed with the old level (and may be flushed); the new level will take
656
- effect only at the next call of deflate().
657
-
658
- Before the call of deflateParams, the stream state must be set as for
659
- a call of deflate(), since the currently available input may have to be
660
- compressed and flushed. In particular, strm->avail_out must be non-zero.
661
-
662
- deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
663
- stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if
664
- strm->avail_out was zero.
714
+ If the compression approach (which is a function of the level) or the
715
+ strategy is changed, and if any input has been consumed in a previous
716
+ deflate() call, then the input available so far is compressed with the old
717
+ level and strategy using deflate(strm, Z_BLOCK). There are three approaches
718
+ for the compression levels 0, 1..3, and 4..9 respectively. The new level
719
+ and strategy will take effect at the next call of deflate().
720
+
721
+ If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
722
+ not have enough output space to complete, then the parameter change will not
723
+ take effect. In this case, deflateParams() can be called again with the
724
+ same parameters and more output space to try again.
725
+
726
+ In order to assure a change in the parameters on the first try, the
727
+ deflate stream should be flushed using deflate() with Z_BLOCK or other flush
728
+ request until strm.avail_out is not zero, before calling deflateParams().
729
+ Then no more input data should be provided before the deflateParams() call.
730
+ If this is done, the old level and strategy will be applied to the data
731
+ compressed before deflateParams(), and the new level and strategy will be
732
+ applied to the the data compressed after deflateParams().
733
+
734
+ deflateParams returns Z_OK on success, Z_STREAM_ERROR if the source stream
735
+ state was inconsistent or if a parameter was invalid, or Z_BUF_ERROR if
736
+ there was not enough output space to complete the compression of the
737
+ available input data before a change in the strategy or approach. Note that
738
+ in the case of a Z_BUF_ERROR, the parameters are not changed. A return
739
+ value of Z_BUF_ERROR is not fatal, in which case deflateParams() can be
740
+ retried with more output space.
665
741
  */
666
742
 
667
743
  ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
@@ -688,8 +764,28 @@ ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
688
764
  deflation of sourceLen bytes. It must be called after deflateInit() or
689
765
  deflateInit2(), and after deflateSetHeader(), if used. This would be used
690
766
  to allocate an output buffer for deflation in a single pass, and so would be
691
- called before deflate().
692
- */
767
+ called before deflate(). If that first deflate() call is provided the
768
+ sourceLen input bytes, an output buffer allocated to the size returned by
769
+ deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed
770
+ to return Z_STREAM_END. Note that it is possible for the compressed size to
771
+ be larger than the value returned by deflateBound() if flush options other
772
+ than Z_FINISH or Z_NO_FLUSH are used.
773
+ */
774
+
775
+ ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
776
+ unsigned *pending,
777
+ int *bits));
778
+ /*
779
+ deflatePending() returns the number of bytes and bits of output that have
780
+ been generated, but not yet provided in the available output. The bytes not
781
+ provided would be due to the available output space having being consumed.
782
+ The number of bits of output not provided are between 0 and 7, where they
783
+ await more bits to join them in order to fill out a full byte. If pending
784
+ or bits are Z_NULL, then those values are not set.
785
+
786
+ deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
787
+ stream state was inconsistent.
788
+ */
693
789
 
694
790
  ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
695
791
  int bits,
@@ -703,8 +799,9 @@ ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
703
799
  than or equal to 16, and that many of the least significant bits of value
704
800
  will be inserted in the output.
705
801
 
706
- deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
707
- stream state was inconsistent.
802
+ deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough
803
+ room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the
804
+ source stream state was inconsistent.
708
805
  */
709
806
 
710
807
  ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
@@ -758,7 +855,7 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
758
855
  is for use with other formats that use the deflate compressed data format
759
856
  such as zip. Those formats provide their own check values. If a custom
760
857
  format is developed using the raw deflate format for compressed data, it is
761
- recommended that a check value such as an adler32 or a crc32 be applied to
858
+ recommended that a check value such as an Adler-32 or a CRC-32 be applied to
762
859
  the uncompressed data as is done in the zlib, gzip, and zip formats. For
763
860
  most applications, the zlib format should be used as is. Note that comments
764
861
  above on the use in deflateInit2() applies to the magnitude of windowBits.
@@ -767,7 +864,10 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
767
864
  32 to windowBits to enable zlib and gzip decoding with automatic header
768
865
  detection, or add 16 to decode only the gzip format (the zlib format will
769
866
  return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a
770
- crc32 instead of an adler32.
867
+ CRC-32 instead of an Adler-32. Unlike the gunzip utility and gzread() (see
868
+ below), inflate() will not automatically decode concatenated gzip streams.
869
+ inflate() will return Z_STREAM_END at the end of the gzip stream. The state
870
+ would need to be reset to continue decoding a subsequent gzip stream.
771
871
 
772
872
  inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
773
873
  memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
@@ -788,34 +888,54 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
788
888
  Initializes the decompression dictionary from the given uncompressed byte
789
889
  sequence. This function must be called immediately after a call of inflate,
790
890
  if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
791
- can be determined from the adler32 value returned by that call of inflate.
891
+ can be determined from the Adler-32 value returned by that call of inflate.
792
892
  The compressor and decompressor must use exactly the same dictionary (see
793
- deflateSetDictionary). For raw inflate, this function can be called
794
- immediately after inflateInit2() or inflateReset() and before any call of
795
- inflate() to set the dictionary. The application must insure that the
796
- dictionary that was used for compression is provided.
893
+ deflateSetDictionary). For raw inflate, this function can be called at any
894
+ time to set the dictionary. If the provided dictionary is smaller than the
895
+ window and there is already data in the window, then the provided dictionary
896
+ will amend what's there. The application must insure that the dictionary
897
+ that was used for compression is provided.
797
898
 
798
899
  inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
799
900
  parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
800
901
  inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
801
- expected one (incorrect adler32 value). inflateSetDictionary does not
902
+ expected one (incorrect Adler-32 value). inflateSetDictionary does not
802
903
  perform any decompression: this will be done by subsequent calls of
803
904
  inflate().
804
905
  */
805
906
 
907
+ ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
908
+ Bytef *dictionary,
909
+ uInt *dictLength));
910
+ /*
911
+ Returns the sliding dictionary being maintained by inflate. dictLength is
912
+ set to the number of bytes in the dictionary, and that many bytes are copied
913
+ to dictionary. dictionary must have enough space, where 32768 bytes is
914
+ always enough. If inflateGetDictionary() is called with dictionary equal to
915
+ Z_NULL, then only the dictionary length is returned, and nothing is copied.
916
+ Similary, if dictLength is Z_NULL, then it is not set.
917
+
918
+ inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
919
+ stream state is inconsistent.
920
+ */
921
+
806
922
  ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
807
923
  /*
808
- Skips invalid compressed data until a full flush point (see above the
809
- description of deflate with Z_FULL_FLUSH) can be found, or until all
924
+ Skips invalid compressed data until a possible full flush point (see above
925
+ for the description of deflate with Z_FULL_FLUSH) can be found, or until all
810
926
  available input is skipped. No output is provided.
811
927
 
812
- inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
813
- if no more input was provided, Z_DATA_ERROR if no flush point has been
814
- found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the
815
- success case, the application may save the current current value of total_in
816
- which indicates where valid compressed data was found. In the error case,
817
- the application may repeatedly call inflateSync, providing more input each
818
- time, until success or end of the input data.
928
+ inflateSync searches for a 00 00 FF FF pattern in the compressed data.
929
+ All full flush points have this pattern, but not all occurrences of this
930
+ pattern are full flush points.
931
+
932
+ inflateSync returns Z_OK if a possible full flush point has been found,
933
+ Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
934
+ has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
935
+ In the success case, the application may save the current current value of
936
+ total_in which indicates where valid compressed data was found. In the
937
+ error case, the application may repeatedly call inflateSync, providing more
938
+ input each time, until success or end of the input data.
819
939
  */
820
940
 
821
941
  ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
@@ -837,7 +957,7 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
837
957
  ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
838
958
  /*
839
959
  This function is equivalent to inflateEnd followed by inflateInit,
840
- but does not free and reallocate all the internal decompression state. The
960
+ but does not free and reallocate the internal decompression state. The
841
961
  stream will keep attributes that may have been set by inflateInit2.
842
962
 
843
963
  inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
@@ -849,7 +969,9 @@ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
849
969
  /*
850
970
  This function is the same as inflateReset, but it also permits changing
851
971
  the wrap and window size requests. The windowBits parameter is interpreted
852
- the same as it is for inflateInit2.
972
+ the same as it is for inflateInit2. If the window size is changed, then the
973
+ memory allocated for the window is freed, and the window will be reallocated
974
+ by inflate() if needed.
853
975
 
854
976
  inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
855
977
  stream state was inconsistent (such as zalloc or state being Z_NULL), or if
@@ -901,7 +1023,7 @@ ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
901
1023
  location in the input stream can be determined from avail_in and data_type
902
1024
  as noted in the description for the Z_BLOCK flush parameter for inflate.
903
1025
 
904
- inflateMark returns the value noted above or -1 << 16 if the provided
1026
+ inflateMark returns the value noted above, or -65536 if the provided
905
1027
  source stream state was inconsistent.
906
1028
  */
907
1029
 
@@ -962,12 +1084,13 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
962
1084
  See inflateBack() for the usage of these routines.
963
1085
 
964
1086
  inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
965
- the paramaters are invalid, Z_MEM_ERROR if the internal state could not be
1087
+ the parameters are invalid, Z_MEM_ERROR if the internal state could not be
966
1088
  allocated, or Z_VERSION_ERROR if the version of the library does not match
967
1089
  the version of the header file.
968
1090
  */
969
1091
 
970
- typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
1092
+ typedef unsigned (*in_func) OF((void FAR *,
1093
+ z_const unsigned char FAR * FAR *));
971
1094
  typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
972
1095
 
973
1096
  ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
@@ -975,11 +1098,12 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
975
1098
  out_func out, void FAR *out_desc));
976
1099
  /*
977
1100
  inflateBack() does a raw inflate with a single call using a call-back
978
- interface for input and output. This is more efficient than inflate() for
979
- file i/o applications in that it avoids copying between the output and the
980
- sliding window by simply making the window itself the output buffer. This
981
- function trusts the application to not change the output buffer passed by
982
- the output function, at least until inflateBack() returns.
1101
+ interface for input and output. This is potentially more efficient than
1102
+ inflate() for file i/o applications, in that it avoids copying between the
1103
+ output and the sliding window by simply making the window itself the output
1104
+ buffer. inflate() can be faster on modern CPUs when used with large
1105
+ buffers. inflateBack() trusts the application to not change the output
1106
+ buffer passed by the output function, at least until inflateBack() returns.
983
1107
 
984
1108
  inflateBackInit() must be called first to allocate the internal state
985
1109
  and to initialize the state with the user-provided window buffer.
@@ -991,9 +1115,9 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
991
1115
  This routine would normally be used in a utility that reads zip or gzip
992
1116
  files and writes out uncompressed files. The utility would decode the
993
1117
  header and process the trailer on its own, hence this routine expects only
994
- the raw deflate stream to decompress. This is different from the normal
995
- behavior of inflate(), which expects either a zlib or gzip header and
996
- trailer around the deflate stream.
1118
+ the raw deflate stream to decompress. This is different from the default
1119
+ behavior of inflate(), which expects a zlib header and trailer around the
1120
+ deflate stream.
997
1121
 
998
1122
  inflateBack() uses two subroutines supplied by the caller that are then
999
1123
  called by inflateBack() for input and output. inflateBack() calls those
@@ -1002,12 +1126,12 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
1002
1126
  parameters and return types are defined above in the in_func and out_func
1003
1127
  typedefs. inflateBack() will call in(in_desc, &buf) which should return the
1004
1128
  number of bytes of provided input, and a pointer to that input in buf. If
1005
- there is no input available, in() must return zero--buf is ignored in that
1006
- case--and inflateBack() will return a buffer error. inflateBack() will call
1007
- out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out()
1008
- should return zero on success, or non-zero on failure. If out() returns
1009
- non-zero, inflateBack() will return with an error. Neither in() nor out()
1010
- are permitted to change the contents of the window provided to
1129
+ there is no input available, in() must return zero -- buf is ignored in that
1130
+ case -- and inflateBack() will return a buffer error. inflateBack() will
1131
+ call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].
1132
+ out() should return zero on success, or non-zero on failure. If out()
1133
+ returns non-zero, inflateBack() will return with an error. Neither in() nor
1134
+ out() are permitted to change the contents of the window provided to
1011
1135
  inflateBackInit(), which is also the buffer that out() uses to write from.
1012
1136
  The length written by out() will be at most the window size. Any non-zero
1013
1137
  amount of input may be provided by in().
@@ -1035,7 +1159,7 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
1035
1159
  using strm->next_in which will be Z_NULL only if in() returned an error. If
1036
1160
  strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
1037
1161
  non-zero. (in() will always be called before out(), so strm->next_in is
1038
- assured to be defined if out() returns non-zero.) Note that inflateBack()
1162
+ assured to be defined if out() returns non-zero.) Note that inflateBack()
1039
1163
  cannot return Z_OK.
1040
1164
  */
1041
1165
 
@@ -1057,7 +1181,7 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
1057
1181
  7.6: size of z_off_t
1058
1182
 
1059
1183
  Compiler, assembler, and debug options:
1060
- 8: DEBUG
1184
+ 8: ZLIB_DEBUG
1061
1185
  9: ASMV or ASMINF -- use ASM code
1062
1186
  10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
1063
1187
  11: 0 (reserved)
@@ -1088,6 +1212,7 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
1088
1212
  27-31: 0 (reserved)
1089
1213
  */
1090
1214
 
1215
+ #ifndef Z_SOLO
1091
1216
 
1092
1217
  /* utility functions */
1093
1218
 
@@ -1106,7 +1231,8 @@ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
1106
1231
  the byte length of the source buffer. Upon entry, destLen is the total size
1107
1232
  of the destination buffer, which must be at least the value returned by
1108
1233
  compressBound(sourceLen). Upon exit, destLen is the actual size of the
1109
- compressed buffer.
1234
+ compressed data. compress() is equivalent to compress2() with a level
1235
+ parameter of Z_DEFAULT_COMPRESSION.
1110
1236
 
1111
1237
  compress returns Z_OK if success, Z_MEM_ERROR if there was not
1112
1238
  enough memory, Z_BUF_ERROR if there was not enough room in the output
@@ -1122,7 +1248,7 @@ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
1122
1248
  length of the source buffer. Upon entry, destLen is the total size of the
1123
1249
  destination buffer, which must be at least the value returned by
1124
1250
  compressBound(sourceLen). Upon exit, destLen is the actual size of the
1125
- compressed buffer.
1251
+ compressed data.
1126
1252
 
1127
1253
  compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
1128
1254
  memory, Z_BUF_ERROR if there was not enough room in the output buffer,
@@ -1145,13 +1271,22 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
1145
1271
  uncompressed data. (The size of the uncompressed data must have been saved
1146
1272
  previously by the compressor and transmitted to the decompressor by some
1147
1273
  mechanism outside the scope of this compression library.) Upon exit, destLen
1148
- is the actual size of the uncompressed buffer.
1274
+ is the actual size of the uncompressed data.
1149
1275
 
1150
1276
  uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
1151
1277
  enough memory, Z_BUF_ERROR if there was not enough room in the output
1152
- buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
1278
+ buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In
1279
+ the case where there is not enough room, uncompress() will fill the output
1280
+ buffer with the uncompressed data up to that point.
1153
1281
  */
1154
1282
 
1283
+ ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen,
1284
+ const Bytef *source, uLong *sourceLen));
1285
+ /*
1286
+ Same as uncompress, except that sourceLen is a pointer, where the
1287
+ length of the source is *sourceLen. On return, *sourceLen is the number of
1288
+ source bytes consumed.
1289
+ */
1155
1290
 
1156
1291
  /* gzip file access functions */
1157
1292
 
@@ -1162,7 +1297,7 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
1162
1297
  wrapper, documented in RFC 1952, wrapped around a deflate stream.
1163
1298
  */
1164
1299
 
1165
- typedef voidp gzFile; /* opaque gzip file descriptor */
1300
+ typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */
1166
1301
 
1167
1302
  /*
1168
1303
  ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
@@ -1172,13 +1307,28 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
1172
1307
  a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
1173
1308
  compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'
1174
1309
  for fixed code compression as in "wb9F". (See the description of
1175
- deflateInit2 for more information about the strategy parameter.) Also "a"
1176
- can be used instead of "w" to request that the gzip stream that will be
1177
- written be appended to the file. "+" will result in an error, since reading
1178
- and writing to the same gzip file is not supported.
1310
+ deflateInit2 for more information about the strategy parameter.) 'T' will
1311
+ request transparent writing or appending with no compression and not using
1312
+ the gzip format.
1313
+
1314
+ "a" can be used instead of "w" to request that the gzip stream that will
1315
+ be written be appended to the file. "+" will result in an error, since
1316
+ reading and writing to the same gzip file is not supported. The addition of
1317
+ "x" when writing will create the file exclusively, which fails if the file
1318
+ already exists. On systems that support it, the addition of "e" when
1319
+ reading or writing will set the flag to close the file on an execve() call.
1320
+
1321
+ These functions, as well as gzip, will read and decode a sequence of gzip
1322
+ streams in a file. The append function of gzopen() can be used to create
1323
+ such a file. (Also see gzflush() for another way to do this.) When
1324
+ appending, gzopen does not test whether the file begins with a gzip stream,
1325
+ nor does it look for the end of the gzip streams to begin appending. gzopen
1326
+ will simply append a gzip stream to the existing file.
1179
1327
 
1180
1328
  gzopen can be used to read a file which is not in gzip format; in this
1181
- case gzread will directly read from the file without decompression.
1329
+ case gzread will directly read from the file without decompression. When
1330
+ reading, this will be detected automatically by looking for the magic two-
1331
+ byte gzip header.
1182
1332
 
1183
1333
  gzopen returns NULL if the file could not be opened, if there was
1184
1334
  insufficient memory to allocate the gzFile state, or if an invalid mode was
@@ -1197,7 +1347,11 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
1197
1347
  descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
1198
1348
  fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,
1199
1349
  mode);. The duplicated descriptor should be saved to avoid a leak, since
1200
- gzdopen does not close fd if it fails.
1350
+ gzdopen does not close fd if it fails. If you are using fileno() to get the
1351
+ file descriptor from a FILE *, then you will have to use dup() to avoid
1352
+ double-close()ing the file descriptor. Both gzclose() and fclose() will
1353
+ close the associated file descriptor, so they need to have different file
1354
+ descriptors.
1201
1355
 
1202
1356
  gzdopen returns NULL if there was insufficient memory to allocate the
1203
1357
  gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not
@@ -1212,10 +1366,9 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
1212
1366
  default buffer size is 8192 bytes. This function must be called after
1213
1367
  gzopen() or gzdopen(), and before any other calls that read or write the
1214
1368
  file. The buffer memory allocation is always deferred to the first read or
1215
- write. Two buffers are allocated, either both of the specified size when
1216
- writing, or one of the specified size and the other twice that size when
1217
- reading. A larger buffer size of, for example, 64K or 128K bytes will
1218
- noticeably increase the speed of decompression (reading).
1369
+ write. Three times that size in buffer space is allocated. A larger buffer
1370
+ size of, for example, 64K or 128K bytes will noticeably increase the speed
1371
+ of decompression (reading).
1219
1372
 
1220
1373
  The new buffer size also affects the maximum length for gzprintf().
1221
1374
 
@@ -1226,26 +1379,68 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
1226
1379
  ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
1227
1380
  /*
1228
1381
  Dynamically update the compression level or strategy. See the description
1229
- of deflateInit2 for the meaning of these parameters.
1382
+ of deflateInit2 for the meaning of these parameters. Previously provided
1383
+ data is flushed before the parameter change.
1230
1384
 
1231
- gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
1232
- opened for writing.
1385
+ gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not
1386
+ opened for writing, Z_ERRNO if there is an error writing the flushed data,
1387
+ or Z_MEM_ERROR if there is a memory allocation error.
1233
1388
  */
1234
1389
 
1235
1390
  ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
1236
1391
  /*
1237
1392
  Reads the given number of uncompressed bytes from the compressed file. If
1238
- the input file was not in gzip format, gzread copies the given number of
1239
- bytes into the buffer.
1393
+ the input file is not in gzip format, gzread copies the given number of
1394
+ bytes into the buffer directly from the file.
1240
1395
 
1241
1396
  After reaching the end of a gzip stream in the input, gzread will continue
1242
- to read, looking for another gzip stream, or failing that, reading the rest
1243
- of the input file directly without decompression. The entire input file
1244
- will be read if gzread is called until it returns less than the requested
1245
- len.
1397
+ to read, looking for another gzip stream. Any number of gzip streams may be
1398
+ concatenated in the input file, and will all be decompressed by gzread().
1399
+ If something other than a gzip stream is encountered after a gzip stream,
1400
+ that remaining trailing garbage is ignored (and no error is returned).
1401
+
1402
+ gzread can be used to read a gzip file that is being concurrently written.
1403
+ Upon reaching the end of the input, gzread will return with the available
1404
+ data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then
1405
+ gzclearerr can be used to clear the end of file indicator in order to permit
1406
+ gzread to be tried again. Z_OK indicates that a gzip stream was completed
1407
+ on the last gzread. Z_BUF_ERROR indicates that the input file ended in the
1408
+ middle of a gzip stream. Note that gzread does not return -1 in the event
1409
+ of an incomplete gzip stream. This error is deferred until gzclose(), which
1410
+ will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip
1411
+ stream. Alternatively, gzerror can be used before gzclose to detect this
1412
+ case.
1246
1413
 
1247
1414
  gzread returns the number of uncompressed bytes actually read, less than
1248
- len for end of file, or -1 for error.
1415
+ len for end of file, or -1 for error. If len is too large to fit in an int,
1416
+ then nothing is read, -1 is returned, and the error state is set to
1417
+ Z_STREAM_ERROR.
1418
+ */
1419
+
1420
+ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
1421
+ gzFile file));
1422
+ /*
1423
+ Read up to nitems items of size size from file to buf, otherwise operating
1424
+ as gzread() does. This duplicates the interface of stdio's fread(), with
1425
+ size_t request and return types. If the library defines size_t, then
1426
+ z_size_t is identical to size_t. If not, then z_size_t is an unsigned
1427
+ integer type that can contain a pointer.
1428
+
1429
+ gzfread() returns the number of full items read of size size, or zero if
1430
+ the end of the file was reached and a full item could not be read, or if
1431
+ there was an error. gzerror() must be consulted if zero is returned in
1432
+ order to determine if there was an error. If the multiplication of size and
1433
+ nitems overflows, i.e. the product does not fit in a z_size_t, then nothing
1434
+ is read, zero is returned, and the error state is set to Z_STREAM_ERROR.
1435
+
1436
+ In the event that the end of file is reached and only a partial item is
1437
+ available at the end, i.e. the remaining uncompressed data length is not a
1438
+ multiple of size, then the final partial item is nevetheless read into buf
1439
+ and the end-of-file flag is set. The length of the partial item read is not
1440
+ provided, but could be inferred from the result of gztell(). This behavior
1441
+ is the same as the behavior of fread() implementations in common libraries,
1442
+ but it prevents the direct use of gzfread() to read a concurrently written
1443
+ file, reseting and retrying on end-of-file, when size is not 1.
1249
1444
  */
1250
1445
 
1251
1446
  ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
@@ -1256,19 +1451,33 @@ ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
1256
1451
  error.
1257
1452
  */
1258
1453
 
1259
- ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
1454
+ ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size,
1455
+ z_size_t nitems, gzFile file));
1456
+ /*
1457
+ gzfwrite() writes nitems items of size size from buf to file, duplicating
1458
+ the interface of stdio's fwrite(), with size_t request and return types. If
1459
+ the library defines size_t, then z_size_t is identical to size_t. If not,
1460
+ then z_size_t is an unsigned integer type that can contain a pointer.
1461
+
1462
+ gzfwrite() returns the number of full items written of size size, or zero
1463
+ if there was an error. If the multiplication of size and nitems overflows,
1464
+ i.e. the product does not fit in a z_size_t, then nothing is written, zero
1465
+ is returned, and the error state is set to Z_STREAM_ERROR.
1466
+ */
1467
+
1468
+ ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
1260
1469
  /*
1261
1470
  Converts, formats, and writes the arguments to the compressed file under
1262
1471
  control of the format string, as in fprintf. gzprintf returns the number of
1263
- uncompressed bytes actually written, or 0 in case of error. The number of
1264
- uncompressed bytes written is limited to 8191, or one less than the buffer
1265
- size given to gzbuffer(). The caller should assure that this limit is not
1266
- exceeded. If it is exceeded, then gzprintf() will return an error (0) with
1267
- nothing written. In this case, there may also be a buffer overflow with
1268
- unpredictable consequences, which is possible only if zlib was compiled with
1269
- the insecure functions sprintf() or vsprintf() because the secure snprintf()
1270
- or vsnprintf() functions were not available. This can be determined using
1271
- zlibCompileFlags().
1472
+ uncompressed bytes actually written, or a negative zlib error code in case
1473
+ of error. The number of uncompressed bytes written is limited to 8191, or
1474
+ one less than the buffer size given to gzbuffer(). The caller should assure
1475
+ that this limit is not exceeded. If it is exceeded, then gzprintf() will
1476
+ return an error (0) with nothing written. In this case, there may also be a
1477
+ buffer overflow with unpredictable consequences, which is possible only if
1478
+ zlib was compiled with the insecure functions sprintf() or vsprintf()
1479
+ because the secure snprintf() or vsnprintf() functions were not available.
1480
+ This can be determined using zlibCompileFlags().
1272
1481
  */
1273
1482
 
1274
1483
  ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
@@ -1301,7 +1510,10 @@ ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
1301
1510
  ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
1302
1511
  /*
1303
1512
  Reads one byte from the compressed file. gzgetc returns this byte or -1
1304
- in case of end of file or error.
1513
+ in case of end of file or error. This is implemented as a macro for speed.
1514
+ As such, it does not do all of the checking the other functions do. I.e.
1515
+ it does not check to see if file is NULL, nor whether the structure file
1516
+ points to has been clobbered or not.
1305
1517
  */
1306
1518
 
1307
1519
  ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
@@ -1325,7 +1537,7 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
1325
1537
  If the flush parameter is Z_FINISH, the remaining data is written and the
1326
1538
  gzip stream is completed in the output. If gzwrite() is called again, a new
1327
1539
  gzip stream will be started in the output. gzread() is able to read such
1328
- concatented gzip streams.
1540
+ concatenated gzip streams.
1329
1541
 
1330
1542
  gzflush should be called only when strictly necessary because it will
1331
1543
  degrade compression if called too often.
@@ -1397,9 +1609,7 @@ ZEXTERN int ZEXPORT gzeof OF((gzFile file));
1397
1609
  ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
1398
1610
  /*
1399
1611
  Returns true (1) if file is being copied directly while reading, or false
1400
- (0) if file is a gzip stream being decompressed. This state can change from
1401
- false to true while reading the input file if the end of a gzip stream is
1402
- reached, but is followed by data that is not another gzip stream.
1612
+ (0) if file is a gzip stream being decompressed.
1403
1613
 
1404
1614
  If the input file is empty, gzdirect() will return true, since the input
1405
1615
  does not contain a gzip stream.
@@ -1408,6 +1618,13 @@ ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
1408
1618
  cause buffers to be allocated to allow reading the file to determine if it
1409
1619
  is a gzip file. Therefore if gzbuffer() is used, it should be called before
1410
1620
  gzdirect().
1621
+
1622
+ When writing, gzdirect() returns true (1) if transparent writing was
1623
+ requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note:
1624
+ gzdirect() is not needed when writing. Transparent writing must be
1625
+ explicitly requested, so the application already knows the answer. When
1626
+ linking statically, using gzdirect() will include all of the zlib code for
1627
+ gzip file reading and decompression, which may not be desired.)
1411
1628
  */
1412
1629
 
1413
1630
  ZEXTERN int ZEXPORT gzclose OF((gzFile file));
@@ -1419,7 +1636,8 @@ ZEXTERN int ZEXPORT gzclose OF((gzFile file));
1419
1636
  must not be called more than once on the same allocation.
1420
1637
 
1421
1638
  gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
1422
- file operation error, or Z_OK on success.
1639
+ file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the
1640
+ last read ended in the middle of a gzip stream, or Z_OK on success.
1423
1641
  */
1424
1642
 
1425
1643
  ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
@@ -1457,6 +1675,7 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
1457
1675
  file that is being written concurrently.
1458
1676
  */
1459
1677
 
1678
+ #endif /* !Z_SOLO */
1460
1679
 
1461
1680
  /* checksum functions */
1462
1681
 
@@ -1472,7 +1691,7 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
1472
1691
  return the updated checksum. If buf is Z_NULL, this function returns the
1473
1692
  required initial value for the checksum.
1474
1693
 
1475
- An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
1694
+ An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed
1476
1695
  much faster.
1477
1696
 
1478
1697
  Usage example:
@@ -1485,6 +1704,12 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
1485
1704
  if (adler != original_adler) error();
1486
1705
  */
1487
1706
 
1707
+ ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf,
1708
+ z_size_t len));
1709
+ /*
1710
+ Same as adler32(), but with a size_t length.
1711
+ */
1712
+
1488
1713
  /*
1489
1714
  ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
1490
1715
  z_off_t len2));
@@ -1492,16 +1717,17 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
1492
1717
  Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
1493
1718
  and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
1494
1719
  each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
1495
- seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
1720
+ seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note
1721
+ that the z_off_t type (like off_t) is a signed integer. If len2 is
1722
+ negative, the result has no meaning or utility.
1496
1723
  */
1497
1724
 
1498
1725
  ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
1499
1726
  /*
1500
1727
  Update a running CRC-32 with the bytes buf[0..len-1] and return the
1501
1728
  updated CRC-32. If buf is Z_NULL, this function returns the required
1502
- initial value for the for the crc. Pre- and post-conditioning (one's
1503
- complement) is performed within this function so it shouldn't be done by the
1504
- application.
1729
+ initial value for the crc. Pre- and post-conditioning (one's complement) is
1730
+ performed within this function so it shouldn't be done by the application.
1505
1731
 
1506
1732
  Usage example:
1507
1733
 
@@ -1513,6 +1739,12 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
1513
1739
  if (crc != original_crc) error();
1514
1740
  */
1515
1741
 
1742
+ ZEXTERN uLong ZEXPORT crc32_z OF((uLong adler, const Bytef *buf,
1743
+ z_size_t len));
1744
+ /*
1745
+ Same as crc32(), but with a size_t length.
1746
+ */
1747
+
1516
1748
  /*
1517
1749
  ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
1518
1750
 
@@ -1543,18 +1775,59 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
1543
1775
  unsigned char FAR *window,
1544
1776
  const char *version,
1545
1777
  int stream_size));
1546
- #define deflateInit(strm, level) \
1547
- deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream))
1548
- #define inflateInit(strm) \
1549
- inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream))
1550
- #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
1551
- deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
1552
- (strategy), ZLIB_VERSION, sizeof(z_stream))
1553
- #define inflateInit2(strm, windowBits) \
1554
- inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
1555
- #define inflateBackInit(strm, windowBits, window) \
1556
- inflateBackInit_((strm), (windowBits), (window), \
1557
- ZLIB_VERSION, sizeof(z_stream))
1778
+ #ifdef Z_PREFIX_SET
1779
+ # define z_deflateInit(strm, level) \
1780
+ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
1781
+ # define z_inflateInit(strm) \
1782
+ inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
1783
+ # define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
1784
+ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
1785
+ (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
1786
+ # define z_inflateInit2(strm, windowBits) \
1787
+ inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
1788
+ (int)sizeof(z_stream))
1789
+ # define z_inflateBackInit(strm, windowBits, window) \
1790
+ inflateBackInit_((strm), (windowBits), (window), \
1791
+ ZLIB_VERSION, (int)sizeof(z_stream))
1792
+ #else
1793
+ # define deflateInit(strm, level) \
1794
+ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
1795
+ # define inflateInit(strm) \
1796
+ inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
1797
+ # define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
1798
+ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
1799
+ (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
1800
+ # define inflateInit2(strm, windowBits) \
1801
+ inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
1802
+ (int)sizeof(z_stream))
1803
+ # define inflateBackInit(strm, windowBits, window) \
1804
+ inflateBackInit_((strm), (windowBits), (window), \
1805
+ ZLIB_VERSION, (int)sizeof(z_stream))
1806
+ #endif
1807
+
1808
+ #ifndef Z_SOLO
1809
+
1810
+ /* gzgetc() macro and its supporting function and exposed data structure. Note
1811
+ * that the real internal state is much larger than the exposed structure.
1812
+ * This abbreviated structure exposes just enough for the gzgetc() macro. The
1813
+ * user should not mess with these exposed elements, since their names or
1814
+ * behavior could change in the future, perhaps even capriciously. They can
1815
+ * only be used by the gzgetc() macro. You have been warned.
1816
+ */
1817
+ struct gzFile_s {
1818
+ unsigned have;
1819
+ unsigned char *next;
1820
+ z_off64_t pos;
1821
+ };
1822
+ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
1823
+ #ifdef Z_PREFIX_SET
1824
+ # undef z_gzgetc
1825
+ # define z_gzgetc(g) \
1826
+ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
1827
+ #else
1828
+ # define gzgetc(g) \
1829
+ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
1830
+ #endif
1558
1831
 
1559
1832
  /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
1560
1833
  * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
@@ -1562,7 +1835,7 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
1562
1835
  * functions are changed to 64 bits) -- in case these are set on systems
1563
1836
  * without large file support, _LFS64_LARGEFILE must also be true
1564
1837
  */
1565
- #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
1838
+ #ifdef Z_LARGE64
1566
1839
  ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
1567
1840
  ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
1568
1841
  ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
@@ -1571,14 +1844,23 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
1571
1844
  ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
1572
1845
  #endif
1573
1846
 
1574
- #if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0
1575
- # define gzopen gzopen64
1576
- # define gzseek gzseek64
1577
- # define gztell gztell64
1578
- # define gzoffset gzoffset64
1579
- # define adler32_combine adler32_combine64
1580
- # define crc32_combine crc32_combine64
1581
- # ifdef _LARGEFILE64_SOURCE
1847
+ #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
1848
+ # ifdef Z_PREFIX_SET
1849
+ # define z_gzopen z_gzopen64
1850
+ # define z_gzseek z_gzseek64
1851
+ # define z_gztell z_gztell64
1852
+ # define z_gzoffset z_gzoffset64
1853
+ # define z_adler32_combine z_adler32_combine64
1854
+ # define z_crc32_combine z_crc32_combine64
1855
+ # else
1856
+ # define gzopen gzopen64
1857
+ # define gzseek gzseek64
1858
+ # define gztell gztell64
1859
+ # define gzoffset gzoffset64
1860
+ # define adler32_combine adler32_combine64
1861
+ # define crc32_combine crc32_combine64
1862
+ # endif
1863
+ # ifndef Z_LARGE64
1582
1864
  ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
1583
1865
  ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
1584
1866
  ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
@@ -1595,16 +1877,33 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
1595
1877
  ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
1596
1878
  #endif
1597
1879
 
1598
- /* hack for buggy compilers */
1599
- #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
1600
- struct internal_state {int dummy;};
1601
- #endif
1880
+ #else /* Z_SOLO */
1881
+
1882
+ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
1883
+ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
1884
+
1885
+ #endif /* !Z_SOLO */
1602
1886
 
1603
1887
  /* undocumented functions */
1604
1888
  ZEXTERN const char * ZEXPORT zError OF((int));
1605
1889
  ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
1606
- ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
1890
+ ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void));
1607
1891
  ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
1892
+ ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int));
1893
+ ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF ((z_streamp));
1894
+ ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
1895
+ ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
1896
+ #if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(Z_SOLO)
1897
+ ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
1898
+ const char *mode));
1899
+ #endif
1900
+ #if defined(STDC) || defined(Z_HAVE_STDARG_H)
1901
+ # ifndef Z_SOLO
1902
+ ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file,
1903
+ const char *format,
1904
+ va_list va));
1905
+ # endif
1906
+ #endif
1608
1907
 
1609
1908
  #ifdef __cplusplus
1610
1909
  }