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,344 +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_write_set_format_cpio.c 201170 2009-12-29 06:34:23Z kientzle $");
28
-
29
- #ifdef HAVE_ERRNO_H
30
- #include <errno.h>
31
- #endif
32
- #include <stdio.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_write_private.h"
44
-
45
- static ssize_t archive_write_cpio_data(struct archive_write *,
46
- const void *buff, size_t s);
47
- static int archive_write_cpio_finish(struct archive_write *);
48
- static int archive_write_cpio_destroy(struct archive_write *);
49
- static int archive_write_cpio_finish_entry(struct archive_write *);
50
- static int archive_write_cpio_header(struct archive_write *,
51
- struct archive_entry *);
52
- static int format_octal(int64_t, void *, int);
53
- static int64_t format_octal_recursive(int64_t, char *, int);
54
-
55
- struct cpio {
56
- uint64_t entry_bytes_remaining;
57
-
58
- int64_t ino_next;
59
-
60
- struct { int64_t old; int new;} *ino_list;
61
- size_t ino_list_size;
62
- size_t ino_list_next;
63
- };
64
-
65
- struct cpio_header {
66
- char c_magic[6];
67
- char c_dev[6];
68
- char c_ino[6];
69
- char c_mode[6];
70
- char c_uid[6];
71
- char c_gid[6];
72
- char c_nlink[6];
73
- char c_rdev[6];
74
- char c_mtime[11];
75
- char c_namesize[6];
76
- char c_filesize[11];
77
- };
78
-
79
- /*
80
- * Set output format to 'cpio' format.
81
- */
82
- int
83
- archive_write_set_format_cpio(struct archive *_a)
84
- {
85
- struct archive_write *a = (struct archive_write *)_a;
86
- struct cpio *cpio;
87
-
88
- /* If someone else was already registered, unregister them. */
89
- if (a->format_destroy != NULL)
90
- (a->format_destroy)(a);
91
-
92
- cpio = (struct cpio *)malloc(sizeof(*cpio));
93
- if (cpio == NULL) {
94
- archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
95
- return (ARCHIVE_FATAL);
96
- }
97
- memset(cpio, 0, sizeof(*cpio));
98
- a->format_data = cpio;
99
-
100
- a->pad_uncompressed = 1;
101
- a->format_name = "cpio";
102
- a->format_write_header = archive_write_cpio_header;
103
- a->format_write_data = archive_write_cpio_data;
104
- a->format_finish_entry = archive_write_cpio_finish_entry;
105
- a->format_finish = archive_write_cpio_finish;
106
- a->format_destroy = archive_write_cpio_destroy;
107
- a->archive.archive_format = ARCHIVE_FORMAT_CPIO_POSIX;
108
- a->archive.archive_format_name = "POSIX cpio";
109
- return (ARCHIVE_OK);
110
- }
111
-
112
- /*
113
- * Ino values are as long as 64 bits on some systems; cpio format
114
- * only allows 18 bits and relies on the ino values to identify hardlinked
115
- * files. So, we can't merely "hash" the ino numbers since collisions
116
- * would corrupt the archive. Instead, we generate synthetic ino values
117
- * to store in the archive and maintain a map of original ino values to
118
- * synthetic ones so we can preserve hardlink information.
119
- *
120
- * TODO: Make this more efficient. It's not as bad as it looks (most
121
- * files don't have any hardlinks and we don't do any work here for those),
122
- * but it wouldn't be hard to do better.
123
- *
124
- * TODO: Work with dev/ino pairs here instead of just ino values.
125
- */
126
- static int
127
- synthesize_ino_value(struct cpio *cpio, struct archive_entry *entry)
128
- {
129
- int64_t ino = archive_entry_ino64(entry);
130
- int ino_new;
131
- size_t i;
132
-
133
- /*
134
- * If no index number was given, don't assign one. In
135
- * particular, this handles the end-of-archive marker
136
- * correctly by giving it a zero index value. (This is also
137
- * why we start our synthetic index numbers with one below.)
138
- */
139
- if (ino == 0)
140
- return (0);
141
-
142
- /* Don't store a mapping if we don't need to. */
143
- if (archive_entry_nlink(entry) < 2) {
144
- return ++cpio->ino_next;
145
- }
146
-
147
- /* Look up old ino; if we have it, this is a hardlink
148
- * and we reuse the same value. */
149
- for (i = 0; i < cpio->ino_list_next; ++i) {
150
- if (cpio->ino_list[i].old == ino)
151
- return (cpio->ino_list[i].new);
152
- }
153
-
154
- /* Assign a new index number. */
155
- ino_new = ++cpio->ino_next;
156
-
157
- /* Ensure space for the new mapping. */
158
- if (cpio->ino_list_size <= cpio->ino_list_next) {
159
- size_t newsize = cpio->ino_list_size < 512
160
- ? 512 : cpio->ino_list_size * 2;
161
- void *newlist = realloc(cpio->ino_list,
162
- sizeof(cpio->ino_list[0]) * newsize);
163
- if (newlist == NULL)
164
- return (-1);
165
-
166
- cpio->ino_list_size = newsize;
167
- cpio->ino_list = newlist;
168
- }
169
-
170
- /* Record and return the new value. */
171
- cpio->ino_list[cpio->ino_list_next].old = ino;
172
- cpio->ino_list[cpio->ino_list_next].new = ino_new;
173
- ++cpio->ino_list_next;
174
- return (ino_new);
175
- }
176
-
177
- static int
178
- archive_write_cpio_header(struct archive_write *a, struct archive_entry *entry)
179
- {
180
- struct cpio *cpio;
181
- const char *p, *path;
182
- int pathlength, ret, ret2;
183
- int64_t ino;
184
- struct cpio_header h;
185
-
186
- cpio = (struct cpio *)a->format_data;
187
- ret2 = ARCHIVE_OK;
188
-
189
- path = archive_entry_pathname(entry);
190
- pathlength = (int)strlen(path) + 1; /* Include trailing null. */
191
-
192
- memset(&h, 0, sizeof(h));
193
- format_octal(070707, &h.c_magic, sizeof(h.c_magic));
194
- format_octal(archive_entry_dev(entry), &h.c_dev, sizeof(h.c_dev));
195
-
196
- ino = synthesize_ino_value(cpio, entry);
197
- if (ino < 0) {
198
- archive_set_error(&a->archive, ENOMEM,
199
- "No memory for ino translation table");
200
- return (ARCHIVE_FATAL);
201
- } else if (ino > 0777777) {
202
- archive_set_error(&a->archive, ERANGE,
203
- "Too many files for this cpio format");
204
- return (ARCHIVE_FATAL);
205
- }
206
- format_octal(ino & 0777777, &h.c_ino, sizeof(h.c_ino));
207
-
208
- format_octal(archive_entry_mode(entry), &h.c_mode, sizeof(h.c_mode));
209
- format_octal(archive_entry_uid(entry), &h.c_uid, sizeof(h.c_uid));
210
- format_octal(archive_entry_gid(entry), &h.c_gid, sizeof(h.c_gid));
211
- format_octal(archive_entry_nlink(entry), &h.c_nlink, sizeof(h.c_nlink));
212
- if (archive_entry_filetype(entry) == AE_IFBLK
213
- || archive_entry_filetype(entry) == AE_IFCHR)
214
- format_octal(archive_entry_dev(entry), &h.c_rdev, sizeof(h.c_rdev));
215
- else
216
- format_octal(0, &h.c_rdev, sizeof(h.c_rdev));
217
- format_octal(archive_entry_mtime(entry), &h.c_mtime, sizeof(h.c_mtime));
218
- format_octal(pathlength, &h.c_namesize, sizeof(h.c_namesize));
219
-
220
- /* Non-regular files don't store bodies. */
221
- if (archive_entry_filetype(entry) != AE_IFREG)
222
- archive_entry_set_size(entry, 0);
223
-
224
- /* Symlinks get the link written as the body of the entry. */
225
- p = archive_entry_symlink(entry);
226
- if (p != NULL && *p != '\0')
227
- format_octal(strlen(p), &h.c_filesize, sizeof(h.c_filesize));
228
- else
229
- format_octal(archive_entry_size(entry),
230
- &h.c_filesize, sizeof(h.c_filesize));
231
-
232
- ret = (a->compressor.write)(a, &h, sizeof(h));
233
- if (ret != ARCHIVE_OK)
234
- return (ARCHIVE_FATAL);
235
-
236
- ret = (a->compressor.write)(a, path, pathlength);
237
- if (ret != ARCHIVE_OK)
238
- return (ARCHIVE_FATAL);
239
-
240
- cpio->entry_bytes_remaining = archive_entry_size(entry);
241
-
242
- /* Write the symlink now. */
243
- if (p != NULL && *p != '\0')
244
- ret = (a->compressor.write)(a, p, strlen(p));
245
-
246
- if (ret == ARCHIVE_OK)
247
- ret = ret2;
248
- return (ret);
249
- }
250
-
251
- static ssize_t
252
- archive_write_cpio_data(struct archive_write *a, const void *buff, size_t s)
253
- {
254
- struct cpio *cpio;
255
- int ret;
256
-
257
- cpio = (struct cpio *)a->format_data;
258
- if (s > cpio->entry_bytes_remaining)
259
- s = cpio->entry_bytes_remaining;
260
-
261
- ret = (a->compressor.write)(a, buff, s);
262
- cpio->entry_bytes_remaining -= s;
263
- if (ret >= 0)
264
- return (s);
265
- else
266
- return (ret);
267
- }
268
-
269
- /*
270
- * Format a number into the specified field.
271
- */
272
- static int
273
- format_octal(int64_t v, void *p, int digits)
274
- {
275
- int64_t max;
276
- int ret;
277
-
278
- max = (((int64_t)1) << (digits * 3)) - 1;
279
- if (v >= 0 && v <= max) {
280
- format_octal_recursive(v, (char *)p, digits);
281
- ret = 0;
282
- } else {
283
- format_octal_recursive(max, (char *)p, digits);
284
- ret = -1;
285
- }
286
- return (ret);
287
- }
288
-
289
- static int64_t
290
- format_octal_recursive(int64_t v, char *p, int s)
291
- {
292
- if (s == 0)
293
- return (v);
294
- v = format_octal_recursive(v, p+1, s-1);
295
- *p = '0' + (v & 7);
296
- return (v >> 3);
297
- }
298
-
299
- static int
300
- archive_write_cpio_finish(struct archive_write *a)
301
- {
302
- int er;
303
- struct archive_entry *trailer;
304
-
305
- trailer = archive_entry_new();
306
- /* nlink = 1 here for GNU cpio compat. */
307
- archive_entry_set_nlink(trailer, 1);
308
- archive_entry_set_pathname(trailer, "TRAILER!!!");
309
- er = archive_write_cpio_header(a, trailer);
310
- archive_entry_free(trailer);
311
- return (er);
312
- }
313
-
314
- static int
315
- archive_write_cpio_destroy(struct archive_write *a)
316
- {
317
- struct cpio *cpio;
318
-
319
- cpio = (struct cpio *)a->format_data;
320
- free(cpio->ino_list);
321
- free(cpio);
322
- a->format_data = NULL;
323
- return (ARCHIVE_OK);
324
- }
325
-
326
- static int
327
- archive_write_cpio_finish_entry(struct archive_write *a)
328
- {
329
- struct cpio *cpio;
330
- size_t to_write;
331
- int ret;
332
-
333
- cpio = (struct cpio *)a->format_data;
334
- ret = ARCHIVE_OK;
335
- while (cpio->entry_bytes_remaining > 0) {
336
- to_write = cpio->entry_bytes_remaining < a->null_length ?
337
- cpio->entry_bytes_remaining : a->null_length;
338
- ret = (a->compressor.write)(a, a->nulls, to_write);
339
- if (ret != ARCHIVE_OK)
340
- return (ret);
341
- cpio->entry_bytes_remaining -= to_write;
342
- }
343
- return (ret);
344
- }
@@ -1,295 +0,0 @@
1
- /*-
2
- * Copyright (c) 2003-2007 Tim Kientzle
3
- * Copyright (c) 2006 Rudolf Marek SYSGO s.r.o.
4
- * All rights reserved.
5
- *
6
- * Redistribution and use in source and binary forms, with or without
7
- * modification, are permitted provided that the following conditions
8
- * are met:
9
- * 1. Redistributions of source code must retain the above copyright
10
- * notice, this list of conditions and the following disclaimer.
11
- * 2. Redistributions in binary form must reproduce the above copyright
12
- * notice, this list of conditions and the following disclaimer in the
13
- * documentation and/or other materials provided with the distribution.
14
- *
15
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
16
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18
- * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
19
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
- */
26
-
27
- #include "archive_platform.h"
28
- __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_cpio_newc.c 201160 2009-12-29 05:41:57Z kientzle $");
29
-
30
- #ifdef HAVE_ERRNO_H
31
- #include <errno.h>
32
- #endif
33
- #include <stdio.h>
34
- #ifdef HAVE_STDLIB_H
35
- #include <stdlib.h>
36
- #endif
37
- #ifdef HAVE_STRING_H
38
- #include <string.h>
39
- #endif
40
-
41
- #include "archive.h"
42
- #include "archive_entry.h"
43
- #include "archive_private.h"
44
- #include "archive_write_private.h"
45
-
46
- static ssize_t archive_write_newc_data(struct archive_write *,
47
- const void *buff, size_t s);
48
- static int archive_write_newc_finish(struct archive_write *);
49
- static int archive_write_newc_destroy(struct archive_write *);
50
- static int archive_write_newc_finish_entry(struct archive_write *);
51
- static int archive_write_newc_header(struct archive_write *,
52
- struct archive_entry *);
53
- static int format_hex(int64_t, void *, int);
54
- static int64_t format_hex_recursive(int64_t, char *, int);
55
-
56
- struct cpio {
57
- uint64_t entry_bytes_remaining;
58
- int padding;
59
- };
60
-
61
- struct cpio_header_newc {
62
- char c_magic[6];
63
- char c_ino[8];
64
- char c_mode[8];
65
- char c_uid[8];
66
- char c_gid[8];
67
- char c_nlink[8];
68
- char c_mtime[8];
69
- char c_filesize[8];
70
- char c_devmajor[8];
71
- char c_devminor[8];
72
- char c_rdevmajor[8];
73
- char c_rdevminor[8];
74
- char c_namesize[8];
75
- char c_checksum[8];
76
- };
77
-
78
- /* Logic trick: difference between 'n' and next multiple of 4 */
79
- #define PAD4(n) (3 & (1 + ~(n)))
80
-
81
- /*
82
- * Set output format to 'cpio' format.
83
- */
84
- int
85
- archive_write_set_format_cpio_newc(struct archive *_a)
86
- {
87
- struct archive_write *a = (struct archive_write *)_a;
88
- struct cpio *cpio;
89
-
90
- /* If someone else was already registered, unregister them. */
91
- if (a->format_destroy != NULL)
92
- (a->format_destroy)(a);
93
-
94
- cpio = (struct cpio *)malloc(sizeof(*cpio));
95
- if (cpio == NULL) {
96
- archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
97
- return (ARCHIVE_FATAL);
98
- }
99
- memset(cpio, 0, sizeof(*cpio));
100
- a->format_data = cpio;
101
-
102
- a->pad_uncompressed = 1;
103
- a->format_name = "cpio";
104
- a->format_write_header = archive_write_newc_header;
105
- a->format_write_data = archive_write_newc_data;
106
- a->format_finish_entry = archive_write_newc_finish_entry;
107
- a->format_finish = archive_write_newc_finish;
108
- a->format_destroy = archive_write_newc_destroy;
109
- a->archive.archive_format = ARCHIVE_FORMAT_CPIO_SVR4_NOCRC;
110
- a->archive.archive_format_name = "SVR4 cpio nocrc";
111
- return (ARCHIVE_OK);
112
- }
113
-
114
- static int
115
- archive_write_newc_header(struct archive_write *a, struct archive_entry *entry)
116
- {
117
- int64_t ino;
118
- struct cpio *cpio;
119
- const char *p, *path;
120
- int pathlength, ret, ret2;
121
- struct cpio_header_newc h;
122
- int pad;
123
-
124
- cpio = (struct cpio *)a->format_data;
125
- ret2 = ARCHIVE_OK;
126
-
127
- path = archive_entry_pathname(entry);
128
- pathlength = (int)strlen(path) + 1; /* Include trailing null. */
129
-
130
- memset(&h, 0, sizeof(h));
131
- format_hex(0x070701, &h.c_magic, sizeof(h.c_magic));
132
- format_hex(archive_entry_devmajor(entry), &h.c_devmajor,
133
- sizeof(h.c_devmajor));
134
- format_hex(archive_entry_devminor(entry), &h.c_devminor,
135
- sizeof(h.c_devminor));
136
-
137
- ino = archive_entry_ino64(entry);
138
- if (ino > 0xffffffff) {
139
- archive_set_error(&a->archive, ERANGE,
140
- "large inode number truncated");
141
- ret2 = ARCHIVE_WARN;
142
- }
143
-
144
- format_hex(ino & 0xffffffff, &h.c_ino, sizeof(h.c_ino));
145
- format_hex(archive_entry_mode(entry), &h.c_mode, sizeof(h.c_mode));
146
- format_hex(archive_entry_uid(entry), &h.c_uid, sizeof(h.c_uid));
147
- format_hex(archive_entry_gid(entry), &h.c_gid, sizeof(h.c_gid));
148
- format_hex(archive_entry_nlink(entry), &h.c_nlink, sizeof(h.c_nlink));
149
- if (archive_entry_filetype(entry) == AE_IFBLK
150
- || archive_entry_filetype(entry) == AE_IFCHR) {
151
- format_hex(archive_entry_rdevmajor(entry), &h.c_rdevmajor, sizeof(h.c_rdevmajor));
152
- format_hex(archive_entry_rdevminor(entry), &h.c_rdevminor, sizeof(h.c_rdevminor));
153
- } else {
154
- format_hex(0, &h.c_rdevmajor, sizeof(h.c_rdevmajor));
155
- format_hex(0, &h.c_rdevminor, sizeof(h.c_rdevminor));
156
- }
157
- format_hex(archive_entry_mtime(entry), &h.c_mtime, sizeof(h.c_mtime));
158
- format_hex(pathlength, &h.c_namesize, sizeof(h.c_namesize));
159
- format_hex(0, &h.c_checksum, sizeof(h.c_checksum));
160
-
161
- /* Non-regular files don't store bodies. */
162
- if (archive_entry_filetype(entry) != AE_IFREG)
163
- archive_entry_set_size(entry, 0);
164
-
165
- /* Symlinks get the link written as the body of the entry. */
166
- p = archive_entry_symlink(entry);
167
- if (p != NULL && *p != '\0')
168
- format_hex(strlen(p), &h.c_filesize, sizeof(h.c_filesize));
169
- else
170
- format_hex(archive_entry_size(entry),
171
- &h.c_filesize, sizeof(h.c_filesize));
172
-
173
- ret = (a->compressor.write)(a, &h, sizeof(h));
174
- if (ret != ARCHIVE_OK)
175
- return (ARCHIVE_FATAL);
176
-
177
- /* Pad pathname to even length. */
178
- ret = (a->compressor.write)(a, path, pathlength);
179
- if (ret != ARCHIVE_OK)
180
- return (ARCHIVE_FATAL);
181
- pad = PAD4(pathlength + sizeof(struct cpio_header_newc));
182
- if (pad)
183
- ret = (a->compressor.write)(a, "\0\0\0", pad);
184
- if (ret != ARCHIVE_OK)
185
- return (ARCHIVE_FATAL);
186
-
187
- cpio->entry_bytes_remaining = archive_entry_size(entry);
188
- cpio->padding = PAD4(cpio->entry_bytes_remaining);
189
-
190
- /* Write the symlink now. */
191
- if (p != NULL && *p != '\0') {
192
- ret = (a->compressor.write)(a, p, strlen(p));
193
- if (ret != ARCHIVE_OK)
194
- return (ARCHIVE_FATAL);
195
- pad = PAD4(strlen(p));
196
- ret = (a->compressor.write)(a, "\0\0\0", pad);
197
- }
198
-
199
- if (ret == ARCHIVE_OK)
200
- ret = ret2;
201
- return (ret);
202
- }
203
-
204
- static ssize_t
205
- archive_write_newc_data(struct archive_write *a, const void *buff, size_t s)
206
- {
207
- struct cpio *cpio;
208
- int ret;
209
-
210
- cpio = (struct cpio *)a->format_data;
211
- if (s > cpio->entry_bytes_remaining)
212
- s = cpio->entry_bytes_remaining;
213
-
214
- ret = (a->compressor.write)(a, buff, s);
215
- cpio->entry_bytes_remaining -= s;
216
- if (ret >= 0)
217
- return (s);
218
- else
219
- return (ret);
220
- }
221
-
222
- /*
223
- * Format a number into the specified field.
224
- */
225
- static int
226
- format_hex(int64_t v, void *p, int digits)
227
- {
228
- int64_t max;
229
- int ret;
230
-
231
- max = (((int64_t)1) << (digits * 4)) - 1;
232
- if (v >= 0 && v <= max) {
233
- format_hex_recursive(v, (char *)p, digits);
234
- ret = 0;
235
- } else {
236
- format_hex_recursive(max, (char *)p, digits);
237
- ret = -1;
238
- }
239
- return (ret);
240
- }
241
-
242
- static int64_t
243
- format_hex_recursive(int64_t v, char *p, int s)
244
- {
245
- if (s == 0)
246
- return (v);
247
- v = format_hex_recursive(v, p+1, s-1);
248
- *p = "0123456789abcdef"[v & 0xf];
249
- return (v >> 4);
250
- }
251
-
252
- static int
253
- archive_write_newc_finish(struct archive_write *a)
254
- {
255
- int er;
256
- struct archive_entry *trailer;
257
-
258
- trailer = archive_entry_new();
259
- archive_entry_set_nlink(trailer, 1);
260
- archive_entry_set_pathname(trailer, "TRAILER!!!");
261
- er = archive_write_newc_header(a, trailer);
262
- archive_entry_free(trailer);
263
- return (er);
264
- }
265
-
266
- static int
267
- archive_write_newc_destroy(struct archive_write *a)
268
- {
269
- struct cpio *cpio;
270
-
271
- cpio = (struct cpio *)a->format_data;
272
- free(cpio);
273
- a->format_data = NULL;
274
- return (ARCHIVE_OK);
275
- }
276
-
277
- static int
278
- archive_write_newc_finish_entry(struct archive_write *a)
279
- {
280
- struct cpio *cpio;
281
- size_t to_write;
282
- int ret;
283
-
284
- cpio = (struct cpio *)a->format_data;
285
- while (cpio->entry_bytes_remaining > 0) {
286
- to_write = cpio->entry_bytes_remaining < a->null_length ?
287
- cpio->entry_bytes_remaining : a->null_length;
288
- ret = (a->compressor.write)(a, a->nulls, to_write);
289
- if (ret != ARCHIVE_OK)
290
- return (ret);
291
- cpio->entry_bytes_remaining -= to_write;
292
- }
293
- ret = (a->compressor.write)(a, a->nulls, cpio->padding);
294
- return (ret);
295
- }