diff options
author | Nick Clifton <nickc@redhat.com> | 2009-06-09 15:14:23 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2009-06-09 15:14:23 +0000 |
commit | 6b3bea168ef38911542e8a2988eaac21bf42f1b6 (patch) | |
tree | 7753efffe19cc819ceceb2e08252e59eabcfe3c6 /binutils/winduni.c | |
parent | 32ae0794a29953d605d5b2562df0579b149e66c6 (diff) | |
download | binutils-redhat-6b3bea168ef38911542e8a2988eaac21bf42f1b6.tar.gz |
PR 10165
* winduni.c (wind_MultiByteToWideChar): Do not pass MB_PRECOMPOSED
to MultiByteToWideChar when using the CP_UTF8 or CO_UTF7 types.
Diffstat (limited to 'binutils/winduni.c')
-rw-r--r-- | binutils/winduni.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/binutils/winduni.c b/binutils/winduni.c index f811de7d73..8b39af1f59 100644 --- a/binutils/winduni.c +++ b/binutils/winduni.c @@ -661,7 +661,15 @@ wind_MultiByteToWideChar (rc_uint_type cp, const char *mb, rc_uint_type ret = 0; #if defined (_WIN32) || defined (__CYGWIN__) - ret = (rc_uint_type) MultiByteToWideChar (cp, MB_PRECOMPOSED, + rc_uint_type conv_flags = MB_PRECOMPOSED; + + /* MB_PRECOMPOSED is not allowed for UTF-7 or UTF-8. + MultiByteToWideChar will set the last error to + ERROR_INVALID_FLAGS if we do. */ + if (cp == CP_UTF8 || cp == CP_UTF7) + conv_flags = 0; + + ret = (rc_uint_type) MultiByteToWideChar (cp, conv_flags, mb, -1, u, u_len); /* Convert to bytes. */ ret *= sizeof (unichar); |