Modification for compatibility with crtdll.

svn path=/trunk/; revision=6879
This commit is contained in:
Filip Navara 2003-12-07 08:23:18 +00:00
parent bcee43d68f
commit 08dcc0e1a6

View file

@ -10,32 +10,24 @@
#include <msvcrt/mbstring.h>
char *strrchr(const char* szSearch, int cFor);
extern int __mb_cur_max;
/*
* @implemented
*/
unsigned char * _mbsrchr(const unsigned char *src, unsigned int val)
{
if (__mb_cur_max > 1)
unsigned int c;
unsigned char *match = NULL;
if (!src)
return NULL;
while (1)
{
unsigned int c;
unsigned char *match = NULL;
if (!src)
return NULL;
while (1)
{
c = _mbsnextc(src);
if (c == val)
match = (unsigned char*)src;
if (!c)
return match;
src += (c > 255) ? 2 : 1;
}
c = _mbsnextc(src);
if (c == val)
match = (unsigned char*)src;
if (!c)
return match;
src += (c > 255) ? 2 : 1;
}
return strrchr(src, val);
}