libarchive-static 1.0.6 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (295) hide show
  1. checksums.yaml +4 -4
  2. data/ext/extconf.rb +2 -9
  3. data/ext/libarchive-0.1.1/ext/archive_read_support_compression.c +6 -6
  4. data/ext/libarchive-0.1.1/ext/archive_read_support_compression.o +0 -0
  5. data/ext/libarchive-0.1.1/ext/archive_read_support_format.o +0 -0
  6. data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.c +1 -1
  7. data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.o +0 -0
  8. data/ext/libarchive-0.1.1/ext/archive_write_set_compression.c +5 -5
  9. data/ext/libarchive-0.1.1/ext/archive_write_set_compression.o +0 -0
  10. data/ext/libarchive-0.1.1/ext/config.h +23 -0
  11. data/ext/libarchive-0.1.1/ext/config.log +230 -0
  12. data/ext/libarchive-0.1.1/ext/config.status +671 -0
  13. data/ext/libarchive-0.1.1/ext/libarchive.c +1 -1
  14. data/ext/libarchive-0.1.1/ext/libarchive.o +0 -0
  15. data/ext/libarchive-0.1.1/ext/libarchive_archive.c +7 -7
  16. data/ext/libarchive-0.1.1/ext/libarchive_archive.o +0 -0
  17. data/ext/libarchive-0.1.1/ext/libarchive_entry.c +6 -0
  18. data/ext/libarchive-0.1.1/ext/libarchive_entry.o +0 -0
  19. data/ext/libarchive-0.1.1/ext/libarchive_reader.c +6 -4
  20. data/ext/libarchive-0.1.1/ext/libarchive_reader.o +0 -0
  21. data/ext/libarchive-0.1.1/ext/libarchive_ruby.so +0 -0
  22. data/ext/libarchive-0.1.1/ext/libarchive_win32.h +1 -1
  23. data/ext/libarchive-0.1.1/ext/libarchive_writer.c +2 -2
  24. data/ext/libarchive-0.1.1/ext/libarchive_writer.o +0 -0
  25. data/ext/libarchive-3.6.2/Makefile.in +16892 -0
  26. data/ext/libarchive-3.6.2/build/autoconf/ax_append_compile_flags.m4 +67 -0
  27. data/ext/libarchive-3.6.2/build/autoconf/ax_append_flag.m4 +71 -0
  28. data/ext/libarchive-3.6.2/build/autoconf/ax_check_compile_flag.m4 +74 -0
  29. data/ext/libarchive-3.6.2/build/autoconf/ax_require_defined.m4 +37 -0
  30. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/check_stdcall_func.m4 +0 -0
  31. data/ext/libarchive-3.6.2/build/autoconf/compile +348 -0
  32. data/ext/libarchive-3.6.2/build/autoconf/config.guess +1754 -0
  33. data/ext/libarchive-3.6.2/build/autoconf/config.rpath +696 -0
  34. data/ext/libarchive-3.6.2/build/autoconf/config.sub +1890 -0
  35. data/ext/libarchive-3.6.2/build/autoconf/depcomp +791 -0
  36. data/ext/libarchive-3.6.2/build/autoconf/iconv.m4 +271 -0
  37. data/ext/libarchive-3.6.2/build/autoconf/install-sh +541 -0
  38. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/la_uid_t.m4 +0 -0
  39. data/ext/libarchive-3.6.2/build/autoconf/lib-ld.m4 +109 -0
  40. data/ext/libarchive-3.6.2/build/autoconf/lib-link.m4 +777 -0
  41. data/ext/libarchive-3.6.2/build/autoconf/lib-prefix.m4 +224 -0
  42. data/ext/libarchive-3.6.2/build/autoconf/ltmain.sh +11251 -0
  43. data/ext/libarchive-3.6.2/build/autoconf/m4_ax_compile_check_sizeof.m4 +115 -0
  44. data/ext/libarchive-3.6.2/build/autoconf/missing +215 -0
  45. data/ext/libarchive-3.6.2/build/autoconf/test-driver +153 -0
  46. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/pkgconfig/libarchive.pc.in +4 -1
  47. data/ext/libarchive-3.6.2/config.h.in +1504 -0
  48. data/ext/libarchive-3.6.2/configure +25558 -0
  49. data/ext/libarchive-3.6.2/libarchive/archive.h +1212 -0
  50. data/ext/libarchive-3.6.2/libarchive/archive_acl.c +2097 -0
  51. data/ext/libarchive-3.6.2/libarchive/archive_acl_private.h +83 -0
  52. data/ext/libarchive-3.6.2/libarchive/archive_blake2.h +197 -0
  53. data/ext/libarchive-3.6.2/libarchive/archive_blake2_impl.h +161 -0
  54. data/ext/libarchive-3.6.2/libarchive/archive_blake2s_ref.c +369 -0
  55. data/ext/libarchive-3.6.2/libarchive/archive_blake2sp_ref.c +361 -0
  56. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_check_magic.c +63 -22
  57. data/ext/libarchive-3.6.2/libarchive/archive_cmdline.c +227 -0
  58. data/ext/libarchive-3.6.2/libarchive/archive_cmdline_private.h +47 -0
  59. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_crc32.h +17 -0
  60. data/ext/libarchive-3.6.2/libarchive/archive_cryptor.c +534 -0
  61. data/ext/libarchive-3.6.2/libarchive/archive_cryptor_private.h +188 -0
  62. data/ext/libarchive-3.6.2/libarchive/archive_digest.c +1505 -0
  63. data/ext/libarchive-3.6.2/libarchive/archive_digest_private.h +416 -0
  64. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_darwin.c +559 -0
  65. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_freebsd.c +712 -0
  66. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_linux.c +760 -0
  67. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_sunos.c +824 -0
  68. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_endian.h +48 -15
  69. data/ext/libarchive-3.6.2/libarchive/archive_entry.c +2149 -0
  70. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry.h +305 -106
  71. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_bhfi.c +5 -4
  72. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_stat.c +9 -3
  73. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_link_resolver.c +104 -62
  74. data/ext/libarchive-3.6.2/libarchive/archive_entry_locale.h +92 -0
  75. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_private.h +65 -49
  76. data/ext/libarchive-3.6.2/libarchive/archive_entry_sparse.c +156 -0
  77. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_stat.c +6 -6
  78. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_strmode.c +1 -1
  79. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_xattr.c +4 -6
  80. data/ext/libarchive-3.6.2/libarchive/archive_getdate.c +1165 -0
  81. data/ext/libarchive-3.6.2/libarchive/archive_getdate.h +39 -0
  82. data/ext/libarchive-3.6.2/libarchive/archive_hmac.c +334 -0
  83. data/ext/libarchive-3.6.2/libarchive/archive_hmac_private.h +117 -0
  84. data/ext/libarchive-3.6.2/libarchive/archive_match.c +1875 -0
  85. data/ext/libarchive-3.6.2/libarchive/archive_openssl_evp_private.h +53 -0
  86. data/ext/libarchive-3.6.2/libarchive/archive_openssl_hmac_private.h +54 -0
  87. data/ext/libarchive-3.6.2/libarchive/archive_options.c +218 -0
  88. data/ext/libarchive-3.6.2/libarchive/archive_options_private.h +51 -0
  89. data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.c +337 -0
  90. data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.h +49 -0
  91. data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.c +463 -0
  92. data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.h +52 -0
  93. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_platform.h +77 -9
  94. data/ext/libarchive-3.6.2/libarchive/archive_platform_acl.h +55 -0
  95. data/ext/libarchive-3.6.2/libarchive/archive_platform_xattr.h +47 -0
  96. data/ext/libarchive-3.6.2/libarchive/archive_ppmd7.c +1168 -0
  97. data/ext/libarchive-3.6.2/libarchive/archive_ppmd7_private.h +119 -0
  98. data/ext/libarchive-3.6.2/libarchive/archive_ppmd8.c +1287 -0
  99. data/ext/libarchive-3.6.2/libarchive/archive_ppmd8_private.h +148 -0
  100. data/ext/libarchive-3.6.2/libarchive/archive_ppmd_private.h +151 -0
  101. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_private.h +74 -18
  102. data/ext/libarchive-3.6.2/libarchive/archive_random.c +272 -0
  103. data/ext/libarchive-3.6.2/libarchive/archive_random_private.h +36 -0
  104. data/ext/libarchive-3.6.2/libarchive/archive_rb.c +709 -0
  105. data/ext/libarchive-3.6.2/libarchive/archive_rb.h +113 -0
  106. data/ext/libarchive-3.6.2/libarchive/archive_read.c +1756 -0
  107. data/ext/libarchive-3.6.2/libarchive/archive_read_add_passphrase.c +190 -0
  108. data/ext/libarchive-3.6.2/libarchive/archive_read_append_filter.c +204 -0
  109. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_data_into_fd.c +64 -18
  110. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_entry_from_file.c +1086 -0
  111. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_posix.c +2732 -0
  112. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_private.h +40 -4
  113. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_set_standard_lookup.c +21 -11
  114. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_windows.c +2479 -0
  115. data/ext/libarchive-3.6.2/libarchive/archive_read_extract.c +60 -0
  116. data/ext/{libarchive-2.8.4/libarchive/archive_read_extract.c → libarchive-3.6.2/libarchive/archive_read_extract2.c} +34 -61
  117. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_fd.c +70 -49
  118. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_file.c +38 -23
  119. data/ext/libarchive-3.6.2/libarchive/archive_read_open_filename.c +586 -0
  120. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_memory.c +58 -28
  121. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_private.h +127 -59
  122. data/ext/libarchive-3.6.2/libarchive/archive_read_set_format.c +117 -0
  123. data/ext/libarchive-3.6.2/libarchive/archive_read_set_options.c +133 -0
  124. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_all.c → libarchive-3.6.2/libarchive/archive_read_support_filter_all.c} +35 -10
  125. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_by_code.c +83 -0
  126. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_bzip2.c → libarchive-3.6.2/libarchive/archive_read_support_filter_bzip2.c} +38 -26
  127. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_compress.c → libarchive-3.6.2/libarchive/archive_read_support_filter_compress.c} +52 -44
  128. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_grzip.c +112 -0
  129. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_gzip.c → libarchive-3.6.2/libarchive/archive_read_support_filter_gzip.c} +108 -37
  130. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lrzip.c +122 -0
  131. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lz4.c +742 -0
  132. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lzop.c +499 -0
  133. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_none.c → libarchive-3.6.2/libarchive/archive_read_support_filter_none.c} +15 -3
  134. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_program.c → libarchive-3.6.2/libarchive/archive_read_support_filter_program.c} +114 -77
  135. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_rpm.c → libarchive-3.6.2/libarchive/archive_read_support_filter_rpm.c} +31 -31
  136. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_uu.c → libarchive-3.6.2/libarchive/archive_read_support_filter_uu.c} +141 -85
  137. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_xz.c → libarchive-3.6.2/libarchive/archive_read_support_filter_xz.c} +369 -284
  138. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_zstd.c +297 -0
  139. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_7zip.c +3900 -0
  140. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_all.c +89 -0
  141. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_ar.c +126 -72
  142. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_by_code.c +92 -0
  143. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cab.c +3228 -0
  144. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cpio.c +1104 -0
  145. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_empty.c +14 -11
  146. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_iso9660.c +990 -541
  147. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_lha.c +2916 -0
  148. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_mtree.c +2150 -0
  149. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar.c +3797 -0
  150. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar5.c +4251 -0
  151. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_raw.c +38 -31
  152. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_tar.c +1157 -629
  153. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_warc.c +848 -0
  154. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_xar.c +439 -258
  155. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_zip.c +4270 -0
  156. data/ext/libarchive-3.6.2/libarchive/archive_string.c +4240 -0
  157. data/ext/libarchive-3.6.2/libarchive/archive_string.h +243 -0
  158. data/ext/libarchive-3.6.2/libarchive/archive_string_composition.h +2292 -0
  159. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_string_sprintf.c +44 -16
  160. data/ext/libarchive-3.6.2/libarchive/archive_util.c +655 -0
  161. data/ext/libarchive-3.6.2/libarchive/archive_version_details.c +151 -0
  162. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_virtual.c +85 -16
  163. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.c +214 -541
  164. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.h +74 -106
  165. data/ext/libarchive-3.6.2/libarchive/archive_write.c +828 -0
  166. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter.c +72 -0
  167. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_b64encode.c +304 -0
  168. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_by_name.c +77 -0
  169. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_bzip2.c +401 -0
  170. data/ext/{libarchive-2.8.4/libarchive/archive_write_set_compression_compress.c → libarchive-3.6.2/libarchive/archive_write_add_filter_compress.c} +86 -131
  171. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_grzip.c +135 -0
  172. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_gzip.c +442 -0
  173. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lrzip.c +197 -0
  174. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lz4.c +700 -0
  175. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lzop.c +478 -0
  176. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_format_all.c → libarchive-3.6.2/libarchive/archive_write_add_filter_none.c} +11 -11
  177. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_program.c +391 -0
  178. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_uuencode.c +295 -0
  179. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_xz.c +545 -0
  180. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_zstd.c +418 -0
  181. data/ext/libarchive-3.6.2/libarchive/archive_write_disk_posix.c +4711 -0
  182. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_private.h +9 -2
  183. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_set_standard_lookup.c +30 -29
  184. data/ext/libarchive-3.6.2/libarchive/archive_write_disk_windows.c +2842 -0
  185. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_fd.c +15 -10
  186. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_file.c +15 -9
  187. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_filename.c +128 -20
  188. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_memory.c +7 -18
  189. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_private.h +72 -29
  190. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format.c +56 -3
  191. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_7zip.c +2322 -0
  192. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ar.c +54 -34
  193. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_by_name.c +20 -2
  194. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio.c +11 -0
  195. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_binary.c +610 -0
  196. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_newc.c +457 -0
  197. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_odc.c +500 -0
  198. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_filter_by_ext.c +142 -0
  199. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_gnutar.c +755 -0
  200. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_iso9660.c +8165 -0
  201. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_mtree.c +2217 -0
  202. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_pax.c +1049 -387
  203. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_private.h +42 -0
  204. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_raw.c +125 -0
  205. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_shar.c +62 -47
  206. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ustar.c +279 -108
  207. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_v7tar.c +638 -0
  208. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_warc.c +453 -0
  209. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_xar.c +3259 -0
  210. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_zip.c +1704 -0
  211. data/ext/libarchive-3.6.2/libarchive/archive_write_set_options.c +130 -0
  212. data/ext/libarchive-3.6.2/libarchive/archive_write_set_passphrase.c +95 -0
  213. data/ext/libarchive-3.6.2/libarchive/archive_xxhash.h +48 -0
  214. data/ext/libarchive-3.6.2/libarchive/config_freebsd.h +271 -0
  215. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/filter_fork.h +10 -5
  216. data/ext/{libarchive-2.8.4/libarchive/filter_fork.c → libarchive-3.6.2/libarchive/filter_fork_posix.c} +98 -19
  217. data/ext/libarchive-3.6.2/libarchive/filter_fork_windows.c +236 -0
  218. data/ext/libarchive-3.6.2/libarchive/xxhash.c +525 -0
  219. data/ext/libarchive-static-makefile +144 -80
  220. data/ext/libarchive-static-wrapper-makefile +1 -1
  221. data/ext/zlib-1.2.13/Makefile.in +404 -0
  222. data/ext/{zlib-1.2.5 → zlib-1.2.13}/adler32.c +51 -34
  223. data/ext/{zlib-1.2.5 → zlib-1.2.13}/compress.c +27 -21
  224. data/ext/zlib-1.2.13/configure +922 -0
  225. data/ext/zlib-1.2.13/crc32.c +1125 -0
  226. data/ext/zlib-1.2.13/crc32.h +9446 -0
  227. data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.c +842 -459
  228. data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.h +37 -33
  229. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzclose.c +0 -0
  230. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzguts.h +103 -16
  231. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzlib.c +155 -53
  232. data/ext/zlib-1.2.13/gzread.c +650 -0
  233. data/ext/zlib-1.2.13/gzwrite.c +677 -0
  234. data/ext/{zlib-1.2.5 → zlib-1.2.13}/infback.c +24 -12
  235. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.c +49 -66
  236. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.h +0 -0
  237. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffixed.h +3 -3
  238. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.c +209 -94
  239. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.h +9 -5
  240. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.c +24 -50
  241. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.h +1 -1
  242. data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.c +135 -198
  243. data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.h +0 -0
  244. data/ext/zlib-1.2.13/uncompr.c +93 -0
  245. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zconf.h +182 -63
  246. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zlib.h +617 -295
  247. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.c +50 -41
  248. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.h +83 -82
  249. metadata +241 -133
  250. data/ext/libarchive-0.1.1/libarchive.c +0 -1762
  251. data/ext/libarchive-2.8.4/Makefile.in +0 -7076
  252. data/ext/libarchive-2.8.4/build/autoconf/compile +0 -143
  253. data/ext/libarchive-2.8.4/build/autoconf/config.guess +0 -1502
  254. data/ext/libarchive-2.8.4/build/autoconf/config.sub +0 -1708
  255. data/ext/libarchive-2.8.4/build/autoconf/depcomp +0 -630
  256. data/ext/libarchive-2.8.4/build/autoconf/install-sh +0 -291
  257. data/ext/libarchive-2.8.4/build/autoconf/ltmain.sh +0 -8406
  258. data/ext/libarchive-2.8.4/build/autoconf/missing +0 -376
  259. data/ext/libarchive-2.8.4/config.h.in +0 -772
  260. data/ext/libarchive-2.8.4/configure +0 -17916
  261. data/ext/libarchive-2.8.4/libarchive/archive.h +0 -741
  262. data/ext/libarchive-2.8.4/libarchive/archive_entry.c +0 -2202
  263. data/ext/libarchive-2.8.4/libarchive/archive_hash.h +0 -281
  264. data/ext/libarchive-2.8.4/libarchive/archive_read.c +0 -1249
  265. data/ext/libarchive-2.8.4/libarchive/archive_read_disk.c +0 -198
  266. data/ext/libarchive-2.8.4/libarchive/archive_read_disk_entry_from_file.c +0 -570
  267. data/ext/libarchive-2.8.4/libarchive/archive_read_open_filename.c +0 -272
  268. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_cpio.c +0 -777
  269. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_mtree.c +0 -1304
  270. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_zip.c +0 -903
  271. data/ext/libarchive-2.8.4/libarchive/archive_string.c +0 -453
  272. data/ext/libarchive-2.8.4/libarchive/archive_string.h +0 -148
  273. data/ext/libarchive-2.8.4/libarchive/archive_util.c +0 -391
  274. data/ext/libarchive-2.8.4/libarchive/archive_write.c +0 -466
  275. data/ext/libarchive-2.8.4/libarchive/archive_write_disk.c +0 -2628
  276. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_bzip2.c +0 -408
  277. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_gzip.c +0 -477
  278. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_none.c +0 -257
  279. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_program.c +0 -347
  280. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_xz.c +0 -438
  281. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio.c +0 -344
  282. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio_newc.c +0 -295
  283. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_mtree.c +0 -1050
  284. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_zip.c +0 -667
  285. data/ext/libarchive-2.8.4/libarchive/config_freebsd.h +0 -154
  286. data/ext/libarchive-2.8.4/libarchive/filter_fork_windows.c +0 -113
  287. data/ext/zlib-1.2.5/Makefile.in +0 -257
  288. data/ext/zlib-1.2.5/configure +0 -596
  289. data/ext/zlib-1.2.5/crc32.c +0 -442
  290. data/ext/zlib-1.2.5/crc32.h +0 -441
  291. data/ext/zlib-1.2.5/example.c +0 -565
  292. data/ext/zlib-1.2.5/gzread.c +0 -653
  293. data/ext/zlib-1.2.5/gzwrite.c +0 -531
  294. data/ext/zlib-1.2.5/minigzip.c +0 -440
  295. data/ext/zlib-1.2.5/uncompr.c +0 -59
