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

Go to the source code of this file.

Functions

errno_t __cdecl _mbsupr_s_l (unsigned char *string, size_t sizeInBytes, _locale_t plocinfo)
 
 errno_t (__cdecl _mbsupr_s)(unsigned char *string
 
unsigned char *__cdecl _mbsupr_l (unsigned char *string, _locale_t plocinfo)
 
unsigned char *__cdecl _mbsupr (unsigned char *string)
 

Variables

size_t sizeInBytes
 

Function Documentation

◆ _mbsupr()

unsigned char *__cdecl _mbsupr ( unsigned char string)

Definition at line 128 of file mbsupr.cpp.

131{
132 return (_mbsupr_s_l(string, (string == nullptr ? 0 : (size_t)-1), nullptr) == 0 ? string : nullptr);
133}
errno_t __cdecl _mbsupr_s_l(unsigned char *string, size_t sizeInBytes, _locale_t plocinfo)
Definition: mbsupr.cpp:40

◆ _mbsupr_l()

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

Definition at line 120 of file mbsupr.cpp.

124{
125 return (_mbsupr_s_l(string, (string == nullptr ? 0 : (size_t)-1), plocinfo) == 0 ? string : nullptr);
126}
_locale_t plocinfo
Definition: ismbbyte.cpp:75

◆ _mbsupr_s_l()

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

Definition at line 40 of file mbsupr.cpp.

45{
46 size_t stringlen;
47
48 /* validation section */
49 _VALIDATE_RETURN_ERRCODE((string != nullptr && sizeInBytes > 0) || (string == nullptr && sizeInBytes == 0), EINVAL);
50
51 if (string == nullptr)
52 {
53 /* nothing to do */
54 return 0;
55 }
56
57 stringlen = strnlen((char *)string, sizeInBytes);
59 {
62 }
64
65 unsigned char *cp, *dst;
66 _LocaleUpdate _loc_update(plocinfo);
67
68 for (cp = string, dst = string; *cp; ++cp)
69 {
70 if ( _ismbblead_l(*cp, _loc_update.GetLocaleT()) )
71 {
72
73
74 int retval;
75 unsigned char ret[4];
76
78 _loc_update.GetLocaleT(),
79 _loc_update.GetLocaleT()->mbcinfo->mblocalename,
81 (const char *)cp,
82 2,
83 (char *)ret,
84 2,
85 _loc_update.GetLocaleT()->mbcinfo->mbcodepage,
86 TRUE )) == 0 )
87 {
88 errno = EILSEQ;
90 return errno;
91 }
92
93 *(dst++) = ret[0];
94 ++cp;
95 if (retval > 1)
96 {
97 *(dst++) = ret[1];
98 }
99
100
101 }
102 else
103 /* single byte, macro version */
104 *(dst++) = (unsigned char) _mbbtoupper_l(*cp, _loc_update.GetLocaleT());
105 }
106 /* null terminate the string */
107 *dst = '\0';
108
109 return 0;
110}
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 _ismbblead_l(_c, p)
#define _mbbtoupper_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: mbsupr.cpp:116
#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_UPPERCASE
Definition: winnls.h:187

Referenced by _mbsupr(), and _mbsupr_l().

◆ errno_t()

errno_t ( __cdecl  _mbsupr_s)

Variable Documentation

◆ sizeInBytes

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

Definition at line 114 of file mbsupr.cpp.

Referenced by _mbsupr_s_l().