PATCH: mbsnbcnt

Marcus Meissner marcus at jet.franken.de
Tue Sep 4 11:12:39 CDT 2001


Hi,

Ciao, Marcus
Changelog:
	Implement mbsnbcnt, added stubs for _Gettnames and __lc_collate_cp.

Index: msvcrt.spec
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/msvcrt.spec,v
retrieving revision 1.21
diff -u -r1.21 msvcrt.spec
--- msvcrt.spec	2001/08/10 22:24:54	1.21
+++ msvcrt.spec	2001/09/04 15:03:44
@@ -367,7 +367,7 @@
 @ cdecl _mbslwr(str) _mbslwr
 @ stub _mbsnbcat #(str str long)
 @ cdecl _mbsnbcmp(str str long) _mbsnbcmp
-@ stub _mbsnbcnt #(ptr long)
+@ cdecl _mbsnbcnt (ptr long) _mbsnbcnt
 @ stub _mbsnbcoll #(str str long)
 @ cdecl _mbsnbcpy(ptr str long) _mbsnbcpy
 @ stub _mbsnbicmp #(str str long)
@@ -768,3 +768,5 @@
 @ cdecl wctomb(ptr long) MSVCRT_wctomb
 @ varargs wprintf(wstr) MSVCRT_wprintf
 @ stub wscanf #(wstr) varargs
+@ stub _Gettnames
+@ stub __lc_collate_cp
Index: mbcs.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/mbcs.c,v
retrieving revision 1.11
diff -u -r1.11 mbcs.c
--- mbcs.c	2001/08/10 22:24:54	1.11
+++ mbcs.c	2001/09/04 15:03:44
@@ -446,6 +446,7 @@
 
 /*********************************************************************
  *		_mbsnccnt(MSVCRT.@)
+ * 'c' is for 'character'.
  */
 unsigned int _mbsnccnt(const unsigned char *str, unsigned int len)
 {
@@ -468,6 +469,30 @@
   return min(strlen(str), len); /* ASCII CP */
 }
 
+/*********************************************************************
+ *		_mbsnbcnt(MSVCRT.@)
+ * 'b' is for byte count.
+ */
+unsigned int _mbsnbcnt(const unsigned char *str, unsigned int len)
+{
+  const unsigned char *xstr = str;
+
+  if(MSVCRT___mb_cur_max > 1)
+  {
+    while(*xstr && len-- > 0)
+    {
+      if(MSVCRT_isleadbyte(*xstr))
+      {
+        xstr++;
+        len--;
+      }
+      xstr++;
+    }
+    return xstr-str;
+  }
+  return min(strlen(str), len); /* ASCII CP */
+}
+
 
 /*********************************************************************
  *		_mbsncat(MSVCRT.@)




More information about the wine-patches mailing list