]> Savannah Git Hosting - gnulib.git/commitdiff
Don't assume that UNICODE is not defined.
authorBruno Haible <bruno@clisp.org>
Thu, 28 May 2020 00:31:53 +0000 (02:31 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 28 May 2020 00:31:53 +0000 (02:31 +0200)
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.

ChangeLog
lib/link.c
lib/localename.c
lib/stat-w32.c

index ae76e2c9559ca822be462fd22559c744d72dee10..c17b76b72ec2190a0c2631339d0eb1a64eafe70e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+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.
index fc3eebf90f8649d9c6319946d52245fd2636164d..8e079d24136b21c7ddab9ceb2ebe58cee13dc40e 100644 (file)
@@ -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;
index fe3d168c80ae279bfbbec7647d7475de49185222..4046a0bb61ae233bf01fd44fab20bd4760772bd8 100644 (file)
@@ -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];
index c4b5de9a7118a52cc46d20f5df5f7d316b4503b6..b9163f56e230688417ee62c6a1263e40f01ea050 100644 (file)
@@ -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;