reader: track read_filter "can_seek" with a flag
Currently we the ::seek callback can be either NULL or client_seek_proxy. Since we already explicitly use the latter, instead of ::seek just drop the function pointer all together, in favour of a simple flag. Alternatively one could use a ARCHIVE_FILTER_NONE check. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
1 parent
7f3f47cba7
commit
4e7a6bd811
2 files changed
+3
-4
No files matched your search
@@ -489,11 +489,11 @@ archive_read_open1(struct archive *_a)
|
||||
filter->open = client_open_proxy;
|
||||
filter->read = client_read_proxy;
|
||||
filter->skip = client_skip_proxy;
|
||||
filter->seek = client_seek_proxy;
|
||||
filter->close = client_close_proxy;
|
||||
filter->sswitch = client_switch_proxy;
|
||||
filter->name = "none";
|
||||
filter->code = ARCHIVE_FILTER_NONE;
|
||||
filter->can_seek = 1;
|
||||
|
||||
a->client.dataset[0].begin_position = 0;
|
||||
if (!a->filter || !a->bypass_filter_bidding)
|
||||
@@ -1633,7 +1633,7 @@ __archive_read_filter_seek(struct archive_read_filter *filter, int64_t offset,
|
||||
|
||||
if (filter->closed || filter->fatal)
|
||||
return (ARCHIVE_FATAL);
|
||||
if (filter->seek == NULL)
|
||||
if (filter->can_seek == 0)
|
||||
return (ARCHIVE_FAILED);
|
||||
|
||||
client = &(filter->archive->client);
|
||||
|
||||
@@ -93,8 +93,6 @@ struct archive_read_filter {
|
||||
ssize_t (*read)(struct archive_read_filter *, const void **);
|
||||
/* Skip forward this many bytes. */
|
||||
int64_t (*skip)(struct archive_read_filter *self, int64_t request);
|
||||
/* Seek to an absolute location. */
|
||||
int64_t (*seek)(struct archive_read_filter *self, int64_t offset, int whence);
|
||||
/* Close (just this filter) and free(self). */
|
||||
int (*close)(struct archive_read_filter *self);
|
||||
/* Function that handles switching from reading one block to the next/prev */
|
||||
@@ -106,6 +104,7 @@ struct archive_read_filter {
|
||||
|
||||
const char *name;
|
||||
int code;
|
||||
int can_seek;
|
||||
|
||||
/* Used by reblocking logic. */
|
||||
char *buffer;
|
||||
|
||||
Reference in new issue
Block a user