[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/5] win32: Use ANSI functions
From: |
Paolo Bonzini |
Subject: |
[PATCH 1/5] win32: Use ANSI functions |
Date: |
Thu, 1 Oct 2009 14:15:07 +0200 |
Hi all, this is the first of a few patches to a few Win32 implementations
of gnulib modules.
This first one uses ANSI functions whenever we're passing or receiving
strings, so that compiling with -DUNICODE succeeds. I started from the
list of Win32 API functions, which I got from
grep -orh '\<[A-Z][a-z][A-Za-z]*[A-Z][a-z][a-z]*\ (' *
and then cleaned up the list to just a handful of them. After this,
I got carried away cleaning up uname, so this function is not in this
patch.
Ok?
* lib/getaddrinfo.c: Use ANSI functions.
* lib/link.c: Use GetModuleHandleA.
* lib/physmem.c: Use ANSI functions.
* lib/poll.c: Use ANSI functions.
* lib/progreloc.c: Use ANSI functions.
* lib/relocatable.c: Use ANSI functions.
* lib/select.c: Use ANSI functions.
* lib/tmpfile.c: Use ANSI functions.
---
ChangeLog | 12 ++++++++++++
lib/getaddrinfo.c | 2 +-
lib/link.c | 2 +-
lib/physmem.c | 4 ++--
lib/poll.c | 2 +-
lib/progreloc.c | 2 +-
lib/relocatable.c | 2 +-
lib/select.c | 2 +-
lib/tmpfile.c | 2 +-
9 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 50500fd..328a808 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-10-01 Paolo Bonzini <address@hidden>
+
+ Use ANSI Win32 functions.
+ * lib/getaddrinfo.c: Use ANSI functions.
+ * lib/link.c: Use GetModuleHandleA.
+ * lib/physmem.c: Use ANSI functions.
+ * lib/poll.c: Use ANSI functions.
+ * lib/progreloc.c: Use ANSI functions.
+ * lib/relocatable.c: Use ANSI functions.
+ * lib/select.c: Use ANSI functions.
+ * lib/tmpfile.c: Use ANSI functions.
+
2009-09-30 Ben Pfaff <address@hidden>
Fix broken build of replacement for Windows tmpfile().
diff --git a/lib/getaddrinfo.c b/lib/getaddrinfo.c
index 6a36bf0..4f25661 100644
--- a/lib/getaddrinfo.c
+++ b/lib/getaddrinfo.c
@@ -80,7 +80,7 @@ use_win32_p (void)
done = 1;
- h = GetModuleHandle ("ws2_32.dll");
+ h = GetModuleHandleA ("ws2_32.dll");
if (h)
{
diff --git a/lib/link.c b/lib/link.c
index 42d086c..460dff2 100644
--- a/lib/link.c
+++ b/lib/link.c
@@ -41,7 +41,7 @@ static BOOL initialized = FALSE;
static void
initialize (void)
{
- HMODULE kernel32 = LoadLibrary ("kernel32.dll");
+ HMODULE kernel32 = GetModuleHandleA ("kernel32.dll");
if (kernel32 != NULL)
{
CreateHardLinkFunc =
diff --git a/lib/physmem.c b/lib/physmem.c
index 4b532e1..1c0ff81 100644
--- a/lib/physmem.c
+++ b/lib/physmem.c
@@ -151,7 +151,7 @@ physmem_total (void)
#if defined _WIN32
{ /* this works on windows */
PFN_MS_EX pfnex;
- HMODULE h = GetModuleHandle ("kernel32.dll");
+ HMODULE h = GetModuleHandleA ("kernel32.dll");
if (!h)
return 0.0;
@@ -252,7 +252,7 @@ physmem_available (void)
#if defined _WIN32
{ /* this works on windows */
PFN_MS_EX pfnex;
- HMODULE h = GetModuleHandle ("kernel32.dll");
+ HMODULE h = GetModuleHandleA ("kernel32.dll");
if (!h)
return 0.0;
diff --git a/lib/poll.c b/lib/poll.c
index 3fa8872..88a4358 100644
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -139,7 +139,7 @@ win32_compute_revents (HANDLE h, int *p_sought)
if (!once_only)
{
NtQueryInformationFile = (PNtQueryInformationFile)
- GetProcAddress (GetModuleHandle ("ntdll.dll"),
+ GetProcAddress (GetModuleHandleA ("ntdll.dll"),
"NtQueryInformationFile");
once_only = TRUE;
}
diff --git a/lib/progreloc.c b/lib/progreloc.c
index 9ae08fb..5cbb723 100644
--- a/lib/progreloc.c
+++ b/lib/progreloc.c
@@ -142,7 +142,7 @@ find_executable (const char *argv0)
{
#if defined WIN32_NATIVE || defined __CYGWIN__
char location[MAX_PATH];
- int length = GetModuleFileName (NULL, location, sizeof (location));
+ int length = GetModuleFileNameA (NULL, location, sizeof (location));
if (length < 0)
return NULL;
if (!IS_PATH_WITH_DIR (location))
diff --git a/lib/relocatable.c b/lib/relocatable.c
index 09ff8c9..25dcf6b 100644
--- a/lib/relocatable.c
+++ b/lib/relocatable.c
@@ -304,7 +304,7 @@ DllMain (HINSTANCE module_handle, DWORD event, LPVOID
reserved)
/* The DLL is being loaded into an application's address range. */
static char location[MAX_PATH];
- if (!GetModuleFileName (module_handle, location, sizeof (location)))
+ if (!GetModuleFileNameA (module_handle, location, sizeof (location)))
/* Shouldn't happen. */
return FALSE;
diff --git a/lib/select.c b/lib/select.c
index 12d3e51..937b20e 100644
--- a/lib/select.c
+++ b/lib/select.c
@@ -122,7 +122,7 @@ win32_poll_handle (HANDLE h, int fd, struct bitset *rbits,
struct bitset *wbits,
if (!once_only)
{
NtQueryInformationFile = (PNtQueryInformationFile)
- GetProcAddress (GetModuleHandle ("ntdll.dll"),
+ GetProcAddress (GetModuleHandleA ("ntdll.dll"),
"NtQueryInformationFile");
once_only = TRUE;
}
diff --git a/lib/tmpfile.c b/lib/tmpfile.c
index 19c8a5e..2397088 100644
--- a/lib/tmpfile.c
+++ b/lib/tmpfile.c
@@ -69,7 +69,7 @@ tmpfile (void)
We provide this as the directory argument to path_search because Windows
defines P_tmpdir to "\\" and will therefore try to put all temporary files
in the root directory (unless $TMPDIR is set). */
- retval = GetTempPath (PATH_MAX, dir);
+ retval = GetTempPathA (PATH_MAX, dir);
if (retval > 0 && retval < PATH_MAX)
{
char xtemplate[PATH_MAX];
--
1.6.2.5
- Re: multiple target patterns, Paolo Bonzini, 2009/10/01
- [PATCH 1/5] win32: Use ANSI functions,
Paolo Bonzini <=
- [PATCH 2/5] uname: use only one OSVERSIONINFOEXA struct, use ANSI version, Paolo Bonzini, 2009/10/01
- Re: [PATCH 4/5] Handle Windows CE and rewrite NT version handling., Bruno Haible, 2009/10/01
- Re: [PATCH 4/5] Handle Windows CE and rewrite NT version handling., Paolo Bonzini, 2009/10/01
- Re: [PATCH 4/5] Handle Windows CE and rewrite NT version handling., Bruno Haible, 2009/10/01
- Re: [PATCH 4/5] Handle Windows CE and rewrite NT version handling., Paolo Bonzini, 2009/10/01
- Re: [PATCH 2/5] uname: use only one OSVERSIONINFOEXA struct, use ANSI version, Bruno Haible, 2009/10/01