[MPlayer-dev-eng] [PATCH] Kill some _LARGEFILE_SOURCE #ifdefs

Rich Felker dalias at aerifal.cx
Thu Jun 30 05:13:43 CEST 2005


On Thu, Jun 30, 2005 at 12:59:05AM +0200, Tobias Diedrich wrote:
> I think everyone agrees that #ifdefs in code are best avoided. :-)
> While I was looking at some code I noticed some unnecessary 
> ifdefs related to largefile support.
> Some can be avoided by casting to off_t, as in:
> 
> |-#ifdef _LARGEFILE_SOURCE
> |-       newpos &= ~((long long) (STREAM_BUFFER_SIZE - 1));  /* sector boundary */
> |-#else
> |-       newpos &= ~(STREAM_BUFFER_SIZE - 1);  /* sector boundary */
> |-#endif
> |+       newpos &= ~((off_t) (STREAM_BUFFER_SIZE - 1));  /* sector boundary */
> 
> And for some format strings I think the simplest solution is to
> always cast to long long:
> 
> |-#ifdef _LARGEFILE_SOURCE
> |   mp_msg(MSGT_STREAM,MSGL_V,"stream_seek: WARNING! Can't seek to 0x%llX !\n",(long long)(pos+newpos));
> |-#else
> |-  mp_msg(MSGT_STREAM,MSGL_V,"stream_seek: WARNING! Can't seek to 0x%X !\n",(pos+newpos));
> |-#endif

I agree.

Rich




More information about the MPlayer-dev-eng mailing list