summaryrefslogtreecommitdiffstats
path: root/private/crt32/mbstring/mbtoupr.c
diff options
context:
space:
mode:
Diffstat (limited to 'private/crt32/mbstring/mbtoupr.c')
-rw-r--r--private/crt32/mbstring/mbtoupr.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/private/crt32/mbstring/mbtoupr.c b/private/crt32/mbstring/mbtoupr.c
new file mode 100644
index 000000000..515e7163b
--- /dev/null
+++ b/private/crt32/mbstring/mbtoupr.c
@@ -0,0 +1,72 @@
+/***
+*mbtoupr.c - Convert character to upper case (MBCS)
+*
+* Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Convert character to upper case (MBCS)
+*
+*Revision History:
+* 11-19-92 KRS Ported from 16-bit sources.
+* 08-20-93 CFW Change short params to int for 32-bit tree.
+*
+*******************************************************************************/
+
+#ifdef _MBCS
+#include <cruntime.h>
+#include <ctype.h>
+#include <mbdata.h>
+#include <mbctype.h>
+#include <mbstring.h>
+
+
+/***
+* _mbctoupper - Convert character to upper case (MBCS)
+*
+*Purpose:
+* If the given character is lower case, convert to upper case.
+* Handles MBCS chars correctly.
+*
+* Note: Use test against 0x00FF instead of _ISLEADBYTE
+* to ensure that we don't call SBCS routine with a two-byte
+* value.
+*
+*Entry:
+* unsigned int c = character to convert
+*
+*Exit:
+* Returns converted character
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+unsigned int _CRTAPI1 _mbctoupper(
+ unsigned int c
+ )
+{
+
+#ifdef _MBCS_OS
+
+ if (c > 0x00FF)
+ return(c);
+ else
+ return((unsigned int)toupper((int)c));
+
+#else
+
+ if (c > 0x00FF) {
+
+ if ( (_mbascii) &&
+ ((c >= _MBLOWERLOW) && (c <= _MBLOWERHIGH))
+ )
+ c -= _MBCASEDIFF;
+ }
+
+ else
+ return((unsigned int)toupper((int)c));
+
+#endif
+
+}
+#endif /* _MBCS */