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().
This commit is contained in:
Owen Taylor 2002-03-08 15:50:54 +00:00 committed by Owen Taylor
parent dac25522cd
commit cef5d28c89
17 changed files with 164 additions and 34 deletions

View File

@ -1,3 +1,13 @@
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().
Fri Mar 8 00:15:29 2002 Owen Taylor <otaylor@redhat.com> Fri Mar 8 00:15:29 2002 Owen Taylor <otaylor@redhat.com>
* README.in: Updates. * README.in: Updates.

View File

@ -1,3 +1,13 @@
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().
Fri Mar 8 00:15:29 2002 Owen Taylor <otaylor@redhat.com> Fri Mar 8 00:15:29 2002 Owen Taylor <otaylor@redhat.com>
* README.in: Updates. * README.in: Updates.

View File

@ -1,3 +1,13 @@
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().
Fri Mar 8 00:15:29 2002 Owen Taylor <otaylor@redhat.com> Fri Mar 8 00:15:29 2002 Owen Taylor <otaylor@redhat.com>
* README.in: Updates. * README.in: Updates.

View File

@ -1,3 +1,13 @@
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().
Fri Mar 8 00:15:29 2002 Owen Taylor <otaylor@redhat.com> Fri Mar 8 00:15:29 2002 Owen Taylor <otaylor@redhat.com>
* README.in: Updates. * README.in: Updates.

View File

@ -1,3 +1,13 @@
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().
Fri Mar 8 00:15:29 2002 Owen Taylor <otaylor@redhat.com> Fri Mar 8 00:15:29 2002 Owen Taylor <otaylor@redhat.com>
* README.in: Updates. * README.in: Updates.

View File

@ -1,3 +1,13 @@
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().
Fri Mar 8 00:15:29 2002 Owen Taylor <otaylor@redhat.com> Fri Mar 8 00:15:29 2002 Owen Taylor <otaylor@redhat.com>
* README.in: Updates. * README.in: Updates.

View File

@ -1,3 +1,13 @@
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().
Fri Mar 8 00:15:29 2002 Owen Taylor <otaylor@redhat.com> Fri Mar 8 00:15:29 2002 Owen Taylor <otaylor@redhat.com>
* README.in: Updates. * README.in: Updates.

View File

@ -1,3 +1,13 @@
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().
Fri Mar 8 00:15:29 2002 Owen Taylor <otaylor@redhat.com> Fri Mar 8 00:15:29 2002 Owen Taylor <otaylor@redhat.com>
* README.in: Updates. * README.in: Updates.

20
NEWS
View File

@ -1,3 +1,23 @@
Overview of Changes in GLib 2.0.0
=================================
* Thread portability fixes [Sebastian Wilhelmi]
* Documentation updates [Owen Taylor]
* Make g_strerror(), g_strsignal() properly return UTF-8,
call bind_text_domain_codeset() so that error strings
are in UTF-8 as well. [Owen, Tor Lillqvist]
Overview of Changes in GLib 2.0.0 rc1:
======================================
* Win32 fixes [Tor Lillqvist]
* Portability fixes [Finlay Dobbie, Miroslaw Dobrzanski-Neumann]
* Fix up g_date_strftime [Daniel Elstner]
* Add some structure padding [Tim Janik]
* Make g_get_homedir() prefer the users home directory to $HOME
Other contributors: Matthias Clasen, Paolo Maggi, Christian Rose
Overview of Changes in GLib 1.3.15: Overview of Changes in GLib 1.3.15:
=================================== ===================================

View File

@ -34,10 +34,6 @@ Notes about GLib-2.0.0
Application programmers should not call g_locale_to_utf8() on these Application programmers should not call g_locale_to_utf8() on these
strings. strings.
* The results of g_strerror() are currently in the encoding of the locale
rather than in UTF-8. Again, this is a bug, and not behavior that
should be relied upon.
* Similarly, the GLib error logging functions such as g_print(), g_warning(), * Similarly, the GLib error logging functions such as g_print(), g_warning(),
g_error(), currently do not convert the strings they are passed from g_error(), currently do not convert the strings they are passed from
UTF-8 to the encoding of the locale, or check that the strings they UTF-8 to the encoding of the locale, or check that the strings they

View File

