branch update for HEAD-2003021201
[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 unsigned int _mbctoupper(unsigned int c)
25 {
26
27         if ((c & 0xFF00) != 0) {
28 // true multibyte case conversion needed
29         if ( _ismbcupper(c) )
30                 return c + CASE_DIFF;
31
32         } else
33                 return _mbbtoupper(c);
34
35         return 0;
36 }
37
38 unsigned char * _mbsupr(unsigned char *x)
39 {
40         unsigned char  *y=x;
41         while (*y) {
42                 if (!_ismbblead(*y) )
43                         *y = toupper(*y);
44                 else {
45                         *y=_mbctoupper(*(unsigned short *)y);
46                         y++;
47                 }
48         }
49         return x;
50 }