[MPlayer-dev-eng] serious warnings and bugs

pl p_l at tfz.net
Tue Dec 25 12:31:04 CET 2001


Ohohoh merry xmas,

On Mon, Dec 24, 2001 at 12:14:30AM +0200, Arpi wrote:

> Just compiled libmpdemux with -Wall, and got tons of bugs in form of
> warnings! just a few examples:
...
> again: above liens are just examples, there are much more of them over the
> whole code. it's time for some review or cleanup. fixing warnings always
> solve some misterious bugs.

A few janitor's suggestions :

 - there's a problem for off_t as it varies from 4 to 8 bytes and there
   are #if ... #else #endif to cope with this

   Suggestion: replace this code by an explicit cast to 8 bytes
       off_t o;
       printf("... %lld blah", (long long) o);

 - problems with malloc/realloc/strdup/...
   Several malloc's are not checked for failure. Although failure don't
   happen that often, that's not clean coding :)

   Suggestion: 
     add a mplayer C lib with xmalloc xrealloc xfree xstrdup xstrndup 
                              x<add your favorite func>
     these functions would wrap std C calls or would add an equivalent for
     portability (strndup for instance is not std C IIRC)

     As for mem functions, if a malloc fails then we should quit early as
     things will become worse & worse !)

I'll check that if there's any interest...

--
pl



More information about the MPlayer-dev-eng mailing list