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/libimobiledevice.h | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'include/libimobiledevice/libimobiledevice.h') diff --git a/include/libimobiledevice/libimobiledevice.h b/include/libimobiledevice/libimobiledevice.h index 3cbb96b..c91ec83 100644 --- a/include/libimobiledevice/libimobiledevice.h +++ b/include/libimobiledevice/libimobiledevice.h @@ -32,19 +32,16 @@ extern "C" { #include #include -/** @name Error Codes */ -/*@{*/ -#define IDEVICE_E_SUCCESS 0 -#define IDEVICE_E_INVALID_ARG -1 -#define IDEVICE_E_UNKNOWN_ERROR -2 -#define IDEVICE_E_NO_DEVICE -3 -#define IDEVICE_E_NOT_ENOUGH_DATA -4 -#define IDEVICE_E_BAD_HEADER -5 -#define IDEVICE_E_SSL_ERROR -6 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t idevice_error_t; +/** Error Codes */ +typedef enum { + IDEVICE_E_SUCCESS = 0, + IDEVICE_E_INVALID_ARG = -1, + IDEVICE_E_UNKNOWN_ERROR = -2, + IDEVICE_E_NO_DEVICE = -3, + IDEVICE_E_NOT_ENOUGH_DATA = -4, + IDEVICE_E_BAD_HEADER = -5, + IDEVICE_E_SSL_ERROR = -6 +} idevice_error_t; typedef struct idevice_private idevice_private; typedef idevice_private *idevice_t; /**< The device handle. */ -- cgit v1.1-32-gdbae