msvcrt: Fix _mbsspn implementation.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com> Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c62c51c04a
commit
f0f93c791f
|
@ -2028,27 +2028,19 @@ 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++)
|
||||
{
|
||||
if (_ismbblead(*p))
|
||||
pc = _mbsnextc(p);
|
||||
for (q = set; *q; q++)
|
||||
{
|
||||
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;
|
||||
qc = _mbsnextc(q);
|
||||
if (pc == qc) break;
|
||||
if (qc > 255 && q[1]) q++;
|
||||
}
|
||||
if (!*q) break;
|
||||
if (pc > 255 && p[1]) p++;
|
||||
}
|
||||
return p - string;
|
||||
}
|
||||
|
|
|
@ -530,13 +530,13 @@ static void test_mbsspn( void)
|
|||
|
||||
_setmbcp( 932);
|
||||
ret=_mbsspn( mbstr, mbset1);
|
||||
todo_wine ok( ret==8, "_mbsspn returns %d should be 8\n", ret);
|
||||
ok( ret==8, "_mbsspn returns %d should be 8\n", ret);
|
||||
ret=_mbsspn( mbstr, mbset2);
|
||||
ok( ret==1, "_mbsspn returns %d should be 1\n", ret);
|
||||
ret=_mbsspn( mbstr+8, mbset1);
|
||||
ok( ret==0, "_mbsspn returns %d should be 0\n", ret);
|
||||
ret=_mbsspn( mbstr+8, mbset2);
|
||||
todo_wine ok( ret==2, "_mbsspn returns %d should be 2\n", ret);
|
||||
ok( ret==2, "_mbsspn returns %d should be 2\n", ret);
|
||||
|
||||
_setmbcp( cp);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue