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 /include/libimobiledevice/mobilesync.h | |
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 'include/libimobiledevice/mobilesync.h')
-rw-r--r-- | include/libimobiledevice/mobilesync.h | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/include/libimobiledevice/mobilesync.h b/include/libimobiledevice/mobilesync.h index 6ba197b..3c0d576 100644 --- a/include/libimobiledevice/mobilesync.h +++ b/include/libimobiledevice/mobilesync.h @@ -33,20 +33,19 @@ extern "C" { #define MOBILESYNC_SERVICE_NAME "com.apple.mobilesync" -/** @name Error Codes */ -/*@{*/ -#define MOBILESYNC_E_SUCCESS 0 -#define MOBILESYNC_E_INVALID_ARG -1 -#define MOBILESYNC_E_PLIST_ERROR -2 -#define MOBILESYNC_E_MUX_ERROR -3 -#define MOBILESYNC_E_BAD_VERSION -4 -#define MOBILESYNC_E_SYNC_REFUSED -5 -#define MOBILESYNC_E_CANCELLED -6 -#define MOBILESYNC_E_WRONG_DIRECTION -7 -#define MOBILESYNC_E_NOT_READY -8 - -#define MOBILESYNC_E_UNKNOWN_ERROR -256 -/*@}*/ +/** Error Codes */ +typedef enum { + MOBILESYNC_E_SUCCESS = 0, + MOBILESYNC_E_INVALID_ARG = -1, + MOBILESYNC_E_PLIST_ERROR = -2, + MOBILESYNC_E_MUX_ERROR = -3, + MOBILESYNC_E_BAD_VERSION = -4, + MOBILESYNC_E_SYNC_REFUSED = -5, + MOBILESYNC_E_CANCELLED = -6, + MOBILESYNC_E_WRONG_DIRECTION = -7, + MOBILESYNC_E_NOT_READY = -8, + MOBILESYNC_E_UNKNOWN_ERROR = -256 +} mobilesync_error_t; /** The sync type of the current sync session. */ typedef enum { @@ -55,9 +54,6 @@ typedef enum { MOBILESYNC_SYNC_TYPE_RESET /**< Reset-sync signals that the computer should send all data again. */ } mobilesync_sync_type_t; -/** Represents an error code. */ -typedef int16_t mobilesync_error_t; - typedef struct mobilesync_client_private mobilesync_client_private; typedef mobilesync_client_private *mobilesync_client_t; /**< The client handle */ |