diff options
author | Tor Lillqvist <tml@iki.fi> | 2004-11-04 00:20:27 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2004-11-04 00:20:27 +0000 |
commit | f5de06030414fcd3c416833b22fab0be1ed21967 (patch) | |
tree | b6bf9658890863bedb07855044b85d32dcda9a58 /gmodule | |
parent | 80546e4e2980e8c6307ed196f953ef3b19fc7c89 (diff) | |
download | glib-f5de06030414fcd3c416833b22fab0be1ed21967.tar.gz |
Argument is in UTF-8. Use wide character Win32 API if present.
2004-11-04 Tor Lillqvist <tml@iki.fi>
* gmodule-win32.c (_g_module_open): Argument is in UTF-8. Use wide
character Win32 API if present.
* gmodule.c (parse_libtool_archive, g_module_open): Convert file
name to UTF-8 before storing in the error message string.
* gmodule.c (parse_libtool_archive): Use g_open().
Diffstat (limited to 'gmodule')
-rw-r--r-- | gmodule/ChangeLog | 10 | ||||
-rw-r--r-- | gmodule/gmodule-win32.c | 15 | ||||
-rw-r--r-- | gmodule/gmodule.c | 17 |
3 files changed, 37 insertions, 5 deletions
diff --git a/gmodule/ChangeLog b/gmodule/ChangeLog index 97caa0f00..8c98209bf 100644 --- a/gmodule/ChangeLog +++ b/gmodule/ChangeLog @@ -1,3 +1,13 @@ +2004-11-04 Tor Lillqvist <tml@iki.fi> + + * gmodule-win32.c (_g_module_open): Argument is in UTF-8. Use wide + character Win32 API if present. + + * gmodule.c (parse_libtool_archive, g_module_open): Convert file + name to UTF-8 before storing in the error message string. + + * gmodule.c (parse_libtool_archive): Use g_open(). + 2004-11-02 Matthias Clasen <mclasen@redhat.com> * === Released 2.5.5 === diff --git a/gmodule/gmodule-win32.c b/gmodule/gmodule-win32.c index 97b33638d..bf6309138 100644 --- a/gmodule/gmodule-win32.c +++ b/gmodule/gmodule-win32.c @@ -62,8 +62,21 @@ _g_module_open (const gchar *file_name, cygwin_conv_to_win32_path(file_name, tmp); file_name = tmp; #endif + if (G_WIN32_HAVE_WIDECHAR_API ()) + { + wchar_t *wfilename = g_utf8_to_utf16 (file_name, -1, NULL, NULL, NULL); - handle = LoadLibrary (file_name); + handle = LoadLibraryW (wfilename); + g_free (wfilename); + } + else + { + gchar *cp_filename = g_locale_from_utf8 (file_name, -1, NULL, NULL, NULL); + + handle = LoadLibraryA (cp_filename); + g_free (cp_filename); + } + if (!handle) set_error (); diff --git a/gmodule/gmodule.c b/gmodule/gmodule.c index 507f527b0..1673b2e6e 100644 --- a/gmodule/gmodule.c +++ b/gmodule/gmodule.c @@ -31,6 +31,7 @@ #ifdef HAVE_CONFIG_H # include <config.h> #endif +#include "gstdio.h" #include "gmodule.h" #include "gmoduleconf.h" #include <errno.h> @@ -207,10 +208,12 @@ parse_libtool_archive (const gchar* libtool_name) GTokenType token; GScanner *scanner; - int fd = open (libtool_name, O_RDONLY, 0); + int fd = g_open (libtool_name, O_RDONLY, 0); if (fd < 0) { - g_module_set_error_unduped (g_strdup_printf ("failed to open libtool archive \"%s\"", libtool_name)); + gchar *display_libtool_name = g_filename_display_name (libtool_name); + g_module_set_error_unduped (g_strdup_printf ("failed to open libtool archive \"%s\"", display_libtool_name)); + g_free (display_libtool_name); return NULL; } /* search libtool's dlname specification */ @@ -234,7 +237,9 @@ parse_libtool_archive (const gchar* libtool_name) (token == TOKEN_INSTALLED ? G_TOKEN_IDENTIFIER : G_TOKEN_STRING)) { - g_module_set_error_unduped (g_strdup_printf ("unable to parse libtool archive \"%s\"", libtool_name)); + gchar *display_libtool_name = g_filename_display_name (libtool_name); + g_module_set_error_unduped (g_strdup_printf ("unable to parse libtool archive \"%s\"", display_libtool_name)); + g_free (display_libtool_name); g_free (lt_dlname); g_free (lt_libdir); @@ -392,7 +397,11 @@ g_module_open (const gchar *file_name, (flags & G_MODULE_BIND_LOCAL) != 0); } else - g_module_set_error_unduped (g_strdup_printf ("unable to access file \"%s\"", file_name)); + { + gchar *display_file_name = g_filename_display_name (file_name); + g_module_set_error_unduped (g_strdup_printf ("unable to access file \"%s\"", display_file_name)); + g_free (display_file_name); + } g_free (name); if (handle) |