@@ -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.13, October 13th, 2022
3
3
 
4
- Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
4
+ Copyright (C) 1995-2022 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.13"
41
+ #define ZLIB_VERNUM 0x12d0
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 13
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 output
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
 
@@ -523,8 +543,7 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
523
543
  int strategy));
524
544
 
525
545
  This is another version of deflateInit with more compression options. The
526
- fields next_in, zalloc, zfree and opaque must be initialized before by the
527
- caller.
546
+ fields zalloc, zfree and opaque must be initialized before by the caller.
528
547
 
529
548
  The method parameter is the compression method. It must be Z_DEFLATED in
530
549
  this version of the library.
@@ -535,16 +554,29 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
535
554
  compression at the expense of memory usage. The default value is 15 if
536
555
  deflateInit is used instead.
537
556
 
557
+ For the current implementation of deflate(), a windowBits value of 8 (a
558
+ window size of 256 bytes) is not supported. As a result, a request for 8
559
+ will result in 9 (a 512-byte window). In that case, providing 8 to
560
+ inflateInit2() will result in an error when the zlib header with 9 is
561
+ checked against the initialization of inflate(). The remedy is to not use 8
562
+ with deflateInit2() with this initialization, or at least in that case use 9
563
+ with inflateInit2().
564
+
538
565
  windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
