Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        config.c theme.c 


Log Message:
Valgrindings.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/config.c,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -3 -r1.111 -r1.112
--- config.c    25 Jul 2004 09:34:43 -0000      1.111
+++ config.c    30 Jul 2004 20:46:34 -0000      1.112
@@ -2452,13 +2452,13 @@
    /* This function will load an ImageClass off disk */
 
    char                s[FILEPATH_LEN_MAX];
-   char                s1[FILEPATH_LEN_MAX];
    char                s2[FILEPATH_LEN_MAX];
    int                 i1;
    ImageClass         *ic = 0;
    ImageState         *ICToRead = 0;
    ColorModifierClass *cm = 0;
    int                 fields;;
+   int                 l, r, t, b;
 
    while (GetLine(s, sizeof(s), ConfigFile))
      {
@@ -2476,10 +2476,9 @@
        else if (i1 != CONFIG_INVALID)
          {
             if (fields != 2)
-              {
-                 Alert(_("CONFIG: missing required data in \"%s\"\n"), s);
-              }
+               Alert(_("CONFIG: missing required data in \"%s\"\n"), s);
          }
+
        switch (i1)
          {
          case CONFIG_CLOSE:
@@ -2488,18 +2487,14 @@
             return;
          case ICLASS_LRTB:
             {
-               char                s3[FILEPATH_LEN_MAX];
-               char                s4[FILEPATH_LEN_MAX];
-               char                s5[FILEPATH_LEN_MAX];
-
                ICToRead->border = Emalloc(sizeof(Imlib_Border));
 
-               sscanf(s, "%4000s %4000s %4000s %4000s %4000s", s1, s2, s3,
-                      s4, s5);
-               ICToRead->border->left = atoi(s2);
-               ICToRead->border->right = atoi(s3);
-               ICToRead->border->top = atoi(s4);
-               ICToRead->border->bottom = atoi(s5);
+               l = r = t = b = 0;
+               sscanf(s, "%*s %i %i %i %i", &l, &r, &t, &b);
+               ICToRead->border->left = l;
+               ICToRead->border->right = r;
+               ICToRead->border->top = t;
+               ICToRead->border->bottom = b;
                /* Hmmm... imlib2 works better with this */
                ICToRead->border->right++;
                ICToRead->border->bottom++;
@@ -2544,16 +2539,12 @@
             break;
          case ICLASS_PADDING:
             {
-               char                s3[FILEPATH_LEN_MAX];
-               char                s4[FILEPATH_LEN_MAX];
-               char                s5[FILEPATH_LEN_MAX];
-
-               sscanf(s, "%4000s %4000s %4000s %4000s %4000s", s1, s2, s3,
-                      s4, s5);
-               ic->padding.left = atoi(s2);
-               ic->padding.right = atoi(s3);
-               ic->padding.top = atoi(s4);
-               ic->padding.bottom = atoi(s5);
+               l = r = t = b = 0;
+               sscanf(s, "%*s %i %i %i %i", &l, &r, &t, &b);
+               ic->padding.left = l;
+               ic->padding.right = r;
+               ic->padding.top = t;
+               ic->padding.bottom = b;
             }
             break;
          case CONFIG_CLASSNAME:
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/theme.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- theme.c     12 Jul 2004 23:33:15 -0000      1.37
+++ theme.c     30 Jul 2004 20:46:35 -0000      1.38
@@ -92,7 +92,7 @@
    char                s[FILEPATH_LEN_MAX], ss[FILEPATH_LEN_MAX];
    char              **str = NULL, *def = NULL;
    char                already, *tmp, *tmp2;
-   int                 i, j, num;
+   int                 i, j, num, len;
 
    str = E_ls(dir, &num);
    if (!str)
@@ -120,8 +120,11 @@
 
        if (!strcmp(str[i], "DEFAULT"))
          {
-            if (readlink(ss, s, sizeof(s)) > 0)
+            memset(s, 0, sizeof(s));
+            len = readlink(ss, s, sizeof(s) - 1);
+            if (len > 0)
               {
+                 s[len] = '\0';        /* Redundant due to memset */
                  if (s[0] == '/')
                     def = Estrdup(s);
                  else




-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to