[MPlayer-dev-eng] serious warnings and bugs

pl p_l at tfz.net
Tue Dec 25 15:50:01 CET 2001


On Tue, Dec 25, 2001 at 01:39:57PM +0000, Stephen Davies wrote:

> >  - 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);
> > 
> 
> Have you got some examples where you feel there's a problem?  These are
> probably from when I added the 64-bit offset support.

Well that's not a big problem just some warning most of the time...


For instance in libmpdemux/cache2.c there is no #ifdef, althoug off_t
may be 8B (so it should be %llX) :

void cache_stats(cache_vars_t* s){
  int newb=s->max_filepos-s->read_filepos;
	// new bytes in the buffer
  printf("0x%06X  [0x%06X]  0x%06X",
	s->min_filepos,s->read_filepos,s->max_filepos);

  printf("%3d %%
(%3d%%)\n",100*newb/s->buffer_size,100*min_fill/s->buffer_size);
}


or in libmpdemux/open.c line 395:

#ifdef _LARGEFILE_SOURCE
  mp_msg(MSGT_OPEN,MSGL_V,"File size is %lld bytes\n", (long long)len);
#else
  mp_msg(MSGT_OPEN,MSGL_V,"File size is %u bytes\n", (unsigned int)len);
#endif


There are probably other places like that but these are the first one I
grepped.  Always casting avoids such #ifdef around the code and does not
cost much I would say.

--
Best regards,
  pl



More information about the MPlayer-dev-eng mailing list