Convert G_CONVERT_ERROR_NOT_ABSOLUTE_FILE_URI and

2001-10-01  Alex Larsson  <alexl@redhat.com>

	* 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
This commit is contained in:
Alex Larsson 2001-10-01 20:40:05 +00:00 committed by Alexander Larsson
parent ce83d7fb82
commit 5c75cc9617
11 changed files with 94 additions and 23 deletions

View File

@ -1,3 +1,12 @@
2001-10-01 Alex Larsson <alexl@redhat.com>
* 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 <otaylor@redhat.com>
* glib/gstring.[ch] glib/grel.c: Rename g_string_printfa()

View File

@ -1,3 +1,12 @@
2001-10-01 Alex Larsson <alexl@redhat.com>
* 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 <otaylor@redhat.com>
* glib/gstring.[ch] glib/grel.c: Rename g_string_printfa()

View File

@ -1,3 +1,12 @@
2001-10-01 Alex Larsson <alexl@redhat.com>
* 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 <otaylor@redhat.com>
* glib/gstring.[ch] glib/grel.c: Rename g_string_printfa()

View File

@ -1,3 +1,12 @@
2001-10-01 Alex Larsson <alexl@redhat.com>
* 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 <otaylor@redhat.com>
* glib/gstring.[ch] glib/grel.c: Rename g_string_printfa()

View File

@ -1,3 +1,12 @@
2001-10-01 Alex Larsson <alexl@redhat.com>
* 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 <otaylor@redhat.com>
* glib/gstring.[ch] glib/grel.c: Rename g_string_printfa()

View File

@ -1,3 +1,12 @@
2001-10-01 Alex Larsson <alexl@redhat.com>
* 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 <otaylor@redhat.com>
* glib/gstring.[ch] glib/grel.c: Rename g_string_printfa()

View File

@ -1,3 +1,12 @@
2001-10-01 Alex Larsson <alexl@redhat.com>
* 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 <otaylor@redhat.com>
* glib/gstring.[ch] glib/grel.c: Rename g_string_printfa()

View File

@ -1,3 +1,12 @@
2001-10-01 Alex Larsson <alexl@redhat.com>
* 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 <otaylor@redhat.com>
* glib/gstring.[ch] glib/grel.c: Rename g_string_printfa()

View File

@ -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;
}

View File

@ -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;

View File

@ -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? */
};