xref: /reactos/sdk/lib/ucrt/mbstring/ismbupr.cpp (revision e3e520d1)
1 /***
2 *ismbupr - Test if character is upper case (MBCS)
3 *
4 *       Copyright (c) Microsoft Corporation.  All rights reserved.
5 *
6 *Purpose:
7 *       Test if character is upper case (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 * _ismbcupper - Test if character is upper case (MBCS)
18 *
19 *Purpose:
20 *       Test if the supplied character is upper case or not.
21 *       Handles MBCS characters correctly.
22 *
23 *       Note:  Use test against 0x00FF instead of _ISLEADBYTE
24 *       to ensure that we don't call SBCS routine with a two-byte
25 *       value.
26 *
27 *Entry:
28 *       unsigned int c = character to test
29 *
30 *Exit:
31 *       Returns TRUE if c is an upper case character; else FALSE
32 *
33 *Exceptions:
34 *
35 *******************************************************************************/
36 
37 extern "C" int __cdecl _ismbcupper_l(unsigned int const c, _locale_t const locale)
38 {
39     _LocaleUpdate locale_update(locale);
40 
41     if (c <= 0x00FF)
42     {
43         return _mbbisupper_l(c, locale_update.GetLocaleT());
44     }
45 
46     return __dcrt_multibyte_check_type(c, locale_update.GetLocaleT(), _UPPER, true);
47 }
48 
49 extern "C" int __cdecl _ismbcupper(unsigned int const c)
50 {
51     return _ismbcupper_l(c, nullptr);
52 }
53