Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenmbclen.c
Go to the documentation of this file.
00001 /* 00002 * COPYRIGHT: See COPYING in the top level directory 00003 * PROJECT: ReactOS system libraries 00004 * FILE: lib/sdk/crt/mbstring/mbclen.c 00005 * PURPOSE: Determines the length of a multi byte character 00006 * PROGRAMERS: 00007 * Copyright 1999 Alexandre Julliard 00008 * Copyright 2000 Jon Griffths 00009 * 00010 */ 00011 00012 #include <mbstring.h> 00013 #include <stdlib.h> 00014 00015 int isleadbyte(int byte); 00016 00017 /* 00018 * @implemented 00019 */ 00020 size_t _mbclen(const unsigned char *s) 00021 { 00022 return _ismbblead(*s) ? 2 : 1; 00023 } 00024 00025 size_t _mbclen2(const unsigned int s) 00026 { 00027 return (_ismbblead(s>>8) && _ismbbtrail(s&0x00FF)) ? 2 : 1; 00028 } 00029 00030 /* 00031 * assume MB_CUR_MAX == 2 00032 * 00033 * @implemented 00034 */ 00035 int mblen( const char *str, size_t size ) 00036 { 00037 if (str && *str && size) 00038 { 00039 return !isleadbyte(*str) ? 1 : (size>1 ? 2 : -1); 00040 } 00041 return 0; 00042 } Generated on Sat May 26 2012 04:35:27 for ReactOS by
1.7.6.1
|