Evas textblock: Fixed format parsing to not be confused by single-quotes.
authorTom Hacohen <tom@stosb.com>
Mon, 1 Jul 2013 13:11:27 +0000 (14:11 +0100)
committerTom Hacohen <tom@stosb.com>
Mon, 1 Jul 2013 13:18:52 +0000 (14:18 +0100)
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
NEWS
src/lib/evas/canvas/evas_object_textblock.c

index 772dff5..fc31833 100644 (file)
--- 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 873f218..cbbb71d 100644 (file)
--- 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.
index 88d1fa4..2b7a4be 100644 (file)
@@ -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, '\'');