From: Tor Lillqvist Date: Wed, 21 Jan 2009 16:18:39 +0000 (+0000) Subject: Drop the code in the else branch of #if GLIB_CHECK_VERSION (2, 19, 0). X-Git-Tag: GLIB_2_19_6~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=98d2cdd9e64f43ee05b4368aa7479a85a58668e9;p=platform%2Fupstream%2Fglib.git Drop the code in the else branch of #if GLIB_CHECK_VERSION (2, 19, 0). 2009-01-21 Tor Lillqvist * 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. svn path=/trunk/; revision=7826 --- diff --git a/ChangeLog b/ChangeLog index bec2a1c..baa322c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-01-21 Tor Lillqvist + + * 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. + 2009-01-20 Matthias Clasen Bug 568294 – A wrong reference in the description of diff --git a/glib/gwin32.c b/glib/gwin32.c index d722a87..c2ced69 100644 --- a/glib/gwin32.c +++ b/glib/gwin32.c @@ -380,75 +380,11 @@ get_package_directory_from_module (const gchar *module_name) 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);