539
566
  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.
567
+ with no zlib header or trailer, and will not compute a check value.
541
568
 
542
569
  windowBits can also be greater than 15 for optional gzip encoding. Add
543
570
  16 to windowBits to write a simple gzip header and trailer around the
544
571
  compressed data instead of a zlib wrapper. The gzip header will have no
545
572
  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.
573
+ header crc, and the operating system will be set to the appropriate value,
574
+ if the operating system was determined at compile time. If a gzip stream is
575
+ being written, strm->adler is a CRC-32 instead of an Adler-32.
576
+
577
+ For raw deflate or gzip encoding, a request for a 256-byte window is
578
+ rejected as invalid, since only the zlib header provides a means of
579
+ transmitting the window size to the decompressor.
548
580
 
549
581
  The memLevel parameter specifies how much memory should be allocated
550
582
  for the internal compression state. memLevel=1 uses minimum memory but is
@@ -580,10 +612,15 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
580
612
  uInt dictLength));
581
613
  /*
582
614
  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).
615
+ without producing any compressed output. When using the zlib format, this
616
+ function must be called immediately after deflateInit, deflateInit2 or
617
+ deflateReset, and before any call of deflate. When doing raw deflate, this
618
+ function must be called either before any call of deflate, or immediately
619
+ after the completion of a deflate block, i.e. after all input has been
620
+ consumed and all output has been delivered when using any of the flush
621
+ options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The
622
+ compressor and decompressor must use exactly the same dictionary (see
623
+ inflateSetDictionary).
587
624
 
588
625
  The dictionary should consist of strings (byte sequences) that are likely
589
626
  to be encountered later in the data to be compressed, with the most commonly
@@ -600,18 +637,40 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
600
637
  addition, the current implementation of deflate will use at most the window
601
638
  size minus 262 bytes of the provided dictionary.
602
639
 
603
- Upon return of this function, strm->adler is set to the adler32 value
640
+ Upon return of this function, strm->adler is set to the Adler-32 value
604
641
  of the dictionary; the decompressor may later use this value to determine
605
- which dictionary has been used by the compressor. (The adler32 value
642
+ which dictionary has been used by the compressor. (The Adler-32 value
606
643
  applies to the whole dictionary even if only a subset of the dictionary is
607
644
  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.
645
+ Adler-32 value is not computed and strm->adler is not set.
609
646
 
610
647
  deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
611
648
  parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
612
649
  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().
650
+ or if not at a block boundary for raw deflate). deflateSetDictionary does
651
+ not perform any compression: this will be done by deflate().
652
+ */
653
+
654
+ ZEXTERN int ZEXPORT deflateGetDictionary OF((z_streamp strm,
655
+ Bytef *dictionary,
656
+ uInt *dictLength));
657
+ /*
658
+ Returns the sliding dictionary being maintained by deflate. dictLength is
659
+ set to the number of bytes in the dictionary, and that many bytes are copied
660
+ to dictionary. dictionary must have enough space, where 32768 bytes is
661
+ always enough. If deflateGetDictionary() is called with dictionary equal to
662
+ Z_NULL, then only the dictionary length is returned, and nothing is copied.
663
+ Similarly, if dictLength is Z_NULL, then it is not set.
664
+
665
+ deflateGetDictionary() may return a length less than the window size, even
666
+ when more than the window size in input has been provided. It may return up
667
+ to 258 bytes less in that case, due to how zlib's implementation of deflate
668
+ manages the sliding window and lookahead for matches, where matches can be
669
+ up to 258 bytes long. If the application needs the last window-size bytes of
670
+ input, then that would need to be saved by the application outside of zlib.
671
+
672
+ deflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
673
+ stream state is inconsistent.
615
674
  */
