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,5 +1,5 @@
1
1
  /* inflate.c -- zlib decompression
2
- * Copyright (C) 1995-2010 Mark Adler
2
+ * Copyright (C) 1995-2022 Mark Adler
3
3
  * For conditions of distribution and use, see copyright notice in zlib.h
4
4
  */
5
5
 
@@ -92,32 +92,47 @@
92
92
  #endif
93
93
 
94
94
  /* function prototypes */
95
+ local int inflateStateCheck OF((z_streamp strm));
95
96
  local void fixedtables OF((struct inflate_state FAR *state));
96
- local int updatewindow OF((z_streamp strm, unsigned out));
97
+ local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
98
+ unsigned copy));
97
99
  #ifdef BUILDFIXED
98
100
  void makefixed OF((void));
99
101
  #endif
100
- local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf,
102
+ local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf,
101
103
  unsigned len));
102
104
 
103
- int ZEXPORT inflateReset(strm)
105
+ local int inflateStateCheck(strm)
106
+ z_streamp strm;
107
+ {
108
+ struct inflate_state FAR *state;
109
+ if (strm == Z_NULL ||
110
+ strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
111
+ return 1;
112
+ state = (struct inflate_state FAR *)strm->state;
113
+ if (state == Z_NULL || state->strm != strm ||
114
+ state->mode < HEAD || state->mode > SYNC)
115
+ return 1;
116
+ return 0;
117
+ }
118
+
119
+ int ZEXPORT inflateResetKeep(strm)
104
120
  z_streamp strm;
105
121
  {
106
122
  struct inflate_state FAR *state;
107
123
 
108
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
124
+ if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
109
125
  state = (struct inflate_state FAR *)strm->state;
110
126
  strm->total_in = strm->total_out = state->total = 0;
111
127
  strm->msg = Z_NULL;
112
- strm->adler = 1; /* to support ill-conceived Java test suite */
128
+ if (state->wrap) /* to support ill-conceived Java test suite */
129
+ strm->adler = state->wrap & 1;
113
130
  state->mode = HEAD;
114
131
  state->last = 0;
115
132
  state->havedict = 0;
133
+ state->flags = -1;
116
134
  state->dmax = 32768U;
117
135
  state->head = Z_NULL;
118
- state->wsize = 0;
119
- state->whave = 0;
120
- state->wnext = 0;
121
136
  state->hold = 0;
122
137
  state->bits = 0;
123
138
  state->lencode = state->distcode = state->next = state->codes;
@@ -127,6 +142,19 @@ z_streamp strm;
127
142
  return Z_OK;
128
143
  }
129
144
 
145
+ int ZEXPORT inflateReset(strm)
146
+ z_streamp strm;
147
+ {
148
+ struct inflate_state FAR *state;
149
+
150
+ if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
151
+ state = (struct inflate_state FAR *)strm->state;
152
+ state->wsize = 0;
153
+ state->whave = 0;
154
+ state->wnext = 0;
155
+ return inflateResetKeep(strm);
156
+ }
157
+
130
158
  int ZEXPORT inflateReset2(strm, windowBits)
131
159
  z_streamp strm;
132
160
  int windowBits;
@@ -135,16 +163,18 @@ int windowBits;
135
163
  struct inflate_state FAR *state;
136
164
 
137
165
  /* get the state */
138
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
166
+ if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
139
167
  state = (struct inflate_state FAR *)strm->state;
140
168
 
141
169
  /* extract wrap request from windowBits parameter */
142
170
  if (windowBits < 0) {
171
+ if (windowBits < -15)
172
+ return Z_STREAM_ERROR;
143
173
  wrap = 0;
144
174
  windowBits = -windowBits;
145
175
  }
146
176
  else {
147
- wrap = (windowBits >> 4) + 1;
177
+ wrap = (windowBits >> 4) + 5;
148
178
  #ifdef GUNZIP
149
179
  if (windowBits < 48)
150
180
  windowBits &= 15;
@@ -180,16 +210,27 @@ int stream_size;
180
210
  if (strm == Z_NULL) return Z_STREAM_ERROR;
181
211
  strm->msg = Z_NULL; /* in case we return an error */
182
212
  if (strm->zalloc == (alloc_func)0) {
213
+ #ifdef Z_SOLO
214
+ return Z_STREAM_ERROR;
215
+ #else
183
216
  strm->zalloc = zcalloc;
184
217
  strm->opaque = (voidpf)0;
218
+ #endif
185
219
  }
186
- if (strm->zfree == (free_func)0) strm->zfree = zcfree;
220
+ if (strm->zfree == (free_func)0)
221
+ #ifdef Z_SOLO
222
+ return Z_STREAM_ERROR;
223
+ #else
224
+ strm->zfree = zcfree;
225
+ #endif
187
226
  state = (struct inflate_state FAR *)
188
227
  ZALLOC(strm, 1, sizeof(struct inflate_state));
189
228
  if (state == Z_NULL) return Z_MEM_ERROR;
190
229
  Tracev((stderr, "inflate: allocated\n"));
191
230
  strm->state = (struct internal_state FAR *)state;
231
+ state->strm = strm;
192
232
  state->window = Z_NULL;
233
+ state->mode = HEAD; /* to pass state test in inflateReset2() */
193
234
  ret = inflateReset2(strm, windowBits);
194
235
  if (ret != Z_OK) {
195
236
  ZFREE(strm, state);
@@ -213,17 +254,17 @@ int value;
213
254
  {
214
255
  struct inflate_state FAR *state;
215
256
 
216
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
257
+ if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
217
258
  state = (struct inflate_state FAR *)strm->state;
218
259
  if (bits < 0) {
219
260
  state->hold = 0;
220
261
  state->bits = 0;
221
262
  return Z_OK;
222
263
  }
223
- if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
264
+ if (bits > 16 || state->bits + (uInt)bits > 32) return Z_STREAM_ERROR;
224
265
  value &= (1L << bits) - 1;
225
- state->hold += value << state->bits;
226
- state->bits += bits;
266
+ state->hold += (unsigned)value << state->bits;
267
+ state->bits += (uInt)bits;
227
268
  return Z_OK;
228
269
  }
229
270
 
@@ -321,8 +362,8 @@ void makefixed()
321
362
  low = 0;
322
363
  for (;;) {
323
364
  if ((low % 7) == 0) printf("\n ");
324
- printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits,
325
- state.lencode[low].val);
365
+ printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op,
366
+ state.lencode[low].bits, state.lencode[low].val);
326
367
  if (++low == size) break;
327
368
  putchar(',');
328
369
  }
@@ -355,12 +396,13 @@ void makefixed()
355
396
  output will fall in the output data, making match copies simpler and faster.
356
397
  The advantage may be dependent on the size of the processor's data caches.
357
398
  */
358
- local int updatewindow(strm, out)
399
+ local int updatewindow(strm, end, copy)
359
400
  z_streamp strm;
360
- unsigned out;
401
+ const Bytef *end;
402
+ unsigned copy;
361
403
  {
362
404
  struct inflate_state FAR *state;
363
- unsigned copy, dist;
405
+ unsigned dist;
364
406
 
365
407
  state = (struct inflate_state FAR *)strm->state;
366
408
 
@@ -380,19 +422,18 @@ unsigned out;
380
422
  }
381
423
 
382
424
  /* copy state->wsize or less output bytes into the circular window */
383
- copy = out - strm->avail_out;
384
425
  if (copy >= state->wsize) {
385
- zmemcpy(state->window, strm->next_out - state->wsize, state->wsize);
426
+ zmemcpy(state->window, end - state->wsize, state->wsize);
386
427
  state->wnext = 0;
387
428
  state->whave = state->wsize;
388
429
  }
389
430
  else {
390
431
  dist = state->wsize - state->wnext;
391
432
  if (dist > copy) dist = copy;
392
- zmemcpy(state->window + state->wnext, strm->next_out - copy, dist);
433
+ zmemcpy(state->window + state->wnext, end - copy, dist);
393
434
  copy -= dist;
394
435
  if (copy) {
395
- zmemcpy(state->window, strm->next_out - copy, copy);
436
+ zmemcpy(state->window, end - copy, copy);
396
437
  state->wnext = copy;
397
438
  state->whave = state->wsize;
398
439
  }
@@ -409,10 +450,10 @@ unsigned out;
409
450
 
410
451
  /* check function to use adler32() for zlib or crc32() for gzip */
411
452
  #ifdef GUNZIP
412
- # define UPDATE(check, buf, len) \
453
+ # define UPDATE_CHECK(check, buf, len) \
413
454
  (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
414
455
  #else
415
- # define UPDATE(check, buf, len) adler32(check, buf, len)
456
+ # define UPDATE_CHECK(check, buf, len) adler32(check, buf, len)
416
457
  #endif
417
458
 
418
459
  /* check macros for header crc */
@@ -499,11 +540,6 @@ unsigned out;
499
540
  bits -= bits & 7; \
500
541
  } while (0)
501
542
 
502
- /* Reverse the bytes in a 32-bit value */
503
- #define REVERSE(q) \
504
- ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
505
- (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
506
-
507
543
  /*
508
544
  inflate() uses a state machine to process as much input data and generate as
509
545
  much output data as possible before returning. The state machine is
@@ -591,7 +627,7 @@ z_streamp strm;
591
627
  int flush;
592
628
  {
593
629
  struct inflate_state FAR *state;
594
- unsigned char FAR *next; /* next input */
630
+ z_const unsigned char FAR *next; /* next input */
595
631
  unsigned char FAR *put; /* next output */
596
632
  unsigned have, left; /* available input and output */
597
633
  unsigned long hold; /* bit buffer */
@@ -609,7 +645,7 @@ int flush;
609
645
  static const unsigned short order[19] = /* permutation of code lengths */
610
646
  {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
611
647
 
612
- if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL ||
648
+ if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
613
649
  (strm->next_in == Z_NULL && strm->avail_in != 0))
614
650
  return Z_STREAM_ERROR;
615
651
 
@@ -629,13 +665,14 @@ int flush;
629
665
  NEEDBITS(16);
630
666
  #ifdef GUNZIP
631
667
  if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */
668
+ if (state->wbits == 0)
669
+ state->wbits = 15;
632
670
  state->check = crc32(0L, Z_NULL, 0);
633
671
  CRC2(state->check, hold);
634
672
  INITBITS();
635
673
  state->mode = FLAGS;
636
674
  break;
637
675
  }
638
- state->flags = 0; /* expect zlib header */
639
676
  if (state->head != Z_NULL)
640
677
  state->head->done = -1;
641
678
  if (!(state->wrap & 1) || /* check if zlib header allowed */
@@ -656,12 +693,13 @@ int flush;
656
693
  len = BITS(4) + 8;
657
694
  if (state->wbits == 0)
658
695
  state->wbits = len;
659
- else if (len > state->wbits) {
696
+ if (len > 15 || len > state->wbits) {
660
697
  strm->msg = (char *)"invalid window size";
661
698
  state->mode = BAD;
662
699
  break;
663
700
  }
664
701
  state->dmax = 1U << len;
702
+ state->flags = 0; /* indicate zlib header */
665
703
  Tracev((stderr, "inflate: zlib header ok\n"));
666
704
  strm->adler = state->check = adler32(0L, Z_NULL, 0);
667
705
  state->mode = hold & 0x200 ? DICTID : TYPE;
@@ -683,50 +721,59 @@ int flush;
683
721
  }
684
722
  if (state->head != Z_NULL)
685
723
  state->head->text = (int)((hold >> 8) & 1);
686
- if (state->flags & 0x0200) CRC2(state->check, hold);
724
+ if ((state->flags & 0x0200) && (state->wrap & 4))
725
+ CRC2(state->check, hold);
687
726
  INITBITS();
688
727
  state->mode = TIME;
728
+ /* fallthrough */
689
729
  case TIME:
690
730
  NEEDBITS(32);
691
731
  if (state->head != Z_NULL)
692
732
  state->head->time = hold;
693
- if (state->flags & 0x0200) CRC4(state->check, hold);
733
+ if ((state->flags & 0x0200) && (state->wrap & 4))
734
+ CRC4(state->check, hold);
694
735
  INITBITS();
695
736
  state->mode = OS;
737
+ /* fallthrough */
696
738
  case OS:
697
739
  NEEDBITS(16);
698
740
  if (state->head != Z_NULL) {
699
741
  state->head->xflags = (int)(hold & 0xff);
700
742
  state->head->os = (int)(hold >> 8);
701
743
  }
702
- if (state->flags & 0x0200) CRC2(state->check, hold);
744
+ if ((state->flags & 0x0200) && (state->wrap & 4))
745
+ CRC2(state->check, hold);
703
746
  INITBITS();
704
747
  state->mode = EXLEN;
748
+ /* fallthrough */
705
749
  case EXLEN:
706
750
  if (state->flags & 0x0400) {
707
751
  NEEDBITS(16);
708
752
  state->length = (unsigned)(hold);
709
753
  if (state->head != Z_NULL)
710
754
  state->head->extra_len = (unsigned)hold;
711
- if (state->flags & 0x0200) CRC2(state->check, hold);
755
+ if ((state->flags & 0x0200) && (state->wrap & 4))
756
+ CRC2(state->check, hold);
712
757
  INITBITS();
713
758
  }
714
759
  else if (state->head != Z_NULL)
715
760
  state->head->extra = Z_NULL;
716
761
  state->mode = EXTRA;
762
+ /* fallthrough */
717
763
  case EXTRA:
718
764
  if (state->flags & 0x0400) {
719
765
  copy = state->length;
720
766
  if (copy > have) copy = have;
721
767
  if (copy) {
722
768
  if (state->head != Z_NULL &&
723
- state->head->extra != Z_NULL) {
724
- len = state->head->extra_len - state->length;
769
+ state->head->extra != Z_NULL &&
770
+ (len = state->head->extra_len - state->length) <
771
+ state->head->extra_max) {
725
772
  zmemcpy(state->head->extra + len, next,
726
773
  len + copy > state->head->extra_max ?
727
774
  state->head->extra_max - len : copy);
728
775
  }
729
- if (state->flags & 0x0200)
776
+ if ((state->flags & 0x0200) && (state->wrap & 4))
730
777
  state->check = crc32(state->check, next, copy);
731
778
  have -= copy;
732
779
  next += copy;
@@ -736,6 +783,7 @@ int flush;
736
783
  }
737
784
  state->length = 0;
738
785
  state->mode = NAME;
786
+ /* fallthrough */
739
787
  case NAME:
740
788
  if (state->flags & 0x0800) {
741
789
  if (have == 0) goto inf_leave;
@@ -745,9 +793,9 @@ int flush;
745
793
  if (state->head != Z_NULL &&
746
794
  state->head->name != Z_NULL &&
747
795
  state->length < state->head->name_max)
748
- state->head->name[state->length++] = len;
796
+ state->head->name[state->length++] = (Bytef)len;
749
797
  } while (len && copy < have);
750
- if (state->flags & 0x0200)
798
+ if ((state->flags & 0x0200) && (state->wrap & 4))
751
799
  state->check = crc32(state->check, next, copy);
752
800
  have -= copy;
753
801
  next += copy;
@@ -757,6 +805,7 @@ int flush;
757
805
  state->head->name = Z_NULL;
758
806
  state->length = 0;
759
807
  state->mode = COMMENT;
808
+ /* fallthrough */
760
809
  case COMMENT:
761
810
  if (state->flags & 0x1000) {
762
811
  if (have == 0) goto inf_leave;
@@ -766,9 +815,9 @@ int flush;
766
815
  if (state->head != Z_NULL &&
767
816
  state->head->comment != Z_NULL &&
768
817
  state->length < state->head->comm_max)
769
- state->head->comment[state->length++] = len;
818
+ state->head->comment[state->length++] = (Bytef)len;
770
819
  } while (len && copy < have);
771
- if (state->flags & 0x0200)
820
+ if ((state->flags & 0x0200) && (state->wrap & 4))
772
821
  state->check = crc32(state->check, next, copy);
773
822
  have -= copy;
774
823
  next += copy;
@@ -777,10 +826,11 @@ int flush;
777
826
  else if (state->head != Z_NULL)
778
827
  state->head->comment = Z_NULL;
779
828
  state->mode = HCRC;
829
+ /* fallthrough */
780
830
  case HCRC:
781
831
  if (state->flags & 0x0200) {
782
832
  NEEDBITS(16);
783
- if (hold != (state->check & 0xffff)) {
833
+ if ((state->wrap & 4) && hold != (state->check & 0xffff)) {
784
834
  strm->msg = (char *)"header crc mismatch";
785
835
  state->mode = BAD;
786
836
  break;
@@ -797,9 +847,10 @@ int flush;
797
847
  #endif
798
848
  case DICTID:
799
849
  NEEDBITS(32);
800
- strm->adler = state->check = REVERSE(hold);
850
+ strm->adler = state->check = ZSWAP32(hold);
801
851
  INITBITS();
802
852
  state->mode = DICT;
853
+ /* fallthrough */
803
854
  case DICT:
804
855
  if (state->havedict == 0) {
805
856
  RESTORE();
@@ -807,8 +858,10 @@ int flush;
807
858
  }
808
859
  strm->adler = state->check = adler32(0L, Z_NULL, 0);
809
860
  state->mode = TYPE;
861
+ /* fallthrough */
810
862
  case TYPE:
811
863
  if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
864
+ /* fallthrough */
812
865
  case TYPEDO:
813
866
  if (state->last) {
814
867
  BYTEBITS();
@@ -859,8 +912,10 @@ int flush;
859
912
  INITBITS();
860
913
  state->mode = COPY_;
861
914
  if (flush == Z_TREES) goto inf_leave;
915
+ /* fallthrough */
862
916
  case COPY_:
863
917
  state->mode = COPY;
918
+ /* fallthrough */
864
919
  case COPY:
865
920
  copy = state->length;
866
921
  if (copy) {
@@ -896,6 +951,7 @@ int flush;
896
951
  Tracev((stderr, "inflate: table sizes ok\n"));
897
952
  state->have = 0;
898
953
  state->mode = LENLENS;
954
+ /* fallthrough */
899
955
  case LENLENS:
900
956
  while (state->have < state->ncode) {
901
957
  NEEDBITS(3);
@@ -905,7 +961,7 @@ int flush;
905
961
  while (state->have < 19)
906
962
  state->lens[order[state->have++]] = 0;
907
963
  state->next = state->codes;
908
- state->lencode = (code const FAR *)(state->next);
964
+ state->lencode = (const code FAR *)(state->next);
909
965
  state->lenbits = 7;
910
966
  ret = inflate_table(CODES, state->lens, 19, &(state->next),
911
967
  &(state->lenbits), state->work);
@@ -917,6 +973,7 @@ int flush;
917
973
  Tracev((stderr, "inflate: code lengths ok\n"));
918
974
  state->have = 0;
919
975
  state->mode = CODELENS;
976
+ /* fallthrough */
920
977
  case CODELENS:
921
978
  while (state->have < state->nlen + state->ndist) {
922
979
  for (;;) {
@@ -925,7 +982,6 @@ int flush;
925
982
  PULLBYTE();
926
983
  }
927
984
  if (here.val < 16) {
928
- NEEDBITS(here.bits);
929
985
  DROPBITS(here.bits);
930
986
  state->lens[state->have++] = here.val;
931
987
  }
@@ -980,7 +1036,7 @@ int flush;
980
1036
  values here (9 and 6) without reading the comments in inftrees.h
981
1037
  concerning the ENOUGH constants, which depend on those values */
982
1038
  state->next = state->codes;
983
- state->lencode = (code const FAR *)(state->next);
1039
+ state->lencode = (const code FAR *)(state->next);
984
1040
  state->lenbits = 9;
985
1041
  ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
986
1042
  &(state->lenbits), state->work);
@@ -989,7 +1045,7 @@ int flush;
989
1045
  state->mode = BAD;
990
1046
  break;
991
1047
  }
992
- state->distcode = (code const FAR *)(state->next);
1048
+ state->distcode = (const code FAR *)(state->next);
993
1049
  state->distbits = 6;
994
1050
  ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
995
1051
  &(state->next), &(state->distbits), state->work);
@@ -1001,8 +1057,10 @@ int flush;
1001
1057
  Tracev((stderr, "inflate: codes ok\n"));
1002
1058
  state->mode = LEN_;
1003
1059
  if (flush == Z_TREES) goto inf_leave;
1060
+ /* fallthrough */
1004
1061
  case LEN_:
1005
1062
  state->mode = LEN;
1063
+ /* fallthrough */
1006
1064
  case LEN:
1007
1065
  if (have >= 6 && left >= 258) {
1008
1066
  RESTORE();
@@ -1052,6 +1110,7 @@ int flush;
1052
1110
  }
1053
1111
  state->extra = (unsigned)(here.op) & 15;
1054
1112
  state->mode = LENEXT;
1113
+ /* fallthrough */
1055
1114
  case LENEXT:
1056
1115
  if (state->extra) {
1057
1116
  NEEDBITS(state->extra);
@@ -1062,6 +1121,7 @@ int flush;
1062
1121
  Tracevv((stderr, "inflate: length %u\n", state->length));
1063
1122
  state->was = state->length;
1064
1123
  state->mode = DIST;
1124
+ /* fallthrough */
1065
1125
  case DIST:
1066
1126
  for (;;) {
1067
1127
  here = state->distcode[BITS(state->distbits)];
@@ -1089,6 +1149,7 @@ int flush;
1089
1149
  state->offset = (unsigned)here.val;
1090
1150
  state->extra = (unsigned)(here.op) & 15;
1091
1151
  state->mode = DISTEXT;
1152
+ /* fallthrough */
1092
1153
  case DISTEXT:
1093
1154
  if (state->extra) {
1094
1155
  NEEDBITS(state->extra);
@@ -1105,6 +1166,7 @@ int flush;
1105
1166
  #endif
1106
1167
  Tracevv((stderr, "inflate: distance %u\n", state->offset));
1107
1168
  state->mode = MATCH;
1169
+ /* fallthrough */
1108
1170
  case MATCH:
1109
1171
  if (left == 0) goto inf_leave;
1110
1172
  copy = out - left;
@@ -1162,15 +1224,15 @@ int flush;
1162
1224
  out -= left;
1163
1225
  strm->total_out += out;
1164
1226
  state->total += out;
1165
- if (out)
1227
+ if ((state->wrap & 4) && out)
1166
1228
  strm->adler = state->check =
1167
- UPDATE(state->check, put - out, out);
1229
+ UPDATE_CHECK(state->check, put - out, out);
1168
1230
  out = left;
1169
- if ((
1231
+ if ((state->wrap & 4) && (
1170
1232
  #ifdef GUNZIP
1171
1233
  state->flags ? hold :
1172
1234
  #endif
1173
- REVERSE(hold)) != state->check) {
1235
+ ZSWAP32(hold)) != state->check) {
1174
1236
  strm->msg = (char *)"incorrect data check";
1175
1237
  state->mode = BAD;
1176
1238
  break;
@@ -1180,10 +1242,11 @@ int flush;
1180
1242
  }
1181
1243
  #ifdef GUNZIP
1182
1244
  state->mode = LENGTH;
1245
+ /* fallthrough */
1183
1246
  case LENGTH:
1184
1247
  if (state->wrap && state->flags) {
1185
1248
  NEEDBITS(32);
1186
- if (hold != (state->total & 0xffffffffUL)) {
1249
+ if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) {
1187
1250
  strm->msg = (char *)"incorrect length check";
1188
1251
  state->mode = BAD;
1189
1252
  break;
@@ -1193,6 +1256,7 @@ int flush;
1193
1256
  }
1194
1257
  #endif
1195
1258
  state->mode = DONE;
1259
+ /* fallthrough */
1196
1260
  case DONE:
1197
1261
  ret = Z_STREAM_END;
1198
1262
  goto inf_leave;
@@ -1202,6 +1266,7 @@ int flush;
1202
1266
  case MEM:
1203
1267
  return Z_MEM_ERROR;
1204
1268
  case SYNC:
1269
+ /* fallthrough */
1205
1270
  default:
1206
1271
  return Z_STREAM_ERROR;
1207
1272
  }
@@ -1214,8 +1279,9 @@ int flush;
1214
1279
  */
1215
1280
  inf_leave:
1216
1281
  RESTORE();
1217
- if (state->wsize || (state->mode < CHECK && out != strm->avail_out))
1218
- if (updatewindow(strm, out)) {
1282
+ if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
1283
+ (state->mode < CHECK || flush != Z_FINISH)))
1284
+ if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
1219
1285
  state->mode = MEM;
1220
1286
  return Z_MEM_ERROR;
1221
1287
  }
@@ -1224,10 +1290,10 @@ int flush;
1224
1290
  strm->total_in += in;
1225
1291
  strm->total_out += out;
1226
1292
  state->total += out;
1227
- if (state->wrap && out)
1293
+ if ((state->wrap & 4) && out)
1228
1294
  strm->adler = state->check =
1229
- UPDATE(state->check, strm->next_out - out, out);
1230
- strm->data_type = state->bits + (state->last ? 64 : 0) +
1295
+ UPDATE_CHECK(state->check, strm->next_out - out, out);
1296
+ strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
1231
1297
  (state->mode == TYPE ? 128 : 0) +
1232
1298
  (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
1233
1299
  if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
@@ -1239,7 +1305,7 @@ int ZEXPORT inflateEnd(strm)
1239
1305
  z_streamp strm;
1240
1306
  {
1241
1307
  struct inflate_state FAR *state;
1242
- if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
1308
+ if (inflateStateCheck(strm))
1243
1309
  return Z_STREAM_ERROR;
1244
1310
  state = (struct inflate_state FAR *)strm->state;
1245
1311
  if (state->window != Z_NULL) ZFREE(strm, state->window);
@@ -1249,43 +1315,59 @@ z_streamp strm;
1249
1315
  return Z_OK;
1250
1316
  }
1251
1317
 
1318
+ int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength)
1319
+ z_streamp strm;
1320
+ Bytef *dictionary;
1321
+ uInt *dictLength;
1322
+ {
1323
+ struct inflate_state FAR *state;
1324
+
1325
+ /* check state */
1326
+ if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1327
+ state = (struct inflate_state FAR *)strm->state;
1328
+
1329
+ /* copy dictionary */
1330
+ if (state->whave && dictionary != Z_NULL) {
1331
+ zmemcpy(dictionary, state->window + state->wnext,
1332
+ state->whave - state->wnext);
1333
+ zmemcpy(dictionary + state->whave - state->wnext,
1334
+ state->window, state->wnext);
1335
+ }
1336
+ if (dictLength != Z_NULL)
1337
+ *dictLength = state->whave;
1338
+ return Z_OK;
1339
+ }
1340
+
1252
1341
  int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
1253
1342
  z_streamp strm;
1254
1343
  const Bytef *dictionary;
1255
1344
  uInt dictLength;
1256
1345
  {
1257
1346
  struct inflate_state FAR *state;
1258
- unsigned long id;
1347
+ unsigned long dictid;
1348
+ int ret;
1259
1349
 
1260
1350
  /* check state */
1261
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
1351
+ if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1262
1352
  state = (struct inflate_state FAR *)strm->state;
1263
1353
  if (state->wrap != 0 && state->mode != DICT)
1264
1354
  return Z_STREAM_ERROR;
1265
1355
 
1266
- /* check for correct dictionary id */
1356
+ /* check for correct dictionary identifier */
1267
1357
  if (state->mode == DICT) {
1268
- id = adler32(0L, Z_NULL, 0);
1269
- id = adler32(id, dictionary, dictLength);
1270
- if (id != state->check)
1358
+ dictid = adler32(0L, Z_NULL, 0);
1359
+ dictid = adler32(dictid, dictionary, dictLength);
1360
+ if (dictid != state->check)
1271
1361
  return Z_DATA_ERROR;
1272
1362
  }
1273
1363
 
1274
- /* copy dictionary to window */
1275
- if (updatewindow(strm, strm->avail_out)) {
1364
+ /* copy dictionary to window using updatewindow(), which will amend the
1365
+ existing dictionary if appropriate */
1366
+ ret = updatewindow(strm, dictionary + dictLength, dictLength);
1367
+ if (ret) {
1276
1368
  state->mode = MEM;
1277
1369
  return Z_MEM_ERROR;
1278
1370
  }
1279
- if (dictLength > state->wsize) {
1280
- zmemcpy(state->window, dictionary + dictLength - state->wsize,
1281
- state->wsize);
1282
- state->whave = state->wsize;
1283
- }
1284
- else {
1285
- zmemcpy(state->window + state->wsize - dictLength, dictionary,
1286
- dictLength);
1287
- state->whave = dictLength;
1288
- }
1289
1371
  state->havedict = 1;
1290
1372
  Tracev((stderr, "inflate: dictionary set\n"));
1291
1373
  return Z_OK;
@@ -1298,7 +1380,7 @@ gz_headerp head;
1298
1380
  struct inflate_state FAR *state;
1299
1381
 
1300
1382
  /* check state */
1301
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
1383
+ if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1302
1384
  state = (struct inflate_state FAR *)strm->state;
1303
1385
  if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
1304
1386
 
@@ -1321,7 +1403,7 @@ gz_headerp head;
1321
1403
  */
1322
1404
  local unsigned syncsearch(have, buf, len)
1323
1405
  unsigned FAR *have;
1324
- unsigned char FAR *buf;
1406
+ const unsigned char FAR *buf;
1325
1407
  unsigned len;
1326
1408
  {
1327
1409
  unsigned got;
@@ -1346,12 +1428,13 @@ int ZEXPORT inflateSync(strm)
1346
1428
  z_streamp strm;
1347
1429
  {
1348
1430
  unsigned len; /* number of bytes to look at or looked at */
1431
+ int flags; /* temporary to save header status */
1349
1432
  unsigned long in, out; /* temporary to save total_in and total_out */
1350
1433
  unsigned char buf[4]; /* to restore bit buffer to byte string */
1351
1434
  struct inflate_state FAR *state;
1352
1435
 
1353
1436
  /* check parameters */
1354
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
1437
+ if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1355
1438
  state = (struct inflate_state FAR *)strm->state;
1356
1439
  if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
1357
1440
 
@@ -1378,9 +1461,15 @@ z_streamp strm;
1378
1461
 
1379
1462
  /* return no joy or set up to restart inflate() on a new block */
1380
1463
  if (state->have != 4) return Z_DATA_ERROR;
1464
+ if (state->flags == -1)
1465
+ state->wrap = 0; /* if no header yet, treat as raw */
1466
+ else
1467
+ state->wrap &= ~4; /* no point in computing a check value now */
1468
+ flags = state->flags;
1381
1469
  in = strm->total_in; out = strm->total_out;
1382
1470
  inflateReset(strm);
1383
1471
  strm->total_in = in; strm->total_out = out;
1472
+ state->flags = flags;
1384
1473
  state->mode = TYPE;
1385
1474
  return Z_OK;
1386
1475
  }
@@ -1398,7 +1487,7 @@ z_streamp strm;
1398
1487
  {
1399
1488
  struct inflate_state FAR *state;
1400
1489
 
1401
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
1490
+ if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1402
1491
  state = (struct inflate_state FAR *)strm->state;
1403
1492
  return state->mode == STORED && state->bits == 0;
1404
1493
  }
@@ -1413,8 +1502,7 @@ z_streamp source;
1413
1502
  unsigned wsize;
1414
1503
 
1415
1504
  /* check input */
1416
- if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
1417
- source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
1505
+ if (inflateStateCheck(source) || dest == Z_NULL)
1418
1506
  return Z_STREAM_ERROR;
1419
1507
  state = (struct inflate_state FAR *)source->state;
1420
1508
 
@@ -1433,8 +1521,9 @@ z_streamp source;
1433
1521
  }
1434
1522
 
1435
1523
  /* copy state */
1436
- zmemcpy(dest, source, sizeof(z_stream));
1437
- zmemcpy(copy, state, sizeof(struct inflate_state));
1524
+ zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
1525
+ zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state));
1526
+ copy->strm = dest;
1438
1527
  if (state->lencode >= state->codes &&
1439
1528
  state->lencode <= state->codes + ENOUGH - 1) {
1440
1529
  copy->lencode = copy->codes + (state->lencode - state->codes);
@@ -1456,25 +1545,51 @@ int subvert;
1456
1545
  {
1457
1546
  struct inflate_state FAR *state;
1458
1547
 
1459
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
1548
+ if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1460
1549
  state = (struct inflate_state FAR *)strm->state;
1461
- state->sane = !subvert;
1462
1550
  #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
1551
+ state->sane = !subvert;
1463
1552
  return Z_OK;
1464
1553
  #else
1554
+ (void)subvert;
1465
1555
  state->sane = 1;
1466
1556
  return Z_DATA_ERROR;
1467
1557
  #endif
1468
1558
  }
1469
1559
 
1560
+ int ZEXPORT inflateValidate(strm, check)
1561
+ z_streamp strm;
1562
+ int check;
1563
+ {
1564
+ struct inflate_state FAR *state;
1565
+
1566
+ if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
1567
+ state = (struct inflate_state FAR *)strm->state;
1568
+ if (check && state->wrap)
1569
+ state->wrap |= 4;
1570
+ else
1571
+ state->wrap &= ~4;
1572
+ return Z_OK;
1573
+ }
1574
+
1470
1575
  long ZEXPORT inflateMark(strm)
1471
1576
  z_streamp strm;
1472
1577
  {
1473
1578
  struct inflate_state FAR *state;
1474
1579
 
1475
- if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
1580
+ if (inflateStateCheck(strm))
1581
+ return -(1L << 16);
1476
1582
  state = (struct inflate_state FAR *)strm->state;
1477
- return ((long)(state->back) << 16) +
1583
+ return (long)(((unsigned long)((long)state->back)) << 16) +
1478
1584
  (state->mode == COPY ? state->length :
1479
1585
  (state->mode == MATCH ? state->was - state->length : 0));
1480
1586
  }
1587
+
1588
+ unsigned long ZEXPORT inflateCodesUsed(strm)
1589
+ z_streamp strm;
1590
+ {
1591
+ struct inflate_state FAR *state;
1592
+ if (inflateStateCheck(strm)) return (unsigned long)-1;
1593
+ state = (struct inflate_state FAR *)strm->state;
1594
+ return (unsigned long)(state->next - state->codes);
1595
+ }