Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| SHA1 Hash: | 559e94a378325c28cb447d64abc11cba8f460fdc |
|---|---|
| Date: | 2010-03-12 02:39:25 |
| User: | stephan |
| Comment: | added whio_rc_string() and whio_rc.HashingError. |
Tags And Properties
- branch=trunk inherited from [c3e484d316]
- sym-trunk inherited from [c3e484d316]
Changes
Changes to include/wh/whio/whio_common.h
| Old (9471ec793811d188) | New (5549ed9f14e5052e) | |||
|---|---|---|---|---|
| 1 | #ifndef WANDERINGHORSE_NET_WHIO_COMMON_H_INCLUDED | 1 | #ifndef WANDERINGHORSE_NET_WHIO_COMMON_H_INCLUDED | |
| 2 | #define WANDERINGHORSE_NET_WHIO_COMMON_H_INCLUDED | 2 | #define WANDERINGHORSE_NET_WHIO_COMMON_H_INCLUDED | |
| 3 | /* | 3 | /* | |
| 4 | Common API declarations for the whio API. | 4 | Common API declarations for the whio API. | |
| 5 | 5 | |||
| 113 hidden lines | ||||
| 119 | devices which support locking. | 119 | devices which support locking. | |
| 120 | */ | 120 | */ | |
| 121 | int LockingError; | 121 | int LockingError; | |
| 122 | 122 | |||
| 123 | /** | 123 | /** | |
| > | 124 | Indicates some form of device-specific hashing-related error. | ||
| > | 125 | */ | ||
| > | 126 | int HashingError; | ||
| > | 127 | |||
| > | 128 | /** | ||
| 124 | The catch-all "nobody really knows what happened" error. | 129 | The catch-all "nobody really knows what happened" error. | |
| 125 | */ | 130 | */ | |
| 126 | int WTFError; | 131 | int WTFError; | |
| 127 | 132 | |||
| 128 | /** | 133 | /** | |
| 6 hidden lines | ||||
| 135 | /** @var whio_rc | 140 | /** @var whio_rc | |
| 136 | A shared instance of whio_rc_t which contains the "official" values | 141 | A shared instance of whio_rc_t which contains the "official" values | |
| 137 | of the common error codes for the whio API. | 142 | of the common error codes for the whio API. | |
| 138 | */ | 143 | */ | |
| 139 | extern const whio_rc_t whio_rc; | 144 | extern const whio_rc_t whio_rc; | |
| > | 145 | |||
| > | 146 | /** | ||
| > | 147 | When passed one of the integer values from the whio_rc object | ||
| > | 148 | this function returns a string in the form "whio_rc.ErrorName". | ||
| > | 149 | If rc is not a known error value then NULL is returned. | ||
| > | 150 | |||
| > | 151 | The returned string is static. | ||
| > | 152 | */ | ||
| > | 153 | char const * whio_rc_string( int rc ); | ||
| 140 | 154 | |||
| 141 | /** @struct whio_client_data | 155 | /** @struct whio_client_data | |
| 142 | 156 | |||
| 143 | whio_client_data is an abstraction for tying client-specific data to a | 157 | whio_client_data is an abstraction for tying client-specific data to a | |
| 144 | whio_dev or whio_stream object. The data is not used by the public | 158 | whio_dev or whio_stream object. The data is not used by the public | |
| 300 hidden lines | ||||
| 445 | #ifdef __cplusplus | 459 | #ifdef __cplusplus | |
| 446 | } /* extern "C" */ | 460 | } /* extern "C" */ | |
| 447 | #endif | 461 | #endif | |
| 448 | 462 | |||
| 449 | #endif /* WANDERINGHORSE_NET_WHIO_COMMON_H_INCLUDED */ | 463 | #endif /* WANDERINGHORSE_NET_WHIO_COMMON_H_INCLUDED */ | |
Changes to src/whio.c
| Old (628dc1a89254ac35) | New (99796b311667c4cc) | |||
|---|---|---|---|---|
| 1 | /* | 1 | /* | |
| 2 | Author: Stephan Beal (http://wanderinghorse.net/home/stephan/) | 2 | Author: Stephan Beal (http://wanderinghorse.net/home/stephan/) | |
| 3 | 3 | |||
| 4 | License: Public Domain | 4 | License: Public Domain | |
| 5 | */ | 5 | */ | |
| 23 hidden lines | ||||
| 29 | -10, /* NYIError */ | 29 | -10, /* NYIError */ | |
| 30 | -11, /* UnsupportedError */ | 30 | -11, /* UnsupportedError */ | |
| 31 | -12, /* TypeError */ | 31 | -12, /* TypeError */ | |
| 32 | -13, /* DeviceFullError */ | 32 | -13, /* DeviceFullError */ | |
| 33 | -14, /* LockingError */ | 33 | -14, /* LockingError */ | |
| 34 | -15, /* WTFError */ | | | 34 | -15, /* HashingError */ |
| | | 35 | -16, /* WTFError */ | ||
| 35 | (whio_size_t)-1 /* SizeTError */ | 36 | (whio_size_t)-1 /* SizeTError */ | |
| 36 | }; | 37 | }; | |
| 37 | 38 | |||
| 38 | 39 | |||
| > | 40 | char const * whio_rc_string( int rc ) | ||
| > | 41 | { | ||
| > | 42 | /* can't use switch(rc) here b/c we can't use | ||
| > | 43 | whio_rc.XXX in a case label. | ||
| > | 44 | */ | ||
| > | 45 | if( ! rc ) return "whio_rc.OK"; | ||
| > | 46 | #define C(X) else if( whio_rc.X == rc ) return "whio_rc."#X | ||
| > | 47 | C(ArgError); | ||
| > | 48 | C(IOError); | ||
| > | 49 | C(AllocError); | ||
| > | 50 | C(InternalError); | ||
| > | 51 | C(RangeError); | ||
| > | 52 | C(InterruptedError); | ||
| > | 53 | C(AccessError); | ||
| > | 54 | C(ConsistencyError); | ||
| > | 55 | C(NYIError); | ||
| > | 56 | C(UnsupportedError); | ||
| > | 57 | C(TypeError); | ||
| > | 58 | C(DeviceFullError); | ||
| > | 59 | C(LockingError); | ||
| > | 60 | C(HashingError); | ||
| > | 61 | C(WTFError); | ||
| > | 62 | #undef C | ||
| > | 63 | else return NULL; | ||
| > | 64 | } | ||
| 39 | 65 | |||
| 40 | void whio_noop_printf(char const * fmt, ...) | 66 | void whio_noop_printf(char const * fmt, ...) | |
| 41 | { | 67 | { | |
| 42 | } | 68 | } | |
| 43 | static void * whio_realloc_default( void * m, unsigned int n, void * state ) | 69 | static void * whio_realloc_default( void * m, unsigned int n, void * state ) | |
| 15 hidden lines | ||||
| 59 | void whio_free( void * m ) | 85 | void whio_free( void * m ) | |
| 60 | { | 86 | { | |
| 61 | if(NULL != m) whio_realloc( m, 0 ); | 87 | if(NULL != m) whio_realloc( m, 0 ); | |
| 62 | return; | 88 | return; | |
| 63 | } | 89 | } | |