ReactOS 0.4.16-dev-927-g467dec4
isctype.cpp File Reference
#include <corecrt_internal.h>
#include <ctype.h>
#include <locale.h>
Include dependency graph for isctype.cpp:

Go to the source code of this file.

Functions

int __cdecl _isctype_l (int const c, int const mask, _locale_t const locale)
 
int __cdecl _isctype (int const c, int const mask)
 

Function Documentation

◆ _isctype()

int __cdecl _isctype ( int const  c,
int const  mask 
)

Definition at line 108 of file isctype.cpp.

109{
110 if (__acrt_locale_changed())
111 {
112 return _isctype_l(c, mask, nullptr);
113 }
114
116}
__crt_locale_data __acrt_initial_locale_data
Definition: nlsdata.cpp:92
static int __CRTDECL __acrt_locale_get_ctype_array_value(_In_reads_(_Char_value+1) unsigned short const *const locale_pctype_array, _In_range_(-1, 255) int const c, _In_ int const mask)
Definition: stubs.c:113
const GLubyte * c
Definition: glext.h:8905
GLenum GLint GLuint mask
Definition: glext.h:6028
int __cdecl _isctype_l(int const c, int const mask, _locale_t const locale)
Definition: isctype.cpp:62
unsigned short const * _locale_pctype
Definition: stubs.c:95
__crt_locale_data_public _public

◆ _isctype_l()

int __cdecl _isctype_l ( int const  c,
int const  mask,
_locale_t const  locale 
)

Definition at line 62 of file isctype.cpp.

63{
64 _LocaleUpdate locale_update(locale);
65
66 if (c >= -1 && c <= 255)
67 {
68 // Direct access to _locale_pctype is allowed due to bounds check.
69 return locale_update.GetLocaleT()->locinfo->_public._locale_pctype[c] & mask;
70 }
71
72 size_t const buffer_count{3};
73
74 int buffer_length;
75 char buffer[buffer_count];
76 if (_isleadbyte_fast_internal(c >> 8 & 0xff, locale_update.GetLocaleT()))
77 {
78 buffer[0] = (c >> 8 & 0xff); // Put lead-byte at start of the string
79 buffer[1] = static_cast<char>(c);
80 buffer[2] = '\0';
81 buffer_length = 2;
82 }
83 else
84 {
85 buffer[0] = static_cast<char>(c);
86 buffer[1] = '\0';
87 buffer_length = 1;
88 }
89
90
91 unsigned short character_type[buffer_count]{};
93 locale_update.GetLocaleT(),
95 buffer,
96 buffer_length,
98 locale_update.GetLocaleT()->locinfo->_public._locale_lc_codepage,
99 TRUE
100 ) == 0)
101 {
102 return 0;
103 }
104
105 return static_cast<int>(character_type[0] & mask);
106}
BOOL __cdecl __acrt_GetStringTypeA(_locale_t const locale, DWORD const info_type, LPCSTR const string, int const string_size_in_bytes, unsigned short *const char_type, int const code_page, BOOL const error)
Definition: _locale.h:75
_Check_return_ __forceinline unsigned short __cdecl _isleadbyte_fast_internal(_In_ unsigned char const c, _In_ _locale_t const locale)
#define TRUE
Definition: types.h:120
GLuint buffer
Definition: glext.h:5915
#define c
Definition: ke_i.h:80
#define CT_CTYPE1
Definition: winnls.h:239
size_t const buffer_count
Definition: xtoa.cpp:36

Referenced by _isctype().