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
  /*-
2
- * Copyright (c) 2003-2007 Tim Kientzle
2
+ * Copyright (c) 2003-2011 Tim Kientzle
3
3
  * All rights reserved.
4
4
  *
5
5
  * Redistribution and use in source and binary forms, with or without
@@ -24,30 +24,55 @@
24
24
  */
25
25
 
26
26
  #include "archive_platform.h"
27
- __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_all.c 201248 2009-12-30 06:12:03Z kientzle $");
27
+ __FBSDID("$FreeBSD$");
28
28
 
29
29
  #include "archive.h"
30
+ #include "archive_private.h"
30
31
 
32
+ #if ARCHIVE_VERSION_NUMBER < 4000000
33
+ /* Deprecated; remove in libarchive 4.0 */
31
34
  int
32
35
  archive_read_support_compression_all(struct archive *a)
33
36
  {
37
+ return archive_read_support_filter_all(a);
38
+ }
39
+ #endif
40
+
41
+ int
42
+ archive_read_support_filter_all(struct archive *a)
43
+ {
44
+ archive_check_magic(a, ARCHIVE_READ_MAGIC,
45
+ ARCHIVE_STATE_NEW, "archive_read_support_filter_all");
46
+
34
47
  /* Bzip falls back to "bunzip2" command-line */
35
- archive_read_support_compression_bzip2(a);
48
+ archive_read_support_filter_bzip2(a);
36
49
  /* The decompress code doesn't use an outside library. */
37
- archive_read_support_compression_compress(a);
38
- /* Gzip decompress falls back to "gunzip" command-line. */
39
- archive_read_support_compression_gzip(a);
50
+ archive_read_support_filter_compress(a);
51
+ /* Gzip decompress falls back to "gzip -d" command-line. */
52
+ archive_read_support_filter_gzip(a);
53
+ /* Lzip falls back to "unlzip" command-line program. */
54
+ archive_read_support_filter_lzip(a);
40
55
  /* The LZMA file format has a very weak signature, so it
41
56
  * may not be feasible to keep this here, but we'll try.
42
57
  * This will come back out if there are problems. */
43
58
  /* Lzma falls back to "unlzma" command-line program. */
44
- archive_read_support_compression_lzma(a);
59
+ archive_read_support_filter_lzma(a);
45
60
  /* Xz falls back to "unxz" command-line program. */
46
- archive_read_support_compression_xz(a);
61
+ archive_read_support_filter_xz(a);
47
62
  /* The decode code doesn't use an outside library. */
48
- archive_read_support_compression_uu(a);
63
+ archive_read_support_filter_uu(a);
49
64
  /* The decode code doesn't use an outside library. */
50
- archive_read_support_compression_rpm(a);
65
+ archive_read_support_filter_rpm(a);
66
+ /* The decode code always uses "lrzip -q -d" command-line. */
67
+ archive_read_support_filter_lrzip(a);
68
+ /* Lzop decompress falls back to "lzop -d" command-line. */
69
+ archive_read_support_filter_lzop(a);
70
+ /* The decode code always uses "grzip -d" command-line. */
71
+ archive_read_support_filter_grzip(a);
72
+ /* Lz4 falls back to "lz4 -d" command-line program. */
73
+ archive_read_support_filter_lz4(a);
74
+ /* Zstd falls back to "zstd -d" command-line program. */
75
+ archive_read_support_filter_zstd(a);
51
76
 
52
77
  /* Note: We always return ARCHIVE_OK here, even if some of the
53
78
  * above return ARCHIVE_WARN. The intent here is to enable
@@ -0,0 +1,83 @@
1
+ /*-
2
+ * Copyright (c) 2020 Martin Matuska
3
+ * All rights reserved.
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions
7
+ * are met:
8
+ * 1. Redistributions of source code must retain the above copyright
9
+ * notice, this list of conditions and the following disclaimer.
10
+ * 2. Redistributions in binary form must reproduce the above copyright
11
+ * notice, this list of conditions and the following disclaimer in the
12
+ * documentation and/or other materials provided with the distribution.
13
+ *
14
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
+ */
25
+
26
+ #include "archive_platform.h"
27
+ __FBSDID("$FreeBSD$");
28
+
29
+ #include "archive.h"
30
+ #include "archive_private.h"
31
+
32
+ int
33
+ archive_read_support_filter_by_code(struct archive *a, int filter_code)
34
+ {
35
+ archive_check_magic(a, ARCHIVE_READ_MAGIC,
36
+ ARCHIVE_STATE_NEW, "archive_read_support_filter_by_code");
37
+
38
+ switch (filter_code) {
39
+ case ARCHIVE_FILTER_NONE:
40
+ return archive_read_support_filter_none(a);
41
+ break;
42
+ case ARCHIVE_FILTER_GZIP:
43
+ return archive_read_support_filter_gzip(a);
44
+ break;
45
+ case ARCHIVE_FILTER_BZIP2:
46
+ return archive_read_support_filter_bzip2(a);
47
+ break;
48
+ case ARCHIVE_FILTER_COMPRESS:
49
+ return archive_read_support_filter_compress(a);
50
+ break;
51
+ case ARCHIVE_FILTER_LZMA:
52
+ return archive_read_support_filter_lzma(a);
53
+ break;
54
+ case ARCHIVE_FILTER_XZ:
55
+ return archive_read_support_filter_xz(a);
56
+ break;
57
+ case ARCHIVE_FILTER_UU:
58
+ return archive_read_support_filter_uu(a);
59
+ break;
60
+ case ARCHIVE_FILTER_RPM:
61
+ return archive_read_support_filter_rpm(a);
62
+ break;
63
+ case ARCHIVE_FILTER_LZIP:
64
+ return archive_read_support_filter_lzip(a);
65
+ break;
66
+ case ARCHIVE_FILTER_LRZIP:
67
+ return archive_read_support_filter_lrzip(a);
68
+ break;
69
+ case ARCHIVE_FILTER_LZOP:
70
+ return archive_read_support_filter_lzop(a);
71
+ break;
72
+ case ARCHIVE_FILTER_GRZIP:
73
+ return archive_read_support_filter_grzip(a);
74
+ break;
75
+ case ARCHIVE_FILTER_LZ4:
76
+ return archive_read_support_filter_lz4(a);
77
+ break;
78
+ case ARCHIVE_FILTER_ZSTD:
79
+ return archive_read_support_filter_zstd(a);
80
+ break;
81
+ }
82
+ return (ARCHIVE_FATAL);
83
+ }
@@ -25,7 +25,7 @@
25
25
 
26
26
  #include "archive_platform.h"
27
27
 
28
- __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_bzip2.c 201108 2009-12-28 03:28:21Z kientzle $");
28
+ __FBSDID("$FreeBSD$");
29
29
 
30
30
  #ifdef HAVE_ERRNO_H
31
31
  #include <errno.h>
@@ -70,37 +70,40 @@ static int bzip2_filter_close(struct archive_read_filter *);
70
70
  */
71
71
  static int bzip2_reader_bid(struct archive_read_filter_bidder *, struct archive_read_filter *);
72
72
  static int bzip2_reader_init(struct archive_read_filter *);
73
- static int bzip2_reader_free(struct archive_read_filter_bidder *);
74
73
 
74
+ #if ARCHIVE_VERSION_NUMBER < 4000000
75
+ /* Deprecated; remove in libarchive 4.0 */
75
76
  int
76
- archive_read_support_compression_bzip2(struct archive *_a)
77
+ archive_read_support_compression_bzip2(struct archive *a)
78
+ {
79
+ return archive_read_support_filter_bzip2(a);
80
+ }
81
+ #endif
82
+
83
+ static const struct archive_read_filter_bidder_vtable
84
+ bzip2_bidder_vtable = {
85
+ .bid = bzip2_reader_bid,
86
+ .init = bzip2_reader_init,
87
+ };
88
+
89
+ int
90
+ archive_read_support_filter_bzip2(struct archive *_a)
77
91
  {
78
92
  struct archive_read *a = (struct archive_read *)_a;
79
- struct archive_read_filter_bidder *reader = __archive_read_get_bidder(a);
80
93
 
81
- if (reader == NULL)
94
+ if (__archive_read_register_bidder(a, NULL, "bzip2",
95
+ &bzip2_bidder_vtable) != ARCHIVE_OK)
82
96
  return (ARCHIVE_FATAL);
83
97
 
84
- reader->data = NULL;
85
- reader->bid = bzip2_reader_bid;
86
- reader->init = bzip2_reader_init;
87
- reader->options = NULL;
88
- reader->free = bzip2_reader_free;
89
98
  #if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
90
99
  return (ARCHIVE_OK);
91
100
  #else
92
101
  archive_set_error(_a, ARCHIVE_ERRNO_MISC,
93
- "Using external bunzip2 program");
102
+ "Using external bzip2 program");
94
103
  return (ARCHIVE_WARN);
95
104
  #endif
96
105
  }
