From: Changhui LIU Subject: libwine: Make mbstowcs_dbcs return real converted chars when srclen is 1, len is 0 and *scr is partial char. Message-Id: Date: Wed, 3 Feb 2016 16:03:55 +0800 -- Regards, Changhui Liu From 293e8881ed78d5a65e11cae91c94c7bf45a8675c Mon Sep 17 00:00:00 2001 From: Changhui Liu Date: Wed, 3 Feb 2016 14:58:41 +0800 Subject: libwine: Make mbstowcs_dbcs return real converted chars when srclen is 1, len is 0 and *scr is partial char. To: wine-patches Reply-To: wine-devel So the MultiByteToWideChar function can have the same behavior like Microsoft Windows's implement. Signed-off-by: Changhui Liu --- libs/wine/mbtowc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/wine/mbtowc.c b/libs/wine/mbtowc.c index 1995b31..b290a48 100644 --- a/libs/wine/mbtowc.c +++ b/libs/wine/mbtowc.c @@ -206,7 +206,7 @@ static inline int mbstowcs_dbcs( const struct dbcs_table *table, } else *dst = cp2uni[*src]; } - if (srclen) return -1; /* overflow */ + if ((srclen > 1) || (1 == srclen && 0 == cp2uni_lb[*src])) return -1; /* overflow */ return dstlen - len; } -- 1.9.1