Commit 2853352c authored by Bartosz Kosiorek's avatar Bartosz Kosiorek Committed by Alexandre Julliard

msvcrt: Add _mbsrchr_l implementation.

parent 3c941962
......@@ -1176,7 +1176,7 @@
@ cdecl _mbspbrk(str str)
@ stub _mbspbrk_l
@ cdecl _mbsrchr(str long)
@ stub _mbsrchr_l
@ cdecl _mbsrchr_l(str long ptr)
@ cdecl _mbsrev(str)
@ stub _mbsrev_l
@ cdecl _mbsset(ptr long)
......
......@@ -1533,7 +1533,7 @@
@ cdecl _mbspbrk(str str)
@ stub _mbspbrk_l
@ cdecl _mbsrchr(str long)
@ stub _mbsrchr_l
@ cdecl _mbsrchr_l(str long ptr)
@ cdecl _mbsrev(str)
@ stub _mbsrev_l
@ cdecl _mbsset(ptr long)
......
......@@ -1544,7 +1544,7 @@
@ cdecl _mbspbrk(str str)
@ stub _mbspbrk_l
@ cdecl _mbsrchr(str long)
@ stub _mbsrchr_l
@ cdecl _mbsrchr_l(str long ptr)
@ cdecl _mbsrev(str)
@ stub _mbsrev_l
@ cdecl _mbsset(ptr long)
......
......@@ -848,7 +848,7 @@
@ cdecl _mbspbrk(str str)
@ stub _mbspbrk_l
@ cdecl _mbsrchr(str long)
@ stub _mbsrchr_l
@ cdecl _mbsrchr_l(str long ptr)
@ cdecl _mbsrev(str)
@ stub _mbsrev_l
@ cdecl _mbsset(ptr long)
......
......@@ -826,7 +826,7 @@
@ cdecl _mbspbrk(str str)
@ stub _mbspbrk_l
@ cdecl _mbsrchr(str long)
@ stub _mbsrchr_l
@ cdecl _mbsrchr_l(str long ptr)
@ cdecl _mbsrev(str)
@ stub _mbsrev_l
@ cdecl _mbsset(ptr long)
......
......@@ -1442,26 +1442,44 @@ unsigned char* CDECL _mbschr(const unsigned char* s, unsigned int x)
}
/*********************************************************************
* _mbsrchr_l(MSVCRT.@)
*/
unsigned char* CDECL _mbsrchr_l(const unsigned char *s, unsigned int x, _locale_t locale)
{
pthreadmbcinfo mbcinfo;
if (!MSVCRT_CHECK_PMT(s))
return NULL;
if (locale)
mbcinfo = locale->mbcinfo;
else
mbcinfo = get_mbcinfo();
if (mbcinfo->ismbcodepage)
{
unsigned char *match = NULL;
unsigned int c;
while (1)
{
c = _mbsnextc_l(s, locale);
if (c == x)
match = (unsigned char *)s;
if (!c)
return match;
s += (c > 255) ? 2 : 1;
}
}
return u_strrchr(s, x);
}
/*********************************************************************
* _mbsrchr(MSVCRT.@)
*/
unsigned char* CDECL _mbsrchr(const unsigned char* s, unsigned int x)
{
if(get_mbcinfo()->ismbcodepage)
{
unsigned int c;
unsigned char* match=NULL;
if(!s)
return NULL;
while (1) {
c = _mbsnextc(s);
if (c == x)
match=(unsigned char*)s;
if (!c)
return match;
s +=(c > 255) ? 2 : 1;
}
}
return u_strrchr(s, x);
return _mbsrchr_l(s, x, NULL);
}
/*********************************************************************
......
......@@ -797,7 +797,7 @@
@ cdecl _mbspbrk(str str)
# stub _mbspbrk_l(str str ptr)
@ cdecl _mbsrchr(str long)
# stub _mbsrchr_l(str long ptr)
@ cdecl _mbsrchr_l(str long ptr)
@ cdecl _mbsrev(str)
# stub _mbsrev_l(str ptr)
@ cdecl _mbsset(ptr long)
......
......@@ -692,7 +692,7 @@
@ cdecl _mbspbrk(str str)
@ stub _mbspbrk_l
@ cdecl _mbsrchr(str long)
@ stub _mbsrchr_l
@ cdecl _mbsrchr_l(str long ptr)
@ cdecl _mbsrev(str)
@ stub _mbsrev_l
@ cdecl _mbsset(ptr long)
......@@ -1261,7 +1261,7 @@
@ cdecl _o__mbspbrk(str str) _mbspbrk
@ stub _o__mbspbrk_l
@ cdecl _o__mbsrchr(str long) _mbsrchr
@ stub _o__mbsrchr_l
@ cdecl _o__mbsrchr_l(str long ptr) _mbsrchr_l
@ cdecl _o__mbsrev(str) _mbsrev
@ stub _o__mbsrev_l
@ cdecl _o__mbsset(ptr long) _mbsset
......
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