97
106
 
98
- static int
99
- bzip2_reader_free(struct archive_read_filter_bidder *self){
100
- (void)self; /* UNUSED */
101
- return (ARCHIVE_OK);
102
- }
103
-
104
107
  /*
105
108
  * Test whether we can handle this data.
106
109
  *
@@ -124,7 +127,7 @@ bzip2_reader_bid(struct archive_read_filter_bidder *self, struct archive_read_fi
124
127
 
125
128
  /* First three bytes must be "BZh" */
126
129
  bits_checked = 0;
127
- if (buffer[0] != 'B' || buffer[1] != 'Z' || buffer[2] != 'h')
130
+ if (memcmp(buffer, "BZh", 3) != 0)
128
131
  return (0);
129
132
  bits_checked += 24;
130
133
 
@@ -158,11 +161,11 @@ bzip2_reader_init(struct archive_read_filter *self)
158
161
  {
159
162
  int r;
160
163
 
161
- r = __archive_read_program(self, "bunzip2");
164
+ r = __archive_read_program(self, "bzip2 -d");
162
165
  /* Note: We set the format here even if __archive_read_program()
163
166
  * above fails. We do, after all, know what the format is
164
167
  * even if we weren't able to read it. */
165
- self->code = ARCHIVE_COMPRESSION_BZIP2;
168
+ self->code = ARCHIVE_FILTER_BZIP2;
166
169
  self->name = "bzip2";
167
170
  return (r);
168
171
  }
@@ -170,6 +173,12 @@ bzip2_reader_init(struct archive_read_filter *self)
170
173
 
171
174
  #else
172
175
 
176
+ static const struct archive_read_filter_vtable
177
+ bzip2_reader_vtable = {
178
+ .read = bzip2_filter_read,
179
+ .close = bzip2_filter_close,
180
+ };
181
+
173
182
  /*
174
183
  * Setup the callbacks.
175
184
  */
@@ -180,12 +189,12 @@ bzip2_reader_init(struct archive_read_filter *self)
180
189
  void *out_block;
181
190
  struct private_data *state;
182
191
 
183
- self->code = ARCHIVE_COMPRESSION_BZIP2;
192
+ self->code = ARCHIVE_FILTER_BZIP2;
184
193
  self->name = "bzip2";
185
194
 
186
195
  state = (struct private_data *)calloc(sizeof(*state), 1);
187
196
  out_block = (unsigned char *)malloc(out_block_size);
188
- if (self == NULL || state == NULL || out_block == NULL) {
197
+ if (state == NULL || out_block == NULL) {
189
198
  archive_set_error(&self->archive->archive, ENOMEM,
190
199
  "Can't allocate data for bzip2 decompression");
191
200
  free(out_block);
@@ -196,9 +205,7 @@ bzip2_reader_init(struct archive_read_filter *self)
196
205
  self->data = state;
197
206
  state->out_block_size = out_block_size;
198
207
  state->out_block = out_block;
199
- self->read = bzip2_filter_read;
200
- self->skip = NULL; /* not supported */
201
- self->close = bzip2_filter_close;
208
+ self->vtable = &bzip2_reader_vtable;
202
209
 
203
210
  return (ARCHIVE_OK);
204
211
  }
@@ -274,8 +281,12 @@ bzip2_filter_read(struct archive_read_filter *self, const void **p)
274
281
  * doesn't declare it so. <sigh> */
275
282
  read_buf =
276
283
  __archive_read_filter_ahead(self->upstream, 1, &ret);
277
- if (read_buf == NULL)
284
+ if (read_buf == NULL) {
285
+ archive_set_error(&self->archive->archive,
286
+ ARCHIVE_ERRNO_MISC,
287
+ "truncated bzip2 input");
278
288
  return (ARCHIVE_FATAL);
289
+ }
279
290
  state->stream.next_in = (char *)(uintptr_t)read_buf;
280
291
  state->stream.avail_in = ret;
281
292
  /* There is no more data, return whatever we have. */
@@ -343,6 +354,7 @@ bzip2_filter_close(struct archive_read_filter *self)
343
354
  "Failed to clean up decompressor");
344
355
  ret = ARCHIVE_FATAL;
345
356
  }
357
+ state->valid = 0;
346
358
  }
347
359
 
348
360
  free(state->out_block);
@@ -64,7 +64,7 @@
64
64
 
65
65
 
66
66
  #include "archive_platform.h"
67
- __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_compress.c 201094 2009-12-28 02:29:21Z kientzle $");
67
+ __FBSDID("$FreeBSD$");
68
68
 
69
69
  #ifdef HAVE_ERRNO_H
70
70
  #include <errno.h>
@@ -95,6 +95,7 @@ struct private_data {
95
95
  /* Input variables. */
96
96
  const unsigned char *next_in;
97
97
  size_t avail_in;
98
+ size_t consume_unnotified;
98
99
  int bit_buffer;
99
100
  int bits_avail;
100
101
  size_t bytes_in_section;
@@ -132,7 +133,6 @@ struct private_data {
132
133
 
133
134
  static int compress_bidder_bid(struct archive_read_filter_bidder *, struct archive_read_filter *);
134
135
  static int compress_bidder_init(struct archive_read_filter *);
135
- static int compress_bidder_free(struct archive_read_filter_bidder *);
136
136
 
137
137
  static ssize_t compress_filter_read(struct archive_read_filter *, const void **);
138
138
  static int compress_filter_close(struct archive_read_filter *);
@@ -140,29 +140,33 @@ static int compress_filter_close(struct archive_read_filter *);
140
140
  static int getbits(struct archive_read_filter *, int n);
141
141
  static int next_code(struct archive_read_filter *);
142
142
 
143
+ #if ARCHIVE_VERSION_NUMBER < 4000000
144
+ /* Deprecated; remove in libarchive 4.0 */
143
145
  int
144
- archive_read_support_compression_compress(struct archive *_a)
146
+ archive_read_support_compression_compress(struct archive *a)
145
147
  {
146
- struct archive_read *a = (struct archive_read *)_a;
147
- struct archive_read_filter_bidder *bidder = __archive_read_get_bidder(a);
148
+ return archive_read_support_filter_compress(a);
149
+ }
150
+ #endif
148
151
 
149
- if (bidder == NULL)
150
- return (ARCHIVE_FATAL);
152
+ static const struct archive_read_filter_bidder_vtable
153
+ compress_bidder_vtable = {
154
+ .bid = compress_bidder_bid,
155
+ .init = compress_bidder_init,
156
+ };
151
157
 
152
- bidder->data = NULL;
153
- bidder->bid = compress_bidder_bid;
154
- bidder->init = compress_bidder_init;
155
- bidder->options = NULL;
156
- bidder->free = compress_bidder_free;
157
- return (ARCHIVE_OK);
158
+ int
159
+ archive_read_support_filter_compress(struct archive *_a)
160
+ {
161
+ struct archive_read *a = (struct archive_read *)_a;
162
+
163
+ return __archive_read_register_bidder(a, NULL, "compress (.Z)",
164
+ &compress_bidder_vtable);
158
165
  }
159
166
 
160
167
  /*
161
168
  * Test whether we can handle this data.
162
- *
163
- * This logic returns zero if any part of the signature fails. It
164
- * also tries to Do The Right Thing if a very short buffer prevents us
165
- * from verifying as much as we would like.
169
+ * This logic returns zero if any part of the signature fails.
166
170
  */
167
171
  static int
168
172
  compress_bidder_bid(struct archive_read_filter_bidder *self,
@@ -174,27 +178,32 @@ compress_bidder_bid(struct archive_read_filter_bidder *self,
174
178
 
175
179
  (void)self; /* UNUSED */
176
180
 
177
- buffer = __archive_read_filter_ahead(filter, 2, &avail);
181
+ /* Shortest valid compress file is 3 bytes. */
182
+ buffer = __archive_read_filter_ahead(filter, 3, &avail);
178
183
 
179
184
  if (buffer == NULL)
180
185
  return (0);
181
186
 
182
187
  bits_checked = 0;
183
- if (buffer[0] != 037) /* Verify first ID byte. */
188
+ /* First two bytes are the magic value */
189
+ if (buffer[0] != 0x1F || buffer[1] != 0x9D)
184
190
  return (0);
185
- bits_checked += 8;
186
-
187
- if (buffer[1] != 0235) /* Verify second ID byte. */
191
+ /* Third byte holds compression parameters. */
192
+ if (buffer[2] & 0x20) /* Reserved bit, must be zero. */
188
193
  return (0);
189
- bits_checked += 8;
190
-
191
- /*
192
- * TODO: Verify more.
193
- */
194
+ if (buffer[2] & 0x40) /* Reserved bit, must be zero. */
195
+ return (0);
196
+ bits_checked += 18;
194
197
 
195
198
  return (bits_checked);
196
199
  }
197
200
 
201
+ static const struct archive_read_filter_vtable
202
+ compress_reader_vtable = {
203
+ .read = compress_filter_read,
204
+ .close = compress_filter_close,
205
+ };
206
+
198
207
  /*
199
208
  * Setup the callbacks.
200
209
  */
@@ -206,7 +215,7 @@ compress_bidder_init(struct archive_read_filter *self)
206
215
  void *out_block;
207
216
  int code;
208
217
 
209
- self->code = ARCHIVE_COMPRESSION_COMPRESS;
218
+ self->code = ARCHIVE_FILTER_COMPRESS;
210
219
  self->name = "compress (.Z)";
211
220
 
212
221
  state = (struct private_data *)calloc(sizeof(*state), 1);
@@ -223,16 +232,20 @@ compress_bidder_init(struct archive_read_filter *self)
223
232
  self->data = state;
224
233
  state->out_block_size = out_block_size;
225
234
  state->out_block = out_block;
226
- self->read = compress_filter_read;
227
- self->skip = NULL; /* not supported */
228
- self->close = compress_filter_close;
235
+ self->vtable = &compress_reader_vtable;
229
236
 
230
237
  /* XXX MOVE THE FOLLOWING OUT OF INIT() XXX */
231
238
 
232
239
  (void)getbits(self, 8); /* Skip first signature byte. */
233
240
  (void)getbits(self, 8); /* Skip second signature byte. */
234
241
 
242
+ /* Get compression parameters. */
235
243
  code = getbits(self, 8);
244
+ if ((code & 0x1f) > 16) {
245
+ archive_set_error(&self->archive->archive, -1,
246
+ "Invalid compressed data");
247
+ return (ARCHIVE_FATAL);
248
+ }
236
249
  state->maxcode_bits = code & 0x1f;
237
250
  state->maxcode = (1 << state->maxcode_bits);
238
251
  state->use_reset_code = code & 0x80;
@@ -289,16 +302,6 @@ compress_filter_read(struct archive_read_filter *self, const void **pblock)
289
302
  return (p - start);
290
303
  }
291
304
 
292
- /*
293
- * Clean up the reader.
294
- */
295
- static int
296
- compress_bidder_free(struct archive_read_filter_bidder *self)
297
- {
298
- self->data = NULL;
299
- return (ARCHIVE_OK);
300
- }
301
-
302
305
  /*
303
306
  * Close and release the filter.
304
307
  */
@@ -361,7 +364,8 @@ next_code(struct archive_read_filter *self)
361
364
  return (next_code(self));
362
365
  }
363
366
 
364
- if (code > state->free_ent) {
367
+ if (code > state->free_ent
368
+ || (code == state->free_ent && state->oldcode < 0)) {
365
369
  /* An invalid code is a fatal error. */
366
370
  archive_set_error(&(self->archive->archive), -1,
367
371
  "Invalid compressed data");
@@ -420,6 +424,11 @@ getbits(struct archive_read_filter *self, int n)
420
424
 
421
425
  while (state->bits_avail < n) {
422
426
  if (state->avail_in <= 0) {
427
+ if (state->consume_unnotified) {
428
+ __archive_read_filter_consume(self->upstream,
429
+ state->consume_unnotified);
430
+ state->consume_unnotified = 0;
431
+ }
423
432
  state->next_in
424
433
  = __archive_read_filter_ahead(self->upstream,
425
434
  1, &ret);
@@ -427,8 +436,7 @@ getbits(struct archive_read_filter *self, int n)
427
436
  return (-1);
428
437
  if (ret < 0 || state->next_in == NULL)
429
438
  return (ARCHIVE_FATAL);
430
- state->avail_in = ret;
431
- __archive_read_filter_consume(self->upstream, ret);
439
+ state->consume_unnotified = state->avail_in = ret;
432
440
  }
433
441
  state->bit_buffer |= *state->next_in++ << state->bits_avail;
434
442
  state->avail_in--;
@@ -0,0 +1,112 @@
1
+ /*-
2
+ * Copyright (c) 2012 Michihiro NAKAJIMA
3
+ * All rights reserved.
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions
7
+ * are met:
8
+ * 1. Redistributions of source code must retain the above copyright
9
+ * notice, this list of conditions and the following disclaimer.
10
+ * 2. Redistributions in binary form must reproduce the above copyright
11
+ * notice, this list of conditions and the following disclaimer in the
12
+ * documentation and/or other materials provided with the distribution.
13
+ *
14
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
+ */
25
+
26
+ #include "archive_platform.h"
27
+
28
+ __FBSDID("$FreeBSD$");
29
+
30
+
31
+ #ifdef HAVE_ERRNO_H
32
+ #include <errno.h>
33
+ #endif
34
+ #ifdef HAVE_STDLIB_H
35
+ #include <stdlib.h>
36
+ #endif
37
+ #ifdef HAVE_STRING_H
38
+ #include <string.h>
39
+ #endif
40
+ #ifdef HAVE_UNISTD_H
41
+ #include <unistd.h>
42
+ #endif
43
+
44
+ #include "archive.h"
45
+ #include "archive_private.h"
46
+ #include "archive_read_private.h"
47
+
48
+ static const unsigned char grzip_magic[] = {
49
+ 0x47, 0x52, 0x5a, 0x69, 0x70, 0x49, 0x49, 0x00,
50
+ 0x02, 0x04, 0x3a, 0x29 };
51
+
52
+ static int grzip_bidder_bid(struct archive_read_filter_bidder *,
53
+ struct archive_read_filter *);
54
+ static int grzip_bidder_init(struct archive_read_filter *);
55
+
56
+
57
+ static const struct archive_read_filter_bidder_vtable
58
+ grzip_bidder_vtable = {
59
+ .bid = grzip_bidder_bid,
60
+ .init = grzip_bidder_init,
61
+ };
62
+
63
+ int
64
+ archive_read_support_filter_grzip(struct archive *_a)
65
+ {
66
+ struct archive_read *a = (struct archive_read *)_a;
67
+
68
+ if (__archive_read_register_bidder(a, NULL, NULL,
69
+ &grzip_bidder_vtable) != ARCHIVE_OK)
70
+ return (ARCHIVE_FATAL);
71
+
72
+ /* This filter always uses an external program. */
73
+ archive_set_error(_a, ARCHIVE_ERRNO_MISC,
74
+ "Using external grzip program for grzip decompression");
75
+ return (ARCHIVE_WARN);
76
+ }
77
+
78
+ /*
79
+ * Bidder just verifies the header and returns the number of verified bits.
80
+ */
81
+ static int
82
+ grzip_bidder_bid(struct archive_read_filter_bidder *self,
83
+ struct archive_read_filter *filter)
84
+ {
85
+ const unsigned char *p;
86
+ ssize_t avail;
87
+
88
+ (void)self; /* UNUSED */
89
+
90
+ p = __archive_read_filter_ahead(filter, sizeof(grzip_magic), &avail);
91
+ if (p == NULL || avail == 0)
92
+ return (0);
93
+
94
+ if (memcmp(p, grzip_magic, sizeof(grzip_magic)))
95
+ return (0);
96
+
97
+ return (sizeof(grzip_magic) * 8);
98
+ }
99
+
100
+ static int
101
+ grzip_bidder_init(struct archive_read_filter *self)
102
+ {
103
+ int r;
104
+
105
+ r = __archive_read_program(self, "grzip -d");
106
+ /* Note: We set the format here even if __archive_read_program()
107
+ * above fails. We do, after all, know what the format is
108
+ * even if we weren't able to read it. */
109
+ self->code = ARCHIVE_FILTER_GRZIP;
110
+ self->name = "grzip";
111
+ return (r);
112
+ }