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