summaryrefslogtreecommitdiff
path: root/libarchive/archive_write_set_format_ustar.c
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@gmail.com>2010-02-20 00:53:11 -0500
committerTim Kientzle <kientzle@gmail.com>2010-02-20 00:53:11 -0500
commit911dc2bff3dc37fa499c17379dcf35f352f88c0b (patch)
treebe38d9958879cea30c63edc440c6e31e826c6625 /libarchive/archive_write_set_format_ustar.c
parent8f43f6931172a59c0e25647b35503a99d6f26fde (diff)
downloadlibarchive-911dc2bff3dc37fa499c17379dcf35f352f88c0b.tar.gz
Stackable write filter support. This ended up touching an awful lot
of files. But, the old API is supported almost entirely unchanged, which I wasn't certain would be possible. Big changes: * You can add more than one write filter by using archive_write_add_filter_{bzip2,compress,gzip,lzma,xz}. This will be more interesting when we have uuencode, RPM, encryption. * The old archive_write_set_compression_XXXX are shorthands for "remove all the current filters and add this one." They're deprecated and scheduled to be removed in libarchive 4.0. * The internal API and life cycle for write filters has been rationalized: create, set options, open, write, close, free. * New utility functions provide information about each filter when there's more than one: code, name, and number of bytes processed * Old archive_bytes_compressed(), etc, are implemented in terms of the more generic new functions. * The read side was generalized to also support the new utility functions. In particular, the write filters are much simpler since each one doesn't have to deal with blocking. In this version, there's still a "write_add_filter_none" that handles blocking, but I think I'll soon fold that down into the client wrapper and add_filter_none will become a no-op. I think this also gets us a big step closer to multi-volume support on the write side. SVN-Revision: 1920
Diffstat (limited to 'libarchive/archive_write_set_format_ustar.c')
-rw-r--r--libarchive/archive_write_set_format_ustar.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/libarchive/archive_write_set_format_ustar.c b/libarchive/archive_write_set_format_ustar.c
index 1de273fc..5bd038ee 100644
--- a/libarchive/archive_write_set_format_ustar.c
+++ b/libarchive/archive_write_set_format_ustar.c
@@ -232,7 +232,7 @@ archive_write_ustar_header(struct archive_write *a, struct archive_entry *entry)
ret = __archive_write_format_header_ustar(a, buff, entry, -1, 1);
if (ret < ARCHIVE_WARN)
return (ret);
- ret2 = (a->compressor.write)(a, buff, 512);
+ ret2 = __archive_write_output(a, buff, 512);
if (ret2 < ARCHIVE_WARN)
return (ret2);
if (ret2 < ret)
@@ -521,13 +521,7 @@ format_octal(int64_t v, char *p, int s)
static int
archive_write_ustar_finish(struct archive_write *a)
{
- int r;
-
- if (a->compressor.write == NULL)
- return (ARCHIVE_OK);
-
- r = write_nulls(a, 512*2);
- return (r);
+ return (write_nulls(a, 512*2));
}
static int
@@ -562,7 +556,7 @@ write_nulls(struct archive_write *a, size_t padding)
while (padding > 0) {
to_write = padding < a->null_length ? padding : a->null_length;
- ret = (a->compressor.write)(a, a->nulls, to_write);
+ ret = __archive_write_output(a, a->nulls, to_write);
if (ret != ARCHIVE_OK)
return (ret);
padding -= to_write;
@@ -579,7 +573,7 @@ archive_write_ustar_data(struct archive_write *a, const void *buff, size_t s)
ustar = (struct ustar *)a->format_data;
if (s > ustar->entry_bytes_remaining)
s = ustar->entry_bytes_remaining;
- ret = (a->compressor.write)(a, buff, s);
+ ret = __archive_write_output(a, buff, s);
ustar->entry_bytes_remaining -= s;
if (ret != ARCHIVE_OK)
return (ret);