svn path=/trunk/; revision=6868
This commit is contained in:
Filip Navara 2003-12-06 20:58:27 +00:00
parent ba1e3f3b39
commit 6d529771a4
5 changed files with 40 additions and 26 deletions

View file

@ -4,7 +4,7 @@
/*
* @unimplemented
*/
int isleadbyte(char *mbstr)
int isleadbyte(int byte)
{
return 0;
//return IsDBCSLeadByteEx(0,*c);

View file

@ -1,4 +1,7 @@
#include <msvcrt/mbstring.h>
int isleadbyte(int byte);
/*
* not correct
*
@ -6,14 +9,17 @@
*/
unsigned char * _mbspbrk(const unsigned char *s1, const unsigned char *s2)
{
const char *scanp;
int c, sc;
const unsigned char* p;
while ((c = *s1++) != 0)
while (*s1)
{
for (scanp = s2; (sc = *scanp++) != 0;)
if (sc == c)
return (unsigned char *)((char *)s1 - (char *)1);
for (p = s2; *p; p += (isleadbyte(*p) ? 2 : 1))
{
if (*p == *s1)
if (!isleadbyte(*p) || (*(p+1) == *(s1 + 1)))
return (unsigned char*)s1;
}
s1 += (isleadbyte(*s1) ? 2 : 1);
}
return 0;
return NULL;
}

View file

@ -10,24 +10,32 @@
#include <msvcrt/mbstring.h>
size_t _mbclen2(const unsigned int s);
char *strrchr(const char* szSearch, int cFor);
extern int __mb_cur_max;
/*
* @implemented
*/
unsigned char * _mbsrchr(const unsigned char *src, unsigned int val)
{
char *s = (char *)src;
short cc = val;
const char *sp=(char *)0;
if (__mb_cur_max > 1)
{
unsigned int c;
unsigned char *match = NULL;
while (*s)
{
if (*(short *)s == cc)
sp = s;
s+= _mbclen2(*s);
}
if (cc == 0)
sp = s;
return (char *)sp;
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;
}
}
return strrchr(src, val);
}

View file

@ -10,7 +10,7 @@
BOOL FASTCALL
IntRedrawWindow(PWINDOW_OBJECT Wnd, const RECT* UpdateRect, HRGN UpdateRgn, ULONG Flags);
BOOL FASTCALL
IntGetPaintMessage(PWINDOW_OBJECT Window, PW32THREAD Thread, MSG *Message, BOOL Remove);
IntGetPaintMessage(HWND hWnd, PW32THREAD Thread, MSG *Message, BOOL Remove);
BOOL STDCALL
NtUserValidateRgn(HWND hWnd, HRGN hRgn);

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: painting.c,v 1.40 2003/11/30 20:03:47 navaraf Exp $
* $Id: painting.c,v 1.41 2003/12/06 20:58:27 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -678,7 +678,7 @@ IntFindWindowToRepaint(HWND hWnd, PW32THREAD Thread)
}
BOOL FASTCALL
IntGetPaintMessage(PWINDOW_OBJECT Wnd, PW32THREAD Thread, MSG *Message,
IntGetPaintMessage(HWND hWnd, PW32THREAD Thread, MSG *Message,
BOOL Remove)
{
PWINDOW_OBJECT Window;
@ -687,8 +687,8 @@ IntGetPaintMessage(PWINDOW_OBJECT Wnd, PW32THREAD Thread, MSG *Message,
if (!MessageQueue->PaintPosted)
return FALSE;
if (Wnd)
Message->hwnd = IntFindWindowToRepaint(Wnd->Self, PsGetWin32Thread());
if (hWnd)
Message->hwnd = IntFindWindowToRepaint(hWnd, PsGetWin32Thread());
else
Message->hwnd = IntFindWindowToRepaint(NULL, PsGetWin32Thread());