reactos/lib/sdk/crt/mbstring/ismblead.c
Cameron Gutman 29fa274d6d - Create another branch for networking fixes
- TSVN choked repeatedly when attempting to merge ~9000 revs into the branch (tried 3 times on 2 different computers)
 - If someone wants to delete aicom-network-fixes, they are welcome to
 - Lesson learned: Letting a branch get thousands of revs out of date is a horrible idea

svn path=/branches/aicom-network-branch/; revision=44353
2009-12-02 03:23:19 +00:00

53 lines
1,004 B
C

/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/ismblead.c
* PURPOSE: Checks for a leading byte
* PROGRAMERS:
* Copyright 1999 Ariadne, Taiji Yamada
* Copyright 1999 Alexandre Julliard
* Copyright 2000 Jon Griffths
* Copyright 2008 Samuel Serapion adapted from PROJECT C Library
*
*/
#include <precomp.h>
#include <mbctype.h>
/*
* @implemented
*/
int _ismbblead(unsigned int c)
{
return (_mbctype[(c&0xff) + 1] & _M1) != 0;
}
/*
* @implemented
*/
int _ismbslead( const unsigned char *start, const unsigned char *str)
{
int lead = 0;
/* Lead bytes can also be trail bytes so we need to analyse the string
*/
while (start <= str)
{
if (!*start)
return 0;
lead = !lead && _ismbblead(*start);
start++;
}
return lead ? -1 : 0;
}
/*
* @implemented
*/
unsigned char *__p__mbctype(void)
{
return _mbctype;
}