Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions librsync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,12 @@ def patch(f, d, o=None):
@patch_callback
def read_cb(opaque, pos, length, buff):
f.seek(pos)
block = f.read(length)
buff.next_in = ctypes.c_char_p(block)
buff.avail_in = ctypes.c_size_t(len(block))
size_p = ctypes.cast(length, ctypes.POINTER(ctypes.c_size_t)).contents
size = size_p.value
block = f.read(size)
size_p.value = len(block)
buff_p = ctypes.cast(buff, ctypes.POINTER(ctypes.c_char_p)).contents
buff_p.value = block
return RS_DONE

job = _librsync.rs_patch_begin(read_cb, None)
Expand Down