ws2_32(4/8): Allow binding to IrDA sockets if IrDA support is compiled in (try 4)

Juan Lang juan.lang at gmail.com
Wed Aug 12 11:16:05 CDT 2009


--Juan
-------------- next part --------------
From f18b94cb97c8eeb101eda5cb2e42766cc0476542 Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Wed, 12 Aug 2009 09:14:27 -0700
Subject: [PATCH 4/8] Allow binding to IrDA sockets if IrDA support is compiled in

---
 dlls/ws2_32/socket.c |   30 ++++++++++++++++++++++++++----
 1 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 2bbb49c..5400ea4 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -110,6 +110,14 @@
 # define HAVE_IPX
 #endif
 
+#ifdef HAVE_LINUX_IRDA_H
+# ifdef HAVE_LINUX_TYPES_H
+#  include <linux/types.h>
+# endif
+# include <linux/irda.h>
+# define HAVE_IRDA
+#endif
+
 #ifdef HAVE_POLL_H
 #include <poll.h>
 #endif
@@ -852,11 +860,25 @@ static struct WS_protoent *check_buffer_pe(int size)
 
 /* ----------------------------------- i/o APIs */
 
+static inline BOOL supported_pf(int pf)
+{
+    switch (pf)
+    {
+    case WS_AF_INET:
+    case WS_AF_INET6:
+        return TRUE;
 #ifdef HAVE_IPX
-#define SUPPORTED_PF(pf) ((pf)==WS_AF_INET || (pf)== WS_AF_IPX || (pf) == WS_AF_INET6)
-#else
-#define SUPPORTED_PF(pf) ((pf)==WS_AF_INET || (pf) == WS_AF_INET6)
+    case WS_AF_IPX:
+        return TRUE;
+#endif
+#ifdef HAVE_IRDA
+    case WS_AF_IRDA:
+        return TRUE;
 #endif
+    default:
+        return FALSE;
+    }
+}
 
 
 /**********************************************************************/
@@ -1425,7 +1447,7 @@ int WINAPI WS_bind(SOCKET s, const struct WS_sockaddr* name, int namelen)
 
     if (fd != -1)
     {
-        if (!name || (name->sa_family && !SUPPORTED_PF(name->sa_family)))
+        if (!name || (name->sa_family && !supported_pf(name->sa_family)))
         {
             SetLastError(WSAEAFNOSUPPORT);
         }
-- 
1.6.3.2


More information about the wine-patches mailing list