mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 00:32:57 +00:00
Create a branch for cmake bringup.
svn path=/branches/cmake-bringup/; revision=48236
This commit is contained in:
parent
a28e798006
commit
c424146e2c
20602 changed files with 0 additions and 1140137 deletions
42
lib/sdk/crt/mbstring/mbclen.c
Normal file
42
lib/sdk/crt/mbstring/mbclen.c
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/mbstring/mbclen.c
|
||||
* PURPOSE: Determines the length of a multi byte character
|
||||
* PROGRAMERS:
|
||||
* Copyright 1999 Alexandre Julliard
|
||||
* Copyright 2000 Jon Griffths
|
||||
*
|
||||
*/
|
||||
|
||||
#include <mbstring.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int isleadbyte(int byte);
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
size_t _mbclen(const unsigned char *s)
|
||||
{
|
||||
return _ismbblead(*s) ? 2 : 1;
|
||||
}
|
||||
|
||||
size_t _mbclen2(const unsigned int s)
|
||||
{
|
||||
return (_ismbblead(s>>8) && _ismbbtrail(s&0x00FF)) ? 2 : 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* assume MB_CUR_MAX == 2
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
int mblen( const char *str, size_t size )
|
||||
{
|
||||
if (str && *str && size)
|
||||
{
|
||||
return !isleadbyte(*str) ? 1 : (size>1 ? 2 : -1);
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue