libarchive-static 1.0.5 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (296) hide show
  1. checksums.yaml +5 -5
  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_internal.h +0 -1
  20. data/ext/libarchive-0.1.1/ext/libarchive_reader.c +6 -4
  21. data/ext/libarchive-0.1.1/ext/libarchive_reader.o +0 -0
  22. data/ext/libarchive-0.1.1/ext/libarchive_ruby.so +0 -0
  23. data/ext/libarchive-0.1.1/ext/libarchive_win32.h +1 -1
  24. data/ext/libarchive-0.1.1/ext/libarchive_writer.c +2 -2
  25. data/ext/libarchive-0.1.1/ext/libarchive_writer.o +0 -0
  26. data/ext/libarchive-3.6.2/Makefile.in +16892 -0
  27. data/ext/libarchive-3.6.2/build/autoconf/ax_append_compile_flags.m4 +67 -0
  28. data/ext/libarchive-3.6.2/build/autoconf/ax_append_flag.m4 +71 -0
  29. data/ext/libarchive-3.6.2/build/autoconf/ax_check_compile_flag.m4 +74 -0
  30. data/ext/libarchive-3.6.2/build/autoconf/ax_require_defined.m4 +37 -0
  31. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/check_stdcall_func.m4 +0 -0
  32. data/ext/libarchive-3.6.2/build/autoconf/compile +348 -0
  33. data/ext/libarchive-3.6.2/build/autoconf/config.guess +1754 -0
  34. data/ext/libarchive-3.6.2/build/autoconf/config.rpath +696 -0
  35. data/ext/libarchive-3.6.2/build/autoconf/config.sub +1890 -0
  36. data/ext/libarchive-3.6.2/build/autoconf/depcomp +791 -0
  37. data/ext/libarchive-3.6.2/build/autoconf/iconv.m4 +271 -0
  38. data/ext/libarchive-3.6.2/build/autoconf/install-sh +541 -0
  39. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/la_uid_t.m4 +0 -0
  40. data/ext/libarchive-3.6.2/build/autoconf/lib-ld.m4 +109 -0
  41. data/ext/libarchive-3.6.2/build/autoconf/lib-link.m4 +777 -0
  42. data/ext/libarchive-3.6.2/build/autoconf/lib-prefix.m4 +224 -0
  43. data/ext/libarchive-3.6.2/build/autoconf/ltmain.sh +11251 -0
  44. data/ext/libarchive-3.6.2/build/autoconf/m4_ax_compile_check_sizeof.m4 +115 -0
  45. data/ext/libarchive-3.6.2/build/autoconf/missing +215 -0
  46. data/ext/libarchive-3.6.2/build/autoconf/test-driver +153 -0
  47. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/pkgconfig/libarchive.pc.in +4 -1
  48. data/ext/libarchive-3.6.2/config.h.in +1504 -0
  49. data/ext/libarchive-3.6.2/configure +25558 -0
  50. data/ext/libarchive-3.6.2/libarchive/archive.h +1212 -0
  51. data/ext/libarchive-3.6.2/libarchive/archive_acl.c +2097 -0
  52. data/ext/libarchive-3.6.2/libarchive/archive_acl_private.h +83 -0
  53. data/ext/libarchive-3.6.2/libarchive/archive_blake2.h +197 -0
  54. data/ext/libarchive-3.6.2/libarchive/archive_blake2_impl.h +161 -0
  55. data/ext/libarchive-3.6.2/libarchive/archive_blake2s_ref.c +369 -0
  56. data/ext/libarchive-3.6.2/libarchive/archive_blake2sp_ref.c +361 -0
  57. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_check_magic.c +63 -22
  58. data/ext/libarchive-3.6.2/libarchive/archive_cmdline.c +227 -0
  59. data/ext/libarchive-3.6.2/libarchive/archive_cmdline_private.h +47 -0
  60. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_crc32.h +17 -0
  61. data/ext/libarchive-3.6.2/libarchive/archive_cryptor.c +534 -0
  62. data/ext/libarchive-3.6.2/libarchive/archive_cryptor_private.h +188 -0
  63. data/ext/libarchive-3.6.2/libarchive/archive_digest.c +1505 -0
  64. data/ext/libarchive-3.6.2/libarchive/archive_digest_private.h +416 -0
  65. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_darwin.c +559 -0
  66. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_freebsd.c +712 -0
  67. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_linux.c +760 -0
  68. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_sunos.c +824 -0
  69. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_endian.h +48 -15
  70. data/ext/libarchive-3.6.2/libarchive/archive_entry.c +2149 -0
  71. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry.h +305 -106
  72. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_bhfi.c +5 -4
  73. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_stat.c +9 -3
  74. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_link_resolver.c +104 -62
  75. data/ext/libarchive-3.6.2/libarchive/archive_entry_locale.h +92 -0
  76. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_private.h +65 -49
  77. data/ext/libarchive-3.6.2/libarchive/archive_entry_sparse.c +156 -0
  78. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_stat.c +6 -6
  79. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_strmode.c +1 -1
  80. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_xattr.c +4 -6
  81. data/ext/libarchive-3.6.2/libarchive/archive_getdate.c +1165 -0
  82. data/ext/libarchive-3.6.2/libarchive/archive_getdate.h +39 -0
  83. data/ext/libarchive-3.6.2/libarchive/archive_hmac.c +334 -0
  84. data/ext/libarchive-3.6.2/libarchive/archive_hmac_private.h +117 -0
  85. data/ext/libarchive-3.6.2/libarchive/archive_match.c +1875 -0
  86. data/ext/libarchive-3.6.2/libarchive/archive_openssl_evp_private.h +53 -0
  87. data/ext/libarchive-3.6.2/libarchive/archive_openssl_hmac_private.h +54 -0
  88. data/ext/libarchive-3.6.2/libarchive/archive_options.c +218 -0
  89. data/ext/libarchive-3.6.2/libarchive/archive_options_private.h +51 -0
  90. data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.c +337 -0
  91. data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.h +49 -0
  92. data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.c +463 -0
  93. data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.h +52 -0
  94. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_platform.h +77 -9
  95. data/ext/libarchive-3.6.2/libarchive/archive_platform_acl.h +55 -0
  96. data/ext/libarchive-3.6.2/libarchive/archive_platform_xattr.h +47 -0
  97. data/ext/libarchive-3.6.2/libarchive/archive_ppmd7.c +1168 -0
  98. data/ext/libarchive-3.6.2/libarchive/archive_ppmd7_private.h +119 -0
  99. data/ext/libarchive-3.6.2/libarchive/archive_ppmd8.c +1287 -0
  100. data/ext/libarchive-3.6.2/libarchive/archive_ppmd8_private.h +148 -0
  101. data/ext/libarchive-3.6.2/libarchive/archive_ppmd_private.h +151 -0
  102. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_private.h +74 -18
  103. data/ext/libarchive-3.6.2/libarchive/archive_random.c +272 -0
  104. data/ext/libarchive-3.6.2/libarchive/archive_random_private.h +36 -0
  105. data/ext/libarchive-3.6.2/libarchive/archive_rb.c +709 -0
  106. data/ext/libarchive-3.6.2/libarchive/archive_rb.h +113 -0
  107. data/ext/libarchive-3.6.2/libarchive/archive_read.c +1756 -0
  108. data/ext/libarchive-3.6.2/libarchive/archive_read_add_passphrase.c +190 -0
  109. data/ext/libarchive-3.6.2/libarchive/archive_read_append_filter.c +204 -0
  110. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_data_into_fd.c +64 -18
  111. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_entry_from_file.c +1086 -0
  112. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_posix.c +2732 -0
  113. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_private.h +40 -4
  114. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_set_standard_lookup.c +21 -11
  115. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_windows.c +2479 -0
  116. data/ext/libarchive-3.6.2/libarchive/archive_read_extract.c +60 -0
  117. data/ext/{libarchive-2.8.4/libarchive/archive_read_extract.c → libarchive-3.6.2/libarchive/archive_read_extract2.c} +34 -61
  118. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_fd.c +70 -49
  119. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_file.c +38 -23
  120. data/ext/libarchive-3.6.2/libarchive/archive_read_open_filename.c +586 -0
  121. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_memory.c +58 -28
  122. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_private.h +127 -59
  123. data/ext/libarchive-3.6.2/libarchive/archive_read_set_format.c +117 -0
  124. data/ext/libarchive-3.6.2/libarchive/archive_read_set_options.c +133 -0
  125. 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
  126. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_by_code.c +83 -0
  127. 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
  128. 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
  129. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_grzip.c +112 -0
  130. 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
  131. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lrzip.c +122 -0
  132. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lz4.c +742 -0
  133. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lzop.c +499 -0
  134. 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
  135. 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
  136. 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
  137. 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
  138. 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
  139. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_zstd.c +297 -0
  140. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_7zip.c +3900 -0
  141. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_all.c +89 -0
  142. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_ar.c +126 -72
  143. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_by_code.c +92 -0
  144. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cab.c +3228 -0
  145. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cpio.c +1104 -0
  146. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_empty.c +14 -11
  147. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_iso9660.c +990 -541
  148. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_lha.c +2916 -0
  149. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_mtree.c +2150 -0
  150. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar.c +3797 -0
  151. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar5.c +4251 -0
  152. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_raw.c +38 -31
  153. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_tar.c +1157 -629
  154. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_warc.c +848 -0
  155. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_xar.c +439 -258
  156. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_zip.c +4270 -0
  157. data/ext/libarchive-3.6.2/libarchive/archive_string.c +4240 -0
  158. data/ext/libarchive-3.6.2/libarchive/archive_string.h +243 -0
  159. data/ext/libarchive-3.6.2/libarchive/archive_string_composition.h +2292 -0
  160. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_string_sprintf.c +44 -16
  161. data/ext/libarchive-3.6.2/libarchive/archive_util.c +655 -0
  162. data/ext/libarchive-3.6.2/libarchive/archive_version_details.c +151 -0
  163. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_virtual.c +85 -16
  164. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.c +214 -541
  165. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.h +74 -106
  166. data/ext/libarchive-3.6.2/libarchive/archive_write.c +828 -0
  167. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter.c +72 -0
  168. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_b64encode.c +304 -0
  169. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_by_name.c +77 -0
  170. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_bzip2.c +401 -0
  171. 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
  172. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_grzip.c +135 -0
  173. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_gzip.c +442 -0
  174. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lrzip.c +197 -0
  175. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lz4.c +700 -0
  176. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lzop.c +478 -0
  177. 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
  178. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_program.c +391 -0
  179. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_uuencode.c +295 -0
  180. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_xz.c +545 -0
  181. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_zstd.c +418 -0
  182. data/ext/libarchive-3.6.2/libarchive/archive_write_disk_posix.c +4711 -0
  183. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_private.h +9 -2
  184. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_set_standard_lookup.c +30 -29
  185. data/ext/libarchive-3.6.2/libarchive/archive_write_disk_windows.c +2842 -0
  186. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_fd.c +15 -10
  187. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_file.c +15 -9
  188. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_filename.c +128 -20
  189. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_memory.c +7 -18
  190. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_private.h +72 -29
  191. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format.c +56 -3
  192. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_7zip.c +2322 -0
  193. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ar.c +54 -34
  194. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_by_name.c +20 -2
  195. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio.c +11 -0
  196. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_binary.c +610 -0
  197. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_newc.c +457 -0
  198. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_odc.c +500 -0
  199. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_filter_by_ext.c +142 -0
  200. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_gnutar.c +755 -0
  201. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_iso9660.c +8165 -0
  202. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_mtree.c +2217 -0
  203. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_pax.c +1049 -387
  204. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_private.h +42 -0
  205. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_raw.c +125 -0
  206. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_shar.c +62 -47
  207. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ustar.c +279 -108
  208. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_v7tar.c +638 -0
  209. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_warc.c +453 -0
  210. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_xar.c +3259 -0
  211. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_zip.c +1704 -0
  212. data/ext/libarchive-3.6.2/libarchive/archive_write_set_options.c +130 -0
  213. data/ext/libarchive-3.6.2/libarchive/archive_write_set_passphrase.c +95 -0
  214. data/ext/libarchive-3.6.2/libarchive/archive_xxhash.h +48 -0
  215. data/ext/libarchive-3.6.2/libarchive/config_freebsd.h +271 -0
  216. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/filter_fork.h +10 -5
  217. data/ext/{libarchive-2.8.4/libarchive/filter_fork.c → libarchive-3.6.2/libarchive/filter_fork_posix.c} +98 -19
  218. data/ext/libarchive-3.6.2/libarchive/filter_fork_windows.c +236 -0
  219. data/ext/libarchive-3.6.2/libarchive/xxhash.c +525 -0
  220. data/ext/libarchive-static-makefile +144 -80
  221. data/ext/libarchive-static-wrapper-makefile +1 -1
  222. data/ext/zlib-1.2.13/Makefile.in +404 -0
  223. data/ext/{zlib-1.2.5 → zlib-1.2.13}/adler32.c +51 -34
  224. data/ext/{zlib-1.2.5 → zlib-1.2.13}/compress.c +27 -21
  225. data/ext/zlib-1.2.13/configure +922 -0
  226. data/ext/zlib-1.2.13/crc32.c +1125 -0
  227. data/ext/zlib-1.2.13/crc32.h +9446 -0
  228. data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.c +842 -459
  229. data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.h +37 -33
  230. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzclose.c +0 -0
  231. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzguts.h +103 -16
  232. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzlib.c +155 -53
  233. data/ext/zlib-1.2.13/gzread.c +650 -0
  234. data/ext/zlib-1.2.13/gzwrite.c +677 -0
  235. data/ext/{zlib-1.2.5 → zlib-1.2.13}/infback.c +24 -12
  236. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.c +49 -66
  237. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.h +0 -0
  238. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffixed.h +3 -3
  239. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.c +209 -94
  240. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.h +9 -5
  241. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.c +24 -50
  242. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.h +1 -1
  243. data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.c +135 -198
  244. data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.h +0 -0
  245. data/ext/zlib-1.2.13/uncompr.c +93 -0
  246. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zconf.h +182 -63
  247. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zlib.h +617 -295
  248. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.c +50 -41
  249. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.h +83 -82
  250. metadata +244 -137
  251. data/ext/libarchive-0.1.1/libarchive.c +0 -1762
  252. data/ext/libarchive-2.8.4/Makefile.in +0 -7076
  253. data/ext/libarchive-2.8.4/build/autoconf/compile +0 -143
  254. data/ext/libarchive-2.8.4/build/autoconf/config.guess +0 -1502
  255. data/ext/libarchive-2.8.4/build/autoconf/config.sub +0 -1708
  256. data/ext/libarchive-2.8.4/build/autoconf/depcomp +0 -630
  257. data/ext/libarchive-2.8.4/build/autoconf/install-sh +0 -291
  258. data/ext/libarchive-2.8.4/build/autoconf/ltmain.sh +0 -8406
  259. data/ext/libarchive-2.8.4/build/autoconf/missing +0 -376
  260. data/ext/libarchive-2.8.4/config.h.in +0 -772
  261. data/ext/libarchive-2.8.4/configure +0 -17916
  262. data/ext/libarchive-2.8.4/libarchive/archive.h +0 -741
  263. data/ext/libarchive-2.8.4/libarchive/archive_entry.c +0 -2202
  264. data/ext/libarchive-2.8.4/libarchive/archive_hash.h +0 -281
  265. data/ext/libarchive-2.8.4/libarchive/archive_read.c +0 -1249
  266. data/ext/libarchive-2.8.4/libarchive/archive_read_disk.c +0 -198
  267. data/ext/libarchive-2.8.4/libarchive/archive_read_disk_entry_from_file.c +0 -570
  268. data/ext/libarchive-2.8.4/libarchive/archive_read_open_filename.c +0 -272
  269. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_cpio.c +0 -777
  270. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_mtree.c +0 -1304
  271. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_zip.c +0 -903
  272. data/ext/libarchive-2.8.4/libarchive/archive_string.c +0 -453
  273. data/ext/libarchive-2.8.4/libarchive/archive_string.h +0 -148
  274. data/ext/libarchive-2.8.4/libarchive/archive_util.c +0 -391
  275. data/ext/libarchive-2.8.4/libarchive/archive_write.c +0 -466
  276. data/ext/libarchive-2.8.4/libarchive/archive_write_disk.c +0 -2628
  277. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_bzip2.c +0 -408
  278. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_gzip.c +0 -477
  279. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_none.c +0 -257
  280. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_program.c +0 -347
  281. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_xz.c +0 -438
  282. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio.c +0 -344
  283. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio_newc.c +0 -295
  284. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_mtree.c +0 -1050
  285. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_zip.c +0 -667
  286. data/ext/libarchive-2.8.4/libarchive/config_freebsd.h +0 -154
  287. data/ext/libarchive-2.8.4/libarchive/filter_fork_windows.c +0 -113
  288. data/ext/zlib-1.2.5/Makefile.in +0 -257
  289. data/ext/zlib-1.2.5/configure +0 -596
  290. data/ext/zlib-1.2.5/crc32.c +0 -442
  291. data/ext/zlib-1.2.5/crc32.h +0 -441
  292. data/ext/zlib-1.2.5/example.c +0 -565
  293. data/ext/zlib-1.2.5/gzread.c +0 -653
  294. data/ext/zlib-1.2.5/gzwrite.c +0 -531
  295. data/ext/zlib-1.2.5/minigzip.c +0 -440
  296. data/ext/zlib-1.2.5/uncompr.c +0 -59
