Implemented _mbstok and _mbsnbset.
This commit is contained in:
parent
0e85f48f9d
commit
d76455df74
|
@ -550,6 +550,41 @@ unsigned char* _mbsrchr(const unsigned char* s, unsigned int x)
|
||||||
return strrchr(s,x);
|
return strrchr(s,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.@)
|
||||||
*/
|
*/
|
||||||
|
@ -792,6 +827,36 @@ unsigned char* _mbsset(unsigned char* str, unsigned int c)
|
||||||
return ret;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/*********************************************************************
|
/*********************************************************************
|
||||||
* _mbsnset(MSVCRT.@)
|
* _mbsnset(MSVCRT.@)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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 @@
|
||||||
@ 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
|
||||||
|
|
Loading…
Reference in New Issue