aboutsummaryrefslogtreecommitdiff
path: root/iconvdata/gb2312.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-04-25 20:34:34 +0000
committerUlrich Drepper <drepper@redhat.com>1998-04-25 20:34:34 +0000
commit918b9d72a9980efd4622bd25506da9531a952dbe (patch)
treef45368136155cd1ef156aaf277047a5488b9c3ac /iconvdata/gb2312.h
parent05c9fa3c0511214e808ec048f1062540dc243eb9 (diff)
downloadglibc-918b9d72a9980efd4622bd25506da9531a952dbe.tar
glibc-918b9d72a9980efd4622bd25506da9531a952dbe.tar.gz
glibc-918b9d72a9980efd4622bd25506da9531a952dbe.tar.bz2
glibc-918b9d72a9980efd4622bd25506da9531a952dbe.zip
Update.
1998-04-25 18:39 Ulrich Drepper <drepper@cygnus.com> * iconvdata/Makefile: Use gap method for iso8859-5, iso8859-7, iso8859-8 and iso8859-10. * iconvdata/iso8859-5.c: Change to use gap method. * iconvdata/iso8859-7.c: Likewise. * iconvdata/iso8859-8.c: Likewise. * iconvdata/iso8859-10.c: Likewise. * iconvdata/Makefile: Add rules for ISO-2022-JP module. * iconv/skeleton.c: Allow END_LOOP do be defined and use it at the end of the loop. * iconvdata/iso-2022-jp.c: New file. * iconvdata/ksc5601.c: Don't use uint16_t to represent byte sequence. * iconvdata/ksc5601.h: Unify function interfaces. * iconvdata/euckr.c: Adapt for changed ksc5601.h interface. * iconvdata/uhc.c: Likewise. * iconvdata/gb2312.h: Use correct types. * iconvdata/iso646.c (gconv_open): Correctly initialize the character size elements of data.
Diffstat (limited to 'iconvdata/gb2312.h')
-rw-r--r--iconvdata/gb2312.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/iconvdata/gb2312.h b/iconvdata/gb2312.h
index 5b405a1138..3de274e06b 100644
--- a/iconvdata/gb2312.h
+++ b/iconvdata/gb2312.h
@@ -29,7 +29,7 @@ extern const uint16_t __gb2312_to_ucs[];
static inline uint32_t
-gb2312_to_ucs4 (const char **s, size_t avail, unsigned char offset)
+gb2312_to_ucs4 (const unsigned char **s, size_t avail, unsigned char offset)
{
unsigned char ch = *(*s);
unsigned char ch2;
@@ -66,7 +66,7 @@ extern const char __gb2312_from_ucs4_tab8[][2];
extern const char __gb2312_from_ucs4_tab9[][2];
static inline size_t
-ucs4_to_gb2312 (uint32_t wch, char *s, size_t avail)
+ucs4_to_gb2312 (uint32_t wch, unsigned char **s, size_t avail)
{
unsigned int ch = (unsigned int) wch;
char buf[2];
@@ -212,11 +212,16 @@ ucs4_to_gb2312 (uint32_t wch, char *s, size_t avail)
return UNKNOWN_10646_CHAR;
}
- if (cp[1] != '\0' && avail < 2)
+ if (cp[0] == '\0')
+ return UNKNOWN_10646_CHAR;
+
+ assert (cp[1] != '\0');
+
+ if (avail < 2)
return 0;
- s[0] = cp[0];
- s[1] = cp[1];
+ *(*s)++ = cp[0];
+ *(*s)++ = cp[1];
return 2;
}