616
675
 
617
676
  ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
@@ -634,10 +693,10 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
634
693
 
635
694
  ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
636
695
  /*
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.
696
+ This function is equivalent to deflateEnd followed by deflateInit, but
697
+ does not free and reallocate the internal compression state. The stream
698
+ will leave the compression level and any other attributes that may have been
699
+ set unchanged.
641
700
 
642
701
  deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
643
702
  stream state was inconsistent (such as zalloc or state being Z_NULL).
@@ -648,20 +707,37 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
648
707
  int strategy));
649
708
  /*
650
709
  Dynamically update the compression level and compression strategy. The
651
- interpretation of level and strategy is as in deflateInit2. This can be
710
+ interpretation of level and strategy is as in deflateInit2(). This can be
652
711
  used to switch between compression and straight copy of the input data, or
653
712
  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.
713
+ If the compression approach (which is a function of the level) or the
714
+ strategy is changed, and if there have been any deflate() calls since the
715
+ state was initialized or reset, then the input available so far is
716
+ compressed with the old level and strategy using deflate(strm, Z_BLOCK).
717
+ There are three approaches for the compression levels 0, 1..3, and 4..9
718
+ respectively. The new level and strategy will take effect at the next call
719
+ 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,12 @@ 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 members.
869
+ inflate() will return Z_STREAM_END at the end of the gzip member. The state
870
+ would need to be reset to continue decoding a subsequent gzip member. This
871
+ *must* be done if there is more data after a gzip member, in order for the
872
+ decompression to be compliant with the gzip standard (RFC 1952).
771
873
 
772
874
  inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
773
875
  memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
@@ -788,34 +890,54 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
788
890
  Initializes the decompression dictionary from the given uncompressed byte
789
891
  sequence. This function must be called immediately after a call of inflate,
790
892
  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.
893
+ can be determined from the Adler-32 value returned by that call of inflate.
792
894
  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.
895
+ deflateSetDictionary). For raw inflate, this function can be called at any
896
+ time to set the dictionary. If the provided dictionary is smaller than the
897
+ window and there is already data in the window, then the provided dictionary
898
+ will amend what's there. The application must insure that the dictionary
899
+ that was used for compression is provided.
797
900
 
798
901
  inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
799
902
  parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
800
903
  inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
801
- expected one (incorrect adler32 value). inflateSetDictionary does not
904
+ expected one (incorrect Adler-32 value). inflateSetDictionary does not
802
905
  perform any decompression: this will be done by subsequent calls of
803
906
  inflate().
804
907
  */
805
908
 
909
+ ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm,
910
+ Bytef *dictionary,
911
+ uInt *dictLength));
912
+ /*
913
+ Returns the sliding dictionary being maintained by inflate. dictLength is
914
+ set to the number of bytes in the dictionary, and that many bytes are copied
915
+ to dictionary. dictionary must have enough space, where 32768 bytes is
916
+ always enough. If inflateGetDictionary() is called with dictionary equal to
917
+ Z_NULL, then only the dictionary length is returned, and nothing is copied.
918
+ Similarly, if dictLength is Z_NULL, then it is not set.
919
+
920
+ inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the
921
+ stream state is inconsistent.
922
+ */
923
+
806
924
  ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
807
925
  /*
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
926
+ Skips invalid compressed data until a possible full flush point (see above
927
+ for the description of deflate with Z_FULL_FLUSH) can be found, or until all
810
928
  available input is skipped. No output is provided.
811
929
 
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.
930
+ inflateSync searches for a 00 00 FF FF pattern in the compressed data.
931
+ All full flush points have this pattern, but not all occurrences of this
932
+ pattern are full flush points.
933
+
934
+ inflateSync returns Z_OK if a possible full flush point has been found,
935
+ Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
936
+ has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
937
+ In the success case, the application may save the current current value of
938
+ total_in which indicates where valid compressed data was found. In the
939
+ error case, the application may repeatedly call inflateSync, providing more
940
+ input each time, until success or end of the input data.
819
941
  */
820
942
 
821
943
  ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
@@ -837,7 +959,7 @@ ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
837
959
  ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
838
960
  /*
839
961
  This function is equivalent to inflateEnd followed by inflateInit,
840
- but does not free and reallocate all the internal decompression state. The
962
+ but does not free and reallocate the internal decompression state. The
841
963
  stream will keep attributes that may have been set by inflateInit2.
842
964
 
843
965
  inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
@@ -849,7 +971,9 @@ ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
849
971
  /*
850
972
  This function is the same as inflateReset, but it also permits changing
851
973
  the wrap and window size requests. The windowBits parameter is interpreted
852
- the same as it is for inflateInit2.
974
+ the same as it is for inflateInit2. If the window size is changed, then the
975
+ memory allocated for the window is freed, and the window will be reallocated
976
+ by inflate() if needed.
853
977
 
854
978
  inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
855
979
  stream state was inconsistent (such as zalloc or state being Z_NULL), or if
@@ -901,7 +1025,7 @@ ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
901
1025
  location in the input stream can be determined from avail_in and data_type
902
1026
  as noted in the description for the Z_BLOCK flush parameter for inflate.
903
1027
 
904
- inflateMark returns the value noted above or -1 << 16 if the provided
1028
+ inflateMark returns the value noted above, or -65536 if the provided
905
1029
  source stream state was inconsistent.
906
1030
  */
907
1031
 
@@ -962,12 +1086,13 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
962
1086
  See inflateBack() for the usage of these routines.
963
1087
 
964
1088
  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
1089
+ the parameters are invalid, Z_MEM_ERROR if the internal state could not be
966
1090
  allocated, or Z_VERSION_ERROR if the version of the library does not match
967
1091
  the version of the header file.
968
1092
  */
969
1093
 
970
- typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
1094
+ typedef unsigned (*in_func) OF((void FAR *,
1095
+ z_const unsigned char FAR * FAR *));
971
1096
  typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
972
1097
 
973
1098
  ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
@@ -975,11 +1100,12 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
975
1100
  out_func out, void FAR *out_desc));
