diff options
author | asmodai <asmodai@FreeBSD.org> | 2002-04-14 10:55:42 +0000 |
---|---|---|
committer | asmodai <asmodai@FreeBSD.org> | 2002-04-14 10:55:42 +0000 |
commit | 3b69e0094ce6b020016ab6d398abcd617b712a6c (patch) | |
tree | 3d58831244c9c5adcc95db1f796fdd5c4b9c8c50 | |
parent | 9c6b97e0231072e9dc4cd0c3b8376e5aec63e95e (diff) | |
download | FreeBSD-src-3b69e0094ce6b020016ab6d398abcd617b712a6c.zip FreeBSD-src-3b69e0094ce6b020016ab6d398abcd617b712a6c.tar.gz |
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 <winard@ms11.url.com.tw>
-rw-r--r-- | lib/libc/locale/euc.c | 4 |
1 files changed, 3 insertions, 1 deletions
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); } |