From 3b69e0094ce6b020016ab6d398abcd617b712a6c Mon Sep 17 00:00:00 2001 From: asmodai Date: Sun, 14 Apr 2002 10:55:42 +0000 Subject: Remove the hard-coded limit of 3 bytes for EUC encodings. Satoshi NIIMI-san kindly explained that EUC does not limit the byte length to any arbitrary number. We now set the limit to the maximum octet length of the codeset and it is locale-specific. Submitted by: Yong-Jhen Hong --- lib/libc/locale/euc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/libc/locale/euc.c b/lib/libc/locale/euc.c index f2ae003..0b4c92a 100644 --- a/lib/libc/locale/euc.c +++ b/lib/libc/locale/euc.c @@ -82,6 +82,7 @@ _EUC_init(rl) free(rl); return (ENOMEM); } + __mb_cur_max = 0; for (x = 0; x < 4; ++x) { ei->count[x] = (int) strtol(v, &e, 0); if (v == e || !(v = e)) { @@ -89,6 +90,8 @@ _EUC_init(rl) free(ei); return (EFTYPE); } + if (__mb_cur_max < ei->count[x]) + __mb_cur_max = ei->count[x]; while (*v == ' ' || *v == '\t') ++v; ei->bits[x] = (int) strtol(v, &e, 0); @@ -114,7 +117,6 @@ _EUC_init(rl) } rl->variable_len = sizeof(_EucInfo); _CurrentRuneLocale = rl; - __mb_cur_max = 3; return (0); } -- cgit v1.1