PATCH: implement _mbstok and _mbsnbset

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

 



Hello,

implementing _mbstok and _mbsnbset lets the ACT! 2000 installer to
finish its job. The implementation is based on existing related
functions.

License: LGPL, X11
Changelog:
	Michael Stefaniuc <mstefani@redhat.com>
	- implement _mbstok and _mbsnbset

bye
	michael
-- 
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.21
diff -u -r1.21 mbcs.c
--- dlls/msvcrt/mbcs.c	19 Dec 2002 04:21:30 -0000	1.21
+++ dlls/msvcrt/mbcs.c	23 Jan 2003 21:58:09 -0000
@@ -525,6 +525,45 @@
 }
 
 /*********************************************************************
+ *		_mbstok(MSVCRT.@)
+ *
+ * Find and extract tokens from strings
+ */
+unsigned char* _mbstok(unsigned char *str, const unsigned char *delim)
+{
+    static char *next = NULL;
+    char *ret;
+
+    if(MSVCRT___mb_cur_max > 1)
+    {
+	unsigned int c;
+
+	if (!str)
+    	    if (!(str = next)) return NULL;
+
+	while ((c = _mbsnextc(str)) && _mbschr(delim, c)) {
+	    str += c > 255 ? 2 : 1;
+	}
+	if (!*str) return NULL;
+	ret = str++;
+	while ((c = _mbsnextc(str)) && !_mbschr(delim, c)) {
+	    str += c > 255 ? 2 : 1;
+	}
+	if (*str) {
+	    *str++ = 0;
+	    if (c > 255) *str++ = 0;
+	}
+	next = str;
+	return ret;
+    }
+    return strtok(str, delim);	/* ASCII CP */
+}
+	    
+
+
+
+
+/*********************************************************************
  *		mbtowc(MSVCRT.@)
  */
 int MSVCRT_mbtowc(MSVCRT_wchar_t *dst, const char* str, MSVCRT_size_t n)
@@ -764,6 +803,36 @@
     str[0] = '\0'; /* FIXME: OK to shorten? */
 
   return ret;
+}
+
+/*********************************************************************
+ *		_mbsnbset(MSVCRT.@)
+ */
+unsigned char* _mbsnbset(unsigned char *str, unsigned int c, MSVCRT_size_t len)
+{
+    unsigned char *ret = str;
+
+    if(!len)
+	return ret;
+
+    if(MSVCRT___mb_cur_max == 1 || c < 256)
+	return _strnset(str, c, len); /* ASCII CP or SB char */
+
+    c &= 0xffff; /* Strip high bits */
+
+    while(str[0] && str[1] && (len > 1))
+    {
+	*str++ = c >> 8;
+	len--;
+	*str++ = c & 0xff;
+	len--;
+    }
+    if(len && str[0]) {
+	/* as per msdn pad with a blank character */
+	str[0] = ' ';
+    }
+
+    return ret;
 }
 
 /*********************************************************************
Index: dlls/msvcrt/msvcrt.spec
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/msvcrt.spec,v
retrieving revision 1.59
diff -u -r1.59 msvcrt.spec
--- dlls/msvcrt/msvcrt.spec	11 Jan 2003 21:01:04 -0000	1.59
+++ dlls/msvcrt/msvcrt.spec	23 Jan 2003 21:58:10 -0000
@@ -366,7 +366,7 @@
 @ cdecl _mbsnbcpy(ptr str long) _mbsnbcpy
 @ cdecl _mbsnbicmp(str str long) _mbsnbicmp
 @ stub _mbsnbicoll #(str str long)
-@ stub _mbsnbset #(str long long)
+@ cdecl _mbsnbset(str long long) _mbsnbset
 @ cdecl _mbsncat(str str long) _mbsncat
 @ cdecl _mbsnccnt(str long) _mbsnccnt
 @ cdecl _mbsncmp(str str long) _mbsncmp
@@ -384,7 +384,7 @@
 @ cdecl _mbsspn(str str) _mbsspn
 @ stub _mbsspnp #(str str)
 @ cdecl _mbsstr(str str) strstr
-@ stub _mbstok #(str str)
+@ cdecl _mbstok(str str) _mbstok
 @ cdecl _mbstrlen(str) _mbstrlen
 @ cdecl _mbsupr(str) _mbsupr
 @ cdecl _memccpy(ptr ptr long long) memccpy

Attachment: pgp00088.pgp
Description: PGP signature


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

  Powered by Linux