From: Tim Kientzle Date: Tue, 22 Nov 2011 05:32:59 +0000 (-0500) Subject: Comments... X-Git-Tag: v3.0.1b~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6e1b09edc871d02df24165515215f3598196c09;p=thirdparty%2Flibarchive.git Comments... SVN-Revision: 3828 --- diff --git a/libarchive/archive_read.c b/libarchive/archive_read.c index 1fa407ee6..53c7e6480 100644 --- a/libarchive/archive_read.c +++ b/libarchive/archive_read.c @@ -1332,6 +1332,23 @@ __archive_read_filter_seek(struct archive_read_filter *filter, int64_t offset, i return (ARCHIVE_FAILED); r = filter->seek(filter, offset, whence); if (r >= 0) { + /* + * Ouch. Clearing the buffer like this hurts, especially + * at bid time. A lot of our efficiency at bid time comes + * from having bidders reuse the data we've already read. + * + * TODO: If the seek request is in data we already + * have, then don't call the seek callback. + * + * TODO: Zip seeks to end-of-file at bid time. If + * other formats also start doing this, we may need to + * find a way for clients to fudge the seek offset to + * a block boundary. + * + * Hmmm... If whence was SEEK_END, we know the file + * size is (r - offset). Can we use that to simplify + * the TODO items above? + */ filter->avail = filter->client_avail = 0; filter->next = filter->buffer; filter->position = r; diff --git a/libarchive/archive_read_open_filename.c b/libarchive/archive_read_open_filename.c index 5ea27c9b6..bf5269724 100644 --- a/libarchive/archive_read_open_filename.c +++ b/libarchive/archive_read_open_filename.c @@ -443,6 +443,9 @@ file_skip(struct archive *a, void *client_data, int64_t request) return (0); } +/* + * TODO: Store the offset and use it in the read callback. + */ static int64_t file_seek(struct archive *a, void *client_data, int64_t request, int whence) {