From 04a2b04b9841b8b9e3726c522829a8da38f4ad8d Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Mon, 8 Feb 2010 18:48:12 +0000 Subject: [PATCH] Implement gai_strerror() for systems lacking such functionality. Patch by KO Myung-Hun . Originally committed as revision 21692 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/network.h | 2 ++ libavformat/os_support.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/libavformat/network.h b/libavformat/network.h index 6e82f81ca8..796d44ae5f 100644 --- a/libavformat/network.h +++ b/libavformat/network.h @@ -147,9 +147,11 @@ void ff_freeaddrinfo(struct addrinfo *res); int ff_getnameinfo(const struct sockaddr *sa, int salen, char *host, int hostlen, char *serv, int servlen, int flags); +const char *ff_gai_strerror(int ecode); #define getaddrinfo ff_getaddrinfo #define freeaddrinfo ff_freeaddrinfo #define getnameinfo ff_getnameinfo +#define gai_strerror ff_gai_strerror #endif #endif /* AVFORMAT_NETWORK_H */ diff --git a/libavformat/os_support.c b/libavformat/os_support.c index 58215ec198..fd6af3368a 100644 --- a/libavformat/os_support.c +++ b/libavformat/os_support.c @@ -203,6 +203,17 @@ int ff_getnameinfo(const struct sockaddr *sa, int salen, return 0; } + +const char *ff_gai_strerror(int ecode) +{ + switch(ecode) { + case EAI_FAIL : return "A non-recoverable error occurred"; + case EAI_FAMILY : return "The address family was not recognized or the address length was invalid for the specified family"; + case EAI_NONAME : return "The name does not resolve for the supplied parameters"; + } + + return "Unknown error"; +} #endif /* resolve host with also IP address parsing */