From 5c75cc96170a46773a2e8f6aa073d35e2e020ed5 Mon Sep 17 00:00:00 2001 From: Alex Larsson Date: Mon, 1 Oct 2001 20:40:05 +0000 Subject: [PATCH] Convert G_CONVERT_ERROR_NOT_ABSOLUTE_FILE_URI and 2001-10-01 Alex Larsson * glib/gconvert.[ch]: Convert G_CONVERT_ERROR_NOT_ABSOLUTE_FILE_URI and G_CONVERT_ERROR_INVALID_URI to G_CONVERT_ERROR_BAD_URI. * tests/uri-test.c: Update tests --- ChangeLog | 9 +++++++++ ChangeLog.pre-2-0 | 9 +++++++++ ChangeLog.pre-2-10 | 9 +++++++++ ChangeLog.pre-2-12 | 9 +++++++++ ChangeLog.pre-2-2 | 9 +++++++++ ChangeLog.pre-2-4 | 9 +++++++++ ChangeLog.pre-2-6 | 9 +++++++++ ChangeLog.pre-2-8 | 9 +++++++++ glib/gconvert.c | 24 ++++++++++++------------ glib/gconvert.h | 3 +-- tests/uri-test.c | 18 +++++++++--------- 11 files changed, 94 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index f8bc03f..93faa12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2001-10-01 Alex Larsson + + * glib/gconvert.[ch]: + Convert G_CONVERT_ERROR_NOT_ABSOLUTE_FILE_URI and + G_CONVERT_ERROR_INVALID_URI to G_CONVERT_ERROR_BAD_URI. + + * tests/uri-test.c: + Update tests + Mon Oct 1 16:01:24 2001 Owen Taylor * glib/gstring.[ch] glib/grel.c: Rename g_string_printfa() diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index f8bc03f..93faa12 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,12 @@ +2001-10-01 Alex Larsson + + * glib/gconvert.[ch]: + Convert G_CONVERT_ERROR_NOT_ABSOLUTE_FILE_URI and + G_CONVERT_ERROR_INVALID_URI to G_CONVERT_ERROR_BAD_URI. + + * tests/uri-test.c: + Update tests + Mon Oct 1 16:01:24 2001 Owen Taylor * glib/gstring.[ch] glib/grel.c: Rename g_string_printfa() diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index f8bc03f..93faa12 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +2001-10-01 Alex Larsson + + * glib/gconvert.[ch]: + Convert G_CONVERT_ERROR_NOT_ABSOLUTE_FILE_URI and + G_CONVERT_ERROR_INVALID_URI to G_CONVERT_ERROR_BAD_URI. + + * tests/uri-test.c: + Update tests + Mon Oct 1 16:01:24 2001 Owen Taylor * glib/gstring.[ch] glib/grel.c: Rename g_string_printfa() diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index f8bc03f..93faa12 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,12 @@ +2001-10-01 Alex Larsson + + * glib/gconvert.[ch]: + Convert G_CONVERT_ERROR_NOT_ABSOLUTE_FILE_URI and + G_CONVERT_ERROR_INVALID_URI to G_CONVERT_ERROR_BAD_URI. + + * tests/uri-test.c: + Update tests + Mon Oct 1 16:01:24 2001 Owen Taylor * glib/gstring.[ch] glib/grel.c: Rename g_string_printfa() diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index f8bc03f..93faa12 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,12 @@ +2001-10-01 Alex Larsson + + * glib/gconvert.[ch]: + Convert G_CONVERT_ERROR_NOT_ABSOLUTE_FILE_URI and + G_CONVERT_ERROR_INVALID_URI to G_CONVERT_ERROR_BAD_URI. + + * tests/uri-test.c: + Update tests + Mon Oct 1 16:01:24 2001 Owen Taylor * glib/gstring.[ch] glib/grel.c: Rename g_string_printfa() diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index f8bc03f..93faa12 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +2001-10-01 Alex Larsson + + * glib/gconvert.[ch]: + Convert G_CONVERT_ERROR_NOT_ABSOLUTE_FILE_URI and + G_CONVERT_ERROR_INVALID_URI to G_CONVERT_ERROR_BAD_URI. + + * tests/uri-test.c: + Update tests + Mon Oct 1 16:01:24 2001 Owen Taylor * glib/gstring.[ch] glib/grel.c: Rename g_string_printfa() diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index f8bc03f..93faa12 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +2001-10-01 Alex Larsson + + * glib/gconvert.[ch]: + Convert G_CONVERT_ERROR_NOT_ABSOLUTE_FILE_URI and + G_CONVERT_ERROR_INVALID_URI to G_CONVERT_ERROR_BAD_URI. + + * tests/uri-test.c: + Update tests + Mon Oct 1 16:01:24 2001 Owen Taylor * glib/gstring.[ch] glib/grel.c: Rename g_string_printfa() diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index f8bc03f..93faa12 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +2001-10-01 Alex Larsson + + * glib/gconvert.[ch]: + Convert G_CONVERT_ERROR_NOT_ABSOLUTE_FILE_URI and + G_CONVERT_ERROR_INVALID_URI to G_CONVERT_ERROR_BAD_URI. + + * tests/uri-test.c: + Update tests + Mon Oct 1 16:01:24 2001 Owen Taylor * glib/gstring.[ch] glib/grel.c: Rename g_string_printfa() diff --git a/glib/gconvert.c b/glib/gconvert.c index aecff7e..bc1c760 100644 --- a/glib/gconvert.c +++ b/glib/gconvert.c @@ -199,11 +199,11 @@ open_converter (const gchar *to_codeset, /* Something went wrong. */ if (errno == EINVAL) g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_NO_CONVERSION, - _("Conversion from character set `%s' to `%s' is not supported"), + _("Conversion from character set '%s' to '%s' is not supported"), from_codeset, to_codeset); else g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED, - _("Could not open converter from `%s' to `%s': %s"), + _("Could not open converter from '%s' to '%s': %s"), from_codeset, to_codeset, strerror (errno)); } @@ -1257,8 +1257,8 @@ g_filename_from_uri (const char *uri, if (!has_case_prefix (uri, "file:/")) { - g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_NOT_ABSOLUTE_FILE_URI, - _("The URI `%s' is not an absolute URI using the file scheme"), + g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_BAD_URI, + _("The URI '%s' is not an absolute URI using the file scheme"), uri); return NULL; } @@ -1267,8 +1267,8 @@ g_filename_from_uri (const char *uri, if (strchr (path_part, '#') != NULL) { - g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_INVALID_URI, - _("The local file URI `%s' may not include a `#'"), + g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_BAD_URI, + _("The local file URI '%s' may not include a '#'"), uri); return NULL; } @@ -1284,8 +1284,8 @@ g_filename_from_uri (const char *uri, if (path_part == NULL) { - g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_INVALID_URI, - _("The URI `%s' is invalid"), + g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_BAD_URI, + _("The URI '%s' is invalid"), uri); return NULL; } @@ -1293,8 +1293,8 @@ g_filename_from_uri (const char *uri, unescaped_hostname = g_unescape_uri_string (host_part, "", path_part - host_part); if (unescaped_hostname == NULL) { - g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_INVALID_URI, - _("The hostname of the URI `%s' contains invalidly escaped characters"), + g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_BAD_URI, + _("The hostname of the URI '%s' contains invalidly escaped characters"), uri); return NULL; } @@ -1309,8 +1309,8 @@ g_filename_from_uri (const char *uri, if (filename == NULL) { - g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_INVALID_URI, - _("The URI `%s' contains invalidly escaped characters"), + g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_BAD_URI, + _("The URI '%s' contains invalidly escaped characters"), uri); return NULL; } diff --git a/glib/gconvert.h b/glib/gconvert.h index a6e9d78..b7c5a40 100644 --- a/glib/gconvert.h +++ b/glib/gconvert.h @@ -38,8 +38,7 @@ typedef enum G_CONVERT_ERROR_ILLEGAL_SEQUENCE, G_CONVERT_ERROR_FAILED, G_CONVERT_ERROR_PARTIAL_INPUT, - G_CONVERT_ERROR_NOT_ABSOLUTE_FILE_URI, - G_CONVERT_ERROR_INVALID_URI, + G_CONVERT_ERROR_BAD_URI, G_CONVERT_ERROR_NOT_ABSOLUTE_PATH } GConvertError; diff --git a/tests/uri-test.c b/tests/uri-test.c index 26a5a67..6b2baa4 100644 --- a/tests/uri-test.c +++ b/tests/uri-test.c @@ -103,14 +103,14 @@ from_uri_tests[] = { { "file://otherhost/etc", "/etc", "otherhost"}, { "file://otherhost/etc/%23%25%20file", "/etc/#% file", "otherhost"}, { "file://%C3%B6%C3%A4%C3%A5/etc", "/etc", "öäå"}, - { "file:////etc/%C3%B6%C3%C3%C3%A5", NULL, NULL, G_CONVERT_ERROR_INVALID_URI}, - { "file://localhost/åäö", NULL, NULL, G_CONVERT_ERROR_INVALID_URI}, - { "file://åäö/etc", NULL, NULL, G_CONVERT_ERROR_INVALID_URI}, - { "file:///some/file#bad", NULL, NULL, G_CONVERT_ERROR_INVALID_URI}, - { "file://some", NULL, NULL, G_CONVERT_ERROR_INVALID_URI}, - { "", NULL, NULL, G_CONVERT_ERROR_NOT_ABSOLUTE_FILE_URI}, /* should be G_CONVERT_ERROR_INVALID_URI */ - { "file:test", NULL, NULL, G_CONVERT_ERROR_NOT_ABSOLUTE_FILE_URI}, - { "http://www.yahoo.com/", NULL, NULL, G_CONVERT_ERROR_NOT_ABSOLUTE_FILE_URI}, + { "file:////etc/%C3%B6%C3%C3%C3%A5", NULL, NULL, G_CONVERT_ERROR_BAD_URI}, + { "file://localhost/åäö", NULL, NULL, G_CONVERT_ERROR_BAD_URI}, + { "file://åäö/etc", NULL, NULL, G_CONVERT_ERROR_BAD_URI}, + { "file:///some/file#bad", NULL, NULL, G_CONVERT_ERROR_BAD_URI}, + { "file://some", NULL, NULL, G_CONVERT_ERROR_BAD_URI}, + { "", 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 */ @@ -125,7 +125,7 @@ from_uri_tests[] = { { "file://%C3%80%C3%BF/", "/", "\xC3\x80\xC3\xBF"}, { "file://@/", "/", "@"}, { "file://:/", "/", ":"}, - { "file://#/", NULL, NULL, G_CONVERT_ERROR_INVALID_URI}, + { "file://#/", NULL, NULL, G_CONVERT_ERROR_BAD_URI}, { "file://%23/", "/", "#"}, /* is it dangerous to return a hostname with a "#" character in it? */ { "file://%2F/", "/", "/"}, /* is it dangerous to return a hostname with a "/" character in it? */ }; -- 2.7.4