Changeset 4185:03264ac425a9 in roaraudio
- Timestamp:
- 08/14/10 16:40:16 (14 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroar/error.h
r3877 r4185 71 71 int roar_err_parsemsg(struct roar_message * mes, struct roar_error_frame * frame); 72 72 73 void roar_err_clear(void); 74 void roar_err_from_errno(void); 75 void roar_err_to_errno(void); 76 73 77 #endif 74 78 -
libroar/error.c
r3877 r4185 99 99 } 100 100 101 void roar_err_clear(void) { 102 roar_errno = ROAR_ERROR_NONE; 103 } 104 105 void roar_err_from_errno(void) { 106 switch (errno) { 107 #ifdef EPERM 108 case EPERM: roar_errno = ROAR_ERROR_PERM; break; 109 #endif 110 #ifdef ENOENT 111 case ENOENT: roar_errno = ROAR_ERROR_NOENT; break; 112 #endif 113 #ifdef EBADMSG 114 case EBADMSG: roar_errno = ROAR_ERROR_BADMSG; break; 115 #endif 116 #ifdef EBUSY 117 case EBUSY: roar_errno = ROAR_ERROR_BUSY; break; 118 #endif 119 #ifdef ECONNREFUSED 120 case ECONNREFUSED: roar_errno = ROAR_ERROR_CONNREFUSED; break; 121 #endif 122 #ifdef ENOSYS 123 case ENOSYS: roar_errno = ROAR_ERROR_NOSYS; break; 124 #endif 125 #ifdef ENOTSUP 126 case ENOTSUP: roar_errno = ROAR_ERROR_NOTSUP; break; 127 #endif 128 #ifdef EPIPE 129 case EPIPE: roar_errno = ROAR_ERROR_PIPE; break; 130 #endif 131 #ifdef EPROTO 132 case EPROTO: roar_errno = ROAR_ERROR_PROTO; break; 133 #endif 134 #ifdef ERANGE 135 case ERANGE: roar_errno = ROAR_ERROR_RANGE; break; 136 #endif 137 #ifdef EMSGSIZE 138 case EMSGSIZE: roar_errno = ROAR_ERROR_MSGSIZE; break; 139 #endif 140 #ifdef ENOMEM 141 case ENOMEM: roar_errno = ROAR_ERROR_NOMEM; break; 142 #endif 143 #ifdef EINVAL 144 case EINVAL: roar_errno = ROAR_ERROR_INVAL; break; 145 #endif 146 default: 147 roar_errno = ROAR_ERROR_UNKNOWN; 148 break; 149 } 150 } 151 152 void roar_err_to_errno(void) { 153 switch (roar_errno) { 154 case ROAR_ERROR_NONE: 155 errno = 0; // just gussing 156 break; 157 #ifdef EPERM 158 case ROAR_ERROR_PERM: 159 errno = EPERM; 160 break; 161 #endif 162 #ifdef ENOENT 163 case ROAR_ERROR_NOENT: 164 errno = ENOENT; 165 break; 166 #endif 167 #ifdef EBADMSG 168 case ROAR_ERROR_BADMSG: 169 errno = EBADMSG; 170 break; 171 #endif 172 #ifdef EBUSY 173 case ROAR_ERROR_BUSY: 174 errno = EBUSY; 175 break; 176 #endif 177 #ifdef ECONNREFUSED 178 case ROAR_ERROR_CONNREFUSED: 179 errno = ECONNREFUSED; 180 break; 181 #endif 182 #ifdef ENOSYS 183 case ROAR_ERROR_NOSYS: 184 errno = ENOSYS; 185 break; 186 #endif 187 #ifdef ENOTSUP 188 case ROAR_ERROR_NOTSUP: 189 errno = ENOTSUP; 190 break; 191 #endif 192 #ifdef EPIPE 193 case ROAR_ERROR_PIPE: 194 errno = EPIPE; 195 break; 196 #endif 197 #ifdef EPROTO 198 case ROAR_ERROR_PROTO: 199 errno = EPROTO; 200 break; 201 #endif 202 #ifdef ERANGE 203 case ROAR_ERROR_RANGE: 204 errno = ERANGE; 205 break; 206 #endif 207 #ifdef EMSGSIZE 208 case ROAR_ERROR_MSGSIZE: 209 errno = EMSGSIZE; 210 break; 211 #endif 212 #ifdef ENOMEM 213 case ROAR_ERROR_NOMEM: 214 errno = ENOMEM; 215 break; 216 #endif 217 #ifdef EINVAL 218 case ROAR_ERROR_INVAL: 219 errno = EINVAL; 220 break; 221 #endif 222 default: 223 #ifdef EINVAL 224 errno = EINVAL; 225 #else 226 errno = -1; // just guess 227 #endif 228 break; 229 } 230 } 231 101 232 //ll
Note: See TracChangeset
for help on using the changeset viewer.