libarchive-static 1.0.6 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. checksums.yaml +4 -4
  2. data/ext/extconf.rb +2 -9
  3. data/ext/libarchive-0.1.1/ext/archive_read_support_compression.c +6 -6
  4. data/ext/libarchive-0.1.1/ext/archive_read_support_compression.o +0 -0
  5. data/ext/libarchive-0.1.1/ext/archive_read_support_format.o +0 -0
  6. data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.c +1 -1
  7. data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.o +0 -0
  8. data/ext/libarchive-0.1.1/ext/archive_write_set_compression.c +5 -5
  9. data/ext/libarchive-0.1.1/ext/archive_write_set_compression.o +0 -0
  10. data/ext/libarchive-0.1.1/ext/config.h +23 -0
  11. data/ext/libarchive-0.1.1/ext/config.log +230 -0
  12. data/ext/libarchive-0.1.1/ext/config.status +671 -0
  13. data/ext/libarchive-0.1.1/ext/libarchive.c +1 -1
  14. data/ext/libarchive-0.1.1/ext/libarchive.o +0 -0
  15. data/ext/libarchive-0.1.1/ext/libarchive_archive.c +7 -7
  16. data/ext/libarchive-0.1.1/ext/libarchive_archive.o +0 -0
  17. data/ext/libarchive-0.1.1/ext/libarchive_entry.c +6 -0
  18. data/ext/libarchive-0.1.1/ext/libarchive_entry.o +0 -0
  19. data/ext/libarchive-0.1.1/ext/libarchive_reader.c +6 -4
  20. data/ext/libarchive-0.1.1/ext/libarchive_reader.o +0 -0
  21. data/ext/libarchive-0.1.1/ext/libarchive_ruby.so +0 -0
  22. data/ext/libarchive-0.1.1/ext/libarchive_win32.h +1 -1
  23. data/ext/libarchive-0.1.1/ext/libarchive_writer.c +2 -2
  24. data/ext/libarchive-0.1.1/ext/libarchive_writer.o +0 -0
  25. data/ext/libarchive-3.6.2/Makefile.in +16892 -0
  26. data/ext/libarchive-3.6.2/build/autoconf/ax_append_compile_flags.m4 +67 -0
  27. data/ext/libarchive-3.6.2/build/autoconf/ax_append_flag.m4 +71 -0
  28. data/ext/libarchive-3.6.2/build/autoconf/ax_check_compile_flag.m4 +74 -0
  29. data/ext/libarchive-3.6.2/build/autoconf/ax_require_defined.m4 +37 -0
  30. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/check_stdcall_func.m4 +0 -0
  31. data/ext/libarchive-3.6.2/build/autoconf/compile +348 -0
  32. data/ext/libarchive-3.6.2/build/autoconf/config.guess +1754 -0
  33. data/ext/libarchive-3.6.2/build/autoconf/config.rpath +696 -0
  34. data/ext/libarchive-3.6.2/build/autoconf/config.sub +1890 -0
  35. data/ext/libarchive-3.6.2/build/autoconf/depcomp +791 -0
  36. data/ext/libarchive-3.6.2/build/autoconf/iconv.m4 +271 -0
  37. data/ext/libarchive-3.6.2/build/autoconf/install-sh +541 -0
  38. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/la_uid_t.m4 +0 -0
  39. data/ext/libarchive-3.6.2/build/autoconf/lib-ld.m4 +109 -0
  40. data/ext/libarchive-3.6.2/build/autoconf/lib-link.m4 +777 -0
  41. data/ext/libarchive-3.6.2/build/autoconf/lib-prefix.m4 +224 -0
  42. data/ext/libarchive-3.6.2/build/autoconf/ltmain.sh +11251 -0
  43. data/ext/libarchive-3.6.2/build/autoconf/m4_ax_compile_check_sizeof.m4 +115 -0
  44. data/ext/libarchive-3.6.2/build/autoconf/missing +215 -0
  45. data/ext/libarchive-3.6.2/build/autoconf/test-driver +153 -0
  46. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/pkgconfig/libarchive.pc.in +4 -1
  47. data/ext/libarchive-3.6.2/config.h.in +1504 -0
  48. data/ext/libarchive-3.6.2/configure +25558 -0
  49. data/ext/libarchive-3.6.2/libarchive/archive.h +1212 -0
  50. data/ext/libarchive-3.6.2/libarchive/archive_acl.c +2097 -0
  51. data/ext/libarchive-3.6.2/libarchive/archive_acl_private.h +83 -0
  52. data/ext/libarchive-3.6.2/libarchive/archive_blake2.h +197 -0
  53. data/ext/libarchive-3.6.2/libarchive/archive_blake2_impl.h +161 -0
  54. data/ext/libarchive-3.6.2/libarchive/archive_blake2s_ref.c +369 -0
  55. data/ext/libarchive-3.6.2/libarchive/archive_blake2sp_ref.c +361 -0
  56. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_check_magic.c +63 -22
  57. data/ext/libarchive-3.6.2/libarchive/archive_cmdline.c +227 -0
  58. data/ext/libarchive-3.6.2/libarchive/archive_cmdline_private.h +47 -0
  59. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_crc32.h +17 -0
  60. data/ext/libarchive-3.6.2/libarchive/archive_cryptor.c +534 -0
  61. data/ext/libarchive-3.6.2/libarchive/archive_cryptor_private.h +188 -0
  62. data/ext/libarchive-3.6.2/libarchive/archive_digest.c +1505 -0
  63. data/ext/libarchive-3.6.2/libarchive/archive_digest_private.h +416 -0
  64. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_darwin.c +559 -0
  65. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_freebsd.c +712 -0
  66. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_linux.c +760 -0
  67. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_sunos.c +824 -0
  68. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_endian.h +48 -15
  69. data/ext/libarchive-3.6.2/libarchive/archive_entry.c +2149 -0
  70. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry.h +305 -106
  71. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_bhfi.c +5 -4
  72. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_stat.c +9 -3
  73. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_link_resolver.c +104 -62
  74. data/ext/libarchive-3.6.2/libarchive/archive_entry_locale.h +92 -0
  75. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_private.h +65 -49
  76. data/ext/libarchive-3.6.2/libarchive/archive_entry_sparse.c +156 -0
  77. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_stat.c +6 -6
  78. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_strmode.c +1 -1
  79. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_xattr.c +4 -6
  80. data/ext/libarchive-3.6.2/libarchive/archive_getdate.c +1165 -0
  81. data/ext/libarchive-3.6.2/libarchive/archive_getdate.h +39 -0
  82. data/ext/libarchive-3.6.2/libarchive/archive_hmac.c +334 -0
  83. data/ext/libarchive-3.6.2/libarchive/archive_hmac_private.h +117 -0
  84. data/ext/libarchive-3.6.2/libarchive/archive_match.c +1875 -0
  85. data/ext/libarchive-3.6.2/libarchive/archive_openssl_evp_private.h +53 -0
  86. data/ext/libarchive-3.6.2/libarchive/archive_openssl_hmac_private.h +54 -0
  87. data/ext/libarchive-3.6.2/libarchive/archive_options.c +218 -0
  88. data/ext/libarchive-3.6.2/libarchive/archive_options_private.h +51 -0
  89. data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.c +337 -0
  90. data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.h +49 -0
  91. data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.c +463 -0
  92. data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.h +52 -0
  93. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_platform.h +77 -9
  94. data/ext/libarchive-3.6.2/libarchive/archive_platform_acl.h +55 -0
  95. data/ext/libarchive-3.6.2/libarchive/archive_platform_xattr.h +47 -0
  96. data/ext/libarchive-3.6.2/libarchive/archive_ppmd7.c +1168 -0
  97. data/ext/libarchive-3.6.2/libarchive/archive_ppmd7_private.h +119 -0
  98. data/ext/libarchive-3.6.2/libarchive/archive_ppmd8.c +1287 -0
  99. data/ext/libarchive-3.6.2/libarchive/archive_ppmd8_private.h +148 -0
  100. data/ext/libarchive-3.6.2/libarchive/archive_ppmd_private.h +151 -0
  101. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_private.h +74 -18
  102. data/ext/libarchive-3.6.2/libarchive/archive_random.c +272 -0
  103. data/ext/libarchive-3.6.2/libarchive/archive_random_private.h +36 -0
  104. data/ext/libarchive-3.6.2/libarchive/archive_rb.c +709 -0
  105. data/ext/libarchive-3.6.2/libarchive/archive_rb.h +113 -0
  106. data/ext/libarchive-3.6.2/libarchive/archive_read.c +1756 -0
  107. data/ext/libarchive-3.6.2/libarchive/archive_read_add_passphrase.c +190 -0
  108. data/ext/libarchive-3.6.2/libarchive/archive_read_append_filter.c +204 -0
  109. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_data_into_fd.c +64 -18
  110. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_entry_from_file.c +1086 -0
  111. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_posix.c +2732 -0
  112. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_private.h +40 -4
  113. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_set_standard_lookup.c +21 -11
  114. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_windows.c +2479 -0
  115. data/ext/libarchive-3.6.2/libarchive/archive_read_extract.c +60 -0
  116. data/ext/{libarchive-2.8.4/libarchive/archive_read_extract.c → libarchive-3.6.2/libarchive/archive_read_extract2.c} +34 -61
  117. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_fd.c +70 -49
  118. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_file.c +38 -23
  119. data/ext/libarchive-3.6.2/libarchive/archive_read_open_filename.c +586 -0
  120. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_memory.c +58 -28
  121. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_private.h +127 -59
  122. data/ext/libarchive-3.6.2/libarchive/archive_read_set_format.c +117 -0
  123. data/ext/libarchive-3.6.2/libarchive/archive_read_set_options.c +133 -0
  124. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_all.c → libarchive-3.6.2/libarchive/archive_read_support_filter_all.c} +35 -10
  125. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_by_code.c +83 -0
  126. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_bzip2.c → libarchive-3.6.2/libarchive/archive_read_support_filter_bzip2.c} +38 -26
  127. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_compress.c → libarchive-3.6.2/libarchive/archive_read_support_filter_compress.c} +52 -44
  128. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_grzip.c +112 -0
  129. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_gzip.c → libarchive-3.6.2/libarchive/archive_read_support_filter_gzip.c} +108 -37
  130. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lrzip.c +122 -0
  131. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lz4.c +742 -0
  132. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lzop.c +499 -0
  133. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_none.c → libarchive-3.6.2/libarchive/archive_read_support_filter_none.c} +15 -3
  134. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_program.c → libarchive-3.6.2/libarchive/archive_read_support_filter_program.c} +114 -77
  135. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_rpm.c → libarchive-3.6.2/libarchive/archive_read_support_filter_rpm.c} +31 -31
  136. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_uu.c → libarchive-3.6.2/libarchive/archive_read_support_filter_uu.c} +141 -85
  137. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_xz.c → libarchive-3.6.2/libarchive/archive_read_support_filter_xz.c} +369 -284
  138. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_zstd.c +297 -0
  139. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_7zip.c +3900 -0
  140. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_all.c +89 -0
  141. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_ar.c +126 -72
  142. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_by_code.c +92 -0
  143. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cab.c +3228 -0
  144. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cpio.c +1104 -0
  145. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_empty.c +14 -11
  146. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_iso9660.c +990 -541
  147. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_lha.c +2916 -0
  148. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_mtree.c +2150 -0
  149. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar.c +3797 -0
  150. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar5.c +4251 -0
  151. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_raw.c +38 -31
  152. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_tar.c +1157 -629
  153. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_warc.c +848 -0
  154. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_xar.c +439 -258
  155. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_zip.c +4270 -0
  156. data/ext/libarchive-3.6.2/libarchive/archive_string.c +4240 -0
  157. data/ext/libarchive-3.6.2/libarchive/archive_string.h +243 -0
  158. data/ext/libarchive-3.6.2/libarchive/archive_string_composition.h +2292 -0
  159. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_string_sprintf.c +44 -16
  160. data/ext/libarchive-3.6.2/libarchive/archive_util.c +655 -0
  161. data/ext/libarchive-3.6.2/libarchive/archive_version_details.c +151 -0
  162. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_virtual.c +85 -16
  163. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.c +214 -541
  164. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.h +74 -106
  165. data/ext/libarchive-3.6.2/libarchive/archive_write.c +828 -0
  166. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter.c +72 -0
  167. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_b64encode.c +304 -0
  168. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_by_name.c +77 -0
  169. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_bzip2.c +401 -0
  170. data/ext/{libarchive-2.8.4/libarchive/archive_write_set_compression_compress.c → libarchive-3.6.2/libarchive/archive_write_add_filter_compress.c} +86 -131
  171. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_grzip.c +135 -0
  172. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_gzip.c +442 -0
  173. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lrzip.c +197 -0
  174. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lz4.c +700 -0
  175. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lzop.c +478 -0
  176. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_format_all.c → libarchive-3.6.2/libarchive/archive_write_add_filter_none.c} +11 -11
  177. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_program.c +391 -0
  178. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_uuencode.c +295 -0
  179. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_xz.c +545 -0
  180. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_zstd.c +418 -0
  181. data/ext/libarchive-3.6.2/libarchive/archive_write_disk_posix.c +4711 -0
  182. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_private.h +9 -2
  183. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_set_standard_lookup.c +30 -29
  184. data/ext/libarchive-3.6.2/libarchive/archive_write_disk_windows.c +2842 -0
  185. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_fd.c +15 -10
  186. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_file.c +15 -9
  187. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_filename.c +128 -20
  188. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_memory.c +7 -18
  189. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_private.h +72 -29
  190. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format.c +56 -3
  191. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_7zip.c +2322 -0
  192. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ar.c +54 -34
  193. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_by_name.c +20 -2
  194. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio.c +11 -0
  195. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_binary.c +610 -0
  196. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_newc.c +457 -0
  197. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_odc.c +500 -0
  198. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_filter_by_ext.c +142 -0
  199. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_gnutar.c +755 -0
  200. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_iso9660.c +8165 -0
  201. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_mtree.c +2217 -0
  202. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_pax.c +1049 -387
  203. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_private.h +42 -0
  204. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_raw.c +125 -0
  205. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_shar.c +62 -47
  206. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ustar.c +279 -108
  207. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_v7tar.c +638 -0
  208. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_warc.c +453 -0
  209. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_xar.c +3259 -0
  210. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_zip.c +1704 -0
  211. data/ext/libarchive-3.6.2/libarchive/archive_write_set_options.c +130 -0
  212. data/ext/libarchive-3.6.2/libarchive/archive_write_set_passphrase.c +95 -0
  213. data/ext/libarchive-3.6.2/libarchive/archive_xxhash.h +48 -0
  214. data/ext/libarchive-3.6.2/libarchive/config_freebsd.h +271 -0
  215. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/filter_fork.h +10 -5
  216. data/ext/{libarchive-2.8.4/libarchive/filter_fork.c → libarchive-3.6.2/libarchive/filter_fork_posix.c} +98 -19
  217. data/ext/libarchive-3.6.2/libarchive/filter_fork_windows.c +236 -0
  218. data/ext/libarchive-3.6.2/libarchive/xxhash.c +525 -0
  219. data/ext/libarchive-static-makefile +144 -80
  220. data/ext/libarchive-static-wrapper-makefile +1 -1
  221. data/ext/zlib-1.2.13/Makefile.in +404 -0
  222. data/ext/{zlib-1.2.5 → zlib-1.2.13}/adler32.c +51 -34
  223. data/ext/{zlib-1.2.5 → zlib-1.2.13}/compress.c +27 -21
  224. data/ext/zlib-1.2.13/configure +922 -0
  225. data/ext/zlib-1.2.13/crc32.c +1125 -0
  226. data/ext/zlib-1.2.13/crc32.h +9446 -0
  227. data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.c +842 -459
  228. data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.h +37 -33
  229. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzclose.c +0 -0
  230. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzguts.h +103 -16
  231. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzlib.c +155 -53
  232. data/ext/zlib-1.2.13/gzread.c +650 -0
  233. data/ext/zlib-1.2.13/gzwrite.c +677 -0
  234. data/ext/{zlib-1.2.5 → zlib-1.2.13}/infback.c +24 -12
  235. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.c +49 -66
  236. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.h +0 -0
  237. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffixed.h +3 -3
  238. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.c +209 -94
  239. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.h +9 -5
  240. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.c +24 -50
  241. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.h +1 -1
  242. data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.c +135 -198
  243. data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.h +0 -0
  244. data/ext/zlib-1.2.13/uncompr.c +93 -0
  245. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zconf.h +182 -63
  246. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zlib.h +617 -295
  247. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.c +50 -41
  248. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.h +83 -82
  249. metadata +241 -133
  250. data/ext/libarchive-0.1.1/libarchive.c +0 -1762
  251. data/ext/libarchive-2.8.4/Makefile.in +0 -7076
  252. data/ext/libarchive-2.8.4/build/autoconf/compile +0 -143
  253. data/ext/libarchive-2.8.4/build/autoconf/config.guess +0 -1502
  254. data/ext/libarchive-2.8.4/build/autoconf/config.sub +0 -1708
  255. data/ext/libarchive-2.8.4/build/autoconf/depcomp +0 -630
  256. data/ext/libarchive-2.8.4/build/autoconf/install-sh +0 -291
  257. data/ext/libarchive-2.8.4/build/autoconf/ltmain.sh +0 -8406
  258. data/ext/libarchive-2.8.4/build/autoconf/missing +0 -376
  259. data/ext/libarchive-2.8.4/config.h.in +0 -772
  260. data/ext/libarchive-2.8.4/configure +0 -17916
  261. data/ext/libarchive-2.8.4/libarchive/archive.h +0 -741
  262. data/ext/libarchive-2.8.4/libarchive/archive_entry.c +0 -2202
  263. data/ext/libarchive-2.8.4/libarchive/archive_hash.h +0 -281
  264. data/ext/libarchive-2.8.4/libarchive/archive_read.c +0 -1249
  265. data/ext/libarchive-2.8.4/libarchive/archive_read_disk.c +0 -198
  266. data/ext/libarchive-2.8.4/libarchive/archive_read_disk_entry_from_file.c +0 -570
  267. data/ext/libarchive-2.8.4/libarchive/archive_read_open_filename.c +0 -272
  268. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_cpio.c +0 -777
  269. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_mtree.c +0 -1304
  270. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_zip.c +0 -903
  271. data/ext/libarchive-2.8.4/libarchive/archive_string.c +0 -453
  272. data/ext/libarchive-2.8.4/libarchive/archive_string.h +0 -148
  273. data/ext/libarchive-2.8.4/libarchive/archive_util.c +0 -391
  274. data/ext/libarchive-2.8.4/libarchive/archive_write.c +0 -466
  275. data/ext/libarchive-2.8.4/libarchive/archive_write_disk.c +0 -2628
  276. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_bzip2.c +0 -408
  277. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_gzip.c +0 -477
  278. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_none.c +0 -257
  279. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_program.c +0 -347
  280. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_xz.c +0 -438
  281. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio.c +0 -344
  282. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio_newc.c +0 -295
  283. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_mtree.c +0 -1050
  284. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_zip.c +0 -667
  285. data/ext/libarchive-2.8.4/libarchive/config_freebsd.h +0 -154
  286. data/ext/libarchive-2.8.4/libarchive/filter_fork_windows.c +0 -113
  287. data/ext/zlib-1.2.5/Makefile.in +0 -257
  288. data/ext/zlib-1.2.5/configure +0 -596
  289. data/ext/zlib-1.2.5/crc32.c +0 -442
  290. data/ext/zlib-1.2.5/crc32.h +0 -441
  291. data/ext/zlib-1.2.5/example.c +0 -565
  292. data/ext/zlib-1.2.5/gzread.c +0 -653
  293. data/ext/zlib-1.2.5/gzwrite.c +0 -531
  294. data/ext/zlib-1.2.5/minigzip.c +0 -440
  295. data/ext/zlib-1.2.5/uncompr.c +0 -59
