glib r7826 - in trunk: . glib
- From: tml svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r7826 - in trunk: . glib
- Date: Wed, 21 Jan 2009 16:18:39 +0000 (UTC)
Author: tml
Date: Wed Jan 21 16:18:39 2009
New Revision: 7826
URL: http://svn.gnome.org/viewvc/glib?rev=7826&view=rev
Log:
2009-01-21 Tor Lillqvist <tml novell com>
* glib/gwin32.c (g_win32_locale_filename_from_utf8): Drop the code
in the else branch of #if GLIB_CHECK_VERSION (2, 19, 0). Drop
unused variables.
Modified:
trunk/ChangeLog
trunk/glib/gwin32.c
Modified: trunk/glib/gwin32.c
==============================================================================
--- trunk/glib/gwin32.c (original)
+++ trunk/glib/gwin32.c Wed Jan 21 16:18:39 2009
@@ -380,75 +380,11 @@
g_win32_get_package_installation_directory_utf8 (const gchar *package,
const gchar *dll_name)
{
- static GHashTable *package_dirs = NULL;
- G_LOCK_DEFINE_STATIC (package_dirs);
gchar *result = NULL;
- gchar *key;
- wchar_t *wc_key;
- HKEY reg_key = NULL;
- DWORD type;
- DWORD nbytes;
-#if GLIB_CHECK_VERSION (2, 19, 0)
if (package != NULL)
g_warning ("Passing a non-NULL package to g_win32_get_package_installation_directory() is deprecated and it is ignored.");
-#else
- if (package != NULL)
- {
- g_warning ("Passing a non-NULL package to g_win32_get_package_installation_directory() is deprecated and will not work in GLib after 2.18.");
-
- G_LOCK (package_dirs);
-
- if (package_dirs == NULL)
- package_dirs = g_hash_table_new (g_str_hash, g_str_equal);
-
- result = g_hash_table_lookup (package_dirs, package);
-
- if (result && result[0])
- {
- G_UNLOCK (package_dirs);
- return g_strdup (result);
- }
-
- key = g_strconcat ("Software\\", package, NULL);
-
- nbytes = 0;
-
- wc_key = g_utf8_to_utf16 (key, -1, NULL, NULL, NULL);
- if (((RegOpenKeyExW (HKEY_CURRENT_USER, wc_key, 0,
- KEY_QUERY_VALUE, ®_key) == ERROR_SUCCESS
- && RegQueryValueExW (reg_key, L"InstallationDirectory", 0,
- &type, NULL, &nbytes) == ERROR_SUCCESS)
- ||
- (RegOpenKeyExW (HKEY_LOCAL_MACHINE, wc_key, 0,
- KEY_QUERY_VALUE, ®_key) == ERROR_SUCCESS
- && RegQueryValueExW (reg_key, L"InstallationDirectory", 0,
- &type, NULL, &nbytes) == ERROR_SUCCESS))
- && type == REG_SZ)
- {
- wchar_t *wc_temp = g_new (wchar_t, (nbytes+1)/2 + 1);
- RegQueryValueExW (reg_key, L"InstallationDirectory", 0,
- &type, (LPBYTE) wc_temp, &nbytes);
- wc_temp[nbytes/2] = '\0';
- result = g_utf16_to_utf8 (wc_temp, -1, NULL, NULL, NULL);
- g_free (wc_temp);
- }
- g_free (wc_key);
-
- if (reg_key != NULL)
- RegCloseKey (reg_key);
-
- g_free (key);
- if (result)
- {
- g_hash_table_insert (package_dirs, g_strdup (package), result);
- G_UNLOCK (package_dirs);
- return g_strdup (result);
- }
- G_UNLOCK (package_dirs);
- }
-#endif
if (dll_name != NULL)
result = get_package_directory_from_module (dll_name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]