W dniu 26.11.2018 o 23:30, Jacek Caban pisze:
> On 11/26/18 10:31 PM, Martin Storsjö wrote:
>> On Mon, 26 Nov 2018, Jacek Caban wrote:
>>
>>> Hi Mateusz,
>>>
>>>
>>> The patch looks mostly good to me.
>>>
>>>
>>> On 23/11/2018 22:37, Mateusz wrote:
>>>> --- a/mingw-w64-headers/crt/stdio.h
>>>> +++ b/mingw-w64-headers/crt/stdio.h
>>>> @@ -609,31 +609,20 @@ int vsnprintf (char *__stream, size_t __n, const
>>>> char *__format, __builtin_va_li
>>>> /* Shouldn't be any fseeko32 in glibc, 32bit to 64bit casting should
>>>> be fine */
>>>> /* int fseeko32(FILE* stream, _off_t offset, int whence);*/ /*
>>>> fseeko32 redirects to fseeko64 */
>>>> -#if __MSVCRT_VERSION__ >= 0x1400
>>>> +#if __MSVCRT_VERSION__ >= 0x900
>>>> // Mark these as _CRTIMP to avoid trying to link in the mingwex
>>>> versions.
>>>> _CRTIMP int __cdecl _fseeki64(FILE *_File,__int64 _Offset,int _Origin);
>>>> _CRTIMP __int64 __cdecl _ftelli64(FILE *_File);
>>>> - __mingw_static_ovr int fseeko(FILE *_File, _off_t _Offset, int _Origin)
>>>> {
>>>> - return fseek(_File, _Offset, _Origin);
>>>> - }
>>>> - __mingw_static_ovr int fseeko64(FILE *_File, _off64_t _Offset, int
>>>> _Origin) {
>>>> - return _fseeki64(_File, _Offset, _Origin);
>>>> - }
>>>> - __mingw_static_ovr _off_t ftello(FILE *_File) {
>>>> - return ftell(_File);
>>>> - }
>>>> - __mingw_static_ovr _off64_t ftello64(FILE *_File) {
>>>> - return _ftelli64(_File);
>>>> - }
>>>> #else
>>>> __MINGW_EXTENSION int __cdecl _fseeki64(FILE *_File,__int64
>>>> _Offset,int _Origin);
>>>> __MINGW_EXTENSION __int64 __cdecl _ftelli64(FILE *_File);
>>>> +#endif
>>>
>>> I would suggest to get rid of #if here and simply always use _CRTIMP
>>> without __MINGW_EXTENSION. This would require adding symbols with
>>> __MINGW_IMP_SYMBOL to symbols in fseeki64.c.
>>
>> I'm not quite sure I know all the nuances about the difference between e.g.
>> fseeko64 and _fseeki64 (looking at stdio/fseeko64.c, their implementation is
>> rather different), but... On one hand I'd like to keep inline versions in
>> the headers for ucrt, but on the other hand it is unnecessary if the
>> libmingwex versions work as well. If others prefer unifying it I don't mind.
>
>
> Actually I didn't notice that aspect, I concentrated on getting moving part
> right. Before changing that, it would at least deserve a reasoning. I'm not
> sure about nuances as well, so I don't know what's the best solution. I'd
> prefer to simply keep it out of this patch.
>
>
>>
>> In general the patch (the latest version) looks rather straightforward to
>> me, and I'm fine with it if Jacek is.
>
>
> With inline helpers kept for ucrt builds, I will be fine with the patch.
In all documentations about fseeko/fseek that I found it is clear stated that
fseeko works exactly like fseek but it is better and preferable (because of
_off_t instead of long). mingw implementation of fseeko64 looks too much
simplified (it is possible that it was written before _fseeki64).
My question/proposition is:
we declare fseeko64 as
_CRTIMP int __cdecl fseeko64...
for libmsvcrt we add line to fseeki64.c
int __cdecl (*__MINGW_IMP_SYMBOL(fseeko64))(FILE *, _off64_t, int) = _fseeki64;
for libmsvcr90 and newer we add line to def.in file
fseeko64 == _fseeki64
and we delete 'DATA' from original _fseeki64 (libmsvcr90 and 100)
We could do similar for ftello64.
Is that way OK?
Regards,
Mateusz
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public