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) 2009 Michihiro NAKAJIMA
2
+ * Copyright (c) 2009-2011 Michihiro NAKAJIMA
3
3
  * Copyright (c) 2003-2008 Tim Kientzle and Miklos Vajna
4
4
  * All rights reserved.
5
5
  *
@@ -26,7 +26,7 @@
26
26
 
27
27
  #include "archive_platform.h"
28
28
 
29
- __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_xz.c 201167 2009-12-29 06:06:20Z kientzle $");
29
+ __FBSDID("$FreeBSD$");
30
30
 
31
31
  #ifdef HAVE_ERRNO_H
32
32
  #include <errno.h>
@@ -43,8 +43,6 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_xz.c 20
43
43
  #endif
44
44
  #if HAVE_LZMA_H
45
45
  #include <lzma.h>
46
- #elif HAVE_LZMADEC_H
47
- #include <lzmadec.h>
48
46
  #endif
49
47
 
50
48
  #include "archive.h"
@@ -60,26 +58,28 @@ struct private_data {
60
58
  size_t out_block_size;
61
59
  int64_t total_out;
62
60
  char eof; /* True = found end of compressed data. */
61
+ char in_stream;
62
+
63
+ /* Following variables are used for lzip only. */
64
+ char lzip_ver;
65
+ uint32_t crc32;
66
+ int64_t member_in;
67
+ int64_t member_out;
63
68
  };
64
69
 
65
- /* Combined lzma/xz filter */
70
+ #if LZMA_VERSION_MAJOR >= 5
71
+ /* Effectively disable the limiter. */
72
+ #define LZMA_MEMLIMIT UINT64_MAX
73
+ #else
74
+ /* NOTE: This needs to check memory size which running system has. */
75
+ #define LZMA_MEMLIMIT (1U << 30)
76
+ #endif
77
+
78
+ /* Combined lzip/lzma/xz filter */
66
79
  static ssize_t xz_filter_read(struct archive_read_filter *, const void **);
67
80
  static int xz_filter_close(struct archive_read_filter *);
68
81
  static int xz_lzma_bidder_init(struct archive_read_filter *);
69
82
 
70
- #elif HAVE_LZMADEC_H && HAVE_LIBLZMADEC
71
-
72
- struct private_data {
73
- lzmadec_stream stream;
74
- unsigned char *out_block;
75
- size_t out_block_size;
76
- int64_t total_out;
77
- char eof; /* True = found end of compressed data. */
78
- };
79
-
80
- /* Lzma-only filter */
81
- static ssize_t lzma_filter_read(struct archive_read_filter *, const void **);
82
- static int lzma_filter_close(struct archive_read_filter *);
83
83
  #endif
84
84
 
85
85
  /*
@@ -94,53 +94,105 @@ static int xz_bidder_init(struct archive_read_filter *);
94
94
  static int lzma_bidder_bid(struct archive_read_filter_bidder *,
95
95
  struct archive_read_filter *);
96
96
  static int lzma_bidder_init(struct archive_read_filter *);
97
+ static int lzip_has_member(struct archive_read_filter *);
98
+ static int lzip_bidder_bid(struct archive_read_filter_bidder *,
99
+ struct archive_read_filter *);
100
+ static int lzip_bidder_init(struct archive_read_filter *);
101
+
102
+ #if ARCHIVE_VERSION_NUMBER < 4000000
103
+ /* Deprecated; remove in libarchive 4.0 */
104
+ int
105
+ archive_read_support_compression_xz(struct archive *a)
106
+ {
107
+ return archive_read_support_filter_xz(a);
108
+ }
109
+ #endif
110
+
111
+ static const struct archive_read_filter_bidder_vtable
112
+ xz_bidder_vtable = {
113
+ .bid = xz_bidder_bid,
114
+ .init = xz_bidder_init,
115
+ };
97
116
 
98
117
  int
99
- archive_read_support_compression_xz(struct archive *_a)
118
+ archive_read_support_filter_xz(struct archive *_a)
100
119
  {
101
120
  struct archive_read *a = (struct archive_read *)_a;
102
- struct archive_read_filter_bidder *bidder = __archive_read_get_bidder(a);
103
121
 
104
- archive_clear_error(_a);
105
- if (bidder == NULL)
122
+ if (__archive_read_register_bidder(a, NULL, "xz",
123
+ &xz_bidder_vtable) != ARCHIVE_OK)
106
124
  return (ARCHIVE_FATAL);
107
125
 
108
- bidder->data = NULL;
109
- bidder->bid = xz_bidder_bid;
110
- bidder->init = xz_bidder_init;
111
- bidder->options = NULL;
112
- bidder->free = NULL;
113
126
  #if HAVE_LZMA_H && HAVE_LIBLZMA
114
127
  return (ARCHIVE_OK);
115
128
  #else
116
129
  archive_set_error(_a, ARCHIVE_ERRNO_MISC,
117
- "Using external unxz program for xz decompression");
130
+ "Using external xz program for xz decompression");
118
131
  return (ARCHIVE_WARN);
119
132
  #endif
120
133
  }
121
134
 
135
+ #if ARCHIVE_VERSION_NUMBER < 4000000
122
136
  int
123
- archive_read_support_compression_lzma(struct archive *_a)
137
+ archive_read_support_compression_lzma(struct archive *a)
138
+ {
139
+ return archive_read_support_filter_lzma(a);
140
+ }
141
+ #endif
142
+
143
+ static const struct archive_read_filter_bidder_vtable
144
+ lzma_bidder_vtable = {
145
+ .bid = lzma_bidder_bid,
146
+ .init = lzma_bidder_init,
147
+ };
148
+
149
+ int
150
+ archive_read_support_filter_lzma(struct archive *_a)
124
151
  {
125
152
  struct archive_read *a = (struct archive_read *)_a;
126
- struct archive_read_filter_bidder *bidder = __archive_read_get_bidder(a);
127
153
 
128
- archive_clear_error(_a);
129
- if (bidder == NULL)
154
+ if (__archive_read_register_bidder(a, NULL, "lzma",
155
+ &lzma_bidder_vtable) != ARCHIVE_OK)
130
156
  return (ARCHIVE_FATAL);
131
157
 
132
- bidder->data = NULL;
133
- bidder->bid = lzma_bidder_bid;
134
- bidder->init = lzma_bidder_init;
135
- bidder->options = NULL;
136
- bidder->free = NULL;
137
158
  #if HAVE_LZMA_H && HAVE_LIBLZMA
138
159
  return (ARCHIVE_OK);
139
- #elif HAVE_LZMADEC_H && HAVE_LIBLZMADEC
160
+ #else
161
+ archive_set_error(_a, ARCHIVE_ERRNO_MISC,
162
+ "Using external lzma program for lzma decompression");
163
+ return (ARCHIVE_WARN);
164
+ #endif
165
+ }
166
+
167
+
168
+ #if ARCHIVE_VERSION_NUMBER < 4000000
169
+ int
170
+ archive_read_support_compression_lzip(struct archive *a)
171
+ {
172
+ return archive_read_support_filter_lzip(a);
173
+ }
174
+ #endif
175
+
176
+ static const struct archive_read_filter_bidder_vtable
177
+ lzip_bidder_vtable = {
178
+ .bid = lzip_bidder_bid,
179
+ .init = lzip_bidder_init,
180
+ };
181
+
182
+ int
183
+ archive_read_support_filter_lzip(struct archive *_a)
184
+ {
185
+ struct archive_read *a = (struct archive_read *)_a;
186
+
187
+ if (__archive_read_register_bidder(a, NULL, "lzip",
188
+ &lzip_bidder_vtable) != ARCHIVE_OK)
189
+ return (ARCHIVE_FATAL);
190
+
191
+ #if HAVE_LZMA_H && HAVE_LIBLZMA
140
192
  return (ARCHIVE_OK);
141
193
  #else
142
194
  archive_set_error(_a, ARCHIVE_ERRNO_MISC,
143
- "Using external unlzma program for lzma decompression");
195
+ "Using external lzip program for lzip decompression");
144
196
  return (ARCHIVE_WARN);
145
197
  #endif
146
198
  }
@@ -154,7 +206,6 @@ xz_bidder_bid(struct archive_read_filter_bidder *self,
154
206
  {
155
207
  const unsigned char *buffer;
156
208
  ssize_t avail;
157
- int bits_checked;
158
209
 
159
210
  (void)self; /* UNUSED */
160
211
 
@@ -165,27 +216,10 @@ xz_bidder_bid(struct archive_read_filter_bidder *self,
165
216
  /*
166
217
  * Verify Header Magic Bytes : FD 37 7A 58 5A 00
167
218
  */
168
- bits_checked = 0;
169
- if (buffer[0] != 0xFD)
170
- return (0);
171
- bits_checked += 8;
172
- if (buffer[1] != 0x37)
173
- return (0);
174
- bits_checked += 8;
175
- if (buffer[2] != 0x7A)
176
- return (0);
177
- bits_checked += 8;
178
- if (buffer[3] != 0x58)
179
- return (0);
180
- bits_checked += 8;
181
- if (buffer[4] != 0x5A)
182
- return (0);
183
- bits_checked += 8;
184
- if (buffer[5] != 0x00)
219
+ if (memcmp(buffer, "\xFD\x37\x7A\x58\x5A\x00", 6) != 0)
185
220
  return (0);
186
- bits_checked += 8;
187
221
 
188
- return (bits_checked);
222
+ return (48);
189
223
  }
190
224
 
191
225
  /*
@@ -250,8 +284,8 @@ lzma_bidder_bid(struct archive_read_filter_bidder *self,
250
284
  /* Second through fifth bytes are dictionary size, stored in
251
285
  * little-endian order. The minimum dictionary size is
252
286
  * 1 << 12(4KiB) which the lzma of LZMA SDK uses with option
253
- * -d12 and the maxinam dictionary size is 1 << 27(128MiB)
254
- * which the one uses with option -d27.
287
+ * -d12 and the maximum dictionary size is 1 << 29(512MiB)
288
+ * which the one uses with option -d29.
255
289
  * NOTE: A comment of LZMA SDK source code says this dictionary
256
290
  * range is from 1 << 12 to 1 << 30. */
257
291
  dicsize = archive_le32dec(buffer+1);
@@ -307,6 +341,49 @@ lzma_bidder_bid(struct archive_read_filter_bidder *self,
307
341
  return (bits_checked);
308
342
  }
309
343
 
344
+ static int
345
+ lzip_has_member(struct archive_read_filter *filter)
346
+ {
347
+ const unsigned char *buffer;
348
+ ssize_t avail;
349
+ int bits_checked;
350
+ int log2dic;
351
+
352
+ buffer = __archive_read_filter_ahead(filter, 6, &avail);
353
+ if (buffer == NULL)
354
+ return (0);
355
+
356
+ /*
357
+ * Verify Header Magic Bytes : 4C 5A 49 50 (`LZIP')
358
+ */
359
+ bits_checked = 0;
360
+ if (memcmp(buffer, "LZIP", 4) != 0)
361
+ return (0);
362
+ bits_checked += 32;
363
+
364
+ /* A version number must be 0 or 1 */
365
+ if (buffer[4] != 0 && buffer[4] != 1)
366
+ return (0);
367
+ bits_checked += 8;
368
+
369
+ /* Dictionary size. */
370
+ log2dic = buffer[5] & 0x1f;
371
+ if (log2dic < 12 || log2dic > 29)
372
+ return (0);
373
+ bits_checked += 8;
374
+
375
+ return (bits_checked);
376
+ }
377
+
378
+ static int
379
+ lzip_bidder_bid(struct archive_read_filter_bidder *self,
380
+ struct archive_read_filter *filter)
381
+ {
382
+
383
+ (void)self; /* UNUSED */
384
+ return (lzip_has_member(filter));
385
+ }
386
+
310
387
  #if HAVE_LZMA_H && HAVE_LIBLZMA
311
388
 
312
389
  /*
@@ -315,7 +392,7 @@ lzma_bidder_bid(struct archive_read_filter_bidder *self,
315
392
  static int
316
393
  xz_bidder_init(struct archive_read_filter *self)
317
394
  {
318
- self->code = ARCHIVE_COMPRESSION_XZ;
395
+ self->code = ARCHIVE_FILTER_XZ;
319
396
  self->name = "xz";
320
397
  return (xz_lzma_bidder_init(self));
321
398
  }
@@ -323,11 +400,73 @@ xz_bidder_init(struct archive_read_filter *self)
323
400
  static int
324
401
  lzma_bidder_init(struct archive_read_filter *self)
325
402
  {
326
- self->code = ARCHIVE_COMPRESSION_LZMA;
403
+ self->code = ARCHIVE_FILTER_LZMA;
327
404
  self->name = "lzma";
328
405
  return (xz_lzma_bidder_init(self));
329
406
  }
330
407
 
408
+ static int
409
+ lzip_bidder_init(struct archive_read_filter *self)
410
+ {
411
+ self->code = ARCHIVE_FILTER_LZIP;
412
+ self->name = "lzip";
413
+ return (xz_lzma_bidder_init(self));
414
+ }
415
+
416
+ /*
417
+ * Set an error code and choose an error message
418
+ */
419
+ static void
420
+ set_error(struct archive_read_filter *self, int ret)
421
+ {
422
+
423
+ switch (ret) {
424
+ case LZMA_STREAM_END: /* Found end of stream. */
425
+ case LZMA_OK: /* Decompressor made some progress. */
426
+ break;
427
+ case LZMA_MEM_ERROR:
428
+ archive_set_error(&self->archive->archive, ENOMEM,
429
+ "Lzma library error: Cannot allocate memory");
430
+ break;
431
+ case LZMA_MEMLIMIT_ERROR:
432
+ archive_set_error(&self->archive->archive, ENOMEM,
433
+ "Lzma library error: Out of memory");
434
+ break;
435
+ case LZMA_FORMAT_ERROR:
436
+ archive_set_error(&self->archive->archive,
437
+ ARCHIVE_ERRNO_MISC,
438
+ "Lzma library error: format not recognized");
439
+ break;
440
+ case LZMA_OPTIONS_ERROR:
441
+ archive_set_error(&self->archive->archive,
442
+ ARCHIVE_ERRNO_MISC,
443
+ "Lzma library error: Invalid options");
444
+ break;
445
+ case LZMA_DATA_ERROR:
446
+ archive_set_error(&self->archive->archive,
447
+ ARCHIVE_ERRNO_MISC,
448
+ "Lzma library error: Corrupted input data");
449
+ break;
450
+ case LZMA_BUF_ERROR:
451
+ archive_set_error(&self->archive->archive,
452
+ ARCHIVE_ERRNO_MISC,
453
+ "Lzma library error: No progress is possible");
454
+ break;
455
+ default:
456
+ /* Return an error. */
457
+ archive_set_error(&self->archive->archive,
458
+ ARCHIVE_ERRNO_MISC,
459
+ "Lzma decompression failed: Unknown error");
460
+ break;
461
+ }
462
+ }
463
+
464
+ static const struct archive_read_filter_vtable
465
+ xz_lzma_reader_vtable = {
466
+ .read = xz_filter_read,
467
+ .close = xz_filter_close,
468
+ };
469
+
331
470
  /*
332
471
  * Setup the callbacks.
333
472
  */
@@ -352,49 +491,39 @@ xz_lzma_bidder_init(struct archive_read_filter *self)
352
491
  self->data = state;
353
492
  state->out_block_size = out_block_size;
354
493
  state->out_block = out_block;
355
- self->read = xz_filter_read;
356
- self->skip = NULL; /* not supported */
357
- self->close = xz_filter_close;
494
+ self->vtable = &xz_lzma_reader_vtable;
358
495
 
359
496
  state->stream.avail_in = 0;
360
497
 
361
498
  state->stream.next_out = state->out_block;
362
499
  state->stream.avail_out = state->out_block_size;
363
500
 
364
- /* Initialize compression library.
365
- * TODO: I don't know what value is best for memlimit.
366
- * maybe, it needs to check memory size which
367
- * running system has.
368
- */
369
- if (self->code == ARCHIVE_COMPRESSION_XZ)
501
+ state->crc32 = 0;
502
+ if (self->code == ARCHIVE_FILTER_LZIP) {
503
+ /*
504
+ * We have to read a lzip header and use it to initialize
505
+ * compression library, thus we cannot initialize the
506
+ * library for lzip here.
507
+ */
508
+ state->in_stream = 0;
509
+ return (ARCHIVE_OK);
510
+ } else
511
+ state->in_stream = 1;
512
+
513
+ /* Initialize compression library. */
514
+ if (self->code == ARCHIVE_FILTER_XZ)
370
515
  ret = lzma_stream_decoder(&(state->stream),
371
- (1U << 30),/* memlimit */
516
+ LZMA_MEMLIMIT,/* memlimit */
372
517
  LZMA_CONCATENATED);
373
518
  else
374
519
  ret = lzma_alone_decoder(&(state->stream),
375
- (1U << 30));/* memlimit */
520
+ LZMA_MEMLIMIT);/* memlimit */
376
521
 
377
522
  if (ret == LZMA_OK)
378
523
  return (ARCHIVE_OK);
379
524
 
380
525
  /* Library setup failed: Choose an error message and clean up. */
381
- switch (ret) {
382
- case LZMA_MEM_ERROR:
383
- archive_set_error(&self->archive->archive, ENOMEM,
384
- "Internal error initializing compression library: "
385
- "Cannot allocate memory");
386
- break;
387
- case LZMA_OPTIONS_ERROR:
388
- archive_set_error(&self->archive->archive,
389
- ARCHIVE_ERRNO_MISC,
390
- "Internal error initializing compression library: "
391
- "Invalid or unsupported options");
392
- break;
393
- default:
394
- archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC,
395
- "Internal error initializing lzma library");
396
- break;
397
- }
526
+ set_error(self, ret);
398
527
 
399
528
  free(state->out_block);
400
529
  free(state);
@@ -402,193 +531,132 @@ xz_lzma_bidder_init(struct archive_read_filter *self)
402
531
  return (ARCHIVE_FATAL);
403
532
  }
404
533
 
405
- /*
406
- * Return the next block of decompressed data.
407
- */
408
- static ssize_t
409
- xz_filter_read(struct archive_read_filter *self, const void **p)
534
+ static int
535
+ lzip_init(struct archive_read_filter *self)
410
536
  {
411
537
  struct private_data *state;
412
- size_t decompressed;
538
+ const unsigned char *h;
539
+ lzma_filter filters[2];
540
+ unsigned char props[5];
413
541
  ssize_t avail_in;
414
- int ret;
542
+ uint32_t dicsize;
543
+ int log2dic, ret;
415
544
 
416
545
  state = (struct private_data *)self->data;
546
+ h = __archive_read_filter_ahead(self->upstream, 6, &avail_in);
547
+ if (h == NULL)
548
+ return (ARCHIVE_FATAL);
417
549
 
418
- /* Empty our output buffer. */
419
- state->stream.next_out = state->out_block;
420
- state->stream.avail_out = state->out_block_size;
550
+ /* Get a version number. */
551
+ state->lzip_ver = h[4];
421
552
 
422
- /* Try to fill the output buffer. */
423
- while (state->stream.avail_out > 0 && !state->eof) {
424
- state->stream.next_in =
425
- __archive_read_filter_ahead(self->upstream, 1, &avail_in);
426
- if (state->stream.next_in == NULL && avail_in < 0)
427
- return (ARCHIVE_FATAL);
428
- state->stream.avail_in = avail_in;
553
+ /*
554
+ * Setup lzma property.
555
+ */
556
+ props[0] = 0x5d;
429
557
 
430
- /* Decompress as much as we can in one pass. */
431
- ret = lzma_code(&(state->stream),
432
- (state->stream.avail_in == 0)? LZMA_FINISH: LZMA_RUN);
433
- switch (ret) {
434
- case LZMA_STREAM_END: /* Found end of stream. */
435
- state->eof = 1;
436
- /* FALL THROUGH */
437
- case LZMA_OK: /* Decompressor made some progress. */
438
- __archive_read_filter_consume(self->upstream,
439
- avail_in - state->stream.avail_in);
440
- break;
441
- case LZMA_MEM_ERROR:
442
- archive_set_error(&self->archive->archive, ENOMEM,
443
- "Lzma library error: Cannot allocate memory");
444
- return (ARCHIVE_FATAL);
445
- case LZMA_MEMLIMIT_ERROR:
446
- archive_set_error(&self->archive->archive, ENOMEM,
447
- "Lzma library error: Out of memory");
448
- return (ARCHIVE_FATAL);
449
- case LZMA_FORMAT_ERROR:
450
- archive_set_error(&self->archive->archive,
451
- ARCHIVE_ERRNO_MISC,
452
- "Lzma library error: format not recognized");
453
- return (ARCHIVE_FATAL);
454
- case LZMA_OPTIONS_ERROR:
455
- archive_set_error(&self->archive->archive,
456
- ARCHIVE_ERRNO_MISC,
457
- "Lzma library error: Invalid options");
458
- return (ARCHIVE_FATAL);
459
- case LZMA_DATA_ERROR:
460
- archive_set_error(&self->archive->archive,
461
- ARCHIVE_ERRNO_MISC,
462
- "Lzma library error: Corrupted input data");
463
- return (ARCHIVE_FATAL);
464
- case LZMA_BUF_ERROR:
465
- archive_set_error(&self->archive->archive,
466
- ARCHIVE_ERRNO_MISC,
467
- "Lzma library error: No progress is possible");
468
- return (ARCHIVE_FATAL);
469
- default:
470
- /* Return an error. */
471
- archive_set_error(&self->archive->archive,
472
- ARCHIVE_ERRNO_MISC,
473
- "Lzma decompression failed: Unknown error");
474
- return (ARCHIVE_FATAL);
475
- }
558
+ /* Get dictionary size. */
559
+ log2dic = h[5] & 0x1f;
560
+ if (log2dic < 12 || log2dic > 29)
561
+ return (ARCHIVE_FATAL);
562
+ dicsize = 1U << log2dic;
563
+ if (log2dic > 12)
564
+ dicsize -= (dicsize / 16) * (h[5] >> 5);
565
+ archive_le32enc(props+1, dicsize);
566
+
567
+ /* Consume lzip header. */
568
+ __archive_read_filter_consume(self->upstream, 6);
569
+ state->member_in = 6;
570
+
571
+ filters[0].id = LZMA_FILTER_LZMA1;
572
+ filters[0].options = NULL;
573
+ filters[1].id = LZMA_VLI_UNKNOWN;
574
+ filters[1].options = NULL;
575
+
576
+ ret = lzma_properties_decode(&filters[0], NULL, props, sizeof(props));
577
+ if (ret != LZMA_OK) {
578
+ set_error(self, ret);
579
+ return (ARCHIVE_FATAL);
580
+ }
581
+ ret = lzma_raw_decoder(&(state->stream), filters);
582
+ free(filters[0].options);
583
+ if (ret != LZMA_OK) {
584
+ set_error(self, ret);
585
+ return (ARCHIVE_FATAL);
476
586
  }
477
-
478
- decompressed = state->stream.next_out - state->out_block;
479
- state->total_out += decompressed;
480
- if (decompressed == 0)
481
- *p = NULL;
482
- else
483
- *p = state->out_block;
484
- return (decompressed);
485
- }
486
-
487
- /*
488
- * Clean up the decompressor.
489
- */
490
- static int
491
- xz_filter_close(struct archive_read_filter *self)
492
- {
493
- struct private_data *state;
494
-
495
- state = (struct private_data *)self->data;
496
- lzma_end(&(state->stream));
497
- free(state->out_block);
498
- free(state);
499
587
  return (ARCHIVE_OK);
500
588
  }
501
589
 
502
- #else
503
-
504
- #if HAVE_LZMADEC_H && HAVE_LIBLZMADEC
505
-
506
- /*
507
- * If we have the older liblzmadec library, then we can handle
508
- * LZMA streams but not XZ streams.
509
- */
510
-
511
- /*
512
- * Setup the callbacks.
513
- */
514
590
  static int
515
- lzma_bidder_init(struct archive_read_filter *self)
591
+ lzip_tail(struct archive_read_filter *self)
516
592
  {
517
- static const size_t out_block_size = 64 * 1024;
518
- void *out_block;
519
593
  struct private_data *state;
520
- ssize_t ret, avail_in;
521
-
522
- self->code = ARCHIVE_COMPRESSION_LZMA;
523
- self->name = "lzma";
594
+ const unsigned char *f;
595
+ ssize_t avail_in;
596
+ int tail;
524
597
 
525
- state = (struct private_data *)calloc(sizeof(*state), 1);
526
- out_block = (unsigned char *)malloc(out_block_size);
527
- if (state == NULL || out_block == NULL) {
528
- archive_set_error(&self->archive->archive, ENOMEM,
529
- "Can't allocate data for lzma decompression");
530
- free(out_block);
531
- free(state);
598
+ state = (struct private_data *)self->data;
599
+ if (state->lzip_ver == 0)
600
+ tail = 12;
601
+ else
602
+ tail = 20;
603
+ f = __archive_read_filter_ahead(self->upstream, tail, &avail_in);
604
+ if (f == NULL && avail_in < 0)
532
605
  return (ARCHIVE_FATAL);
606
+ if (f == NULL || avail_in < tail) {
607
+ archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC,
608
+ "Lzip: Remaining data is less bytes");
609
+ return (ARCHIVE_FAILED);
533
610
  }
534
611
 
535
- self->data = state;
536
- state->out_block_size = out_block_size;
537
- state->out_block = out_block;
538
- self->read = lzma_filter_read;
539
- self->skip = NULL; /* not supported */
540
- self->close = lzma_filter_close;
541
-
542
- /* Prime the lzma library with 18 bytes of input. */
543
- state->stream.next_in = (unsigned char *)(uintptr_t)
544
- __archive_read_filter_ahead(self->upstream, 18, &avail_in);
545
- if (state->stream.next_in == NULL)
546
- return (ARCHIVE_FATAL);
547
- state->stream.avail_in = avail_in;
548
- state->stream.next_out = state->out_block;
549
- state->stream.avail_out = state->out_block_size;
550
-
551
- /* Initialize compression library. */
552
- ret = lzmadec_init(&(state->stream));
553
- __archive_read_filter_consume(self->upstream,
554
- avail_in - state->stream.avail_in);
555
- if (ret == LZMADEC_OK)
556
- return (ARCHIVE_OK);
557
-
558
- /* Library setup failed: Clean up. */
559
- archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC,
560
- "Internal error initializing lzma library");
612
+ /* Check the crc32 value of the uncompressed data of the current
613
+ * member */
614
+ if (state->crc32 != archive_le32dec(f)) {
615
+ #ifndef DONT_FAIL_ON_CRC_ERROR
616
+ archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC,
617
+ "Lzip: CRC32 error");
618
+ return (ARCHIVE_FAILED);
619
+ #endif
620
+ }
561
621
 
