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

Go to the source code of this file.

Functions

int __cdecl _mbsbtype_l (unsigned char const *string, size_t length, _locale_t const locale)
 
int __cdecl _mbsbtype (unsigned char const *const string, size_t const length)
 

Function Documentation

◆ _mbsbtype()

int __cdecl _mbsbtype ( unsigned char const *const  string,
size_t const  length 
)

Definition at line 79 of file mbsbtype.cpp.

80{
81 return _mbsbtype_l(string, length, nullptr);
82}
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
int __cdecl _mbsbtype_l(unsigned char const *string, size_t length, _locale_t const locale)
Definition: mbsbtype.cpp:51

◆ _mbsbtype_l()

int __cdecl _mbsbtype_l ( unsigned char const string,
size_t  length,
_locale_t const  locale 
)

Definition at line 51 of file mbsbtype.cpp.

52{
53 _VALIDATE_RETURN(string != nullptr, EINVAL, _MBC_ILLEGAL);
54
55 _LocaleUpdate locale_update(locale);
56
57 if (locale_update.GetLocaleT()->mbcinfo->ismbcodepage == 0)
58 return _MBC_SINGLE;
59
60 int chartype = _MBC_ILLEGAL;
61
62 do
63 {
64 /* If the char at the position asked for is a '\0' we return
65 _MBC_ILLEGAL. But, If any char before the position asked for is
66 a '\0', then we call invalid_param */
67
68 if (length == 0 && *string == '\0')
69 return _MBC_ILLEGAL;
70
71 _VALIDATE_RETURN(*string != '\0', EINVAL, _MBC_ILLEGAL);
72
73 chartype = _mbbtype_l(*string++, chartype, locale_update.GetLocaleT());
74 } while (length--);
75
76 return chartype;
77}
#define EINVAL
Definition: acclib.h:90
Definition: _locale.h:75
#define _VALIDATE_RETURN(expr, errorcode, retexpr)
_Check_return_ _CRTIMP int __cdecl _mbbtype_l(_In_ unsigned char _Ch, _In_ int _CType, _In_opt_ _locale_t _Locale)
#define _MBC_SINGLE
Definition: msvcrt.h:823
#define _MBC_ILLEGAL
Definition: msvcrt.h:826

Referenced by _mbsbtype().