summaryrefslogtreecommitdiffstats
path: root/include/libimobiledevice/service.h
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2014-10-05 16:51:03 +0200
committerGravatar Martin Szulecki2014-10-05 16:51:03 +0200
commit5072dea1373b7c4789a9ea1e65d05ea30acf41ed (patch)
tree51bdd0584d727080fab86acd28bd4b360b2333bd /include/libimobiledevice/service.h
parent5552fa0fcc7501d3206fb3d3a64c1d04062ec53b (diff)
downloadlibimobiledevice-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 'include/libimobiledevice/service.h')
-rw-r--r--include/libimobiledevice/service.h25
1 files changed, 11 insertions, 14 deletions
diff --git a/include/libimobiledevice/service.h b/include/libimobiledevice/service.h
index acf846b..760dbb4 100644
--- a/include/libimobiledevice/service.h
+++ b/include/libimobiledevice/service.h
@@ -30,23 +30,20 @@ extern "C" {
#include <libimobiledevice/libimobiledevice.h>
#include <libimobiledevice/lockdown.h>
-/** @name Error Codes */
-/*@{*/
-#define SERVICE_E_SUCCESS 0
-#define SERVICE_E_INVALID_ARG -1
-#define SERVICE_E_MUX_ERROR -3
-#define SERVICE_E_SSL_ERROR -4
-#define SERVICE_E_START_SERVICE_ERROR -5
-#define SERVICE_E_UNKNOWN_ERROR -256
-/*@}*/
-
-/** Represents an error code. */
-typedef int16_t service_error_t;
+/** Error Codes */
+typedef enum {
+ SERVICE_E_SUCCESS = 0,
+ SERVICE_E_INVALID_ARG = -1,
+ SERVICE_E_MUX_ERROR = -3,
+ SERVICE_E_SSL_ERROR = -4,
+ SERVICE_E_START_SERVICE_ERROR = -5,
+ SERVICE_E_UNKNOWN_ERROR = -256
+} service_error_t;
typedef struct service_client_private service_client_private;
typedef service_client_private* service_client_t; /**< The client handle. */
-#define SERVICE_CONSTRUCTOR(x) (int16_t (*)(idevice_t, lockdownd_service_descriptor_t, void**))(x)
+#define SERVICE_CONSTRUCTOR(x) (int32_t (*)(idevice_t, lockdownd_service_descriptor_t, void**))(x)
/* Interface */
@@ -79,7 +76,7 @@ service_error_t service_client_new(idevice_t device, lockdownd_service_descripto
* @return SERVICE_E_SUCCESS on success, or a SERVICE_E_* error code
* otherwise.
*/
-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);
+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);
/**
* Frees a service instance.