Final updates for 2.0.0
authorOwen Taylor <otaylor@redhat.com>
Fri, 8 Mar 2002 15:50:54 +0000 (15:50 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Fri, 8 Mar 2002 15:50:54 +0000 (15:50 +0000)
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().

17 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
NEWS
README.in
glib/gconvert.c
glib/gdir.c
glib/gfileutils.c
glib/giochannel.c
glib/giounix.c
glib/giowin32.c
glib/gstrfuncs.c

index 109fb6313c67a9694abc550f1f6dfadc71dc0766..33fe570ad1799129a3bce43013a5dc9604e6b49d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * README.in: Updates.
index 109fb6313c67a9694abc550f1f6dfadc71dc0766..33fe570ad1799129a3bce43013a5dc9604e6b49d 100644 (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>
 
        * README.in: Updates.
index 109fb6313c67a9694abc550f1f6dfadc71dc0766..33fe570ad1799129a3bce43013a5dc9604e6b49d 100644 (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>
 
        * README.in: Updates.
index 109fb6313c67a9694abc550f1f6dfadc71dc0766..33fe570ad1799129a3bce43013a5dc9604e6b49d 100644 (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>
 
        * README.in: Updates.
index 109fb6313c67a9694abc550f1f6dfadc71dc0766..33fe570ad1799129a3bce43013a5dc9604e6b49d 100644 (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>
 
        * README.in: Updates.
index 109fb6313c67a9694abc550f1f6dfadc71dc0766..33fe570ad1799129a3bce43013a5dc9604e6b49d 100644 (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>
 
        * README.in: Updates.
index 109fb6313c67a9694abc550f1f6dfadc71dc0766..33fe570ad1799129a3bce43013a5dc9604e6b49d 100644 (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>
 
        * README.in: Updates.
index 109fb6313c67a9694abc550f1f6dfadc71dc0766..33fe570ad1799129a3bce43013a5dc9604e6b49d 100644 (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>
 
        * README.in: Updates.
diff --git a/NEWS b/NEWS
index b25ea88400aee30743e44de7b78828fa9fbb8eed..5f68bae76e3eeaa7aeb3d3a749aee7c49d2b206c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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:
 ===================================
 
index e530b0d98cdcb55be1ed8e81a5d9c533e05ac43a..fe5f9cea27365efed6ba6c2bbf0bef974833cc4c 100644 (file)
--- a/README.in
+++ b/README.in
@@ -34,10 +34,6 @@ Notes about GLib-2.0.0
   Application programmers should not call g_locale_to_utf8() on these
   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(),
   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
index 79cad6ba3d0391a7119a64ea5f3b6cc3002f3268..9ecb8bed0456abe7174470d706dd0bce90d0d3e2 100644 (file)
@@ -392,7 +392,7 @@ open_converter (const gchar *to_codeset,
   else
     g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
                 _("Could not open converter from '%s' to '%s': %s"),
-                from_codeset, to_codeset, strerror (errno));
+                from_codeset, to_codeset, g_strerror (errno));
   
   return cd;
 }
@@ -595,7 +595,7 @@ g_convert_with_iconv (const gchar *str,
        default:
          g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
                       _("Error during conversion: %s"),
-                      strerror (errno));
+                      g_strerror (errno));
          have_error = TRUE;
          break;
        }
@@ -811,7 +811,7 @@ g_convert_with_fallback (const gchar *str,
            default:
              g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
                           _("Error during conversion: %s"),
-                          strerror (errno));
+                          g_strerror (errno));
              have_error = TRUE;
              break;
            }
index aaf967add757992509714c826544cc66ec9ce55f..dafd34372b4fc1ed90615f46fa9a002fffd9fc3e 100644 (file)
@@ -24,7 +24,7 @@
 #include "config.h"
 
 #include <errno.h>
-#include <string.h> /* strerror, strcmp */
+#include <string.h> /* strcmp */
 
 #ifdef HAVE_DIRENT_H
 #include <dirent.h>
@@ -77,7 +77,7 @@ g_dir_open (const gchar  *path,
                G_FILE_ERROR,
                g_file_error_from_errno (errno),
                _("Error opening directory '%s': %s"),
-              path, strerror (errno));
+              path, g_strerror (errno));
 
   g_free (dir);
   return NULL;
index 37b06f5084957f08df74ca2950d34f07c208f170..fbe8bd7281857ee7fcfddf07b73ecf5c037077a6 100644 (file)
@@ -346,7 +346,7 @@ get_contents_stdio (const gchar *filename,
                        G_FILE_ERROR,
                        g_file_error_from_errno (errno),
                        _("Error reading file '%s': %s"),
-                       filename, strerror (errno));
+                       filename, g_strerror (errno));
 
           goto error;
         }
@@ -424,7 +424,7 @@ get_contents_regfile (const gchar *filename,
                            G_FILE_ERROR,
                            g_file_error_from_errno (errno),
                            _("Failed to read from file '%s': %s"),
-                           filename, strerror (errno));
+                           filename, g_strerror (errno));
 
               return FALSE;
             }
@@ -463,7 +463,7 @@ get_contents_posix (const gchar *filename,
                    G_FILE_ERROR,
                    g_file_error_from_errno (errno),
                    _("Failed to open file '%s': %s"),
-                   filename, strerror (errno));
+                   filename, g_strerror (errno));
 
       return FALSE;
     }
@@ -477,7 +477,7 @@ get_contents_posix (const gchar *filename,
                    G_FILE_ERROR,
                    g_file_error_from_errno (errno),
                    _("Failed to get attributes of file '%s': fstat() failed: %s"),
-                   filename, strerror (errno));
+                   filename, g_strerror (errno));
 
       return FALSE;
     }