976
1101
  /*
977
1102
  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.
1103
+ interface for input and output. This is potentially more efficient than
1104
+ inflate() for file i/o applications, in that it avoids copying between the
1105
+ output and the sliding window by simply making the window itself the output
1106
+ buffer. inflate() can be faster on modern CPUs when used with large
1107
+ buffers. inflateBack() trusts the application to not change the output
1108
+ buffer passed by the output function, at least until inflateBack() returns.
983
1109
 
984
1110
  inflateBackInit() must be called first to allocate the internal state
985
1111
  and to initialize the state with the user-provided window buffer.
@@ -991,9 +1117,9 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
991
1117
  This routine would normally be used in a utility that reads zip or gzip
992
1118
  files and writes out uncompressed files. The utility would decode the
993
1119
  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.
1120
+ the raw deflate stream to decompress. This is different from the default
1121
+ behavior of inflate(), which expects a zlib header and trailer around the
1122
+ deflate stream.
997
1123
 
998
1124
  inflateBack() uses two subroutines supplied by the caller that are then
999
1125
  called by inflateBack() for input and output. inflateBack() calls those
@@ -1002,12 +1128,12 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
1002
1128
  parameters and return types are defined above in the in_func and out_func
1003
1129
  typedefs. inflateBack() will call in(in_desc, &buf) which should return the
1004
1130
  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
1131
+ there is no input available, in() must return zero -- buf is ignored in that
1132
+ case -- and inflateBack() will return a buffer error. inflateBack() will
1133
+ call out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].
1134
+ out() should return zero on success, or non-zero on failure. If out()
1135
+ returns non-zero, inflateBack() will return with an error. Neither in() nor
1136
+ out() are permitted to change the contents of the window provided to
1011
1137
  inflateBackInit(), which is also the buffer that out() uses to write from.
1012
1138
  The length written by out() will be at most the window size. Any non-zero
1013
1139
  amount of input may be provided by in().
@@ -1035,7 +1161,7 @@ ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
1035
1161
  using strm->next_in which will be Z_NULL only if in() returned an error. If
1036
1162
  strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
1037
1163
  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()
1164
+ assured to be defined if out() returns non-zero.) Note that inflateBack()
1039
1165
  cannot return Z_OK.
1040
1166
  */
1041
1167
 
@@ -1057,7 +1183,7 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
1057
1183
  7.6: size of z_off_t
1058
1184
 
1059
1185
  Compiler, assembler, and debug options:
1060
- 8: DEBUG
1186
+ 8: ZLIB_DEBUG
1061
1187
  9: ASMV or ASMINF -- use ASM code
1062
1188
  10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
1063
1189
  11: 0 (reserved)
@@ -1088,6 +1214,7 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
1088
1214
  27-31: 0 (reserved)
1089
1215
  */
1090
1216
 
1217
+ #ifndef Z_SOLO
1091
1218
 
1092
1219
  /* utility functions */
1093
1220
 
@@ -1106,7 +1233,8 @@ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
1106
1233
  the byte length of the source buffer. Upon entry, destLen is the total size
1107
1234
  of the destination buffer, which must be at least the value returned by
1108
1235
  compressBound(sourceLen). Upon exit, destLen is the actual size of the
1109
- compressed buffer.
1236
+ compressed data. compress() is equivalent to compress2() with a level
1237
+ parameter of Z_DEFAULT_COMPRESSION.
1110
1238
 
1111
1239
  compress returns Z_OK if success, Z_MEM_ERROR if there was not
1112
1240
  enough memory, Z_BUF_ERROR if there was not enough room in the output
@@ -1122,7 +1250,7 @@ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
1122
1250
  length of the source buffer. Upon entry, destLen is the total size of the
1123
1251
  destination buffer, which must be at least the value returned by
1124
1252
  compressBound(sourceLen). Upon exit, destLen is the actual size of the
1125
- compressed buffer.
1253
+ compressed data.
1126
1254
 
1127
1255
  compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
1128
1256
  memory, Z_BUF_ERROR if there was not enough room in the output buffer,
@@ -1145,13 +1273,22 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
1145
1273
  uncompressed data. (The size of the uncompressed data must have been saved
1146
1274
  previously by the compressor and transmitted to the decompressor by some
1147
1275
  mechanism outside the scope of this compression library.) Upon exit, destLen
1148
- is the actual size of the uncompressed buffer.
1276
+ is the actual size of the uncompressed data.
1149
1277
 
1150
1278
  uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
1151
1279
  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.
1280
+ buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In
1281
+ the case where there is not enough room, uncompress() will fill the output
1282
+ buffer with the uncompressed data up to that point.
1153
1283
  */
1154
1284
 
1285
+ ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen,
1286
+ const Bytef *source, uLong *sourceLen));
1287
+ /*
1288
+ Same as uncompress, except that sourceLen is a pointer, where the
1289
+ length of the source is *sourceLen. On return, *sourceLen is the number of
1290
+ source bytes consumed.
1291
+ */
1155
1292
 
1156
1293
  /* gzip file access functions */
1157
1294
 
@@ -1162,23 +1299,38 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
1162
1299
  wrapper, documented in RFC 1952, wrapped around a deflate stream.
1163
1300
  */
1164
1301
 
1165
- typedef voidp gzFile; /* opaque gzip file descriptor */
1302
+ typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */
1166
1303
 
1167
1304
  /*
1168
1305
  ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
1169
1306
 
1170
- Opens a gzip (.gz) file for reading or writing. The mode parameter is as
1171
- in fopen ("rb" or "wb") but can also include a compression level ("wb9") or
1172
- a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
1173
- compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'
1174
- 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.
1307
+ Open the gzip (.gz) file at path for reading and decompressing, or
1308
+ compressing and writing. The mode parameter is as in fopen ("rb" or "wb")
1309
+ but can also include a compression level ("wb9") or a strategy: 'f' for
1310
+ filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h",
1311
+ 'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression
1312
+ as in "wb9F". (See the description of deflateInit2 for more information
1313
+ about the strategy parameter.) 'T' will request transparent writing or
1314
+ appending with no compression and not using the gzip format.
1315
+
1316
+ "a" can be used instead of "w" to request that the gzip stream that will
1317
+ be written be appended to the file. "+" will result in an error, since
1318
+ reading and writing to the same gzip file is not supported. The addition of
1319
+ "x" when writing will create the file exclusively, which fails if the file
1320
+ already exists. On systems that support it, the addition of "e" when
1321
+ reading or writing will set the flag to close the file on an execve() call.
1322
+
1323
+ These functions, as well as gzip, will read and decode a sequence of gzip
1324
+ streams in a file. The append function of gzopen() can be used to create
1325
+ such a file. (Also see gzflush() for another way to do this.) When
1326
+ appending, gzopen does not test whether the file begins with a gzip stream,
1327
+ nor does it look for the end of the gzip streams to begin appending. gzopen
1328
+ will simply append a gzip stream to the existing file.
1179
1329
 
1180
1330
  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.
1331
+ case gzread will directly read from the file without decompression. When
1332
+ reading, this will be detected automatically by looking for the magic two-
1333
+ byte gzip header.
1182
1334
 
1183
1335
  gzopen returns NULL if the file could not be opened, if there was
1184
1336
  insufficient memory to allocate the gzFile state, or if an invalid mode was
@@ -1189,15 +1341,19 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
1189
1341
 
1190
1342
  ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
1191
1343
  /*
1192
- gzdopen associates a gzFile with the file descriptor fd. File descriptors
1193
- are obtained from calls like open, dup, creat, pipe or fileno (if the file
1194
- has been previously opened with fopen). The mode parameter is as in gzopen.
1344
+ Associate a gzFile with the file descriptor fd. File descriptors are
1345
+ obtained from calls like open, dup, creat, pipe or fileno (if the file has
1346
+ been previously opened with fopen). The mode parameter is as in gzopen.
1195
1347
 
1196
1348
  The next call of gzclose on the returned gzFile will also close the file
1197
1349
  descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
1198
1350
  fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,
1199
1351
  mode);. The duplicated descriptor should be saved to avoid a leak, since
1200
- gzdopen does not close fd if it fails.
1352
+ gzdopen does not close fd if it fails. If you are using fileno() to get the
1353
+ file descriptor from a FILE *, then you will have to use dup() to avoid
1354
+ double-close()ing the file descriptor. Both gzclose() and fclose() will
1355
+ close the associated file descriptor, so they need to have different file
1356
+ descriptors.
1201
1357
 
1202
1358
  gzdopen returns NULL if there was insufficient memory to allocate the
1203
1359
  gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not
@@ -1208,14 +1364,13 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
1208
1364
 
1209
1365
  ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
1210
1366
  /*
1211
- Set the internal buffer size used by this library's functions. The
1212
- default buffer size is 8192 bytes. This function must be called after
1213
- gzopen() or gzdopen(), and before any other calls that read or write the
1214
- 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).
1367
+ Set the internal buffer size used by this library's functions for file to
1368
+ size. The default buffer size is 8192 bytes. This function must be called
1369
+ after gzopen() or gzdopen(), and before any other calls that read or write
1370
+ the file. The buffer memory allocation is always deferred to the first read
1371
+ or write. Three times that size in buffer space is allocated. A larger
1372
+ buffer size of, for example, 64K or 128K bytes will noticeably increase the
1373
+ speed of decompression (reading).
1219
1374
 
1220
1375
  The new buffer size also affects the maximum length for gzprintf().
1221
1376
 
@@ -1225,55 +1380,109 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
1225
1380
 
1226
1381
  ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
1227
1382
  /*
1228
- Dynamically update the compression level or strategy. See the description
1229
- of deflateInit2 for the meaning of these parameters.
1383
+ Dynamically update the compression level and strategy for file. See the
1384
+ description of deflateInit2 for the meaning of these parameters. Previously
1385
+ provided data is flushed before applying the parameter changes.
1230
1386
 
1231
- gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
1232
- opened for writing.
1387
+ gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not
1388
+ opened for writing, Z_ERRNO if there is an error writing the flushed data,
1389
+ or Z_MEM_ERROR if there is a memory allocation error.
1233
1390
  */
