kernel32: MultiByteToWideChar: MB_USEGLYPHCHARS fix

Andrew O. Shadoura bugzilla at tut.by
Sat Mar 10 17:25:04 CST 2007


Hello All!

This patch implements MB_USEGLYPHCHARS flag in MultiByteToWideChar function.
It works, just tested. Maybe, the style is bad, but this is my very first
contribution to WINE.

==================== here clipboard begins ====================
diff -u -p ori/dlls/kernel32/locale.c mod/dlls/kernel32/locale.c
--- ori/dlls/kernel32/locale.c       2007-03-02 18:12:43.000000000 +0200
+++ mod/dlls/kernel32/locale.c       2007-03-11 00:23:21.000000000 +0200
@@ -70,6 +70,13 @@ static const WCHAR szNlsKeyName[] = {
     'C','o','n','t','r','o','l','\\','N','l','s','\0'
 };

+static const WCHAR glyph_xlat[32] = {
+    0x0000, 0x263A, 0x263B, 0x2665, 0x2666, 0x2663, 0x2662, 0x2219,
+    0x25D8, 0x25CB, 0x25D9, 0x2642, 0x2640, 0x266A, 0x266B, 0x263C,
+    0x25BA, 0x25C4, 0x2195, 0x203C, 0x00B6, 0x00A7, 0x25AC, 0x21A8,
+    0x2191, 0x2193, 0x2192, 0x2190, 0x221F, 0x2194, 0x25B2, 0x25BC
+};
+
 /* Charset to codepage map, sorted by name. */
 static const struct charset_entry
 {
@@ -1763,8 +1770,10 @@ INT WINAPI MultiByteToWideChar( UINT pag
                                 LPWSTR dst, INT dstlen )
 {
     const union cptable *table;
-    int ret;
+    int i,ret;
+#if 0
     static int once;
+#endif

     if (!src || (!dst && dstlen))
     {
@@ -1774,11 +1783,13 @@ INT WINAPI MultiByteToWideChar( UINT pag

     if (srclen < 0) srclen = strlen(src) + 1;

+#if 0
     if (!once && (flags & MB_USEGLYPHCHARS))
     {
         once = 1;
         FIXME("MB_USEGLYPHCHARS not supported\n");
     }
+#endif

     switch(page)
     {
@@ -1814,6 +1825,11 @@ INT WINAPI MultiByteToWideChar( UINT pag
         break;
     }

+    if (flags & MB_USEGLYPHCHARS) {
+       for (i=0; i!=dstlen; i++)
+           if (dst[i]<0x20) dst[i]=glyph_xlat[dst[i]];
+    }
+
     if (ret < 0)
     {
         switch(ret)
==================== here clipboard ends ====================

 -- WBR, Andrew O. Shadoura

--- PolySoft Station
 * Origin: Knowledge itself is a power (2:4500/1.25)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: locale.c.diff
Type: application/octet-stream
Size: 1489 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20070311/6504ea51/locale.c-0001.obj


More information about the wine-patches mailing list