]> Savannah Git Hosting - gnulib.git/commitdiff
Don't assume that UNICODE is not defined.
authorBruno Haible <bruno@clisp.org>
Sat, 30 May 2020 09:04:02 +0000 (11:04 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 30 May 2020 09:04:02 +0000 (11:04 +0200)
Many Windows API functions are defined differently (redirecting to a
function with suffix 'W') if the application defines the macro UNICODE
than by default (redirecting to a function with suffix 'A').

* lib/clean-temp.c (OSVERSIONINFO, GetVersionEx): Redirect to the
variant with suffix 'A'.
* lib/dirent-private.h (WIN32_FIND_DATA): Likewise.
* lib/gc-gnulib.c (CryptAcquireContext): Likewise.
* lib/getaddrinfo.c (GetModuleHandle): Likewise.
* lib/getlogin.c (GetUserName): Likewise.
* lib/getlogin_r.c (GetUserName): Likewise.
* lib/gettimeofday.c (LoadLibrary): Likewise.
* lib/isatty.c (LoadLibrary, QueryFullProcessImageName): Likewise.
* lib/link.c (GetModuleHandle, CreateHardLink): Likewise.
* lib/localename.c (GetLocaleInfo, EnumSystemLocales): Likewise.
* lib/mountlist.c (GetDriveType): Likewise.
* lib/nonblocking.c (GetNamedPipeHandleState): Likewise.
* lib/opendir.c (WIN32_FIND_DATA, GetFullPathName, FindFirstFile):
Likewise.
* lib/physmem.c (GetModuleHandle): Likewise.
* lib/poll.c (GetModuleHandle, PeekConsoleInput, CreateEvent,
PeekMessage, DispatchMessage): Likewise.
* lib/progreloc.c (GetModuleFileName): Likewise.
* lib/putenv.c (SetEnvironmentVariable): Likewise.
* lib/read.c (GetNamedPipeHandleState): Likewise.
* lib/readdir.c (FindNextFile): Likewise.
* lib/relocatable.c (GetModuleFileName): Likewise.
* lib/rename.c (MoveFileEx): Likewise.
* lib/rewinddir.c (FindFirstFile): Likewise.
* lib/select.c (GetModuleHandle, PeekConsoleInput, CreateEvent,
PeekMessage, DispatchMessage): Likewise.
* lib/sethostname.c (GetComputerNameEx, SetComputerNameEx): Likewise.
* lib/socket.c (WSASocket): Likewise.
* lib/stat-w32.c (LoadLibrary, GetFinalPathNameByHandle): Likewise.
* lib/stat.c (WIN32_FIND_DATA, CreateFile, FindFirstFile): Likewise.
* lib/stdio-read.c (GetNamedPipeHandleState): Likewise.
* lib/stdio-write.c (GetNamedPipeHandleState): Likewise.
* lib/tmpdir.c (GetTempPath): Likewise.
* lib/tmpfile.c (OSVERSIONINFO, GetVersionEx, GetTempPath): Likewise.
* lib/uname.c (OSVERSIONINFO, GetVersionEx): Likewise.
* lib/utime.c (CreateFile, GetFileAttributes): Likewise.
* lib/windows-cond.c (CreateEvent): Likewise.
* lib/windows-rwlock.c (CreateEvent): Likewise.
* lib/windows-timedmutex.c (CreateEvent): Likewise.
* lib/windows-timedrecmutex.c (CreateEvent): Likewise.
* lib/windows-timedrwlock.c (CreateEvent): Likewise.
* lib/write.c (GetNamedPipeHandleState): Likewise.

40 files changed:
ChangeLog
lib/clean-temp.c
lib/dirent-private.h
lib/gc-gnulib.c
lib/getaddrinfo.c
lib/getlogin.c
lib/getlogin_r.c
lib/gettimeofday.c
lib/isatty.c
lib/link.c
lib/localename.c
lib/mountlist.c
lib/nonblocking.c
lib/opendir.c
lib/physmem.c
lib/poll.c
lib/progreloc.c
lib/putenv.c
lib/read.c
lib/readdir.c
lib/relocatable.c
lib/rename.c
lib/rewinddir.c
lib/select.c
lib/sethostname.c
lib/socket.c
lib/stat-w32.c
lib/stat.c
lib/stdio-read.c
lib/stdio-write.c
lib/tmpdir.c
lib/tmpfile.c
lib/uname.c
lib/utime.c
lib/windows-cond.c
lib/windows-rwlock.c
lib/windows-timedmutex.c
lib/windows-timedrecmutex.c
lib/windows-timedrwlock.c
lib/write.c

index 33b61863aa6bb8818e561dd5abc8ba81eb49cbef..bc21cf70b7e2b621025c1632e45edfad4715bf82 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,53 @@
+2020-05-30  Bruno Haible  <bruno@clisp.org>
+
+       Don't assume that UNICODE is not defined.
+       Many Windows API functions are defined differently (redirecting to a
+       function with suffix 'W') if the application defines the macro UNICODE
+       than by default (redirecting to a function with suffix 'A').
+       * lib/clean-temp.c (OSVERSIONINFO, GetVersionEx): Redirect to the
+       variant with suffix 'A'.
+       * lib/dirent-private.h (WIN32_FIND_DATA): Likewise.
+       * lib/gc-gnulib.c (CryptAcquireContext): Likewise.
+       * lib/getaddrinfo.c (GetModuleHandle): Likewise.
+       * lib/getlogin.c (GetUserName): Likewise.
+       * lib/getlogin_r.c (GetUserName): Likewise.
+       * lib/gettimeofday.c (LoadLibrary): Likewise.
+       * lib/isatty.c (LoadLibrary, QueryFullProcessImageName): Likewise.
+       * lib/link.c (GetModuleHandle, CreateHardLink): Likewise.
+       * lib/localename.c (GetLocaleInfo, EnumSystemLocales): Likewise.
+       * lib/mountlist.c (GetDriveType): Likewise.
+       * lib/nonblocking.c (GetNamedPipeHandleState): Likewise.
+       * lib/opendir.c (WIN32_FIND_DATA, GetFullPathName, FindFirstFile):
+       Likewise.
+       * lib/physmem.c (GetModuleHandle): Likewise.
+       * lib/poll.c (GetModuleHandle, PeekConsoleInput, CreateEvent,
+       PeekMessage, DispatchMessage): Likewise.
+       * lib/progreloc.c (GetModuleFileName): Likewise.
+       * lib/putenv.c (SetEnvironmentVariable): Likewise.
+       * lib/read.c (GetNamedPipeHandleState): Likewise.
+       * lib/readdir.c (FindNextFile): Likewise.
+       * lib/relocatable.c (GetModuleFileName): Likewise.
+       * lib/rename.c (MoveFileEx): Likewise.
+       * lib/rewinddir.c (FindFirstFile): Likewise.
+       * lib/select.c (GetModuleHandle, PeekConsoleInput, CreateEvent,
+       PeekMessage, DispatchMessage): Likewise.
+       * lib/sethostname.c (GetComputerNameEx, SetComputerNameEx): Likewise.
+       * lib/socket.c (WSASocket): Likewise.
+       * lib/stat-w32.c (LoadLibrary, GetFinalPathNameByHandle): Likewise.
+       * lib/stat.c (WIN32_FIND_DATA, CreateFile, FindFirstFile): Likewise.
+       * lib/stdio-read.c (GetNamedPipeHandleState): Likewise.
+       * lib/stdio-write.c (GetNamedPipeHandleState): Likewise.
+       * lib/tmpdir.c (GetTempPath): Likewise.
+       * lib/tmpfile.c (OSVERSIONINFO, GetVersionEx, GetTempPath): Likewise.
+       * lib/uname.c (OSVERSIONINFO, GetVersionEx): Likewise.
+       * lib/utime.c (CreateFile, GetFileAttributes): Likewise.
+       * lib/windows-cond.c (CreateEvent): Likewise.
+       * lib/windows-rwlock.c (CreateEvent): Likewise.
+       * lib/windows-timedmutex.c (CreateEvent): Likewise.
+       * lib/windows-timedrecmutex.c (CreateEvent): Likewise.
+       * lib/windows-timedrwlock.c (CreateEvent): Likewise.
+       * lib/write.c (GetNamedPipeHandleState): Likewise.
+
 2020-05-30  Bruno Haible  <bruno@clisp.org>
 
        physmem: Fix compilation errors on MSVC.
index 8d3cbd9f53d4e9f0c6013dc7fbb356dc00cff285..c57d6581715f0170f55f6d1c1d49bf0715d6c390 100644 (file)
 # define PATH_MAX 1024
 #endif
 
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Don't assume that UNICODE is not defined.  */
+# undef OSVERSIONINFO
+# define OSVERSIONINFO OSVERSIONINFOA
+# undef GetVersionEx
+# define GetVersionEx GetVersionExA
+#endif
+
 
 /* The use of 'volatile' in the types below (and ISO C 99 section 5.1.2.3.(5))
    ensure that while constructing or modifying the data structures, the field
index 4b4eba4e62a9f5bc735b2fff6c124bf2ce23ac59..a3c684439ffc6f0d3aea172ed73190485890c802 100644 (file)
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>
 
+/* Don't assume that UNICODE is not defined.  */
+#undef WIN32_FIND_DATA
+#define WIN32_FIND_DATA WIN32_FIND_DATAA
+
 struct gl_directory
 {
   /* Status, or error code to produce in next readdir() call.
index 8e9b88f075793f41b7b5a328b9299ece89221257..84f42e43f8ecb79913c8b0df3cecf00e7cd8174d 100644 (file)
@@ -89,6 +89,12 @@ HCRYPTPROV g_hProv = 0;
 # endif
 #endif
 
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Don't assume that UNICODE is not defined.  */
+# undef CryptAcquireContext
+# define CryptAcquireContext CryptAcquireContextA
+#endif
+
 Gc_rc
 gc_init (void)
 {
index 1db9be86988eb19585edf89836d79a39e9c6228c..8d2c01c99604e346a7b596d30e892695af734830 100644 (file)
@@ -86,6 +86,10 @@ freeaddrinfo (struct addrinfo *ai)
 
 # ifdef WINDOWS_NATIVE
 
+/* Don't assume that UNICODE is not defined.  */
+#  undef GetModuleHandle
+#  define GetModuleHandle GetModuleHandleA
+
 #  if !(_WIN32_WINNT >= _WIN32_WINNT_WINXP)
 
 /* Avoid warnings from gcc -Wcast-function-type.  */
index 5863feb77c91c01d85af9187a4270430af9a8b1d..af93664278c08221ec68da7b0b5868224a9c68b1 100644 (file)
@@ -25,6 +25,9 @@
 #if defined _WIN32 && ! defined __CYGWIN__
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
+/* Don't assume that UNICODE is not defined.  */
+# undef GetUserName
+# define GetUserName GetUserNameA
 #endif
 
 char *
index 598a6e4708771b14861c94824e5853df61f708bb..2506b1b5ffbbe4fb7ad0a00fb7755b95c0f98a4b 100644 (file)
@@ -30,6 +30,9 @@
 #if defined _WIN32 && ! defined __CYGWIN__
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
+/* Don't assume that UNICODE is not defined.  */
+# undef GetUserName
+# define GetUserName GetUserNameA
 #else
 # if !HAVE_DECL_GETLOGIN
 extern char *getlogin (void);
index 93914ba92034fb0a8b1ff970a980c4c6a57b9bbe..305ab984e054627eb9bea2d3c14627eeddf32fa8 100644 (file)
 
 #ifdef WINDOWS_NATIVE
 
+/* Don't assume that UNICODE is not defined.  */
+# undef LoadLibrary
+# define LoadLibrary LoadLibraryA
+
 # if !(_WIN32_WINNT >= _WIN32_WINNT_WIN8)
 
 /* Avoid warnings from gcc -Wcast-function-type.  */
index 4c5b8e378f5e4d214d3c3cb04ca4e89fbd3cf5fa..7c278ec09780cd347f290a455d2a236de61a09bc 100644 (file)
 # include <io.h>
 #endif
 
+/* Don't assume that UNICODE is not defined.  */
+#undef LoadLibrary
+#define LoadLibrary LoadLibraryA
+#undef QueryFullProcessImageName
+#define QueryFullProcessImageName QueryFullProcessImageNameA
+
 #if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA)
 
 /* Avoid warnings from gcc -Wcast-function-type.  */
index 8680e3e98586c7ee25f6d095d9a6d9acc0020898..797cdf8b9b3362467bc650104d424b9dd60c7998 100644 (file)
 #  define WIN32_LEAN_AND_MEAN
 #  include <windows.h>
 
+/* Don't assume that UNICODE is not defined.  */
+#  undef GetModuleHandle
+#  define GetModuleHandle GetModuleHandleA
+#  undef CreateHardLink
+#  define CreateHardLink CreateHardLinkA
+
 #  if !(_WIN32_WINNT >= _WIN32_WINNT_WINXP)
 
 /* Avoid warnings from gcc -Wcast-function-type.  */
index 4046a0bb61ae233bf01fd44fab20bd4760772bd8..dc60b07c565696dfdd6478ef2a0f0887ae145bcd 100644 (file)
@@ -1150,6 +1150,11 @@ extern char * getlocalename_l(int, locale_t);
 # ifndef LOCALE_NAME_MAX_LENGTH
 # define LOCALE_NAME_MAX_LENGTH 85
 # endif
+/* Don't assume that UNICODE is not defined.  */
+# undef GetLocaleInfo
+# define GetLocaleInfo GetLocaleInfoA
+# undef EnumSystemLocales
+# define EnumSystemLocales EnumSystemLocalesA
 #endif
 
 /* We want to use the system's setlocale() function here, not the gnulib
index 9cf78c82e00474072f81c72b87f318da0bada1c6..ca1be63f21ec44f5bee8b1e5400ba391005c5934 100644 (file)
 
 #ifdef __CYGWIN__
 # include <windows.h>
+/* Don't assume that UNICODE is not defined.  */
+# undef GetDriveType
+# define GetDriveType GetDriveTypeA
 # define ME_REMOTE me_remote
 /* All cygwin mount points include ':' or start with '//'; so it
    requires a native Windows call to determine remote disks.  */
index b354e74cef1ddd6d695675062bd880358b6c050d..0c4e5f8ee045315732b9ecfc542bf675e0f941fb 100644 (file)
 #  include <io.h>
 # endif
 
+/* Don't assume that UNICODE is not defined.  */
+# undef GetNamedPipeHandleState
+# define GetNamedPipeHandleState GetNamedPipeHandleStateA
+
 int
 get_nonblocking_flag (int desc)
 {
index 162ae4a03e5d24b72e370690be22e045370309c1..500fa44f6176c6d493441924138f0cffbaa2b29c 100644 (file)
 # include <fcntl.h>
 #endif
 
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Don't assume that UNICODE is not defined.  */
+# undef WIN32_FIND_DATA
+# define WIN32_FIND_DATA WIN32_FIND_DATAA
+# undef GetFullPathName
+# define GetFullPathName GetFullPathNameA
+# undef FindFirstFile
+# define FindFirstFile FindFirstFileA
+#endif
+
 DIR *
 opendir (const char *dir_name)
 {
index 6f0c5ef84a738b7c154635b4f5c47c61a791dcbe..db1bb07d6bb2ea05898739f7761f95480f21a96d 100644 (file)
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 
+/* Don't assume that UNICODE is not defined.  */
+# undef GetModuleHandle
+# define GetModuleHandle GetModuleHandleA
+
 /* Avoid warnings from gcc -Wcast-function-type.  */
 # define GetProcAddress \
    (void *) GetProcAddress
index 53bbafee2fc694aaae696ce66092efdfcd967133..61dd639eeaa52c58510cd3e22a6c07704260746c 100644 (file)
 
 #ifdef WINDOWS_NATIVE
 
+/* Don't assume that UNICODE is not defined.  */
+# undef GetModuleHandle
+# define GetModuleHandle GetModuleHandleA
+# undef PeekConsoleInput
+# define PeekConsoleInput PeekConsoleInputA
+# undef CreateEvent
+# define CreateEvent CreateEventA
+# undef PeekMessage
+# define PeekMessage PeekMessageA
+# undef DispatchMessage
+# define DispatchMessage DispatchMessageA
+
 /* Do *not* use the function WSAPoll
    <https://docs.microsoft.com/en-us/windows/desktop/api/winsock2/nf-winsock2-wsapoll>
    because there is a bug named â€śWindows 8 Bugs 309411 - WSAPoll does not
index de00bf6333aededdd60cb7b20aa58c60954101e1..ab0007ca0688d48a89a8eb68112a06c3d9d284b8 100644 (file)
    one.  */
 extern char * canonicalize_file_name (const char *name);
 
+#if defined WINDOWS_NATIVE
+/* Don't assume that UNICODE is not defined.  */
+# undef GetModuleFileName
+# define GetModuleFileName GetModuleFileNameA
+#endif
+
 /* Pathname support.
    ISSLASH(C)                tests whether C is a directory separator character.
    IS_FILE_NAME_WITH_DIR(P)  tests whether P contains a directory specification.
index 9e862e63d3d25258742bd586110b3ae3cd3818bf..ce0c752aab8230da23b143bb0d31e118e7a558af 100644 (file)
@@ -58,6 +58,12 @@ __libc_lock_define_initialized (static, envlock)
 # define UNLOCK
 #endif
 
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Don't assume that UNICODE is not defined.  */
+# undef SetEnvironmentVariable
+# define SetEnvironmentVariable SetEnvironmentVariableA
+#endif
+
 static int
 _unsetenv (const char *name)
 {
index 407738b90a627303c2afa88232a1de23f9e9e0de..90d1053052a34d1f5879aabddc88970cd045737b 100644 (file)
 #  include <io.h>
 # endif
 
+/* Don't assume that UNICODE is not defined.  */
+# undef GetNamedPipeHandleState
+# define GetNamedPipeHandleState GetNamedPipeHandleStateA
+
 # undef read
 
 # if HAVE_MSVC_INVALID_PARAMETER_HANDLER
index 1a02ce4173fb69a826e28e4aafe3dce1d72ecedf..91a351650dd3fb9866a081cef44452a23860cd9a 100644 (file)
 
 #include "dirent-private.h"
 
+/* Don't assume that UNICODE is not defined.  */
+#undef FindNextFile
+#define FindNextFile FindNextFileA
+
 struct dirent *
 readdir (DIR *dirp)
 {
index e4b867b9e96f29e0a1865f7088e2cc893b5c7933..04fb22e0f835edfc1f7868b3a8bc0274f9efc9b3 100644 (file)
 # include <libintl.h>
 #endif
 
+#if defined _WIN32 && !defined __CYGWIN__
+/* Don't assume that UNICODE is not defined.  */
+# undef GetModuleFileName
+# define GetModuleFileName GetModuleFileNameA
+#endif
+
 /* Faked cheap 'bool'.  */
 #undef bool
 #undef false
index 09881e8cfdae09970870fc1b0d9825adb669cbe9..108dc40c4fb112e0c0abe4c5b52ff88c1a5109b9 100644 (file)
 
 # include "dirname.h"
 
+/* Don't assume that UNICODE is not defined.  */
+# undef MoveFileEx
+# define MoveFileEx MoveFileExA
+
 /* Rename the file SRC to DST.  This replacement is necessary on
    Windows, on which the system rename function will not replace
    an existing DST.  */
index d8ae71405a85144480e2418a0d4d44acf7aae594..a18943d7d67a565a106e9a3533644ad86c5853fc 100644 (file)
 
 #include "dirent-private.h"
 
+/* Don't assume that UNICODE is not defined.  */
+#undef FindFirstFile
+#define FindFirstFile FindFirstFileA
+
 void
 rewinddir (DIR *dirp)
 {
index 4467eae84b2b669bc7f9beafd28977d895c9ffc4..b2234ea33426cc74771e294c1e2be3a8e84cc328 100644 (file)
 
 #undef select
 
+/* Don't assume that UNICODE is not defined.  */
+#undef GetModuleHandle
+#define GetModuleHandle GetModuleHandleA
+#undef PeekConsoleInput
+#define PeekConsoleInput PeekConsoleInputA
+#undef CreateEvent
+#define CreateEvent CreateEventA
+#undef PeekMessage
+#define PeekMessage PeekMessageA
+#undef DispatchMessage
+#define DispatchMessage DispatchMessageA
+
 /* Avoid warnings from gcc -Wcast-function-type.  */
 #define GetProcAddress \
   (void *) GetProcAddress
index 96318fb801f3d502002130c8ff3806f72b78c4be..52064df46ac9e44509a4eda9c69aec5e4480654c 100644 (file)
@@ -103,13 +103,12 @@ sethostname (const char *name, size_t len)
 # include <string.h>
 
 # include <windows.h>
-/* The mingw header files don't define GetComputerNameEx, SetComputerNameEx.  */
-# ifndef GetComputerNameEx
-#  define GetComputerNameEx GetComputerNameExA
-# endif
-# ifndef SetComputerNameEx
-#  define SetComputerNameEx SetComputerNameExA
-# endif
+
+/* Don't assume that UNICODE is not defined.  */
+# undef GetComputerNameEx
+# define GetComputerNameEx GetComputerNameExA
+# undef SetComputerNameEx
+# define SetComputerNameEx SetComputerNameExA
 
 /* Set up to LEN chars of NAME as system hostname.
    Return 0 if ok, set errno and return -1 on error. */
index 67c6b1e8775687fd8ab41b3482ffa59fba945f76..ebf777f25f62732ed27e5ba451e922cbdc37a40b 100644 (file)
 
 #include "sockets.h"
 
+/* Don't assume that UNICODE is not defined.  */
+#undef WSASocket
+#define WSASocket WSASocketA
+
 int
 rpl_socket (int domain, int type, int protocol)
 {
index cca12dd9cd734cd99adc5d43384c56b6662aab8e..19bdfaa379cdd0acf5586badf3bdf234f47e7271 100644 (file)
 #include "pathmax.h"
 #include "verify.h"
 
+/* Don't assume that UNICODE is not defined.  */
+#undef LoadLibrary
+#define LoadLibrary LoadLibraryA
+#undef GetFinalPathNameByHandle
+#define GetFinalPathNameByHandle GetFinalPathNameByHandleA
+
 #if !(_WIN32_WINNT >= _WIN32_WINNT_VISTA)
 
 /* Avoid warnings from gcc -Wcast-function-type.  */
index e074e6a0a0302627da21a1fd01c1eefd5485ce86..9d3965d3ce5aebca61a5777cc1625c04a1aa52c0 100644 (file)
@@ -65,6 +65,13 @@ orig_stat (const char *filename, struct stat *buf)
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 # include "stat-w32.h"
+/* Don't assume that UNICODE is not defined.  */
+# undef WIN32_FIND_DATA
+# define WIN32_FIND_DATA WIN32_FIND_DATAA
+# undef CreateFile
+# define CreateFile CreateFileA
+# undef FindFirstFile
+# define FindFirstFile FindFirstFileA
 #endif
 
 #ifdef WINDOWS_NATIVE
index 874c9b113416d06e2164ba0d0ec1935d3866a716..e63a3276912789101d0046d6ae9c31cfa2f36958 100644 (file)
 #   include <io.h>
 #  endif
 
+/* Don't assume that UNICODE is not defined.  */
+#  undef GetNamedPipeHandleState
+#  define GetNamedPipeHandleState GetNamedPipeHandleStateA
+
 #  define CALL_WITH_ERRNO_FIX(RETTYPE, EXPRESSION, FAILED) \
   if (ferror (stream))                                                        \
     return (EXPRESSION);                                                      \
index 41bc74c6f994738eb77fb118ba2b4b29237f7f74..778e7cf16db5345db5433cab14e3e9ebb0fb3abd 100644 (file)
 #   include <io.h>
 #  endif
 
+/* Don't assume that UNICODE is not defined.  */
+#  undef GetNamedPipeHandleState
+#  define GetNamedPipeHandleState GetNamedPipeHandleStateA
+
 #  if GNULIB_NONBLOCKING
 #   define CLEAR_ERRNO \
       errno = 0;
index 74ae3592625ca12311d6230b74069559b6b5bfed..28ff99f58a5c81481dee3933b3789b5510ed3f8f 100644 (file)
 
 #include "pathmax.h"
 
+#if defined _WIN32 && ! defined __CYGWIN__
+/* Don't assume that UNICODE is not defined.  */
+# undef GetTempPath
+# define GetTempPath GetTempPathA
+#endif
+
 #if _LIBC
 # define struct_stat64 struct stat64
 #else
index 99d6752bb1808a990550e8cb6caefbbc2c009ae6..667c0f234ec029d20c84d0972b337d804641c098 100644 (file)
 #if defined _WIN32 && ! defined __CYGWIN__
 /* A native Windows platforms.  */
 
+/* Don't assume that UNICODE is not defined.  */
+# undef OSVERSIONINFO
+# define OSVERSIONINFO OSVERSIONINFOA
+# undef GetVersionEx
+# define GetVersionEx GetVersionExA
+# undef GetTempPath
+# define GetTempPath GetTempPathA
+
 /* On Windows, opening a file with _O_TEMPORARY has the effect of passing
    the FILE_FLAG_DELETE_ON_CLOSE flag to CreateFile(), which has the effect
    of deleting the file when it is closed - even when the program crashes.
index d4778a8e3d218ec6093427b5caa86fabc7b0ce3d..cb6dd28ea05e60eba49e5b4dead9e6f8f36eabd9 100644 (file)
 /* This file provides an implementation only for the native Windows API.  */
 #if defined _WIN32 && ! defined __CYGWIN__
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <windows.h>
+# include <stdio.h>
+# include <stdlib.h>
+# include <string.h>
+# include <unistd.h>
+# include <windows.h>
 
 /* Mingw headers don't have all the platform codes.  */
-#ifndef VER_PLATFORM_WIN32_CE
-# define VER_PLATFORM_WIN32_CE 3
-#endif
+# ifndef VER_PLATFORM_WIN32_CE
+#  define VER_PLATFORM_WIN32_CE 3
+# endif
 
 /* Some headers don't have all the processor architecture codes.  */
-#ifndef PROCESSOR_ARCHITECTURE_AMD64
-# define PROCESSOR_ARCHITECTURE_AMD64 9
-#endif
-#ifndef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
-# define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
-#endif
+# ifndef PROCESSOR_ARCHITECTURE_AMD64
+#  define PROCESSOR_ARCHITECTURE_AMD64 9
+# endif
+# ifndef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
+#  define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
+# endif
 
 /* Mingw headers don't have the latest processor codes.  */
-#ifndef PROCESSOR_AMD_X8664
-# define PROCESSOR_AMD_X8664 8664
-#endif
+# ifndef PROCESSOR_AMD_X8664
+#  define PROCESSOR_AMD_X8664 8664
+# endif
+
+/* Don't assume that UNICODE is not defined.  */
+# undef OSVERSIONINFO
+# define OSVERSIONINFO OSVERSIONINFOA
+# undef GetVersionEx
+# define GetVersionEx GetVersionExA
 
 int
 uname (struct utsname *buf)
@@ -108,7 +114,7 @@ uname (struct utsname *buf)
     super_version = "";
 
   /* Fill in sysname.  */
-#ifdef __MINGW32__
+# ifdef __MINGW32__
   /* Returns a string compatible with the MSYS uname.exe program,
      so that no further changes are needed to GNU config.guess.
      For example,
@@ -117,9 +123,9 @@ uname (struct utsname *buf)
   sprintf (buf->sysname, "MINGW32_%s-%u.%u", super_version,
            (unsigned int) version.dwMajorVersion,
            (unsigned int) version.dwMinorVersion);
-#else
+# else
   sprintf (buf->sysname, "Windows%s", super_version);
-#endif
+# endif
 
   /* Fill in release, version.  */
   /* The MSYS uname.exe programs uses strings from a modified Cygwin runtime:
index 77968dca7fcc2b66b3851cf6c9bcafc4240064e2..c35eb169e6b228b572ecb1744b31303a7781efac 100644 (file)
 # include "filename.h"
 # include "malloca.h"
 
+/* Don't assume that UNICODE is not defined.  */
+# undef CreateFile
+# define CreateFile CreateFileA
+# undef GetFileAttributes
+# define GetFileAttributes GetFileAttributesA
+
 int
 _gl_utimens_windows (const char *name, struct timespec ts[2])
 {
index 44586a6d2c2a231bffafa94b025d728599313543..45e9b836ca9c23061f273b7916b75b948c971d64 100644 (file)
 #include <stdlib.h>
 #include <sys/time.h>
 
+/* Don't assume that UNICODE is not defined.  */
+#undef CreateEvent
+#define CreateEvent CreateEventA
+
 /* In this file, the waitqueues are implemented as linked lists.  */
 #define glwthread_waitqueue_t glwthread_linked_waitqueue_t
 
index 85a8552358b3d27e3da498c19e92d5e48ef876ad..6afb45b090e9fa4ffb134921c3b6f21169f388b1 100644 (file)
 #include <errno.h>
 #include <stdlib.h>
 
+/* Don't assume that UNICODE is not defined.  */
+#undef CreateEvent
+#define CreateEvent CreateEventA
+
 /* In this file, the waitqueues are implemented as circular arrays.  */
 #define glwthread_waitqueue_t glwthread_carray_waitqueue_t
 
index e36f4107bad90eac07031c188575c66fce6a7999..788fe40fc31606df366c826d0c54d4c1b3ab9a50 100644 (file)
 #include <stdlib.h>
 #include <sys/time.h>
 
+/* Don't assume that UNICODE is not defined.  */
+#undef CreateEvent
+#define CreateEvent CreateEventA
+
 int
 glwthread_timedmutex_init (glwthread_timedmutex_t *mutex)
 {
index 81fcdb66da3754138d7170327f6a68332740280b..d244bfd01513d0ff4bb2fd9170cf7616f71dd7ec 100644 (file)
 #include <stdlib.h>
 #include <sys/time.h>
 
+/* Don't assume that UNICODE is not defined.  */
+#undef CreateEvent
+#define CreateEvent CreateEventA
+
 int
 glwthread_timedrecmutex_init (glwthread_timedrecmutex_t *mutex)
 {
index 793e8b76b2eb4a065f5b08a76101d1a1dc09476d..42ad7461d2883fc2d4a28fb0b825bef824e0c0d8 100644 (file)
 #include <stdlib.h>
 #include <sys/time.h>
 
+/* Don't assume that UNICODE is not defined.  */
+#undef CreateEvent
+#define CreateEvent CreateEventA
+
 /* In this file, the waitqueues are implemented as linked lists.  */
 #define glwthread_waitqueue_t glwthread_clinked_waitqueue_t
 
index a3912838cd801edb0162c2f87897daeeb853ba67..581e674b40a8768390a1ea3ba5f28ba75309b878 100644 (file)
 #  include <io.h>
 # endif
 
+/* Don't assume that UNICODE is not defined.  */
+# undef GetNamedPipeHandleState
+# define GetNamedPipeHandleState GetNamedPipeHandleStateA
+
 # undef write
 
 # if HAVE_MSVC_INVALID_PARAMETER_HANDLER