Ugh, fix braino.

This commit is contained in:
Tor Lillqvist
2005-08-01 19:23:10 +00:00
parent d5a989875b
commit 7aa2e37f5e
5 changed files with 32 additions and 6 deletions

View File

@@ -5,7 +5,10 @@
return "localhost" hostnames. return "localhost" hostnames.
(safe_strcmp_filename): New function that considers slash and (safe_strcmp_filename): New function that considers slash and
backslash equal on Win32. backslash equal on Win32.
(run_roundtrip_tests): Use safe_strcmp_filename(). (safe_strcmp_hostname): New function that considers "localhost"
equal NULL on Win32.
(run_roundtrip_tests): Use safe_strcmp_filename() and
safe_strcmp_hostname().
Sun Jul 31 01:50:20 2005 Tim Janik <timj@gtk.org> Sun Jul 31 01:50:20 2005 Tim Janik <timj@gtk.org>

View File

@@ -5,7 +5,10 @@
return "localhost" hostnames. return "localhost" hostnames.
(safe_strcmp_filename): New function that considers slash and (safe_strcmp_filename): New function that considers slash and
backslash equal on Win32. backslash equal on Win32.
(run_roundtrip_tests): Use safe_strcmp_filename(). (safe_strcmp_hostname): New function that considers "localhost"
equal NULL on Win32.
(run_roundtrip_tests): Use safe_strcmp_filename() and
safe_strcmp_hostname().
Sun Jul 31 01:50:20 2005 Tim Janik <timj@gtk.org> Sun Jul 31 01:50:20 2005 Tim Janik <timj@gtk.org>

View File

@@ -5,7 +5,10 @@
return "localhost" hostnames. return "localhost" hostnames.
(safe_strcmp_filename): New function that considers slash and (safe_strcmp_filename): New function that considers slash and
backslash equal on Win32. backslash equal on Win32.
(run_roundtrip_tests): Use safe_strcmp_filename(). (safe_strcmp_hostname): New function that considers "localhost"
equal NULL on Win32.
(run_roundtrip_tests): Use safe_strcmp_filename() and
safe_strcmp_hostname().
Sun Jul 31 01:50:20 2005 Tim Janik <timj@gtk.org> Sun Jul 31 01:50:20 2005 Tim Janik <timj@gtk.org>

View File

@@ -5,7 +5,10 @@
return "localhost" hostnames. return "localhost" hostnames.
(safe_strcmp_filename): New function that considers slash and (safe_strcmp_filename): New function that considers slash and
backslash equal on Win32. backslash equal on Win32.
(run_roundtrip_tests): Use safe_strcmp_filename(). (safe_strcmp_hostname): New function that considers "localhost"
equal NULL on Win32.
(run_roundtrip_tests): Use safe_strcmp_filename() and
safe_strcmp_hostname().
Sun Jul 31 01:50:20 2005 Tim Janik <timj@gtk.org> Sun Jul 31 01:50:20 2005 Tim Janik <timj@gtk.org>

View File

@@ -314,7 +314,7 @@ safe_strcmp (const gchar *a, const gchar *b)
static gint static gint
safe_strcmp_filename (const gchar *a, const gchar *b) safe_strcmp_filename (const gchar *a, const gchar *b)
{ {
#ifdef G_OS_WIN32 #ifndef G_OS_WIN32
return safe_strcmp (a, b); return safe_strcmp (a, b);
#else #else
if (!a) if (!a)
@@ -331,10 +331,24 @@ safe_strcmp_filename (const gchar *a, const gchar *b)
else else
return (*a - *b); return (*a - *b);
} }
return (*a - *b);
} }
#endif #endif
} }
static gint
safe_strcmp_hostname (const gchar *a, const gchar *b)
{
#ifndef G_OS_WIN32
return safe_strcmp (a, b);
#else
if (safe_strcmp (a, "localhost") == 0 && b == NULL)
return 0;
else
return safe_strcmp (a, b);
#endif
}
static void static void
run_roundtrip_tests (void) run_roundtrip_tests (void)
{ {
@@ -378,7 +392,7 @@ run_roundtrip_tests (void)
any_failed = TRUE; any_failed = TRUE;
} }
if (safe_strcmp (to_uri_tests[i].hostname, hostname)) if (safe_strcmp_hostname (to_uri_tests[i].hostname, hostname))
{ {
g_print ("roundtrip test %d failed, hostname modified: " g_print ("roundtrip test %d failed, hostname modified: "
" expected \"%s\", but got \"%s\"\n", " expected \"%s\", but got \"%s\"\n",