@@ -1,777 +0,0 @@
1
- /*-
2
- * Copyright (c) 2003-2007 Tim Kientzle
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: head/lib/libarchive/archive_read_support_format_cpio.c 201163 2009-12-29 05:50:34Z kientzle $");
28
-
29
- #ifdef HAVE_ERRNO_H
30
- #include <errno.h>
31
- #endif
32
- /* #include <stdint.h> */ /* See archive_platform.h */
33
- #ifdef HAVE_STDLIB_H
34
- #include <stdlib.h>
35
- #endif
36
- #ifdef HAVE_STRING_H
37
- #include <string.h>
38
- #endif
39
-
40
- #include "archive.h"
41
- #include "archive_entry.h"
42
- #include "archive_private.h"
43
- #include "archive_read_private.h"
44
-
45
- struct cpio_bin_header {
46
- unsigned char c_magic[2];
47
- unsigned char c_dev[2];
48
- unsigned char c_ino[2];
49
- unsigned char c_mode[2];
50
- unsigned char c_uid[2];
51
- unsigned char c_gid[2];
52
- unsigned char c_nlink[2];
53
- unsigned char c_rdev[2];
54
- unsigned char c_mtime[4];
55
- unsigned char c_namesize[2];
56
- unsigned char c_filesize[4];
57
- };
58
-
59
- struct cpio_odc_header {
60
- char c_magic[6];
61
- char c_dev[6];
62
- char c_ino[6];
63
- char c_mode[6];
64
- char c_uid[6];
65
- char c_gid[6];
66
- char c_nlink[6];
67
- char c_rdev[6];
68
- char c_mtime[11];
69
- char c_namesize[6];
70
- char c_filesize[11];
71
- };
72
-
73
- struct cpio_newc_header {
74
- char c_magic[6];
75
- char c_ino[8];
76
- char c_mode[8];
77
- char c_uid[8];
78
- char c_gid[8];
79
- char c_nlink[8];
80
- char c_mtime[8];
81
- char c_filesize[8];
82
- char c_devmajor[8];
83
- char c_devminor[8];
84
- char c_rdevmajor[8];
85
- char c_rdevminor[8];
86
- char c_namesize[8];
87
- char c_crc[8];
88
- };
89
-
90
- struct links_entry {
91
- struct links_entry *next;
92
- struct links_entry *previous;
93
- int links;
94
- dev_t dev;
95
- int64_t ino;
96
- char *name;
97
- };
98
-
99
- #define CPIO_MAGIC 0x13141516
100
- struct cpio {
101
- int magic;
102
- int (*read_header)(struct archive_read *, struct cpio *,
103
- struct archive_entry *, size_t *, size_t *);
104
- struct links_entry *links_head;
105
- struct archive_string entry_name;
106
- struct archive_string entry_linkname;
107
- off_t entry_bytes_remaining;
108
- off_t entry_offset;
109
- off_t entry_padding;
110
- };
111
-
112
- static int64_t atol16(const char *, unsigned);
113
- static int64_t atol8(const char *, unsigned);
114
- static int archive_read_format_cpio_bid(struct archive_read *);
115
- static int archive_read_format_cpio_cleanup(struct archive_read *);
116
- static int archive_read_format_cpio_read_data(struct archive_read *,
117
- const void **, size_t *, off_t *);
118
- static int archive_read_format_cpio_read_header(struct archive_read *,
119
- struct archive_entry *);
120
- static int be4(const unsigned char *);
121
- static int find_odc_header(struct archive_read *);
122
- static int find_newc_header(struct archive_read *);
123
- static int header_bin_be(struct archive_read *, struct cpio *,
124
- struct archive_entry *, size_t *, size_t *);
125
- static int header_bin_le(struct archive_read *, struct cpio *,
126
- struct archive_entry *, size_t *, size_t *);
127
- static int header_newc(struct archive_read *, struct cpio *,
128
- struct archive_entry *, size_t *, size_t *);
129
- static int header_odc(struct archive_read *, struct cpio *,
130
- struct archive_entry *, size_t *, size_t *);
131
- static int is_octal(const char *, size_t);
132
- static int is_hex(const char *, size_t);
133
- static int le4(const unsigned char *);
134
- static void record_hardlink(struct cpio *cpio, struct archive_entry *entry);
135
-
136
- int
137
- archive_read_support_format_cpio(struct archive *_a)
138
- {
139
- struct archive_read *a = (struct archive_read *)_a;
140
- struct cpio *cpio;
141
- int r;
142
-
143
- cpio = (struct cpio *)malloc(sizeof(*cpio));
144
- if (cpio == NULL) {
145
- archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
146
- return (ARCHIVE_FATAL);
147
- }
148
- memset(cpio, 0, sizeof(*cpio));
149
- cpio->magic = CPIO_MAGIC;
150
-
151
- r = __archive_read_register_format(a,
152
- cpio,
153
- "cpio",
154
- archive_read_format_cpio_bid,
155
- NULL,
156
- archive_read_format_cpio_read_header,
157
- archive_read_format_cpio_read_data,
158
- NULL,
159
- archive_read_format_cpio_cleanup);
160
-
161
- if (r != ARCHIVE_OK)
162
- free(cpio);
163
- return (ARCHIVE_OK);
164
- }
165
-
166
-
167
- static int
168
- archive_read_format_cpio_bid(struct archive_read *a)
169
- {
170
- const void *h;
171
- const unsigned char *p;
172
- struct cpio *cpio;
173
- int bid;
174
-
175
- cpio = (struct cpio *)(a->format->data);
176
-
177
- if ((h = __archive_read_ahead(a, 6, NULL)) == NULL)
178
- return (-1);
179
-
180
- p = (const unsigned char *)h;
181
- bid = 0;
182
- if (memcmp(p, "070707", 6) == 0) {
183
- /* ASCII cpio archive (odc, POSIX.1) */
184
- cpio->read_header = header_odc;
185
- bid += 48;
186
- /*
187
- * XXX TODO: More verification; Could check that only octal
188
- * digits appear in appropriate header locations. XXX
189
- */
190
- } else if (memcmp(p, "070701", 6) == 0) {
191
- /* ASCII cpio archive (SVR4 without CRC) */
192
- cpio->read_header = header_newc;
193
- bid += 48;
194
- /*
195
- * XXX TODO: More verification; Could check that only hex
196
- * digits appear in appropriate header locations. XXX
197
- */
198
- } else if (memcmp(p, "070702", 6) == 0) {
199
- /* ASCII cpio archive (SVR4 with CRC) */
200
- /* XXX TODO: Flag that we should check the CRC. XXX */
201
- cpio->read_header = header_newc;
202
- bid += 48;
203
- /*
204
- * XXX TODO: More verification; Could check that only hex
205
- * digits appear in appropriate header locations. XXX
206
- */
207
- } else if (p[0] * 256 + p[1] == 070707) {
208
- /* big-endian binary cpio archives */
209
- cpio->read_header = header_bin_be;
210
- bid += 16;
211
- /* Is more verification possible here? */
212
- } else if (p[0] + p[1] * 256 == 070707) {
213
- /* little-endian binary cpio archives */
214
- cpio->read_header = header_bin_le;
215
- bid += 16;
216
- /* Is more verification possible here? */
217
- } else
218
- return (ARCHIVE_WARN);
219
-
220
- return (bid);
221
- }
222
-
223
- static int
224
- archive_read_format_cpio_read_header(struct archive_read *a,
225
- struct archive_entry *entry)
226
- {
227
- struct cpio *cpio;
228
- const void *h;
229
- size_t namelength;
230
- size_t name_pad;
231
- int r;
232
-
233
- cpio = (struct cpio *)(a->format->data);
234
- r = (cpio->read_header(a, cpio, entry, &namelength, &name_pad));
235
-
236
- if (r < ARCHIVE_WARN)
237
- return (r);
238
-
239
- /* Read name from buffer. */
240
- h = __archive_read_ahead(a, namelength + name_pad, NULL);
241
- if (h == NULL)
242
- return (ARCHIVE_FATAL);
243
- __archive_read_consume(a, namelength + name_pad);
244
- archive_strncpy(&cpio->entry_name, (const char *)h, namelength);
245
- archive_entry_set_pathname(entry, cpio->entry_name.s);
246
- cpio->entry_offset = 0;
247
-
248
- /* If this is a symlink, read the link contents. */
249
- if (archive_entry_filetype(entry) == AE_IFLNK) {
250
- h = __archive_read_ahead(a, cpio->entry_bytes_remaining, NULL);
251
- if (h == NULL)
252
- return (ARCHIVE_FATAL);
253
- __archive_read_consume(a, cpio->entry_bytes_remaining);
254
- archive_strncpy(&cpio->entry_linkname, (const char *)h,
255
- cpio->entry_bytes_remaining);
256
- archive_entry_set_symlink(entry, cpio->entry_linkname.s);
257
- cpio->entry_bytes_remaining = 0;
258
- }
259
-
260
- /* XXX TODO: If the full mode is 0160200, then this is a Solaris
261
- * ACL description for the following entry. Read this body
262
- * and parse it as a Solaris-style ACL, then read the next
263
- * header. XXX */
264
-
265
- /* Compare name to "TRAILER!!!" to test for end-of-archive. */
266
- if (namelength == 11 && strcmp((const char *)h, "TRAILER!!!") == 0) {
267
- /* TODO: Store file location of start of block. */
268
- archive_set_error(&a->archive, 0, NULL);
269
- return (ARCHIVE_EOF);
270
- }
271
-
272
- /* Detect and record hardlinks to previously-extracted entries. */
273
- record_hardlink(cpio, entry);
274
-
275
- return (r);
276
- }
277
-
278
- static int
279
- archive_read_format_cpio_read_data(struct archive_read *a,
280
- const void **buff, size_t *size, off_t *offset)
281
- {
282
- ssize_t bytes_read;
283
- struct cpio *cpio;
284
-
285
- cpio = (struct cpio *)(a->format->data);
286
- if (cpio->entry_bytes_remaining > 0) {
287
- *buff = __archive_read_ahead(a, 1, &bytes_read);
288
- if (bytes_read <= 0)
289
- return (ARCHIVE_FATAL);
290
- if (bytes_read > cpio->entry_bytes_remaining)
291
- bytes_read = cpio->entry_bytes_remaining;
292
- *size = bytes_read;
293
- *offset = cpio->entry_offset;
294
- cpio->entry_offset += bytes_read;
295
- cpio->entry_bytes_remaining -= bytes_read;
296
- __archive_read_consume(a, bytes_read);
297
- return (ARCHIVE_OK);
298
- } else {
299
- while (cpio->entry_padding > 0) {
300
- *buff = __archive_read_ahead(a, 1, &bytes_read);
301
- if (bytes_read <= 0)
302
- return (ARCHIVE_FATAL);
303
- if (bytes_read > cpio->entry_padding)
304
- bytes_read = cpio->entry_padding;
305
- __archive_read_consume(a, bytes_read);
306
- cpio->entry_padding -= bytes_read;
307
- }
308
- *buff = NULL;
309
- *size = 0;
310
- *offset = cpio->entry_offset;
311
- return (ARCHIVE_EOF);
312
- }
313
- }
314
-
315
- /*
316
- * Skip forward to the next cpio newc header by searching for the
317
- * 07070[12] string. This should be generalized and merged with
318
- * find_odc_header below.
319
- */
320
- static int
321
- is_hex(const char *p, size_t len)
322
- {
323
- while (len-- > 0) {
324
- if ((*p >= '0' && *p <= '9')
325
- || (*p >= 'a' && *p <= 'f')
326
- || (*p >= 'A' && *p <= 'F'))
327
- ++p;
328
- else
329
- return (0);
330
- }
331
- return (1);
332
- }
333
-
334
- static int
335
- find_newc_header(struct archive_read *a)
336
- {
337
- const void *h;
338
- const char *p, *q;
339
- size_t skip, skipped = 0;
340
- ssize_t bytes;
341
-
342
- for (;;) {
343
- h = __archive_read_ahead(a, sizeof(struct cpio_newc_header), &bytes);
344
- if (h == NULL)
345
- return (ARCHIVE_FATAL);
346
- p = h;
347
- q = p + bytes;
348
-
349
- /* Try the typical case first, then go into the slow search.*/
350
- if (memcmp("07070", p, 5) == 0
351
- && (p[5] == '1' || p[5] == '2')
352
- && is_hex(p, sizeof(struct cpio_newc_header)))
353
- return (ARCHIVE_OK);
354
-
355
- /*
356
- * Scan ahead until we find something that looks
357
- * like an odc header.
358
- */
359
- while (p + sizeof(struct cpio_newc_header) <= q) {
360
- switch (p[5]) {
361
- case '1':
362
- case '2':
363
- if (memcmp("07070", p, 5) == 0
364
- && is_hex(p, sizeof(struct cpio_newc_header))) {
365
- skip = p - (const char *)h;
366
- __archive_read_consume(a, skip);
367
- skipped += skip;
368
- if (skipped > 0) {
369
- archive_set_error(&a->archive,
370
- 0,
371
- "Skipped %d bytes before "
372
- "finding valid header",
373
- (int)skipped);
374
- return (ARCHIVE_WARN);
375
- }
376
- return (ARCHIVE_OK);
377
- }
378
- p += 2;
379
- break;
380
- case '0':
381
- p++;
382
- break;
383
- default:
384
- p += 6;
385
- break;
386
- }
387
- }
388
- skip = p - (const char *)h;
389
- __archive_read_consume(a, skip);
390
- skipped += skip;
391
- }
392
- }
393
-
394
- static int
395
- header_newc(struct archive_read *a, struct cpio *cpio,
396
- struct archive_entry *entry, size_t *namelength, size_t *name_pad)
397
- {
398
- const void *h;
399
- const struct cpio_newc_header *header;
400
- int r;
401
-
402
- r = find_newc_header(a);
403
- if (r < ARCHIVE_WARN)
404
- return (r);
405
-
406
- /* Read fixed-size portion of header. */
407
- h = __archive_read_ahead(a, sizeof(struct cpio_newc_header), NULL);
408
- if (h == NULL)
409
- return (ARCHIVE_FATAL);
410
- __archive_read_consume(a, sizeof(struct cpio_newc_header));
411
-
412
- /* Parse out hex fields. */
413
- header = (const struct cpio_newc_header *)h;
414
-
415
- if (memcmp(header->c_magic, "070701", 6) == 0) {
416
- a->archive.archive_format = ARCHIVE_FORMAT_CPIO_SVR4_NOCRC;
417
- a->archive.archive_format_name = "ASCII cpio (SVR4 with no CRC)";
418
- } else if (memcmp(header->c_magic, "070702", 6) == 0) {
419
- a->archive.archive_format = ARCHIVE_FORMAT_CPIO_SVR4_CRC;
420
- a->archive.archive_format_name = "ASCII cpio (SVR4 with CRC)";
421
- } else {
422
- /* TODO: Abort here? */
423
- }
424
-
425
- archive_entry_set_devmajor(entry, atol16(header->c_devmajor, sizeof(header->c_devmajor)));
426
- archive_entry_set_devminor(entry, atol16(header->c_devminor, sizeof(header->c_devminor)));
427
- archive_entry_set_ino(entry, atol16(header->c_ino, sizeof(header->c_ino)));
428
- archive_entry_set_mode(entry, atol16(header->c_mode, sizeof(header->c_mode)));
429
- archive_entry_set_uid(entry, atol16(header->c_uid, sizeof(header->c_uid)));
430
- archive_entry_set_gid(entry, atol16(header->c_gid, sizeof(header->c_gid)));
431
- archive_entry_set_nlink(entry, atol16(header->c_nlink, sizeof(header->c_nlink)));
432
- archive_entry_set_rdevmajor(entry, atol16(header->c_rdevmajor, sizeof(header->c_rdevmajor)));
433
- archive_entry_set_rdevminor(entry, atol16(header->c_rdevminor, sizeof(header->c_rdevminor)));
434
- archive_entry_set_mtime(entry, atol16(header->c_mtime, sizeof(header->c_mtime)), 0);
435
- *namelength = atol16(header->c_namesize, sizeof(header->c_namesize));
436
- /* Pad name to 2 more than a multiple of 4. */
437
- *name_pad = (2 - *namelength) & 3;
438
-
439
- /*
440
- * Note: entry_bytes_remaining is at least 64 bits and
441
- * therefore guaranteed to be big enough for a 33-bit file
442
- * size.
443
- */
444
- cpio->entry_bytes_remaining =
445
- atol16(header->c_filesize, sizeof(header->c_filesize));
446
- archive_entry_set_size(entry, cpio->entry_bytes_remaining);
447
- /* Pad file contents to a multiple of 4. */
448
- cpio->entry_padding = 3 & -cpio->entry_bytes_remaining;
449
- return (r);
450
- }
451
-
452
- /*
453
- * Skip forward to the next cpio odc header by searching for the
454
- * 070707 string. This is a hand-optimized search that could
455
- * probably be easily generalized to handle all character-based
456
- * cpio variants.
457
- */
458
- static int
459
- is_octal(const char *p, size_t len)
460
- {
461
- while (len-- > 0) {
462
- if (*p < '0' || *p > '7')
463
- return (0);
464
- ++p;
465
- }
466
- return (1);
467
- }
468
-
469
- static int
470
- find_odc_header(struct archive_read *a)
471
- {
472
- const void *h;
473
- const char *p, *q;
474
- size_t skip, skipped = 0;
475
- ssize_t bytes;
476
-
477
- for (;;) {
478
- h = __archive_read_ahead(a, sizeof(struct cpio_odc_header), &bytes);
479
- if (h == NULL)
480
- return (ARCHIVE_FATAL);
481
- p = h;
482
- q = p + bytes;
483
-
484
- /* Try the typical case first, then go into the slow search.*/
485
- if (memcmp("070707", p, 6) == 0
486
- && is_octal(p, sizeof(struct cpio_odc_header)))
487
- return (ARCHIVE_OK);
488
-
489
- /*
490
- * Scan ahead until we find something that looks
491
- * like an odc header.
492
- */
493
- while (p + sizeof(struct cpio_odc_header) <= q) {
494
- switch (p[5]) {
495
- case '7':
496
- if (memcmp("070707", p, 6) == 0
497
- && is_octal(p, sizeof(struct cpio_odc_header))) {
498
- skip = p - (const char *)h;
499
- __archive_read_consume(a, skip);
500
- skipped += skip;
501
- if (skipped > 0) {
502
- archive_set_error(&a->archive,
503
- 0,
504
- "Skipped %d bytes before "
505
- "finding valid header",
506
- (int)skipped);
507
- return (ARCHIVE_WARN);
508
- }
509
- return (ARCHIVE_OK);
510
- }
511
- p += 2;
512
- break;
513
- case '0':
514
- p++;
515
- break;
516
- default:
517
- p += 6;
518
- break;
519
- }
520
- }
521
- skip = p - (const char *)h;
522
- __archive_read_consume(a, skip);
523
- skipped += skip;
524
- }
525
- }
526
-
527
- static int
528
- header_odc(struct archive_read *a, struct cpio *cpio,
529
- struct archive_entry *entry, size_t *namelength, size_t *name_pad)
530
- {
531
- const void *h;
532
- int r;
533
- const struct cpio_odc_header *header;
534
-
535
- a->archive.archive_format = ARCHIVE_FORMAT_CPIO_POSIX;
536
- a->archive.archive_format_name = "POSIX octet-oriented cpio";
537
-
538
- /* Find the start of the next header. */
539
- r = find_odc_header(a);
540
- if (r < ARCHIVE_WARN)
541
- return (r);
542
-
543
- /* Read fixed-size portion of header. */
544
- h = __archive_read_ahead(a, sizeof(struct cpio_odc_header), NULL);
545
- if (h == NULL)
546
- return (ARCHIVE_FATAL);
547
- __archive_read_consume(a, sizeof(struct cpio_odc_header));
548
-
549
- /* Parse out octal fields. */
550
- header = (const struct cpio_odc_header *)h;
551
-
552
- archive_entry_set_dev(entry, atol8(header->c_dev, sizeof(header->c_dev)));
553
- archive_entry_set_ino(entry, atol8(header->c_ino, sizeof(header->c_ino)));
554
- archive_entry_set_mode(entry, atol8(header->c_mode, sizeof(header->c_mode)));
555
- archive_entry_set_uid(entry, atol8(header->c_uid, sizeof(header->c_uid)));
556
- archive_entry_set_gid(entry, atol8(header->c_gid, sizeof(header->c_gid)));
557
- archive_entry_set_nlink(entry, atol8(header->c_nlink, sizeof(header->c_nlink)));
558
- archive_entry_set_rdev(entry, atol8(header->c_rdev, sizeof(header->c_rdev)));
559
- archive_entry_set_mtime(entry, atol8(header->c_mtime, sizeof(header->c_mtime)), 0);
560
- *namelength = atol8(header->c_namesize, sizeof(header->c_namesize));
561
- *name_pad = 0; /* No padding of filename. */
562
-
563
- /*
564
- * Note: entry_bytes_remaining is at least 64 bits and
565
- * therefore guaranteed to be big enough for a 33-bit file
566
- * size.
567
- */
568
- cpio->entry_bytes_remaining =
569
- atol8(header->c_filesize, sizeof(header->c_filesize));
570
- archive_entry_set_size(entry, cpio->entry_bytes_remaining);
571
- cpio->entry_padding = 0;
572
- return (r);
573
- }
574
-
575
- static int
576
- header_bin_le(struct archive_read *a, struct cpio *cpio,
577
- struct archive_entry *entry, size_t *namelength, size_t *name_pad)
578
- {
579
- const void *h;
580
- const struct cpio_bin_header *header;
581
-
582
- a->archive.archive_format = ARCHIVE_FORMAT_CPIO_BIN_LE;
583
- a->archive.archive_format_name = "cpio (little-endian binary)";
584
-
585
- /* Read fixed-size portion of header. */
586
- h = __archive_read_ahead(a, sizeof(struct cpio_bin_header), NULL);
587
- if (h == NULL)
588
- return (ARCHIVE_FATAL);
589
- __archive_read_consume(a, sizeof(struct cpio_bin_header));
590
-
591
- /* Parse out binary fields. */
592
- header = (const struct cpio_bin_header *)h;
593
-
594
- archive_entry_set_dev(entry, header->c_dev[0] + header->c_dev[1] * 256);
595
- archive_entry_set_ino(entry, header->c_ino[0] + header->c_ino[1] * 256);
596
- archive_entry_set_mode(entry, header->c_mode[0] + header->c_mode[1] * 256);
597
- archive_entry_set_uid(entry, header->c_uid[0] + header->c_uid[1] * 256);
598
- archive_entry_set_gid(entry, header->c_gid[0] + header->c_gid[1] * 256);
599
- archive_entry_set_nlink(entry, header->c_nlink[0] + header->c_nlink[1] * 256);
600
- archive_entry_set_rdev(entry, header->c_rdev[0] + header->c_rdev[1] * 256);
601
- archive_entry_set_mtime(entry, le4(header->c_mtime), 0);
602
- *namelength = header->c_namesize[0] + header->c_namesize[1] * 256;
603
- *name_pad = *namelength & 1; /* Pad to even. */
604
-
605
- cpio->entry_bytes_remaining = le4(header->c_filesize);
606
- archive_entry_set_size(entry, cpio->entry_bytes_remaining);
607
- cpio->entry_padding = cpio->entry_bytes_remaining & 1; /* Pad to even. */
608
- return (ARCHIVE_OK);
609
- }
610
-
611
- static int
612
- header_bin_be(struct archive_read *a, struct cpio *cpio,
613
- struct archive_entry *entry, size_t *namelength, size_t *name_pad)
614
- {
615
- const void *h;
616
- const struct cpio_bin_header *header;
617
-
618
- a->archive.archive_format = ARCHIVE_FORMAT_CPIO_BIN_BE;
619
- a->archive.archive_format_name = "cpio (big-endian binary)";
620
-
621
- /* Read fixed-size portion of header. */
622
- h = __archive_read_ahead(a, sizeof(struct cpio_bin_header), NULL);
623
- if (h == NULL)
624
- return (ARCHIVE_FATAL);
625
- __archive_read_consume(a, sizeof(struct cpio_bin_header));
626
-
627
- /* Parse out binary fields. */
628
- header = (const struct cpio_bin_header *)h;
629
- archive_entry_set_dev(entry, header->c_dev[0] * 256 + header->c_dev[1]);
630
- archive_entry_set_ino(entry, header->c_ino[0] * 256 + header->c_ino[1]);
631
- archive_entry_set_mode(entry, header->c_mode[0] * 256 + header->c_mode[1]);
632
- archive_entry_set_uid(entry, header->c_uid[0] * 256 + header->c_uid[1]);
633
- archive_entry_set_gid(entry, header->c_gid[0] * 256 + header->c_gid[1]);
634
- archive_entry_set_nlink(entry, header->c_nlink[0] * 256 + header->c_nlink[1]);
635
- archive_entry_set_rdev(entry, header->c_rdev[0] * 256 + header->c_rdev[1]);
636
- archive_entry_set_mtime(entry, be4(header->c_mtime), 0);
637
- *namelength = header->c_namesize[0] * 256 + header->c_namesize[1];
638
- *name_pad = *namelength & 1; /* Pad to even. */
639
-
640
- cpio->entry_bytes_remaining = be4(header->c_filesize);
641
- archive_entry_set_size(entry, cpio->entry_bytes_remaining);
642
- cpio->entry_padding = cpio->entry_bytes_remaining & 1; /* Pad to even. */
643
- return (ARCHIVE_OK);
644
- }
645
-
646
- static int
647
- archive_read_format_cpio_cleanup(struct archive_read *a)
648
- {
649
- struct cpio *cpio;
650
-
651
- cpio = (struct cpio *)(a->format->data);
652
- /* Free inode->name map */
653
- while (cpio->links_head != NULL) {
654
- struct links_entry *lp = cpio->links_head->next;
655
-
656
- if (cpio->links_head->name)
657
- free(cpio->links_head->name);
658
- free(cpio->links_head);
659
- cpio->links_head = lp;
660
- }
661
- archive_string_free(&cpio->entry_name);
662
- free(cpio);
663
- (a->format->data) = NULL;
664
- return (ARCHIVE_OK);
665
- }
666
-
667
- static int
668
- le4(const unsigned char *p)
669
- {
670
- return ((p[0]<<16) + (p[1]<<24) + (p[2]<<0) + (p[3]<<8));
671
- }
672
-
673
-
674
- static int
675
- be4(const unsigned char *p)
676
- {
677
- return ((p[0]<<24) + (p[1]<<16) + (p[2]<<8) + (p[3]));
678
- }
679
-
680
- /*
681
- * Note that this implementation does not (and should not!) obey
682
- * locale settings; you cannot simply substitute strtol here, since
683
- * it does obey locale.
684
- */
685
- static int64_t
686
- atol8(const char *p, unsigned char_cnt)
687
- {
688
- int64_t l;
689
- int digit;
690
-
691
- l = 0;
692
- while (char_cnt-- > 0) {
693
- if (*p >= '0' && *p <= '7')
694
- digit = *p - '0';
695
- else
696
- return (l);
697
- p++;
698
- l <<= 3;
699
- l |= digit;
700
- }
701
- return (l);
702
- }
703
-
704
- static int64_t
705
- atol16(const char *p, unsigned char_cnt)
706
- {
707
- int64_t l;
708
- int digit;
709
-
710
- l = 0;
711
- while (char_cnt-- > 0) {
712
- if (*p >= 'a' && *p <= 'f')
713
- digit = *p - 'a' + 10;
714
- else if (*p >= 'A' && *p <= 'F')
715
- digit = *p - 'A' + 10;
716
- else if (*p >= '0' && *p <= '9')
717
- digit = *p - '0';
718
- else
719
- return (l);
720
- p++;
721
- l <<= 4;
722
- l |= digit;
723
- }
724
- return (l);
725
- }
726
-
727
- static void
728
- record_hardlink(struct cpio *cpio, struct archive_entry *entry)
729
- {
730
- struct links_entry *le;
731
- dev_t dev;
732
- int64_t ino;
733
-
734
- if (archive_entry_nlink(entry) <= 1)
735
- return;
736
-
737
- dev = archive_entry_dev(entry);
738
- ino = archive_entry_ino64(entry);
739
-
740
- /*
741
- * First look in the list of multiply-linked files. If we've
742
- * already dumped it, convert this entry to a hard link entry.
743
- */
744
- for (le = cpio->links_head; le; le = le->next) {
745
- if (le->dev == dev && le->ino == ino) {
746
- archive_entry_copy_hardlink(entry, le->name);
747
-
748
- if (--le->links <= 0) {
749
- if (le->previous != NULL)
750
- le->previous->next = le->next;
751
- if (le->next != NULL)
752
- le->next->previous = le->previous;
753
- if (cpio->links_head == le)
754
- cpio->links_head = le->next;
755
- free(le->name);
756
- free(le);
757
- }
758
-
759
- return;
760
- }
761
- }
762
-
763
- le = (struct links_entry *)malloc(sizeof(struct links_entry));
764
- if (le == NULL)
765
- __archive_errx(1, "Out of memory adding file to list");
766
- if (cpio->links_head != NULL)
767
- cpio->links_head->previous = le;
768
- le->next = cpio->links_head;
769
- le->previous = NULL;
770
- cpio->links_head = le;
771
- le->dev = dev;
772
- le->ino = ino;
773
- le->links = archive_entry_nlink(entry) - 1;
774
- le->name = strdup(archive_entry_pathname(entry));
775
- if (le->name == NULL)
776
- __archive_errx(1, "Out of memory adding file to list");
777
- }