Changeset 4793:a5f42917b666 in roaraudio for libroar/vs.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/vs.c

    r4772 r4793  
    8181 
    8282const char * roar_vs_strerr(int error) { 
    83  const struct { 
    84   int err; 
    85   const char * msg; 
    86  } msgs[] = { 
    87   {ROAR_ERROR_NONE,        "No error"}, 
    88   {ROAR_ERROR_PERM,        "Operation not permitted"}, 
    89   {ROAR_ERROR_NOENT,       "No such object, file or directory"}, 
    90   {ROAR_ERROR_BADMSG,      "Bad message"}, 
    91   {ROAR_ERROR_BUSY,        "Device or resource busy"}, 
    92   {ROAR_ERROR_CONNREFUSED, "Connection refused"}, 
    93   {ROAR_ERROR_NOSYS,       "Function not implemented"}, 
    94   {ROAR_ERROR_NOTSUP,      "Operation not supported"}, 
    95   {ROAR_ERROR_PIPE,        "Broken pipe"}, 
    96   {ROAR_ERROR_PROTO,       "Protocol error"}, 
    97   {ROAR_ERROR_RANGE,       "Result too large or parameter out of range"}, 
    98   {ROAR_ERROR_MSGSIZE,     "Message too long"}, 
    99   {ROAR_ERROR_NOMEM,       "Not enough space"}, 
    100   {ROAR_ERROR_INVAL,       "Invalid argument"}, 
    101   {-1, NULL} 
    102  }; 
    103  int i; 
    104  
    105  for (i = 0; msgs[i].msg != NULL; i++) 
    106   if ( msgs[i].err == error ) 
    107    return msgs[i].msg; 
    108  
    109  return "(unknown)"; 
     83 const char * ret = roar_error2str(error); 
     84 
     85 if ( ret == NULL ) 
     86  return "(unknown)"; 
     87 
     88 return ret; 
    11089} 
    11190 
Note: See TracChangeset for help on using the changeset viewer.