[vlc-devel] [PATCH] access: dtv: fix lfind call with different prototypes in mingw32

Steve Lhomme robux4 at ycbcr.xyz
Mon Jul 15 08:01:30 CEST 2019


On 2019-07-13 9:33, Rémi Denis-Courmont wrote:
> Le perjantaina 12. heinäkuuta 2019, 12.43.43 EEST Steve Lhomme a écrit :
>> On 2019-07-12 9:14, Rémi Denis-Courmont wrote:
>>> Hi,
>>>
>>> size_t and unsigned should be the same on Win32, so I don't exactly see
>>> the point.
>>>
>>> Of course, there *is* a problem on Win64, but either MingW should be fixed
>>> or a systematic work-around should be used,m (e.g. #define lfind
>>> lfind_size_t), otherwise the same bug will reoccur silently (only on
>>> 64-bits Windows) every time lfind() is used.
>> I can make a local fix by remapping lfind() to a local function with the
>> correct signature, but if we want to make it generic it's trickier. It
>> is used by plugins, so it either needs to be exported by the core (nope)
>> or added in compat.
> 
> Ah? You can just do that in vlc_fixups.h
> 
> #ifdef _WIN64
> static inline ... lfind_size_t(..){ lfind(...); }
> 
> #define lfind lfind_size_t
> #endif

For some reason I thought it would mean the inline above would turn the 
lfind() call into a lfind_size_t() ending up calling itself. I'll give 
that a try.

> But given that's unlikely VLC-specific problem, it's better to fix the Win64
> port in MingW, IMO.

I don't think it will happen. lfind() in mingw has been like that 
forever and matches the MS _lfind() signature. Changing this means all 
the code that has been made to use mingw will now have to be changed.

Let alone the fact we would need to keep track of which version of mingw 
is being compiled to know which signature to use and still have a 
version using the MS signature.


More information about the vlc-devel mailing list