glib r7898 - in branches/glib-2-18: . glib
- From: tml svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r7898 - in branches/glib-2-18: . glib
- Date: Mon, 23 Feb 2009 09:43:45 +0000 (UTC)
Author: tml
Date: Mon Feb 23 09:43:45 2009
New Revision: 7898
URL: http://svn.gnome.org/viewvc/glib?rev=7898&view=rev
Log:
2009-02-23 Tor Lillqvist <tml novell com>
Bug 570501 - g_win32_get_system_data_dirs uses invalid conversion
of function pointer to object pointer
* glib/gutils.c (g_win32_get_system_data_dirs_for_module): Change
the type of the function's parameter to be explicitly a function
pointer.
* glib/gutils.h (_g_win32_get_system_data_dirs): Modify
declaration and the only caller, the inline
_g_win32_get_system_data_dirs(), accordingly. Add comments
pointing out these are internal GLib functions.
Modified:
branches/glib-2-18/ChangeLog
branches/glib-2-18/glib/gutils.c
branches/glib-2-18/glib/gutils.h
Modified: branches/glib-2-18/glib/gutils.c
==============================================================================
--- branches/glib-2-18/glib/gutils.c (original)
+++ branches/glib-2-18/glib/gutils.c Mon Feb 23 09:43:45 2009
@@ -2542,7 +2542,7 @@
}
G_CONST_RETURN gchar * G_CONST_RETURN *
-g_win32_get_system_data_dirs_for_module (gconstpointer address)
+g_win32_get_system_data_dirs_for_module (void (*address_of_function)())
{
GArray *data_dirs;
HMODULE hmodule;
@@ -2551,10 +2551,10 @@
gchar *p;
gchar *exe_root;
- if (address)
+ if (address_of_function)
{
G_LOCK (g_utils_global);
- hmodule = get_module_for_address (address);
+ hmodule = get_module_for_address (address_of_function);
if (hmodule != NULL)
{
if (per_module_data_dirs == NULL)
@@ -2592,9 +2592,9 @@
* subdirectory of the installation directory for the package
* our caller is a part of.
*
- * The address parameter, if non-NULL, points to a function in the
- * calling module. Use that to determine that module's installation
- * folder, and use its "share" subfolder.
+ * The address_of_function parameter, if non-NULL, points to a
+ * function in the calling module. Use that to determine that
+ * module's installation folder, and use its "share" subfolder.
*
* Additionally, also use the "share" subfolder of the installation
* locations of GLib and the .exe file being run.
@@ -2606,7 +2606,7 @@
* function.
*/
- p = get_module_share_dir (address);
+ p = get_module_share_dir (address_of_function);
if (p)
g_array_append_val (data_dirs, p);
@@ -2627,7 +2627,7 @@
retval = (gchar **) g_array_free (data_dirs, FALSE);
- if (address)
+ if (address_of_function)
{
if (hmodule != NULL)
g_hash_table_insert (per_module_data_dirs, hmodule, retval);
Modified: branches/glib-2-18/glib/gutils.h
==============================================================================
--- branches/glib-2-18/glib/gutils.h (original)
+++ branches/glib-2-18/glib/gutils.h Mon Feb 23 09:43:45 2009
@@ -133,16 +133,21 @@
G_CONST_RETURN gchar* G_CONST_RETURN * g_get_system_data_dirs (void);
#ifdef G_OS_WIN32
-G_CONST_RETURN gchar* G_CONST_RETURN * g_win32_get_system_data_dirs_for_module (gconstpointer address);
+/* This functions is not part of the public GLib API */
+G_CONST_RETURN gchar* G_CONST_RETURN * g_win32_get_system_data_dirs_for_module (void (*address_of_function)());
#endif
#if defined (G_OS_WIN32) && defined (G_CAN_INLINE) && !defined (__cplusplus)
+/* This function is not part of the public GLib API either. Just call
+ * g_get_system_data_dirs() in your code, never mind that that is
+ * actually a macro and you will in fact call this inline function.
+ */
static inline G_CONST_RETURN gchar * G_CONST_RETURN *
-g_win32_get_system_data_dirs (void)
+_g_win32_get_system_data_dirs (void)
{
- return g_win32_get_system_data_dirs_for_module ((gconstpointer) &g_win32_get_system_data_dirs);
+ return g_win32_get_system_data_dirs_for_module ((void (*)()) &_g_win32_get_system_data_dirs);
}
-#define g_get_system_data_dirs g_win32_get_system_data_dirs
+#define g_get_system_data_dirs _g_win32_get_system_data_dirs
#endif
G_CONST_RETURN gchar* G_CONST_RETURN * g_get_system_config_dirs (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]