glib r7480 - in trunk: . glib
- From: tml svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r7480 - in trunk: . glib
- Date: Sat, 13 Sep 2008 20:23:18 +0000 (UTC)
Author: tml
Date: Sat Sep 13 20:23:17 2008
New Revision: 7480
URL: http://svn.gnome.org/viewvc/glib?rev=7480&view=rev
Log:
2008-09-13 Tor Lillqvist <tml novell com>
* glib/gutils.h
* glib/gwin32.h: Deprecate G_WIN32_DLLMAIN_FOR_DLL_NAME(),
g_win32_get_package_installation_directory() and
g_win32_get_package_installation_subdirectory() as their
documentation has warned for a while. Sorry that I forgot to do
this before 2.18.0.
* glib/gwin32.c (g_win32_get_package_installation_directory):
Print a warning if a non-NULL package parameter is passed to this
function, as that is deprecated usage, as the documentation says.
Modified:
trunk/ChangeLog
trunk/glib/gutils.h
trunk/glib/gwin32.c
trunk/glib/gwin32.h
Modified: trunk/glib/gutils.h
==============================================================================
--- trunk/glib/gutils.h (original)
+++ trunk/glib/gutils.h Sat Sep 13 20:23:17 2008
@@ -430,11 +430,13 @@
G_END_DECLS
+#ifndef G_DISABLE_DEPRECATED
+
/*
- * This macro will be deprecated in the future. This DllMain() is too
- * complex. It is recommended to have a DLlMain() that just saves the
- * handle to the DLL and then use that handle in normal code instead,
- * for instance passing it to
+ * This macro is deprecated. This DllMain() is too complex. It is
+ * recommended to write an explicit minimal DLlMain() that just saves
+ * the handle to the DLL and then use that handle instead, for
+ * instance passing it to
* g_win32_get_package_installation_directory_of_module().
*
* On Windows, this macro defines a DllMain function that stores the
@@ -472,6 +474,9 @@
\
return TRUE; \
}
+
+#endif /* !G_DISABLE_DEPRECATED */
+
#endif /* G_PLATFORM_WIN32 */
#endif /* __G_UTILS_H__ */
Modified: trunk/glib/gwin32.c
==============================================================================
--- trunk/glib/gwin32.c (original)
+++ trunk/glib/gwin32.c Sat Sep 13 20:23:17 2008
@@ -321,10 +321,11 @@
*
* Try to determine the installation directory for a software package.
*
- * This function will be deprecated in the future. Use
+ * This function is deprecated. Use
* g_win32_get_package_installation_directory_of_module() instead.
*
- * The use of @package is deprecated. You should always pass %NULL.
+ * The use of @package is deprecated. You should always pass %NULL. A
+ * warning is printed if non-NULL is passed as @package.
*
* The original intended use of @package was for a short identifier of
* the package, typically the same identifier as used for
@@ -343,7 +344,7 @@
*
* For this reason it is recommeded to always pass %NULL as
* @package to this function, to avoid the temptation to use the
- * Registry. In version 2.18 of GLib the @package parameter
+ * Registry. In version 2.20 of GLib the @package parameter
* will be ignored and this function won't look in the Registry at all.
*
* If @package is %NULL, or the above value isn't found in the
@@ -364,11 +365,14 @@
* @package. The string is in the GLib file name encoding,
* i.e. UTF-8. The return value should be freed with g_free() when not
* needed any longer. If the function fails %NULL is returned.
+ *
+ * @Deprecated:2.18: Pass the HMODULE of a DLL or EXE to
+ * g_win32_get_package_installation_directory_of_module() instead.
**/
-gchar *
-g_win32_get_package_installation_directory (const gchar *package,
- const gchar *dll_name)
+ gchar *
+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);
@@ -379,8 +383,14 @@
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)
@@ -432,7 +442,7 @@
}
G_UNLOCK (package_dirs);
}
-
+#endif
if (dll_name != NULL)
result = get_package_directory_from_module (dll_name);
@@ -444,8 +454,6 @@
#if !defined (_WIN64)
-#undef g_win32_get_package_installation_directory
-
/* DLL ABI binary compatibility version that uses system codepage file names */
gchar *
@@ -482,8 +490,9 @@
* @dll_name: The name of a DLL that a package provides, in UTF-8, or %NULL.
* @subdir: A subdirectory of the package installation directory, also in UTF-8
*
- * This function will be deprecated in the future. Use
- * g_win32_get_package_installation_directory_of_module() instead.
+ * This function is deprecated. Use
+ * g_win32_get_package_installation_directory_of_module() and
+ * g_build_filename() instead.
*
* Returns a newly-allocated string containing the path of the
* subdirectory @subdir in the return value from calling
@@ -498,12 +507,16 @@
* the GLib file name encoding, i.e. UTF-8. The return value should be
* freed with g_free() when no longer needed. If something goes wrong,
* %NULL is returned.
+ *
+ * @Deprecated:2.18: Pass the HMODULE of a DLL or EXE to
+ * g_win32_get_package_installation_directory_of_module() instead, and
+ * then construct a subdirectory pathname with g_build_filename().
**/
gchar *
-g_win32_get_package_installation_subdirectory (const gchar *package,
- const gchar *dll_name,
- const gchar *subdir)
+g_win32_get_package_installation_subdirectory_utf8 (const gchar *package,
+ const gchar *dll_name,
+ const gchar *subdir)
{
gchar *prefix;
gchar *dirname;
@@ -518,8 +531,6 @@
#if !defined (_WIN64)
-#undef g_win32_get_package_installation_subdirectory
-
/* DLL ABI binary compatibility version that uses system codepage file names */
gchar *
Modified: trunk/glib/gwin32.h
==============================================================================
--- trunk/glib/gwin32.h (original)
+++ trunk/glib/gwin32.h Sat Sep 13 20:23:17 2008
@@ -83,6 +83,8 @@
*/
gchar* g_win32_error_message (gint error);
+#ifndef G_DISABLE_DEPRECATED
+
#define g_win32_get_package_installation_directory g_win32_get_package_installation_directory_utf8
#define g_win32_get_package_installation_subdirectory g_win32_get_package_installation_subdirectory_utf8
@@ -93,6 +95,8 @@
const gchar *dll_name,
const gchar *subdir);
+#endif
+
gchar* g_win32_get_package_installation_directory_of_module (gpointer hmodule);
guint g_win32_get_windows_version (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]