Reactos
at master 49 lines 1.3 kB view raw
1/*** 2*mbclen.c - Find length of MBCS character 3* 4* Copyright (c) Microsoft Corporation. All rights reserved. 5* 6*Purpose: 7* Find length of MBCS character 8* 9*******************************************************************************/ 10#ifndef _MBCS 11 #error This file should only be compiled with _MBCS defined 12#endif 13 14#include <corecrt_internal_mbstring.h> 15#include <locale.h> 16 17#pragma warning(disable:__WARNING_POTENTIAL_BUFFER_OVERFLOW_NULLTERMINATED) // 26018 18 19/*** 20* _mbclen - Find length of MBCS character 21* 22*Purpose: 23* Find the length of the MBCS character (in bytes). 24* 25*Entry: 26* unsigned char *c = MBCS character 27* 28*Exit: 29* Returns the number of bytes in the MBCS character 30* 31*Exceptions: 32* 33*******************************************************************************/ 34 35extern "C" size_t __cdecl _mbclen_l(unsigned char const* c, _locale_t locale) 36{ 37 /* Don't return two if we have leadbyte, EOS. 38 Don't assert here; too low level 39 */ 40 return ((_ismbblead_l)(*c, locale) && c[1] != '\0') ? 2 : 1; 41} 42 43extern "C" size_t __cdecl _mbclen(unsigned char const* c) 44{ 45 /* Don't return two if we have leadbyte, EOS. 46 Don't assert here; too low level 47 */ 48 return (_ismbblead(*c) && c[1]!='\0') ? 2 : 1; 49}