glib/glib.symbols Implement Windows DLL ABI stability also for
authorTor Lillqvist <tml@iki.fi>
Sun, 12 Dec 2004 20:53:02 +0000 (20:53 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Sun, 12 Dec 2004 20:53:02 +0000 (20:53 +0000)
2004-12-12  Tor Lillqvist  <tml@iki.fi>

* glib/glib.symbols
* glib/gconvert.[ch]: Implement Windows DLL ABI stability also for
g_filename_{to,from}_uri().

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/gconvert.c
glib/gconvert.h
glib/glib.symbols

index f3f193e..adc8bd2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-12-12  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/glib.symbols
+       * glib/gconvert.[ch]: Implement Windows DLL ABI stability also for
+       g_filename_{to,from}_uri().
+
 2004-12-11  Tor Lillqvist  <tml@iki.fi>
 
        * glib/gstdio.c (g_rename, g_unlink, g_remove): Add doc comments
index f3f193e..adc8bd2 100644 (file)
@@ -1,3 +1,9 @@
+2004-12-12  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/glib.symbols
+       * glib/gconvert.[ch]: Implement Windows DLL ABI stability also for
+       g_filename_{to,from}_uri().
+
 2004-12-11  Tor Lillqvist  <tml@iki.fi>
 
        * glib/gstdio.c (g_rename, g_unlink, g_remove): Add doc comments
index f3f193e..adc8bd2 100644 (file)
@@ -1,3 +1,9 @@
+2004-12-12  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/glib.symbols
+       * glib/gconvert.[ch]: Implement Windows DLL ABI stability also for
+       g_filename_{to,from}_uri().
+
 2004-12-11  Tor Lillqvist  <tml@iki.fi>
 
        * glib/gstdio.c (g_rename, g_unlink, g_remove): Add doc comments
index f3f193e..adc8bd2 100644 (file)
@@ -1,3 +1,9 @@
+2004-12-12  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/glib.symbols
+       * glib/gconvert.[ch]: Implement Windows DLL ABI stability also for
+       g_filename_{to,from}_uri().
+
 2004-12-11  Tor Lillqvist  <tml@iki.fi>
 
        * glib/gstdio.c (g_rename, g_unlink, g_remove): Add doc comments
index f3f193e..adc8bd2 100644 (file)
@@ -1,3 +1,9 @@
+2004-12-12  Tor Lillqvist  <tml@iki.fi>
+
+       * glib/glib.symbols
+       * glib/gconvert.[ch]: Implement Windows DLL ABI stability also for
+       g_filename_{to,from}_uri().
+
 2004-12-11  Tor Lillqvist  <tml@iki.fi>
 
        * glib/gstdio.c (g_rename, g_unlink, g_remove): Add doc comments
index d22a1c1..5509bd6 100644 (file)
@@ -1019,8 +1019,11 @@ filename_charset_cache_free (gpointer data)
  * subsequent character sets are used when trying to generate a displayable
  * representation of a filename, see g_filename_display_name().
  *
- * The character sets are determined by consulting the environment variables 
- * <envar>G_FILENAME_ENCODING</envar> and <envar>G_BROKEN_FILENAMES</envar>.
+ * On Unix, the character sets are determined by consulting the
+ * environment variables <envar>G_FILENAME_ENCODING</envar> and
+ * <envar>G_BROKEN_FILENAMES</envar>. On Windows, the character set
+ * used in the GLib API is always UTF-8 and said environment variables
+ * have no effect.
  *
  * <envar>G_FILENAME_ENCODING</envar> may be set to a comma-separated list 
  * of character set names. The special token "@locale" is taken to mean the 
@@ -1176,7 +1179,7 @@ _g_convert_thread_init (void)
  * @error:         location to store the error occuring, or %NULL to ignore
  *                 errors. Any of the errors in #GConvertError may occur.
  * 
- * Converts a string which is in the encoding used for filenames
+ * Converts a string which is in the encoding used by GLib for filenames
  * into a UTF-8 string.
  * 
  * Return value: The converted string, or %NULL on an error.
@@ -1694,6 +1697,29 @@ g_filename_from_uri (const gchar *uri,
   return result;
 }
 
+#ifdef G_OS_WIN32
+
+#undef g_filename_from_uri
+
+gchar *
+g_filename_from_uri (const gchar *uri,
+                    gchar      **hostname,
+                    GError     **error)
+{
+  gchar *utf8_filename;
+  gchar *retval = NULL;
+
+  utf8_filename = g_filename_from_uri_utf8 (uri, hostname, error);
+  if (utf8_filename)
+    {
+      retval = g_locale_from_utf8 (utf8_filename, -1, NULL, NULL, error);
+      g_free (utf8_filename);
+    }
+  return retval;
+}
+
+#endif
+
 /**
  * g_filename_to_uri:
  * @filename: an absolute filename specified in the encoding
@@ -1744,6 +1770,31 @@ g_filename_to_uri (const gchar *filename,
   return escaped_uri;
 }
 
+#ifdef G_OS_WIN32
+
+#undef g_filename_to_uri
+
+gchar *
+g_filename_to_uri (const gchar *filename,
+                  const gchar *hostname,
+                  GError     **error)
+{
+  gchar *utf8_filename;
+  gchar *retval = NULL;
+
+  utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, error);
+
+  if (utf8_filename)
+    {
+      retval = g_filename_to_uri_utf8 (utf8_filename, hostname, error);
+      g_free (utf8_filename);
+    }
+
+  return retval;
+}
+
+#endif
+
 /**
  * g_uri_list_extract_uris:
  * @uri_list: an URI list 
index 7883879..4629a1b 100644 (file)
@@ -101,6 +101,8 @@ gchar* g_locale_from_utf8 (const gchar  *utf8string,
 #ifdef G_OS_WIN32
 #define g_filename_to_utf8 g_filename_to_utf8_utf8
 #define g_filename_from_utf8 g_filename_from_utf8_utf8
+#define g_filename_from_uri g_filename_from_uri_utf8
+#define g_filename_to_uri g_filename_to_uri_utf8 
 #endif
 
 gchar* g_filename_to_utf8   (const gchar  *opsysstring,
index 4631b77..cbb2af2 100644 (file)
@@ -169,12 +169,18 @@ g_file_get_contents PRIVATE
 g_file_get_contents_utf8
 #endif
 g_filename_display_name G_GNUC_MALLOC
-g_filename_from_uri G_GNUC_MALLOC
+g_filename_from_uri PRIVATE G_GNUC_MALLOC
+#ifdef G_OS_WIN32
+g_filename_from_uri_utf8 G_GNUC_MALLOC
+#endif
 g_filename_from_utf8 PRIVATE G_GNUC_MALLOC
 #ifdef G_OS_WIN32
 g_filename_from_utf8_utf8
 #endif
-g_filename_to_uri G_GNUC_MALLOC
+g_filename_to_uri PRIVATE G_GNUC_MALLOC
+#ifdef G_OS_WIN32
+g_filename_to_uri_utf8 G_GNUC_MALLOC
+#endif
 g_filename_to_utf8 PRIVATE G_GNUC_MALLOC 
 #ifdef G_OS_WIN32
 g_filename_to_utf8_utf8