diff options
author | cperciva <cperciva@FreeBSD.org> | 2007-03-31 22:59:43 +0000 |
---|---|---|
committer | cperciva <cperciva@FreeBSD.org> | 2007-03-31 22:59:43 +0000 |
commit | 5ca8f701f1424bb5e1b4504e01a71f01252654f1 (patch) | |
tree | 1361de2a0496b3c2146c0eb0ea65d53aa30e8982 /lib/libarchive/archive_read_support_format_iso9660.c | |
parent | 7af0b4e5ce104914d5971547b0fea1984ef4d6c4 (diff) | |
download | FreeBSD-src-5ca8f701f1424bb5e1b4504e01a71f01252654f1.zip FreeBSD-src-5ca8f701f1424bb5e1b4504e01a71f01252654f1.tar.gz |
Provide a dummy compression-layer skip function which just reads data and
discards it, for use when the compression layer code doesn't know how to
skip data (e.g., everything other than the "none" compressor). This makes
format level code simpler because that code can now assume that the
compression layer always knows how to skip and will always skip exactly
the requested number of bytes.
Discussed with: kientzle (3 months ago)
Diffstat (limited to 'lib/libarchive/archive_read_support_format_iso9660.c')
-rw-r--r-- | lib/libarchive/archive_read_support_format_iso9660.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/lib/libarchive/archive_read_support_format_iso9660.c b/lib/libarchive/archive_read_support_format_iso9660.c index f115b0e..c892f72 100644 --- a/lib/libarchive/archive_read_support_format_iso9660.c +++ b/lib/libarchive/archive_read_support_format_iso9660.c @@ -917,33 +917,13 @@ fprintf(stderr, " *** Discarding CE data.\n"); offset = file->offset; /* Seek forward to the start of the entry. */ - /* Use fast compression_skip if it's available. */ - if (iso9660->current_position < offset - && a->compression_skip != NULL) { + if (iso9660->current_position < offset) { off_t step = offset - iso9660->current_position; off_t bytes_read; bytes_read = (a->compression_skip)(a, step); - iso9660->current_position += bytes_read; - } - - /* Use a series of reads if compression_skip didn't - * get us all the way there. */ - while (iso9660->current_position < offset) { - ssize_t step = offset - iso9660->current_position; - ssize_t bytes_read; - const void *buff; - - if (step > iso9660->logical_block_size) - step = iso9660->logical_block_size; - bytes_read = (a->compression_read_ahead)(a, &buff, step); - if (bytes_read <= 0) { - release_file(iso9660, file); - return (ARCHIVE_FATAL); - } - if (bytes_read > step) - bytes_read = step; - iso9660->current_position += bytes_read; - (a->compression_read_consume)(a, bytes_read); + if (bytes_read < 0) + return (bytes_read); + iso9660->current_position = offset; } /* We found body of file; handle it now. */ |