LIU Hao wrote
> 在 2026-2-12 18:20, Kirill Makurin 写道:
> > Both __mingw_{mbrtowc,wcrtomb}_cp are mingw-w64's private functions, so 
> > there is no need to use `mbstate_t` the same way as CRT does. On top of 
> > that, UCRT uses `long` member of `mbstate_t` the same way as MSVCRT uses 
> > `mbstate_t` as whole with SBCS/DBCS code pages; both `short` members in 
> > UCRT's `mbstate_t` are only used when converting UTF-8.
>
> Right, but what if `CP_UTF8` is passed, either indirectly or unintentionally 
> in the future, on UCRT? It
> should be handled for UCRT.

I would say it applies not only to UCRT. One potential use for these functions 
is converting/processing file names using active ANSI/OEM code pages (filenames 
retuned by Win32 APIs), which can be CP_UTF8 even with pre-UCRT. So this is a 
valid concern.

> The first patch looks good to me. I have pushed it now.

Ok, thanks!

- Kirill Makurin

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to