summaryrefslogtreecommitdiffstats
path: root/include/libimobiledevice/afc.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/afc.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/afc.h')
-rw-r--r--include/libimobiledevice/afc.h67
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" {
33 33
34#define AFC_SERVICE_NAME "com.apple.afc" 34#define AFC_SERVICE_NAME "com.apple.afc"
35 35
36/** @name Error Codes */ 36/** Error Codes */
37/*@{*/ 37typedef enum {
38#define AFC_E_SUCCESS 0 38 AFC_E_SUCCESS = 0,
39#define AFC_E_UNKNOWN_ERROR 1 39 AFC_E_UNKNOWN_ERROR = 1,
40#define AFC_E_OP_HEADER_INVALID 2 40 AFC_E_OP_HEADER_INVALID = 2,
41#define AFC_E_NO_RESOURCES 3 41 AFC_E_NO_RESOURCES = 3,
42#define AFC_E_READ_ERROR 4 42 AFC_E_READ_ERROR = 4,
43#define AFC_E_WRITE_ERROR 5 43 AFC_E_WRITE_ERROR = 5,
44#define AFC_E_UNKNOWN_PACKET_TYPE 6 44 AFC_E_UNKNOWN_PACKET_TYPE = 6,
45#define AFC_E_INVALID_ARG 7 45 AFC_E_INVALID_ARG = 7,
46#define AFC_E_OBJECT_NOT_FOUND 8 46 AFC_E_OBJECT_NOT_FOUND = 8,
47#define AFC_E_OBJECT_IS_DIR 9 47 AFC_E_OBJECT_IS_DIR = 9,
48#define AFC_E_PERM_DENIED 10 48 AFC_E_PERM_DENIED = 10,
49#define AFC_E_SERVICE_NOT_CONNECTED 11 49 AFC_E_SERVICE_NOT_CONNECTED = 11,
50#define AFC_E_OP_TIMEOUT 12 50 AFC_E_OP_TIMEOUT = 12,
51#define AFC_E_TOO_MUCH_DATA 13 51 AFC_E_TOO_MUCH_DATA = 13,
52#define AFC_E_END_OF_DATA 14 52 AFC_E_END_OF_DATA = 14,
53#define AFC_E_OP_NOT_SUPPORTED 15 53 AFC_E_OP_NOT_SUPPORTED = 15,
54#define AFC_E_OBJECT_EXISTS 16 54 AFC_E_OBJECT_EXISTS = 16,
55#define AFC_E_OBJECT_BUSY 17 55 AFC_E_OBJECT_BUSY = 17,
56#define AFC_E_NO_SPACE_LEFT 18 56 AFC_E_NO_SPACE_LEFT = 18,
57#define AFC_E_OP_WOULD_BLOCK 19 57 AFC_E_OP_WOULD_BLOCK = 19,
58#define AFC_E_IO_ERROR 20 58 AFC_E_IO_ERROR = 20,
59#define AFC_E_OP_INTERRUPTED 21 59 AFC_E_OP_INTERRUPTED = 21,
60#define AFC_E_OP_IN_PROGRESS 22 60 AFC_E_OP_IN_PROGRESS = 22,
61#define AFC_E_INTERNAL_ERROR 23 61 AFC_E_INTERNAL_ERROR = 23,
62 62 AFC_E_MUX_ERROR = 30,
63#define AFC_E_MUX_ERROR 30 63 AFC_E_NO_MEM = 31,
64#define AFC_E_NO_MEM 31 64 AFC_E_NOT_ENOUGH_DATA = 32,
65#define AFC_E_NOT_ENOUGH_DATA 32 65 AFC_E_DIR_NOT_EMPTY = 33,
66#define AFC_E_DIR_NOT_EMPTY 33 66 AFC_E_FORCE_SIGNED_TYPE = -1
67/*@}*/ 67} afc_error_t;
68
69/** Represents an error code. */
70typedef int16_t afc_error_t;
71 68
72/** Flags for afc_file_open */ 69/** Flags for afc_file_open */
73typedef enum { 70typedef enum {