Philip Warner wrote: > Rather than having a different patch file for each platform and refusing to > code fseek/tell because we can't do SEEK_CUR, why not check for FSEEKO64 > and revert to a simple solution: > > #ifdef HAVE_FSEEKO64 > #define FSEEK fseeko64 > #define FTELL ftello64 > #define FILE_OFFSET off64_t
We can do this, but there is the problem of making the code pretty ugly. Also, it is not immediately clear when off_t is something to be used by fseek and when it is being used in file offsets that will never be seeked. I am concerned about perhaps making things worse than they are now. > #else > #ifdef HAVE_FSEEKO > #define FSEEK fseeko > #define FTELL ftello > #define FILE_OFFSET off_t > #else > #if HAVE_FSEEK_BETTER_THAN_32_BIT > #define FSEEK FSEEK_BETTER_THAN_32_BIT > #define FTELL FTELL_BETTER_THAN_32_BIT > #define FILE_OFFSET FILE_OFFSET_BETTER_THAN_32_BIT > #else > #if sizeof(off_t) > sizeof(long) Can't do sizeof() tests in cpp, which is where the #if is processed. > #define IGNORE_FSEEK > #else > #define FSEEK fseek > #define FTELL ftell > #define FILE_OFFSET long > #end if... > > Then use a correct checkSeek which also checks IGNORE_FSEEK. > > AFAICT, this *will* do the job on all systems discussed. And we can > certainly skip the HAVE_FSEEK_BETTER_THAN_32_BIT bit, but coding a trivial > seek/tell pair for fsetpos/fgetpos is easy, even in a macro. I don't think we can assume that off_t can be passed to fset/getpos unless we know the platform supports it, unless people think fpos_t being integral and the same size as fpos_t is enough. Also, I don't think these can be done a macro, perhaps fseeko(...,SEEK_SET), but not the others, and not ftello. See port/fseeko.c for the reason. -- Bruce Momjian | http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster