mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
guri: Rename G_URI_ERROR_MISC to G_URI_ERROR_FAILED
This brings its naming in line with the ‘generic’ error codes in other error domains. This is not an API break since `GUriError` hasn’t been in a release yet. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
ff60d2ebf5
commit
1f1efbbb05
10
glib/guri.c
10
glib/guri.c
@ -1237,7 +1237,7 @@ g_uri_parse_relative (GUri *base_uri,
|
||||
|
||||
if (!uri->scheme && !base_uri)
|
||||
{
|
||||
g_set_error_literal (error, G_URI_ERROR, G_URI_ERROR_MISC,
|
||||
g_set_error_literal (error, G_URI_ERROR, G_URI_ERROR_FAILED,
|
||||
_("URI is not absolute, and no base URI was provided"));
|
||||
goto fail;
|
||||
}
|
||||
@ -1980,19 +1980,19 @@ g_uri_params_iter_next (GUriParamsIter *iter,
|
||||
attr_end = memchr (ri->attr, '=', val_end - ri->attr);
|
||||
if (!attr_end)
|
||||
{
|
||||
g_set_error_literal (error, G_URI_ERROR, G_URI_ERROR_MISC,
|
||||
g_set_error_literal (error, G_URI_ERROR, G_URI_ERROR_FAILED,
|
||||
_("Missing '=' and parameter value"));
|
||||
return FALSE;
|
||||
}
|
||||
if (!uri_decode (&decoded_attr, NULL, ri->attr, attr_end - ri->attr,
|
||||
www_form, G_URI_FLAGS_NONE, G_URI_ERROR_MISC, error))
|
||||
www_form, G_URI_FLAGS_NONE, G_URI_ERROR_FAILED, error))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
val = attr_end + 1;
|
||||
if (!uri_decode (&decoded_value, NULL, val, val_end - val,
|
||||
www_form, G_URI_FLAGS_NONE, G_URI_ERROR_MISC, error))
|
||||
www_form, G_URI_FLAGS_NONE, G_URI_ERROR_FAILED, error))
|
||||
{
|
||||
g_free (decoded_attr);
|
||||
return FALSE;
|
||||
@ -2495,7 +2495,7 @@ g_uri_unescape_bytes (const gchar *escaped_string,
|
||||
FALSE,
|
||||
FALSE,
|
||||
G_URI_FLAGS_PARSE_STRICT|G_URI_FLAGS_ENCODED,
|
||||
G_URI_ERROR_MISC, error);
|
||||
G_URI_ERROR_FAILED, error);
|
||||
if (unescaped_length == -1)
|
||||
return NULL;
|
||||
|
||||
|
@ -295,7 +295,7 @@ GQuark g_uri_error_quark (void);
|
||||
|
||||
/**
|
||||
* GUriError:
|
||||
* @G_URI_ERROR_MISC: Generic error if no more specific error is available.
|
||||
* @G_URI_ERROR_FAILED: Generic error if no more specific error is available.
|
||||
* See the error message for details.
|
||||
* @G_URI_ERROR_BAD_SCHEME: The scheme of a URI could not be parsed.
|
||||
* @G_URI_ERROR_BAD_USER: The user/userinfo of a URI could not be parsed.
|
||||
@ -312,7 +312,7 @@ GQuark g_uri_error_quark (void);
|
||||
* Since: 2.66
|
||||
*/
|
||||
typedef enum {
|
||||
G_URI_ERROR_MISC,
|
||||
G_URI_ERROR_FAILED,
|
||||
G_URI_ERROR_BAD_SCHEME,
|
||||
G_URI_ERROR_BAD_USER,
|
||||
G_URI_ERROR_BAD_PASSWORD,
|
||||
|
@ -417,7 +417,7 @@ test_uri_unescape_bytes (gconstpointer test_data)
|
||||
if (tests[i].expected_unescaped_len < 0)
|
||||
{
|
||||
g_assert_null (bytes);
|
||||
g_assert_error (error, G_URI_ERROR, G_URI_ERROR_MISC);
|
||||
g_assert_error (error, G_URI_ERROR, G_URI_ERROR_FAILED);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
else
|
||||
@ -891,17 +891,17 @@ test_uri_parsing_relative (void)
|
||||
|
||||
resolved = g_uri_resolve_relative (NULL, "a", G_URI_FLAGS_NONE, &error);
|
||||
g_assert_null (resolved);
|
||||
g_assert_error (error, G_URI_ERROR, G_URI_ERROR_MISC);
|
||||
g_assert_error (error, G_URI_ERROR, G_URI_ERROR_FAILED);
|
||||
g_clear_error (&error);
|
||||
|
||||
resolved = g_uri_resolve_relative ("../b", "a", G_URI_FLAGS_NONE, &error);
|
||||
g_assert_null (resolved);
|
||||
g_assert_error (error, G_URI_ERROR, G_URI_ERROR_MISC);
|
||||
g_assert_error (error, G_URI_ERROR, G_URI_ERROR_FAILED);
|
||||
g_clear_error (&error);
|
||||
|
||||
resolved = g_uri_resolve_relative ("%%", "a", G_URI_FLAGS_NONE, &error);
|
||||
g_assert_null (resolved);
|
||||
g_assert_error (error, G_URI_ERROR, G_URI_ERROR_MISC);
|
||||
g_assert_error (error, G_URI_ERROR, G_URI_ERROR_FAILED);
|
||||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
@ -1449,7 +1449,7 @@ test_uri_iter_params (gconstpointer test_data)
|
||||
g_assert_cmpint (n, ==, params_tests[i].expected_n_iter);
|
||||
if (err)
|
||||
{
|
||||
g_assert_error (err, G_URI_ERROR, G_URI_ERROR_MISC);
|
||||
g_assert_error (err, G_URI_ERROR, G_URI_ERROR_FAILED);
|
||||
g_clear_error (&err);
|
||||
}
|
||||
g_free (uri);
|
||||
@ -1494,7 +1494,7 @@ test_uri_parse_params (gconstpointer test_data)
|
||||
if (params_tests[i].expected_n_params < 0)
|
||||
{
|
||||
g_assert_null (params);
|
||||
g_assert_error (err, G_URI_ERROR, G_URI_ERROR_MISC);
|
||||
g_assert_error (err, G_URI_ERROR, G_URI_ERROR_FAILED);
|
||||
g_clear_error (&err);
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user