xref: /reactos/sdk/lib/crt/mbstring/mbsupr.c (revision c2c66aff)
1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  * PROJECT:     ReactOS system libraries
4  * FILE:        lib/sdk/crt/mbstring/mbsupr.c
5  * PURPOSE:
6  * PROGRAMER:   Ariadne
7  * UPDATE HISTORY:
8  *              12/04/99: Created
9  */
10 
11 #include <precomp.h>
12 #include <mbstring.h>
13 #include <ctype.h>
14 
_mbbtoupper(unsigned int c)15 unsigned int _mbbtoupper(unsigned int c)
16 {
17 	if (!_ismbblead(c) )
18 		return toupper(c);
19 
20 	return c;
21 }
22 
23 /*
24  * @implemented
25  */
_mbctoupper(unsigned int c)26 unsigned int _mbctoupper(unsigned int c)
27 {
28     return _ismbclower (c) ? c - 0x21 : c;
29 }
30 
_mbset(unsigned char * string,int c)31 unsigned char *_mbset (unsigned char *string, int c)
32 {
33     unsigned char *save = string;
34 
35     if (_MBIS16 (c)) {
36 
37 	if (_MBLMASK (c) == 0) {
38 	    *string++ = '\0';
39 	    *string++ = '\0';
40 	}
41 	else {
42 	    *string++ = _MBGETH (c);
43 	    *string++ = _MBGETL (c);
44 	}
45 
46     }
47     else {
48 
49 	*string++ = c;
50 
51     }
52 
53     return save;
54 }
55 
56 /*
57  * @implemented
58  */
_mbsupr(unsigned char * string)59 unsigned char *_mbsupr (unsigned char *string)
60 {
61     int c;
62     unsigned char *save = string;
63 
64     while ((c = _mbsnextc (string))) {
65 
66 	if (_MBIS16 (c) == 0)
67 	    c = toupper (c);
68 
69 	_mbset (string, c);
70 
71 	string = _mbsinc (string);
72 
73     }
74 
75     return save;
76 }
77