@@ -1,5 +1,5 @@
1
1
  /*-
2
- * Copyright (c) 2009 Michihiro NAKAJIMA
2
+ * Copyright (c) 2009-2011 Michihiro NAKAJIMA
3
3
  * Copyright (c) 2003-2007 Kees Zeelenberg
4
4
  * All rights reserved.
5
5
  *
@@ -48,7 +48,7 @@
48
48
 
49
49
  #include "archive_platform.h"
50
50
  #include "archive_private.h"
51
- #include "archive_hash.h"
51
+ #include "archive_entry.h"
52
52
  #include <ctype.h>
53
53
  #include <errno.h>
54
54
  #include <stddef.h>
@@ -56,24 +56,25 @@
56
56
  #include <sys/utime.h>
57
57
  #endif
58
58
  #include <sys/stat.h>
59
+ #include <locale.h>
59
60
  #include <process.h>
60
61
  #include <stdlib.h>
61
62
  #include <wchar.h>
62
63
  #include <windows.h>
64
+ #include <share.h>
63
65
 
64
66
  #define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
65
67
 
66
- #if defined(_MSC_VER) && _MSC_VER < 1300
67
- /* VS 6 does not provide SetFilePointerEx, so define it here. */
68
- static BOOL SetFilePointerEx(HANDLE hFile,
69
- LARGE_INTEGER liDistanceToMove,
70
- PLARGE_INTEGER lpNewFilePointer,
71
- DWORD dwMoveMethod)
68
+ #if defined(__LA_LSEEK_NEEDED)
69
+ static BOOL SetFilePointerEx_perso(HANDLE hFile,
70
+ LARGE_INTEGER liDistanceToMove,
71
+ PLARGE_INTEGER lpNewFilePointer,
72
+ DWORD dwMoveMethod)
72
73
  {
73
74
  LARGE_INTEGER li;
74
75
  li.QuadPart = liDistanceToMove.QuadPart;
75
76
  li.LowPart = SetFilePointer(
76
- hFile, li.LowPart, &li.HighPart, dwMoveMethod);
77
+ hFile, li.LowPart, &li.HighPart, dwMoveMethod);
77
78
  if(lpNewFilePointer) {
78
79
  lpNewFilePointer->QuadPart = li.QuadPart;
79
80
  }
