From 0d05f8de79ee91e9be80c6296eff9ce216582ba4 Mon Sep 17 00:00:00 2001 From: Jonathan Beck Date: Thu, 29 Jan 2009 22:30:16 +0100 Subject: Update to latest libplist API. --- src/MobileSync.c | 13 +++++-------- src/lockdown.c | 18 +++++++++--------- 2 files changed, 14 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/MobileSync.c b/src/MobileSync.c index 752aee9..839ed2b 100644 --- a/src/MobileSync.c +++ b/src/MobileSync.c @@ -222,7 +222,7 @@ iphone_error_t iphone_msync_get_all_contacts(iphone_msync_client_t client) ret = iphone_msync_recv(client, &array); - plist_t rep_node = plist_find_node(array, PLIST_STRING, "SDSyncTypeSlow", strlen("SDSyncTypeSlow")); + plist_t rep_node = plist_find_node_by_string(array, "SDSyncTypeSlow"); if (!rep_node) return ret; @@ -244,10 +244,9 @@ iphone_error_t iphone_msync_get_all_contacts(iphone_msync_client_t client) plist_t contact_node; plist_t switch_node; - contact_node = plist_find_node(array, PLIST_STRING, "com.apple.Contacts", strlen("com.apple.Contacts")); + contact_node = plist_find_node_by_string(array, "com.apple.Contacts"); switch_node = - plist_find_node(array, PLIST_STRING, "SDMessageDeviceReadyToReceiveChanges", - strlen("SDMessageDeviceReadyToReceiveChanges")); + plist_find_node_by_string(array, "SDMessageDeviceReadyToReceiveChanges"); while (NULL == switch_node) { @@ -264,10 +263,8 @@ iphone_error_t iphone_msync_get_all_contacts(iphone_msync_client_t client) ret = iphone_msync_recv(client, &array); - contact_node = plist_find_node(array, PLIST_STRING, "com.apple.Contacts", strlen("com.apple.Contacts")); - switch_node = - plist_find_node(array, PLIST_STRING, "SDMessageDeviceReadyToReceiveChanges", - strlen("SDMessageDeviceReadyToReceiveChanges")); + contact_node = plist_find_node_by_string(array, "com.apple.Contacts"); + switch_node = plist_find_node_by_string(array, "SDMessageDeviceReadyToReceiveChanges"); } array = plist_new_array(); diff --git a/src/lockdown.c b/src/lockdown.c index a02e6a8..2f48dfd 100644 --- a/src/lockdown.c +++ b/src/lockdown.c @@ -411,15 +411,15 @@ iphone_error_t lockdownd_generic_get_value(iphone_lckd_client_t control, const c if (!strcmp(result_key, "Value")) { log_dbg_msg(DBGMASK_LOCKDOWND, "lockdownd_generic_get_value(): success\n"); - plist_type value_value_type; - char *value_value = NULL; - uint64_t valval_length = 0; + plist_type value_value_type = plist_get_node_type(value_value_node); + if (PLIST_STRING == value_value_type) { + char *value_value = NULL; + plist_get_string_val(value_value_node, &value_value); - plist_get_type_and_value(value_value_node, &value_value_type, (void *) (&value_value), &valval_length); - - value->data = value_value; - value->size = valval_length; - ret = IPHONE_E_SUCCESS; + value->data = value_value; + value->size = strlen(value_value); + ret = IPHONE_E_SUCCESS; + } } free(result_key); } @@ -825,7 +825,7 @@ iphone_error_t lockdownd_start_SSL_session(iphone_lckd_client_t control, const c if (!dict) return IPHONE_E_PLIST_ERROR; - plist_t query_node = plist_find_node(dict, PLIST_STRING, "StartSession", strlen("StartSession")); + plist_t query_node = plist_find_node_by_string(dict, "StartSession"); plist_t result_key_node = plist_get_next_sibling(query_node); plist_t result_value_node = plist_get_next_sibling(result_key_node); -- cgit v1.1-32-gdbae