diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2006-05-17 07:49:39 +0000 |
---|---|---|
committer | Danny Smith <dannysmith@users.sourceforge.net> | 2006-05-17 07:49:39 +0000 |
commit | 01668fecd4ef7be84b666ae3c789ec9c12078580 (patch) | |
tree | a33e399648096fc295aa0860477cda1755cc52f5 /winsup | |
parent | 9fa8d227d41aaa7436b1065ca0a2922c0bf2dfa9 (diff) | |
download | cygnal-01668fecd4ef7be84b666ae3c789ec9c12078580.tar.gz cygnal-01668fecd4ef7be84b666ae3c789ec9c12078580.tar.bz2 cygnal-01668fecd4ef7be84b666ae3c789ec9c12078580.zip |
* mingwex/wcrtomb.c (wcrtomb_cp): Test (wc > 255) only if C locale.
Use supplied codepage as arg to WideCharToMultiByte.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/mingw/ChangeLog | 5 | ||||
-rwxr-xr-x | winsup/mingw/mingwex/wcrtomb.c | 18 |
2 files changed, 13 insertions, 10 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 2eb768921..c47fb7e36 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,8 @@ +2006-05-17 Danny Smith <dannysmith@users.sourceforge.net> + + * mingwex/wcrtomb.c (wcrtomb_cp): Test (wc > 255) only if C locale. + Use supplied codepage as arg to WideCharToMultiByte. + 2006-02-13 Earnie Boyd <earnie@users.sf.net> * Makefile.in (libmsvcr80.a): Add import lib. diff --git a/winsup/mingw/mingwex/wcrtomb.c b/winsup/mingw/mingwex/wcrtomb.c index 08a5fccae..454f035c0 100755 --- a/winsup/mingw/mingwex/wcrtomb.c +++ b/winsup/mingw/mingwex/wcrtomb.c @@ -11,14 +11,13 @@ static int __MINGW_ATTRIB_NONNULL(1) __wcrtomb_cp (char *dst, wchar_t wc, const unsigned int cp, const unsigned int mb_max) { - if (wc > 255) - { - errno = EILSEQ; - return -1; - } - if (cp == 0) { + if (wc > 255) + { + errno = EILSEQ; + return -1; + } *dst = (char) wc; return 1; } @@ -26,10 +25,9 @@ static int __MINGW_ATTRIB_NONNULL(1) { int invalid_char = 0; - int size = WideCharToMultiByte(get_cp_from_locale(), - 0 /* Is this correct flag? */, - &wc, 1, dst, mb_max, - NULL, &invalid_char); + int size = WideCharToMultiByte (cp, 0 /* Is this correct flag? */, + &wc, 1, dst, mb_max, + NULL, &invalid_char); if (size == 0 || invalid_char) { errno = EILSEQ; |