From 827885d794f6271c4f62194faee513e38e92364f Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Mon, 1 Jul 2013 14:11:27 +0100 Subject: [PATCH] Evas textblock: Fixed format parsing to not be confused by single-quotes. Before this commit, having a single quote anywhere in the format would mess up all of the format parsing. Thanks to MinSu Seo for reporting. --- ChangeLog | 4 ++++ NEWS | 1 + src/lib/evas/canvas/evas_object_textblock.c | 12 ++++++++---- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 772dff5827..fc3183304d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-06-25 Tom Hacohen + + * Evas textblock: Fixed issue when parsing formats with quotes. + 2013-06-28 Jiyoun Park * Evas: Fix jpeg loader cannot deal with exif information correctly diff --git a/NEWS b/NEWS index 873f2184fc..cbbb71db79 100644 --- a/NEWS +++ b/NEWS @@ -342,3 +342,4 @@ Fixes: * Evas textblock: Fixed issue with textblocks without fonts segfaulting. * Evas: Fix evas_common_convert_yuv_42* functions to actually return the converted data. * Evas: Fix jpeg loader cannot deal with exif information correctly + * Evas textblock: Fixed issue when parsing formats with quotes. diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index 88d1fa4f9e..2b7a4be147 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -2267,15 +2267,19 @@ _format_is_param(const char *item) static void _format_param_parse(const char *item, const char **key, const char **val) { - const char *start, *end, *quote; + const char *start, *end; start = strchr(item, '='); *key = eina_stringshare_add_length(item, start - item); start++; /* Advance after the '=' */ - /* If we can find a quote, our new delimiter is a quote, not a space. */ - if ((quote = strchr(start, '\''))) + /* If we can find a quote as the first non-space char, + * our new delimiter is a quote, not a space. */ + while (*start == ' ') + start++; + + if (*start == '\'') { - start = quote + 1; + start++; end = strchr(start, '\''); while ((end) && (end > start) && (end[-1] == '\\')) end = strchr(end + 1, '\'');