Module: wine Branch: master Commit: 464c956a0a0c81d3871362630e0647a5c1ebd010 URL: http://source.winehq.org/git/wine.git/?a=commit;h=464c956a0a0c81d3871362630e...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Jul 24 10:40:32 2009 +0200
libwine: Fix the wctomb validity check for codepages where the default chars don't convert to each other.
---
libs/wine/wctomb.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/libs/wine/wctomb.c b/libs/wine/wctomb.c index 966e6af..3b081d4 100644 --- a/libs/wine/wctomb.c +++ b/libs/wine/wctomb.c @@ -69,9 +69,9 @@ WCHAR compose( const WCHAR *str ) static inline int is_valid_sbcs_mapping( const struct sbcs_table *table, int flags, WCHAR wch, unsigned char ch ) { - if (flags & WC_NO_BEST_FIT_CHARS) return (table->cp2uni[ch] == wch); - if (ch != (unsigned char)table->info.def_char) return 1; - return (wch == table->info.def_unicode_char); + if ((flags & WC_NO_BEST_FIT_CHARS) || ch == (unsigned char)table->info.def_char) + return (table->cp2uni[ch] == wch); + return 1; }
/* query necessary dst length for src string */ @@ -262,8 +262,7 @@ static int wcstombs_sbcs_slow( const struct sbcs_table *table, int flags, static inline int is_valid_dbcs_mapping( const struct dbcs_table *table, int flags, WCHAR wch, unsigned short ch ) { - if (ch == table->info.def_char && wch != table->info.def_unicode_char) return 0; - if (flags & WC_NO_BEST_FIT_CHARS) + if ((flags & WC_NO_BEST_FIT_CHARS) || ch == table->info.def_char) { /* check if char maps back to the same Unicode value */ if (ch & 0xff00)