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.
---
 mingw-w64-crt/misc/mbrtowc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mingw-w64-crt/misc/mbrtowc.c b/mingw-w64-crt/misc/mbrtowc.c
index c2b29f64eba2..bee17fec1215 100644
--- a/mingw-w64-crt/misc/mbrtowc.c
+++ b/mingw-w64-crt/misc/mbrtowc.c
@@ -71,7 +71,7 @@ size_t mbrtowc (
   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] */
-- 
2.20.1



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

Reply via email to