562
- /* Override the error message if we know what really went wrong. */
563
- switch (ret) {
564
- case LZMADEC_HEADER_ERROR:
565
- archive_set_error(&self->archive->archive,
566
- ARCHIVE_ERRNO_MISC,
567
- "Internal error initializing compression library: "
568
- "invalid header");
569
- break;
570
- case LZMADEC_MEM_ERROR:
571
- archive_set_error(&self->archive->archive, ENOMEM,
572
- "Internal error initializing compression library: "
573
- "out of memory");
574
- break;
622
+ /* Check the uncompressed size of the current member */
623
+ if ((uint64_t)state->member_out != archive_le64dec(f + 4)) {
624
+ archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC,
625
+ "Lzip: Uncompressed size error");
626
+ return (ARCHIVE_FAILED);
575
627
  }
576
628
 
577
- free(state->out_block);
578
- free(state);
579
- self->data = NULL;
580
- return (ARCHIVE_FATAL);
629
+ /* Check the total size of the current member */
630
+ if (state->lzip_ver == 1 &&
631
+ (uint64_t)state->member_in + tail != archive_le64dec(f + 12)) {
632
+ archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC,
633
+ "Lzip: Member size error");
634
+ return (ARCHIVE_FAILED);
635
+ }
636
+ __archive_read_filter_consume(self->upstream, tail);
637
+
638
+ /* If current lzip data consists of multi member, try decompressing
639
+ * a next member. */
640
+ if (lzip_has_member(self->upstream) != 0) {
641
+ state->in_stream = 0;
642
+ state->crc32 = 0;
643
+ state->member_out = 0;
644
+ state->member_in = 0;
645
+ state->eof = 0;
646
+ }
647
+ return (ARCHIVE_OK);
581
648
  }