@ -392,7 +392,7 @@ open_converter (const gchar *to_codeset,
else else
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED, g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
_("Could not open converter from '%s' to '%s': %s"), _("Could not open converter from '%s' to '%s': %s"),
from_codeset, to_codeset, strerror (errno)); from_codeset, to_codeset, g_strerror (errno));
return cd; return cd;
} }
@ -595,7 +595,7 @@ g_convert_with_iconv (const gchar *str,
default: default:
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED, g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
_("Error during conversion: %s"), _("Error during conversion: %s"),
strerror (errno)); g_strerror (errno));
have_error = TRUE; have_error = TRUE;
break; break;
} }
@ -811,7 +811,7 @@ g_convert_with_fallback (const gchar *str,
default: default:
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED, g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
_("Error during conversion: %s"), _("Error during conversion: %s"),
strerror (errno)); g_strerror (errno));
have_error = TRUE; have_error = TRUE;
break; break;
} }

View File

@ -24,7 +24,7 @@
#include "config.h" #include "config.h"
#include <errno.h> #include <errno.h>
#include <string.h> /* strerror, strcmp */ #include <string.h> /* strcmp */
#ifdef HAVE_DIRENT_H #ifdef HAVE_DIRENT_H
#include <dirent.h> #include <dirent.h>
@ -77,7 +77,7 @@ g_dir_open (const gchar *path,
G_FILE_ERROR, G_FILE_ERROR,
g_file_error_from_errno (errno), g_file_error_from_errno (errno),
_("Error opening directory '%s': %s"), _("Error opening directory '%s': %s"),
path, strerror (errno)); path, g_strerror (errno));
g_free (dir); g_free (dir);
return NULL; return NULL;

View File

@ -346,7 +346,7 @@ get_contents_stdio (const gchar *filename,
G_FILE_ERROR, G_FILE_ERROR,
g_file_error_from_errno (errno), g_file_error_from_errno (errno),
_("Error reading file '%s': %s"), _("Error reading file '%s': %s"),
filename, strerror (errno)); filename, g_strerror (errno));
goto error; goto error;
} }
@ -424,7 +424,7 @@ get_contents_regfile (const gchar *filename,
G_FILE_ERROR, G_FILE_ERROR,
g_file_error_from_errno (errno), g_file_error_from_errno (errno),
_("Failed to read from file '%s': %s"), _("Failed to read from file '%s': %s"),
filename, strerror (errno)); filename, g_strerror (errno));
return FALSE; return FALSE;
} }
@ -463,7 +463,7 @@ get_contents_posix (const gchar *filename,
G_FILE_ERROR, G_FILE_ERROR,
g_file_error_from_errno (errno), g_file_error_from_errno (errno),
_("Failed to open file '%s': %s"), _("Failed to open file '%s': %s"),
filename, strerror (errno)); filename, g_strerror (errno));
return FALSE; return FALSE;
} }
@ -477,7 +477,7 @@ get_contents_posix (const gchar *filename,
G_FILE_ERROR, G_FILE_ERROR,
g_file_error_from_errno (errno), g_file_error_from_errno (errno),
_("Failed to get attributes of file '%s': fstat() failed: %s"), _("Failed to get attributes of file '%s': fstat() failed: %s"),
filename, strerror (errno)); filename, g_strerror (errno));
return FALSE; return FALSE;
} }
@ -503,7 +503,7 @@ get_contents_posix (const gchar *filename,
G_FILE_ERROR, G_FILE_ERROR,
g_file_error_from_errno (errno), g_file_error_from_errno (errno),
_("Failed to open file '%s': fdopen() failed: %s"), _("Failed to open file '%s': fdopen() failed: %s"),
filename, strerror (errno)); filename, g_strerror (errno));
return FALSE; return FALSE;
} }
@ -531,7 +531,7 @@ get_contents_win32 (const gchar *filename,
G_FILE_ERROR, G_FILE_ERROR,
g_file_error_from_errno (errno), g_file_error_from_errno (errno),
_("Failed to open file '%s': %s"), _("Failed to open file '%s': %s"),
filename, strerror (errno)); filename, g_strerror (errno));
return FALSE; return FALSE;
} }
@ -743,7 +743,7 @@ g_file_open_tmp (const char *tmpl,
G_FILE_ERROR, G_FILE_ERROR,
g_file_error_from_errno (errno), g_file_error_from_errno (errno),
_("Failed to create file '%s': %s"), _("Failed to create file '%s': %s"),
fulltemplate, strerror (errno)); fulltemplate, g_strerror (errno));
g_free (fulltemplate); g_free (fulltemplate);
return -1; return -1;
} }

