mirror of
https://github.com/reactos/reactos.git
synced 2025-04-27 17:10:22 +00:00
[USER32] Rewrite CharPrev(Ex)A functions and fix tests (#4860)
Fixes 48 failing tests of user32:CharFuncs. Only 12 minor failing tests are left! Thanks to Simone Mario Lombardo for the problem analysis! CORE-18415 CORE-18452
This commit is contained in:
parent
6b53f6d824
commit
51f78918da
1 changed files with 31 additions and 10 deletions
|
@ -148,13 +148,25 @@ LPSTR
|
||||||
WINAPI
|
WINAPI
|
||||||
CharPrevA(LPCSTR start, LPCSTR ptr)
|
CharPrevA(LPCSTR start, LPCSTR ptr)
|
||||||
{
|
{
|
||||||
while (*start && (start < ptr))
|
if (ptr > start)
|
||||||
{
|
{
|
||||||
LPCSTR next = CharNextA(start);
|
--ptr;
|
||||||
if (next >= ptr) break;
|
if (gpsi->dwSRVIFlags & SRVINFO_DBCSENABLED)
|
||||||
start = next;
|
{
|
||||||
|
LPCSTR ch;
|
||||||
|
BOOL dbl = FALSE;
|
||||||
|
|
||||||
|
for (ch = ptr - 1; ch >= start; --ch)
|
||||||
|
{
|
||||||
|
if (!IsDBCSLeadByte(*ch))
|
||||||
|
break;
|
||||||
|
|
||||||
|
dbl = !dbl;
|
||||||
}
|
}
|
||||||
return (LPSTR)start;
|
if (dbl) --ptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (LPSTR)ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -164,13 +176,22 @@ LPSTR
|
||||||
WINAPI
|
WINAPI
|
||||||
CharPrevExA(WORD codepage, LPCSTR start, LPCSTR ptr, DWORD flags)
|
CharPrevExA(WORD codepage, LPCSTR start, LPCSTR ptr, DWORD flags)
|
||||||
{
|
{
|
||||||
while (*start && (start < ptr))
|
if (ptr > start)
|
||||||
{
|
{
|
||||||
LPCSTR next = CharNextExA(codepage, start, flags);
|
LPCSTR ch;
|
||||||
if (next >= ptr) break;
|
BOOL dbl = FALSE;
|
||||||
start = next;
|
|
||||||
|
--ptr;
|
||||||
|
for (ch = ptr - 1; ch >= start; --ch)
|
||||||
|
{
|
||||||
|
if (!IsDBCSLeadByteEx(codepage, *ch))
|
||||||
|
break;
|
||||||
|
|
||||||
|
dbl = !dbl;
|
||||||
}
|
}
|
||||||
return (LPSTR)start;
|
if (dbl) --ptr;
|
||||||
|
}
|
||||||
|
return (LPSTR)ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue