From 7aa2e37f5eff398ce82ec33248cdb2aa29295ebc Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Mon, 1 Aug 2005 19:23:10 +0000 Subject: [PATCH] Ugh, fix braino. --- ChangeLog | 5 ++++- ChangeLog.pre-2-10 | 5 ++++- ChangeLog.pre-2-12 | 5 ++++- ChangeLog.pre-2-8 | 5 ++++- tests/uri-test.c | 18 ++++++++++++++++-- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b79d7e7..7044e02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,7 +5,10 @@ return "localhost" hostnames. (safe_strcmp_filename): New function that considers slash and 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 diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index b79d7e7..7044e02 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -5,7 +5,10 @@ return "localhost" hostnames. (safe_strcmp_filename): New function that considers slash and 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 diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index b79d7e7..7044e02 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -5,7 +5,10 @@ return "localhost" hostnames. (safe_strcmp_filename): New function that considers slash and 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 diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index b79d7e7..7044e02 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -5,7 +5,10 @@ return "localhost" hostnames. (safe_strcmp_filename): New function that considers slash and 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 diff --git a/tests/uri-test.c b/tests/uri-test.c index 6f4e6da..0ecfda9 100644 --- a/tests/uri-test.c +++ b/tests/uri-test.c @@ -314,7 +314,7 @@ safe_strcmp (const gchar *a, const gchar *b) static gint safe_strcmp_filename (const gchar *a, const gchar *b) { -#ifdef G_OS_WIN32 +#ifndef G_OS_WIN32 return safe_strcmp (a, b); #else if (!a) @@ -331,10 +331,24 @@ safe_strcmp_filename (const gchar *a, const gchar *b) else return (*a - *b); } + return (*a - *b); } #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 run_roundtrip_tests (void) { @@ -378,7 +392,7 @@ run_roundtrip_tests (void) 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: " " expected \"%s\", but got \"%s\"\n", -- 2.7.4