To: vim_dev@googlegroups.com Subject: Patch 8.2.0594 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0594 Problem: MS-Windows: cannot build with WINVER set to 0x0501. Solution: Only use inet_ntop() when available. (Ozaki Kiichi, closes #5946) Files: src/Make_cyg_ming.mak, src/Make_mvc.mak, src/auto/configure, src/channel.c, src/config.h.in, src/configure.ac *** ../vim-8.2.0593/src/Make_cyg_ming.mak 2020-04-17 20:48:51.294786862 +0200 --- src/Make_cyg_ming.mak 2020-04-18 18:13:17.024862667 +0200 *************** *** 625,630 **** --- 625,633 ---- ifeq ($(CHANNEL),yes) DEFINES += -DFEAT_JOB_CHANNEL -DFEAT_IPV6 + ifeq ($(shell expr "$(WINVER)" \>= 0x600),1) + DEFINES += -DHAVE_INET_NTOP + endif endif ifeq ($(TERMINAL),yes) *** ../vim-8.2.0593/src/Make_mvc.mak 2020-04-17 20:48:51.294786862 +0200 --- src/Make_mvc.mak 2020-04-18 18:13:17.024862667 +0200 *************** *** 317,322 **** --- 317,326 ---- CPU = ix86 !endif + ### Set the default $(WINVER) to make it work with VC++7.0 (VS.NET) + !ifndef WINVER + WINVER = 0x0501 + !endif # Flag to turn on Win64 compatibility warnings for VC7.x and VC8. WP64CHECK = /Wp64 *************** *** 468,473 **** --- 472,480 ---- CHANNEL_PRO = proto/channel.pro CHANNEL_OBJ = $(OBJDIR)/channel.obj CHANNEL_DEFS = -DFEAT_JOB_CHANNEL -DFEAT_IPV6 + ! if $(WINVER) >= 0x600 + CHANNEL_DEFS = $(CHANNEL_DEFS) -DHAVE_INET_NTOP + ! endif NETBEANS_LIB = WSock32.lib Ws2_32.lib !endif *************** *** 493,503 **** CON_LIB = $(CON_LIB) /DELAYLOAD:comdlg32.dll /DELAYLOAD:ole32.dll DelayImp.lib !endif - ### Set the default $(WINVER) to make it work with VC++7.0 (VS.NET) - !ifndef WINVER - WINVER = 0x0501 - !endif - # If you have a fixed directory for $VIM or $VIMRUNTIME, other than the normal # default, use these lines. #VIMRCLOC = somewhere --- 500,505 ---- *** ../vim-8.2.0593/src/auto/configure 2020-04-12 17:52:49.425492403 +0200 --- src/auto/configure 2020-04-18 18:15:43.928361789 +0200 *************** *** 7872,7877 **** --- 7872,7888 ---- if test "x$vim_cv_ipv6_networking" = "xyes"; then $as_echo "#define FEAT_IPV6 1" >>confdefs.h + for ac_func in inet_ntop + do : + ac_fn_c_check_func "$LINENO" "inet_ntop" "ac_cv_func_inet_ntop" + if test "x$ac_cv_func_inet_ntop" = xyes; then : + cat >>confdefs.h <<_ACEOF + #define HAVE_INET_NTOP 1 + _ACEOF + + fi + done + else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; } *** ../vim-8.2.0593/src/channel.c 2020-04-12 19:37:13.506297291 +0200 --- src/channel.c 2020-04-18 18:22:04.035162638 +0200 *************** *** 996,1004 **** for (addr = res; addr != NULL; addr = addr->ai_next) { ! const char *dst = hostname; ! const void *src = NULL; ! char buf[NUMBUFLEN]; if (addr->ai_family == AF_INET6) { --- 996,1006 ---- for (addr = res; addr != NULL; addr = addr->ai_next) { ! const char *dst = hostname; ! const void *src = NULL; ! # ifdef HAVE_INET_NTOP ! char buf[NUMBUFLEN]; ! # endif if (addr->ai_family == AF_INET6) { *************** *** 1014,1025 **** sai->sin_port = htons(port); src = &sai->sin_addr; } if (src != NULL) { dst = inet_ntop(addr->ai_family, src, buf, sizeof(buf)); ! if (dst != NULL && STRCMP(hostname, dst) != 0) ch_log(channel, "Resolved %s to %s", hostname, dst); } ch_log(channel, "Trying to connect to %s port %d", dst, port); --- 1016,1031 ---- sai->sin_port = htons(port); src = &sai->sin_addr; } + # ifdef HAVE_INET_NTOP if (src != NULL) { dst = inet_ntop(addr->ai_family, src, buf, sizeof(buf)); ! if (dst == NULL) ! dst = hostname; ! else if (STRCMP(hostname, dst) != 0) ch_log(channel, "Resolved %s to %s", hostname, dst); } + # endif ch_log(channel, "Trying to connect to %s port %d", dst, port); *** ../vim-8.2.0593/src/config.h.in 2020-04-12 17:52:49.425492403 +0200 --- src/config.h.in 2020-04-18 18:13:17.024862667 +0200 *************** *** 174,179 **** --- 174,180 ---- #undef HAVE_GETTIMEOFDAY #undef HAVE_GETWD #undef HAVE_ICONV + #undef HAVE_INET_NTOP #undef HAVE_LOCALTIME_R #undef HAVE_LSTAT #undef HAVE_MEMSET *** ../vim-8.2.0593/src/configure.ac 2020-04-12 17:52:49.429492390 +0200 --- src/configure.ac 2020-04-18 18:13:17.028862652 +0200 *************** *** 2077,2082 **** --- 2077,2083 ---- if test "x$vim_cv_ipv6_networking" = "xyes"; then AC_DEFINE(FEAT_IPV6) + AC_CHECK_FUNCS(inet_ntop) else dnl On Solaris we need the nsl library. AC_CHECK_LIB(nsl, gethostbyname) *** ../vim-8.2.0593/src/version.c 2020-04-18 17:45:34.702165051 +0200 --- src/version.c 2020-04-18 18:15:19.672442655 +0200 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 594, /**/ -- Managers are like cats in a litter box. They instinctively shuffle things around to conceal what they've done. (Scott Adams - The Dilbert principle) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///