+2002-01-23 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gconvert.c: (strdup_len): Not used on Windows, don't even
+ compile it then.
+
+ (acceptable): Improve comments for the _acceptable_ table: put
+ each ASCII char above the hex number for it.
+
+ (g_escape_file_uri): On Windows, turn backslashes in the file name
+ into plain ("forward") slashes.
+
+ (g_filename_from_uri): On Windows, don't return the hostname
+ "localhost", because we can not be 100% sure it will be recognized
+ in all cases anyway, so simpler to turn it into a null
+ hostname.
+
+ Change slashes in the filename into backslashes, as that is the
+ more canonical separator.
+
+ Recognize drive letters (either followed by a colon or a vertical
+ bar, as used by some browsers), and if the filename part starts
+ with a such, don't include any (back)slash.
+
+ Don't drop any extra leading slash in the filename on Unix.
+
+ (g_filename_to_uri): On Windows, if the hostname is "localhost",
+ don't use it, for consistency with g_filename_from_uri().
+
+ tests/uri-test.c: Change accordingly, so that all tests pass on
+ Windows. Unix, too, I hope, though I couldn't check that now.
+
+ (main): Unset the G_BROKEN_FILENAMES environment variable on Unix,
+ as some tests require that filenames are in UTF-8. Is unsetenv()
+ portable?
+
+ These changes should fix bugs #59387, #59652, #59657 and #59658.
+
2002-01-22 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Get the right multithread option for GCC 3.0 and
+2002-01-23 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gconvert.c: (strdup_len): Not used on Windows, don't even
+ compile it then.
+
+ (acceptable): Improve comments for the _acceptable_ table: put
+ each ASCII char above the hex number for it.
+
+ (g_escape_file_uri): On Windows, turn backslashes in the file name
+ into plain ("forward") slashes.
+
+ (g_filename_from_uri): On Windows, don't return the hostname
+ "localhost", because we can not be 100% sure it will be recognized
+ in all cases anyway, so simpler to turn it into a null
+ hostname.
+
+ Change slashes in the filename into backslashes, as that is the
+ more canonical separator.
+
+ Recognize drive letters (either followed by a colon or a vertical
+ bar, as used by some browsers), and if the filename part starts
+ with a such, don't include any (back)slash.
+
+ Don't drop any extra leading slash in the filename on Unix.
+
+ (g_filename_to_uri): On Windows, if the hostname is "localhost",
+ don't use it, for consistency with g_filename_from_uri().
+
+ tests/uri-test.c: Change accordingly, so that all tests pass on
+ Windows. Unix, too, I hope, though I couldn't check that now.
+
+ (main): Unset the G_BROKEN_FILENAMES environment variable on Unix,
+ as some tests require that filenames are in UTF-8. Is unsetenv()
+ portable?
+
+ These changes should fix bugs #59387, #59652, #59657 and #59658.
+
2002-01-22 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Get the right multithread option for GCC 3.0 and
+2002-01-23 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gconvert.c: (strdup_len): Not used on Windows, don't even
+ compile it then.
+
+ (acceptable): Improve comments for the _acceptable_ table: put
+ each ASCII char above the hex number for it.
+
+ (g_escape_file_uri): On Windows, turn backslashes in the file name
+ into plain ("forward") slashes.
+
+ (g_filename_from_uri): On Windows, don't return the hostname
+ "localhost", because we can not be 100% sure it will be recognized
+ in all cases anyway, so simpler to turn it into a null
+ hostname.
+
+ Change slashes in the filename into backslashes, as that is the
+ more canonical separator.
+
+ Recognize drive letters (either followed by a colon or a vertical
+ bar, as used by some browsers), and if the filename part starts
+ with a such, don't include any (back)slash.
+
+ Don't drop any extra leading slash in the filename on Unix.
+
+ (g_filename_to_uri): On Windows, if the hostname is "localhost",
+ don't use it, for consistency with g_filename_from_uri().
+
+ tests/uri-test.c: Change accordingly, so that all tests pass on
+ Windows. Unix, too, I hope, though I couldn't check that now.
+
+ (main): Unset the G_BROKEN_FILENAMES environment variable on Unix,
+ as some tests require that filenames are in UTF-8. Is unsetenv()
+ portable?
+
+ These changes should fix bugs #59387, #59652, #59657 and #59658.
+
2002-01-22 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Get the right multithread option for GCC 3.0 and
+2002-01-23 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gconvert.c: (strdup_len): Not used on Windows, don't even
+ compile it then.
+
+ (acceptable): Improve comments for the _acceptable_ table: put
+ each ASCII char above the hex number for it.
+
+ (g_escape_file_uri): On Windows, turn backslashes in the file name
+ into plain ("forward") slashes.
+
+ (g_filename_from_uri): On Windows, don't return the hostname
+ "localhost", because we can not be 100% sure it will be recognized
+ in all cases anyway, so simpler to turn it into a null
+ hostname.
+
+ Change slashes in the filename into backslashes, as that is the
+ more canonical separator.
+
+ Recognize drive letters (either followed by a colon or a vertical
+ bar, as used by some browsers), and if the filename part starts
+ with a such, don't include any (back)slash.
+
+ Don't drop any extra leading slash in the filename on Unix.
+
+ (g_filename_to_uri): On Windows, if the hostname is "localhost",
+ don't use it, for consistency with g_filename_from_uri().
+
+ tests/uri-test.c: Change accordingly, so that all tests pass on
+ Windows. Unix, too, I hope, though I couldn't check that now.
+
+ (main): Unset the G_BROKEN_FILENAMES environment variable on Unix,
+ as some tests require that filenames are in UTF-8. Is unsetenv()
+ portable?
+
+ These changes should fix bugs #59387, #59652, #59657 and #59658.
+
2002-01-22 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Get the right multithread option for GCC 3.0 and
+2002-01-23 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gconvert.c: (strdup_len): Not used on Windows, don't even
+ compile it then.
+
+ (acceptable): Improve comments for the _acceptable_ table: put
+ each ASCII char above the hex number for it.
+
+ (g_escape_file_uri): On Windows, turn backslashes in the file name
+ into plain ("forward") slashes.
+
+ (g_filename_from_uri): On Windows, don't return the hostname
+ "localhost", because we can not be 100% sure it will be recognized
+ in all cases anyway, so simpler to turn it into a null
+ hostname.
+
+ Change slashes in the filename into backslashes, as that is the
+ more canonical separator.
+
+ Recognize drive letters (either followed by a colon or a vertical
+ bar, as used by some browsers), and if the filename part starts
+ with a such, don't include any (back)slash.
+
+ Don't drop any extra leading slash in the filename on Unix.
+
+ (g_filename_to_uri): On Windows, if the hostname is "localhost",
+ don't use it, for consistency with g_filename_from_uri().
+
+ tests/uri-test.c: Change accordingly, so that all tests pass on
+ Windows. Unix, too, I hope, though I couldn't check that now.
+
+ (main): Unset the G_BROKEN_FILENAMES environment variable on Unix,
+ as some tests require that filenames are in UTF-8. Is unsetenv()
+ portable?
+
+ These changes should fix bugs #59387, #59652, #59657 and #59658.
+
2002-01-22 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Get the right multithread option for GCC 3.0 and
+2002-01-23 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gconvert.c: (strdup_len): Not used on Windows, don't even
+ compile it then.
+
+ (acceptable): Improve comments for the _acceptable_ table: put
+ each ASCII char above the hex number for it.
+
+ (g_escape_file_uri): On Windows, turn backslashes in the file name
+ into plain ("forward") slashes.
+
+ (g_filename_from_uri): On Windows, don't return the hostname
+ "localhost", because we can not be 100% sure it will be recognized
+ in all cases anyway, so simpler to turn it into a null
+ hostname.
+
+ Change slashes in the filename into backslashes, as that is the
+ more canonical separator.
+
+ Recognize drive letters (either followed by a colon or a vertical
+ bar, as used by some browsers), and if the filename part starts
+ with a such, don't include any (back)slash.
+
+ Don't drop any extra leading slash in the filename on Unix.
+
+ (g_filename_to_uri): On Windows, if the hostname is "localhost",
+ don't use it, for consistency with g_filename_from_uri().
+
+ tests/uri-test.c: Change accordingly, so that all tests pass on
+ Windows. Unix, too, I hope, though I couldn't check that now.
+
+ (main): Unset the G_BROKEN_FILENAMES environment variable on Unix,
+ as some tests require that filenames are in UTF-8. Is unsetenv()
+ portable?
+
+ These changes should fix bugs #59387, #59652, #59657 and #59658.
+
2002-01-22 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Get the right multithread option for GCC 3.0 and
+2002-01-23 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gconvert.c: (strdup_len): Not used on Windows, don't even
+ compile it then.
+
+ (acceptable): Improve comments for the _acceptable_ table: put
+ each ASCII char above the hex number for it.
+
+ (g_escape_file_uri): On Windows, turn backslashes in the file name
+ into plain ("forward") slashes.
+
+ (g_filename_from_uri): On Windows, don't return the hostname
+ "localhost", because we can not be 100% sure it will be recognized
+ in all cases anyway, so simpler to turn it into a null
+ hostname.
+
+ Change slashes in the filename into backslashes, as that is the
+ more canonical separator.
+
+ Recognize drive letters (either followed by a colon or a vertical
+ bar, as used by some browsers), and if the filename part starts
+ with a such, don't include any (back)slash.
+
+ Don't drop any extra leading slash in the filename on Unix.
+
+ (g_filename_to_uri): On Windows, if the hostname is "localhost",
+ don't use it, for consistency with g_filename_from_uri().
+
+ tests/uri-test.c: Change accordingly, so that all tests pass on
+ Windows. Unix, too, I hope, though I couldn't check that now.
+
+ (main): Unset the G_BROKEN_FILENAMES environment variable on Unix,
+ as some tests require that filenames are in UTF-8. Is unsetenv()
+ portable?
+
+ These changes should fix bugs #59387, #59652, #59657 and #59658.
+
2002-01-22 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Get the right multithread option for GCC 3.0 and
+2002-01-23 Tor Lillqvist <tml@iki.fi>
+
+ * glib/gconvert.c: (strdup_len): Not used on Windows, don't even
+ compile it then.
+
+ (acceptable): Improve comments for the _acceptable_ table: put
+ each ASCII char above the hex number for it.
+
+ (g_escape_file_uri): On Windows, turn backslashes in the file name
+ into plain ("forward") slashes.
+
+ (g_filename_from_uri): On Windows, don't return the hostname
+ "localhost", because we can not be 100% sure it will be recognized
+ in all cases anyway, so simpler to turn it into a null
+ hostname.
+
+ Change slashes in the filename into backslashes, as that is the
+ more canonical separator.
+
+ Recognize drive letters (either followed by a colon or a vertical
+ bar, as used by some browsers), and if the filename part starts
+ with a such, don't include any (back)slash.
+
+ Don't drop any extra leading slash in the filename on Unix.
+
+ (g_filename_to_uri): On Windows, if the hostname is "localhost",
+ don't use it, for consistency with g_filename_from_uri().
+
+ tests/uri-test.c: Change accordingly, so that all tests pass on
+ Windows. Unix, too, I hope, though I couldn't check that now.
+
+ (main): Unset the G_BROKEN_FILENAMES environment variable on Unix,
+ as some tests require that filenames are in UTF-8. Is unsetenv()
+ portable?
+
+ These changes should fix bugs #59387, #59652, #59657 and #59658.
+
2002-01-22 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in: Get the right multithread option for GCC 3.0 and
*
*/
+#ifndef G_PLATFORM_WIN32
+
static gchar *
strdup_len (const gchar *string,
gssize len,
return g_strndup (string, real_len);
}
+#endif
+
/**
* g_locale_to_utf8:
* @opsysstring: a string in the encoding of the current locale
} UnsafeCharacterSet;
static const guchar acceptable[96] = {
- /* X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 XA XB XC XD XE XF */
- 0x00,0x3F,0x20,0x20,0x20,0x00,0x2C,0x3F,0x3F,0x3F,0x3F,0x22,0x20,0x3F,0x3F,0x1C, /* 2X !"#$%&'()*+,-./ */
- 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x38,0x20,0x20,0x2C,0x20,0x2C, /* 3X 0123456789:;<=>? */
- 0x30,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F, /* 4X @ABCDEFGHIJKLMNO */
- 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x20,0x20,0x20,0x20,0x3F, /* 5X PQRSTUVWXYZ[\]^_ */
- 0x20,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F, /* 6X `abcdefghijklmno */
- 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x20,0x20,0x20,0x3F,0x20 /* 7X pqrstuvwxyz{|}~DEL */
+ /* A table of the ASCII chars from space (32) to DEL (127) */
+ /* ! " # $ % & ' ( ) * + , - . / */
+ 0x00,0x3F,0x20,0x20,0x20,0x00,0x2C,0x3F,0x3F,0x3F,0x3F,0x22,0x20,0x3F,0x3F,0x1C,
+ /* 0 1 2 3 4 5 6 7 8 9 : ; < = > ? */
+ 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x38,0x20,0x20,0x2C,0x20,0x2C,
+ /* @ A B C D E F G H I J K L M N O */
+ 0x30,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
+ /* P Q R S T U V W X Y Z [ \ ] ^ _ */
+ 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x20,0x20,0x20,0x20,0x3F,
+ /* ` a b c d e f g h i j k l m n o */
+ 0x20,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,
+ /* p q r s t u v w x y z { | } ~ DEL */
+ 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x20,0x20,0x20,0x3F,0x20
};
static const gchar hex[16] = "0123456789ABCDEF";
use_mask = mask;
for (p = string; *p != '\0'; p++)
{
- c = *p;
+ c = (guchar) *p;
if (!ACCEPTABLE (c))
unacceptable++;
}
use_mask = mask;
for (q = result, p = string; *p != '\0'; p++)
{
- c = (unsigned char)*p;
+ c = (guchar) *p;
if (!ACCEPTABLE (c))
{
char *escaped_path;
char *res;
+#ifdef G_OS_WIN32
+ char *p, *backslash;
+
+ /* Turn backslashes into forward slashes. That's what Netscape
+ * does, and they are actually more or less equivalent in Windows.
+ */
+
+ pathname = g_strdup (pathname);
+ p = (char *) pathname;
+
+ while ((backslash = strchr (p, '\\')) != NULL)
+ {
+ *backslash = '/';
+ p = backslash + 1;
+ }
+#endif
+
if (hostname && *hostname != '\0')
{
escaped_hostname = g_escape_uri_string (hostname, UNSAFE_HOST);
escaped_path,
NULL);
+#ifdef G_OS_WIN32
+ g_free ((char *) pathname);
+#endif
+
g_free (escaped_hostname);
g_free (escaped_path);
char *result;
char *filename;
int offs;
+#ifdef G_OS_WIN32
+ char *p, *slash;
+#endif
if (hostname)
*hostname = NULL;
return NULL;
}
- /* DOS uri's are like "file://host/c:\foo", so we need to check if we need to
- * drop the initial slash */
offs = 0;
- if (g_path_is_absolute (filename+1))
- offs = 1;
+#ifdef G_OS_WIN32
+ /* Drop localhost */
+ if (hostname && *hostname != NULL &&
+ g_ascii_strcasecmp (*hostname, "localhost") == 0)
+ {
+ g_free (*hostname);
+ *hostname = NULL;
+ }
+
+ /* Turn slashes into backslashes, because that's the canonical spelling */
+ p = filename;
+ while ((slash = strchr (p, '/')) != NULL)
+ {
+ *slash = '\\';
+ p = slash + 1;
+ }
+
+ /* Windows URIs with a drive letter can be like "file://host/c:/foo"
+ * or "file://host/c|/foo" (some Netscape versions). In those cases, start
+ * the filename from the drive letter.
+ */
+ if (g_ascii_isalpha (filename[1]))
+ {
+ if (filename[2] == ':')
+ offs = 1;
+ else if (filename[2] == '|')
+ {
+ filename[2] = ':';
+ offs = 1;
+ }
+ }
+#endif
result = g_filename_from_utf8 (filename + offs, -1, NULL, NULL, error);
g_free (filename);
return NULL;
}
+#ifdef G_OS_WIN32
+ /* Don't use localhost unnecessarily */
+ if (hostname && g_ascii_strcasecmp (hostname, "localhost") == 0)
+ hostname = NULL;
+#endif
+
escaped_uri = g_escape_file_uri (hostname,
utf8_filename);
g_free (utf8_filename);
to_uri_tests[] = {
{ "/etc", NULL, "file:///etc"},
{ "/etc", "", "file:///etc"},
- { "/etc", "localhost", "file://localhost/etc"},
{ "/etc", "otherhost", "file://otherhost/etc"},
#ifdef G_OS_WIN32
- { "c:\\windows", NULL, "file:///c:\\windows"}, /* these 3 tests almost certainly fail */
- { "c:\\windows", "localhost", "file://localhost/c:\\windows"},
- { "c:\\windows", "otherhost", "file://otherhost/c:\\windows"},
+ { "/etc", "localhost", "file:///etc"},
+ { "c:\\windows", NULL, "file:///c:/windows"},
+ { "c:\\windows", "localhost", "file:///c:/windows"},
+ { "c:\\windows", "otherhost", "file://otherhost/c:/windows"},
+ { "\\\\server\\share\\dir", NULL, "file:////server/share/dir"},
+ { "\\\\server\\share\\dir", "localhost", "file:////server/share/dir"},
#else
+ { "/etc", "localhost", "file://localhost/etc"},
{ "c:\\windows", NULL, NULL, G_CONVERT_ERROR_NOT_ABSOLUTE_PATH}, /* it's important to get this error on Unix */
{ "c:\\windows", "localhost", NULL, G_CONVERT_ERROR_NOT_ABSOLUTE_PATH},
{ "c:\\windows", "otherhost", NULL, G_CONVERT_ERROR_NOT_ABSOLUTE_PATH},
#endif
{ "etc", "localhost", NULL, G_CONVERT_ERROR_NOT_ABSOLUTE_PATH},
+#ifndef G_OS_WIN32
+ /* g_filename_to_utf8 uses current code page on Win32, these tests assume that
+ * local filenames *are* in UTF-8.
+ */
{ "/etc/öäå", NULL, NULL, G_CONVERT_ERROR_ILLEGAL_SEQUENCE},
{ "/etc/öäå", NULL, "file:///etc/%C3%B6%C3%A4%C3%A5"},
+#endif
{ "/etc", "öäå", "file://%C3%B6%C3%A4%C3%A5/etc"},
{ "/etc", "åäö", NULL, G_CONVERT_ERROR_ILLEGAL_SEQUENCE},
{ "/etc/file with #%", NULL, "file:///etc/file%20with%20%23%25"},
{ "/ABCDEFGHIJKLMNOPQRSTUVWXYZ", NULL, "file:///ABCDEFGHIJKLMNOPQRSTUVWXYZ"},
{ "/abcdefghijklmnopqrstuvwxyz", NULL, "file:///abcdefghijklmnopqrstuvwxyz"},
{ "/-_.!~*'()", NULL, "file:///-_.!~*'()"},
+#ifdef G_OS_WIN32
+ /* As '\\' is a path separator on Win32, it gets turned into '/' in the URI */
+ { "/\"#%<>[\\]^`{|}\x7F", NULL, "file:///%22%23%25%3C%3E%5B/%5D%5E%60%7B%7C%7D%7F"},
+#else
+ /* On Unix, '\\' is a normal character in the file name */
{ "/\"#%<>[\\]^`{|}\x7F", NULL, "file:///%22%23%25%3C%3E%5B%5C%5D%5E%60%7B%7C%7D%7F"},
+#endif
{ "/;@+$,", NULL, "file:///%3B%40%2B%24%2C"},
- { "/:", NULL, "file:///:"}, /* not escaped even though reserved as side effect of DOS support -- is that really what we want on Unix? */
+ /* This and some of the following are of course as such illegal file names on Windows,
+ * and would not occur in real life.
+ */
+ { "/:", NULL, "file:///:"},
{ "/?&=", NULL, "file:///?&="}, /* these are not escaped and other reserved characters are -- is that really what we want? */
{ "/", "0123456789", "file://0123456789/"},
{ "/", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "file://ABCDEFGHIJKLMNOPQRSTUVWXYZ/"},
from_uri_tests[] = {
{ "file:///etc", "/etc"},
{ "file:/etc", "/etc"},
+#ifdef G_OS_WIN32
+ /* On Win32 we don't return "localhost" hostames, just in case
+ * it isn't recognized anyway.
+ */
+ { "file://localhost/etc", "/etc", NULL},
+ { "file://localhost/etc/%23%25%20file", "/etc/#% file", NULL},
+#else
{ "file://localhost/etc", "/etc", "localhost"},
{ "file://localhost/etc/%23%25%20file", "/etc/#% file", "localhost"},
+#endif
{ "file://otherhost/etc", "/etc", "otherhost"},
{ "file://otherhost/etc/%23%25%20file", "/etc/#% file", "otherhost"},
{ "file://%C3%B6%C3%A4%C3%A5/etc", "/etc", "öäå"},
{ "", NULL, NULL, G_CONVERT_ERROR_BAD_URI},
{ "file:test", NULL, NULL, G_CONVERT_ERROR_BAD_URI},
{ "http://www.yahoo.com/", NULL, NULL, G_CONVERT_ERROR_BAD_URI},
- { "file:////etc", "/etc"}, /* should be "//etc" -- mistake in code for DOS results in dropped slash */
- { "file://///etc", "//etc"}, /* should be "///etc" -- mistake in code for DOS results in dropped slash */
- { "file:///c:\\foo", "/c:\\foo"}, /* should be "c:\\foo" on DOS perhaps, but that would be bad for Unix */
- { "file:///c:/foo", "/c:/foo"}, /* should be "c:/foo" on DOS perhaps, but that would be bad for Unix */
- { "file:////c:/foo", "/c:/foo"}, /* should be "//c:/foo" on Unix */
+ { "file:////etc", "//etc"},
+ { "file://///etc", "///etc"},
+#ifdef G_OS_WIN32
+ /* URIs with backslashes come from some nonstandard application, but accept them anyhow */
+ { "file:///c:\\foo", "c:\\foo"},
+ { "file:///c:/foo\\bar", "c:\\foo\\bar"},
+ /* Accept also the old Netscape drive-letter-and-vertical bar convention */
+ { "file:///c|/foo", "c:\\foo"},
+ { "file:////server/share/dir", "\\\\server\\share\\dir"},
+ { "file://localhost//server/share/foo", "\\\\server\\share\\foo"},
+ { "file://otherhost//server/share/foo", "\\\\server\\share\\foo", "otherhost"},
+#else
+ { "file:///c:\\foo", "/c:\\foo"},
+ { "file:///c:/foo", "/c:/foo"},
+ { "file:////c:/foo", "//c:/foo"},
+#endif
{ "file://0123456789/", "/", "0123456789"},
{ "file://ABCDEFGHIJKLMNOPQRSTUVWXYZ/", "/", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"},
{ "file://abcdefghijklmnopqrstuvwxyz/", "/", "abcdefghijklmnopqrstuvwxyz"},
}
else
{
+#ifdef G_OS_WIN32
+ gchar *slash, *p;
+
+ p = from_uri_tests[i].expected_filename = g_strdup (from_uri_tests[i].expected_filename);
+ while ((slash = strchr (p, '/')) != NULL)
+ {
+ *slash = '\\';
+ p = slash + 1;
+ }
+#endif
if (res == NULL || strcmp (res, from_uri_tests[i].expected_filename) != 0)
{
g_print ("\ng_filename_from_uri() test %d failed, expected result: %s, actual result: %s\n",
main (int argc,
char *argv[])
{
+#ifdef G_OS_UNIX
+ unsetenv ("G_BROKEN_FILENAMES");
+#endif
+
run_to_uri_tests ();
run_from_uri_tests ();