Karsten Hopp 4e7202
To: vim_dev@googlegroups.com
Karsten Hopp 4e7202
Subject: Patch 7.4.175
Karsten Hopp 4e7202
Fcc: outbox
Karsten Hopp 4e7202
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 4e7202
Mime-Version: 1.0
Karsten Hopp 4e7202
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 4e7202
Content-Transfer-Encoding: 8bit
Karsten Hopp 4e7202
------------
Karsten Hopp 4e7202
Karsten Hopp 4e7202
Patch 7.4.175
Karsten Hopp 4e7202
Problem:    When a wide library function fails, falling back to the non-wide
Karsten Hopp 4e7202
	    function may do the wrong thing.
Karsten Hopp 4e7202
Solution:   Check the platform, when the wide function is supported don't fall
Karsten Hopp 4e7202
	    back to the non-wide function. (Ken Takata)
Karsten Hopp 4e7202
Files:	    src/os_mswin.c, src/os_win32.c
Karsten Hopp 4e7202
Karsten Hopp 4e7202
Karsten Hopp 4e7202
*** ../vim-7.4.174/src/os_mswin.c	2014-01-14 12:18:41.000000000 +0100
Karsten Hopp 4e7202
--- src/os_mswin.c	2014-02-11 17:02:03.002214267 +0100
Karsten Hopp 4e7202
***************
Karsten Hopp 4e7202
*** 648,654 ****
Karsten Hopp 4e7202
  	{
Karsten Hopp 4e7202
  	    n = wstat_symlink_aware(wp, (struct _stat *)stp);
Karsten Hopp 4e7202
  	    vim_free(wp);
Karsten Hopp 4e7202
! 	    if (n >= 0)
Karsten Hopp 4e7202
  		return n;
Karsten Hopp 4e7202
  	    /* Retry with non-wide function (for Windows 98). Can't use
Karsten Hopp 4e7202
  	     * GetLastError() here and it's unclear what errno gets set to if
Karsten Hopp 4e7202
--- 648,654 ----
Karsten Hopp 4e7202
  	{
Karsten Hopp 4e7202
  	    n = wstat_symlink_aware(wp, (struct _stat *)stp);
Karsten Hopp 4e7202
  	    vim_free(wp);
Karsten Hopp 4e7202
! 	    if (n >= 0 || g_PlatformId == VER_PLATFORM_WIN32_NT)
Karsten Hopp 4e7202
  		return n;
Karsten Hopp 4e7202
  	    /* Retry with non-wide function (for Windows 98). Can't use
Karsten Hopp 4e7202
  	     * GetLastError() here and it's unclear what errno gets set to if
Karsten Hopp 4e7202
***************
Karsten Hopp 4e7202
*** 815,822 ****
Karsten Hopp 4e7202
  	{
Karsten Hopp 4e7202
  	    n = _wchdir(p);
Karsten Hopp 4e7202
  	    vim_free(p);
Karsten Hopp 4e7202
! 	    if (n == 0)
Karsten Hopp 4e7202
! 		return 0;
Karsten Hopp 4e7202
  	    /* Retry with non-wide function (for Windows 98). */
Karsten Hopp 4e7202
  	}
Karsten Hopp 4e7202
      }
Karsten Hopp 4e7202
--- 815,822 ----
Karsten Hopp 4e7202
  	{
Karsten Hopp 4e7202
  	    n = _wchdir(p);
Karsten Hopp 4e7202
  	    vim_free(p);
Karsten Hopp 4e7202
! 	    if (n == 0 || g_PlatformId == VER_PLATFORM_WIN32_NT)
Karsten Hopp 4e7202
! 		return n;
Karsten Hopp 4e7202
  	    /* Retry with non-wide function (for Windows 98). */
Karsten Hopp 4e7202
  	}
Karsten Hopp 4e7202
      }
Karsten Hopp 4e7202
***************
Karsten Hopp 4e7202
*** 1942,1949 ****
Karsten Hopp 4e7202
  
