On Wed, 28 May 2008 22:09:11 -0400 dan sinclair <[EMAIL PROTECTED]> babbled:

> Why did you comment out all the printfs for invalid files? Those can be 
> useful if the .ini file is actually screwed up.

they were rather annoying when you want to test parsing of screwed files... and
do you want the stdout of apps cluttered with it? they can go back - but i just
didn't see it as really useful to keep when it's likely never to be seen
(except in test suites...)? :)

> dan
> 
> 
> 
> Enlightenment CVS wrote:
> > Enlightenment CVS committal
> > 
> > Author  : raster
> > Project : e17
> > Module  : libs/efreet
> > 
> > Dir     : e17/libs/efreet/src/lib
> > 
> > 
> > Modified Files:
> >     efreet_ini.c efreet_mime.c 
> > 
> > 
> > Log Message:
> > 
> > 
> > * add efreet garbage data check
> > * remove printfs that clutter output
> > * add efreet file type check - only parse regular files
> > * chekc mmap returns correctly for MAP_FAILED results
> > * edje has some stubs for adding script-only objecvts - but nothing useful
> > right now
> > 
> > ===================================================================
> > RCS file: /cvs/e/e17/libs/efreet/src/lib/efreet_ini.c,v
> > retrieving revision 1.15
> > retrieving revision 1.16
> > diff -u -3 -r1.15 -r1.16
> > --- efreet_ini.c    8 May 2008 14:22:21 -0000       1.15
> > +++ efreet_ini.c    29 May 2008 02:00:04 -0000      1.16
> > @@ -81,7 +81,12 @@
> >      f = fopen(file, "rb");
> >      if (!f) return NULL;
> >  
> > -    if (fstat(fileno(f), &file_stat) || file_stat.st_size < 1)
> > +    if (fstat(fileno(f), &file_stat) || (file_stat.st_size < 1))
> > +    {
> > +        fclose(f);
> > +        return NULL;
> > +    }
> > +    if (!S_ISREG(file_stat.st_mode)) /* if not a regular file - close */
> >      {
> >          fclose(f);
> >          return NULL;
> > @@ -89,7 +94,7 @@
> >  
> >      left = file_stat.st_size;
> >      buffer = mmap(NULL, left, PROT_READ, MAP_SHARED, fileno(f), 0);
> > -    if (!buffer)
> > +    if (buffer == MAP_FAILED)
> >      {
> >          fclose(f);
> >          return NULL;
> > @@ -107,7 +112,7 @@
> >          /* find the end of line */
> >          for (line_length = 0; 
> >                  (line_length < left) && 
> > -                (line_start[line_length] != '\n'); ++line_length)
> > +                (line_start[line_length] != '\n'); line_length++)
> >              ;
> >  
> >          /* check for all white space */
> > @@ -151,8 +156,8 @@
> >                  ecore_hash_free_value_cb_set(section, ECORE_FREE_CB(free));
> >  
> >                  old = ecore_hash_remove(data, header);
> > -                if (old) printf("[efreet] Warning: duplicate section '%s' "
> > -                                "in file '%s'\n", header, file);
> > +//                if (old) printf("[efreet] Warning: duplicate section '%
> > s' "
> > +  //                              "in file '%s'\n", header, file);
> >  
> >                  IF_FREE_HASH(old);
> >                  ecore_hash_set(data, (void *)ecore_string_instance(header),
> > @@ -162,14 +167,14 @@
> >              {
> >                  /* invalid file - skip line? or refuse to parse file? */
> >                  /* just printf for now till we figure out what to do */
> > -                printf("Invalid file (%s) (missing ] on group name)\n",
> > file); +//                printf("Invalid file (%s) (missing ] on group
> > name)\n", file); }
> >              goto next_line;
> >          }
> >  
> >          if (section == NULL)
> >          {
> > -            printf("Invalid file (%s) (missing section)\n", file);
> > +//            printf("Invalid file (%s) (missing section)\n", file);
> >              goto next_line;
> >          }
> >  
> > @@ -212,7 +217,7 @@
> >              if (key_end == 0)
> >              {
> >                  /* invalid file... */
> > -                printf("Invalid file (%s) (invalid key=value pair)\n",
> > file); +//                printf("Invalid file (%s) (invalid key=value pair)
> > \n", file); 
> >                  goto next_line;
> >              }
> > @@ -234,17 +239,16 @@
> >              ecore_hash_set(section, (void *)ecore_string_instance(key),
> >                             efreet_ini_unescape(value));
> >          }
> > -        else
> > -        {
> > -            /* invalid file... */
> > -            printf("Invalid file (%s) (missing = from key=value pair)\n",
> > file);
> > -        }
> > +//        else
> > +//        {
> > +//            /* invalid file... */
> > +//            printf("Invalid file (%s) (missing = from key=value pair)
> > \n", file); +//        }
> >  
> >  next_line:
> >          left -= line_length + 1;
> >          line_start += line_length + 1;
> >      }
> > -
> >      munmap((char*) buffer, file_stat.st_size);
> >      fclose(f);
> >  
> > ===================================================================
> > RCS file: /cvs/e/e17/libs/efreet/src/lib/efreet_mime.c,v
> > retrieving revision 1.36
> > retrieving revision 1.37
> > diff -u -3 -r1.36 -r1.37
> > --- efreet_mime.c   7 Apr 2008 05:52:45 -0000       1.36
> > +++ efreet_mime.c   29 May 2008 02:00:04 -0000      1.37
> > @@ -826,7 +826,7 @@
> >      if (fd == -1) return;
> >  
> >      data = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
> > -    if (data == (void *)-1)
> > +    if (data == MAP_FAILED)
> >      {
> >          close(fd);
> >          return;
> > 
> > 
> > 
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Microsoft
> > Defy all challenges. Microsoft(R) Visual Studio 2008.
> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > _______________________________________________
> > enlightenment-cvs mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs
> > 
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> 


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    [EMAIL PROTECTED]


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to