[FFmpeg-cvslog] network: Extend the fallback gai_strerror implementation to handle more error codes
Martin Storsjö
git at videolan.org
Mon Jul 16 20:51:09 CEST 2012
ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Mon Jun 25 12:44:18 2012 +0300| [2ca6e9bb47f0f58f0cb4a840b301edf45e77f0e5] | committer: Martin Storsjö
network: Extend the fallback gai_strerror implementation to handle more error codes
This is useful if a proper getaddrinfo is loaded dynamically on
windows, while using the fallback implementation of gai_strerror.
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2ca6e9bb47f0f58f0cb4a840b301edf45e77f0e5
---
libavformat/network.h | 20 ++++++++++++++++++--
libavformat/os_support.c | 8 ++++++++
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/libavformat/network.h b/libavformat/network.h
index 793cfee..9b0b94d 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -110,17 +110,33 @@ struct addrinfo {
#endif
/* getaddrinfo constants */
+#ifndef EAI_AGAIN
+#define EAI_AGAIN 2
+#endif
+#ifndef EAI_BADFLAGS
+#define EAI_BADFLAGS 3
+#endif
#ifndef EAI_FAIL
#define EAI_FAIL 4
#endif
-
#ifndef EAI_FAMILY
#define EAI_FAMILY 5
#endif
-
+#ifndef EAI_MEMORY
+#define EAI_MEMORY 6
+#endif
+#ifndef EAI_NODATA
+#define EAI_NODATA 7
+#endif
#ifndef EAI_NONAME
#define EAI_NONAME 8
#endif
+#ifndef EAI_SERVICE
+#define EAI_SERVICE 9
+#endif
+#ifndef EAI_SOCKTYPE
+#define EAI_SOCKTYPE 10
+#endif
#ifndef AI_PASSIVE
#define AI_PASSIVE 1
diff --git a/libavformat/os_support.c b/libavformat/os_support.c
index 6d8c8ac..76204e0 100644
--- a/libavformat/os_support.c
+++ b/libavformat/os_support.c
@@ -243,9 +243,17 @@ int ff_getnameinfo(const struct sockaddr *sa, int salen,
const char *ff_gai_strerror(int ecode)
{
switch(ecode) {
+ case EAI_AGAIN : return "Temporary failure in name resolution";
+ case EAI_BADFLAGS: return "Invalid flags for ai_flags";
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_MEMORY : return "Memory allocation failure";
+#if EAI_NODATA != EAI_NONAME
+ case EAI_NODATA : return "No address associated with hostname";
+#endif
case EAI_NONAME : return "The name does not resolve for the supplied parameters";
+ case EAI_SERVICE: return "servname not supported for ai_socktype";
+ case EAI_SOCKTYPE: return "ai_socktype not supported";
}
return "Unknown error";
More information about the ffmpeg-cvslog
mailing list