Alexandre Julliard : libwine: Properly increment source pointer for surrogates in wine_utf8_wcstombs.

Alexandre Julliard julliard at winehq.org
Mon Jan 21 05:59:04 CST 2008


Module: wine
Branch: master
Commit: bc3a5bad0f791986bfa41432e222e62b8a2e5f8d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bc3a5bad0f791986bfa41432e222e62b8a2e5f8d

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jan 21 12:40:57 2008 +0100

libwine: Properly increment source pointer for surrogates in wine_utf8_wcstombs.

Spotted by Ken Thomases.

---

 libs/wine/utf8.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libs/wine/utf8.c b/libs/wine/utf8.c
index 14cdb9d..fcbbeb0 100644
--- a/libs/wine/utf8.c
+++ b/libs/wine/utf8.c
@@ -82,7 +82,11 @@ static inline int get_length_wcs_utf8( int flags, const WCHAR *src, unsigned int
         if (val < 0x10000)  /* 0x800-0xffff: 3 bytes */
             len += 3;
         else   /* 0x10000-0x10ffff: 4 bytes */
+        {
             len += 4;
+            src++;
+            srclen--;
+        }
     }
     return len;
 }
@@ -144,6 +148,8 @@ int wine_utf8_wcstombs( int flags, const WCHAR *src, int srclen, char *dst, int
             val >>= 6;
             dst[0] = 0xf0 | val;
             dst += 4;
+            src++;
+            srclen--;
         }
     }
     return dstlen - len;




More information about the wine-cvs mailing list