summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-02-15 18:08:45 +0000
committerMatthias Clasen <mclasen@redhat.com>2021-02-15 18:08:45 +0000
commit2ac5c3282f094482787f84141579e7a95b722eec (patch)
tree31f47b59ec39a85efcee0bb8b534d7bb19635fe5
parent6b3c356eb7eca65d20d3aefeeef6f34d78e7d8f2 (diff)
parent2f43b8dc49491c1dd73248326722eeb12029d95f (diff)
downloadgtk+-2ac5c3282f094482787f84141579e7a95b722eec.tar.gz
Merge branch 'lenient-compose-parsing' into 'master'
imcontext: Be more lenient in parsing Compose See merge request GNOME/gtk!3201
-rw-r--r--gtk/gtkcomposetable.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/gtk/gtkcomposetable.c b/gtk/gtkcomposetable.c
index 20afc2dc44..09cf7b8e8f 100644
--- a/gtk/gtkcomposetable.c
+++ b/gtk/gtkcomposetable.c
@@ -82,33 +82,34 @@ parse_compose_value (GtkComposeData *compose_data,
gunichar ch;
char *endp;
+ value = g_string_new ("");
+
if (val[0] != '"')
{
- g_warning ("Need to double-quote the value: %s: %s", val, line);
+ g_warning ("Only strings supported after ':': %s: %s", val, line);
goto fail;
}
- value = g_string_new ("");
-
p = val + 1;
while (*p)
{
- if (*p == '\0')
- {
- g_warning ("Missing closing '\"': %s: %s", val, line);
- goto fail;
- }
- else if (*p == '\"')
+ if (*p == '\"')
{
p++;
while (*p && g_ascii_isspace (*p))
p++;
+
if (*p != '\0' && *p != '#')
- {
- g_warning ("Garbage after closing '\"': %s: %s", val, line);
- goto fail;
- }
- break;
+ g_warning ("Ignoring keysym after string: %s: %s", val, line);
+
+ compose_data->value = g_string_free (value, FALSE);
+ return TRUE;
+ }
+
+ if (p[1] == '\0')
+ {
+ g_warning ("Missing closing '\"': %s: %s", val, line);
+ goto fail;
}
else if (*p == '\\')
{
@@ -158,11 +159,9 @@ parse_compose_value (GtkComposeData *compose_data,
}
}
- compose_data->value = g_string_free (value, FALSE);
-
- return TRUE;
-
fail:
+ g_string_free (value, TRUE);
+
return FALSE;
}