[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: |
Thu, 14 Nov 2024 15:31:21 +0100 |
Markus Mützel wrote:
> If the unit test passes with it, it might be passing erroneously.
No: Before making the fixes and adding the unit test, I verified that without
the fixes, the unit test failed. In other words, the unit test is able
to detect the bugs we are interested in.
> > - Apparently the mingw fseeko already supports the 64-bit argument
> fine.
>
>
> "fseeko" has the following prototype in mingw-w64:
> https://sourceforge.net/p/mingw-w64/code/HEAD/tree/trunk/mingw-w64-crt/stdio/fseeko32.c
> int fseeko(FILE* stream, _off_t offset, int whence)
>
> The offset is of type "_off_t". That type is defined like this in mingw-w64:
> https://sourceforge.net/p/mingw-w64/code/HEAD/tree/trunk/mingw-w64-headers/crt/_mingw_off_t.h
> typedef long _off_t;
>
> "long" is a 32-bit integer on Windows. So, the "fseeko" function from
> mingw-w64 shouldn't work for large files.
>
> Does that make sense?
No. You missed the facts that
- the Gnulib 'largefile' module defines _FILE_OFFSET_BITS to 64 on mingw,
- mingw-w64-headers/crt/stdio.h thus does a
#define fseeko fseeko64
- fseeko64 is defined in mingw-w64-crt/stdio/fseeko64.c and takes a 64-bit
argument.
Bruno
- fseek and ftell with large files on Windows, Markus Mützel, 2024/11/11
- Re: fseek and ftell with large files on Windows, Bruno Haible, 2024/11/11
- Re: fseek and ftell with large files on Windows, Markus Mützel, 2024/11/12
- Re: fseek and ftell with large files on Windows, Bruno Haible, 2024/11/12
- Re: fseek and ftell with large files on Windows, Markus Mützel, 2024/11/13
- Re: fseek and ftell with large files on Windows, Bruno Haible, 2024/11/13
- Re: fseek and ftell with large files on Windows, Bruno Haible, 2024/11/13
- Re: fseek and ftell with large files on Windows, Markus Mützel, 2024/11/14
- Re: fseek and ftell with large files on Windows, Bruno Haible, 2024/11/14
- Re: fseek and ftell with large files on Windows, Markus Mützel, 2024/11/14
- Re: fseek and ftell with large files on Windows,
Bruno Haible <=
- Re: fseek and ftell with large files on Windows, Markus Mützel, 2024/11/14
- Re: fseek and ftell with large files on Windows, Bruno Haible, 2024/11/13