582
649
 
583
650
  /*
584
651
  * Return the next block of decompressed data.
585
652
  */
586
653
  static ssize_t
587
- lzma_filter_read(struct archive_read_filter *self, const void **p)
654
+ xz_filter_read(struct archive_read_filter *self, const void **p)
588
655
  {
589
656
  struct private_data *state;
590
657
  size_t decompressed;
591
- ssize_t avail_in, ret;
658
+ ssize_t avail_in;
659
+ int ret;
592
660
 
593
661
  state = (struct private_data *)self->data;
594
662
 
@@ -598,42 +666,61 @@ lzma_filter_read(struct archive_read_filter *self, const void **p)
598
666
 
599
667
  /* Try to fill the output buffer. */
600
668
  while (state->stream.avail_out > 0 && !state->eof) {
601
- state->stream.next_in = (unsigned char *)(uintptr_t)
669
+ if (!state->in_stream) {
670
+ /*
671
+ * Initialize liblzma for lzip
672
+ */
673
+ ret = lzip_init(self);
674
+ if (ret != ARCHIVE_OK)
675
+ return (ret);
676
+ state->in_stream = 1;
677
+ }
678
+ state->stream.next_in =
602
679
  __archive_read_filter_ahead(self->upstream, 1, &avail_in);
603
- if (state->stream.next_in == NULL && avail_in < 0)
680
+ if (state->stream.next_in == NULL && avail_in < 0) {
681
+ archive_set_error(&self->archive->archive,
682
+ ARCHIVE_ERRNO_MISC,
683
+ "truncated input");
604
684
  return (ARCHIVE_FATAL);
685
+ }
605
686
  state->stream.avail_in = avail_in;
606
687
 
607
688
  /* Decompress as much as we can in one pass. */
608
- ret = lzmadec_decode(&(state->stream), avail_in == 0);
689
+ ret = lzma_code(&(state->stream),
690
+ (state->stream.avail_in == 0)? LZMA_FINISH: LZMA_RUN);
609
691
  switch (ret) {
610
- case LZMADEC_STREAM_END: /* Found end of stream. */
692
+ case LZMA_STREAM_END: /* Found end of stream. */
611
693
  state->eof = 1;
612
694
  /* FALL THROUGH */
613
- case LZMADEC_OK: /* Decompressor made some progress. */
695
+ case LZMA_OK: /* Decompressor made some progress. */
614
696
  __archive_read_filter_consume(self->upstream,
615
697
  avail_in - state->stream.avail_in);
698
+ state->member_in +=
699
+ avail_in - state->stream.avail_in;
616
700
  break;
617
- case LZMADEC_BUF_ERROR: /* Insufficient input data? */
618
- archive_set_error(&self->archive->archive,
619
- ARCHIVE_ERRNO_MISC,
620
- "Insufficient compressed data");
621
- return (ARCHIVE_FATAL);
622
701
  default:
623
- /* Return an error. */
624
- archive_set_error(&self->archive->archive,
625
- ARCHIVE_ERRNO_MISC,
626
- "Lzma decompression failed");
702
+ set_error(self, ret);
627
703
  return (ARCHIVE_FATAL);
628
704
  }
629
705
  }
630
706
 
631
707
  decompressed = state->stream.next_out - state->out_block;
632
708
  state->total_out += decompressed;
709
+ state->member_out += decompressed;
633
710
  if (decompressed == 0)
634
711
  *p = NULL;
635
- else
712
+ else {
636
713
  *p = state->out_block;
714
+ if (self->code == ARCHIVE_FILTER_LZIP) {
715
+ state->crc32 = lzma_crc32(state->out_block,
716
+ decompressed, state->crc32);
717
+ if (state->eof) {
718
+ ret = lzip_tail(self);
719
+ if (ret != ARCHIVE_OK)
720
+ return (ret);
721
+ }
722
+ }
723
+ }
637
724
  return (decompressed);
638
725
  }
