mirror of
https://github.com/reactos/reactos.git
synced 2025-07-03 03:01:24 +00:00
Create a branch for header work.
svn path=/branches/header-work/; revision=45691
This commit is contained in:
parent
14fe274b1c
commit
9ea495ba33
19538 changed files with 0 additions and 1063950 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