diff options
author | Bruno Haible <bruno@clisp.org> | 2020-05-28 02:31:53 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2020-05-28 02:31:53 +0200 |
commit | 278738f2881906b3a3efd2144ff8081a39c17587 (patch) | |
tree | 9627941ad0483af0da25cc4a30ab866af78fe01c | |
parent | e0dc0ffc6f2f2a4826156d7451e1dc6e80e53243 (diff) | |
download | gnulib-278738f2881906b3a3efd2144ff8081a39c17587.tar.gz gnulib-278738f2881906b3a3efd2144ff8081a39c17587.tar.bz2 |
Don't assume that UNICODE is not defined.
Some Windows types, such as TCHAR, LPTSTR, LPCTSTR, are defined
differently if the application defines the macro UNICODE.
Reported by Steve Lhomme <robux4@ycbcr.xyz> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00184.html>.
* lib/link.c (CreateHardLinkFuncType): Use LPCSTR, not LPCTSTR.
* lib/localename.c (enum_locales_fn): Use LPSTR, not LPTSTR.
* lib/stat-w32.c (GetFinalPathNameByHandleFuncType): Likewise.
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | lib/link.c | 4 | ||||
-rw-r--r-- | lib/localename.c | 2 | ||||
-rw-r--r-- | lib/stat-w32.c | 2 |
4 files changed, 15 insertions, 4 deletions
@@ -1,5 +1,16 @@ 2020-05-27 Bruno Haible <bruno@clisp.org> + Don't assume that UNICODE is not defined. + Some Windows types, such as TCHAR, LPTSTR, LPCTSTR, are defined + differently if the application defines the macro UNICODE. + Reported by Steve Lhomme <robux4@ycbcr.xyz> in + <https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00184.html>. + * lib/link.c (CreateHardLinkFuncType): Use LPCSTR, not LPCTSTR. + * lib/localename.c (enum_locales_fn): Use LPSTR, not LPTSTR. + * lib/stat-w32.c (GetFinalPathNameByHandleFuncType): Likewise. + +2020-05-27 Bruno Haible <bruno@clisp.org> + Improve pattern for defining _WIN32_WINNT. Newer versions of the Windows API may not only add, but also remove API functions. Therefore, when the user is e.g. building for Windows 10, we diff --git a/lib/link.c b/lib/link.c index fc3eebf90f..8e079d2413 100644 --- a/lib/link.c +++ b/lib/link.c @@ -35,8 +35,8 @@ (void *) GetProcAddress /* CreateHardLink was introduced only in Windows 2000. */ -typedef BOOL (WINAPI * CreateHardLinkFuncType) (LPCTSTR lpFileName, - LPCTSTR lpExistingFileName, +typedef BOOL (WINAPI * CreateHardLinkFuncType) (LPCSTR lpFileName, + LPCSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes); static CreateHardLinkFuncType CreateHardLinkFunc = NULL; static BOOL initialized = FALSE; diff --git a/lib/localename.c b/lib/localename.c index fe3d168c80..4046a0bb61 100644 --- a/lib/localename.c +++ b/lib/localename.c @@ -2564,7 +2564,7 @@ static char lname[LC_MAX * (LOCALE_NAME_MAX_LENGTH + 1) + 1]; /* Callback function for EnumLocales. */ static BOOL CALLBACK -enum_locales_fn (LPTSTR locale_num_str) +enum_locales_fn (LPSTR locale_num_str) { char *endp; char locval[2 * LOCALE_NAME_MAX_LENGTH + 1 + 1]; diff --git a/lib/stat-w32.c b/lib/stat-w32.c index c4b5de9a71..b9163f56e2 100644 --- a/lib/stat-w32.c +++ b/lib/stat-w32.c @@ -54,7 +54,7 @@ static GetFileInformationByHandleExFuncType GetFileInformationByHandleExFunc = N #endif /* GetFinalPathNameByHandle was introduced only in Windows Vista. */ typedef DWORD (WINAPI * GetFinalPathNameByHandleFuncType) (HANDLE hFile, - LPTSTR lpFilePath, + LPSTR lpFilePath, DWORD lenFilePath, DWORD dwFlags); static GetFinalPathNameByHandleFuncType GetFinalPathNameByHandleFunc = NULL; |