Skip to content

Commit 58e5a8c

Browse files
committed
updated for version 7.4.175
Problem: When a wide library function fails, falling back to the non-wide function may do the wrong thing. Solution: Check the platform, when the wide function is supported don't fall back to the non-wide function. (Ken Takata)
1 parent 40c3ee3 commit 58e5a8c

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

src/os_mswin.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ vim_stat(const char *name, struct stat *stp)
648648
{
649649
n = wstat_symlink_aware(wp, (struct _stat *)stp);
650650
vim_free(wp);
651-
if (n >= 0)
651+
if (n >= 0 || g_PlatformId == VER_PLATFORM_WIN32_NT)
652652
return n;
653653
/* Retry with non-wide function (for Windows 98). Can't use
654654
* GetLastError() here and it's unclear what errno gets set to if
@@ -815,8 +815,8 @@ mch_chdir(char *path)
815815
{
816816
n = _wchdir(p);
817817
vim_free(p);
818-
if (n == 0)
819-
return 0;
818+
if (n == 0 || g_PlatformId == VER_PLATFORM_WIN32_NT)
819+
return n;
820820
/* Retry with non-wide function (for Windows 98). */
821821
}
822822
}
@@ -1942,8 +1942,7 @@ mch_resolve_shortcut(char_u *fname)
19421942

19431943
shortcut_errorw:
19441944
vim_free(p);
1945-
if (hr == S_OK)
1946-
goto shortcut_end;
1945+
goto shortcut_end;
19471946
}
19481947
}
19491948
/* Retry with non-wide function (for Windows 98). */

src/os_win32.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2877,6 +2877,8 @@ mch_get_user_name(
28772877
return OK;
28782878
}
28792879
}
2880+
else if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
2881+
return FAIL;
28802882
/* Retry with non-wide function (for Windows 98). */
28812883
}
28822884
#endif
@@ -2917,6 +2919,8 @@ mch_get_host_name(
29172919
return;
29182920
}
29192921
}
2922+
else if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
2923+
return;
29202924
/* Retry with non-wide function (for Windows 98). */
29212925
}
29222926
#endif
@@ -2966,6 +2970,8 @@ mch_dirname(
29662970
return OK;
29672971
}
29682972
}
2973+
else if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
2974+
return FAIL;
29692975
/* Retry with non-wide function (for Windows 98). */
29702976
}
29712977
#endif
@@ -3006,7 +3012,7 @@ mch_setperm(char_u *name, long perm)
30063012
{
30073013
n = _wchmod(p, perm);
30083014
vim_free(p);
3009-
if (n == -1 && GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
3015+
if (n == -1 && g_PlatformId == VER_PLATFORM_WIN32_NT)
30103016
return FAIL;
30113017
/* Retry with non-wide function (for Windows 98). */
30123018
}
@@ -6048,7 +6054,7 @@ mch_open(char *name, int flags, int mode)
60486054
{
60496055
f = _wopen(wn, flags, mode);
60506056
vim_free(wn);
6051-
if (f >= 0)
6057+
if (f >= 0 || g_PlatformId == VER_PLATFORM_WIN32_NT)
60526058
return f;
60536059
/* Retry with non-wide function (for Windows 98). Can't use
60546060
* GetLastError() here and it's unclear what errno gets set to if
@@ -6099,7 +6105,7 @@ mch_fopen(char *name, char *mode)
60996105
_set_fmode(oldMode);
61006106
# endif
61016107

6102-
if (f != NULL)
6108+
if (f != NULL || g_PlatformId == VER_PLATFORM_WIN32_NT)
61036109
return f;
61046110
/* Retry with non-wide function (for Windows 98). Can't use
61056111
* GetLastError() here and it's unclear what errno gets set to if

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,8 @@ static char *(features[]) =
738738

739739
static int included_patches[] =
740740
{ /* Add new patch number below this line */
741+
/**/
742+
175,
741743
/**/
742744
174,
743745
/**/

0 commit comments

Comments
 (0)