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.
This commit is contained in:
Tom Hacohen 2013-07-01 14:11:27 +01:00
parent cc012b754c
commit 827885d794
3 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,7 @@
2013-06-25 Tom Hacohen
* Evas textblock: Fixed issue when parsing formats with quotes.
2013-06-28 Jiyoun Park 2013-06-28 Jiyoun Park
* Evas: Fix jpeg loader cannot deal with exif information correctly * Evas: Fix jpeg loader cannot deal with exif information correctly

1
NEWS
View File

@ -342,3 +342,4 @@ Fixes:
* Evas textblock: Fixed issue with textblocks without fonts segfaulting. * 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 evas_common_convert_yuv_42* functions to actually return the converted data.
* Evas: Fix jpeg loader cannot deal with exif information correctly * Evas: Fix jpeg loader cannot deal with exif information correctly
* Evas textblock: Fixed issue when parsing formats with quotes.

View File

@ -2267,15 +2267,19 @@ _format_is_param(const char *item)
static void static void
_format_param_parse(const char *item, const char **key, const char **val) _format_param_parse(const char *item, const char **key, const char **val)
{ {
const char *start, *end, *quote; const char *start, *end;
start = strchr(item, '='); start = strchr(item, '=');
*key = eina_stringshare_add_length(item, start - item); *key = eina_stringshare_add_length(item, start - item);
start++; /* Advance after the '=' */ start++; /* Advance after the '=' */
/* If we can find a quote, our new delimiter is a quote, not a space. */ /* If we can find a quote as the first non-space char,
if ((quote = strchr(start, '\''))) * our new delimiter is a quote, not a space. */
while (*start == ' ')
start++;
if (*start == '\'')
{ {
start = quote + 1; start++;
end = strchr(start, '\''); end = strchr(start, '\'');
while ((end) && (end > start) && (end[-1] == '\\')) while ((end) && (end > start) && (end[-1] == '\\'))
end = strchr(end + 1, '\''); end = strchr(end + 1, '\'');