pidgin.next.minor: 6abe87c5: Remove some win9x specific code.

datallah at pidgin.im datallah at pidgin.im
Thu Sep 3 23:01:26 EDT 2009


-----------------------------------------------------------------
Revision: 6abe87c54bf7619b035f56628efc9a97090b1f23
Ancestor: 7c03d7975e260b38f1f4a0f1d9c39905e235b8d5
Author: datallah at pidgin.im
Date: 2009-09-04T02:57:26
Branch: im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/6abe87c54bf7619b035f56628efc9a97090b1f23

Modified files:
        libpurple/win32/win32dep.c pidgin/gtkft.c pidgin/gtkpounce.c
        pidgin/gtksound.c pidgin/gtkutils.c
        pidgin/win32/gtkwin32dep.c

ChangeLog: 

Remove some win9x specific code.

-------------- next part --------------
============================================================
--- libpurple/win32/win32dep.c	23ad1bd8d7820755b945fe672e62d9351a626a78
+++ libpurple/win32/win32dep.c	011da107935da2cdb6aa037fb962892bed2f0839
@@ -115,7 +115,6 @@ gchar *wpurple_get_special_folder(int fo
 
 /* Get paths to special Windows folders. */
 gchar *wpurple_get_special_folder(int folder_type) {
-	static LPFNSHGETFOLDERPATHA MySHGetFolderPathA = NULL;
 	static LPFNSHGETFOLDERPATHW MySHGetFolderPathW = NULL;
 	gchar *retval = NULL;
 
@@ -133,21 +132,6 @@ gchar *wpurple_get_special_folder(int fo
 		}
 	}
 
-	if (!retval) {
-		if (!MySHGetFolderPathA) {
-			MySHGetFolderPathA = (LPFNSHGETFOLDERPATHA)
-				wpurple_find_and_loadproc("shfolder.dll", "SHGetFolderPathA");
-		}
-		if (MySHGetFolderPathA) {
-			char locale_dir[MAX_PATH + 1];
-
-			if (SUCCEEDED(MySHGetFolderPathA(NULL, folder_type, NULL,
-							SHGFP_TYPE_CURRENT, locale_dir))) {
-				retval = g_locale_to_utf8(locale_dir, -1, NULL, NULL, NULL);
-			}
-		}
-	}
-
 	return retval;
 }
 
