Enlightenment CVS committal

Author  : tsauerbeck
Project : e17
Module  : libs/edje

Dir     : e17/libs/edje/src/lib


Modified Files:
        edje_text.c 


Log Message:
even more splitting
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/edje/src/lib/edje_text.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -3 -r1.28 -r1.29
--- edje_text.c 30 Oct 2004 18:25:51 -0000      1.28
+++ edje_text.c 30 Oct 2004 19:18:32 -0000      1.29
@@ -287,6 +287,39 @@
      }
 }
 
+static void
+_edje_text_fit_set(char *buf, char *text, int c1, int c2)
+{
+   /* helper function called from _edje_text_fit_x().
+    * note that we can use strcpy()/strcat() safely, the buffer lengths
+    * are checked in the caller.
+    */
+
+   if (c1 >= 0)
+     {
+       strcpy(buf, "...");
+
+       if (c2 >= 0)
+         {
+            strncat(buf, text + c1, c2 - c1);
+            strcat(buf, "...");
+         }
+       else
+         strcat(buf, text + c1);
+     }
+   else
+     {
+       if (c2 >= 0)
+         {
+            strncpy(buf, text, c2);
+            buf[c2] = 0;
+            strcat(buf, "...");
+         }
+       else
+         strcpy(buf, text);
+     }
+}
+
 static char *
 _edje_text_fit_x(Edje *ed, Edje_Real_Part *ep,
                  Edje_Calc_Params *params,
@@ -397,27 +430,8 @@
 
        buf[0] = 0;
 
-       if (c1 >= 0)
-         {
-            strcpy(buf, "...");
-            if (c2 >= 0)
-              {
-                 strncat(buf, text + c1, c2 - c1);
-                 strcat(buf, "...");
-              }
-            else
-              strcat(buf, text + c1);
-         }
-       else
-         {
-            if (c2 >= 0)
-              {
-                 strncpy(buf, text, c2);
-                 buf[c2] = 0;
-                 strcat(buf, "...");
-              }
-            else strcpy(buf, text);
-         }
+       _edje_text_fit_set(buf, text, c1, c2);
+
        evas_object_text_text_set(ep->object, buf);
        evas_object_geometry_get(ep->object, NULL, NULL, &tw, &th);
      }




-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to