From 2b47435322f026277a936c039c6ea45b975c2876 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 13 Apr 1998 15:01:09 +0000 Subject: Update. 1998-04-13 14:52 Ulrich Drepper * iconvdata/cns11643.c: New file. * iconvdata/cns11643.h: New file. * iconvdata/cns11643l1.c: New file. * iconvdata/cns11643l1.h: New file. * iconvdata/euctw.c: New file. * iconvdata/Makefile: Add rules for EUC-TW and CNS. * iconvdata/gconv-modules: Likewise. * iconvdata/eucjp.c: Several bug fixes and improvements. * iconvdata/gb2312.h: Likewise. * iconvdata/jis0201.h: Likewise. * iconvdata/jis0208.h: Likewise. * iconvdata/jis0212.h: Likewise. --- iconvdata/jis0212.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'iconvdata/jis0212.h') diff --git a/iconvdata/jis0212.h b/iconvdata/jis0212.h index 0b60ca8..7d9e9ac 100644 --- a/iconvdata/jis0212.h +++ b/iconvdata/jis0212.h @@ -1,5 +1,5 @@ /* Access functions for JISX0212 conversion. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -42,7 +42,7 @@ extern const char jisx0212_from_ucs[][2]; static inline wchar_t -jisx0212_to_ucs4 (char **s, size_t avail) +jisx0212_to_ucs4 (const char **s, size_t avail, unsigned char offset) { const struct jisx0212_idx *rp = jisx0212_to_ucs_idx; unsigned char ch = *(*s); @@ -50,17 +50,17 @@ jisx0212_to_ucs4 (char **s, size_t avail) wchar_t wch = L'\0'; int idx; - if (ch <= 0x6d || ch > 0xea) + if (ch < offset || (ch - offset) <= 0x6d || (ch - offset) > 0xea) return UNKNOWN_10646_CHAR; if (avail < 2) return 0; ch2 = (*s)[1]; - if (ch2 <= 0x20 || ch2 >= 0x7f) + if (ch2 < offset || (ch2 - offset) <= 0x20 || (ch2 - offset) >= 0x7f) return UNKNOWN_10646_CHAR; - idx = (ch - 0x21) * 94 + (ch2 - 0x21); + idx = (ch - 0x21 - offset) * 94 + (ch2 - 0x21 - offset); while (idx < rp->start) ++rp; @@ -77,7 +77,7 @@ jisx0212_to_ucs4 (char **s, size_t avail) static inline size_t -ucs4_to_jisx0212 (wchar_t wch, char **s, size_t avail) +ucs4_to_jisx0212 (wchar_t wch, char *s, size_t avail) { const struct jisx0212_idx *rp = jisx0212_from_ucs_idx; unsigned int ch = (unsigned int) wch; @@ -91,15 +91,14 @@ ucs4_to_jisx0212 (wchar_t wch, char **s, size_t avail) if (cp == NULL || cp[0] == '\0') return UNKNOWN_10646_CHAR; - **s = cp[0]; + s[0] = cp[0]; if (cp[1] != '\0') { if (avail < 2) return 0; - *++(*s) = cp[1]; + s[1] = cp[1]; } - ++(*s); return 2; } -- cgit v1.1