From 215a6ed80cbb9808a4f81aa1061783952d7206b3 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 28 Jul 2023 14:55:31 +0300 Subject: [PATCH] gconvert: Rename an internal variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The old name was not quite correct: the part of a URI which is just past the scheme might be the hostname or the path. It isn’t necessarily just a path. This introduces no functional changes. Signed-off-by: Philip Withnall --- glib/gconvert.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/glib/gconvert.c b/glib/gconvert.c index 5e3d781df..190909dd8 100644 --- a/glib/gconvert.c +++ b/glib/gconvert.c @@ -1672,7 +1672,7 @@ g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error) { - const char *path_part; + const char *past_scheme; const char *host_part; char *unescaped_hostname; char *result; @@ -1693,9 +1693,9 @@ g_filename_from_uri (const gchar *uri, return NULL; } - path_part = uri + strlen ("file:"); + past_scheme = uri + strlen ("file:"); - if (strchr (path_part, '#') != NULL) + if (strchr (past_scheme, '#') != NULL) { g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_BAD_URI, _("The local file URI “%s” may not include a “#”"), @@ -1703,16 +1703,16 @@ g_filename_from_uri (const gchar *uri, return NULL; } - if (has_case_prefix (path_part, "///")) - path_part += 2; - else if (has_case_prefix (path_part, "//")) + if (has_case_prefix (past_scheme, "///")) + past_scheme += 2; + else if (has_case_prefix (past_scheme, "//")) { - path_part += 2; - host_part = path_part; + past_scheme += 2; + host_part = past_scheme; - path_part = strchr (path_part, '/'); + past_scheme = strchr (past_scheme, '/'); - if (path_part == NULL) + if (past_scheme == NULL) { g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_BAD_URI, _("The URI “%s” is invalid"), @@ -1720,7 +1720,7 @@ g_filename_from_uri (const gchar *uri, return NULL; } - unescaped_hostname = g_unescape_uri_string (host_part, path_part - host_part, "", TRUE); + unescaped_hostname = g_unescape_uri_string (host_part, past_scheme - host_part, "", TRUE); if (unescaped_hostname == NULL || !hostname_validate (unescaped_hostname)) @@ -1738,7 +1738,7 @@ g_filename_from_uri (const gchar *uri, g_free (unescaped_hostname); } - filename = g_unescape_uri_string (path_part, -1, "/", FALSE); + filename = g_unescape_uri_string (past_scheme, -1, "/", FALSE); if (filename == NULL) {