From 19a28b0ed18c8ca2f855e7d129ddcdb8c939a707 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Fri, 24 Jul 2009 23:51:53 +0200 Subject: Use iphone_device_get_uuid() not lockdown, for less overhead where possible --- src/iphone.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/iphone.c') diff --git a/src/iphone.c b/src/iphone.c index 0e179e7..93d7b5d 100644 --- a/src/iphone.c +++ b/src/iphone.c @@ -104,13 +104,13 @@ uint32_t iphone_get_device_handle(iphone_device_t device) } } -char* iphone_get_uuid(iphone_device_t device) +iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid) { - if (device) { - return device->serial_number; - } else { - return NULL; - } + if (!device) + return IPHONE_E_INVALID_ARG; + + *uuid = strdup(device->serial_number); + return IPHONE_E_SUCCESS; } /** Cleans up an iPhone structure, then frees the structure itself. -- cgit v1.1-32-gdbae From 5cb9ecc85240102402082c442d561d7350732027 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 25 Jul 2009 02:54:40 +0200 Subject: Follow glib style and rename iphone_free_device to iphone_device_free --- src/iphone.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/iphone.c') diff --git a/src/iphone.c b/src/iphone.c index 93d7b5d..bdabc35 100644 --- a/src/iphone.c +++ b/src/iphone.c @@ -52,11 +52,11 @@ iphone_error_t iphone_get_device_by_uuid(iphone_device_t * device, const char *u } if (dev_list && dev_list[0].handle > 0) { if (!uuid) { - // select first device found if no UUID specified + /* select first device found if no UUID specified */ handle = dev_list[0].handle; strcpy(serial_number, dev_list[0].serial_number); } else { - // otherwise walk through the list + /* otherwise walk through the list */ for (i = 0; dev_list[i].handle > 0; i++) { log_debug_msg("%s: device handle=%d, uuid=%s\n", __func__, dev_list[i].handle, dev_list[i].serial_number); if (strcasecmp(uuid, dev_list[i].serial_number) == 0) { @@ -119,7 +119,7 @@ iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid) * * @param phone A pointer to an iPhone structure. */ -iphone_error_t iphone_free_device(iphone_device_t device) +iphone_error_t iphone_device_free(iphone_device_t device) { if (!device) return IPHONE_E_INVALID_ARG; -- cgit v1.1-32-gdbae From 1cfc2748d38eb97100cabced3b282108898099c2 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 25 Jul 2009 03:07:01 +0200 Subject: Rename iphone_get_device_handle to iphone_device_get_handle and update tools --- src/iphone.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/iphone.c') diff --git a/src/iphone.c b/src/iphone.c index bdabc35..e694373 100644 --- a/src/iphone.c +++ b/src/iphone.c @@ -19,13 +19,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "iphone.h" -#include "utils.h" #include #include #include -#include -#include + +#include "iphone.h" +#include "utils.h" /** * Retrieves a list of connected devices from usbmuxd and matches their @@ -95,13 +94,13 @@ iphone_error_t iphone_get_device(iphone_device_t * device) return iphone_get_device_by_uuid(device, NULL); } -uint32_t iphone_get_device_handle(iphone_device_t device) +iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle) { - if (device) { - return device->handle; - } else { - return 0; - } + if (!device) + return IPHONE_E_INVALID_ARG; + + *handle = device->handle; + return IPHONE_E_SUCCESS; } iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid) -- cgit v1.1-32-gdbae