glib r7543 - trunk/gmodule
- From: tml svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r7543 - trunk/gmodule
- Date: Fri, 26 Sep 2008 09:16:25 +0000 (UTC)
Author: tml
Date: Fri Sep 26 09:16:25 2008
New Revision: 7543
URL: http://svn.gnome.org/viewvc/glib?rev=7543&view=rev
Log:
2008-09-26 Tor Lillqvist <tml novell com>
* gmodule-win32.c: Improve error reporting: When g_module_open()
fails, include the name of the module passed to LoadLibrary() in
what g_module_error() returns.
Modified:
trunk/gmodule/ChangeLog
trunk/gmodule/gmodule-win32.c
Modified: trunk/gmodule/gmodule-win32.c
==============================================================================
--- trunk/gmodule/gmodule-win32.c (original)
+++ trunk/gmodule/gmodule-win32.c Fri Sep 26 09:16:25 2008
@@ -42,11 +42,25 @@
#endif
static void
-set_error (void)
+set_error (const gchar *format,
+ ...)
{
- gchar *error = g_win32_error_message (GetLastError ());
+ gchar *error;
+ gchar *detail;
+ gchar *message;
+ va_list args;
- g_module_set_error (error);
+ error = g_win32_error_message (GetLastError ());
+
+ va_start (args, format);
+ detail = g_strdup_vprintf (format, args);
+ va_end (args);
+
+ message = g_strconcat (detail, error, NULL);
+
+ g_module_set_error (message);
+ g_free (message);
+ g_free (detail);
g_free (error);
}
@@ -70,7 +84,7 @@
g_free (wfilename);
if (!handle)
- set_error ();
+ set_error ("`%s': ", file_name);
return handle;
}
@@ -90,7 +104,7 @@
{
if (handle != null_module_handle)
if (!FreeLibrary (handle))
- set_error ();
+ set_error ("");
}
static gpointer
@@ -219,7 +233,7 @@
p = GetProcAddress (handle, symbol_name);
if (!p)
- set_error ();
+ set_error ("");
return p;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]