diff options
| author | 2016-03-21 11:27:26 +0300 | |
|---|---|---|
| committer | 2024-04-01 02:55:18 +0200 | |
| commit | 9eee3d14d19aaee60c3510c558a22ccb3dc2ce10 (patch) | |
| tree | 99354358ded5155890ba6c9bb002535705e5e38a /cython | |
| parent | fb1dec7e2cbb2eae14536d8d68db25d3f9384ac1 (diff) | |
| download | libimobiledevice-9eee3d14d19aaee60c3510c558a22ccb3dc2ce10.tar.gz libimobiledevice-9eee3d14d19aaee60c3510c558a22ccb3dc2ce10.tar.bz2 | |
cython: Allow passing null to lockdown set value
* added code to handle passing null values to lockdown_set_value,
needed for  example setting  device name .
Diffstat (limited to 'cython')
| -rw-r--r-- | cython/lockdown.pxi | 15 | 
1 files changed, 12 insertions, 3 deletions
| diff --git a/cython/lockdown.pxi b/cython/lockdown.pxi index 6b88f9d..25edb4c 100644 --- a/cython/lockdown.pxi +++ b/cython/lockdown.pxi | |||
| @@ -210,14 +210,23 @@ cdef class LockdownClient(PropertyListService): | |||
| 210 | raise | 210 | raise | 
| 211 | 211 | ||
| 212 | cpdef set_value(self, bytes domain, bytes key, object value): | 212 | cpdef set_value(self, bytes domain, bytes key, object value): | 
| 213 | cdef plist.plist_t c_node = plist.native_to_plist_t(value) | 213 | cdef: | 
| 214 | plist.plist_t c_node = NULL | ||
| 215 | char* c_domain = NULL | ||
| 216 | char* c_key = NULL | ||
| 217 | |||
| 218 | c_node = plist.native_to_plist_t(value) | ||
| 219 | if domain is not None: | ||
| 220 | c_domain = domain | ||
| 221 | if key is not None: | ||
| 222 | c_key = key | ||
| 214 | try: | 223 | try: | 
| 215 | self.handle_error(lockdownd_set_value(self._c_client, domain, key, c_node)) | 224 | self.handle_error(lockdownd_set_value(self._c_client, c_domain, c_key, c_node)) | 
| 216 | except BaseError, e: | 225 | except BaseError, e: | 
| 217 | raise | 226 | raise | 
| 218 | finally: | 227 | finally: | 
| 219 | if c_node != NULL: | 228 | if c_node != NULL: | 
| 220 | plist.plist_free(c_node) | 229 | c_node = NULL | 
| 221 | 230 | ||
| 222 | cpdef remove_value(self, bytes domain, bytes key): | 231 | cpdef remove_value(self, bytes domain, bytes key): | 
| 223 | self.handle_error(lockdownd_remove_value(self._c_client, domain, key)) | 232 | self.handle_error(lockdownd_remove_value(self._c_client, domain, key)) | 
