Reactos
at master 53 lines 1.4 kB view raw
1/*** 2*ismbspc.c - Test is character is whitespace (MBCS) 3* 4* Copyright (c) Microsoft Corporation. All rights reserved. 5* 6*Purpose: 7* Test is character is whitespace (MBCS) 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/*** 18* _ismbcspace - Test is character is whitespace (MBCS) 19* 20*Purpose: 21* Test if the character is a whitespace character. 22* Handles MBCS chars correctly. 23* 24* Note: Use test against 0x00FF instead of _ISLEADBYTE 25* to ensure that we don't call SBCS routine with a two-byte 26* value. 27* 28*Entry: 29* unsigned int c = character to test 30* 31*Exit: 32* Returns TRUE if character is whitespace, else FALSE 33* 34*Exceptions: 35* 36*******************************************************************************/ 37 38extern "C" int __cdecl _ismbcspace_l(unsigned int const c, _locale_t const locale) 39{ 40 _LocaleUpdate locale_update(locale); 41 42 if (c <= 0x00FF) 43 { 44 return _isspace_l(c, locale_update.GetLocaleT()); 45 } 46 47 return __dcrt_multibyte_check_type(c, locale_update.GetLocaleT(), _SPACE, true); 48} 49 50extern "C" int __cdecl _ismbcspace(unsigned int const c) 51{ 52 return _ismbcspace_l(c, nullptr); 53}