8 Nov
2023
8 Nov
'23
5:34 p.m.
Piotr Caban (@piotr) commented about dlls/msvcrt/mbcs.c:
- } + if (locale) + mbcinfo = locale->mbcinfo; + else + mbcinfo = get_mbcinfo();
- /* repack it in the reverse order */ - p=str; - for(i=len-1; i>=0; i--) + if (mbcinfo->ismbcodepage) { - if(_ismbblead(temp[i*2])) + len = _mbslen_l(str, locale); + temp = malloc(len * 2); + if (!temp) + return str; This is broken, it would be good to avoid the allocation at all.
I think that the easiest implementation would be to first reverse bytes in double-byte characters and then call `u__strrev` on whole string. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4341#note_51541