[MPlayer-dev-eng] libmpdemux/cache2.c: correct format strings given _FILE_OFFSET_BITS

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Wed Aug 17 00:46:31 CEST 2005


Hi,
On Tue, Aug 16, 2005 at 05:50:20PM -0400, a.guru at sympatico.ca wrote:
> I checked MinGW's <sys/types.h> and it seems
> that off_t is always typedef:ed as a long.
> This is not real detection, but it means that
> we can just use "ld" and "lX", and not care what
> a long is (32 or 64 bits).

This will hopefully change somewhen, so I would prefer not to rely on
that...

> > But actually there would be a different possibility: always use PRId64
> > and cast the offsets to int64_t. Because finding the right place for the
> > #ifdefs is non-trivial, as well as detecting the size of off_t I
> > actually think this might be the more "stable"/portable way.
> 
> Yes, but it's less "native" (the conversions are
> overhead in the 32-bit case), so I'd still like
> to give the PRIdOFF approach a shot first.

Umm... just checked, the overhead (on x86) consists of exactly one cdq
and one push (and if you use (uint64_t) actually one additional push
_should_ be enough), but compared to the overhead of a function call
(the mp_msg call), that is hardly relevant.
mp_msg in a performance-critical place should be in #ifndef NDEBUG
anyway IMO.

> How about this (as a base)?

Quite a bit of code, with quite a risk of breaking on some OS and in
a header where it doesn't really belong.
What does everyone else think?

Greetings,
Reimar Döffinger




More information about the MPlayer-dev-eng mailing list