[vlc-commits] win32: do not redefine SHUT_* macros, fix warnings

Rémi Denis-Courmont git at videolan.org
Sun Feb 26 12:10:02 CET 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Feb 26 11:58:27 2017 +0200| [cda6f9c41018dab3ca6a6b7b7b4dfce963832dae] | committer: Rémi Denis-Courmont

win32: do not redefine SHUT_* macros, fix warnings

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cda6f9c41018dab3ca6a6b7b7b4dfce963832dae
---

 include/vlc_network.h | 28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)

diff --git a/include/vlc_network.h b/include/vlc_network.h
index 3d5185d..b1c2185 100644
--- a/include/vlc_network.h
+++ b/include/vlc_network.h
@@ -35,22 +35,29 @@
  * Definitions for sockets and low-level networking
  */
 
+#include <sys/types.h>
+#include <unistd.h>
+
 #if defined( _WIN32 )
 #   define _NO_OLDNAMES 1
-#   include <io.h>
 #   include <winsock2.h>
 #   include <ws2tcpip.h>
 #   define net_errno (WSAGetLastError())
+#   define net_Close(fd) ((void)closesocket((SOCKET)fd))
 #   ifndef IPV6_V6ONLY
 #       define IPV6_V6ONLY 27
 #   endif
 #else
-#   include <sys/types.h>
-#   include <unistd.h>
 #   include <sys/socket.h>
 #   include <netinet/in.h>
 #   include <netdb.h>
 #   define net_errno errno
+#   define net_Close(fd) ((void)vlc_close(fd))
+#   ifdef __OS2__
+#       define SHUT_RD    0
+#       define SHUT_WR    1
+#       define SHUT_RDWR  2
+#   endif
 #endif
 
 #ifndef MSG_NOSIGNAL
@@ -128,22 +135,7 @@ VLC_API ssize_t net_Printf( vlc_object_t *p_this, int fd, const char *psz_fmt, .
 VLC_API ssize_t net_vaPrintf( vlc_object_t *p_this, int fd, const char *psz_fmt, va_list args );
 #define net_vaPrintf(a,b,c,d) net_vaPrintf(VLC_OBJECT(a),b,c,d)
 
-#ifdef _WIN32
-/* Microsoft: same semantic, same value, different name... go figure */
-# define SHUT_RD SD_RECEIVE
-# define SHUT_WR SD_SEND
-# define SHUT_RDWR SD_BOTH
-# define net_Close( fd ) closesocket ((SOCKET)fd)
-#else
-# ifdef __OS2__
-#  define SHUT_RD    0
-#  define SHUT_WR    1
-#  define SHUT_RDWR  2
-# endif
-
 VLC_API int vlc_close(int);
-# define net_Close( fd ) (void)vlc_close (fd)
-#endif
 
 /* Portable network names/addresses resolution layer */
 



More information about the vlc-commits mailing list