@@ -156,20 +140,11 @@ const char *wpurple_install_dir(void) {
 
 	if (!initialized) {
 		char *tmp = NULL;
-		if (G_WIN32_HAVE_WIDECHAR_API()) {
-			wchar_t winstall_dir[MAXPATHLEN];
-			if (GetModuleFileNameW(NULL, winstall_dir,
-					MAXPATHLEN) > 0) {
-				tmp = g_utf16_to_utf8(winstall_dir, -1,
-					NULL, NULL, NULL);
-			}
-		} else {
-			gchar cpinstall_dir[MAXPATHLEN];
-			if (GetModuleFileNameA(NULL, cpinstall_dir,
-					MAXPATHLEN) > 0) {
-				tmp = g_locale_to_utf8(cpinstall_dir,
-					-1, NULL, NULL, NULL);
-			}
+		wchar_t winstall_dir[MAXPATHLEN];
+		if (GetModuleFileNameW(NULL, winstall_dir,
+				MAXPATHLEN) > 0) {
+			tmp = g_utf16_to_utf8(winstall_dir, -1,
+				NULL, NULL, NULL);
 		}
 
 		if (tmp == NULL) {
@@ -246,61 +221,33 @@ gboolean wpurple_write_reg_string(HKEY r
 	HKEY reg_key;
 	gboolean success = FALSE;
 
-	if(G_WIN32_HAVE_WIDECHAR_API()) {
-		wchar_t *wc_subkey = g_utf8_to_utf16(subkey, -1, NULL,
-			NULL, NULL);
+	wchar_t *wc_subkey = g_utf8_to_utf16(subkey, -1, NULL,
+		NULL, NULL);
 
-		if(RegOpenKeyExW(rootkey, wc_subkey, 0,
-				KEY_SET_VALUE, &reg_key) == ERROR_SUCCESS) {
-			wchar_t *wc_valname = NULL;
+	if(RegOpenKeyExW(rootkey, wc_subkey, 0,
+			KEY_SET_VALUE, &reg_key) == ERROR_SUCCESS) {
+		wchar_t *wc_valname = NULL;
 
-			if (valname)
-				wc_valname = g_utf8_to_utf16(valname, -1,
-					NULL, NULL, NULL);
+		if (valname)
+			wc_valname = g_utf8_to_utf16(valname, -1,
+				NULL, NULL, NULL);
 
-			if(value) {
-				wchar_t *wc_value = g_utf8_to_utf16(value, -1,
-					NULL, NULL, NULL);
-				int len = (wcslen(wc_value) * sizeof(wchar_t)) + 1;
-				if(RegSetValueExW(reg_key, wc_valname, 0, REG_SZ,
-						(LPBYTE)wc_value, len
-						) == ERROR_SUCCESS)
-					success = TRUE;
-				g_free(wc_value);
-			} else
-				if(RegDeleteValueW(reg_key, wc_valname) ==  ERROR_SUCCESS)
-					success = TRUE;
+		if(value) {
+			wchar_t *wc_value = g_utf8_to_utf16(value, -1,
+				NULL, NULL, NULL);
+			int len = (wcslen(wc_value) * sizeof(wchar_t)) + 1;
+			if(RegSetValueExW(reg_key, wc_valname, 0, REG_SZ,
+					(LPBYTE)wc_value, len
+					) == ERROR_SUCCESS)
+				success = TRUE;
+			g_free(wc_value);
+		} else
+			if(RegDeleteValueW(reg_key, wc_valname) ==  ERROR_SUCCESS)
+				success = TRUE;
 
-			g_free(wc_valname);
-		}
-		g_free(wc_subkey);
-	} else {
-		char *cp_subkey = g_locale_from_utf8(subkey, -1, NULL,
-			NULL, NULL);
-		if(RegOpenKeyExA(rootkey, cp_subkey, 0,
-				KEY_SET_VALUE, &reg_key) == ERROR_SUCCESS) {
-			char *cp_valname = NULL;
-			if(valname)
-				cp_valname = g_locale_from_utf8(valname, -1,
-					NULL, NULL, NULL);
-
-			if (value) {
-				char *cp_value = g_locale_from_utf8(value, -1,
-					NULL, NULL, NULL);
-				int len = strlen(cp_value) + 1;
-				if(RegSetValueExA(reg_key, cp_valname, 0, REG_SZ,
-						cp_value, len
-						) == ERROR_SUCCESS)
-					success = TRUE;
-				g_free(cp_value);
-			} else
-				if(RegDeleteValueA(reg_key, cp_valname) ==  ERROR_SUCCESS)
-					success = TRUE;
-
-			g_free(cp_valname);
-		}
-		g_free(cp_subkey);
+		g_free(wc_valname);
 	}
+	g_free(wc_subkey);
 
 	if(reg_key != NULL)
 		RegCloseKey(reg_key);
@@ -312,18 +259,12 @@ static HKEY _reg_open_key(HKEY rootkey, 
 	HKEY reg_key = NULL;
 	LONG rv;
 
-	if(G_WIN32_HAVE_WIDECHAR_API()) {
-		wchar_t *wc_subkey = g_utf8_to_utf16(subkey, -1, NULL,
-			NULL, NULL);
-		rv = RegOpenKeyExW(rootkey, wc_subkey, 0, access, &reg_key);
-		g_free(wc_subkey);
-	} else {
-		char *cp_subkey = g_locale_from_utf8(subkey, -1, NULL,
-			NULL, NULL);
-		rv = RegOpenKeyExA(rootkey, cp_subkey, 0, access, &reg_key);
-		g_free(cp_subkey);
-	}
+	wchar_t *wc_subkey = g_utf8_to_utf16(subkey, -1, NULL,
+		NULL, NULL);
+	rv = RegOpenKeyExW(rootkey, wc_subkey, 0, access, &reg_key);
 
+	g_free(wc_subkey);
+
 	if (rv != ERROR_SUCCESS) {
 		char *errmsg = g_win32_error_message(rv);
 		purple_debug_error("wpurple", "Could not open reg key '%s' subkey '%s'.\nMessage: (%ld) %s\n",
@@ -340,19 +281,11 @@ static gboolean _reg_read(HKEY reg_key, 
 static gboolean _reg_read(HKEY reg_key, const char *valname, LPDWORD type, LPBYTE data, LPDWORD data_len) {
 	LONG rv;
 
-	if(G_WIN32_HAVE_WIDECHAR_API()) {
-		wchar_t *wc_valname = NULL;
-		if (valname)
-			wc_valname = g_utf8_to_utf16(valname, -1, NULL, NULL, NULL);
-		rv = RegQueryValueExW(reg_key, wc_valname, 0, type, data, data_len);
-		g_free(wc_valname);
-	} else {
-		char *cp_valname = NULL;
-		if(valname)
-			cp_valname = g_locale_from_utf8(valname, -1, NULL, NULL, NULL);
-		rv = RegQueryValueExA(reg_key, cp_valname, 0, type, data, data_len);
-		g_free(cp_valname);
-	}
+	wchar_t *wc_valname = NULL;
+	if (valname)
+		wc_valname = g_utf8_to_utf16(valname, -1, NULL, NULL, NULL);
+	rv = RegQueryValueExW(reg_key, wc_valname, 0, type, data, data_len);
+	g_free(wc_valname);
 
 	if (rv != ERROR_SUCCESS) {
 		char *errmsg = g_win32_error_message(rv);
@@ -389,24 +322,13 @@ char *wpurple_read_reg_string(HKEY rootk
 
 	if(reg_key) {
 		if(_reg_read(reg_key, valname, &type, NULL, &nbytes) && type == REG_SZ) {
-			LPBYTE data;
-			if(G_WIN32_HAVE_WIDECHAR_API())
-				data = (LPBYTE) g_new(wchar_t, ((nbytes + 1) / sizeof(wchar_t)) + 1);
-			else
-				data = (LPBYTE) g_malloc(nbytes + 1);
+			LPBYTE data = (LPBYTE) g_new(wchar_t, ((nbytes + 1) / sizeof(wchar_t)) + 1);
 
 			if(_reg_read(reg_key, valname, &type, data, &nbytes)) {
-				if(G_WIN32_HAVE_WIDECHAR_API()) {
-					wchar_t *wc_temp = (wchar_t*) data;
-					wc_temp[nbytes / sizeof(wchar_t)] = '\0';
-					result = g_utf16_to_utf8(wc_temp, -1,
-						NULL, NULL, NULL);
-				} else {
-					char *cp_temp = (char*) data;
-					cp_temp[nbytes] = '\0';
-					result = g_locale_to_utf8(cp_temp, -1,
-						NULL, NULL, NULL);
-				}
+				wchar_t *wc_temp = (wchar_t*) data;
+				wc_temp[nbytes / sizeof(wchar_t)] = '\0';
+				result = g_utf16_to_utf8(wc_temp, -1,
+					NULL, NULL, NULL);
 			}
 			g_free(data);
 		}
============================================================
--- pidgin/gtkft.c	38577e577b72aa22a50febe3e5bffb1c2bf51b3d
+++ pidgin/gtkft.c	e6bc986ead0ac34e46d916fedb21a306efd048ac
@@ -458,28 +458,16 @@ open_button_cb(GtkButton *button, Pidgin
 #ifdef _WIN32
 	/* If using Win32... */
 	int code;
-	if (G_WIN32_HAVE_WIDECHAR_API ()) {
-		wchar_t *wc_filename = g_utf8_to_utf16(
-				purple_xfer_get_local_filename(
-					dialog->selected_xfer),
-				-1, NULL, NULL, NULL);
+	wchar_t *wc_filename = g_utf8_to_utf16(
+			purple_xfer_get_local_filename(
+				dialog->selected_xfer),
+			-1, NULL, NULL, NULL);
 
-		code = (int) ShellExecuteW(NULL, NULL, wc_filename, NULL, NULL,
-				SW_SHOW);
+	code = (int) ShellExecuteW(NULL, NULL, wc_filename, NULL, NULL,
+			SW_SHOW);
 
-		g_free(wc_filename);
-	} else {
-		char *l_filename = g_locale_from_utf8(
-				purple_xfer_get_local_filename(
-					dialog->selected_xfer),
-				-1, NULL, NULL, NULL);
+	g_free(wc_filename);
 
-		code = (int) ShellExecuteA(NULL, NULL, l_filename, NULL, NULL,
-				SW_SHOW);
-
-		g_free(l_filename);
-	}
-
 	if (code == SE_ERR_ASSOCINCOMPLETE || code == SE_ERR_NOASSOC)
 	{
 		purple_notify_error(dialog, NULL,
============================================================
--- pidgin/gtkpounce.c	536eb83548954988969ae2c851bb4ede3654130a
+++ pidgin/gtkpounce.c	05b4eea340de6f0985c9db515ca7f137b6e78199
@@ -1536,35 +1536,20 @@ pounce_cb(PurplePounce *pounce, PurplePo
 			PROCESS_INFORMATION pi;
 			BOOL retval;
 			gchar *message = NULL;
+			STARTUPINFOW si;
 
-			memset(&pi, 0, sizeof(pi));
+			wchar_t *wc_cmd = g_utf8_to_utf16(command,
+					-1, NULL, NULL, NULL);
 
-			if (G_WIN32_HAVE_WIDECHAR_API ()) {
-				STARTUPINFOW si;
-				wchar_t *wc_cmd = g_utf8_to_utf16(command,
-						-1, NULL, NULL, NULL);
+			memset(&pi, 0, sizeof(pi));
+			memset(&si, 0 , sizeof(si));
+			si.cb = sizeof(si);
 
-				memset(&si, 0 , sizeof(si));
-				si.cb = sizeof(si);
+			retval = CreateProcessW(NULL, wc_cmd, NULL,
+					NULL, 0, 0, NULL, NULL,
+					&si, &pi);
+			g_free(wc_cmd);
 
-				retval = CreateProcessW(NULL, wc_cmd, NULL,
-						NULL, 0, 0, NULL, NULL,
-						&si, &pi);
-				g_free(wc_cmd);
-			} else {
-				STARTUPINFOA si;
-				char *l_cmd = g_locale_from_utf8(command,
-						-1, NULL, NULL, NULL);
-
-				memset(&si, 0 , sizeof(si));
-				si.cb = sizeof(si);
-
-				retval = CreateProcessA(NULL, l_cmd, NULL,
-						NULL, 0, 0, NULL, NULL,
-						&si, &pi);
-				g_free(l_cmd);
-			}
-
 			if (retval) {
 				CloseHandle(pi.hProcess);
 				CloseHandle(pi.hThread);
============================================================
--- pidgin/gtksound.c	cd624de6ad8a8ee939cb4ab161704955d65ad7c9
+++ pidgin/gtksound.c	118712d8e9ce6e3d22022a32db6357150bc8b85c
@@ -537,18 +537,12 @@ pidgin_sound_play_file(const char *filen
 #else /* _WIN32 */
 	purple_debug_info("sound", "Playing %s\n", filename);
 
-	if (G_WIN32_HAVE_WIDECHAR_API ()) {
+	{
 		wchar_t *wc_filename = g_utf8_to_utf16(filename,
 				-1, NULL, NULL, NULL);
 		if (!PlaySoundW(wc_filename, NULL, SND_ASYNC | SND_FILENAME))
 			purple_debug(PURPLE_DEBUG_ERROR, "sound", "Error playing sound.\n");
 		g_free(wc_filename);
-	} else {
-		char *l_filename = g_locale_from_utf8(filename,
-				-1, NULL, NULL, NULL);
-		if (!PlaySoundA(l_filename, NULL, SND_ASYNC | SND_FILENAME))
-			purple_debug(PURPLE_DEBUG_ERROR, "sound", "Error playing sound.\n");
-		g_free(l_filename);
 	}
 #endif /* _WIN32 */
 
============================================================
--- pidgin/gtkutils.c	db662ad912e82083f7411819a4067dd6711ad308
+++ pidgin/gtkutils.c	f877c009d0e7a6a294b8c0b07c79f959b5a77592
@@ -3107,24 +3107,14 @@ file_open_uri(GtkIMHtml *imhtml, const c
 #ifdef _WIN32
 	/* If using Win32... */
 	int code;
-	if (G_WIN32_HAVE_WIDECHAR_API()) {
-		wchar_t *wc_filename = g_utf8_to_utf16(
-				uri, -1, NULL, NULL, NULL);
+	wchar_t *wc_filename = g_utf8_to_utf16(
+			uri, -1, NULL, NULL, NULL);
 
-		code = (int)ShellExecuteW(NULL, NULL, wc_filename, NULL, NULL,
-				SW_SHOW);
+	code = (int)ShellExecuteW(NULL, NULL, wc_filename, NULL, NULL,
+			SW_SHOW);
 
-		g_free(wc_filename);
-	} else {
-		char *l_filename = g_locale_from_utf8(
-				uri, -1, NULL, NULL, NULL);
+	g_free(wc_filename);
 
-		code = (int)ShellExecuteA(NULL, NULL, l_filename, NULL, NULL,
-				SW_SHOW);
-
-		g_free(l_filename);
-	}
-
 	if (code == SE_ERR_ASSOCINCOMPLETE || code == SE_ERR_NOASSOC)
 	{
 		purple_notify_error(imhtml, NULL,
============================================================
--- pidgin/win32/gtkwin32dep.c	55a8531d83b87d00ef47820e831f8fdaa266a7a4
+++ pidgin/win32/gtkwin32dep.c	12455579af84c1afa2c35f323684c925a4838814
@@ -142,57 +142,34 @@ void winpidgin_shell_execute(const char 
 
 void winpidgin_shell_execute(const char *target, const char *verb, const char *clazz) {
 
+	SHELLEXECUTEINFOW wsinfo;
+	wchar_t *w_uri, *w_verb, *w_clazz = NULL;
+
 	g_return_if_fail(target != NULL);
 	g_return_if_fail(verb != NULL);
 
-	if (G_WIN32_HAVE_WIDECHAR_API()) {
-		SHELLEXECUTEINFOW wsinfo;
-		wchar_t *w_uri, *w_verb, *w_clazz = NULL;
+	w_uri = g_utf8_to_utf16(target, -1, NULL, NULL, NULL);
+	w_verb = g_utf8_to_utf16(verb, -1, NULL, NULL, NULL);
 
-		w_uri = g_utf8_to_utf16(target, -1, NULL, NULL, NULL);
-		w_verb = g_utf8_to_utf16(verb, -1, NULL, NULL, NULL);
+	memset(&wsinfo, 0, sizeof(wsinfo));
+	wsinfo.cbSize = sizeof(wsinfo);
+	wsinfo.lpVerb = w_verb;
+	wsinfo.lpFile = w_uri;
+	wsinfo.nShow = SW_SHOWNORMAL;
+	if (clazz != NULL) {
+		w_clazz = g_utf8_to_utf16(clazz, -1, NULL, NULL, NULL);
+		wsinfo.fMask |= SEE_MASK_CLASSNAME;
+		wsinfo.lpClass = w_clazz;
+	}
 
-		memset(&wsinfo, 0, sizeof(wsinfo));
-		wsinfo.cbSize = sizeof(wsinfo);
-		wsinfo.lpVerb = w_verb;
-		wsinfo.lpFile = w_uri;
-		wsinfo.nShow = SW_SHOWNORMAL;
-		if (clazz != NULL) {
-			w_clazz = g_utf8_to_utf16(clazz, -1, NULL, NULL, NULL);
-			wsinfo.fMask |= SEE_MASK_CLASSNAME;
-			wsinfo.lpClass = w_clazz;
-		}
+	if(!ShellExecuteExW(&wsinfo))
+		purple_debug_error("winpidgin", "Error opening URI: %s error: %d\n",
+			target, (int) wsinfo.hInstApp);
 
-		if(!ShellExecuteExW(&wsinfo))
-			purple_debug_error("winpidgin", "Error opening URI: %s error: %d\n",
-				target, (int) wsinfo.hInstApp);
+	g_free(w_uri);
+	g_free(w_verb);
+	g_free(w_clazz);
 
-		g_free(w_uri);
-		g_free(w_verb);
-		g_free(w_clazz);
-	} else {
-		SHELLEXECUTEINFOA sinfo;
-		gchar *locale_uri;
-
-		locale_uri = g_locale_from_utf8(target, -1, NULL, NULL, NULL);
-
-		memset(&sinfo, 0, sizeof(sinfo));
-		sinfo.cbSize = sizeof(sinfo);
-		sinfo.lpVerb = verb;
-		sinfo.lpFile = locale_uri;
-		sinfo.nShow = SW_SHOWNORMAL;
-		if (clazz != NULL) {
-			sinfo.fMask |= SEE_MASK_CLASSNAME;
-			sinfo.lpClass = clazz;
-		}
-
-		if(!ShellExecuteExA(&sinfo))
-			purple_debug_error("winpidgin", "Error opening URI: %s error: %d\n",
-				target, (int) sinfo.hInstApp);
-
-		g_free(locale_uri);
-	}
-
 }
 
 void winpidgin_notify_uri(const char *uri) {


More information about the Commits mailing list