diff options
Diffstat (limited to 'Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c')
-rw-r--r-- | Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c index 5333d47000..a5243aff71 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_bzip2.c @@ -70,7 +70,6 @@ static int bzip2_filter_close(struct archive_read_filter *); */ static int bzip2_reader_bid(struct archive_read_filter_bidder *, struct archive_read_filter *); static int bzip2_reader_init(struct archive_read_filter *); -static int bzip2_reader_free(struct archive_read_filter_bidder *); #if ARCHIVE_VERSION_NUMBER < 4000000 /* Deprecated; remove in libarchive 4.0 */ @@ -81,24 +80,21 @@ archive_read_support_compression_bzip2(struct archive *a) } #endif +static const struct archive_read_filter_bidder_vtable +bzip2_bidder_vtable = { + .bid = bzip2_reader_bid, + .init = bzip2_reader_init, +}; + int archive_read_support_filter_bzip2(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; - struct archive_read_filter_bidder *reader; - - archive_check_magic(_a, ARCHIVE_READ_MAGIC, - ARCHIVE_STATE_NEW, "archive_read_support_filter_bzip2"); - if (__archive_read_get_bidder(a, &reader) != ARCHIVE_OK) + if (__archive_read_register_bidder(a, NULL, "bzip2", + &bzip2_bidder_vtable) != ARCHIVE_OK) return (ARCHIVE_FATAL); - reader->data = NULL; - reader->name = "bzip2"; - reader->bid = bzip2_reader_bid; - reader->init = bzip2_reader_init; - reader->options = NULL; - reader->free = bzip2_reader_free; #if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR) return (ARCHIVE_OK); #else @@ -108,12 +104,6 @@ archive_read_support_filter_bzip2(struct archive *_a) #endif } -static int -bzip2_reader_free(struct archive_read_filter_bidder *self){ - (void)self; /* UNUSED */ - return (ARCHIVE_OK); -} - /* * Test whether we can handle this data. * @@ -183,6 +173,12 @@ bzip2_reader_init(struct archive_read_filter *self) #else +static const struct archive_read_filter_vtable +bzip2_reader_vtable = { + .read = bzip2_filter_read, + .close = bzip2_filter_close, +}; + /* * Setup the callbacks. */ @@ -209,9 +205,7 @@ bzip2_reader_init(struct archive_read_filter *self) self->data = state; state->out_block_size = out_block_size; state->out_block = out_block; - self->read = bzip2_filter_read; - self->skip = NULL; /* not supported */ - self->close = bzip2_filter_close; + self->vtable = &bzip2_reader_vtable; return (ARCHIVE_OK); } |