From 1f1efbbb05160af9709943fb387aa3bf76a7cfce Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 6 Aug 2020 13:57:06 +0100 Subject: guri: Rename G_URI_ERROR_MISC to G_URI_ERROR_FAILED MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- glib/guri.c | 10 +++++----- glib/guri.h | 4 ++-- glib/tests/uri.c | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/glib/guri.c b/glib/guri.c index 3f1297685..bf2775ff1 100644 --- a/glib/guri.c +++ b/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; diff --git a/glib/guri.h b/glib/guri.h index 9cbbb5b8f..0fc48a17f 100644 --- a/glib/guri.h +++ b/glib/guri.h @@ -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, diff --git a/glib/tests/uri.c b/glib/tests/uri.c index 1e8b66c93..71e3150ff 100644 --- a/glib/tests/uri.c +++ b/glib/tests/uri.c @@ -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 -- cgit v1.2.1