> This is an older issue reported in 2007: > http://lists.xiph.org/pipermail/flac-dev/2007-September/002423.html > > The fix would be to use _ftelli64 instead of ftell with Visual Studio. > http://msdn.microsoft.com/en-us/library/0ys3hc0b%28v=vs.110%29.aspxThat's not enough. At least, the followings are also needed. 1. Change off_t to something else. off_t can lead to ABI issue when used in public API, since it's definition can change even on the same system (by setting _FILE_OFFSET_BITS or something), and is always 32bit on mingw, mingw-w64 and MSVC. Since FLAC even takes the trouble of casting seek offset to off_t when calling fseeko(), it gets truncated to 32bit on Win32 even if you use _fseeki64(). This change results in ABI break, but luckily it seems there's only one metadata function that uses off_t in public API. 2. i686-pc-mingw also needs fseeko()/ftello() definitions (only fseeko64() and ftello64() available). 3. stat()/fstat() must be also taken care of, when it is used to get file size. 4. In some place, size of off_t is checked to see if FLAC binary is compiled with large file support. These also need modification. I have made a fork on https://github.com/nu774/FLAC including these patches, but it's not tested enough. Erik already knows at least off_t issue, and he said he'd like to fix it in the future. It needs many lines of change (although it basically is a trivial replacement).
On 03/04/2013 10:57 PM, nu774 wrote:>> This is an older issue reported in 2007: >> http://lists.xiph.org/pipermail/flac-dev/2007-September/002423.html >> >> The fix would be to use _ftelli64 instead of ftell with Visual Studio. >> http://msdn.microsoft.com/en-us/library/0ys3hc0b%28v=vs.110%29.aspx > > That's not enough. At least, the followings are also needed. > > 1. Change off_t to something else. off_t can lead to ABI issue when used > in public API, since it's definition can change even on the same system > (by setting _FILE_OFFSET_BITS or something), and is always 32bit on > mingw, mingw-w64 and MSVC. > Since FLAC even takes the trouble of casting seek offset to off_t when > calling fseeko(), it gets truncated to 32bit on Win32 even if you use > _fseeki64(). > This change results in ABI break, but luckily it seems there's only one > metadata function that uses off_t in public API. > > 2. i686-pc-mingw also needs fseeko()/ftello() definitions (only > fseeko64() and ftello64() available). > > 3. stat()/fstat() must be also taken care of, when it is used to get > file size. > > 4. In some place, size of off_t is checked to see if FLAC binary is > compiled with large file support. These also need modification. > > > I have made a fork on https://github.com/nu774/FLAC including these > patches, but it's not tested enough. > Erik already knows at least off_t issue, and he said he'd like to fix it > in the future. It needs many lines of change (although it basically is a > trivial replacement).Nothing against you code, that's ugly ..but as it is a first step it can be forgiven :-) I will just force flac to be built with 64 bit file offsets and just reject any caller trying to include/link libflac into a non-lfs program like http://ac-archive.sourceforge.net/largefile/off_t_headers.html Then we can fix all the internal problems, without the need of typedef'ing around ;)
(2013/03/05 12:27), Cristian Rodr?guez wrote:> Nothing against you code, that's ugly ..but as it is a first step it can > be forgiven :-) > > I will just force flac to be built with 64 bit file offsets and just > reject any caller trying to include/link libflac into a non-lfs program > like > > http://ac-archive.sourceforge.net/largefile/off_t_headers.html > > Then we can fix all the internal problems, without the need of > typedef'ing around ;)Well, I'm afraid typedef'ing or something is mandatory for large file support on win32, since off_t is *always* 32bit on win32 and flac basically uses off_t everywhere for seek offset and file size.
On 3/5/2013 09:57, nu774 wrote:> 2. i686-pc-mingw also needs fseeko()/ftello() definitions (only > fseeko64() and ftello64() available).Not true for i686-w64-mingw32, it has Linux style LFS64 with _FILE_OFFSET_BITS. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 834 bytes Desc: OpenPGP digital signature Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20130305/99dc660a/attachment.pgp