libwine: Make mbstowcs_dbcs return real converted chars when srclen is 1, len is 0 and *scr is partial char.

Changhui LIU chliu027028 at gmail.com
Wed Feb 3 02:03:55 CST 2016


-- 
Regards,
Changhui Liu
-------------- next part --------------
From 293e8881ed78d5a65e11cae91c94c7bf45a8675c Mon Sep 17 00:00:00 2001
From: Changhui Liu <liuchanghui at linuxdeepin.com>
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 <wine-patches at winehq.org>
Reply-To: wine-devel <wine-devel at winehq.org>

So the MultiByteToWideChar function can have the same behavior like Microsoft Windows's implement.

Signed-off-by: Changhui Liu <liuchanghui at linuxdeepin.com>
---
 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



More information about the wine-patches mailing list