diff options
Diffstat (limited to 'libarchive/archive_read_support_format_empty.c')
-rw-r--r-- | libarchive/archive_read_support_format_empty.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libarchive/archive_read_support_format_empty.c b/libarchive/archive_read_support_format_empty.c index 518fdcb4913f..3dc2196cb99e 100644 --- a/libarchive/archive_read_support_format_empty.c +++ b/libarchive/archive_read_support_format_empty.c @@ -31,9 +31,9 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_empty.c 1915 #include "archive_private.h" #include "archive_read_private.h" -static int archive_read_format_empty_bid(struct archive_read *); +static int archive_read_format_empty_bid(struct archive_read *, int); static int archive_read_format_empty_read_data(struct archive_read *, - const void **, size_t *, off_t *); + const void **, size_t *, int64_t *); static int archive_read_format_empty_read_header(struct archive_read *, struct archive_entry *); int @@ -42,6 +42,9 @@ archive_read_support_format_empty(struct archive *_a) struct archive_read *a = (struct archive_read *)_a; int r; + archive_check_magic(_a, ARCHIVE_READ_MAGIC, + ARCHIVE_STATE_NEW, "archive_read_support_format_empty"); + r = __archive_read_register_format(a, NULL, NULL, @@ -57,14 +60,11 @@ archive_read_support_format_empty(struct archive *_a) static int -archive_read_format_empty_bid(struct archive_read *a) +archive_read_format_empty_bid(struct archive_read *a, int best_bid) { - ssize_t avail; - - (void)__archive_read_ahead(a, 1, &avail); - if (avail != 0) - return (-1); - return (1); + if (best_bid < 1 && __archive_read_ahead(a, 1, NULL) == NULL) + return (1); + return (-1); } static int @@ -82,7 +82,7 @@ archive_read_format_empty_read_header(struct archive_read *a, static int archive_read_format_empty_read_data(struct archive_read *a, - const void **buff, size_t *size, off_t *offset) + const void **buff, size_t *size, int64_t *offset) { (void)a; /* UNUSED */ (void)buff; /* UNUSED */ |