mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +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
|
||||
CharPrevA(LPCSTR start, LPCSTR ptr)
|
||||
{
|
||||
while (*start && (start < ptr))
|
||||
if (ptr > start)
|
||||
{
|
||||
LPCSTR next = CharNextA(start);
|
||||
if (next >= ptr) break;
|
||||
start = next;
|
||||
--ptr;
|
||||
if (gpsi->dwSRVIFlags & SRVINFO_DBCSENABLED)
|
||||
{
|
||||
LPCSTR ch;
|
||||
BOOL dbl = FALSE;
|
||||
|
||||
for (ch = ptr - 1; ch >= start; --ch)
|
||||
{
|
||||
if (!IsDBCSLeadByte(*ch))
|
||||
break;
|
||||
|
||||
dbl = !dbl;
|
||||
}
|
||||
if (dbl) --ptr;
|
||||
}
|
||||
}
|
||||
return (LPSTR)start;
|
||||
return (LPSTR)ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -164,13 +176,22 @@ LPSTR
|
|||
WINAPI
|
||||
CharPrevExA(WORD codepage, LPCSTR start, LPCSTR ptr, DWORD flags)
|
||||
{
|
||||
while (*start && (start < ptr))
|
||||
if (ptr > start)
|
||||
{
|
||||
LPCSTR next = CharNextExA(codepage, start, flags);
|
||||
if (next >= ptr) break;
|
||||
start = next;
|
||||
LPCSTR ch;
|
||||
BOOL dbl = FALSE;
|
||||
|
||||
--ptr;
|
||||
for (ch = ptr - 1; ch >= start; --ch)
|
||||
{
|
||||
if (!IsDBCSLeadByteEx(codepage, *ch))
|
||||
break;
|
||||
|
||||
dbl = !dbl;
|
||||
}
|
||||
if (dbl) --ptr;
|
||||
}
|
||||
return (LPSTR)start;
|
||||
return (LPSTR)ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue