diff options
author | Owen Taylor <otaylor@redhat.com> | 2002-03-08 15:50:54 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2002-03-08 15:50:54 +0000 |
commit | cef5d28c897af6b057d04420ebd040e70e5a693e (patch) | |
tree | 8f8cd049bb2b4923c82bb04941da7b832248e6d9 /glib/gstrfuncs.c | |
parent | dac25522cd299436ac1a7fe366e66d9a348e1715 (diff) | |
download | glib-cef5d28c897af6b057d04420ebd040e70e5a693e.tar.gz |
Final updates for 2.0.0
Fri Mar 8 10:20:46 2002 Owen Taylor <otaylor@redhat.com>
* NEWS: Final updates for 2.0.0
* glib/gstrfuncs.c: Convert the results of strerror()
and strsignal() to UTF-8.
* glib/gconvert.c glib/gdir.c glib/giochannel.c glib/giounix.c
glib/giowin32.c: Use g_strerror(), not strerror().
Diffstat (limited to 'glib/gstrfuncs.c')
-rw-r--r-- | glib/gstrfuncs.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c index 6469618aa..28ccc9e3b 100644 --- a/glib/gstrfuncs.c +++ b/glib/gstrfuncs.c @@ -586,7 +586,24 @@ g_strerror (gint errnum) char *msg; #ifdef HAVE_STRERROR - return strerror (errnum); + const char *msg_locale; + + msg_locale = strerror (errnum); + if (g_get_charset (NULL)) + return msg_locale; + else + { + gchar *msg_utf8 = g_locale_to_utf8 (msg_locale, -1, NULL, NULL, NULL); + if (msg_utf8) + { + /* Stick in the quark table so that we can return a static result + */ + GQuark msg_quark = g_quark_from_string (msg_utf8); + g_free (msg_utf8); + + return g_quark_to_string (msg_quark); + } + } #elif NO_SYS_ERRLIST switch (errnum) { @@ -1029,13 +1046,30 @@ g_strsignal (gint signum) char *msg; #ifdef HAVE_STRSIGNAL + const char *msg_locale; + #if defined(G_OS_BEOS) || defined(G_WITH_CYGWIN) extern const char *strsignal(int); #else /* this is declared differently (const) in string.h on BeOS */ extern char *strsignal (int sig); #endif /* !G_OS_BEOS && !G_WITH_CYGWIN */ - return strsignal (signum); + msg_locale = strsignal (signum); + if (g_get_charset (NULL)) + return msg_locale; + else + { + gchar *msg_utf8 = g_locale_to_utf8 (msg_locale, -1, NULL, NULL, NULL); + if (msg_utf8) + { + /* Stick in the quark table so that we can return a static result + */ + GQuark msg_quark = g_quark_from_string (msg_utf8); + g_free (msg_utf8); + + return g_quark_to_string (msg_quark); + } + } #elif NO_SYS_SIGLIST switch (signum) { |