@@ -99,9 +100,6 @@ struct ustat {
99
100
  dev_t st_rdev;
100
101
  };
101
102
 
102
- /* Local replacement for undocumented Windows CRT function. */
103
- static void la_dosmaperr(unsigned long e);
104
-
105
103
  /* Transform 64-bits ino into 32-bits by hashing.
106
104
  * You do not forget that really unique number size is 64-bits.
107
105
  */
@@ -112,7 +110,7 @@ getino(struct ustat *ub)
112
110
  ULARGE_INTEGER ino64;
113
111
  ino64.QuadPart = ub->st_ino;
114
112
  /* I don't know this hashing is correct way */
115
- return (ino64.LowPart ^ (ino64.LowPart >> INOSIZE));
113
+ return ((ino_t)(ino64.LowPart ^ (ino64.LowPart >> INOSIZE)));
116
114
  }
117
115
 
118
116
  /*
@@ -121,52 +119,63 @@ getino(struct ustat *ub)
121
119
  * characters.
122
120
  * see also http://msdn.microsoft.com/en-us/library/aa365247.aspx
123
121
  */
124
- static wchar_t *
125
- permissive_name(const char *name)
122
+ wchar_t *
123
+ __la_win_permissive_name(const char *name)
126
124
  {
127
- wchar_t *wn, *wnp;
128
- wchar_t *ws, *wsp;
129
- DWORD l, len, slen;
130
- int unc;
125
+ wchar_t *wn;
126
+ wchar_t *ws;
127
+ size_t ll;
131
128
 
132
- len = (DWORD)strlen(name);
133
- wn = malloc((len + 1) * sizeof(wchar_t));
129
+ ll = strlen(name);
130
+ wn = malloc((ll + 1) * sizeof(wchar_t));
134
131
  if (wn == NULL)
135
132
  return (NULL);
136
- l = MultiByteToWideChar(CP_ACP, 0, name, (int)len, wn, (int)len);
137
- if (l == 0) {
133
+ ll = mbstowcs(wn, name, ll);
134
+ if (ll == (size_t)-1) {
138
135
  free(wn);
139
136
  return (NULL);
140
137
  }
141
- wn[l] = L'\0';
138
+ wn[ll] = L'\0';
139
+ ws = __la_win_permissive_name_w(wn);
140
+ free(wn);
141
+ return (ws);
142
+ }
142
143
 
143
- /* Get a full path names */
144
- l = GetFullPathNameW(wn, 0, NULL, NULL);
145
- if (l == 0) {
146
- free(wn);
144
+ wchar_t *
145
+ __la_win_permissive_name_w(const wchar_t *wname)
146
+ {
147
+ wchar_t *wn, *wnp;
148
+ wchar_t *ws, *wsp;
149
+ DWORD l, len, slen;
150
+ int unc;
151
+
152
+ /* Get a full-pathname. */
153
+ l = GetFullPathNameW(wname, 0, NULL, NULL);
154
+ if (l == 0)
147
155
  return (NULL);
148
- }
156
+ /* NOTE: GetFullPathNameW has a bug that if the length of the file
157
+ * name is just 1 then it returns incomplete buffer size. Thus, we
158
+ * have to add three to the size to allocate a sufficient buffer
159
+ * size for the full-pathname of the file name. */
160
+ l += 3;
149
161
  wnp = malloc(l * sizeof(wchar_t));
150
- if (wnp == NULL) {
151
- free(wn);
162
+ if (wnp == NULL)
152
163
  return (NULL);
153
- }
154
- len = GetFullPathNameW(wn, l, wnp, NULL);
155
- free(wn);
164
+ len = GetFullPathNameW(wname, l, wnp, NULL);
156
165
  wn = wnp;
157
166
 
158
167
  if (wnp[0] == L'\\' && wnp[1] == L'\\' &&
159
168
  wnp[2] == L'?' && wnp[3] == L'\\')
160
- /* We have already permissive names. */
169
+ /* We have already a permissive name. */
161
170
  return (wn);
162
171
 
163
172
  if (wnp[0] == L'\\' && wnp[1] == L'\\' &&
164
173
  wnp[2] == L'.' && wnp[3] == L'\\') {
165
- /* Device names */
174
+ /* This is a device name */
166
175
  if (((wnp[4] >= L'a' && wnp[4] <= L'z') ||
167
176
  (wnp[4] >= L'A' && wnp[4] <= L'Z')) &&
168
177
  wnp[5] == L':' && wnp[6] == L'\\')
169
- wnp[2] = L'?';/* Not device names. */
178
+ wnp[2] = L'?';/* Not device name. */
170
179
  return (wn);
171
180
  }
172
181
 
@@ -214,6 +223,10 @@ permissive_name(const char *name)
214
223
  return (ws);
215
224
  }
216
225
 
226
+ /*
227
+ * Create a file handle.
228
+ * This can exceed MAX_PATH limitation.
229
+ */
217
230
  static HANDLE
218
231
  la_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode,
219
232
  LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition,
@@ -229,7 +242,7 @@ la_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode,
229
242
  return (handle);
230
243
  if (GetLastError() != ERROR_PATH_NOT_FOUND)
231
244
  return (handle);
232
- wpath = permissive_name(path);
245
+ wpath = __la_win_permissive_name(path);
233
246
  if (wpath == NULL)
234
247
  return (handle);
235
248
  handle = CreateFileW(wpath, dwDesiredAccess, dwShareMode,
@@ -239,299 +252,7 @@ la_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode,
239
252
  return (handle);
240
253
  }
241
254
 
242
- static void *
243
- la_GetFunctionKernel32(const char *name)
244
- {
245
- static HINSTANCE lib;
246
- static int set;
247
- if (!set) {
248
- set = 1;
249
- lib = LoadLibrary("kernel32.dll");
250
- }
251
- if (lib == NULL) {
252
- fprintf(stderr, "Can't load kernel32.dll?!\n");
253
- exit(1);
254
- }
255
- return (void *)GetProcAddress(lib, name);
256
- }
257
-
258
- static int
259
- la_CreateHardLinkW(wchar_t *linkname, wchar_t *target)
260
- {
261
- static BOOLEAN (WINAPI *f)(LPWSTR, LPWSTR, LPSECURITY_ATTRIBUTES);
262
- static int set;
263
- if (!set) {
264
- set = 1;
265
- f = la_GetFunctionKernel32("CreateHardLinkW");
266
- }
267
- return f == NULL ? 0 : (*f)(linkname, target, NULL);
268
- }
269
-
270
-
271
- /* Make a link to src called dst. */
272
- static int
273
- __link(const char *src, const char *dst)
274
- {
275
- wchar_t *wsrc, *wdst;
276
- int res, retval;
277
- DWORD attr;
278
-
279
- if (src == NULL || dst == NULL) {
280
- set_errno (EINVAL);
281
- return -1;
282
- }
283
-
284
- wsrc = permissive_name(src);
285
- wdst = permissive_name(dst);
286
- if (wsrc == NULL || wdst == NULL) {
287
- free(wsrc);
288
- free(wdst);
289
- set_errno (EINVAL);
290
- return -1;
291
- }
292
-
293
- if ((attr = GetFileAttributesW(wsrc)) != (DWORD)-1) {
294
- res = la_CreateHardLinkW(wdst, wsrc);
295
- } else {
296
- /* wsrc does not exist; try src prepend it with the dirname of wdst */
297
- wchar_t *wnewsrc, *slash;
298
- int i, n, slen, wlen;
299
-
300
- if (strlen(src) >= 3 && isalpha((unsigned char)src[0]) &&
301
- src[1] == ':' && src[2] == '\\') {
302
- /* Original src name is already full-path */
303
- retval = -1;
304
- goto exit;
305
- }
306
- if (src[0] == '\\') {
307
- /* Original src name is almost full-path
308
- * (maybe src name is without drive) */
309
- retval = -1;
310
- goto exit;
311
- }
312
-
313
- wnewsrc = malloc ((wcslen(wsrc) + wcslen(wdst) + 1) * sizeof(wchar_t));
314
- if (wnewsrc == NULL) {
315
- errno = ENOMEM;
316
- retval = -1;
317
- goto exit;
318
- }
319
- /* Copying a dirname of wdst */
320
- wcscpy(wnewsrc, wdst);
321
- slash = wcsrchr(wnewsrc, L'\\');
322
- if (slash != NULL)
323
- *++slash = L'\0';
324
- else
325
- wcscat(wnewsrc, L"\\");
326
- /* Converting multi-byte src to wide-char src */
327
- wlen = (int)wcslen(wsrc);
328
- slen = (int)strlen(src);
329
- n = MultiByteToWideChar(CP_ACP, 0, src, slen, wsrc, wlen);
330
- if (n == 0) {
331
- free (wnewsrc);
332
- retval = -1;
333
- goto exit;
334
- }
335
- for (i = 0; i < n; i++)
336
- if (wsrc[i] == L'/')
337
- wsrc[i] = L'\\';
338
- wcsncat(wnewsrc, wsrc, n);
339
- /* Check again */
340
- attr = GetFileAttributesW(wnewsrc);
341
- if (attr == (DWORD)-1 || (attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
342
- if (attr == (DWORD)-1)
343
- la_dosmaperr(GetLastError());
344
- else
345
- errno = EPERM;
346
- free (wnewsrc);
347
- retval = -1;
348
- goto exit;
349
- }
350
- res = la_CreateHardLinkW(wdst, wnewsrc);
351
- free (wnewsrc);
352
- }
353
- if (res == 0) {
354
- la_dosmaperr(GetLastError());
355
- retval = -1;
356
- } else
357
- retval = 0;
358
- exit:
359
- free(wsrc);
360
- free(wdst);
361
- return (retval);
362
- }
363
-
364
- /* Make a hard link to src called dst. */
365
- int
366
- __la_link(const char *src, const char *dst)
367
- {
368
- return __link(src, dst);
369
- }
370
-
371
- int
372
- __la_ftruncate(int fd, off_t length)
373
- {
374
- LARGE_INTEGER distance;
375
- HANDLE handle;
376
-
377
- if (fd < 0) {
378
- errno = EBADF;
379
- return (-1);
380
- }
381
- handle = (HANDLE)_get_osfhandle(fd);
382
- if (GetFileType(handle) != FILE_TYPE_DISK) {
383
- errno = EBADF;
384
- return (-1);
385
- }
386
- distance.QuadPart = length;
387
- if (!SetFilePointerEx(handle, distance, NULL, FILE_BEGIN)) {
388
- la_dosmaperr(GetLastError());
389
- return (-1);
390
- }
391
- if (!SetEndOfFile(handle)) {
392
- la_dosmaperr(GetLastError());
393
- return (-1);
394
- }
395
- return (0);
396
- }
397
-
398
- #define WINTIME(sec, usec) ((Int32x32To64(sec, 10000000) + EPOC_TIME) + (usec * 10))
399
- static int
400
- __hutimes(HANDLE handle, const struct __timeval *times)
401
- {
402
- ULARGE_INTEGER wintm;
403
- FILETIME fatime, fmtime;
404
-
405
- wintm.QuadPart = WINTIME(times[0].tv_sec, times[0].tv_usec);
406
- fatime.dwLowDateTime = wintm.LowPart;
407
- fatime.dwHighDateTime = wintm.HighPart;
408
- wintm.QuadPart = WINTIME(times[1].tv_sec, times[1].tv_usec);
409
- fmtime.dwLowDateTime = wintm.LowPart;
410
- fmtime.dwHighDateTime = wintm.HighPart;
411
- if (SetFileTime(handle, NULL, &fatime, &fmtime) == 0) {
412
- errno = EINVAL;
413
- return (-1);
414
- }
415
- return (0);
416
- }
417
-
418
- int
419
- __la_futimes(int fd, const struct __timeval *times)
420
- {
421
-
422
- return (__hutimes((HANDLE)_get_osfhandle(fd), times));
423
- }
424
-
425
- int
426
- __la_utimes(const char *name, const struct __timeval *times)
427
- {
428
- int ret;
429
- HANDLE handle;
430
-
431
- handle = la_CreateFile(name, GENERIC_READ | GENERIC_WRITE,
432
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
433
- FILE_FLAG_BACKUP_SEMANTICS, NULL);
434
- if (handle == INVALID_HANDLE_VALUE) {
435
- la_dosmaperr(GetLastError());
436
- return (-1);
437
- }
438
- ret = __hutimes(handle, times);
439
- CloseHandle(handle);
440
- return (ret);
441
- }
442
-
443
- int
444
- __la_chdir(const char *path)
445
- {
446
- wchar_t *ws;
447
- int r;
448
-
449
- r = SetCurrentDirectoryA(path);
450
- if (r == 0) {
451
- if (GetLastError() != ERROR_FILE_NOT_FOUND) {
452
- la_dosmaperr(GetLastError());
453
- return (-1);
454
- }
455
- } else
456
- return (0);
457
- ws = permissive_name(path);
458
- if (ws == NULL) {
459
- errno = EINVAL;
460
- return (-1);
461
- }
462
- r = SetCurrentDirectoryW(ws);
463
- free(ws);
464
- if (r == 0) {
465
- la_dosmaperr(GetLastError());
466
- return (-1);
467
- }
468
- return (0);
469
- }
470
-
471
- int
472
- __la_chmod(const char *path, mode_t mode)
473
- {
474
- wchar_t *ws;
475
- DWORD attr;
476
- BOOL r;
477
-
478
- ws = NULL;
479
- attr = GetFileAttributesA(path);
480
- if (attr == (DWORD)-1) {
481
- if (GetLastError() != ERROR_FILE_NOT_FOUND) {
482
- la_dosmaperr(GetLastError());
483
- return (-1);
484
- }
485
- ws = permissive_name(path);
486
- if (ws == NULL) {
487
- errno = EINVAL;
488
- return (-1);
489
- }
490
- attr = GetFileAttributesW(ws);
491
- if (attr == (DWORD)-1) {
492
- free(ws);
493
- la_dosmaperr(GetLastError());
494
- return (-1);
495
- }
496
- }
497
- if (mode & _S_IWRITE)
498
- attr &= ~FILE_ATTRIBUTE_READONLY;
499
- else
500
- attr |= FILE_ATTRIBUTE_READONLY;
501
- if (ws == NULL)
502
- r = SetFileAttributesA(path, attr);
503
- else {
504
- r = SetFileAttributesW(ws, attr);
505
- free(ws);
506
- }
507
- if (r == 0) {
508
- la_dosmaperr(GetLastError());
509
- return (-1);
510
- }
511
- return (0);
512
- }
513
-
514
- /*
515
- * This fcntl is limited implemention.
516
- */
517
- int
518
- __la_fcntl(int fd, int cmd, int val)
519
- {
520
- HANDLE handle;
521
-
522
- handle = (HANDLE)_get_osfhandle(fd);
523
- if (GetFileType(handle) == FILE_TYPE_PIPE) {
524
- if (cmd == F_SETFL && val == 0) {
525
- DWORD mode = PIPE_WAIT;
526
- if (SetNamedPipeHandleState(
527
- handle, &mode, NULL, NULL) != 0)
528
- return (0);
529
- }
530
- }
531
- errno = EINVAL;
532
- return (-1);
533
- }
534
-
255
+ #if defined(__LA_LSEEK_NEEDED)
535
256
  __int64
536
257
  __la_lseek(int fd, __int64 offset, int whence)
537
258
  {
@@ -549,7 +270,7 @@ __la_lseek(int fd, __int64 offset, int whence)
549
270
  return (-1);
550
271
  }
551
272
  distance.QuadPart = offset;
552
- if (!SetFilePointerEx(handle, distance, &newpointer, whence)) {
273
+ if (!SetFilePointerEx_perso(handle, distance, &newpointer, whence)) {
553
274
  DWORD lasterr;
554
275
 
555
276
  lasterr = GetLastError();
@@ -563,52 +284,9 @@ __la_lseek(int fd, __int64 offset, int whence)
563
284
  }
564
285
  return (newpointer.QuadPart);
565
286
  }
287
+ #endif
566
288
 
567
- int
568
- __la_mkdir(const char *path, mode_t mode)
569
- {
570
- wchar_t *ws;
571
- int r;
572
-
573
- (void)mode;/* UNUSED */
574
- r = CreateDirectoryA(path, NULL);
575
- if (r == 0) {
576
- DWORD lasterr = GetLastError();
577
- if (lasterr != ERROR_FILENAME_EXCED_RANGE &&
578
- lasterr != ERROR_PATH_NOT_FOUND) {
579
- la_dosmaperr(GetLastError());
580
- return (-1);
581
- }
582
- } else
583
- return (0);
584
- ws = permissive_name(path);
585
- if (ws == NULL) {
586
- errno = EINVAL;
587
- return (-1);
588
- }
589
- r = CreateDirectoryW(ws, NULL);
590
- free(ws);
591
- if (r == 0) {
592
- la_dosmaperr(GetLastError());
593
- return (-1);
594
- }
595
- return (0);
596
- }
597
-
598
- /* Windows' mbstowcs is differrent error handling from other unix mbstowcs.
599
- * That one is using MultiByteToWideChar function with MB_PRECOMPOSED and
600
- * MB_ERR_INVALID_CHARS flags.
601
- * This implements for only to pass libarchive_test.
602
- */
603
- size_t
604
- __la_mbstowcs(wchar_t *wcstr, const char *mbstr, size_t nwchars)
605
- {
606
-
607
- return (MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS,
608
- mbstr, (int)strlen(mbstr), wcstr,
609
- (int)nwchars));
610
- }
611
-
289
+ /* This can exceed MAX_PATH limitation. */
612
290
  int
613
291
  __la_open(const char *path, int flags, ...)
614
292
  {
@@ -623,12 +301,12 @@ __la_open(const char *path, int flags, ...)
623
301
  ws = NULL;
624
302
  if ((flags & ~O_BINARY) == O_RDONLY) {
625
303
  /*
626
- * When we open a directory, _open function returns
304
+ * When we open a directory, _open function returns
627
305
  * "Permission denied" error.
628
306
  */
629
307
  attr = GetFileAttributesA(path);
630
308
  if (attr == (DWORD)-1 && GetLastError() == ERROR_PATH_NOT_FOUND) {
631
- ws = permissive_name(path);
309
+ ws = __la_win_permissive_name(path);
632
310
  if (ws == NULL) {
633
311
  errno = EINVAL;
634
312
  return (-1);
@@ -673,7 +351,7 @@ __la_open(const char *path, int flags, ...)
673
351
  r = _open(path, flags, pmode);
674
352
  #endif
675
353
  if (r < 0 && errno == EACCES && (flags & O_CREAT) != 0) {
676
- /* simular other POSIX system action to pass a test */
354
+ /* Simulate other POSIX system action to pass our test suite. */
677
355
  attr = GetFileAttributesA(path);
678
356
  if (attr == (DWORD)-1)
679
357
  la_dosmaperr(GetLastError());
@@ -685,7 +363,7 @@ __la_open(const char *path, int flags, ...)
685
363
  }
686
364
  if (r >= 0 || errno != ENOENT)
687
365
  return (r);
688
- ws = permissive_name(path);
366
+ ws = __la_win_permissive_name(path);
689
367
  if (ws == NULL) {
690
368
  errno = EINVAL;
691
369
  return (-1);
@@ -693,7 +371,7 @@ __la_open(const char *path, int flags, ...)
693
371
  }
694
372
  r = _wopen(ws, flags, pmode);
695
373
  if (r < 0 && errno == EACCES && (flags & O_CREAT) != 0) {
696
- /* simular other POSIX system action to pass a test */
374
+ /* Simulate other POSIX system action to pass our test suite. */
697
375
  attr = GetFileAttributesW(ws);
698
376
  if (attr == (DWORD)-1)
699
377
  la_dosmaperr(GetLastError());
@@ -721,23 +399,11 @@ __la_read(int fd, void *buf, size_t nbytes)
721
399
  errno = EBADF;
722
400
  return (-1);
723
401
  }
402
+ /* Do not pass 0 to third parameter of ReadFile(), read bytes.
403
+ * This will not return to application side. */
404
+ if (nbytes == 0)
405
+ return (0);
724
406
  handle = (HANDLE)_get_osfhandle(fd);
725
- if (GetFileType(handle) == FILE_TYPE_PIPE) {
726
- DWORD sta;
727
- if (GetNamedPipeHandleState(
728
- handle, &sta, NULL, NULL, NULL, NULL, 0) != 0 &&
729
- (sta & PIPE_NOWAIT) == 0) {
730
- DWORD avail = -1;
731
- int cnt = 3;
732
-
733
- while (PeekNamedPipe(
734
- handle, NULL, 0, NULL, &avail, NULL) != 0 &&
735
- avail == 0 && --cnt)
736
- Sleep(100);
737
- if (avail == 0)
738
- return (0);
739
- }
740
- }
741
407
  r = ReadFile(handle, buf, (uint32_t)nbytes,
742
408
  &bytes_read, NULL);
743
409
  if (r == 0) {
@@ -757,29 +423,9 @@ __la_read(int fd, void *buf, size_t nbytes)
757
423
  return ((ssize_t)bytes_read);
758
424
  }
759
425
 
760
- /* Remove directory */
761
- int
762
- __la_rmdir(const char *path)
763
- {
764
- wchar_t *ws;
765
- int r;
766
-
767
- r = _rmdir(path);
768
- if (r >= 0 || errno != ENOENT)
769
- return (r);
770
- ws = permissive_name(path);
771
- if (ws == NULL) {
772
- errno = EINVAL;
773
- return (-1);
774
- }
775
- r = _wrmdir(ws);
776
- free(ws);
777
- return (r);
778
- }
779
-
780
426
  /* Convert Windows FILETIME to UTC */
781
427
  __inline static void
782
- fileTimeToUTC(const FILETIME *filetime, time_t *time, long *ns)
428
+ fileTimeToUTC(const FILETIME *filetime, time_t *t, long *ns)
783
429
  {
784
430
  ULARGE_INTEGER utc;
785
431
 
@@ -787,19 +433,20 @@ fileTimeToUTC(const FILETIME *filetime, time_t *time, long *ns)
787
433
  utc.LowPart = filetime->dwLowDateTime;
788
434
  if (utc.QuadPart >= EPOC_TIME) {
789
435
  utc.QuadPart -= EPOC_TIME;
790
- *time = (time_t)(utc.QuadPart / 10000000); /* milli seconds base */
436
+ *t = (time_t)(utc.QuadPart / 10000000); /* milli seconds base */
791
437
  *ns = (long)(utc.QuadPart % 10000000) * 100;/* nano seconds base */
792
438
  } else {
793
- *time = 0;
439
+ *t = 0;
794
440
  *ns = 0;
795
441
  }
796
442
  }
797
443
 
798
444
  /* Stat by handle
799
- * Windows' stat() does not accept path which is added "\\?\" especially "?"
445
+ * Windows' stat() does not accept the path added "\\?\" especially "?"
800
446
  * character.
801
- * It means we cannot access a long name path(which is longer than MAX_PATH).
802
- * So I've implemented simular Windows' stat() to access the long name path.
447
+ * It means we cannot access the long name path longer than MAX_PATH.
448
+ * So I've implemented a function similar to Windows' stat() to access the
449
+ * long name path.
803
450
  * And I've added some feature.
804
451
  * 1. set st_ino by nFileIndexHigh and nFileIndexLow of
805
452
  * BY_HANDLE_FILE_INFORMATION.
@@ -813,7 +460,7 @@ __hstat(HANDLE handle, struct ustat *st)
813
460
  ULARGE_INTEGER ino64;
814
461
  DWORD ftype;
815
462
  mode_t mode;
816
- time_t time;
463
+ time_t t;
817
464
  long ns;
818
465
 
819
466
  switch (ftype = GetFileType(handle)) {
@@ -869,17 +516,17 @@ __hstat(HANDLE handle, struct ustat *st)
869
516
  else
870
517
  mode |= S_IFREG;
871
518
  st->st_mode = mode;
872
-
873
- fileTimeToUTC(&info.ftLastAccessTime, &time, &ns);
874
- st->st_atime = time;
519
+
520
+ fileTimeToUTC(&info.ftLastAccessTime, &t, &ns);
521
+ st->st_atime = t;
875
522
  st->st_atime_nsec = ns;
876
- fileTimeToUTC(&info.ftLastWriteTime, &time, &ns);
877
- st->st_mtime = time;
523
+ fileTimeToUTC(&info.ftLastWriteTime, &t, &ns);
524
+ st->st_mtime = t;
878
525
  st->st_mtime_nsec = ns;
879
- fileTimeToUTC(&info.ftCreationTime, &time, &ns);
880
- st->st_ctime = time;
526
+ fileTimeToUTC(&info.ftCreationTime, &t, &ns);
527
+ st->st_ctime = t;
881
528
  st->st_ctime_nsec = ns;
882
- st->st_size =
529
+ st->st_size =
883
530
  ((int64_t)(info.nFileSizeHigh) * ((int64_t)MAXDWORD + 1))
884
531
  + (int64_t)(info.nFileSizeLow);
885
532
  #ifdef SIMULATE_WIN_STAT
@@ -887,7 +534,7 @@ __hstat(HANDLE handle, struct ustat *st)
887
534
  st->st_nlink = 1;
888
535
  st->st_dev = 0;
889
536
  #else
890
- /* Getting FileIndex as i-node. We have to remove a sequence which
537
+ /* Getting FileIndex as i-node. We should remove a sequence which
891
538
  * is high-16-bits of nFileIndexHigh. */
892
539
  ino64.HighPart = info.nFileIndexHigh & 0x0000FFFFUL;
893
540
  ino64.LowPart = info.nFileIndexLow;
@@ -913,12 +560,17 @@ copy_stat(struct stat *st, struct ustat *us)
913
560
  st->st_ino = getino(us);
914
561
  st->st_mode = us->st_mode;
915
562
  st->st_nlink = us->st_nlink;
916
- st->st_size = us->st_size;
563
+ st->st_size = (off_t)us->st_size;
917
564
  st->st_uid = us->st_uid;
918
565
  st->st_dev = us->st_dev;
919
566
  st->st_rdev = us->st_rdev;
920
567
  }
921
568
 
569
+ /*
570
+ * TODO: Remove a use of __la_fstat and __la_stat.
571
+ * We should use GetFileInformationByHandle in place
572
+ * where We still use the *stat functions.
573
+ */
922
574
  int
923
575
  __la_fstat(int fd, struct stat *st)
924
576
  {
@@ -940,6 +592,7 @@ __la_fstat(int fd, struct stat *st)
940
592
  return (ret);
941
593
  }
942
594
 
595
+ /* This can exceed MAX_PATH limitation. */
943
596
  int
944
597
  __la_stat(const char *path, struct stat *st)
945
598
  {
@@ -947,8 +600,8 @@ __la_stat(const char *path, struct stat *st)
947
600
  struct ustat u;
948
601
  int ret;
949
602
 
950
- handle = la_CreateFile(path, 0, 0, NULL, OPEN_EXISTING,
951
- FILE_FLAG_BACKUP_SEMANTICS | FILE_ATTRIBUTE_READONLY,
603
+ handle = la_CreateFile(path, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING,
604
+ FILE_FLAG_BACKUP_SEMANTICS,
952
605
  NULL);
953
606
  if (handle == INVALID_HANDLE_VALUE) {
954
607
  la_dosmaperr(GetLastError());
@@ -977,57 +630,26 @@ __la_stat(const char *path, struct stat *st)
977
630
  return (ret);
978
631
  }
979
632
 
980
- int
981
- __la_unlink(const char *path)
982
- {
983
- wchar_t *ws;
984
- int r;
985
-
986
- r = _unlink(path);
987
- if (r >= 0 || errno != ENOENT)
988
- return (r);
989
- ws = permissive_name(path);
990
- if (ws == NULL) {
991
- errno = EINVAL;
992
- return (-1);
993
- }
994
- r = _wunlink(ws);
995
- free(ws);
996
- return (r);
997
- }
998
-
999
633
  /*
1000
- * This waitpid is limited implemention.
634
+ * This waitpid is limited implementation.
1001
635
  */
1002
636
  pid_t
1003
- __la_waitpid(pid_t wpid, int *status, int option)
637
+ __la_waitpid(HANDLE child, int *status, int option)
1004
638
  {
1005
- HANDLE child;
1006
- DWORD cs, ret;
639
+ DWORD cs;
1007
640
 
1008
641
  (void)option;/* UNUSED */
1009
- child = OpenProcess(PROCESS_QUERY_INFORMATION | SYNCHRONIZE, FALSE, wpid);
1010
- if (child == NULL) {
1011
- la_dosmaperr(GetLastError());
1012
- return (-1);
1013
- }
1014
- ret = WaitForSingleObject(child, INFINITE);
1015
- if (ret == WAIT_FAILED) {
1016
- CloseHandle(child);
1017
- la_dosmaperr(GetLastError());
1018
- return (-1);
1019
- }
1020
- if (GetExitCodeProcess(child, &cs) == 0) {
1021
- CloseHandle(child);
1022
- la_dosmaperr(GetLastError());
1023
- return (-1);
1024
- }
1025
- if (cs == STILL_ACTIVE)
1026
- *status = 0x100;
1027
- else
1028
- *status = (int)(cs & 0xff);
1029
- CloseHandle(child);
1030
- return (wpid);
642
+ do {
643
+ if (GetExitCodeProcess(child, &cs) == 0) {
644
+ CloseHandle(child);
645
+ la_dosmaperr(GetLastError());
646
+ *status = 0;
647
+ return (-1);
648
+ }
649
+ } while (cs == STILL_ACTIVE);
650
+
651
+ *status = (int)(cs & 0xff);
652
+ return (0);
1031
653
  }
1032
654
 
1033
655
  ssize_t
@@ -1057,6 +679,113 @@ __la_write(int fd, const void *buf, size_t nbytes)
1057
679
  return (bytes_written);
1058
680
  }
1059
681
 
682
+ /*
683
+ * Replace the Windows path separator '\' with '/'.
684
+ */
685
+ static int
686
+ replace_pathseparator(struct archive_wstring *ws, const wchar_t *wp)
687
+ {
688
+ wchar_t *w;
689
+ size_t path_length;
690
+
691
+ if (wp == NULL)
692
+ return(0);
693
+ if (wcschr(wp, L'\\') == NULL)
694
+ return(0);
695
+ path_length = wcslen(wp);
696
+ if (archive_wstring_ensure(ws, path_length) == NULL)
697
+ return(-1);
698
+ archive_wstrncpy(ws, wp, path_length);
699
+ for (w = ws->s; *w; w++) {
700
+ if (*w == L'\\')
701
+ *w = L'/';
702
+ }
703
+ return(1);
704
+ }
705
+
706
+ static int
707
+ fix_pathseparator(struct archive_entry *entry)
708
+ {
709
+ struct archive_wstring ws;
710
+ const wchar_t *wp;
711
+ int ret = ARCHIVE_OK;
712
+
713
+ archive_string_init(&ws);
714
+ wp = archive_entry_pathname_w(entry);
715
+ switch (replace_pathseparator(&ws, wp)) {
716
+ case 0: /* Not replaced. */
717
+ break;
718
+ case 1: /* Replaced. */
719
+ archive_entry_copy_pathname_w(entry, ws.s);
720
+ break;
721
+ default:
722
+ ret = ARCHIVE_FAILED;
723
+ }
724
+ wp = archive_entry_hardlink_w(entry);
725
+ switch (replace_pathseparator(&ws, wp)) {
726
+ case 0: /* Not replaced. */
727
+ break;
728
+ case 1: /* Replaced. */
729
+ archive_entry_copy_hardlink_w(entry, ws.s);
730
+ break;
731
+ default:
732
+ ret = ARCHIVE_FAILED;
733
+ }
734
+ wp = archive_entry_symlink_w(entry);
735
+ switch (replace_pathseparator(&ws, wp)) {
736
+ case 0: /* Not replaced. */
737
+ break;
738
+ case 1: /* Replaced. */
739
+ archive_entry_copy_symlink_w(entry, ws.s);
740
+ break;
741
+ default:
742
+ ret = ARCHIVE_FAILED;
743
+ }
744
+ archive_wstring_free(&ws);
745
+ return(ret);
746
+ }
747
+
748
+ struct archive_entry *
749
+ __la_win_entry_in_posix_pathseparator(struct archive_entry *entry)
750
+ {
751
+ struct archive_entry *entry_main;
752
+ const wchar_t *wp;
753
+ int has_backslash = 0;
754
+ int ret;
755
+
756
+ wp = archive_entry_pathname_w(entry);
757
+ if (wp != NULL && wcschr(wp, L'\\') != NULL)
758
+ has_backslash = 1;
759
+ if (!has_backslash) {
760
+ wp = archive_entry_hardlink_w(entry);
761
+ if (wp != NULL && wcschr(wp, L'\\') != NULL)
762
+ has_backslash = 1;
763
+ }
764
+ if (!has_backslash) {
765
+ wp = archive_entry_symlink_w(entry);
766
+ if (wp != NULL && wcschr(wp, L'\\') != NULL)
767
+ has_backslash = 1;
768
+ }
769
+ /*
770
+ * If there is no backslash chars, return the original.
771
+ */
772
+ if (!has_backslash)
773
+ return (entry);
774
+
775
+ /* Copy entry so we can modify it as needed. */
776
+ entry_main = archive_entry_clone(entry);
777
+ if (entry_main == NULL)
778
+ return (NULL);
779
+ /* Replace the Windows path-separator '\' with '/'. */
780
+ ret = fix_pathseparator(entry_main);
781
+ if (ret < ARCHIVE_WARN) {
782
+ archive_entry_free(entry_main);
783
+ return (NULL);
784
+ }
785
+ return (entry_main);
786
+ }
787
+
788
+
1060
789
  /*
1061
790
  * The following function was modified from PostgreSQL sources and is
1062
791
  * subject to the copyright below.
@@ -1152,8 +881,8 @@ static const struct {
1152
881
  { ERROR_NOT_ENOUGH_QUOTA, ENOMEM }
1153
882
  };
1154
883
 
1155
- static void
1156
- la_dosmaperr(unsigned long e)
884
+ void
885
+ __la_dosmaperr(unsigned long e)
1157
886
  {
1158
887
  int i;
1159
888
 
@@ -1163,7 +892,7 @@ la_dosmaperr(unsigned long e)
1163
892
  return;
1164
893
  }
1165
894
 
1166
- for (i = 0; i < sizeof(doserrors); i++)
895
+ for (i = 0; i < (int)(sizeof(doserrors)/sizeof(doserrors[0])); i++)
1167
896
  {
1168
897
  if (doserrors[i].winerr == e)
1169
898
  {
@@ -1177,60 +906,4 @@ la_dosmaperr(unsigned long e)
1177
906
  return;
1178
907
  }
1179
908
 
1180
- #if defined(ARCHIVE_HASH_MD5_WIN) ||\
1181
- defined(ARCHIVE_HASH_SHA1_WIN) || defined(ARCHIVE_HASH_SHA256_WIN) ||\
1182
- defined(ARCHIVE_HASH_SHA384_WIN) || defined(ARCHIVE_HASH_SHA512_WIN)
1183
- /*
1184
- * Message digest functions.
1185
- */
1186
- void
1187
- __la_hash_Init(Digest_CTX *ctx, ALG_ID algId)
1188
- {
1189
-
1190
- ctx->valid = 0;
1191
- if (!CryptAcquireContext(&ctx->cryptProv, NULL, NULL,
1192
- PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
1193
- if (GetLastError() != (DWORD)NTE_BAD_KEYSET)
1194
- return;
1195
- if (!CryptAcquireContext(&ctx->cryptProv, NULL, NULL,
1196
- PROV_RSA_FULL, CRYPT_NEWKEYSET))
1197
- return;
1198
- }
1199
-
1200
- if (!CryptCreateHash(ctx->cryptProv, algId, 0, 0, &ctx->hash)) {
1201
- CryptReleaseContext(ctx->cryptProv, 0);
1202
- return;
1203
- }
1204
-
1205
- ctx->valid = 1;
1206
- }
1207
-
1208
- void
1209
- __la_hash_Update(Digest_CTX *ctx, const unsigned char *buf, size_t len)
1210
- {
1211
-
1212
- if (!ctx->valid)
1213
- return;
1214
-
1215
- CryptHashData(ctx->hash,
1216
- (unsigned char *)(uintptr_t)buf,
1217
- (DWORD)len, 0);
1218
- }
1219
-
1220
- void
1221
- __la_hash_Final(unsigned char *buf, size_t bufsize, Digest_CTX *ctx)
1222
- {
1223
- DWORD siglen = bufsize;
1224
-
1225
- if (!ctx->valid)
1226
- return;
1227
-
1228
- CryptGetHashParam(ctx->hash, HP_HASHVAL, buf, &siglen, 0);
1229
- CryptDestroyHash(ctx->hash);
1230
- CryptReleaseContext(ctx->cryptProv, 0);
1231
- ctx->valid = 0;
1232
- }
1233
-
1234
- #endif /* defined(ARCHIVE_HASH_*_WIN) */
1235
-
1236
909
  #endif /* _WIN32 && !__CYGWIN__ */