msvcrt: implement _mbbtype according to MSDN

Juan Lang juan_lang at yahoo.com
Mon Feb 5 17:34:31 CST 2007


This is admittedly ugly, it just gets bug 7224 a little further.

ChangeLog: implement _mbbtype according to MSDN

--Juan


 
____________________________________________________________________________________
Any questions? Get answers on any topic at www.Answers.yahoo.com.  Try it now.
-------------- next part --------------
>From 6165cdebfd145cc7fd75435751366a855e267335 Mon Sep 17 00:00:00 2001
From: Juan Lang <juan at juandell.gateway.2wire.net>
Date: Thu, 25 Jan 2007 00:50:10 -0800
Subject: [PATCH] Implement _mbbtype according to MSDN

---
 dlls/msvcrt/mbcs.c      |   26 ++++++++++++++++++++++++++
 dlls/msvcrt/msvcrt.spec |    2 +-
 2 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c
index 91549eb..8fa114a 100644
--- a/dlls/msvcrt/mbcs.c
+++ b/dlls/msvcrt/mbcs.c
@@ -26,6 +26,7 @@
 #include "msvcrt.h"
 #include "wine/unicode.h"
 #include "wine/debug.h"
+#include "msvcrt/mbctype.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
 
@@ -740,6 +741,31 @@ unsigned int CDECL _mbbtombc(unsigned int c)
 }
 
 /*********************************************************************
+ *		_mbbtype(MSVCRT.@)
+ */
+int CDECL _mbbtype(unsigned char c, int type)
+{
+    if (type == 1)
+    {
+        if ((c >= 0x20 && c <= 0x7e) || (c >= 0xa1 && c <= 0xdf))
+            return _MBC_SINGLE;
+        else if ((c >= 0x40 && c <= 0x7e) || (c >= 0x80 && c <= 0xfc))
+            return _MBC_TRAIL;
+        else
+            return _MBC_ILLEGAL;
+    }
+    else
+    {
+        if ((c >= 0x20 && c <= 0x7e) || (c >= 0xa1 && c <= 0xdf))
+            return _MBC_SINGLE;
+        else if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfc))
+            return _MBC_LEAD;
+        else
+            return _MBC_ILLEGAL;
+    }
+}
+
+/*********************************************************************
  *		_ismbbkana(MSVCRT.@)
  */
 int CDECL _ismbbkana(unsigned int c)
diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec
index 165ad42..1cfc418 100644
--- a/dlls/msvcrt/msvcrt.spec
+++ b/dlls/msvcrt/msvcrt.spec
@@ -337,7 +337,7 @@
 @ cdecl _makepath(str str str str str)
 @ cdecl _matherr(ptr) MSVCRT__matherr
 @ cdecl _mbbtombc(long)
-@ stub _mbbtype #(long long)
+@ cdecl _mbbtype (long long)
 # extern _mbcasemap
 @ cdecl _mbccpy (str str)
 @ stub _mbcjistojms #(long)
-- 
1.4.4.2



More information about the wine-patches mailing list