hermet pushed a commit to branch master.

http://git.enlightenment.org/tools/enventor.git/commit/?id=cd062d9564868385e3173aa5a7e75048ff5a7dc2

commit cd062d9564868385e3173aa5a7e75048ff5a7dc2
Author: Mykyta Biliavskyi <m.biliavs...@samsung.com>
Date:   Thu Aug 20 11:19:15 2015 +0900

    Edc parser: recognize description block without state name.
    
    Summary:
    In cases when keyword "description" is used without
    state name(it mean that state will have "default" 0.0 name) -
    parser is fail to recognize correct name of that description and
    all others that placed below.
    This make impossible to switching between groups and part descriptions,
    that placed below description without state name.
    @fix
    
    Reviewers: Hermet
    
    Differential Revision: https://phab.enlightenment.org/D2954
---
 src/lib/edc_parser.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/lib/edc_parser.c b/src/lib/edc_parser.c
index ece12e7..17960fc 100644
--- a/src/lib/edc_parser.c
+++ b/src/lib/edc_parser.c
@@ -134,6 +134,10 @@ cur_state_thread_blocking(void *data, Ecore_Thread *thread 
EINA_UNUSED)
         "box", "table", "external" };
    const char *DESC[2] = { "desc", "description" };
    const int DESC_LEN[2] = { 4, 11 };
+   const char *STATE = "state";
+   const char *DEF_STATE_NAME = "default";
+   const int DEF_STATE_LEN = 7;
+
 
    cur_name_td *td = data;
    char *utf8 = td->utf8;
@@ -244,8 +248,8 @@ cur_state_thread_blocking(void *data, Ecore_Thread *thread 
EINA_UNUSED)
           {
              //description? or desc?
              int desc_idx = -1;
-             if (!strncmp(p, DESC[0], DESC_LEN[0])) desc_idx = 0;
-             else if (!strncmp(p, DESC[1], DESC_LEN[1])) desc_idx = 1;
+             if (!strncmp(p, DESC[1], DESC_LEN[1])) desc_idx = 1;
+             else if (!strncmp(p, DESC[0], DESC_LEN[0])) desc_idx = 0;
 
              //we got a description!
              if (desc_idx != -1)
@@ -253,6 +257,14 @@ cur_state_thread_blocking(void *data, Ecore_Thread *thread 
EINA_UNUSED)
                   p += DESC_LEN[desc_idx];
                   char *name_begin = strstr(p, QUOT_UTF8);
                   if (!name_begin) goto end;
+                  char *state = strstr(p, STATE);
+                  if ((desc_idx == 1) && (!state || state > name_begin))
+                    {
+                       desc_name = DEF_STATE_NAME;
+                       desc_name_len = DEF_STATE_LEN;
+                       value_convert = 0;
+                       continue;
+                    }
                   name_begin += QUOT_UTF8_LEN;
                   p = name_begin;
                   char *name_end = strstr(p, QUOT_UTF8);

-- 


Reply via email to