Skip to content

Commit 8256dba

Browse files
authored
Merge pull request #116 from trofi/master
2 parents 222f41a + ef95531 commit 8256dba

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

libarchive/ffi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
c_ssize_t, c_void_p, c_void_p, POINTER(c_void_p)
4848
)
4949
SEEK_CALLBACK = CFUNCTYPE(
50-
c_longlong, c_int, c_void_p, c_longlong, c_int
50+
c_longlong, c_void_p, c_void_p, c_longlong, c_int
5151
)
5252
OPEN_CALLBACK = CFUNCTYPE(c_int, c_void_p, c_void_p)
5353
CLOSE_CALLBACK = CFUNCTYPE(c_int, c_void_p, c_void_p)

libarchive/read.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ def custom_reader(
6565
open_cb = OPEN_CALLBACK(open_func) if open_func else NO_OPEN_CB
6666
read_cb = READ_CALLBACK(read_func)
6767
close_cb = CLOSE_CALLBACK(close_func) if close_func else NO_CLOSE_CB
68+
seek_cb = SEEK_CALLBACK(seek_func)
6869
with new_archive_read(format_name, filter_name, passphrase) as archive_p:
6970
if seek_func:
70-
ffi.read_set_seek_callback(archive_p, SEEK_CALLBACK(seek_func))
71+
ffi.read_set_seek_callback(archive_p, seek_cb)
7172
ffi.read_open(archive_p, None, open_cb, read_cb, close_cb)
7273
yield archive_read_class(archive_p)
7374

@@ -143,9 +144,10 @@ def seek_func(archive_p, context, offset, whence):
143144
open_cb = NO_OPEN_CB
144145
read_cb = READ_CALLBACK(read_func)
145146
close_cb = NO_CLOSE_CB
147+
seek_cb = SEEK_CALLBACK(seek_func)
146148
with new_archive_read(format_name, filter_name, passphrase) as archive_p:
147149
if stream.seekable():
148-
ffi.read_set_seek_callback(archive_p, SEEK_CALLBACK(seek_func))
150+
ffi.read_set_seek_callback(archive_p, seek_cb)
149151
ffi.read_open(archive_p, None, open_cb, read_cb, close_cb)
150152
yield ArchiveRead(archive_p)
151153

0 commit comments

Comments
 (0)