patch 9.0.2052: win32: using deprecated wsock32 api
Problem: win32: using deprecated wsock32 api
Solution: Use winsock2 (ws2_32) consistently
win32: Stop using wsock32
We have already used ws2_32 (winsock2) and already dropped support for
Windows 95 and NT4. So, we don't need to care about wsock32.
Use ws2_32 consistently.
closes: #13383
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Ken Takata <kentkt@csc.jp>
diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak
index 2363080..7afb6e0 100644
--- a/src/Make_cyg_ming.mak
+++ b/src/Make_cyg_ming.mak
@@ -923,7 +923,7 @@
ifeq ($(CHANNEL),yes)
OBJ += $(OUTDIR)/job.o $(OUTDIR)/channel.o
-LIB += -lwsock32 -lws2_32
+LIB += -lws2_32
endif
ifeq ($(DIRECTX),yes)
diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak
index 618821d..5573a58 100644
--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -420,7 +420,6 @@
NBDEBUG_INCL = nbdebug.h
NBDEBUG_SRC = nbdebug.c
! endif
-NETBEANS_LIB = WSock32.lib
! endif
# DirectWrite (DirectX)
@@ -473,7 +472,7 @@
CHANNEL_OBJ = $(OBJDIR)/job.obj $(OBJDIR)/channel.obj
CHANNEL_DEFS = -DFEAT_JOB_CHANNEL -DFEAT_IPV6 -DHAVE_INET_NTOP
-NETBEANS_LIB = WSock32.lib Ws2_32.lib
+NETBEANS_LIB = Ws2_32.lib
!endif
# need advapi32.lib for GetUserName()
diff --git a/src/channel.c b/src/channel.c
index 38f610a..8d850c6 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -10,13 +10,6 @@
* Implements communication through a socket or any file handle.
*/
-#ifdef WIN32
-// Must include winsock2.h before windows.h since it conflicts with winsock.h
-// (included in windows.h).
-# include <winsock2.h>
-# include <ws2tcpip.h>
-#endif
-
#include "vim.h"
#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
diff --git a/src/if_perl.xs b/src/if_perl.xs
index d88c3f3..dd504d3 100644
--- a/src/if_perl.xs
+++ b/src/if_perl.xs
@@ -24,17 +24,6 @@
# define _USE_32BIT_TIME_T
#endif
-/*
- * Prevent including winsock.h. perl.h tries to detect whether winsock.h is
- * already included before including winsock2.h, because winsock2.h isn't
- * compatible with winsock.h. However the detection doesn't work with some
- * versions of MinGW. If WIN32_LEAN_AND_MEAN is defined, windows.h will not
- * include winsock.h.
- */
-#ifdef WIN32
-# define WIN32_LEAN_AND_MEAN
-#endif
-
#include "vim.h"
#ifdef _MSC_VER
diff --git a/src/os_win32.h b/src/os_win32.h
index 87555b7..5995e70 100644
--- a/src/os_win32.h
+++ b/src/os_win32.h
@@ -85,6 +85,10 @@
# define COBJMACROS // For OLE: Enable "friendlier" access to objects
#endif
#ifndef PROTO
+// Must include winsock2.h before windows.h since it conflicts with winsock.h
+// (included in windows.h).
+# include <winsock2.h>
+# include <ws2tcpip.h>
# include <windows.h>
// Weird: rpcndr.h defines "small" to "char", which causes trouble
diff --git a/src/version.c b/src/version.c
index 87ed0b2..34eb37a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2052,
+/**/
2051,
/**/
2050,