Changeset 4793:a5f42917b666 in roaraudio for libroar/error.c


Ignore:
Timestamp:
03/14/11 14:25:13 (13 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Moved error string lookup from VS into error.c (pr1)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/error.c

    r4708 r4793  
    230230} 
    231231 
     232 
     233const char * roar_error2str(const int error) { 
     234 const struct { 
     235  const int    err; 
     236  const char * msg; 
     237 } msgs[] = { 
     238  {ROAR_ERROR_NONE,        "No error"}, 
     239  {ROAR_ERROR_PERM,        "Operation not permitted"}, 
     240  {ROAR_ERROR_NOENT,       "No such object, file or directory"}, 
     241  {ROAR_ERROR_BADMSG,      "Bad message"}, 
     242  {ROAR_ERROR_BUSY,        "Device or resource busy"}, 
     243  {ROAR_ERROR_CONNREFUSED, "Connection refused"}, 
     244  {ROAR_ERROR_NOSYS,       "Function not implemented"}, 
     245  {ROAR_ERROR_NOTSUP,      "Operation not supported"}, 
     246  {ROAR_ERROR_PIPE,        "Broken pipe"}, 
     247  {ROAR_ERROR_PROTO,       "Protocol error"}, 
     248  {ROAR_ERROR_RANGE,       "Result too large or parameter out of range"}, 
     249  {ROAR_ERROR_MSGSIZE,     "Message too long"}, 
     250  {ROAR_ERROR_NOMEM,       "Not enough space"}, 
     251  {ROAR_ERROR_INVAL,       "Invalid argument"}, 
     252  {-1, NULL} 
     253 }; 
     254 int i; 
     255 
     256 for (i = 0; msgs[i].msg != NULL; i++) 
     257  if ( msgs[i].err == error ) 
     258   return msgs[i].msg; 
     259 
     260 return NULL; 
     261} 
     262 
    232263//ll 
Note: See TracChangeset for help on using the changeset viewer.