bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fseek and ftell with large files on Windows


From: Bruno Haible
Subject: Re: fseek and ftell with large files on Windows
Date: Mon, 11 Nov 2024 19:50:36 +0100

Hi,

Markus Mützel wrote:
> Octave is using gnulib's "fseek" and "ftell" functions. A user reported that 
> they have issues when using these functions with large files on Windows:
> https://savannah.gnu.org/bugs/index.php?66399

This is explained in the Gnulib documentation:
https://www.gnu.org/software/gnulib/manual/html_node/fseek.html
https://www.gnu.org/software/gnulib/manual/html_node/ftell.html

> If I understand the code paths for Windows correctly

It's not specific to Windows. You get the same effects on all 32-bit platforms
as well.

> diff --git a/lib/fseeko.c b/lib/fseeko.c
> index 2c3b053a3b..30f8f70afe 100644
> --- a/lib/fseeko.c
> +++ b/lib/fseeko.c
> @@ -31,7 +31,7 @@ fseeko (FILE *fp, off_t offset, int whence)
>  # undef fseek
>  # define fseeko fseek
>  #endif
> -#if _GL_WINDOWS_64_BIT_OFF_T
> +#if _WIN32
>  # undef fseeko
>  # if HAVE__FSEEKI64 && HAVE_DECL__FSEEKI64 /* msvc, mingw since 
> msvcrt8.0, mingw64 */
>  #  define fseeko _fseeki64
> diff --git a/lib/ftello.c b/lib/ftello.c
> index 88247bca8e..2f83c61c0e 100644
> --- a/lib/ftello.c
> +++ b/lib/ftello.c
> @@ -34,7 +34,7 @@ ftello (FILE *fp)
>  # undef ftell
>  # define ftello ftell
>  #endif
> -#if _GL_WINDOWS_64_BIT_OFF_T
> +#if _WIN32
>  # undef ftello
>  # if HAVE__FTELLI64 /* msvc, mingw64 */
>  #  define ftello _ftelli64

This patch cannot help, since the problem is with using a 'long' as offset. 
Gnulib
can't change that, since the prototype of fseek and ftell is specified by ISO C.

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]