Commit d76455df authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

Implemented _mbstok and _mbsnbset.

parent 0e85f48f
...@@ -551,6 +551,41 @@ unsigned char* _mbsrchr(const unsigned char* s, unsigned int x) ...@@ -551,6 +551,41 @@ unsigned char* _mbsrchr(const unsigned char* s, unsigned int x)
} }
/********************************************************************* /*********************************************************************
* _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.@) * mbtowc(MSVCRT.@)
*/ */
int MSVCRT_mbtowc(MSVCRT_wchar_t *dst, const char* str, MSVCRT_size_t n) int MSVCRT_mbtowc(MSVCRT_wchar_t *dst, const char* str, MSVCRT_size_t n)
...@@ -793,6 +828,36 @@ unsigned char* _mbsset(unsigned char* str, unsigned int c) ...@@ -793,6 +828,36 @@ unsigned char* _mbsset(unsigned char* str, unsigned int c)
} }
/********************************************************************* /*********************************************************************
* _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;
}
/*********************************************************************
* _mbsnset(MSVCRT.@) * _mbsnset(MSVCRT.@)
*/ */
unsigned char* _mbsnset(unsigned char* str, unsigned int c, MSVCRT_size_t len) unsigned char* _mbsnset(unsigned char* str, unsigned int c, MSVCRT_size_t len)
......
...@@ -366,7 +366,7 @@ ...@@ -366,7 +366,7 @@
@ cdecl _mbsnbcpy(ptr str long) _mbsnbcpy @ cdecl _mbsnbcpy(ptr str long) _mbsnbcpy
@ cdecl _mbsnbicmp(str str long) _mbsnbicmp @ cdecl _mbsnbicmp(str str long) _mbsnbicmp
@ stub _mbsnbicoll #(str str long) @ stub _mbsnbicoll #(str str long)
@ stub _mbsnbset #(str long long) @ cdecl _mbsnbset(str long long) _mbsnbset
@ cdecl _mbsncat(str str long) _mbsncat @ cdecl _mbsncat(str str long) _mbsncat
@ cdecl _mbsnccnt(str long) _mbsnccnt @ cdecl _mbsnccnt(str long) _mbsnccnt
@ cdecl _mbsncmp(str str long) _mbsncmp @ cdecl _mbsncmp(str str long) _mbsncmp
...@@ -384,7 +384,7 @@ ...@@ -384,7 +384,7 @@
@ cdecl _mbsspn(str str) _mbsspn @ cdecl _mbsspn(str str) _mbsspn
@ stub _mbsspnp #(str str) @ stub _mbsspnp #(str str)
@ cdecl _mbsstr(str str) strstr @ cdecl _mbsstr(str str) strstr
@ stub _mbstok #(str str) @ cdecl _mbstok(str str) _mbstok
@ cdecl _mbstrlen(str) _mbstrlen @ cdecl _mbstrlen(str) _mbstrlen
@ cdecl _mbsupr(str) _mbsupr @ cdecl _mbsupr(str) _mbsupr
@ cdecl _memccpy(ptr ptr long long) memccpy @ cdecl _memccpy(ptr ptr long long) memccpy
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment