]> granicus.if.org Git - libevent/commitdiff
Make Libevent 1.4.12 build on win32 with Unicode enabled.
authorBrodie Thiesfield <brofield2@jellycan.com>
Thu, 4 Feb 2010 04:27:40 +0000 (23:27 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 4 Feb 2010 04:31:44 +0000 (23:31 -0500)
This patch fixes calls to the win32 api to explicitly call the char* versions
of the functions. This fixes build failures when libevent is built with the
UNICODE define.

evdns.c
sample/event-test.c

diff --git a/evdns.c b/evdns.c
index 3611bc63941c64977920448f8b8c54778f70959c..2ef955edc08e0f55c9be124f7c14f0daab07e8e8 100644 (file)
--- a/evdns.c
+++ b/evdns.c
@@ -3530,7 +3530,7 @@ load_nameservers_with_getnetworkparams(struct evdns_base *base)
        GetNetworkParams_fn_t fn;
 
        ASSERT_LOCKED(base);
-       if (!(handle = LoadLibrary("iphlpapi.dll"))) {
+       if (!(handle = LoadLibraryA("iphlpapi.dll"))) {\r
                log(EVDNS_LOG_WARN, "Could not open iphlpapi.dll");
                status = -1;
                goto done;
@@ -3603,13 +3603,13 @@ config_nameserver_from_reg_key(struct evdns_base *base, HKEY key, const char *su
        int status = 0;
 
        ASSERT_LOCKED(base);
-       if (RegQueryValueEx(key, subkey, 0, &type, NULL, &bufsz)
+       if (RegQueryValueExA(key, subkey, 0, &type, NULL, &bufsz)\r
            != ERROR_MORE_DATA)
                return -1;
        if (!(buf = mm_malloc(bufsz)))
                return -1;
 
-       if (RegQueryValueEx(key, subkey, 0, &type, (LPBYTE)buf, &bufsz)
+       if (RegQueryValueExA(key, subkey, 0, &type, (LPBYTE)buf, &bufsz)\r
            == ERROR_SUCCESS && bufsz > 1) {
                status = evdns_nameserver_ip_add_line(base,buf);
        }
@@ -3641,12 +3641,12 @@ load_nameservers_from_registry(struct evdns_base *base)
        if (((int)GetVersion()) > 0) { /* NT */
                HKEY nt_key = 0, interfaces_key = 0;
 
-               if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0,
+               if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0,\r
                                 KEY_READ, &nt_key) != ERROR_SUCCESS) {
                        log(EVDNS_LOG_DEBUG,"Couldn't open nt key, %d",(int)GetLastError());
                        return -1;
                }
-               r = RegOpenKeyEx(nt_key, "Interfaces", 0,
+               r = RegOpenKeyExA(nt_key, "Interfaces", 0,\r
                             KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,
                             &interfaces_key);
                if (r != ERROR_SUCCESS) {
@@ -3661,7 +3661,7 @@ load_nameservers_from_registry(struct evdns_base *base)
                RegCloseKey(nt_key);
        } else {
                HKEY win_key = 0;
-               if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_9X_KEY, 0,
+               if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_9X_KEY, 0,\r
                                 KEY_READ, &win_key) != ERROR_SUCCESS) {
                        log(EVDNS_LOG_DEBUG, "Couldn't open registry key, %d", (int)GetLastError());
                        return -1;
index 5b4b14c43907a18c2efb12a8f639c603bc4a437c..ddb6c60ed680809e149cc49e62f02285b203b0d0 100644 (file)
@@ -77,7 +77,7 @@ main (int argc, char **argv)
 #ifdef WIN32
        HANDLE socket;
        /* Open a file. */
-       socket = CreateFile("test.txt",               /* open File */
+       socket = CreateFileA("test.txt",               /* open File */
                        GENERIC_READ,                 /* open for reading */
                        0,                            /* do not share */
                        NULL,                         /* no security */