@@ -503,7 +503,7 @@ get_contents_posix (const gchar *filename,
                        G_FILE_ERROR,
                        g_file_error_from_errno (errno),
                        _("Failed to open file '%s': fdopen() failed: %s"),
-                       filename, strerror (errno));
+                       filename, g_strerror (errno));
           
           return FALSE;
         }
@@ -531,7 +531,7 @@ get_contents_win32 (const gchar *filename,
                    G_FILE_ERROR,
                    g_file_error_from_errno (errno),
                    _("Failed to open file '%s': %s"),
-                   filename, strerror (errno));
+                   filename, g_strerror (errno));
       
       return FALSE;
     }
@@ -743,7 +743,7 @@ g_file_open_tmp (const char *tmpl,
                   G_FILE_ERROR,
                   g_file_error_from_errno (errno),
                   _("Failed to create file '%s': %s"),
-                  fulltemplate, strerror (errno));
+                  fulltemplate, g_strerror (errno));
       g_free (fulltemplate);
       return -1;
     }
index a82bf0e47d9029a8bbcb834c7527f00587121cb6..7a7e980a18c53f72c06fd141dd0bd7ee759181dc 100644 (file)
@@ -1112,7 +1112,7 @@ g_io_channel_set_encoding (GIOChannel     *channel,
           else
             g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
                          _("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)
             g_iconv_close (read_cd);
@@ -1286,7 +1286,7 @@ reencode:
               default:
                 g_assert (errval != EBADF); /* The converter should be open */
                 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;
             }
         }
@@ -2172,7 +2172,7 @@ reconvert:
                     return G_IO_STATUS_ERROR;
                   default:
                     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)
                       wrote_bytes += from_buf_len - left_len - from_buf_old_len;
                     if (bytes_written)
index 84b2623eb095d26aca27adf8bf17926d9ef384df..d347de5b21cb2a31e0b2faa4b049029ab765ce38 100644 (file)
@@ -201,7 +201,7 @@ g_io_unix_read (GIOChannel *channel,
           default:
             g_set_error (err, G_IO_CHANNEL_ERROR,
                          g_io_channel_error_from_errno (errno),
-                         strerror (errno));
+                         g_strerror (errno));
             return G_IO_STATUS_ERROR;
         }
     }
@@ -241,7 +241,7 @@ g_io_unix_write (GIOChannel  *channel,
           default:
             g_set_error (err, G_IO_CHANNEL_ERROR,
                          g_io_channel_error_from_errno (errno),
-                         strerror (errno));
+                         g_strerror (errno));
             return G_IO_STATUS_ERROR;
         }
     }
@@ -283,7 +283,7 @@ g_io_unix_seek (GIOChannel *channel,
     {
       g_set_error (err, G_IO_CHANNEL_ERROR,
                   g_io_channel_error_from_errno (EINVAL),
-                  strerror (EINVAL));
+                  g_strerror (EINVAL));
       return G_IO_STATUS_ERROR;
     }
   
@@ -293,7 +293,7 @@ g_io_unix_seek (GIOChannel *channel,
     {
       g_set_error (err, G_IO_CHANNEL_ERROR,
                   g_io_channel_error_from_errno (errno),
-                  strerror (errno));
+                  g_strerror (errno));
       return G_IO_STATUS_ERROR;
     }
 
@@ -311,7 +311,7 @@ g_io_unix_close (GIOChannel *channel,
     {
       g_set_error (err, G_IO_CHANNEL_ERROR,
                   g_io_channel_error_from_errno (errno),
-                  strerror (errno));
+                  g_strerror (errno));
       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_file_error_from_errno (errno),
-                   strerror (errno));
+                   g_strerror (errno));
       return (GIOChannel *)NULL;
     }
 
@@ -519,7 +519,7 @@ g_io_channel_new_file (const gchar *filename,
       close (fid);
       g_set_error (error, G_FILE_ERROR,
                    g_file_error_from_errno (errno),
-                   strerror (errno));
+                   g_strerror (errno));
       return (GIOChannel *)NULL;
     }
 
index fae780c99f1d9985fa56606961669437813ca42f..9f20a08cfcee190147e1ad077a726a21fee966f3 100644 (file)
@@ -334,7 +334,7 @@ create_thread (GIOWin32Channel     *channel,
                             &channel->thread_id);
   if (channel->thread_handle == 0)
     g_warning (G_STRLOC ": Error creating reader thread: %s",
-              strerror (errno));
+              g_strerror (errno));
   WaitForSingleObject (channel->space_avail_event, INFINITE);
 }
 
@@ -852,7 +852,7 @@ g_io_win32_fd_read (GIOChannel *channel,
           default:
             g_set_error (err, G_IO_CHANNEL_ERROR,
                          g_io_channel_error_from_errno (errno),
-                         strerror (errno));
+                         g_strerror (errno));
             return G_IO_STATUS_ERROR;
         }
     }
@@ -890,7 +890,7 @@ g_io_win32_fd_write (GIOChannel  *channel,
           default:
             g_set_error (err, G_IO_CHANNEL_ERROR,
                          g_io_channel_error_from_errno (errno),
-                         strerror (errno));
+                         g_strerror (errno));
             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_io_channel_error_from_errno (EINVAL),
-                  strerror (EINVAL));
+                  g_strerror (EINVAL));
       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_io_channel_error_from_errno (errno),
-                  strerror (errno));
+                  g_strerror (errno));
       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_file_error_from_errno (errno),
-                   strerror (errno));
+                   g_strerror (errno));
       return (GIOChannel *)NULL;
     }
 
index 6469618aa689dbd76792cf71ea8f6727d5daf103..28ccc9e3ba4bda55d00bb655741686fd23e5ea96 100644 (file)
@@ -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)
     {