ReactOS 0.4.16-dev-814-g656a5dc
mbslwr.cpp File Reference
#include <corecrt_internal.h>
#include <corecrt_internal_mbstring.h>
#include <corecrt_internal_securecrt.h>
#include <locale.h>
#include <string.h>
Include dependency graph for mbslwr.cpp:

Go to the source code of this file.

Functions

errno_t __cdecl _mbslwr_s_l (unsigned char *string, size_t sizeInBytes, _locale_t plocinfo)
 
 errno_t (__cdecl _mbslwr_s)(unsigned char *string
 
unsigned char *__cdecl _mbslwr_l (unsigned char *string, _locale_t plocinfo)
 
unsigned char *__cdecl _mbslwr (unsigned char *string)
 

Variables

size_t sizeInBytes
 

Function Documentation

◆ _mbslwr()

unsigned char *__cdecl _mbslwr ( unsigned char string)

Definition at line 131 of file mbslwr.cpp.

134{
135 return (_mbslwr_s_l(string, (string == nullptr ? 0 : (size_t)-1), nullptr) == 0 ? string : nullptr);
136}
errno_t __cdecl _mbslwr_s_l(unsigned char *string, size_t sizeInBytes, _locale_t plocinfo)
Definition: mbslwr.cpp:42

◆ _mbslwr_l()

unsigned char *__cdecl _mbslwr_l ( unsigned char string,
_locale_t  plocinfo 
)

Definition at line 123 of file mbslwr.cpp.

127{
128 return (_mbslwr_s_l(string, (string == nullptr ? 0 : (size_t)-1), plocinfo) == 0 ? string : nullptr);
129}
_locale_t plocinfo
Definition: ismbbyte.cpp:75

◆ _mbslwr_s_l()

errno_t __cdecl _mbslwr_s_l ( unsigned char string,
size_t  sizeInBytes,
_locale_t  plocinfo 
)

Definition at line 42 of file mbslwr.cpp.

47{
48 size_t stringlen;
49
50 /* validation section */
51 _VALIDATE_RETURN_ERRCODE((string != nullptr && sizeInBytes > 0) || (string == nullptr && sizeInBytes == 0), EINVAL);
52
53 if (string == nullptr)
54 {
55 /* nothing to do */
56 return 0;
57 }
58
59 stringlen = strnlen((char *)string, sizeInBytes);
61 {
64 }
66
67 unsigned char *cp, *dst;
68 _LocaleUpdate _loc_update(plocinfo);
69
70 for (cp = string, dst = string; *cp != '\0'; ++cp)
71 {
72 if (_ismbblead_l(*cp, _loc_update.GetLocaleT()))
73 {
74
75
76 int retval;
77 unsigned char ret[4];
79 _loc_update.GetLocaleT(),
80 _loc_update.GetLocaleT()->mbcinfo->mblocalename,
82 (const char *)cp,
83 2,
84 (char *)ret,
85 2,
86 _loc_update.GetLocaleT()->mbcinfo->mbcodepage,
87 TRUE )) == 0 )
88 {
89 errno = EILSEQ;
91 return errno;
92 }
93
94 *(dst++) = ret[0];
95 ++cp;
96 if (retval > 1)
97 {
98 *(dst++) = ret[1];
99 }
100
101
102 }
103 else
104 {
105 /* single byte, macro version */
106 *(dst++) = (unsigned char) _mbbtolower_l(*cp, _loc_update.GetLocaleT());
107 }
108 }
109 /* null terminate the string */
110 *dst = '\0';
111
112 return 0;
113}
int __cdecl __acrt_LCMapStringA(_locale_t const plocinfo, PCWSTR const LocaleName, DWORD const dwMapFlags, PCCH const lpSrcStr, int const cchSrc, PCH const lpDestStr, int const cchDest, int const code_page, BOOL const bError)
#define EINVAL
Definition: acclib.h:90
#define _mbbtolower_l(_c, p)
#define _ismbblead_l(_c, p)
#define _RETURN_DEST_NOT_NULL_TERMINATED(_String, _Size)
#define _FILL_STRING
#define _RESET_STRING(_String, _Size)
#define TRUE
Definition: types.h:120
GLint const GLchar GLint stringlen
Definition: glext.h:7232
GLenum GLenum dst
Definition: glext.h:6340
#define _VALIDATE_RETURN_ERRCODE(expr, errorcode)
POINT cp
Definition: magnifier.c:59
size_t sizeInBytes
Definition: mbslwr.cpp:119
#define errno
Definition: errno.h:18
#define EILSEQ
Definition: errno.h:109
size_t __cdecl strnlen(char const *const string, size_t const maximum_count)
Definition: strnlen.cpp:202
int ret
int retval
Definition: wcstombs.cpp:91
#define LCMAP_LOWERCASE
Definition: winnls.h:186

Referenced by _mbslwr(), and _mbslwr_l().

◆ errno_t()

errno_t ( __cdecl  _mbslwr_s)

Variable Documentation

◆ sizeInBytes

size_t sizeInBytes
Initial value:
{
return _mbslwr_s_l(string, sizeInBytes, nullptr)

Definition at line 117 of file mbslwr.cpp.

Referenced by _mbslwr_s_l(), _mbsnlen_l(), _strlwr_s(), _strlwr_s_l(), _strlwr_s_l_stat(), _strupr_s(), _strupr_s_l(), and _strupr_s_l_stat().