Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/evas

Dir     : e17/libs/evas/src/lib/canvas


Modified Files:
        evas_object_textblock.c 


Log Message:


fix valgrind errors

===================================================================
RCS file: 
/cvsroot/enlightenment/e17/libs/evas/src/lib/canvas/evas_object_textblock.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -3 -r1.76 -r1.77
--- evas_object_textblock.c     16 Aug 2005 08:12:14 -0000      1.76
+++ evas_object_textblock.c     16 Aug 2005 09:25:48 -0000      1.77
@@ -829,8 +829,11 @@
        o->markup_text = NULL;
      }
    _nodes_clear(obj);
-   _lines_clear(obj, o->lines);
-   o->lines = NULL;
+   if (o->lines)
+     {
+       _lines_clear(obj, o->lines);
+       o->lines = NULL;
+     }
    o->changed = 1;
    evas_object_change(obj);
    if (!o->style)
@@ -1163,8 +1166,11 @@
    n->text = _strbuf_append(n->text, (char *)text, &(n->len), &(n->alloc));
    cur->node = n;
    cur->pos = n->len - 1;
-   _lines_clear(cur->obj, o->lines);
-   o->lines = NULL;
+   if (o->lines)
+     {
+       _lines_clear(cur->obj, o->lines);
+       o->lines = NULL;
+     }
    o->changed = 1;
    evas_object_change(cur->obj);
 }
@@ -1196,8 +1202,11 @@
    n->text = _strbuf_append(n->text, (char *)format, &(n->len), &(n->alloc));
    cur->node = n;
    cur->pos = 0;
-   _lines_clear(cur->obj, o->lines);
-   o->lines = NULL;
+   if (o->lines)
+     {
+       _lines_clear(cur->obj, o->lines);
+       o->lines = NULL;
+     }
    o->changed = 1;
    evas_object_change(cur->obj);
 }
@@ -1237,8 +1246,11 @@
        free(o->markup_text);
        o->markup_text = NULL;
      }
-   _lines_clear(obj, o->lines);
-   o->lines = NULL;
+   if (o->lines)
+     {
+       _lines_clear(obj, o->lines);
+       o->lines = NULL;
+     }
    o->changed = 1;
    evas_object_change(obj);
 }
@@ -1601,6 +1613,7 @@
        if (!s1)
          {
             if (*p != ' ') s1 = p;
+            if (*p == 0) break;
          }
        else if (!s2)
          {
@@ -1608,12 +1621,12 @@
               {
                  if (*p == '"') quote = 1;
                  else if (*p == ' ') s2 = p;
-                 else if (*p == 0) s2 = p;
               }
             else
               {
                  if (*p == '"') quote = 0;
               }
+            if (*p == 0) s2 = p;
          }
        p++;
        if (s1 && s2)
@@ -1742,6 +1755,7 @@
      {
        fmt = calloc(1, sizeof(Evas_Object_Textblock_Format));
        c->format_stack  = evas_list_prepend(c->format_stack, fmt);
+       fmt->ref = 1;
        fmt->halign = 0.0;
        fmt->valign = -1.0;
        fmt->style = STYLE_PLAIN;
@@ -2300,7 +2314,7 @@
    c->underline_extend = 0;
    c->line_no = 0;
    c->align = 0.0;
-   
+
    /* setup default base style */
    if ((c->o->style) && (c->o->style->default_tag))
      {
@@ -2431,6 +2445,7 @@
        (o->style_pad.t != style_pad_t) || (o->style_pad.b != style_pad_b))
      {
         _lines_clear(obj, c->lines);
+       c->lines = NULL;
        o->style_pad.l = style_pad_l;
        o->style_pad.r = style_pad_r;
        o->style_pad.t = style_pad_t;
@@ -2439,12 +2454,10 @@
      }
    if (!calc_only)
      {
-       c->o->lines = c->lines;
-     }
-   else
-     {
-       _lines_clear(obj, c->lines);
+       o->lines = c->lines;
+       return;
      }
+   if (c->lines) _lines_clear(obj, c->lines);
 }
 
 
@@ -2516,10 +2529,10 @@
    Evas_Object_Textblock *o;
    Evas_Object_List *l, *ll;
    int i, j;
-   int pback, backx = 0;
-   int pline, linex = 0;
-   int pline2, line2x = 0;
-   int pstrike, strikex = 0;
+   int pback = 0, backx = 0;
+   int pline = 0, linex = 0;
+   int pline2 = 0, line2x = 0;
+   int pstrike = 0, strikex = 0;
    int x2;
    unsigned char r = 0, g = 0, b = 0, a = 0;
    unsigned char r2 = 0, g2 = 0, b2 = 0, a2 = 0;
@@ -2555,6 +2568,9 @@
        Evas_Object_Textblock_Line *ln; \
        \
        ln = (Evas_Object_Textblock_Line *)l; \
+        pback = 0; \
+        pline = 0; \
+        pline2 = 0; \
        for (ll = (Evas_Object_List *)ln->items; ll; ll = ll->next) \
          { \
             Evas_Object_Textblock_Item *it; \
@@ -2566,9 +2582,6 @@
               yoff = (it->format->valign * (double)(ln->h - it->h)) + 
it->baseline;
 #define ITEM_WALK_END() \
          } \
-        pback = 0; \
-        pline = 0; \
-        pline2 = 0; \
      }
 #define COLOR_SET(col) \
        ENFN->context_color_set(output, context, \
@@ -2919,10 +2932,12 @@
                0,
                obj->cur.geometry.w, obj->cur.geometry.h,
                NULL, NULL);
-       _lines_clear(obj, lines);
+       if (lines) _lines_clear(obj, lines);
        o->last_w = obj->cur.geometry.w;
        updates = evas_object_render_pre_prev_cur_add(updates, obj);
        o->changed = 0;
+       is_v = evas_object_is_visible(obj);
+       was_v = evas_object_was_visible(obj);
        goto done;
      }
    /* if someone is clipping this obj - go calculate the clipper */




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to