summaryrefslogtreecommitdiffstats
path: root/cython
diff options
context:
space:
mode:
authorGravatar wendyisgr33n2018-07-30 10:47:48 -0700
committerGravatar Nikias Bassen2021-01-03 23:26:52 +0100
commit12d3a070717ad734b1048b1dcacffae5b903f190 (patch)
treedf965f1fa335af3e0ee95b16c13945d464289ef1 /cython
parent652dfdb12ebcdec64dba066550d893de17839365 (diff)
downloadlibimobiledevice-12d3a070717ad734b1048b1dcacffae5b903f190.tar.gz
libimobiledevice-12d3a070717ad734b1048b1dcacffae5b903f190.tar.bz2
Fixed method visibility in mobilebackup2.pxi API
Diffstat (limited to 'cython')
-rw-r--r--cython/mobilebackup2.pxi31
1 files changed, 18 insertions, 13 deletions
diff --git a/cython/mobilebackup2.pxi b/cython/mobilebackup2.pxi
index 4eccae6..4b47e5b 100644
--- a/cython/mobilebackup2.pxi
+++ b/cython/mobilebackup2.pxi
@@ -58,10 +58,10 @@ cdef class MobileBackup2Client(PropertyListService):
cdef inline BaseError _error(self, int16_t ret):
return MobileBackup2Error(ret)
- cdef send_message(self, bytes message, plist.Node options):
+ cpdef send_message(self, bytes message, plist.Node options):
self.handle_error(mobilebackup2_send_message(self._c_client, message, options._c_node))
- cdef tuple receive_message(self):
+ cpdef tuple receive_message(self):
cdef:
char* dlmessage = NULL
plist.plist_t c_node = NULL
@@ -77,29 +77,34 @@ cdef class MobileBackup2Client(PropertyListService):
free(dlmessage)
raise
- cdef int send_raw(self, bytes data, int length):
+ cpdef int send_raw(self, bytes data, int length):
cdef:
- uint32_t bytes = 0
+ uint32_t bytes_recvd = 0
mobilebackup2_error_t err
- err = mobilebackup2_send_raw(self._c_client, data, length, &bytes)
+ err = mobilebackup2_send_raw(self._c_client, data, length, &bytes_recvd)
try:
self.handle_error(err)
- return <bint>bytes
+ return <bint>bytes_recvd
except BaseError, e:
raise
- cdef int receive_raw(self, bytes data, int length):
+ cpdef int receive_raw(self, bytearray data, int length):
cdef:
- uint32_t bytes = 0
+ uint32_t bytes_recvd = 0
mobilebackup2_error_t err
- err = mobilebackup2_receive_raw(self._c_client, data, length, &bytes)
+ err = mobilebackup2_receive_raw(self._c_client, data, length, &bytes_recvd)
+
+ # Throwing an exception when we test if theres more data to read is excessive
+ if err == -1 and bytes_recvd == 0:
+ return 0
+
try:
self.handle_error(err)
- return <bint>bytes
+ return <bint>bytes_recvd
except BaseError, e:
raise
- cdef float version_exchange(self, double[::1] local_versions):
+ cpdef float version_exchange(self, double[::1] local_versions):
cdef:
double[::1] temp = None
double remote_version = 0.0
@@ -111,8 +116,8 @@ cdef class MobileBackup2Client(PropertyListService):
except BaseError, e:
raise
- cdef send_request(self, bytes request, bytes target_identifier, bytes source_identifier, plist.Node options):
+ cpdef send_request(self, bytes request, bytes target_identifier, bytes source_identifier, plist.Node options):
self.handle_error(mobilebackup2_send_request(self._c_client, request, target_identifier, source_identifier, options._c_node))
- cdef send_status_response(self, int status_code, bytes status1, plist.Node status2):
+ cpdef send_status_response(self, int status_code, bytes status1, plist.Node status2):
self.handle_error(mobilebackup2_send_status_response(self._c_client, status_code, status1, status2._c_node))