summaryrefslogtreecommitdiff
path: root/libc/misc/wchar
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/wchar')
-rw-r--r--libc/misc/wchar/wchar.c206
1 files changed, 103 insertions, 103 deletions
diff --git a/libc/misc/wchar/wchar.c b/libc/misc/wchar/wchar.c
index bfe41af83..48f072125 100644
--- a/libc/misc/wchar/wchar.c
+++ b/libc/misc/wchar/wchar.c
@@ -234,7 +234,7 @@ int wctob(wint_t c)
/* If we don't have 8-bit locale support, then this is trivial since
* anything outside of 0-0x7f is illegal in C/POSIX and UTF-8 locales. */
-
+
/* TODO: need unsigned version of wint_t... */
/* return (((unsigned int)c) < 0x80) ? c : WEOF; */
return ((c >= 0) && (c < 0x80)) ? c : EOF;
@@ -928,109 +928,109 @@ libc_hidden_proto(wcswidth)
( defined(__CTYPE_HAS_8_BIT_LOCALES) || defined(__CTYPE_HAS_UTF_8_LOCALES) )
static const unsigned char new_idx[] = {
- 0, 5, 5, 6, 10, 15, 28, 39,
- 48, 48, 71, 94, 113, 128, 139, 154,
- 175, 186, 188, 188, 188, 188, 188, 188,
- 203, 208, 208, 208, 208, 208, 208, 208,
- 208, 219, 219, 219, 222, 222, 222, 222,
- 222, 222, 222, 222, 222, 222, 222, 224,
- 224, 231, 231, 231, 231, 231, 231, 231,
- 231, 231, 231, 231, 231, 231, 231, 231,
- 231, 231, 231, 231, 231, 231, 231, 231,
- 231, 231, 231, 231, 231, 231, 231, 231,
- 231, 231, 231, 231, 231, 231, 231, 231,
- 231, 231, 231, 231, 231, 231, 231, 231,
- 231, 231, 231, 231, 231, 231, 231, 231,
- 231, 231, 231, 231, 231, 231, 231, 231,
- 231, 231, 231, 231, 231, 231, 231, 231,
- 231, 231, 231, 231, 231, 231, 231, 231,
- 231, 231, 231, 231, 231, 231, 231, 231,
- 231, 231, 231, 231, 231, 231, 231, 231,
- 231, 231, 231, 231, 231, 231, 231, 231,
- 231, 231, 231, 231, 231, 231, 231, 231,
- 231, 231, 231, 231, 231, 233, 233, 233,
- 233, 233, 233, 233, 234, 234, 234, 234,
- 234, 234, 234, 234, 234, 234, 234, 234,
- 234, 234, 234, 234, 234, 234, 234, 234,
- 234, 234, 234, 234, 234, 234, 234, 234,
- 234, 234, 234, 234, 234, 234, 234, 234,
- 234, 234, 234, 234, 234, 234, 234, 234,
- 236, 236, 236, 236, 236, 236, 236, 236,
- 236, 236, 236, 236, 236, 236, 236, 236,
- 236, 236, 236, 236, 236, 236, 236, 236,
- 236, 236, 236, 236, 236, 236, 236, 236,
- 236, 237, 237, 238, 241, 241, 242, 249,
- 255,
+ 0, 5, 5, 6, 10, 15, 28, 39,
+ 48, 48, 71, 94, 113, 128, 139, 154,
+ 175, 186, 188, 188, 188, 188, 188, 188,
+ 203, 208, 208, 208, 208, 208, 208, 208,
+ 208, 219, 219, 219, 222, 222, 222, 222,
+ 222, 222, 222, 222, 222, 222, 222, 224,
+ 224, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 231, 231, 231,
+ 231, 231, 231, 231, 231, 233, 233, 233,
+ 233, 233, 233, 233, 234, 234, 234, 234,
+ 234, 234, 234, 234, 234, 234, 234, 234,
+ 234, 234, 234, 234, 234, 234, 234, 234,
+ 234, 234, 234, 234, 234, 234, 234, 234,
+ 234, 234, 234, 234, 234, 234, 234, 234,
+ 234, 234, 234, 234, 234, 234, 234, 234,
+ 236, 236, 236, 236, 236, 236, 236, 236,
+ 236, 236, 236, 236, 236, 236, 236, 236,
+ 236, 236, 236, 236, 236, 236, 236, 236,
+ 236, 236, 236, 236, 236, 236, 236, 236,
+ 236, 237, 237, 238, 241, 241, 242, 249,
+ 255,
};
static const unsigned char new_tbl[] = {
- 0x00, 0x01, 0x20, 0x7f, 0xa0, 0x00, 0x00, 0x50,
- 0x60, 0x70, 0x00, 0x83, 0x87, 0x88, 0x8a, 0x00,
- 0x91, 0xa2, 0xa3, 0xba, 0xbb, 0xbe, 0xbf, 0xc0,
- 0xc1, 0xc3, 0xc4, 0xc5, 0x00, 0x4b, 0x56, 0x70,
- 0x71, 0xd6, 0xe5, 0xe7, 0xe9, 0xea, 0xee, 0x00,
- 0x0f, 0x10, 0x11, 0x12, 0x30, 0x4b, 0xa6, 0xb1,
- 0x00, 0x01, 0x03, 0x3c, 0x3d, 0x41, 0x49, 0x4d,
- 0x4e, 0x51, 0x55, 0x62, 0x64, 0x81, 0x82, 0xbc,
- 0xbd, 0xc1, 0xc5, 0xcd, 0xce, 0xe2, 0xe4, 0x00,
- 0x02, 0x03, 0x3c, 0x3d, 0x41, 0x43, 0x47, 0x49,
- 0x4b, 0x4e, 0x70, 0x72, 0x81, 0x83, 0xbc, 0xbd,
- 0xc1, 0xc6, 0xc7, 0xc9, 0xcd, 0xce, 0x00, 0x01,
- 0x02, 0x3c, 0x3d, 0x3f, 0x40, 0x41, 0x44, 0x4d,
- 0x4e, 0x56, 0x57, 0x82, 0x83, 0xc0, 0xc1, 0xcd,
- 0xce, 0x00, 0x3e, 0x41, 0x46, 0x49, 0x4a, 0x4e,
- 0x55, 0x57, 0xbf, 0xc0, 0xc6, 0xc7, 0xcc, 0xce,
- 0x00, 0x41, 0x44, 0x4d, 0x4e, 0xca, 0xcb, 0xd2,
- 0xd5, 0xd6, 0xd7, 0x00, 0x31, 0x32, 0x34, 0x3b,
- 0x47, 0x4f, 0xb1, 0xb2, 0xb4, 0xba, 0xbb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 0, 1,
+ 1, 0, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 1,
+ 0, 1, 0, 1, 0, 1, 0, 1,
+ 0, 1, 0, 1, 0, 1, 0, 1,
+ 0, 1, 0, 1, 0, 1, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 0,
+ 1, 1, 0, 1, 0, 1, 0, 1,
+ 0, 1, 0, 1, 0, 1, 0, 1,
+ 1, 0, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 1, 0, 1, 0, 1,
+ 0, 1, 0, 1, 0, 1, 0, 1,
+ 0, 1, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 1,
+ 0, 1, 0, 1, 0, 1, 0, 1,
+ 0, 1, 2, 0, 1, 0, 1, 0,
+ 1, 0, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 1, 0, 1, 0, 1,
+ 1, 0, 1, 0, 1, 0, 1, 0,
+ 1, 0, 1, 1, 2, 1, 1, 2,
+ 2, 0, 2, 1, 2, 0, 2, 2,
+ 1, 1, 2, 1, 1, 2, 1, 0,
+ 1, 1, 0, 1, 0, 1, 2, 1,
+ 0, 2, 1, 2, 1, 0, 1,
};
libc_hidden_proto(wcsnrtombs)
@@ -1043,7 +1043,7 @@ int wcswidth(const wchar_t *pwcs, size_t n)
if (ENCODING == __ctype_encoding_7_bit) {
size_t i;
-
+
for (i = 0 ; (i < n) && pwcs[i] ; i++) {
if (pwcs[i] != ((unsigned char)(pwcs[i]))) {
return -1;
@@ -1064,7 +1064,7 @@ int wcswidth(const wchar_t *pwcs, size_t n)
/* For stricter handling of allowed unicode values... see comments above. */
else if (ENCODING == __ctype_encoding_utf8) {
size_t i;
-
+
for (i = 0 ; (i < n) && pwcs[i] ; i++) {
if ( (((__uwchar_t)((pwcs[i]) - 0xfffeU)) < 2)
|| (((__uwchar_t)((pwcs[i]) - 0xd800U)) < (0xe000U - 0xd800U))
@@ -1501,7 +1501,7 @@ size_t weak_function iconv(iconv_t cd, char **__restrict inbuf,
}
wc += (wc2 << 16);
} else if (px->tocodeset & 1) wc = bswap_16(wc);
- }
+ }
(*outbuf)[0] = (char)((unsigned char)(wc));
(*outbuf)[1] = (char)((unsigned char)(wc >> 8));
if (inco == 4) {
@@ -1580,10 +1580,10 @@ extern const unsigned char __iconv_codesets[];
char *progname;
int hide_errors;
-static void error_msg(const char *fmt, ...)
+static void error_msg(const char *fmt, ...)
__attribute__ ((noreturn, format (printf, 1, 2)));
-static void error_msg(const char *fmt, ...)
+static void error_msg(const char *fmt, ...)
{
va_list arg;