639
726
 
@@ -641,27 +728,15 @@ lzma_filter_read(struct archive_read_filter *self, const void **p)
641
728
  * Clean up the decompressor.
642
729
  */
643
730
  static int
644
- lzma_filter_close(struct archive_read_filter *self)
731
+ xz_filter_close(struct archive_read_filter *self)
645
732
  {
646
733
  struct private_data *state;
647
- int ret;
648
734
 
649
735
  state = (struct private_data *)self->data;
650
- ret = ARCHIVE_OK;
651
- switch (lzmadec_end(&(state->stream))) {
652
- case LZMADEC_OK:
653
- break;
654
- default:
655
- archive_set_error(&(self->archive->archive),
656
- ARCHIVE_ERRNO_MISC,
657
- "Failed to clean up %s compressor",
658
- self->archive->archive.compression_name);
659
- ret = ARCHIVE_FATAL;
660
- }
661
-
736
+ lzma_end(&(state->stream));
662
737
  free(state->out_block);
663
738
  free(state);
664
- return (ret);
739
+ return (ARCHIVE_OK);
665
740
  }
666
741
 
667
742
  #else
@@ -678,31 +753,41 @@ lzma_bidder_init(struct archive_read_filter *self)
678
753
  {
679
754
  int r;
680
755
 
681
- r = __archive_read_program(self, "unlzma");
756
+ r = __archive_read_program(self, "lzma -d -qq");
682
757
  /* Note: We set the format here even if __archive_read_program()
683
758
  * above fails. We do, after all, know what the format is
684
759
  * even if we weren't able to read it. */
685
- self->code = ARCHIVE_COMPRESSION_LZMA;
760
+ self->code = ARCHIVE_FILTER_LZMA;
686
761
  self->name = "lzma";
687
762
  return (r);
688
763
  }
