diff --git a/libarchive/ffi.py b/libarchive/ffi.py index 22b3711..7dc16b1 100644 --- a/libarchive/ffi.py +++ b/libarchive/ffi.py @@ -47,7 +47,7 @@ c_ssize_t, c_void_p, c_void_p, POINTER(c_void_p) ) SEEK_CALLBACK = CFUNCTYPE( - c_longlong, c_int, c_void_p, c_longlong, c_int + c_longlong, c_void_p, c_void_p, c_longlong, c_int ) OPEN_CALLBACK = CFUNCTYPE(c_int, c_void_p, c_void_p) CLOSE_CALLBACK = CFUNCTYPE(c_int, c_void_p, c_void_p) diff --git a/libarchive/read.py b/libarchive/read.py index 6ab0e1a..ff7a408 100644 --- a/libarchive/read.py +++ b/libarchive/read.py @@ -65,9 +65,10 @@ def custom_reader( open_cb = OPEN_CALLBACK(open_func) if open_func else NO_OPEN_CB read_cb = READ_CALLBACK(read_func) close_cb = CLOSE_CALLBACK(close_func) if close_func else NO_CLOSE_CB + seek_cb = SEEK_CALLBACK(seek_func) with new_archive_read(format_name, filter_name, passphrase) as archive_p: if seek_func: - ffi.read_set_seek_callback(archive_p, SEEK_CALLBACK(seek_func)) + ffi.read_set_seek_callback(archive_p, seek_cb) ffi.read_open(archive_p, None, open_cb, read_cb, close_cb) yield archive_read_class(archive_p) @@ -143,9 +144,10 @@ def seek_func(archive_p, context, offset, whence): open_cb = NO_OPEN_CB read_cb = READ_CALLBACK(read_func) close_cb = NO_CLOSE_CB + seek_cb = SEEK_CALLBACK(seek_func) with new_archive_read(format_name, filter_name, passphrase) as archive_p: if stream.seekable(): - ffi.read_set_seek_callback(archive_p, SEEK_CALLBACK(seek_func)) + ffi.read_set_seek_callback(archive_p, seek_cb) ffi.read_open(archive_p, None, open_cb, read_cb, close_cb) yield ArchiveRead(archive_p)