1234
1391
 
1235
1392
  ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
1236
1393
  /*
1237
- 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.
1394
+ Read and decompress up to len uncompressed bytes from file into buf. If
1395
+ the input file is not in gzip format, gzread copies the given number of
1396
+ bytes into the buffer directly from the file.
1240
1397
 
1241
1398
  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.
1399
+ to read, looking for another gzip stream. Any number of gzip streams may be
1400
+ concatenated in the input file, and will all be decompressed by gzread().
1401
+ If something other than a gzip stream is encountered after a gzip stream,
1402
+ that remaining trailing garbage is ignored (and no error is returned).
1403
+
1404
+ gzread can be used to read a gzip file that is being concurrently written.
1405
+ Upon reaching the end of the input, gzread will return with the available
1406
+ data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then
1407
+ gzclearerr can be used to clear the end of file indicator in order to permit
1408
+ gzread to be tried again. Z_OK indicates that a gzip stream was completed
1409
+ on the last gzread. Z_BUF_ERROR indicates that the input file ended in the
1410
+ middle of a gzip stream. Note that gzread does not return -1 in the event
1411
+ of an incomplete gzip stream. This error is deferred until gzclose(), which
1412
+ will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip
1413
+ stream. Alternatively, gzerror can be used before gzclose to detect this
1414
+ case.
1246
1415
 
1247
1416
  gzread returns the number of uncompressed bytes actually read, less than
1248
- len for end of file, or -1 for error.
1417
+ len for end of file, or -1 for error. If len is too large to fit in an int,
1418
+ then nothing is read, -1 is returned, and the error state is set to
1419
+ Z_STREAM_ERROR.
1420
+ */
1421
+
1422
+ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
1423
+ gzFile file));
1424
+ /*
1425
+ Read and decompress up to nitems items of size size from file into buf,
1426
+ otherwise operating as gzread() does. This duplicates the interface of
1427
+ stdio's fread(), with size_t request and return types. If the library
1428
+ defines size_t, then z_size_t is identical to size_t. If not, then z_size_t
1429
+ is an unsigned integer type that can contain a pointer.
1430
+
1431
+ gzfread() returns the number of full items read of size size, or zero if
1432
+ the end of the file was reached and a full item could not be read, or if
1433
+ there was an error. gzerror() must be consulted if zero is returned in
1434
+ order to determine if there was an error. If the multiplication of size and
1435
+ nitems overflows, i.e. the product does not fit in a z_size_t, then nothing
1436
+ is read, zero is returned, and the error state is set to Z_STREAM_ERROR.
1437
+
1438
+ In the event that the end of file is reached and only a partial item is
1439
+ available at the end, i.e. the remaining uncompressed data length is not a
1440
+ multiple of size, then the final partial item is nevertheless read into buf
1441
+ and the end-of-file flag is set. The length of the partial item read is not
1442
+ provided, but could be inferred from the result of gztell(). This behavior
1443
+ is the same as the behavior of fread() implementations in common libraries,
1444
+ but it prevents the direct use of gzfread() to read a concurrently written
1445
+ file, resetting and retrying on end-of-file, when size is not 1.
1249
1446
  */
1250
1447
 
1251
- ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
1252
- voidpc buf, unsigned len));
1448
+ ZEXTERN int ZEXPORT gzwrite OF((gzFile file, voidpc buf, unsigned len));
1253
1449
  /*
1254
- Writes the given number of uncompressed bytes into the compressed file.
1255
- gzwrite returns the number of uncompressed bytes written or 0 in case of
1256
- error.
1450
+ Compress and write the len uncompressed bytes at buf to file. gzwrite
1451
+ returns the number of uncompressed bytes written or 0 in case of 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));
1260
1456
  /*
1261
- Converts, formats, and writes the arguments to the compressed file under
1262
- 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().
1457
+ Compress and write 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, ...));
1469
+ /*
1470
+ Convert, format, compress, and write the arguments (...) to file under
1471
+ control of the string format, as in fprintf. gzprintf returns the number of
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));
1275
1484
  /*
1276
- Writes the given null-terminated string to the compressed file, excluding
1485
+ Compress and write the given null-terminated string s to file, excluding
1277
1486
  the terminating null character.
1278
1487
 
1279
1488
  gzputs returns the number of characters written, or -1 in case of error.
@@ -1281,11 +1490,12 @@ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
1281
1490
 
1282
1491
  ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
1283
1492
  /*
1284
- Reads bytes from the compressed file until len-1 characters are read, or a
1285
- newline character is read and transferred to buf, or an end-of-file
1286
- condition is encountered. If any characters are read or if len == 1, the
1287
- string is terminated with a null character. If no characters are read due
1288
- to an end-of-file or len < 1, then the buffer is left untouched.
1493
+ Read and decompress bytes from file into buf, until len-1 characters are
1494
+ read, or until a newline character is read and transferred to buf, or an
1495
+ end-of-file condition is encountered. If any characters are read or if len
1496
+ is one, the string is terminated with a null character. If no characters
1497
+ are read due to an end-of-file or len is less than one, then the buffer is
1498
+ left untouched.
1289
1499
 
1290
1500
  gzgets returns buf which is a null-terminated string, or it returns NULL
1291
1501
  for end-of-file or in case of error. If there was an error, the contents at
@@ -1294,20 +1504,23 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
1294
1504
 
1295
1505
  ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
1296
1506
  /*
1297
- Writes c, converted to an unsigned char, into the compressed file. gzputc
1507
+ Compress and write c, converted to an unsigned char, into file. gzputc
1298
1508
  returns the value that was written, or -1 in case of error.
1299
1509
  */
1300
1510
 
1301
1511
  ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
1302
1512
  /*
1303
- Reads one byte from the compressed file. gzgetc returns this byte or -1
1304
- in case of end of file or error.
1513
+ Read and decompress one byte from file. gzgetc returns this byte or -1
1514
+ in case of end of file or error. This is implemented as a macro for speed.
1515
+ As such, it does not do all of the checking the other functions do. I.e.
1516
+ it does not check to see if file is NULL, nor whether the structure file
1517
+ points to has been clobbered or not.
1305
1518
  */
1306
1519
 
1307
1520
  ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
