diff options
author | Martin Szulecki | 2014-10-05 16:51:03 +0200 |
---|---|---|
committer | Martin Szulecki | 2014-10-05 16:51:03 +0200 |
commit | 5072dea1373b7c4789a9ea1e65d05ea30acf41ed (patch) | |
tree | 51bdd0584d727080fab86acd28bd4b360b2333bd /src | |
parent | 5552fa0fcc7501d3206fb3d3a64c1d04062ec53b (diff) | |
download | libimobiledevice-5072dea1373b7c4789a9ea1e65d05ea30acf41ed.tar.gz libimobiledevice-5072dea1373b7c4789a9ea1e65d05ea30acf41ed.tar.bz2 |
Convert int16_t macro error types into enum to improve debugging/type-checking
This simple change provides various benefits for developers like compile
time errors, better auto-completition in editors and the ability of a
debugger to show the constant instead of just the raw value.
Thanks to Aaron Burghardt for the proposal.
Diffstat (limited to 'src')
-rw-r--r-- | src/diagnostics_relay.c | 2 | ||||
-rw-r--r-- | src/lockdown.c | 8 | ||||
-rw-r--r-- | src/restore.c | 8 | ||||
-rw-r--r-- | src/service.c | 6 | ||||
-rw-r--r-- | src/syslog_relay.c | 2 |
5 files changed, 15 insertions, 11 deletions
diff --git a/src/diagnostics_relay.c b/src/diagnostics_relay.c index 055f60a..825678a 100644 --- a/src/diagnostics_relay.c +++ b/src/diagnostics_relay.c @@ -153,7 +153,7 @@ static diagnostics_relay_error_t diagnostics_relay_send(diagnostics_relay_client return DIAGNOSTICS_RELAY_E_INVALID_ARG; diagnostics_relay_error_t ret = DIAGNOSTICS_RELAY_E_SUCCESS; - idevice_error_t err; + property_list_service_error_t err; err = property_list_service_send_xml_plist(client->parent, plist); if (err != PROPERTY_LIST_SERVICE_E_SUCCESS) { diff --git a/src/lockdown.c b/src/lockdown.c index 8dc1644..14886c9 100644 --- a/src/lockdown.c +++ b/src/lockdown.c @@ -287,7 +287,7 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_send(lockdownd_client_t client, return LOCKDOWN_E_INVALID_ARG; lockdownd_error_t ret = LOCKDOWN_E_SUCCESS; - idevice_error_t err; + property_list_service_error_t err; err = property_list_service_send_xml_plist(client->parent, plist); if (err != PROPERTY_LIST_SERVICE_E_SUCCESS) { @@ -1031,6 +1031,7 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_goodbye(lockdownd_client_t clie LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_start_session(lockdownd_client_t client, const char *host_id, char **session_id, int *ssl_enabled) { lockdownd_error_t ret = LOCKDOWN_E_SUCCESS; + property_list_service_error_t plret; plist_t dict = NULL; if (!client || !host_id) @@ -1113,8 +1114,9 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_start_session(lockdownd_client_ debug_info("Enable SSL Session: %s", (use_ssl?"true":"false")); if (use_ssl) { - ret = property_list_service_enable_ssl(client->parent); - if (ret == PROPERTY_LIST_SERVICE_E_SUCCESS) { + plret = property_list_service_enable_ssl(client->parent); + if (plret == PROPERTY_LIST_SERVICE_E_SUCCESS) { + ret = LOCKDOWN_E_SUCCESS; client->ssl_enabled = 1; } else { ret = LOCKDOWN_E_SSL_ERROR; diff --git a/src/restore.c b/src/restore.c index 3f6be8f..4d4823f 100644 --- a/src/restore.c +++ b/src/restore.c @@ -154,7 +154,7 @@ LIBIMOBILEDEVICE_API restored_error_t restored_send(restored_client_t client, pl return RESTORE_E_INVALID_ARG; restored_error_t ret = RESTORE_E_SUCCESS; - idevice_error_t err; + property_list_service_error_t err; err = property_list_service_send_xml_plist(client->parent, plist); if (err != PROPERTY_LIST_SERVICE_E_SUCCESS) { @@ -297,6 +297,7 @@ LIBIMOBILEDEVICE_API restored_error_t restored_client_new(idevice_t device, rest return RESTORE_E_INVALID_ARG; restored_error_t ret = RESTORE_E_SUCCESS; + idevice_error_t idev_ret; static struct lockdownd_service_descriptor service = { .port = 0xf27e, @@ -317,9 +318,10 @@ LIBIMOBILEDEVICE_API restored_error_t restored_client_new(idevice_t device, rest if (label != NULL) client_loc->label = strdup(label); - ret = idevice_get_udid(device, &client_loc->udid); - if (RESTORE_E_SUCCESS != ret) { + idev_ret = idevice_get_udid(device, &client_loc->udid); + if (IDEVICE_E_SUCCESS != idev_ret) { debug_info("failed to get device udid."); + ret = RESTORE_E_DEVICE_ERROR; } debug_info("device udid: %s", client_loc->udid); diff --git a/src/service.c b/src/service.c index c4743dc..48959b6 100644 --- a/src/service.c +++ b/src/service.c @@ -76,7 +76,7 @@ LIBIMOBILEDEVICE_API service_error_t service_client_new(idevice_t device, lockdo return SERVICE_E_SUCCESS; } -LIBIMOBILEDEVICE_API service_error_t service_client_factory_start_service(idevice_t device, const char* service_name, void **client, const char* label, int16_t (*constructor_func)(idevice_t, lockdownd_service_descriptor_t, void**), int16_t *error_code) +LIBIMOBILEDEVICE_API service_error_t service_client_factory_start_service(idevice_t device, const char* service_name, void **client, const char* label, int32_t (*constructor_func)(idevice_t, lockdownd_service_descriptor_t, void**), int32_t *error_code) { *client = NULL; @@ -95,9 +95,9 @@ LIBIMOBILEDEVICE_API service_error_t service_client_factory_start_service(idevic return SERVICE_E_START_SERVICE_ERROR; } - int16_t ec; + int32_t ec; if (constructor_func) { - ec = (int16_t)constructor_func(device, service, client); + ec = (int32_t)constructor_func(device, service, client); } else { ec = service_client_new(device, service, (service_client_t*)client); } diff --git a/src/syslog_relay.c b/src/syslog_relay.c index 63e7d34..44006ce 100644 --- a/src/syslog_relay.c +++ b/src/syslog_relay.c @@ -139,7 +139,7 @@ LIBIMOBILEDEVICE_API syslog_relay_error_t syslog_relay_receive_with_timeout(sysl void *syslog_relay_worker(void *arg) { - service_error_t ret = SERVICE_E_UNKNOWN_ERROR; + syslog_relay_error_t ret = SYSLOG_RELAY_E_UNKNOWN_ERROR; struct syslog_relay_worker_thread *srwt = (struct syslog_relay_worker_thread*)arg; if (!srwt) |