ReactOS 0.4.16-dev-1097-g530d26a
mbtoupr.cpp
Go to the documentation of this file.
1/***
2*mbtoupr.c - Convert character to upper case (MBCS)
3*
4* Copyright (c) Microsoft Corporation. All rights reserved.
5*
6*Purpose:
7* Convert character to upper case (MBCS)
8*
9*******************************************************************************/
10#ifndef _MBCS
11 #error This file should only be compiled with _MBCS defined
12#endif
13
15#include <locale.h>
16
17/***
18* _mbctoupper - Convert character to upper case (MBCS)
19*
20*Purpose:
21* If the given character is lower case, convert to upper case.
22* Handles MBCS chars correctly.
23*
24* Note: Use test against 0x00FF instead of _ISLEADBYTE
25* to ensure that we don't call SBCS routine with a two-byte
26* value.
27*
28*Entry:
29* unsigned int c = character to convert
30*
31*Exit:
32* Returns converted character
33*
34*Exceptions:
35*
36*******************************************************************************/
37
38extern "C" unsigned int __cdecl _mbctoupper_l(
39 unsigned int c,
41 )
42{
43 unsigned char val[2];
44 unsigned char ret[4];
45 _LocaleUpdate _loc_update(plocinfo);
46
47 if (c > 0x00FF)
48 {
49
50 val[0] = (c >> 8) & 0xFF;
51 val[1] = c & 0xFF;
52
53 if ( !_ismbblead_l(val[0], _loc_update.GetLocaleT()) )
54 return c;
55
56
58 _loc_update.GetLocaleT(),
59 _loc_update.GetLocaleT()->mbcinfo->mblocalename,
61 (const char *)val,
62 2,
63 (char *)ret,
64 2,
65 _loc_update.GetLocaleT()->mbcinfo->mbcodepage,
66 TRUE ) == 0 )
67 return c;
68
69 c = ret[1];
70 c += ret[0] << 8;
71
72 return c;
73
74
75 }
76 else
77 return (unsigned int)_mbbtoupper_l((int)c, _loc_update.GetLocaleT());
78}
80 unsigned int c
81 )
82{
83 return _mbctoupper_l(c, nullptr);
84}
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 __cdecl
Definition: accygwin.h:79
#define _ismbblead_l(_c, p)
#define _mbbtoupper_l(_c, p)
#define TRUE
Definition: types.h:120
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
const GLubyte * c
Definition: glext.h:8905
GLuint GLfloat * val
Definition: glext.h:7180
_Check_return_ _CRTIMP unsigned int __cdecl _mbctoupper(_In_ unsigned int _Ch)
_locale_t plocinfo
Definition: ismbbyte.cpp:75
#define c
Definition: ke_i.h:80
unsigned int __cdecl _mbctoupper_l(unsigned int c, _locale_t plocinfo)
Definition: mbtoupr.cpp:38
int ret
#define LCMAP_UPPERCASE
Definition: winnls.h:187