1308
1521
  /*
1309
- Push one character back onto the stream to be read as the first character
1310
- on the next read. At least one character of push-back is allowed.
1522
+ Push c back onto the stream for file to be read as the first character on
1523
+ the next read. At least one character of push-back is always allowed.
1311
1524
  gzungetc() returns the character pushed, or -1 on failure. gzungetc() will
1312
1525
  fail if c is -1, and may fail if a character has been pushed but not read
1313
1526
  yet. If gzungetc is used immediately after gzopen or gzdopen, at least the
@@ -1318,14 +1531,14 @@ ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
1318
1531
 
1319
1532
  ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
1320
1533
  /*
1321
- Flushes all pending output into the compressed file. The parameter flush
1322
- is as in the deflate() function. The return value is the zlib error number
1323
- (see function gzerror below). gzflush is only permitted when writing.
1534
+ Flush all pending output to file. The parameter flush is as in the
1535
+ deflate() function. The return value is the zlib error number (see function
1536
+ gzerror below). gzflush is only permitted when writing.
1324
1537
 
1325
1538
  If the flush parameter is Z_FINISH, the remaining data is written and the
1326
1539
  gzip stream is completed in the output. If gzwrite() is called again, a new
1327
1540
  gzip stream will be started in the output. gzread() is able to read such
1328
- concatented gzip streams.
1541
+ concatenated gzip streams.
1329
1542
 
1330
1543
  gzflush should be called only when strictly necessary because it will
1331
1544
  degrade compression if called too often.
@@ -1335,8 +1548,8 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
1335
1548
  ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
1336
1549
  z_off_t offset, int whence));
1337
1550
 
1338
- Sets the starting position for the next gzread or gzwrite on the given
1339
- compressed file. The offset represents a number of bytes in the
1551
+ Set the starting position to offset relative to whence for the next gzread
1552
+ or gzwrite on file. The offset represents a number of bytes in the
1340
1553
  uncompressed data stream. The whence parameter is defined as in lseek(2);
1341
1554
  the value SEEK_END is not supported.
1342
1555
 
@@ -1353,18 +1566,18 @@ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
1353
1566
 
1354
1567
  ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
1355
1568
  /*
1356
- Rewinds the given file. This function is supported only for reading.
1569
+ Rewind file. This function is supported only for reading.
1357
1570
 
1358
- gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
1571
+ gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET).
1359
1572
  */
1360
1573
 
1361
1574
  /*
1362
1575
  ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
1363
1576
 
1364
- Returns the starting position for the next gzread or gzwrite on the given
1365
- compressed file. This position represents a number of bytes in the
1366
- uncompressed data stream, and is zero when starting, even if appending or
1367
- reading a gzip stream from the middle of a file using gzdopen().
1577
+ Return the starting position for the next gzread or gzwrite on file.
1578
+ This position represents a number of bytes in the uncompressed data stream,
1579
+ and is zero when starting, even if appending or reading a gzip stream from
1580
+ the middle of a file using gzdopen().
1368
1581
 
1369
1582
  gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
1370
1583
  */
@@ -1372,22 +1585,22 @@ ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
1372
1585
  /*
1373
1586
  ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
1374
1587
 
1375
- Returns the current offset in the file being read or written. This offset
1376
- includes the count of bytes that precede the gzip stream, for example when
1377
- appending or when using gzdopen() for reading. When reading, the offset
1378
- does not include as yet unused buffered input. This information can be used
1379
- for a progress indicator. On error, gzoffset() returns -1.
1588
+ Return the current compressed (actual) read or write offset of file. This
1589
+ offset includes the count of bytes that precede the gzip stream, for example
1590
+ when appending or when using gzdopen() for reading. When reading, the
1591
+ offset does not include as yet unused buffered input. This information can
1592
+ be used for a progress indicator. On error, gzoffset() returns -1.
1380
1593
  */
1381
1594
 
1382
1595
  ZEXTERN int ZEXPORT gzeof OF((gzFile file));
1383
1596
  /*
1384
- Returns true (1) if the end-of-file indicator has been set while reading,
1385
- false (0) otherwise. Note that the end-of-file indicator is set only if the
1386
- read tried to go past the end of the input, but came up short. Therefore,
1387
- just like feof(), gzeof() may return false even if there is no more data to
1388
- read, in the event that the last read request was for the exact number of
1389
- bytes remaining in the input file. This will happen if the input file size
1390
- is an exact multiple of the buffer size.
1597
+ Return true (1) if the end-of-file indicator for file has been set while
1598
+ reading, false (0) otherwise. Note that the end-of-file indicator is set
1599
+ only if the read tried to go past the end of the input, but came up short.
1600
+ Therefore, just like feof(), gzeof() may return false even if there is no
1601
+ more data to read, in the event that the last read request was for the exact
1602
+ number of bytes remaining in the input file. This will happen if the input
1603
+ file size is an exact multiple of the buffer size.
1391
1604
 
1392
1605
  If gzeof() returns true, then the read functions will return no more data,
1393
1606
  unless the end-of-file indicator is reset by gzclearerr() and the input file
@@ -1396,10 +1609,8 @@ ZEXTERN int ZEXPORT gzeof OF((gzFile file));
1396
1609
 
1397
1610
  ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
1398
1611
  /*
1399
- 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
+ Return true (1) if file is being copied directly while reading, or false
1613
+ (0) if file is a gzip stream being decompressed.
1403
1614
 
1404
1615
  If the input file is empty, gzdirect() will return true, since the input
1405
1616
  does not contain a gzip stream.
@@ -1408,18 +1619,26 @@ ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
1408
1619
  cause buffers to be allocated to allow reading the file to determine if it
1409
1620
  is a gzip file. Therefore if gzbuffer() is used, it should be called before
1410
1621
  gzdirect().
1622
+
1623
+ When writing, gzdirect() returns true (1) if transparent writing was
1624
+ requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note:
1625
+ gzdirect() is not needed when writing. Transparent writing must be
1626
+ explicitly requested, so the application already knows the answer. When
1627
+ linking statically, using gzdirect() will include all of the zlib code for
1628
+ gzip file reading and decompression, which may not be desired.)
1411
1629
  */
1412
1630
 
1413
1631
  ZEXTERN int ZEXPORT gzclose OF((gzFile file));
1414
1632
  /*
1415
- Flushes all pending output if necessary, closes the compressed file and
1416
- deallocates the (de)compression state. Note that once file is closed, you
1633
+ Flush all pending output for file, if necessary, close file and
1634
+ deallocate the (de)compression state. Note that once file is closed, you
1417
1635
  cannot call gzerror with file, since its structures have been deallocated.
1418
1636
  gzclose must not be called more than once on the same file, just as free
1419
1637
  must not be called more than once on the same allocation.
1420
1638
 
1421
1639
  gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
1422
- file operation error, or Z_OK on success.
1640
+ file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the
1641
+ last read ended in the middle of a gzip stream, or Z_OK on success.
1423
1642
  */
1424
1643
 
1425
1644
  ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
@@ -1436,10 +1655,10 @@ ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
1436
1655
 
1437
1656
  ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
1438
1657
  /*
1439
- Returns the error message for the last error which occurred on the given
1440
- compressed file. errnum is set to zlib error number. If an error occurred
1441
- in the file system and not in the compression library, errnum is set to
1442
- Z_ERRNO and the application may consult errno to get the exact error code.
1658
+ Return the error message for the last error which occurred on file.
1659
+ errnum is set to zlib error number. If an error occurred in the file system
1660
+ and not in the compression library, errnum is set to Z_ERRNO and the
1661
+ application may consult errno to get the exact error code.
1443
1662
 
1444
1663
  The application must not modify the returned string. Future calls to
1445
1664
  this function may invalidate the previously returned string. If file is
@@ -1452,11 +1671,12 @@ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
1452
1671
 
1453
1672
  ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
1454
1673
  /*
1455
- Clears the error and end-of-file flags for file. This is analogous to the
1674
+ Clear the error and end-of-file flags for file. This is analogous to the
1456
1675
  clearerr() function in stdio. This is useful for continuing to read a gzip
1457
1676
  file that is being written concurrently.
1458
1677
  */
1459
1678
 
1679
+ #endif /* !Z_SOLO */
1460
1680
 
1461
1681
  /* checksum functions */
1462
1682
 
@@ -1469,10 +1689,11 @@ ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
1469
1689
  ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
1470
1690
  /*
1471
1691
  Update a running Adler-32 checksum with the bytes buf[0..len-1] and
1472
- return the updated checksum. If buf is Z_NULL, this function returns the
1473
- required initial value for the checksum.
1692
+ return the updated checksum. An Adler-32 value is in the range of a 32-bit
1693
+ unsigned integer. If buf is Z_NULL, this function returns the required
1694
+ initial value for the checksum.
1474
1695
 
1475
- An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
1696
+ An Adler-32 checksum is almost as reliable as a CRC-32 but can be computed
1476
1697
  much faster.
1477
1698
 
1478
1699
  Usage example:
@@ -1485,6 +1706,12 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
1485
1706
  if (adler != original_adler) error();
1486
1707
  */
