Commit ab525d3f authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

msvcrt: Reimplement _mbsspnp using _mbsspn.

parent f0f93c79
......@@ -2028,19 +2028,26 @@ int CDECL _mbsupr_s(unsigned char* s, MSVCRT_size_t len)
MSVCRT_size_t CDECL _mbsspn(const unsigned char* string, const unsigned char* set)
{
const unsigned char *p, *q;
unsigned int pc, qc;
for (p = string; *p; p++)
{
pc = _mbsnextc(p);
for (q = set; *q; q++)
{
qc = _mbsnextc(q);
if (pc == qc) break;
if (qc > 255 && q[1]) q++;
if (_ismbblead(*q))
{
if (p[0] == q[0] && p[1] == q[1])
{
p++;
break;
}
q++;
}
else
{
if (p[0] == q[0]) break;
}
}
if (!*q) break;
if (pc > 255 && p[1]) p++;
}
return p - string;
}
......@@ -2050,32 +2057,8 @@ MSVCRT_size_t CDECL _mbsspn(const unsigned char* string, const unsigned char* se
*/
unsigned char* CDECL _mbsspnp(const unsigned char* string, const unsigned char* set)
{
const unsigned char *p, *q;
for (p = string; *p; p++)
{
if (_ismbblead(*p))
{
for (q = set; *q; q += 2)
{
if (!q[1])
break;
if ((*p == *q) && (p[1] == q[1]))
break;
}
if (!q[0] || !q[1]) break;
}
else
{
for (q = set; *q; q++)
if (*p == *q)
break;
if (!*q) break;
}
}
if (*p == '\0')
return NULL;
return (unsigned char *)p;
string += _mbsspn( string, set );
return *string ? (unsigned char*)string : NULL;
}
/*********************************************************************
......
......@@ -565,13 +565,13 @@ static void test_mbsspnp( void)
_setmbcp( 932);
ret=_mbsspnp( mbstr, mbset1);
todo_wine ok( ret==mbstr+8, "_mbsspnp returns %p should be %p\n", ret, mbstr+8);
ok( ret==mbstr+8, "_mbsspnp returns %p should be %p\n", ret, mbstr+8);
ret=_mbsspnp( mbstr, mbset2);
ok( ret==mbstr+1, "_mbsspnp returns %p should be %p\n", ret, mbstr+1);
ret=_mbsspnp( mbstr+8, mbset1);
ok( ret==mbstr+8, "_mbsspnp returns %p should be %p\n", ret, mbstr+8);
ret=_mbsspnp( mbstr+8, mbset2);
todo_wine ok( ret==mbstr+10, "_mbsspnp returns %p should be %p\n", ret, mbstr+10);
ok( ret==mbstr+10, "_mbsspnp returns %p should be %p\n", ret, mbstr+10);
_setmbcp( cp);
}
......
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