aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2009-06-09 15:14:23 +0000
committerNick Clifton <nickc@redhat.com>2009-06-09 15:14:23 +0000
commitb882b028e362cc71a36ef9de77f104911d751579 (patch)
tree5bcc450554cb55ccb4d2d7a6b6e3d2b93785926f
parent1fbfe7852a66c02f029e9020a962ba65edb4c59a (diff)
downloadgdb-b882b028e362cc71a36ef9de77f104911d751579.zip
gdb-b882b028e362cc71a36ef9de77f104911d751579.tar.gz
gdb-b882b028e362cc71a36ef9de77f104911d751579.tar.bz2
PR 10165
* winduni.c (wind_MultiByteToWideChar): Do not pass MB_PRECOMPOSED to MultiByteToWideChar when using the CP_UTF8 or CO_UTF7 types.
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/winduni.c10
2 files changed, 15 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index dc4f09b..b0a9be5 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,9 @@
+2009-06-09 Tom Bramer <tjb@postpro.net>
+
+ PR 10165
+ * winduni.c (wind_MultiByteToWideChar): Do not pass MB_PRECOMPOSED
+ to MultiByteToWideChar when using the CP_UTF8 or CO_UTF7 types.
+
2009-06-04 Alan Modra <amodra@bigpond.net.au>
* strings.c (main): Delay parsing of decimal digits.
diff --git a/binutils/winduni.c b/binutils/winduni.c
index f811de7..8b39af1 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);