1487
1708
 
1709
+ ZEXTERN uLong ZEXPORT adler32_z OF((uLong adler, const Bytef *buf,
1710
+ z_size_t len));
1711
+ /*
1712
+ Same as adler32(), but with a size_t length.
1713
+ */
1714
+
1488
1715
  /*
1489
1716
  ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
1490
1717
  z_off_t len2));
@@ -1492,16 +1719,18 @@ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
1492
1719
  Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
1493
1720
  and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
1494
1721
  each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
1495
- seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
1722
+ seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note
1723
+ that the z_off_t type (like off_t) is a signed integer. If len2 is
1724
+ negative, the result has no meaning or utility.
1496
1725
  */
1497
1726
 
1498
- ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
1727
+ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
1499
1728
  /*
1500
1729
  Update a running CRC-32 with the bytes buf[0..len-1] and return the
1501
- 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.
1730
+ updated CRC-32. A CRC-32 value is in the range of a 32-bit unsigned integer.
1731
+ If buf is Z_NULL, this function returns the required initial value for the
1732
+ crc. Pre- and post-conditioning (one's complement) is performed within this
1733
+ function so it shouldn't be done by the application.
1505
1734
 
1506
1735
  Usage example:
1507
1736
 
@@ -1513,6 +1742,12 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
1513
1742
  if (crc != original_crc) error();
1514
1743
  */
1515
1744
 
1745
+ ZEXTERN uLong ZEXPORT crc32_z OF((uLong crc, const Bytef *buf,
1746
+ z_size_t len));
1747
+ /*
1748
+ Same as crc32(), but with a size_t length.
1749
+ */
1750
+
1516
1751
  /*
1517
1752
  ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
1518
1753
 
@@ -1523,6 +1758,20 @@ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
1523
1758
  len2.
1524
1759
  */
1525
1760
 
1761
+ /*
1762
+ ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t len2));
1763
+
1764
+ Return the operator corresponding to length len2, to be used with
1765
+ crc32_combine_op().
1766
+ */
1767
+
1768
+ ZEXTERN uLong ZEXPORT crc32_combine_op OF((uLong crc1, uLong crc2, uLong op));
1769
+ /*
1770
+ Give the same result as crc32_combine(), using op in place of len2. op is
1771
+ is generated from len2 by crc32_combine_gen(). This will be faster than
1772
+ crc32_combine() if the generated op is used more than once.
1773
+ */
1774
+
1526
1775
 
1527
1776
  /* various hacks, don't look :) */
1528
1777
 
@@ -1543,18 +1792,59 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
1543
1792
  unsigned char FAR *window,
1544
1793
  const char *version,
1545
1794
  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))
1795
+ #ifdef Z_PREFIX_SET
1796
+ # define z_deflateInit(strm, level) \
1797
+ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
1798
+ # define z_inflateInit(strm) \
1799
+ inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
1800
+ # define z_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
1801
+ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
1802
+ (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
1803
+ # define z_inflateInit2(strm, windowBits) \
1804
+ inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
1805
+ (int)sizeof(z_stream))
1806
+ # define z_inflateBackInit(strm, windowBits, window) \
1807
+ inflateBackInit_((strm), (windowBits), (window), \
1808
+ ZLIB_VERSION, (int)sizeof(z_stream))
1809
+ #else
1810
+ # define deflateInit(strm, level) \
1811
+ deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
1812
+ # define inflateInit(strm) \
1813
+ inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
1814
+ # define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
1815
+ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
1816
+ (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
1817
+ # define inflateInit2(strm, windowBits) \
1818
+ inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
1819
+ (int)sizeof(z_stream))
1820
+ # define inflateBackInit(strm, windowBits, window) \
1821
+ inflateBackInit_((strm), (windowBits), (window), \
1822
+ ZLIB_VERSION, (int)sizeof(z_stream))
1823
+ #endif
1824
+
1825
+ #ifndef Z_SOLO
1826
+
1827
+ /* gzgetc() macro and its supporting function and exposed data structure. Note
1828
+ * that the real internal state is much larger than the exposed structure.
1829
+ * This abbreviated structure exposes just enough for the gzgetc() macro. The
1830
+ * user should not mess with these exposed elements, since their names or
1831
+ * behavior could change in the future, perhaps even capriciously. They can
1832
+ * only be used by the gzgetc() macro. You have been warned.
1833
+ */
1834
+ struct gzFile_s {
1835
+ unsigned have;
1836
+ unsigned char *next;
1837
+ z_off64_t pos;
1838
+ };
1839
+ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
1840
+ #ifdef Z_PREFIX_SET
1841
+ # undef z_gzgetc
1842
+ # define z_gzgetc(g) \
1843
+ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
1844
+ #else
1845
+ # define gzgetc(g) \
1846
+ ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
1847
+ #endif
1558
1848
 
1559
1849
  /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
1560
1850
  * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
@@ -1562,29 +1852,42 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
1562
1852
  * functions are changed to 64 bits) -- in case these are set on systems
1563
1853
  * without large file support, _LFS64_LARGEFILE must also be true
1564
1854
  */
1565
- #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
1855
+ #ifdef Z_LARGE64
1566
1856
  ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
1567
1857
  ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
1568
1858
  ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
1569
1859
  ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
1570
1860
  ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
1571
1861
  ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
1862
+ ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off64_t));
1572
1863
  #endif
1573
1864
 
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
1865
+ #if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
1866
+ # ifdef Z_PREFIX_SET
1867
+ # define z_gzopen z_gzopen64
1868
+ # define z_gzseek z_gzseek64
1869
+ # define z_gztell z_gztell64
1870
+ # define z_gzoffset z_gzoffset64
1871
+ # define z_adler32_combine z_adler32_combine64
1872
+ # define z_crc32_combine z_crc32_combine64
1873
+ # define z_crc32_combine_gen z_crc32_combine_gen64
1874
+ # else
1875
+ # define gzopen gzopen64
1876
+ # define gzseek gzseek64
1877
+ # define gztell gztell64
1878
+ # define gzoffset gzoffset64
1879
+ # define adler32_combine adler32_combine64
1880
+ # define crc32_combine crc32_combine64
1881
+ # define crc32_combine_gen crc32_combine_gen64
1882
+ # endif
1883
+ # ifndef Z_LARGE64
1582
1884
  ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
1583
1885
  ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
1584
1886
  ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
1585
1887
  ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
1586
1888
  ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
1587
1889
  ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
1890
+ ZEXTERN uLong ZEXPORT crc32_combine_gen64 OF((z_off_t));
1588
1891
  # endif
1589
1892
  #else
1590
1893
  ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
@@ -1593,18 +1896,37 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
1593
1896
  ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
1594
1897
  ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
1595
1898
  ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
1899
+ ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t));
1596
1900
  #endif
1597
1901
 
1598
- /* hack for buggy compilers */
1599
- #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
1600
- struct internal_state {int dummy;};
1601
- #endif
1902
+ #else /* Z_SOLO */
1903
+
1904
+ ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
1905
+ ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
1906
+ ZEXTERN uLong ZEXPORT crc32_combine_gen OF((z_off_t));
1907
+
1908
+ #endif /* !Z_SOLO */
1602
1909
 
1603
1910
  /* undocumented functions */
1604
1911
  ZEXTERN const char * ZEXPORT zError OF((int));
1605
1912
  ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
1606
- ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
1913
+ ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void));
1607
1914
  ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
1915
+ ZEXTERN int ZEXPORT inflateValidate OF((z_streamp, int));
1916
+ ZEXTERN unsigned long ZEXPORT inflateCodesUsed OF((z_streamp));
1917
+ ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
1918
+ ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
1919
+ #if defined(_WIN32) && !defined(Z_SOLO)
1920
+ ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path,
1921
+ const char *mode));
1922
+ #endif
1923
+ #if defined(STDC) || defined(Z_HAVE_STDARG_H)
1924
+ # ifndef Z_SOLO
1925
+ ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file,
1926
+ const char *format,
1927
+ va_list va));
1928
+ # endif
1929
+ #endif
1608
1930
 
1609
1931
  #ifdef __cplusplus
1610
1932
  }