689
764
 
690
- #endif /* HAVE_LZMADEC_H */
691
-
692
-
693
765
  static int
694
766
  xz_bidder_init(struct archive_read_filter *self)
695
767
  {
696
768
  int r;
697
769
 
698
- r = __archive_read_program(self, "unxz");
770
+ r = __archive_read_program(self, "xz -d -qq");
699
771
  /* Note: We set the format here even if __archive_read_program()
700
772
  * above fails. We do, after all, know what the format is
701
773
  * even if we weren't able to read it. */
702
- self->code = ARCHIVE_COMPRESSION_XZ;
774
+ self->code = ARCHIVE_FILTER_XZ;
703
775
  self->name = "xz";
704
776
  return (r);
705
777
  }
706
778
 
779
+ static int
780
+ lzip_bidder_init(struct archive_read_filter *self)
781
+ {
782
+ int r;
783
+
784
+ r = __archive_read_program(self, "lzip -d -q");
785
+ /* Note: We set the format here even if __archive_read_program()
786
+ * above fails. We do, after all, know what the format is
787
+ * even if we weren't able to read it. */
788
+ self->code = ARCHIVE_FILTER_LZIP;
789
+ self->name = "lzip";
790
+ return (r);
791
+ }
707
792
 
708
793
  #endif /* HAVE_LZMA_H */