Commit ec4a5f63 authored by Bartosz Kosiorek's avatar Bartosz Kosiorek Committed by Alexandre Julliard

msvcrt: Add _mbspbrk_l implementation.

parent 0b63da6a
...@@ -1174,7 +1174,7 @@ ...@@ -1174,7 +1174,7 @@
@ stub _mbsnset_s @ stub _mbsnset_s
@ stub _mbsnset_s_l @ stub _mbsnset_s_l
@ cdecl _mbspbrk(str str) @ cdecl _mbspbrk(str str)
@ stub _mbspbrk_l @ cdecl _mbspbrk_l(str str ptr)
@ cdecl _mbsrchr(str long) @ cdecl _mbsrchr(str long)
@ cdecl _mbsrchr_l(str long ptr) @ cdecl _mbsrchr_l(str long ptr)
@ cdecl _mbsrev(str) @ cdecl _mbsrev(str)
......
...@@ -1531,7 +1531,7 @@ ...@@ -1531,7 +1531,7 @@
@ stub _mbsnset_s @ stub _mbsnset_s
@ stub _mbsnset_s_l @ stub _mbsnset_s_l
@ cdecl _mbspbrk(str str) @ cdecl _mbspbrk(str str)
@ stub _mbspbrk_l @ cdecl _mbspbrk_l(str str ptr)
@ cdecl _mbsrchr(str long) @ cdecl _mbsrchr(str long)
@ cdecl _mbsrchr_l(str long ptr) @ cdecl _mbsrchr_l(str long ptr)
@ cdecl _mbsrev(str) @ cdecl _mbsrev(str)
......
...@@ -1542,7 +1542,7 @@ ...@@ -1542,7 +1542,7 @@
@ stub _mbsnset_s @ stub _mbsnset_s
@ stub _mbsnset_s_l @ stub _mbsnset_s_l
@ cdecl _mbspbrk(str str) @ cdecl _mbspbrk(str str)
@ stub _mbspbrk_l @ cdecl _mbspbrk_l(str str ptr)
@ cdecl _mbsrchr(str long) @ cdecl _mbsrchr(str long)
@ cdecl _mbsrchr_l(str long ptr) @ cdecl _mbsrchr_l(str long ptr)
@ cdecl _mbsrev(str) @ cdecl _mbsrev(str)
......
...@@ -846,7 +846,7 @@ ...@@ -846,7 +846,7 @@
@ stub _mbsnset_s @ stub _mbsnset_s
@ stub _mbsnset_s_l @ stub _mbsnset_s_l
@ cdecl _mbspbrk(str str) @ cdecl _mbspbrk(str str)
@ stub _mbspbrk_l @ cdecl _mbspbrk_l(str str ptr)
@ cdecl _mbsrchr(str long) @ cdecl _mbsrchr(str long)
@ cdecl _mbsrchr_l(str long ptr) @ cdecl _mbsrchr_l(str long ptr)
@ cdecl _mbsrev(str) @ cdecl _mbsrev(str)
......
...@@ -824,7 +824,7 @@ ...@@ -824,7 +824,7 @@
@ stub _mbsnset_s @ stub _mbsnset_s
@ stub _mbsnset_s_l @ stub _mbsnset_s_l
@ cdecl _mbspbrk(str str) @ cdecl _mbspbrk(str str)
@ stub _mbspbrk_l @ cdecl _mbspbrk_l(str str ptr)
@ cdecl _mbsrchr(str long) @ cdecl _mbsrchr(str long)
@ cdecl _mbsrchr_l(str long ptr) @ cdecl _mbsrchr_l(str long ptr)
@ cdecl _mbsrev(str) @ cdecl _mbsrev(str)
......
...@@ -150,6 +150,11 @@ static inline unsigned char *u_strchr( const unsigned char *s, unsigned char x ) ...@@ -150,6 +150,11 @@ static inline unsigned char *u_strchr( const unsigned char *s, unsigned char x )
return (unsigned char*) strchr( (const char*)s, x ); return (unsigned char*) strchr( (const char*)s, x );
} }
static inline unsigned char* u_strpbrk(const unsigned char *str, const unsigned char *accept)
{
return (unsigned char*)strpbrk((const char*)str, (const char*)accept);
}
static inline unsigned char *u_strrchr( const unsigned char *s, unsigned char x ) static inline unsigned char *u_strrchr( const unsigned char *s, unsigned char x )
{ {
return (unsigned char*) strrchr( (const char*)s, x ); return (unsigned char*) strrchr( (const char*)s, x );
...@@ -2871,25 +2876,45 @@ unsigned char* CDECL _mbsrev(unsigned char* str) ...@@ -2871,25 +2876,45 @@ unsigned char* CDECL _mbsrev(unsigned char* str)
} }
/********************************************************************* /*********************************************************************
* _mbspbrk (MSVCRT.@) * _mbspbrk_l (MSVCRT.@)
*/ */
unsigned char* CDECL _mbspbrk(const unsigned char* str, const unsigned char* accept) unsigned char* CDECL _mbspbrk_l(const unsigned char *str,
const unsigned char *accept, _locale_t locale)
{ {
const unsigned char* p; const unsigned char* p;
pthreadmbcinfo mbcinfo;
if (locale)
mbcinfo = locale->mbcinfo;
else
mbcinfo = get_mbcinfo();
if (!mbcinfo->ismbcodepage)
return u_strpbrk(str, accept);
while(*str) if (!MSVCRT_CHECK_PMT(str && accept))
return NULL;
while (*str)
{ {
for(p = accept; *p; p += (_ismbblead(*p)?2:1) ) for (p = accept; *p; p += (_ismbblead_l(*p, locale) ? 2 : 1))
{ {
if (*p == *str) if (*p == *str)
if( !_ismbblead(*p) || ( *(p+1) == *(str+1) ) ) if (!_ismbblead_l(*p, locale) || p[1] == str[1])
return (unsigned char*)str; return (unsigned char*)str;
} }
str += (_ismbblead(*str)?2:1); str += (_ismbblead_l(*str, locale) ? 2 : 1);
} }
return NULL; return NULL;
} }
/*********************************************************************
* _mbspbrk (MSVCRT.@)
*/
unsigned char* CDECL _mbspbrk(const unsigned char *str, const unsigned char *accept)
{
return _mbspbrk_l(str, accept, NULL);
}
/* /*
* Functions depending on locale codepage * Functions depending on locale codepage
......
...@@ -795,7 +795,7 @@ ...@@ -795,7 +795,7 @@
# stub _mbsnset_s(ptr long long long) # stub _mbsnset_s(ptr long long long)
# stub _mbsnset_s_l(ptr long long long ptr) # stub _mbsnset_s_l(ptr long long long ptr)
@ cdecl _mbspbrk(str str) @ cdecl _mbspbrk(str str)
# stub _mbspbrk_l(str str ptr) @ cdecl _mbspbrk_l(str str ptr)
@ cdecl _mbsrchr(str long) @ cdecl _mbsrchr(str long)
@ cdecl _mbsrchr_l(str long ptr) @ cdecl _mbsrchr_l(str long ptr)
@ cdecl _mbsrev(str) @ cdecl _mbsrev(str)
......
...@@ -690,7 +690,7 @@ ...@@ -690,7 +690,7 @@
@ stub _mbsnset_s @ stub _mbsnset_s
@ stub _mbsnset_s_l @ stub _mbsnset_s_l
@ cdecl _mbspbrk(str str) @ cdecl _mbspbrk(str str)
@ stub _mbspbrk_l @ cdecl _mbspbrk_l(str str ptr)
@ cdecl _mbsrchr(str long) @ cdecl _mbsrchr(str long)
@ cdecl _mbsrchr_l(str long ptr) @ cdecl _mbsrchr_l(str long ptr)
@ cdecl _mbsrev(str) @ cdecl _mbsrev(str)
...@@ -1259,7 +1259,7 @@ ...@@ -1259,7 +1259,7 @@
@ stub _o__mbsnset_s @ stub _o__mbsnset_s
@ stub _o__mbsnset_s_l @ stub _o__mbsnset_s_l
@ cdecl _o__mbspbrk(str str) _mbspbrk @ cdecl _o__mbspbrk(str str) _mbspbrk
@ stub _o__mbspbrk_l @ cdecl _o__mbspbrk_l(str str ptr) _mbspbrk_l
@ cdecl _o__mbsrchr(str long) _mbsrchr @ cdecl _o__mbsrchr(str long) _mbsrchr
@ cdecl _o__mbsrchr_l(str long ptr) _mbsrchr_l @ cdecl _o__mbsrchr_l(str long ptr) _mbsrchr_l
@ cdecl _o__mbsrev(str) _mbsrev @ cdecl _o__mbsrev(str) _mbsrev
......
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