From 5072dea1373b7c4789a9ea1e65d05ea30acf41ed Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sun, 5 Oct 2014 16:51:03 +0200 Subject: 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. --- include/libimobiledevice/mobilesync.h | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'include/libimobiledevice/mobilesync.h') 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 */ -- cgit v1.1-32-gdbae