qml: Create MediaGroupDisplay
[vlc.git] / compat / gai_strerror.c
blobcb13915ed4ef8af6188e986f5ec915f44590f6e3
1 /*****************************************************************************
2 * gai_strerror.c: gai_strerror() replacement function
3 *****************************************************************************
4 * Copyright (C) 2005 the VideoLAN team
5 * Copyright (C) 2002-2007 Rémi Denis-Courmont
6 * Copyright (C) 2011-2015 KO Myung-Hun
8 * Authors: KO Myung-Hun <komh@chollian.net>
9 * Rémi Denis-Courmont
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; either version 2.1 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
26 #ifdef HAVE_CONFIG_H
27 # include "config.h"
28 #endif
30 /* GAI error codes. See include/vlc_network.h. */
31 #ifndef EAI_BADFLAGS
32 # define EAI_BADFLAGS -1
33 #endif
34 #ifndef EAI_NONAME
35 # define EAI_NONAME -2
36 #endif
37 #ifndef EAI_AGAIN
38 # define EAI_AGAIN -3
39 #endif
40 #ifndef EAI_FAIL
41 # define EAI_FAIL -4
42 #endif
43 #ifndef EAI_NODATA
44 # define EAI_NODATA -5
45 #endif
46 #ifndef EAI_FAMILY
47 # define EAI_FAMILY -6
48 #endif
49 #ifndef EAI_SOCKTYPE
50 # define EAI_SOCKTYPE -7
51 #endif
52 #ifndef EAI_SERVICE
53 # define EAI_SERVICE -8
54 #endif
55 #ifndef EAI_ADDRFAMILY
56 # define EAI_ADDRFAMILY -9
57 #endif
58 #ifndef EAI_MEMORY
59 # define EAI_MEMORY -10
60 #endif
61 #ifndef EAI_OVERFLOW
62 # define EAI_OVERFLOW -11
63 #endif
64 #ifndef EAI_SYSTEM
65 # define EAI_SYSTEM -12
66 #endif
68 static const struct
70 int code;
71 const char msg[41];
72 } gai_errlist[] =
74 { 0, "Error 0" },
75 { EAI_BADFLAGS, "Invalid flag used" },
76 { EAI_NONAME, "Host or service not found" },
77 { EAI_AGAIN, "Temporary name service failure" },
78 { EAI_FAIL, "Non-recoverable name service failure" },
79 { EAI_NODATA, "No data for host name" },
80 { EAI_FAMILY, "Unsupported address family" },
81 { EAI_SOCKTYPE, "Unsupported socket type" },
82 { EAI_SERVICE, "Incompatible service for socket type" },
83 { EAI_ADDRFAMILY, "Unavailable address family for host name" },
84 { EAI_MEMORY, "Memory allocation failure" },
85 { EAI_OVERFLOW, "Buffer overflow" },
86 { EAI_SYSTEM, "System error" },
87 { 0, "" },
90 static const char gai_unknownerr[] = "Unrecognized error number";
92 /****************************************************************************
93 * Converts an EAI_* error code into human readable english text.
94 ****************************************************************************/
95 const char *gai_strerror (int errnum)
97 for (unsigned i = 0; *gai_errlist[i].msg; i++)
98 if (errnum == gai_errlist[i].code)
99 return gai_errlist[i].msg;
101 return gai_unknownerr;