From 57cd876321f563bade0f6230108b1fce18d9b0c6 Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Wed, 17 Apr 2013 12:12:20 -0400 Subject: [PATCH] GVariant parser: tweak lexer for format strings Tweak the lexer so that '[%s]' gets parsed as three separate tokens, instead of the closing bracket getting sucked into the format string. --- glib/gvariant-parser.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/glib/gvariant-parser.c b/glib/gvariant-parser.c index 1421a34ce..c60bd77bd 100644 --- a/glib/gvariant-parser.c +++ b/glib/gvariant-parser.c @@ -223,10 +223,11 @@ token_stream_prepare (TokenStream *stream) case '@': case '%': /* stop at the first space, comma, colon or unmatched bracket. * deals nicely with cases like (%i, %i) or {%i: %i}. + * Also: ] and > are never in format strings. */ for (end = stream->stream + 1; end != stream->end && *end != ',' && - *end != ':' && *end != '>' && !g_ascii_isspace (*end); + *end != ':' && *end != '>' && *end != ']' && !g_ascii_isspace (*end); end++) if (*end == '(' || *end == '{')