ReactOS 0.4.16-dev-1097-g530d26a
mbtolwr.cpp
Go to the documentation of this file.
1/***
2*mbtolwr.c - Convert character to lower case (MBCS).
3*
4* Copyright (c) Microsoft Corporation. All rights reserved.
5*
6*Purpose:
7* Convert character to lower 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/***
19* _mbctolower - Convert character to lower case (MBCS)
20*
21*Purpose:
22* If the given character is upper case, convert it to lower case.
23* Handles MBCS characters correctly.
24*
25* Note: Use test against 0x00FF instead of _ISLEADBYTE
26* to ensure that we don't call SBCS routine with a two-byte
27* value.
28*
29*Entry:
30* unsigned int c = character to convert
31*
32*Exit:
33* Returns converted character
34*
35*Exceptions:
36*
37*******************************************************************************/
38
39extern "C" unsigned int __cdecl _mbctolower_l (
40 unsigned int c,
42 )
43{
44 unsigned char val[2];
45 unsigned char ret[4];
46 _LocaleUpdate _loc_update(plocinfo);
47
48 if (c > 0x00FF)
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)_mbbtolower_l((int)c, _loc_update.GetLocaleT());
78}
79
80extern "C" unsigned int (__cdecl _mbctolower) (
81 unsigned int c
82 )
83{
84 return _mbctolower_l(c, nullptr);
85}
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 _mbbtolower_l(_c, p)
#define _ismbblead_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 _mbctolower(_In_ unsigned int _Ch)
_locale_t plocinfo
Definition: ismbbyte.cpp:75
#define c
Definition: ke_i.h:80
unsigned int __cdecl _mbctolower_l(unsigned int c, _locale_t plocinfo)
Definition: mbtolwr.cpp:39
int ret
#define LCMAP_LOWERCASE
Definition: winnls.h:186