[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[Libevent-users] patch for libevent 1.4.13 for building win32 + unicode



Hi,

The following (and attached) 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.

Regards,
Brodie


--- evdns.orig.c	2009-07-24 00:17:02.000000000 +0900
+++ evdns.c	2010-02-04 11:46:54.046659000 +0900
@@ -2848,3 +2848,3 @@

-	if (!(handle = LoadLibrary("iphlpapi.dll"))) {
+	if (!(handle = LoadLibraryA("iphlpapi.dll"))) {
 		log(EVDNS_LOG_WARN, "Could not open iphlpapi.dll");
@@ -2918,3 +2918,3 @@

-	if (RegQueryValueEx(key, subkey, 0, &type, NULL, &bufsz)
+	if (RegQueryValueExA(key, subkey, 0, &type, NULL, &bufsz)
 	    != ERROR_MORE_DATA)
@@ -2924,3 +2924,3 @@

-	if (RegQueryValueEx(key, subkey, 0, &type, (LPBYTE)buf, &bufsz)
+	if (RegQueryValueExA(key, subkey, 0, &type, (LPBYTE)buf, &bufsz)
 	    == ERROR_SUCCESS && bufsz > 1) {
@@ -2954,3 +2954,3 @@

-		if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0,
+		if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0,
 				 KEY_READ, &nt_key) != ERROR_SUCCESS) {
@@ -2959,3 +2959,3 @@
 		}
-		r = RegOpenKeyEx(nt_key, "Interfaces", 0,
+		r = RegOpenKeyExA(nt_key, "Interfaces", 0,
 			     KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,
@@ -2974,3 +2974,3 @@
 		HKEY win_key = 0;
-		if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_9X_KEY, 0,
+		if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_9X_KEY, 0,
 				 KEY_READ, &win_key) != ERROR_SUCCESS) {
--- sample\event-test.orig.c	2008-11-17 05:35:40.000000000 +0900
+++ sample\event-test.c	2010-02-04 11:49:56.751109100 +0900
@@ -75,3 +75,3 @@
 	// Open a file.
-	socket = CreateFile("test.txt",     // open File
+	socket = CreateFileA("test.txt",     // open File
 			GENERIC_READ,                 // open for reading

--- evdns.orig.c	2009-07-24 00:17:02.000000000 +0900
+++ evdns.c	2010-02-04 11:46:54.046659000 +0900
@@ -2848,3 +2848,3 @@
 
-	if (!(handle = LoadLibrary("iphlpapi.dll"))) {
+	if (!(handle = LoadLibraryA("iphlpapi.dll"))) {
 		log(EVDNS_LOG_WARN, "Could not open iphlpapi.dll");
@@ -2918,3 +2918,3 @@
 
-	if (RegQueryValueEx(key, subkey, 0, &type, NULL, &bufsz)
+	if (RegQueryValueExA(key, subkey, 0, &type, NULL, &bufsz)
 	    != ERROR_MORE_DATA)
@@ -2924,3 +2924,3 @@
 
-	if (RegQueryValueEx(key, subkey, 0, &type, (LPBYTE)buf, &bufsz)
+	if (RegQueryValueExA(key, subkey, 0, &type, (LPBYTE)buf, &bufsz)
 	    == ERROR_SUCCESS && bufsz > 1) {
@@ -2954,3 +2954,3 @@
 
-		if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0,
+		if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0,
 				 KEY_READ, &nt_key) != ERROR_SUCCESS) {
@@ -2959,3 +2959,3 @@
 		}
-		r = RegOpenKeyEx(nt_key, "Interfaces", 0,
+		r = RegOpenKeyExA(nt_key, "Interfaces", 0,
 			     KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,
@@ -2974,3 +2974,3 @@
 		HKEY win_key = 0;
-		if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_9X_KEY, 0,
+		if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_9X_KEY, 0,
 				 KEY_READ, &win_key) != ERROR_SUCCESS) {
--- sample\event-test.orig.c	2008-11-17 05:35:40.000000000 +0900
+++ sample\event-test.c	2010-02-04 11:49:56.751109100 +0900
@@ -75,3 +75,3 @@
 	// Open a file. 
-	socket = CreateFile("test.txt",     // open File 
+	socket = CreateFileA("test.txt",     // open File 
 			GENERIC_READ,                 // open for reading