source: roaraudio/libroarpulse/error.c @ 3481:22f4d04a1114

Last change on this file since 3481:22f4d04a1114 was 3444:ba88a49e6ad6, checked in by phi, 14 years ago

implemented pa_strerror()

File size: 3.2 KB
Line 
1//error.c:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010
5 *  The code (may) include prototypes and comments (and maybe
6 *  other code fragements) from libpulse*. They are mostly copyrighted by:
7 *  Lennart Poettering <poettering@users.sourceforge.net> and
8 *  Pierre Ossman <drzeus@drzeus.cx>
9 *
10 *  This file is part of libroarpulse a part of RoarAudio,
11 *  a cross-platform sound system for both, home and professional use.
12 *  See README for details.
13 *
14 *  This file is free software; you can redistribute it and/or modify
15 *  it under the terms of the GNU General Public License version 3
16 *  as published by the Free Software Foundation.
17 *
18 *  RoarAudio is distributed in the hope that it will be useful,
19 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
20 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 *  GNU General Public License for more details.
22 *
23 *  You should have received a copy of the GNU General Public License
24 *  along with this software; see the file COPYING.  If not, write to
25 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
26 *
27 *  NOTE for everyone want's to change something and send patches:
28 *  read README and HACKING! There a addition information on
29 *  the license of this document you need to read before you send
30 *  any patches.
31 *
32 *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
33 *  or libpulse*:
34 *  The libs libroaresd, libroararts and libroarpulse link this libroar
35 *  and are therefore GPL. Because of this it may be illigal to use
36 *  them with any software that uses libesd, libartsc or libpulse*.
37 */
38
39#include <libroarpulse/libroarpulse.h>
40
41
42static const struct {
43 int error;
44 const char * name;
45} _roar_pa_errors[] = {
46 {PA_OK,                       "OK"                             },
47 {PA_ERR_ACCESS,               "Access denied"                  },
48 {PA_ERR_COMMAND,              "Unknown command"                },
49 {PA_ERR_INVALID,              "Invalid argument"               },
50 {PA_ERR_EXIST,                "Entity exists"                  },
51 {PA_ERR_NOENTITY,             "No such entity"                 },
52 {PA_ERR_CONNECTIONREFUSED,    "Connection refused"             },
53 {PA_ERR_PROTOCOL,             "Protocol error"                 },
54 {PA_ERR_TIMEOUT,              "Timeout"                        },
55 {PA_ERR_AUTHKEY,              "No authorization key"           },
56 {PA_ERR_INTERNAL,             "Internal error"                 },
57 {PA_ERR_CONNECTIONTERMINATED, "Connection terminated"          },
58 {PA_ERR_KILLED,               "Entity killed"                  },
59 {PA_ERR_INVALIDSERVER,        "Invalid server"                 },
60 {PA_ERR_MODINITFAILED,        "Module initalization failed"    },
61 {PA_ERR_BADSTATE,             "Bad state"                      },
62 {PA_ERR_NODATA,               "No data"                        },
63 {PA_ERR_VERSION,              "Incompatible protocol version"  },
64 {PA_ERR_TOOLARGE,             "Too large"                      },
65 {PA_ERR_MAX,                  "MAX"                            },
66 {-1, NULL}
67};
68
69const char * pa_strerror(int error) {
70 int i;
71
72 for (i = 0; _roar_pa_errors[i].name != NULL; i++)
73  if ( _roar_pa_errors[i].error == error )
74   return _roar_pa_errors[i].name;
75
76 return NULL;
77}
78
79//ll
Note: See TracBrowser for help on using the repository browser.