Eric Blake wrote:
> > Btw, what is AC_FUNC_FSEEKO good for?
>
> AC_FUNC_FSEEKO turns on large file support, if necessary.
Actually, it doesn't. Paul explained it: AC_FUNC_FSEEKO makes the fseeko()
and ftello() declarations visible (and all the *64 struct and function
declarations) but does *not* do what AC_SYS_LARGEFILE does.
> > 2007-04-25 Bruno Haible <[EMAIL PROTECTED]>
> >
> > * modules/fseeko: New file.
> ...
> > + #if @GNULIB_FSEEKO@
> > + # if [EMAIL PROTECTED]@
> > + /* Assume 'off_t' is the same type as 'long'. */
> > + # define fseeko fseek
> > + # endif
>
> Is that assumption safe, or should we also find the size of long and off_t
> to verify that situation?
Verifying it cannot hurt. I commit the appended patch. Thanks for the
suggestion.
> > + #else
> > + # undef fseeko
> > + # define fseeko(f,o,w) \
> > + (GL_LINK_WARNING ("fseeko is unportable - " \
> > + "use gnulib module fseeko for portability"), \
> > + fseeko (f, o, w))
> > + #endif
>
> Should we also add a link warning for programs that use fseek/ftell
> instead of fseeko/ftello, telling the user they are potentially
> artificially limited by not using off_t?
Good idea! Can you do this?
Bruno
2007-04-26 Bruno Haible <[EMAIL PROTECTED]>
* lib/stdio_.h (fseeko, ftello): Check that off_t has the same size as
'long' when we assume it.
Suggested by Eric Blake.
*** lib/stdio_.h 25 Apr 2007 09:14:49 -0000 1.20
--- lib/stdio_.h 26 Apr 2007 09:36:47 -0000
***************
*** 38,44 ****
#include <stdarg.h>
#include <stddef.h>
! #if @GNULIB_FFLUSH@ && @REPLACE_FFLUSH@
/* Get off_t. */
# include <sys/types.h>
#endif
--- 38,44 ----
#include <stdarg.h>
#include <stddef.h>
! #if (@GNULIB_FFLUSH@ && @REPLACE_FFLUSH@) || (@GNULIB_FSEEKO@ && [EMAIL
PROTECTED]@) || (@GNULIB_FTELLO@ && [EMAIL PROTECTED]@)
/* Get off_t. */
# include <sys/types.h>
#endif
***************
*** 220,225 ****
--- 220,226 ----
#elif @GNULIB_FSEEKO@
# if [EMAIL PROTECTED]@
/* Assume 'off_t' is the same type as 'long'. */
+ typedef int verify_fseeko_types[2 * (sizeof (off_t) == sizeof (long)) - 1];
# define fseeko fseek
# endif
#else
***************
*** 233,238 ****
--- 234,240 ----
#if @GNULIB_FTELLO@
# if [EMAIL PROTECTED]@
/* Assume 'off_t' is the same type as 'long'. */
+ typedef int verify_ftello_types[2 * (sizeof (off_t) == sizeof (long)) - 1];
# define ftello ftell
# endif
#else