about summary refs log tree commit diff
path: root/iconvdata/jis0212.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-04-13 15:01:09 +0000
committerUlrich Drepper <drepper@redhat.com>1998-04-13 15:01:09 +0000
commit2b47435322f026277a936c039c6ea45b975c2876 (patch)
treef6984d4da34bb384cbb74f637e75907789d3e523 /iconvdata/jis0212.h
parent40b4c81d4ec13a7a5acdeb1288f1d897b511b36c (diff)
downloadglibc-2b47435322f026277a936c039c6ea45b975c2876.tar.gz
glibc-2b47435322f026277a936c039c6ea45b975c2876.tar.xz
glibc-2b47435322f026277a936c039c6ea45b975c2876.zip
Update.
1998-04-13 14:52  Ulrich Drepper  <drepper@cygnus.com>

	* 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.
Diffstat (limited to 'iconvdata/jis0212.h')
-rw-r--r--iconvdata/jis0212.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/iconvdata/jis0212.h b/iconvdata/jis0212.h
index 0b60ca800b..7d9e9ac23b 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 <drepper@cygnus.com>, 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;
 }