Karsten Hopp 4e7202
  shortcut_errorw:
Karsten Hopp 4e7202
  		vim_free(p);
Karsten Hopp 4e7202
! 		if (hr == S_OK)
Karsten Hopp 4e7202
! 		    goto shortcut_end;
Karsten Hopp 4e7202
  	    }
Karsten Hopp 4e7202
  	}
Karsten Hopp 4e7202
  	/* Retry with non-wide function (for Windows 98). */
Karsten Hopp 4e7202
--- 1942,1948 ----
Karsten Hopp 4e7202
  
Karsten Hopp 4e7202
  shortcut_errorw:
Karsten Hopp 4e7202
  		vim_free(p);
Karsten Hopp 4e7202
! 		goto shortcut_end;
Karsten Hopp 4e7202
  	    }
Karsten Hopp 4e7202
  	}
Karsten Hopp 4e7202
  	/* Retry with non-wide function (for Windows 98). */
Karsten Hopp 4e7202
*** ../vim-7.4.174/src/os_win32.c	2014-02-05 14:02:23.590105699 +0100
Karsten Hopp 4e7202
--- src/os_win32.c	2014-02-11 16:59:26.810211874 +0100
Karsten Hopp 4e7202
***************
Karsten Hopp 4e7202
*** 2877,2882 ****
Karsten Hopp 4e7202
--- 2877,2884 ----
Karsten Hopp 4e7202
  		return OK;
Karsten Hopp 4e7202
  	    }
Karsten Hopp 4e7202
  	}
Karsten Hopp 4e7202
+ 	else if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
Karsten Hopp 4e7202
+ 	    return FAIL;
Karsten Hopp 4e7202
  	/* Retry with non-wide function (for Windows 98). */
Karsten Hopp 4e7202
      }
Karsten Hopp 4e7202
  #endif
Karsten Hopp 4e7202
***************
Karsten Hopp 4e7202
*** 2917,2922 ****
Karsten Hopp 4e7202
--- 2919,2926 ----
Karsten Hopp 4e7202
  		return;
Karsten Hopp 4e7202
  	    }
Karsten Hopp 4e7202
  	}
Karsten Hopp 4e7202
+ 	else if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
Karsten Hopp 4e7202
+ 	    return;
Karsten Hopp 4e7202
  	/* Retry with non-wide function (for Windows 98). */
Karsten Hopp 4e7202
      }
Karsten Hopp 4e7202
  #endif
Karsten Hopp 4e7202
***************
Karsten Hopp 4e7202
*** 2966,2971 ****
Karsten Hopp 4e7202
--- 2970,2977 ----
Karsten Hopp 4e7202
  		return OK;
Karsten Hopp 4e7202
  	    }
Karsten Hopp 4e7202
  	}
Karsten Hopp 4e7202
+ 	else if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
Karsten Hopp 4e7202
+ 	    return FAIL;
Karsten Hopp 4e7202
  	/* Retry with non-wide function (for Windows 98). */
Karsten Hopp 4e7202
      }
Karsten Hopp 4e7202
  #endif
