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.
- checksums.yaml +4 -4
- data/ext/extconf.rb +2 -9
- data/ext/libarchive-0.1.1/ext/archive_read_support_compression.c +6 -6
- data/ext/libarchive-0.1.1/ext/archive_read_support_compression.o +0 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_format.o +0 -0
- data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.c +1 -1
- data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.o +0 -0
- data/ext/libarchive-0.1.1/ext/archive_write_set_compression.c +5 -5
- data/ext/libarchive-0.1.1/ext/archive_write_set_compression.o +0 -0
- data/ext/libarchive-0.1.1/ext/config.h +23 -0
- data/ext/libarchive-0.1.1/ext/config.log +230 -0
- data/ext/libarchive-0.1.1/ext/config.status +671 -0
- data/ext/libarchive-0.1.1/ext/libarchive.c +1 -1
- data/ext/libarchive-0.1.1/ext/libarchive.o +0 -0
- data/ext/libarchive-0.1.1/ext/libarchive_archive.c +7 -7
- data/ext/libarchive-0.1.1/ext/libarchive_archive.o +0 -0
- data/ext/libarchive-0.1.1/ext/libarchive_entry.c +6 -0
- data/ext/libarchive-0.1.1/ext/libarchive_entry.o +0 -0
- data/ext/libarchive-0.1.1/ext/libarchive_reader.c +6 -4
- data/ext/libarchive-0.1.1/ext/libarchive_reader.o +0 -0
- data/ext/libarchive-0.1.1/ext/libarchive_ruby.so +0 -0
- data/ext/libarchive-0.1.1/ext/libarchive_win32.h +1 -1
- data/ext/libarchive-0.1.1/ext/libarchive_writer.c +2 -2
- data/ext/libarchive-0.1.1/ext/libarchive_writer.o +0 -0
- data/ext/libarchive-3.6.2/Makefile.in +16892 -0
- data/ext/libarchive-3.6.2/build/autoconf/ax_append_compile_flags.m4 +67 -0
- data/ext/libarchive-3.6.2/build/autoconf/ax_append_flag.m4 +71 -0
- data/ext/libarchive-3.6.2/build/autoconf/ax_check_compile_flag.m4 +74 -0
- data/ext/libarchive-3.6.2/build/autoconf/ax_require_defined.m4 +37 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/check_stdcall_func.m4 +0 -0
- data/ext/libarchive-3.6.2/build/autoconf/compile +348 -0
- data/ext/libarchive-3.6.2/build/autoconf/config.guess +1754 -0
- data/ext/libarchive-3.6.2/build/autoconf/config.rpath +696 -0
- data/ext/libarchive-3.6.2/build/autoconf/config.sub +1890 -0
- data/ext/libarchive-3.6.2/build/autoconf/depcomp +791 -0
- data/ext/libarchive-3.6.2/build/autoconf/iconv.m4 +271 -0
- data/ext/libarchive-3.6.2/build/autoconf/install-sh +541 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/la_uid_t.m4 +0 -0
- data/ext/libarchive-3.6.2/build/autoconf/lib-ld.m4 +109 -0
- data/ext/libarchive-3.6.2/build/autoconf/lib-link.m4 +777 -0
- data/ext/libarchive-3.6.2/build/autoconf/lib-prefix.m4 +224 -0
- data/ext/libarchive-3.6.2/build/autoconf/ltmain.sh +11251 -0
- data/ext/libarchive-3.6.2/build/autoconf/m4_ax_compile_check_sizeof.m4 +115 -0
- data/ext/libarchive-3.6.2/build/autoconf/missing +215 -0
- data/ext/libarchive-3.6.2/build/autoconf/test-driver +153 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/pkgconfig/libarchive.pc.in +4 -1
- data/ext/libarchive-3.6.2/config.h.in +1504 -0
- data/ext/libarchive-3.6.2/configure +25558 -0
- data/ext/libarchive-3.6.2/libarchive/archive.h +1212 -0
- data/ext/libarchive-3.6.2/libarchive/archive_acl.c +2097 -0
- data/ext/libarchive-3.6.2/libarchive/archive_acl_private.h +83 -0
- data/ext/libarchive-3.6.2/libarchive/archive_blake2.h +197 -0
- data/ext/libarchive-3.6.2/libarchive/archive_blake2_impl.h +161 -0
- data/ext/libarchive-3.6.2/libarchive/archive_blake2s_ref.c +369 -0
- data/ext/libarchive-3.6.2/libarchive/archive_blake2sp_ref.c +361 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_check_magic.c +63 -22
- data/ext/libarchive-3.6.2/libarchive/archive_cmdline.c +227 -0
- data/ext/libarchive-3.6.2/libarchive/archive_cmdline_private.h +47 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_crc32.h +17 -0
- data/ext/libarchive-3.6.2/libarchive/archive_cryptor.c +534 -0
- data/ext/libarchive-3.6.2/libarchive/archive_cryptor_private.h +188 -0
- data/ext/libarchive-3.6.2/libarchive/archive_digest.c +1505 -0
- data/ext/libarchive-3.6.2/libarchive/archive_digest_private.h +416 -0
- data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_darwin.c +559 -0
- data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_freebsd.c +712 -0
- data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_linux.c +760 -0
- data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_sunos.c +824 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_endian.h +48 -15
- data/ext/libarchive-3.6.2/libarchive/archive_entry.c +2149 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry.h +305 -106
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_bhfi.c +5 -4
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_stat.c +9 -3
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_link_resolver.c +104 -62
- data/ext/libarchive-3.6.2/libarchive/archive_entry_locale.h +92 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_private.h +65 -49
- data/ext/libarchive-3.6.2/libarchive/archive_entry_sparse.c +156 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_stat.c +6 -6
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_strmode.c +1 -1
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_xattr.c +4 -6
- data/ext/libarchive-3.6.2/libarchive/archive_getdate.c +1165 -0
- data/ext/libarchive-3.6.2/libarchive/archive_getdate.h +39 -0
- data/ext/libarchive-3.6.2/libarchive/archive_hmac.c +334 -0
- data/ext/libarchive-3.6.2/libarchive/archive_hmac_private.h +117 -0
- data/ext/libarchive-3.6.2/libarchive/archive_match.c +1875 -0
- data/ext/libarchive-3.6.2/libarchive/archive_openssl_evp_private.h +53 -0
- data/ext/libarchive-3.6.2/libarchive/archive_openssl_hmac_private.h +54 -0
- data/ext/libarchive-3.6.2/libarchive/archive_options.c +218 -0
- data/ext/libarchive-3.6.2/libarchive/archive_options_private.h +51 -0
- data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.c +337 -0
- data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.h +49 -0
- data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.c +463 -0
- data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.h +52 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_platform.h +77 -9
- data/ext/libarchive-3.6.2/libarchive/archive_platform_acl.h +55 -0
- data/ext/libarchive-3.6.2/libarchive/archive_platform_xattr.h +47 -0
- data/ext/libarchive-3.6.2/libarchive/archive_ppmd7.c +1168 -0
- data/ext/libarchive-3.6.2/libarchive/archive_ppmd7_private.h +119 -0
- data/ext/libarchive-3.6.2/libarchive/archive_ppmd8.c +1287 -0
- data/ext/libarchive-3.6.2/libarchive/archive_ppmd8_private.h +148 -0
- data/ext/libarchive-3.6.2/libarchive/archive_ppmd_private.h +151 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_private.h +74 -18
- data/ext/libarchive-3.6.2/libarchive/archive_random.c +272 -0
- data/ext/libarchive-3.6.2/libarchive/archive_random_private.h +36 -0
- data/ext/libarchive-3.6.2/libarchive/archive_rb.c +709 -0
- data/ext/libarchive-3.6.2/libarchive/archive_rb.h +113 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read.c +1756 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_add_passphrase.c +190 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_append_filter.c +204 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_data_into_fd.c +64 -18
- data/ext/libarchive-3.6.2/libarchive/archive_read_disk_entry_from_file.c +1086 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_disk_posix.c +2732 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_private.h +40 -4
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_set_standard_lookup.c +21 -11
- data/ext/libarchive-3.6.2/libarchive/archive_read_disk_windows.c +2479 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_extract.c +60 -0
- data/ext/{libarchive-2.8.4/libarchive/archive_read_extract.c → libarchive-3.6.2/libarchive/archive_read_extract2.c} +34 -61
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_fd.c +70 -49
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_file.c +38 -23
- data/ext/libarchive-3.6.2/libarchive/archive_read_open_filename.c +586 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_memory.c +58 -28
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_private.h +127 -59
- data/ext/libarchive-3.6.2/libarchive/archive_read_set_format.c +117 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_set_options.c +133 -0
- 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
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_by_code.c +83 -0
- 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
- 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
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_grzip.c +112 -0
- 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
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lrzip.c +122 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lz4.c +742 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lzop.c +499 -0
- 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
- 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
- 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
- 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
- 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
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_zstd.c +297 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_7zip.c +3900 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_all.c +89 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_ar.c +126 -72
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_by_code.c +92 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cab.c +3228 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cpio.c +1104 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_empty.c +14 -11
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_iso9660.c +990 -541
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_lha.c +2916 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_mtree.c +2150 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar.c +3797 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar5.c +4251 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_raw.c +38 -31
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_tar.c +1157 -629
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_warc.c +848 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_xar.c +439 -258
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_zip.c +4270 -0
- data/ext/libarchive-3.6.2/libarchive/archive_string.c +4240 -0
- data/ext/libarchive-3.6.2/libarchive/archive_string.h +243 -0
- data/ext/libarchive-3.6.2/libarchive/archive_string_composition.h +2292 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_string_sprintf.c +44 -16
- data/ext/libarchive-3.6.2/libarchive/archive_util.c +655 -0
- data/ext/libarchive-3.6.2/libarchive/archive_version_details.c +151 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_virtual.c +85 -16
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.c +214 -541
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.h +74 -106
- data/ext/libarchive-3.6.2/libarchive/archive_write.c +828 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter.c +72 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_b64encode.c +304 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_by_name.c +77 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_bzip2.c +401 -0
- 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
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_grzip.c +135 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_gzip.c +442 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lrzip.c +197 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lz4.c +700 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lzop.c +478 -0
- 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
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_program.c +391 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_uuencode.c +295 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_xz.c +545 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_zstd.c +418 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_disk_posix.c +4711 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_private.h +9 -2
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_set_standard_lookup.c +30 -29
- data/ext/libarchive-3.6.2/libarchive/archive_write_disk_windows.c +2842 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_fd.c +15 -10
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_file.c +15 -9
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_filename.c +128 -20
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_memory.c +7 -18
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_private.h +72 -29
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format.c +56 -3
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_7zip.c +2322 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ar.c +54 -34
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_by_name.c +20 -2
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio.c +11 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_binary.c +610 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_newc.c +457 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_odc.c +500 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_filter_by_ext.c +142 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_gnutar.c +755 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_iso9660.c +8165 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_mtree.c +2217 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_pax.c +1049 -387
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_private.h +42 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_raw.c +125 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_shar.c +62 -47
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ustar.c +279 -108
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_v7tar.c +638 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_warc.c +453 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_xar.c +3259 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_zip.c +1704 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_options.c +130 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_passphrase.c +95 -0
- data/ext/libarchive-3.6.2/libarchive/archive_xxhash.h +48 -0
- data/ext/libarchive-3.6.2/libarchive/config_freebsd.h +271 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/filter_fork.h +10 -5
- data/ext/{libarchive-2.8.4/libarchive/filter_fork.c → libarchive-3.6.2/libarchive/filter_fork_posix.c} +98 -19
- data/ext/libarchive-3.6.2/libarchive/filter_fork_windows.c +236 -0
- data/ext/libarchive-3.6.2/libarchive/xxhash.c +525 -0
- data/ext/libarchive-static-makefile +144 -80
- data/ext/libarchive-static-wrapper-makefile +1 -1
- data/ext/zlib-1.2.13/Makefile.in +404 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/adler32.c +51 -34
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/compress.c +27 -21
- data/ext/zlib-1.2.13/configure +922 -0
- data/ext/zlib-1.2.13/crc32.c +1125 -0
- data/ext/zlib-1.2.13/crc32.h +9446 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.c +842 -459
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.h +37 -33
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzclose.c +0 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzguts.h +103 -16
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzlib.c +155 -53
- data/ext/zlib-1.2.13/gzread.c +650 -0
- data/ext/zlib-1.2.13/gzwrite.c +677 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/infback.c +24 -12
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.c +49 -66
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.h +0 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffixed.h +3 -3
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.c +209 -94
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.h +9 -5
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.c +24 -50
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.h +1 -1
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.c +135 -198
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.h +0 -0
- data/ext/zlib-1.2.13/uncompr.c +93 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/zconf.h +182 -63
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/zlib.h +617 -295
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.c +50 -41
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.h +83 -82
- metadata +241 -133
- data/ext/libarchive-0.1.1/libarchive.c +0 -1762
- data/ext/libarchive-2.8.4/Makefile.in +0 -7076
- data/ext/libarchive-2.8.4/build/autoconf/compile +0 -143
- data/ext/libarchive-2.8.4/build/autoconf/config.guess +0 -1502
- data/ext/libarchive-2.8.4/build/autoconf/config.sub +0 -1708
- data/ext/libarchive-2.8.4/build/autoconf/depcomp +0 -630
- data/ext/libarchive-2.8.4/build/autoconf/install-sh +0 -291
- data/ext/libarchive-2.8.4/build/autoconf/ltmain.sh +0 -8406
- data/ext/libarchive-2.8.4/build/autoconf/missing +0 -376
- data/ext/libarchive-2.8.4/config.h.in +0 -772
- data/ext/libarchive-2.8.4/configure +0 -17916
- data/ext/libarchive-2.8.4/libarchive/archive.h +0 -741
- data/ext/libarchive-2.8.4/libarchive/archive_entry.c +0 -2202
- data/ext/libarchive-2.8.4/libarchive/archive_hash.h +0 -281
- data/ext/libarchive-2.8.4/libarchive/archive_read.c +0 -1249
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk.c +0 -198
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_entry_from_file.c +0 -570
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_filename.c +0 -272
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_cpio.c +0 -777
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_mtree.c +0 -1304
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_zip.c +0 -903
- data/ext/libarchive-2.8.4/libarchive/archive_string.c +0 -453
- data/ext/libarchive-2.8.4/libarchive/archive_string.h +0 -148
- data/ext/libarchive-2.8.4/libarchive/archive_util.c +0 -391
- data/ext/libarchive-2.8.4/libarchive/archive_write.c +0 -466
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk.c +0 -2628
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_bzip2.c +0 -408
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_gzip.c +0 -477
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_none.c +0 -257
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_program.c +0 -347
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_xz.c +0 -438
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio.c +0 -344
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio_newc.c +0 -295
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_mtree.c +0 -1050
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_zip.c +0 -667
- data/ext/libarchive-2.8.4/libarchive/config_freebsd.h +0 -154
- data/ext/libarchive-2.8.4/libarchive/filter_fork_windows.c +0 -113
- data/ext/zlib-1.2.5/Makefile.in +0 -257
- data/ext/zlib-1.2.5/configure +0 -596
- data/ext/zlib-1.2.5/crc32.c +0 -442
- data/ext/zlib-1.2.5/crc32.h +0 -441
- data/ext/zlib-1.2.5/example.c +0 -565
- data/ext/zlib-1.2.5/gzread.c +0 -653
- data/ext/zlib-1.2.5/gzwrite.c +0 -531
- data/ext/zlib-1.2.5/minigzip.c +0 -440
- data/ext/zlib-1.2.5/uncompr.c +0 -59
@@ -0,0 +1,391 @@
|
|
1
|
+
/*-
|
2
|
+
* Copyright (c) 2007 Joerg Sonnenberger
|
3
|
+
* Copyright (c) 2012 Michihiro NAKAJIMA
|
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_compression_program.c 201104 2009-12-28 03:14:30Z kientzle $");
|
29
|
+
|
30
|
+
#ifdef HAVE_SYS_WAIT_H
|
31
|
+
# include <sys/wait.h>
|
32
|
+
#endif
|
33
|
+
#ifdef HAVE_ERRNO_H
|
34
|
+
# include <errno.h>
|
35
|
+
#endif
|
36
|
+
#ifdef HAVE_FCNTL_H
|
37
|
+
# include <fcntl.h>
|
38
|
+
#endif
|
39
|
+
#ifdef HAVE_STDLIB_H
|
40
|
+
# include <stdlib.h>
|
41
|
+
#endif
|
42
|
+
#ifdef HAVE_STRING_H
|
43
|
+
# include <string.h>
|
44
|
+
#endif
|
45
|
+
|
46
|
+
#include "archive.h"
|
47
|
+
#include "archive_private.h"
|
48
|
+
#include "archive_string.h"
|
49
|
+
#include "archive_write_private.h"
|
50
|
+
#include "filter_fork.h"
|
51
|
+
|
52
|
+
#if ARCHIVE_VERSION_NUMBER < 4000000
|
53
|
+
int
|
54
|
+
archive_write_set_compression_program(struct archive *a, const char *cmd)
|
55
|
+
{
|
56
|
+
__archive_write_filters_free(a);
|
57
|
+
return (archive_write_add_filter_program(a, cmd));
|
58
|
+
}
|
59
|
+
#endif
|
60
|
+
|
61
|
+
struct archive_write_program_data {
|
62
|
+
#if defined(_WIN32) && !defined(__CYGWIN__)
|
63
|
+
HANDLE child;
|
64
|
+
#else
|
65
|
+
pid_t child;
|
66
|
+
#endif
|
67
|
+
int child_stdin, child_stdout;
|
68
|
+
|
69
|
+
char *child_buf;
|
70
|
+
size_t child_buf_len, child_buf_avail;
|
71
|
+
char *program_name;
|
72
|
+
};
|
73
|
+
|
74
|
+
struct private_data {
|
75
|
+
struct archive_write_program_data *pdata;
|
76
|
+
struct archive_string description;
|
77
|
+
char *cmd;
|
78
|
+
};
|
79
|
+
|
80
|
+
static int archive_compressor_program_open(struct archive_write_filter *);
|
81
|
+
static int archive_compressor_program_write(struct archive_write_filter *,
|
82
|
+
const void *, size_t);
|
83
|
+
static int archive_compressor_program_close(struct archive_write_filter *);
|
84
|
+
static int archive_compressor_program_free(struct archive_write_filter *);
|
85
|
+
|
86
|
+
/*
|
87
|
+
* Add a filter to this write handle that passes all data through an
|
88
|
+
* external program.
|
89
|
+
*/
|
90
|
+
int
|
91
|
+
archive_write_add_filter_program(struct archive *_a, const char *cmd)
|
92
|
+
{
|
93
|
+
struct archive_write_filter *f = __archive_write_allocate_filter(_a);
|
94
|
+
struct private_data *data;
|
95
|
+
static const char prefix[] = "Program: ";
|
96
|
+
|
97
|
+
archive_check_magic(_a, ARCHIVE_WRITE_MAGIC,
|
98
|
+
ARCHIVE_STATE_NEW, "archive_write_add_filter_program");
|
99
|
+
|
100
|
+
f->data = calloc(1, sizeof(*data));
|
101
|
+
if (f->data == NULL)
|
102
|
+
goto memerr;
|
103
|
+
data = (struct private_data *)f->data;
|
104
|
+
|
105
|
+
data->cmd = strdup(cmd);
|
106
|
+
if (data->cmd == NULL)
|
107
|
+
goto memerr;
|
108
|
+
|
109
|
+
data->pdata = __archive_write_program_allocate(cmd);
|
110
|
+
if (data->pdata == NULL)
|
111
|
+
goto memerr;
|
112
|
+
|
113
|
+
/* Make up a description string. */
|
114
|
+
if (archive_string_ensure(&data->description,
|
115
|
+
strlen(prefix) + strlen(cmd) + 1) == NULL)
|
116
|
+
goto memerr;
|
117
|
+
archive_strcpy(&data->description, prefix);
|
118
|
+
archive_strcat(&data->description, cmd);
|
119
|
+
|
120
|
+
f->name = data->description.s;
|
121
|
+
f->code = ARCHIVE_FILTER_PROGRAM;
|
122
|
+
f->open = archive_compressor_program_open;
|
123
|
+
f->write = archive_compressor_program_write;
|
124
|
+
f->close = archive_compressor_program_close;
|
125
|
+
f->free = archive_compressor_program_free;
|
126
|
+
return (ARCHIVE_OK);
|
127
|
+
memerr:
|
128
|
+
archive_compressor_program_free(f);
|
129
|
+
archive_set_error(_a, ENOMEM,
|
130
|
+
"Can't allocate memory for filter program");
|
131
|
+
return (ARCHIVE_FATAL);
|
132
|
+
}
|
133
|
+
|
134
|
+
static int
|
135
|
+
archive_compressor_program_open(struct archive_write_filter *f)
|
136
|
+
{
|
137
|
+
struct private_data *data = (struct private_data *)f->data;
|
138
|
+
|
139
|
+
return __archive_write_program_open(f, data->pdata, data->cmd);
|
140
|
+
}
|
141
|
+
|
142
|
+
static int
|
143
|
+
archive_compressor_program_write(struct archive_write_filter *f,
|
144
|
+
const void *buff, size_t length)
|
145
|
+
{
|
146
|
+
struct private_data *data = (struct private_data *)f->data;
|
147
|
+
|
148
|
+
return __archive_write_program_write(f, data->pdata, buff, length);
|
149
|
+
}
|
150
|
+
|
151
|
+
static int
|
152
|
+
archive_compressor_program_close(struct archive_write_filter *f)
|
153
|
+
{
|
154
|
+
struct private_data *data = (struct private_data *)f->data;
|
155
|
+
|
156
|
+
return __archive_write_program_close(f, data->pdata);
|
157
|
+
}
|
158
|
+
|
159
|
+
static int
|
160
|
+
archive_compressor_program_free(struct archive_write_filter *f)
|
161
|
+
{
|
162
|
+
struct private_data *data = (struct private_data *)f->data;
|
163
|
+
|
164
|
+
if (data) {
|
165
|
+
free(data->cmd);
|
166
|
+
archive_string_free(&data->description);
|
167
|
+
__archive_write_program_free(data->pdata);
|
168
|
+
free(data);
|
169
|
+
f->data = NULL;
|
170
|
+
}
|
171
|
+
return (ARCHIVE_OK);
|
172
|
+
}
|
173
|
+
|
174
|
+
/*
|
175
|
+
* Allocate resources for executing an external program.
|
176
|
+
*/
|
177
|
+
struct archive_write_program_data *
|
178
|
+
__archive_write_program_allocate(const char *program)
|
179
|
+
{
|
180
|
+
struct archive_write_program_data *data;
|
181
|
+
|
182
|
+
data = calloc(1, sizeof(struct archive_write_program_data));
|
183
|
+
if (data == NULL)
|
184
|
+
return (data);
|
185
|
+
data->child_stdin = -1;
|
186
|
+
data->child_stdout = -1;
|
187
|
+
data->program_name = strdup(program);
|
188
|
+
return (data);
|
189
|
+
}
|
190
|
+
|
191
|
+
/*
|
192
|
+
* Release the resources.
|
193
|
+
*/
|
194
|
+
int
|
195
|
+
__archive_write_program_free(struct archive_write_program_data *data)
|
196
|
+
{
|
197
|
+
|
198
|
+
if (data) {
|
199
|
+
free(data->program_name);
|
200
|
+
free(data->child_buf);
|
201
|
+
free(data);
|
202
|
+
}
|
203
|
+
return (ARCHIVE_OK);
|
204
|
+
}
|
205
|
+
|
206
|
+
int
|
207
|
+
__archive_write_program_open(struct archive_write_filter *f,
|
208
|
+
struct archive_write_program_data *data, const char *cmd)
|
209
|
+
{
|
210
|
+
int ret;
|
211
|
+
|
212
|
+
if (data->child_buf == NULL) {
|
213
|
+
data->child_buf_len = 65536;
|
214
|
+
data->child_buf_avail = 0;
|
215
|
+
data->child_buf = malloc(data->child_buf_len);
|
216
|
+
|
217
|
+
if (data->child_buf == NULL) {
|
218
|
+
archive_set_error(f->archive, ENOMEM,
|
219
|
+
"Can't allocate compression buffer");
|
220
|
+
return (ARCHIVE_FATAL);
|
221
|
+
}
|
222
|
+
}
|
223
|
+
|
224
|
+
ret = __archive_create_child(cmd, &data->child_stdin,
|
225
|
+
&data->child_stdout, &data->child);
|
226
|
+
if (ret != ARCHIVE_OK) {
|
227
|
+
archive_set_error(f->archive, EINVAL,
|
228
|
+
"Can't launch external program: %s", cmd);
|
229
|
+
return (ARCHIVE_FATAL);
|
230
|
+
}
|
231
|
+
return (ARCHIVE_OK);
|
232
|
+
}
|
233
|
+
|
234
|
+
static ssize_t
|
235
|
+
child_write(struct archive_write_filter *f,
|
236
|
+
struct archive_write_program_data *data, const char *buf, size_t buf_len)
|
237
|
+
{
|
238
|
+
ssize_t ret;
|
239
|
+
|
240
|
+
if (data->child_stdin == -1)
|
241
|
+
return (-1);
|
242
|
+
|
243
|
+
if (buf_len == 0)
|
244
|
+
return (-1);
|
245
|
+
|
246
|
+
for (;;) {
|
247
|
+
do {
|
248
|
+
ret = write(data->child_stdin, buf, buf_len);
|
249
|
+
} while (ret == -1 && errno == EINTR);
|
250
|
+
|
251
|
+
if (ret > 0)
|
252
|
+
return (ret);
|
253
|
+
if (ret == 0) {
|
254
|
+
close(data->child_stdin);
|
255
|
+
data->child_stdin = -1;
|
256
|
+
fcntl(data->child_stdout, F_SETFL, 0);
|
257
|
+
return (0);
|
258
|
+
}
|
259
|
+
if (ret == -1 && errno != EAGAIN)
|
260
|
+
return (-1);
|
261
|
+
|
262
|
+
if (data->child_stdout == -1) {
|
263
|
+
fcntl(data->child_stdin, F_SETFL, 0);
|
264
|
+
__archive_check_child(data->child_stdin,
|
265
|
+
data->child_stdout);
|
266
|
+
continue;
|
267
|
+
}
|
268
|
+
|
269
|
+
do {
|
270
|
+
ret = read(data->child_stdout,
|
271
|
+
data->child_buf + data->child_buf_avail,
|
272
|
+
data->child_buf_len - data->child_buf_avail);
|
273
|
+
} while (ret == -1 && errno == EINTR);
|
274
|
+
|
275
|
+
if (ret == 0 || (ret == -1 && errno == EPIPE)) {
|
276
|
+
close(data->child_stdout);
|
277
|
+
data->child_stdout = -1;
|
278
|
+
fcntl(data->child_stdin, F_SETFL, 0);
|
279
|
+
continue;
|
280
|
+
}
|
281
|
+
if (ret == -1 && errno == EAGAIN) {
|
282
|
+
__archive_check_child(data->child_stdin,
|
283
|
+
data->child_stdout);
|
284
|
+
continue;
|
285
|
+
}
|
286
|
+
if (ret == -1)
|
287
|
+
return (-1);
|
288
|
+
|
289
|
+
data->child_buf_avail += ret;
|
290
|
+
|
291
|
+
ret = __archive_write_filter(f->next_filter,
|
292
|
+
data->child_buf, data->child_buf_avail);
|
293
|
+
if (ret != ARCHIVE_OK)
|
294
|
+
return (-1);
|
295
|
+
data->child_buf_avail = 0;
|
296
|
+
}
|
297
|
+
}
|
298
|
+
|
299
|
+
/*
|
300
|
+
* Write data to the filter stream.
|
301
|
+
*/
|
302
|
+
int
|
303
|
+
__archive_write_program_write(struct archive_write_filter *f,
|
304
|
+
struct archive_write_program_data *data, const void *buff, size_t length)
|
305
|
+
{
|
306
|
+
ssize_t ret;
|
307
|
+
const char *buf;
|
308
|
+
|
309
|
+
if (data->child == 0)
|
310
|
+
return (ARCHIVE_OK);
|
311
|
+
|
312
|
+
buf = buff;
|
313
|
+
while (length > 0) {
|
314
|
+
ret = child_write(f, data, buf, length);
|
315
|
+
if (ret == -1 || ret == 0) {
|
316
|
+
archive_set_error(f->archive, EIO,
|
317
|
+
"Can't write to program: %s", data->program_name);
|
318
|
+
return (ARCHIVE_FATAL);
|
319
|
+
}
|
320
|
+
length -= ret;
|
321
|
+
buf += ret;
|
322
|
+
}
|
323
|
+
return (ARCHIVE_OK);
|
324
|
+
}
|
325
|
+
|
326
|
+
/*
|
327
|
+
* Finish the filtering...
|
328
|
+
*/
|
329
|
+
int
|
330
|
+
__archive_write_program_close(struct archive_write_filter *f,
|
331
|
+
struct archive_write_program_data *data)
|
332
|
+
{
|
333
|
+
int ret, status;
|
334
|
+
ssize_t bytes_read;
|
335
|
+
|
336
|
+
if (data->child == 0)
|
337
|
+
return ARCHIVE_OK;
|
338
|
+
|
339
|
+
ret = 0;
|
340
|
+
close(data->child_stdin);
|
341
|
+
data->child_stdin = -1;
|
342
|
+
fcntl(data->child_stdout, F_SETFL, 0);
|
343
|
+
|
344
|
+
for (;;) {
|
345
|
+
do {
|
346
|
+
bytes_read = read(data->child_stdout,
|
347
|
+
data->child_buf + data->child_buf_avail,
|
348
|
+
data->child_buf_len - data->child_buf_avail);
|
349
|
+
} while (bytes_read == -1 && errno == EINTR);
|
350
|
+
|
351
|
+
if (bytes_read == 0 || (bytes_read == -1 && errno == EPIPE))
|
352
|
+
break;
|
353
|
+
|
354
|
+
if (bytes_read == -1) {
|
355
|
+
archive_set_error(f->archive, errno,
|
356
|
+
"Error reading from program: %s", data->program_name);
|
357
|
+
ret = ARCHIVE_FATAL;
|
358
|
+
goto cleanup;
|
359
|
+
}
|
360
|
+
data->child_buf_avail += bytes_read;
|
361
|
+
|
362
|
+
ret = __archive_write_filter(f->next_filter,
|
363
|
+
data->child_buf, data->child_buf_avail);
|
364
|
+
if (ret != ARCHIVE_OK) {
|
365
|
+
ret = ARCHIVE_FATAL;
|
366
|
+
goto cleanup;
|
367
|
+
}
|
368
|
+
data->child_buf_avail = 0;
|
369
|
+
}
|
370
|
+
|
371
|
+
cleanup:
|
372
|
+
/* Shut down the child. */
|
373
|
+
if (data->child_stdin != -1)
|
374
|
+
close(data->child_stdin);
|
375
|
+
if (data->child_stdout != -1)
|
376
|
+
close(data->child_stdout);
|
377
|
+
while (waitpid(data->child, &status, 0) == -1 && errno == EINTR)
|
378
|
+
continue;
|
379
|
+
#if defined(_WIN32) && !defined(__CYGWIN__)
|
380
|
+
CloseHandle(data->child);
|
381
|
+
#endif
|
382
|
+
data->child = 0;
|
383
|
+
|
384
|
+
if (status != 0) {
|
385
|
+
archive_set_error(f->archive, EIO,
|
386
|
+
"Error closing program: %s", data->program_name);
|
387
|
+
ret = ARCHIVE_FATAL;
|
388
|
+
}
|
389
|
+
return ret;
|
390
|
+
}
|
391
|
+
|
@@ -0,0 +1,295 @@
|
|
1
|
+
/*-
|
2
|
+
* Copyright (c) 2012 Michihiro NAKAJIMA
|
3
|
+
* All rights reserved.
|
4
|
+
*
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
6
|
+
* modification, are permitted provided that the following conditions
|
7
|
+
* are met:
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
13
|
+
*
|
14
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
15
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
16
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
17
|
+
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
18
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
19
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
20
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
21
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
22
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
23
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
24
|
+
*/
|
25
|
+
|
26
|
+
#include "archive_platform.h"
|
27
|
+
|
28
|
+
__FBSDID("$FreeBSD$");
|
29
|
+
|
30
|
+
#ifdef HAVE_ERRNO_H
|
31
|
+
#include <errno.h>
|
32
|
+
#endif
|
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_private.h"
|
42
|
+
#include "archive_string.h"
|
43
|
+
#include "archive_write_private.h"
|
44
|
+
|
45
|
+
#define LBYTES 45
|
46
|
+
|
47
|
+
struct private_uuencode {
|
48
|
+
int mode;
|
49
|
+
struct archive_string name;
|
50
|
+
struct archive_string encoded_buff;
|
51
|
+
size_t bs;
|
52
|
+
size_t hold_len;
|
53
|
+
unsigned char hold[LBYTES];
|
54
|
+
};
|
55
|
+
|
56
|
+
static int archive_filter_uuencode_options(struct archive_write_filter *,
|
57
|
+
const char *, const char *);
|
58
|
+
static int archive_filter_uuencode_open(struct archive_write_filter *);
|
59
|
+
static int archive_filter_uuencode_write(struct archive_write_filter *,
|
60
|
+
const void *, size_t);
|
61
|
+
static int archive_filter_uuencode_close(struct archive_write_filter *);
|
62
|
+
static int archive_filter_uuencode_free(struct archive_write_filter *);
|
63
|
+
static void uu_encode(struct archive_string *, const unsigned char *, size_t);
|
64
|
+
static int64_t atol8(const char *, size_t);
|
65
|
+
|
66
|
+
/*
|
67
|
+
* Add a compress filter to this write handle.
|
68
|
+
*/
|
69
|
+
int
|
70
|
+
archive_write_add_filter_uuencode(struct archive *_a)
|
71
|
+
{
|
72
|
+
struct archive_write *a = (struct archive_write *)_a;
|
73
|
+
struct archive_write_filter *f = __archive_write_allocate_filter(_a);
|
74
|
+
struct private_uuencode *state;
|
75
|
+
|
76
|
+
archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
|
77
|
+
ARCHIVE_STATE_NEW, "archive_write_add_filter_uu");
|
78
|
+
|
79
|
+
state = (struct private_uuencode *)calloc(1, sizeof(*state));
|
80
|
+
if (state == NULL) {
|
81
|
+
archive_set_error(f->archive, ENOMEM,
|
82
|
+
"Can't allocate data for uuencode filter");
|
83
|
+
return (ARCHIVE_FATAL);
|
84
|
+
}
|
85
|
+
archive_strcpy(&state->name, "-");
|
86
|
+
state->mode = 0644;
|
87
|
+
|
88
|
+
f->data = state;
|
89
|
+
f->name = "uuencode";
|
90
|
+
f->code = ARCHIVE_FILTER_UU;
|
91
|
+
f->open = archive_filter_uuencode_open;
|
92
|
+
f->options = archive_filter_uuencode_options;
|
93
|
+
f->write = archive_filter_uuencode_write;
|
94
|
+
f->close = archive_filter_uuencode_close;
|
95
|
+
f->free = archive_filter_uuencode_free;
|
96
|
+
|
97
|
+
return (ARCHIVE_OK);
|
98
|
+
}
|
99
|
+
|
100
|
+
/*
|
101
|
+
* Set write options.
|
102
|
+
*/
|
103
|
+
static int
|
104
|
+
archive_filter_uuencode_options(struct archive_write_filter *f, const char *key,
|
105
|
+
const char *value)
|
106
|
+
{
|
107
|
+
struct private_uuencode *state = (struct private_uuencode *)f->data;
|
108
|
+
|
109
|
+
if (strcmp(key, "mode") == 0) {
|
110
|
+
if (value == NULL) {
|
111
|
+
archive_set_error(f->archive, ARCHIVE_ERRNO_MISC,
|
112
|
+
"mode option requires octal digits");
|
113
|
+
return (ARCHIVE_FAILED);
|
114
|
+
}
|
115
|
+
state->mode = (int)atol8(value, strlen(value)) & 0777;
|
116
|
+
return (ARCHIVE_OK);
|
117
|
+
} else if (strcmp(key, "name") == 0) {
|
118
|
+
if (value == NULL) {
|
119
|
+
archive_set_error(f->archive, ARCHIVE_ERRNO_MISC,
|
120
|
+
"name option requires a string");
|
121
|
+
return (ARCHIVE_FAILED);
|
122
|
+
}
|
123
|
+
archive_strcpy(&state->name, value);
|
124
|
+
return (ARCHIVE_OK);
|
125
|
+
}
|
126
|
+
|
127
|
+
/* Note: The "warn" return is just to inform the options
|
128
|
+
* supervisor that we didn't handle it. It will generate
|
129
|
+
* a suitable error if no one used this option. */
|
130
|
+
return (ARCHIVE_WARN);
|
131
|
+
}
|
132
|
+
|
133
|
+
/*
|
134
|
+
* Setup callback.
|
135
|
+
*/
|
136
|
+
static int
|
137
|
+
archive_filter_uuencode_open(struct archive_write_filter *f)
|
138
|
+
{
|
139
|
+
struct private_uuencode *state = (struct private_uuencode *)f->data;
|
140
|
+
size_t bs = 65536, bpb;
|
141
|
+
|
142
|
+
if (f->archive->magic == ARCHIVE_WRITE_MAGIC) {
|
143
|
+
/* Buffer size should be a multiple number of the of bytes
|
144
|
+
* per block for performance. */
|
145
|
+
bpb = archive_write_get_bytes_per_block(f->archive);
|
146
|
+
if (bpb > bs)
|
147
|
+
bs = bpb;
|
148
|
+
else if (bpb != 0)
|
149
|
+
bs -= bs % bpb;
|
150
|
+
}
|
151
|
+
|
152
|
+
state->bs = bs;
|
153
|
+
if (archive_string_ensure(&state->encoded_buff, bs + 512) == NULL) {
|
154
|
+
archive_set_error(f->archive, ENOMEM,
|
155
|
+
"Can't allocate data for uuencode buffer");
|
156
|
+
return (ARCHIVE_FATAL);
|
157
|
+
}
|
158
|
+
|
159
|
+
archive_string_sprintf(&state->encoded_buff, "begin %o %s\n",
|
160
|
+
state->mode, state->name.s);
|
161
|
+
|
162
|
+
f->data = state;
|
163
|
+
return (0);
|
164
|
+
}
|
165
|
+
|
166
|
+
static void
|
167
|
+
uu_encode(struct archive_string *as, const unsigned char *p, size_t len)
|
168
|
+
{
|
169
|
+
int c;
|
170
|
+
|
171
|
+
c = (int)len;
|
172
|
+
archive_strappend_char(as, c?c + 0x20:'`');
|
173
|
+
for (; len >= 3; p += 3, len -= 3) {
|
174
|
+
c = p[0] >> 2;
|
175
|
+
archive_strappend_char(as, c?c + 0x20:'`');
|
176
|
+
c = ((p[0] & 0x03) << 4) | ((p[1] & 0xf0) >> 4);
|
177
|
+
archive_strappend_char(as, c?c + 0x20:'`');
|
178
|
+
c = ((p[1] & 0x0f) << 2) | ((p[2] & 0xc0) >> 6);
|
179
|
+
archive_strappend_char(as, c?c + 0x20:'`');
|
180
|
+
c = p[2] & 0x3f;
|
181
|
+
archive_strappend_char(as, c?c + 0x20:'`');
|
182
|
+
}
|
183
|
+
if (len > 0) {
|
184
|
+
c = p[0] >> 2;
|
185
|
+
archive_strappend_char(as, c?c + 0x20:'`');
|
186
|
+
c = (p[0] & 0x03) << 4;
|
187
|
+
if (len == 1) {
|
188
|
+
archive_strappend_char(as, c?c + 0x20:'`');
|
189
|
+
archive_strappend_char(as, '`');
|
190
|
+
archive_strappend_char(as, '`');
|
191
|
+
} else {
|
192
|
+
c |= (p[1] & 0xf0) >> 4;
|
193
|
+
archive_strappend_char(as, c?c + 0x20:'`');
|
194
|
+
c = (p[1] & 0x0f) << 2;
|
195
|
+
archive_strappend_char(as, c?c + 0x20:'`');
|
196
|
+
archive_strappend_char(as, '`');
|
197
|
+
}
|
198
|
+
}
|
199
|
+
archive_strappend_char(as, '\n');
|
200
|
+
}
|
201
|
+
|
202
|
+
/*
|
203
|
+
* Write data to the encoded stream.
|
204
|
+
*/
|
205
|
+
static int
|
206
|
+
archive_filter_uuencode_write(struct archive_write_filter *f, const void *buff,
|
207
|
+
size_t length)
|
208
|
+
{
|
209
|
+
struct private_uuencode *state = (struct private_uuencode *)f->data;
|
210
|
+
const unsigned char *p = buff;
|
211
|
+
int ret = ARCHIVE_OK;
|
212
|
+
|
213
|
+
if (length == 0)
|
214
|
+
return (ret);
|
215
|
+
|
216
|
+
if (state->hold_len) {
|
217
|
+
while (state->hold_len < LBYTES && length > 0) {
|
218
|
+
state->hold[state->hold_len++] = *p++;
|
219
|
+
length--;
|
220
|
+
}
|
221
|
+
if (state->hold_len < LBYTES)
|
222
|
+
return (ret);
|
223
|
+
uu_encode(&state->encoded_buff, state->hold, LBYTES);
|
224
|
+
state->hold_len = 0;
|
225
|
+
}
|
226
|
+
|
227
|
+
for (; length >= LBYTES; length -= LBYTES, p += LBYTES)
|
228
|
+
uu_encode(&state->encoded_buff, p, LBYTES);
|
229
|
+
|
230
|
+
/* Save remaining bytes. */
|
231
|
+
if (length > 0) {
|
232
|
+
memcpy(state->hold, p, length);
|
233
|
+
state->hold_len = length;
|
234
|
+
}
|
235
|
+
while (archive_strlen(&state->encoded_buff) >= state->bs) {
|
236
|
+
ret = __archive_write_filter(f->next_filter,
|
237
|
+
state->encoded_buff.s, state->bs);
|
238
|
+
memmove(state->encoded_buff.s,
|
239
|
+
state->encoded_buff.s + state->bs,
|
240
|
+
state->encoded_buff.length - state->bs);
|
241
|
+
state->encoded_buff.length -= state->bs;
|
242
|
+
}
|
243
|
+
|
244
|
+
return (ret);
|
245
|
+
}
|
246
|
+
|
247
|
+
|
248
|
+
/*
|
249
|
+
* Finish the compression...
|
250
|
+
*/
|
251
|
+
static int
|
252
|
+
archive_filter_uuencode_close(struct archive_write_filter *f)
|
253
|
+
{
|
254
|
+
struct private_uuencode *state = (struct private_uuencode *)f->data;
|
255
|
+
|
256
|
+
/* Flush remaining bytes. */
|
257
|
+
if (state->hold_len != 0)
|
258
|
+
uu_encode(&state->encoded_buff, state->hold, state->hold_len);
|
259
|
+
archive_string_sprintf(&state->encoded_buff, "`\nend\n");
|
260
|
+
/* Write the last block */
|
261
|
+
archive_write_set_bytes_in_last_block(f->archive, 1);
|
262
|
+
return __archive_write_filter(f->next_filter,
|
263
|
+
state->encoded_buff.s, archive_strlen(&state->encoded_buff));
|
264
|
+
}
|
265
|
+
|
266
|
+
static int
|
267
|
+
archive_filter_uuencode_free(struct archive_write_filter *f)
|
268
|
+
{
|
269
|
+
struct private_uuencode *state = (struct private_uuencode *)f->data;
|
270
|
+
|
271
|
+
archive_string_free(&state->name);
|
272
|
+
archive_string_free(&state->encoded_buff);
|
273
|
+
free(state);
|
274
|
+
return (ARCHIVE_OK);
|
275
|
+
}
|
276
|
+
|
277
|
+
static int64_t
|
278
|
+
atol8(const char *p, size_t char_cnt)
|
279
|
+
{
|
280
|
+
int64_t l;
|
281
|
+
int digit;
|
282
|
+
|
283
|
+
l = 0;
|
284
|
+
while (char_cnt-- > 0) {
|
285
|
+
if (*p >= '0' && *p <= '7')
|
286
|
+
digit = *p - '0';
|
287
|
+
else
|
288
|
+
break;
|
289
|
+
p++;
|
290
|
+
l <<= 3;
|
291
|
+
l |= digit;
|
292
|
+
}
|
293
|
+
return (l);
|
294
|
+
}
|
295
|
+
|