Re: implement _mbsnbcat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Alexandre,

please use the attached patch instead (license and changelog are the
same). The previous patch worked correctly only if the lead byte and
trail byte character sets are disjoint but that's not the case.

bye
	michael

On Sun, Feb 02, 2003 at 09:22:46PM +0100, Michael Stefaniuc wrote:
> This patch makes ACT!2000 run with the builtin msvcrt. The
> implementation of _mbsnbcat is based on that of _mbsncat.
> 
> License: LGPL, X11
> Changelog:
> 	Michael Stefaniuc <mstefani@redhat.com>
> 	- implement _mbsnbcat

-- 
Michael Stefaniuc               Tel.: +49-711-96437-199
System Administration           Fax.: +49-711-96437-111
Red Hat GmbH                    Email: mstefani@redhat.com
Hauptstaetterstr. 58            http://www.redhat.de/
D-70178 Stuttgart
Index: dlls/msvcrt/mbcs.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/mbcs.c,v
retrieving revision 1.24
diff -u -r1.24 mbcs.c
--- dlls/msvcrt/mbcs.c	1 Feb 2003 00:59:22 -0000	1.24
+++ dlls/msvcrt/mbcs.c	3 Feb 2003 19:08:08 -0000
@@ -934,6 +934,35 @@
 
 
 /*********************************************************************
+ *		_mbsnbcat(MSVCRT.@)
+ */
+unsigned char* _mbsnbcat(unsigned char* dst, const unsigned char* src, MSVCRT_size_t len)
+{
+    if(MSVCRT___mb_cur_max > 1)
+    {
+        char *res = dst;
+        while (*dst) {
+	    if (MSVCRT_isleadbyte(*dst++)) {
+		if (*dst) {
+		    dst++;
+		} else {
+		    /* as per msdn overwrite the lead byte in front of '\0' */
+		    dst--;
+		    break;
+		}
+	    }
+	}
+        while (*src && len--) {
+            *dst++ = *src;
+        }
+        *dst = '\0';
+        return res;
+    }
+    return strncat(dst, src, len); /* ASCII CP */
+}
+
+
+/*********************************************************************
  *		_mbsncat(MSVCRT.@)
  */
 unsigned char* _mbsncat(unsigned char* dst, const unsigned char* src, MSVCRT_size_t len)
Index: dlls/msvcrt/msvcrt.spec
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/msvcrt.spec,v
retrieving revision 1.61
diff -u -r1.61 msvcrt.spec
--- dlls/msvcrt/msvcrt.spec	1 Feb 2003 00:45:22 -0000	1.61
+++ dlls/msvcrt/msvcrt.spec	3 Feb 2003 19:08:08 -0000
@@ -359,7 +359,7 @@
 @ cdecl _mbsinc(str) _mbsinc
 @ cdecl _mbslen(str) _mbslen
 @ cdecl _mbslwr(str) _mbslwr
-@ stub _mbsnbcat #(str str long)
+@ cdecl _mbsnbcat (str str long) _mbsnbcat
 @ cdecl _mbsnbcmp(str str long) _mbsnbcmp
 @ cdecl _mbsnbcnt(ptr long) _mbsnbcnt
 @ stub _mbsnbcoll #(str str long)

Attachment: pgp00102.pgp
Description: PGP signature


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux