reactos/lib/sdk/crt/mbstring/ismblead.c
Timo Kreuzer 6afbc8f483 Hopefully create a branch and not destroy the svn repository.
svn path=/branches/reactos-yarotows/; revision=45219
2010-01-23 23:25:04 +00:00

54 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;
}