View File

@ -1112,7 +1112,7 @@ g_io_channel_set_encoding (GIOChannel *channel,
else else
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED, g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
_("Could not open converter from `%s' to `%s': %s"), _("Could not open converter from `%s' to `%s': %s"),
from_enc, to_enc, strerror (err)); from_enc, to_enc, g_strerror (err));
if (read_cd != (GIConv) -1) if (read_cd != (GIConv) -1)
g_iconv_close (read_cd); g_iconv_close (read_cd);
@ -1286,7 +1286,7 @@ reencode:
default: default:
g_assert (errval != EBADF); /* The converter should be open */ g_assert (errval != EBADF); /* The converter should be open */
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED, g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
_("Error during conversion: %s"), strerror (errval)); _("Error during conversion: %s"), g_strerror (errval));
return G_IO_STATUS_ERROR; return G_IO_STATUS_ERROR;
} }
} }
@ -2172,7 +2172,7 @@ reconvert:
return G_IO_STATUS_ERROR; return G_IO_STATUS_ERROR;
default: default:
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED, g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
_("Error during conversion: %s"), strerror (errnum)); _("Error during conversion: %s"), g_strerror (errnum));
if (from_buf_len >= left_len + from_buf_old_len) if (from_buf_len >= left_len + from_buf_old_len)
wrote_bytes += from_buf_len - left_len - from_buf_old_len; wrote_bytes += from_buf_len - left_len - from_buf_old_len;
if (bytes_written) if (bytes_written)

View File

@ -201,7 +201,7 @@ g_io_unix_read (GIOChannel *channel,
default: default:
g_set_error (err, G_IO_CHANNEL_ERROR, g_set_error (err, G_IO_CHANNEL_ERROR,
g_io_channel_error_from_errno (errno), g_io_channel_error_from_errno (errno),
strerror (errno)); g_strerror (errno));
return G_IO_STATUS_ERROR; return G_IO_STATUS_ERROR;
} }
} }
@ -241,7 +241,7 @@ g_io_unix_write (GIOChannel *channel,
default: default:
g_set_error (err, G_IO_CHANNEL_ERROR, g_set_error (err, G_IO_CHANNEL_ERROR,
g_io_channel_error_from_errno (errno), g_io_channel_error_from_errno (errno),
strerror (errno)); g_strerror (errno));
return G_IO_STATUS_ERROR; return G_IO_STATUS_ERROR;
} }
} }
@ -283,7 +283,7 @@ g_io_unix_seek (GIOChannel *channel,
{ {
g_set_error (err, G_IO_CHANNEL_ERROR, g_set_error (err, G_IO_CHANNEL_ERROR,
g_io_channel_error_from_errno (EINVAL), g_io_channel_error_from_errno (EINVAL),
strerror (EINVAL)); g_strerror (EINVAL));
return G_IO_STATUS_ERROR; return G_IO_STATUS_ERROR;
} }
@ -293,7 +293,7 @@ g_io_unix_seek (GIOChannel *channel,
{ {
g_set_error (err, G_IO_CHANNEL_ERROR, g_set_error (err, G_IO_CHANNEL_ERROR,
g_io_channel_error_from_errno (errno), g_io_channel_error_from_errno (errno),
strerror (errno)); g_strerror (errno));
return G_IO_STATUS_ERROR; return G_IO_STATUS_ERROR;
} }
@ -311,7 +311,7 @@ g_io_unix_close (GIOChannel *channel,
{ {
g_set_error (err, G_IO_CHANNEL_ERROR, g_set_error (err, G_IO_CHANNEL_ERROR,
g_io_channel_error_from_errno (errno), g_io_channel_error_from_errno (errno),
strerror (errno)); g_strerror (errno));
return G_IO_STATUS_ERROR; return G_IO_STATUS_ERROR;
} }
@ -510,7 +510,7 @@ g_io_channel_new_file (const gchar *filename,
{ {
g_set_error (error, G_FILE_ERROR, g_set_error (error, G_FILE_ERROR,
g_file_error_from_errno (errno), g_file_error_from_errno (errno),
strerror (errno)); g_strerror (errno));
return (GIOChannel *)NULL; return (GIOChannel *)NULL;
} }
@ -519,7 +519,7 @@ g_io_channel_new_file (const gchar *filename,
close (fid); close (fid);
g_set_error (error, G_FILE_ERROR, g_set_error (error, G_FILE_ERROR,
g_file_error_from_errno (errno), g_file_error_from_errno (errno),
strerror (errno)); g_strerror (errno));
return (GIOChannel *)NULL; return (GIOChannel *)NULL;
} }

View File

@ -334,7 +334,7 @@ create_thread (GIOWin32Channel *channel,
&channel->thread_id); &channel->thread_id);
if (channel->thread_handle == 0) if (channel->thread_handle == 0)
g_warning (G_STRLOC ": Error creating reader thread: %s", g_warning (G_STRLOC ": Error creating reader thread: %s",
strerror (errno)); g_strerror (errno));
WaitForSingleObject (channel->space_avail_event, INFINITE); WaitForSingleObject (channel->space_avail_event, INFINITE);
} }
@ -852,7 +852,7 @@ g_io_win32_fd_read (GIOChannel *channel,
default: default:
g_set_error (err, G_IO_CHANNEL_ERROR, g_set_error (err, G_IO_CHANNEL_ERROR,
g_io_channel_error_from_errno (errno), g_io_channel_error_from_errno (errno),
strerror (errno)); g_strerror (errno));
return G_IO_STATUS_ERROR; return G_IO_STATUS_ERROR;
} }
} }
@ -890,7 +890,7 @@ g_io_win32_fd_write (GIOChannel *channel,
default: default:
g_set_error (err, G_IO_CHANNEL_ERROR, g_set_error (err, G_IO_CHANNEL_ERROR,
g_io_channel_error_from_errno (errno), g_io_channel_error_from_errno (errno),
strerror (errno)); g_strerror (errno));
return G_IO_STATUS_ERROR; return G_IO_STATUS_ERROR;
} }
} }
@ -932,7 +932,7 @@ g_io_win32_fd_seek (GIOChannel *channel,
{ {
g_set_error (err, G_IO_CHANNEL_ERROR, g_set_error (err, G_IO_CHANNEL_ERROR,
g_io_channel_error_from_errno (EINVAL), g_io_channel_error_from_errno (EINVAL),
strerror (EINVAL)); g_strerror (EINVAL));
return G_IO_STATUS_ERROR; return G_IO_STATUS_ERROR;
} }
@ -942,7 +942,7 @@ g_io_win32_fd_seek (GIOChannel *channel,
{ {
g_set_error (err, G_IO_CHANNEL_ERROR, g_set_error (err, G_IO_CHANNEL_ERROR,
g_io_channel_error_from_errno (errno), g_io_channel_error_from_errno (errno),
strerror (errno)); g_strerror (errno));
return G_IO_STATUS_ERROR; return G_IO_STATUS_ERROR;
} }
@ -1236,7 +1236,7 @@ g_io_channel_new_file (const gchar *filename,
{ {
g_set_error (error, G_FILE_ERROR, g_set_error (error, G_FILE_ERROR,
g_file_error_from_errno (errno), g_file_error_from_errno (errno),
strerror (errno)); g_strerror (errno));
return (GIOChannel *)NULL; return (GIOChannel *)NULL;
} }

View File

@ -586,7 +586,24 @@ g_strerror (gint errnum)
char *msg; char *msg;
#ifdef HAVE_STRERROR #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 #elif NO_SYS_ERRLIST
switch (errnum) switch (errnum)
{ {
@ -1029,13 +1046,30 @@ g_strsignal (gint signum)
char *msg; char *msg;
#ifdef HAVE_STRSIGNAL #ifdef HAVE_STRSIGNAL
const char *msg_locale;
#if defined(G_OS_BEOS) || defined(G_WITH_CYGWIN) #if defined(G_OS_BEOS) || defined(G_WITH_CYGWIN)
extern const char *strsignal(int); extern const char *strsignal(int);
#else #else
/* this is declared differently (const) in string.h on BeOS */ /* this is declared differently (const) in string.h on BeOS */
extern char *strsignal (int sig); extern char *strsignal (int sig);
#endif /* !G_OS_BEOS && !G_WITH_CYGWIN */ #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 #elif NO_SYS_SIGLIST
switch (signum) switch (signum)
{ {