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/afc.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/afc.h')
-rw-r--r-- | include/libimobiledevice/afc.h | 67 |
1 files changed, 32 insertions, 35 deletions
diff --git a/include/libimobiledevice/afc.h b/include/libimobiledevice/afc.h index b045554..7637db5 100644 --- a/include/libimobiledevice/afc.h +++ b/include/libimobiledevice/afc.h @@ -33,41 +33,38 @@ extern "C" { #define AFC_SERVICE_NAME "com.apple.afc" -/** @name Error Codes */ -/*@{*/ -#define AFC_E_SUCCESS 0 -#define AFC_E_UNKNOWN_ERROR 1 -#define AFC_E_OP_HEADER_INVALID 2 -#define AFC_E_NO_RESOURCES 3 -#define AFC_E_READ_ERROR 4 -#define AFC_E_WRITE_ERROR 5 -#define AFC_E_UNKNOWN_PACKET_TYPE 6 -#define AFC_E_INVALID_ARG 7 -#define AFC_E_OBJECT_NOT_FOUND 8 -#define AFC_E_OBJECT_IS_DIR 9 -#define AFC_E_PERM_DENIED 10 -#define AFC_E_SERVICE_NOT_CONNECTED 11 -#define AFC_E_OP_TIMEOUT 12 -#define AFC_E_TOO_MUCH_DATA 13 -#define AFC_E_END_OF_DATA 14 -#define AFC_E_OP_NOT_SUPPORTED 15 -#define AFC_E_OBJECT_EXISTS 16 -#define AFC_E_OBJECT_BUSY 17 -#define AFC_E_NO_SPACE_LEFT 18 -#define AFC_E_OP_WOULD_BLOCK 19 -#define AFC_E_IO_ERROR 20 -#define AFC_E_OP_INTERRUPTED 21 -#define AFC_E_OP_IN_PROGRESS 22 -#define AFC_E_INTERNAL_ERROR 23 - -#define AFC_E_MUX_ERROR 30 -#define AFC_E_NO_MEM 31 -#define AFC_E_NOT_ENOUGH_DATA 32 -#define AFC_E_DIR_NOT_EMPTY 33 -/*@}*/ - -/** Represents an error code. */ -typedef int16_t afc_error_t; +/** Error Codes */ +typedef enum { + AFC_E_SUCCESS = 0, + AFC_E_UNKNOWN_ERROR = 1, + AFC_E_OP_HEADER_INVALID = 2, + AFC_E_NO_RESOURCES = 3, + AFC_E_READ_ERROR = 4, + AFC_E_WRITE_ERROR = 5, + AFC_E_UNKNOWN_PACKET_TYPE = 6, + AFC_E_INVALID_ARG = 7, + AFC_E_OBJECT_NOT_FOUND = 8, + AFC_E_OBJECT_IS_DIR = 9, + AFC_E_PERM_DENIED = 10, + AFC_E_SERVICE_NOT_CONNECTED = 11, + AFC_E_OP_TIMEOUT = 12, + AFC_E_TOO_MUCH_DATA = 13, + AFC_E_END_OF_DATA = 14, + AFC_E_OP_NOT_SUPPORTED = 15, + AFC_E_OBJECT_EXISTS = 16, + AFC_E_OBJECT_BUSY = 17, + AFC_E_NO_SPACE_LEFT = 18, + AFC_E_OP_WOULD_BLOCK = 19, + AFC_E_IO_ERROR = 20, + AFC_E_OP_INTERRUPTED = 21, + AFC_E_OP_IN_PROGRESS = 22, + AFC_E_INTERNAL_ERROR = 23, + AFC_E_MUX_ERROR = 30, + AFC_E_NO_MEM = 31, + AFC_E_NOT_ENOUGH_DATA = 32, + AFC_E_DIR_NOT_EMPTY = 33, + AFC_E_FORCE_SIGNED_TYPE = -1 +} afc_error_t; /** Flags for afc_file_open */ typedef enum { |