crt: Replace IsDBCSLeadByteEx() by isleadbyte() in mbrtowc() CRT function mbrtowc() works with cp defined by current locale, so use the CRT function isleadbyte() which returns info according to CRT current locale instead of WinAPI function IsDBCSLeadByteEx() which takes explicit locale. For CRT function implementation it is always better to use CRT functions instead of WinAPI functions. Function isleadbyte() is available in all CRT libraries. Note that CRT function _ismbblead() works with cp set by CRT function _setmbcp() (as opposite by CRT's current locale), so do not use _ismbblead() function. Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/misc/mbrtowc.c b/mingw-w64-crt/misc/mbrtowc.c index c2b29f6..bee17fe 100644 --- a/mingw-w64-crt/misc/mbrtowc.c +++ b/mingw-w64-crt/misc/mbrtowc.c
@@ -71,7 +71,7 @@ if (conversion_state.bytes[0]) { conversion_state.bytes[1] = mbs[0]; length = 2; - } else if (mb_cur_max == 2 && IsDBCSLeadByteEx (cp, (BYTE) mbs[0])) { + } else if (mb_cur_max == 2 && isleadbyte (mbs[0])) { conversion_state.bytes[0] = mbs[0]; /* We need to examine mbs[1] */