diff options
-rw-r--r-- | dev/msyncclient.c | 2 | ||||
-rw-r--r-- | include/libiphone/libiphone.h | 11 | ||||
-rw-r--r-- | src/MobileSync.c | 8 | ||||
-rw-r--r-- | src/usbmux.c | 1 | ||||
-rw-r--r-- | src/utils.h | 6 |
5 files changed, 16 insertions, 12 deletions
diff --git a/dev/msyncclient.c b/dev/msyncclient.c index a6764b4..2762f04 100644 --- a/dev/msyncclient.c +++ b/dev/msyncclient.c @@ -28,8 +28,6 @@ #include <libxml/tree.h> #include <libiphone/libiphone.h> -#include "../src/MobileSync.h" -#include "../src/utils.h" int main(int argc, char *argv[]) diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index 59d2de2..6197923 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h @@ -81,8 +81,17 @@ typedef struct iphone_afc_file_int *iphone_afc_file_t; struct iphone_msync_client_int; typedef struct iphone_msync_client_int *iphone_msync_client_t; -//device related functions +//debug related functions +#define DBGMASK_ALL 0xFFFF +#define DBGMASK_NONE 0x0000 +#define DBGMASK_USBMUX (1 << 1) +#define DBGMASK_LOCKDOWND (1 << 2) +#define DBGMASK_MOBILESYNC (1 << 3) + +void iphone_set_debug_mask(uint16_t mask); void iphone_set_debug(int level); + +//device related functions iphone_error_t iphone_get_device ( iphone_device_t *device ); iphone_error_t iphone_free_device ( iphone_device_t device ); diff --git a/src/MobileSync.c b/src/MobileSync.c index a2a361e..752aee9 100644 --- a/src/MobileSync.c +++ b/src/MobileSync.c @@ -51,7 +51,7 @@ iphone_error_t iphone_msync_new_client(iphone_device_t device, int src_port, int ret = iphone_msync_recv(client_loc, &array); plist_t msg_node = - plist_find_node(array, PLIST_STRING, "DLMessageVersionExchange", strlen("DLMessageVersionExchange")); + plist_find_node_by_string(array, "DLMessageVersionExchange"); plist_t ver_1 = plist_get_next_sibling(msg_node); plist_t ver_2 = plist_get_next_sibling(ver_1); @@ -83,7 +83,7 @@ iphone_error_t iphone_msync_new_client(iphone_device_t device, int src_port, int ret = iphone_msync_recv(client_loc, &array); plist_t rep_node = - plist_find_node(array, PLIST_STRING, "DLMessageDeviceReady", strlen("DLMessageDeviceReady")); + plist_find_node_by_string(array, "DLMessageDeviceReady"); if (rep_node) { ret = IPHONE_E_SUCCESS; @@ -117,8 +117,10 @@ static void iphone_msync_stop_session(iphone_msync_client_t client) iphone_error_t iphone_msync_free_client(iphone_msync_client_t client) { - iphone_msync_stop_session(client); + if (!client) + return IPHONE_E_INVALID_ARG; + iphone_msync_stop_session(client); return iphone_mux_free_client(client->connection); } diff --git a/src/usbmux.c b/src/usbmux.c index eb7ec97..5eaa1d1 100644 --- a/src/usbmux.c +++ b/src/usbmux.c @@ -313,6 +313,7 @@ iphone_error_t iphone_mux_recv(iphone_umux_client_t client, char *data, uint32_t } else { memcpy(data, client->recv_buffer, client->r_len); free(client->recv_buffer); // don't need to deal with anymore, but... + client->recv_buffer = NULL; offset = client->r_len; // see #2b, above client->r_len = 0; } diff --git a/src/utils.h b/src/utils.h index d9a441d..1750b8e 100644 --- a/src/utils.h +++ b/src/utils.h @@ -24,13 +24,7 @@ #include "libiphone/libiphone.h" -#define DBGMASK_ALL 0xFFFF -#define DBGMASK_NONE 0x0000 -#define DBGMASK_USBMUX (1 << 1) -#define DBGMASK_LOCKDOWND (1 << 2) -#define DBGMASK_MOBILESYNC (1 << 3) -void iphone_set_debug_mask(uint16_t mask); inline void log_debug_msg(const char *format, ...); inline void log_dbg_msg(uint16_t id, const char *format, ...); |