Karsten Hopp 4e7202
***************
Karsten Hopp 4e7202
*** 3006,3012 ****
Karsten Hopp 4e7202
  	{
Karsten Hopp 4e7202
  	    n = _wchmod(p, perm);
Karsten Hopp 4e7202
  	    vim_free(p);
Karsten Hopp 4e7202
! 	    if (n == -1 && GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
Karsten Hopp 4e7202
  		return FAIL;
Karsten Hopp 4e7202
  	    /* Retry with non-wide function (for Windows 98). */
Karsten Hopp 4e7202
  	}
Karsten Hopp 4e7202
--- 3012,3018 ----
Karsten Hopp 4e7202
  	{
Karsten Hopp 4e7202
  	    n = _wchmod(p, perm);
Karsten Hopp 4e7202
  	    vim_free(p);
Karsten Hopp 4e7202
! 	    if (n == -1 && g_PlatformId == VER_PLATFORM_WIN32_NT)
Karsten Hopp 4e7202
  		return FAIL;
Karsten Hopp 4e7202
  	    /* Retry with non-wide function (for Windows 98). */
Karsten Hopp 4e7202
  	}
Karsten Hopp 4e7202
***************
Karsten Hopp 4e7202
*** 6048,6054 ****
Karsten Hopp 4e7202
  	{
Karsten Hopp 4e7202
  	    f = _wopen(wn, flags, mode);
Karsten Hopp 4e7202
  	    vim_free(wn);
Karsten Hopp 4e7202
! 	    if (f >= 0)
Karsten Hopp 4e7202
  		return f;
Karsten Hopp 4e7202
  	    /* Retry with non-wide function (for Windows 98). Can't use
Karsten Hopp 4e7202
  	     * GetLastError() here and it's unclear what errno gets set to if
Karsten Hopp 4e7202
--- 6054,6060 ----
Karsten Hopp 4e7202
  	{
Karsten Hopp 4e7202
  	    f = _wopen(wn, flags, mode);
Karsten Hopp 4e7202
  	    vim_free(wn);
Karsten Hopp 4e7202
! 	    if (f >= 0 || g_PlatformId == VER_PLATFORM_WIN32_NT)
Karsten Hopp 4e7202
  		return f;
Karsten Hopp 4e7202
  	    /* Retry with non-wide function (for Windows 98). Can't use
Karsten Hopp 4e7202
  	     * GetLastError() here and it's unclear what errno gets set to if
Karsten Hopp 4e7202
***************
Karsten Hopp 4e7202
*** 6099,6105 ****
Karsten Hopp 4e7202
  	_set_fmode(oldMode);
Karsten Hopp 4e7202
  # endif
Karsten Hopp 4e7202
  
Karsten Hopp 4e7202
! 	if (f != NULL)
Karsten Hopp 4e7202
  	    return f;
Karsten Hopp 4e7202
  	/* Retry with non-wide function (for Windows 98). Can't use
Karsten Hopp 4e7202
  	 * GetLastError() here and it's unclear what errno gets set to if
Karsten Hopp 4e7202
--- 6105,6111 ----
Karsten Hopp 4e7202
  	_set_fmode(oldMode);
Karsten Hopp 4e7202
  # endif
Karsten Hopp 4e7202
  
Karsten Hopp 4e7202
! 	if (f != NULL || g_PlatformId == VER_PLATFORM_WIN32_NT)
Karsten Hopp 4e7202
  	    return f;
Karsten Hopp 4e7202
  	/* Retry with non-wide function (for Windows 98). Can't use
Karsten Hopp 4e7202
  	 * GetLastError() here and it's unclear what errno gets set to if
Karsten Hopp 4e7202
*** ../vim-7.4.174/src/version.c	2014-02-11 16:00:31.198157698 +0100
Karsten Hopp 4e7202
--- src/version.c	2014-02-11 16:33:10.002187713 +0100
Karsten Hopp 4e7202
***************
Karsten Hopp 4e7202
*** 740,741 ****
Karsten Hopp 4e7202
--- 740,743 ----
Karsten Hopp 4e7202
  {   /* Add new patch number below this line */
Karsten Hopp 4e7202
+ /**/
Karsten Hopp 4e7202
+     175,
Karsten Hopp 4e7202
  /**/
Karsten Hopp 4e7202
Karsten Hopp 4e7202
-- 
Karsten Hopp 4e7202
DINGO:   And after the spanking ... the oral sex.
Karsten Hopp 4e7202
GALAHAD: Oh, dear! Well, I...
Karsten Hopp 4e7202
GIRLS:   The oral sex ...  The oral sex.
Karsten Hopp 4e7202
GALAHAD: Well, I suppose I could stay a BIT longer.
Karsten Hopp 4e7202
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp 4e7202
Karsten Hopp 4e7202
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 4e7202
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 4e7202
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 4e7202
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///