[PATCH] msvcp110: Fix the spec entry for _Getcvt for msvcp110 and higher.
Piotr Caban
piotr.caban at gmail.com
Tue May 4 04:48:58 CDT 2021
Hi Zeb,
On 5/4/21 6:41 AM, Zebediah Figura wrote:
> -@ cdecl -ret64 _Getcvt()
> +@ cdecl -ret64 _Getcvt(ptr)
It used to be:
@ cdecl _Getcvt(ptr)
Taking in account there was some discussion regarding lldiv I guess it
should be changed differently. Probably current implementation is
incorrect on some platforms. I guess it should look like this:
#if (defined(__GNUC__) && defined(__i386__) //TODO: check if we need
similar workaround for x86_64
/* Workaround a bug in GCC */
ULONGLONG __cdecl _Getcvt(void)
{
union {
_Cvtvec cvtvec;
ULONGLONG ull;
} ret;
TRACE("\n");
ret.cvtvec.page = ___lc_codepage_func();
ret.cvtvec.handle = ___lc_handle_func()[LC_CTYPE];
return ret.ull;
}
#else
_Cvtvec __cdecl _Getcvt(void)
{
_Cvtvec ret = {0};
#if _MSVCP_VER >= 110
int i;
#endif
TRACE("\n");
ret.cvtvec.page = ___lc_codepage_func();
#if _MSVCP_VER < 110
ret.cvtvec.handle = ___lc_handle_func()[LC_CTYPE];
#else
ret->mb_max = ___mb_cur_max_func();
if(ret->mb_max > 1) {
for(i=0; i<256; i++)
if(_ismbblead(i)) ret->isleadbyte[i/8] |= 1 << (i&7);
}
#endif
return ret;
}
#endif
And the spec file entry can be changed to:
@ cdecl -norelay _Getcvt()
Please note that code written here is completely untested. I'm just
raising some possible concerns.
Thanks,
Piotr
More information about the wine-devel
mailing list