update for HEAD-2003091401
[reactos.git] / lib / crtdll / mbstring / mbsupr.c
1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  * PROJECT:     ReactOS system libraries
4  * FILE:        lib/crtdll/mbstring/mbsncmp.c
5  * PURPOSE:     
6  * PROGRAMER:   Boudewijn Dekker
7  * UPDATE HISTORY:
8  *              12/04/99: Created
9  */
10 #include <msvcrt/mbstring.h>
11 #include <msvcrt/ctype.h>
12
13 unsigned int _mbbtoupper(unsigned int c)
14 {
15         if (!_ismbblead(c) )
16                 return toupper(c);
17         
18         return c;
19 }
20
21 // codepage 952
22 #define CASE_DIFF (0x8281 - 0x8260)
23
24 /*
25  * @implemented
26  */
27 unsigned int _mbctoupper(unsigned int c)
28 {
29
30         if ((c & 0xFF00) != 0) {
31 // true multibyte case conversion needed
32         if ( _ismbcupper(c) )
33                 return c + CASE_DIFF;
34
35         } else
36                 return _mbbtoupper(c);
37
38         return 0;
39 }
40
41 /*
42  * @implemented
43  */
44 unsigned char * _mbsupr(unsigned char *x)
45 {
46         unsigned char  *y=x;
47         while (*y) {
48                 if (!_ismbblead(*y) )
49                         *y = toupper(*y);
50                 else {
51                         *y=_mbctoupper(*(unsigned short *)y);
52                         y++;
53                 }
54         }
55         return x;
56 }