diff options
author | Martin Szulecki | 2012-03-20 22:56:33 +0100 |
---|---|---|
committer | Martin Szulecki | 2012-03-20 23:25:56 +0100 |
commit | 2d9ecc3d805e616b2bf85c0b8e99737e9b30c89d (patch) | |
tree | 48e924795c6bf3c217de61efe6048f6bb6573244 /cython | |
parent | 3e9d17ccd5212c110db9cfb5daa2d889d0a1aee4 (diff) | |
download | libimobiledevice-2d9ecc3d805e616b2bf85c0b8e99737e9b30c89d.tar.gz libimobiledevice-2d9ecc3d805e616b2bf85c0b8e99737e9b30c89d.tar.bz2 |
cython: Update to latest API and fix deprecation warnings with cython 0.13+
Diffstat (limited to 'cython')
-rw-r--r-- | cython/afc.pxi | 18 | ||||
-rw-r--r-- | cython/file_relay.pxi | 6 | ||||
-rw-r--r-- | cython/imobiledevice.pyx | 4 | ||||
-rw-r--r-- | cython/lockdown.pxi | 6 | ||||
-rw-r--r-- | cython/mobilesync.pxi | 10 | ||||
-rw-r--r-- | cython/sbservices.pxi | 6 | ||||
-rw-r--r-- | cython/screenshotr.pxi | 2 |
7 files changed, 27 insertions, 25 deletions
diff --git a/cython/afc.pxi b/cython/afc.pxi index c33dbfd..cf72b69 100644 --- a/cython/afc.pxi +++ b/cython/afc.pxi @@ -142,7 +142,7 @@ cdef class AfcFile(Base): except BaseError, e: raise finally: - stdlib.free(c_data) + free(c_data) return bytes_written @@ -182,9 +182,9 @@ cdef class AfcClient(BaseService): while infos[i]: info = infos[i] result.append(info) - stdlib.free(infos[i]) + free(infos[i]) i = i + 1 - stdlib.free(infos) + free(infos) return result @@ -205,13 +205,13 @@ cdef class AfcClient(BaseService): while dir_list[i]: f = dir_list[i] result.append(f) - stdlib.free(dir_list[i]) + free(dir_list[i]) i = i + 1 - stdlib.free(dir_list) + free(dir_list) return result - cpdef AfcFile open(self, bytes filename, bytes mode='r'): + cpdef AfcFile open(self, bytes filename, bytes mode=b'r'): cdef: afc_file_mode_t c_mode uint64_t handle @@ -241,7 +241,7 @@ cdef class AfcClient(BaseService): cpdef get_file_info(self, bytes path): cdef: - list result + list result = [] char** c_result int i = 0 bytes info @@ -254,9 +254,9 @@ cdef class AfcClient(BaseService): while c_result[i]: info = c_result[i] result.append(info) - stdlib.free(c_result[i]) + free(c_result[i]) i = i + 1 - stdlib.free(c_result) + free(c_result) return result diff --git a/cython/file_relay.pxi b/cython/file_relay.pxi index beb429b..450b030 100644 --- a/cython/file_relay.pxi +++ b/cython/file_relay.pxi @@ -31,7 +31,7 @@ cdef class FileRelayError(BaseError): } BaseError.__init__(self, *args, **kwargs) -cimport stdlib +from libc.stdlib cimport * cdef class FileRelayClient(PropertyListService): __service_name__ = "com.apple.mobile.file_relay" @@ -50,7 +50,7 @@ cdef class FileRelayClient(PropertyListService): cdef: file_relay_error_t err Py_ssize_t count = len(sources) - char** c_sources = <char**>stdlib.malloc(sizeof(char*) * (count + 1)) + char** c_sources = <char**>malloc(sizeof(char*) * (count + 1)) iDeviceConnection conn = iDeviceConnection.__new__(iDeviceConnection) for i, value in enumerate(sources): @@ -58,7 +58,7 @@ cdef class FileRelayClient(PropertyListService): c_sources[count] = NULL err = file_relay_request_sources(self._c_client, <const_sources_t>c_sources, &conn._c_connection) - stdlib.free(c_sources) + free(c_sources) self.handle_error(err) return conn diff --git a/cython/imobiledevice.pyx b/cython/imobiledevice.pyx index 7898290..654288e 100644 --- a/cython/imobiledevice.pyx +++ b/cython/imobiledevice.pyx @@ -134,7 +134,7 @@ cdef class iDeviceConnection(Base): cdef inline BaseError _error(self, int16_t ret): return iDeviceError(ret) -cimport stdlib +from libc.stdlib cimport * cdef class iDevice(Base): def __cinit__(self, object uuid=None, *args, **kwargs): @@ -180,7 +180,7 @@ cdef class iDevice(Base): return uuid except Exception, e: if uuid != NULL: - stdlib.free(uuid) + free(uuid) property handle: def __get__(self): cdef uint32_t handle diff --git a/cython/lockdown.pxi b/cython/lockdown.pxi index 8463738..b5207e8 100644 --- a/cython/lockdown.pxi +++ b/cython/lockdown.pxi @@ -90,7 +90,7 @@ cdef class LockdownPairRecord: return result cdef class LockdownClient(PropertyListService): - def __cinit__(self, iDevice device not None, bytes label="", bool handshake=True, *args, **kwargs): + def __cinit__(self, iDevice device not None, bytes label=b'', bint handshake=True, *args, **kwargs): cdef: lockdownd_error_t err char* c_label = NULL @@ -125,7 +125,7 @@ cdef class LockdownClient(PropertyListService): raise finally: if c_type != NULL: - stdlib.free(c_type) + free(c_type) cpdef plist.Node get_value(self, bytes domain=None, bytes key=None): cdef: @@ -212,7 +212,7 @@ cdef class LockdownClient(PropertyListService): raise finally: if c_session_id != NULL: - stdlib.free(c_session_id) + free(c_session_id) cpdef stop_session(self, bytes session_id): self.handle_error(lockdownd_stop_session(self._c_client, session_id)) diff --git a/cython/mobilesync.pxi b/cython/mobilesync.pxi index aef13f9..beafe10 100644 --- a/cython/mobilesync.pxi +++ b/cython/mobilesync.pxi @@ -35,7 +35,7 @@ cdef extern from "libimobiledevice/mobilesync.h": mobilesync_error_t mobilesync_get_all_records_from_device(mobilesync_client_t client) mobilesync_error_t mobilesync_get_changes_from_device(mobilesync_client_t client) - mobilesync_error_t mobilesync_receive_changes(mobilesync_client_t client, plist.plist_t *entities, uint8_t *is_last_record) + mobilesync_error_t mobilesync_receive_changes(mobilesync_client_t client, plist.plist_t *entities, uint8_t *is_last_record, plist.plist_t *actions) mobilesync_error_t mobilesync_acknowledge_changes_from_device(mobilesync_client_t client) mobilesync_error_t mobilesync_ready_to_send_changes_from_computer(mobilesync_client_t client) @@ -114,13 +114,15 @@ cdef class MobileSyncClient(DeviceLinkService): cdef: plist.plist_t entities = NULL uint8_t is_last_record = 0 - + plist.plist_t actions = NULL try: - self.handle_error(mobilesync_receive_changes(self._c_client, &entities, &is_last_record)) - return (plist.plist_t_to_node(entities), <bint>is_last_record) + self.handle_error(mobilesync_receive_changes(self._c_client, &entities, &is_last_record, &actions)) + return (plist.plist_t_to_node(entities), <bint>is_last_record, plist.plist_t_to_node(actions)) except Exception, e: if entities != NULL: plist.plist_free(entities) + if actions != NULL: + plist.plist_free(actions) raise cpdef acknowledge_changes_from_device(self): diff --git a/cython/sbservices.pxi b/cython/sbservices.pxi index 4d09b71..e826b2a 100644 --- a/cython/sbservices.pxi +++ b/cython/sbservices.pxi @@ -10,7 +10,7 @@ cdef extern from "libimobiledevice/sbservices.h": SBSERVICES_E_UNKNOWN_ERROR = -256 sbservices_error_t sbservices_client_new(idevice_t device, uint16_t port, sbservices_client_t *client) sbservices_error_t sbservices_client_free(sbservices_client_t client) - sbservices_error_t sbservices_get_icon_state(sbservices_client_t client, plist.plist_t *state) + sbservices_error_t sbservices_get_icon_state(sbservices_client_t client, plist.plist_t *state, char *format_version) sbservices_error_t sbservices_set_icon_state(sbservices_client_t client, plist.plist_t newstate) sbservices_error_t sbservices_get_icon_pngdata(sbservices_client_t client, char *bundleId, char **pngdata, uint64_t *pngsize) @@ -45,7 +45,7 @@ cdef class SpringboardServicesClient(PropertyListService): cdef: plist.plist_t c_node = NULL sbservices_error_t err - err = sbservices_get_icon_state(self._c_client, &c_node) + err = sbservices_get_icon_state(self._c_client, &c_node, NULL) try: self.handle_error(err) @@ -68,5 +68,5 @@ cdef class SpringboardServicesClient(PropertyListService): return pngdata[:pngsize] except BaseError, e: - stdlib.free(pngdata) + free(pngdata) raise diff --git a/cython/screenshotr.pxi b/cython/screenshotr.pxi index 9213b64..a53fab2 100644 --- a/cython/screenshotr.pxi +++ b/cython/screenshotr.pxi @@ -55,7 +55,7 @@ cdef class ScreenshotrClient(DeviceLinkService): return result except Exception, e: if c_data != NULL: - stdlib.free(c_data) + free(c_data) raise cdef inline BaseError _error(self, int16_t ret): |