diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-03-28 17:33:37 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-03-28 17:33:37 +0000 |
commit | 77e1d15a1afea1189e6aab66cc6e0ce30e3275ce (patch) | |
tree | 78849a20d1b650791f0a8d9d53404ef21057dd24 /iconvdata | |
parent | b35e58e479cd23ff64ad83a30c6670e355a7d642 (diff) | |
download | glibc-77e1d15a1afea1189e6aab66cc6e0ce30e3275ce.tar.gz glibc-77e1d15a1afea1189e6aab66cc6e0ce30e3275ce.tar.xz glibc-77e1d15a1afea1189e6aab66cc6e0ce30e3275ce.zip |
Update.
2000-03-28 Ulrich Drepper <drepper@redhat.com> * iconvdata/TESTS: Use UCS-2BE instead of UCS2. * iconv/loop.c: Define get16, get32, put16, and put32 macros to allow as well reading from/writing to unaligned addresses on machines which don't support this in hardware. Use FCTNAME macro to define function name. Include the file a second time for platforms which need special unaligned handling. * iconv/skeleton.c: Define get16u, get32u, put16u, and put32u macros to access potentially unaligned addresses. These macros are intended to be used only outside the loops. (unaligned): New definition. In case the machine can handle unaligned access define as zero. Otherwise as a variable which is initialized as nonzero in case the buffer passed in at runtime is unaligned with respect to the character set encoding involved. Call aligned or unaligned looop functions according to unaligned variable. * iconvdata/8bit-gap.c: Use get16, get32, put16, and put32 instead of direct casting pointer to potentially handle unaligned memory accesses. * iconvdata/8bit-generic.c: Likewise. * iconvdata/ansi_x3.110.c: Likewise. * iconvdata/big5.c: Likewise. * iconvdata/euc-cn.c: Likewise. * iconvdata/euc-jp.c: Likewise. * iconvdata/euc-kr.c: Likewise. * iconvdata/euc-tw.c: Likewise. * iconvdata/gbk.c: Likewise. * iconvdata/iso-2022-cn.c: Likewise. * iconvdata/iso-2022-jp.c: Likewise. * iconvdata/iso-2022-kr.c: Likewise. * iconvdata/iso646.c: Likewise. * iconvdata/iso_6937-2.c: Likewise. * iconvdata/iso_6937.c: Likewise. * iconvdata/johab.c: Likewise. * iconvdata/sjis.c: Likewise. * iconvdata/t.61.c: Likewise. * iconvdata/uhc.c: Likewise. * iconvdata/unicode.c: Likewise. * iconvdata/utf-16.c: Likewise. * locale/programs/simple-hash.c: Little optimizations. Remove K&R prototypes. * malloc/Versions [libc] (GLIBC_2.2): Add mcheck_check_all. * malloc/mcheck.c (mcheck_check_all): Renamed from check_all and made public. * malloc/mcheck.h (mcheck_check_all): Declare. * stdio-common/Makefile (tests): Add tst-obprintf.
Diffstat (limited to 'iconvdata')
-rw-r--r-- | iconvdata/8bit-gap.c | 7 | ||||
-rw-r--r-- | iconvdata/8bit-generic.c | 7 | ||||
-rw-r--r-- | iconvdata/TESTS | 6 | ||||
-rw-r--r-- | iconvdata/ansi_x3.110.c | 7 | ||||
-rw-r--r-- | iconvdata/big5.c | 7 | ||||
-rw-r--r-- | iconvdata/euc-cn.c | 7 | ||||
-rw-r--r-- | iconvdata/euc-jp.c | 7 | ||||
-rw-r--r-- | iconvdata/euc-kr.c | 7 | ||||
-rw-r--r-- | iconvdata/euc-tw.c | 7 | ||||
-rw-r--r-- | iconvdata/gbk.c | 7 | ||||
-rw-r--r-- | iconvdata/iso-2022-cn.c | 7 | ||||
-rw-r--r-- | iconvdata/iso-2022-jp.c | 7 | ||||
-rw-r--r-- | iconvdata/iso-2022-kr.c | 7 | ||||
-rw-r--r-- | iconvdata/iso646.c | 7 | ||||
-rw-r--r-- | iconvdata/iso_6937-2.c | 7 | ||||
-rw-r--r-- | iconvdata/iso_6937.c | 7 | ||||
-rw-r--r-- | iconvdata/johab.c | 7 | ||||
-rw-r--r-- | iconvdata/sjis.c | 7 | ||||
-rw-r--r-- | iconvdata/t.61.c | 7 | ||||
-rw-r--r-- | iconvdata/uhc.c | 7 | ||||
-rw-r--r-- | iconvdata/unicode.c | 14 | ||||
-rw-r--r-- | iconvdata/utf-16.c | 42 |
22 files changed, 109 insertions, 86 deletions
diff --git a/iconvdata/8bit-gap.c b/iconvdata/8bit-gap.c index 5ab2975bde..b633c475b8 100644 --- a/iconvdata/8bit-gap.c +++ b/iconvdata/8bit-gap.c @@ -1,6 +1,6 @@ /* Generic conversion to and from 8bit charsets, converting from UCS using gaps. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -55,7 +55,8 @@ struct gap break; \ } \ \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ ++inptr; \ } #include <iconv/loop.c> @@ -68,7 +69,7 @@ struct gap #define BODY \ { \ const struct gap *rp = from_idx; \ - uint32_t ch = *((uint32_t *) inptr); \ + uint32_t ch = get32 (inptr); \ unsigned char res; \ \ if (ch >= 0xffff) \ diff --git a/iconvdata/8bit-generic.c b/iconvdata/8bit-generic.c index bd9da7a576..3543bdf004 100644 --- a/iconvdata/8bit-generic.c +++ b/iconvdata/8bit-generic.c @@ -1,5 +1,5 @@ /* Generic conversion to and from 8bit charsets. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -41,7 +41,8 @@ break; \ } \ \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ ++inptr; \ } #include <iconv/loop.c> @@ -53,7 +54,7 @@ #define LOOPFCT TO_LOOP #define BODY \ { \ - uint32_t ch = *((uint32_t *) inptr); \ + uint32_t ch = get32 (inptr); \ \ if (ch >= sizeof (from_ucs4) / sizeof (from_ucs4[0]) \ || (ch != 0 && from_ucs4[ch] == '\0')) \ diff --git a/iconvdata/TESTS b/iconvdata/TESTS index 50ef97acd1..69d268490f 100644 --- a/iconvdata/TESTS +++ b/iconvdata/TESTS @@ -1,5 +1,5 @@ # Available tests for iconv(1) (and therefore iconv(3)) in GNU libc. -# Copyright (C) 1998, 1999 Free Software Foundation, Inc. +# Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. # This file is part of the GNU C Library. # Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. # @@ -38,12 +38,12 @@ ISO-8859-6 ISO-8859-6 Y UTF8 ISO-8859-7 ISO-8859-7 Y UTF8 ISO-8859-8 ISO-8859-8 Y UTF8 ISO-8859-9 ISO-8859-9 Y UTF8 -ISO-8859-10 ISO-8859-10 Y UCS2 UTF8 +ISO-8859-10 ISO-8859-10 Y UCS-2BE UTF8 ISO-8859-14 ISO-8859-14 Y UTF8 ISO-8859-15 ISO-8859-15 Y UTF8 ANSI_X3.4-1968 ANSI_X3.4-1968 Y UTF8 BS_4730 BS_4730 Y UTF8 -CSA_Z243.4-1985-1 CSA_Z243.4-1985-1 Y UCS2 +CSA_Z243.4-1985-1 CSA_Z243.4-1985-1 Y UCS-2BE CSA_Z243.4-1985-2 CSA_Z243.4-1985-2 Y UCS4 DIN_66003 DIN_66003 Y UTF8 DS_2089 DS_2089 Y UTF8 diff --git a/iconvdata/ansi_x3.110.c b/iconvdata/ansi_x3.110.c index 35658b50d4..1dd214bbe5 100644 --- a/iconvdata/ansi_x3.110.c +++ b/iconvdata/ansi_x3.110.c @@ -1,5 +1,5 @@ /* Generic conversion to and from ANSI_X3.110-1983. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -441,7 +441,8 @@ static const char from_ucs4[][2] = } \ \ inptr += incr; \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ } #include <iconv/loop.c> @@ -454,7 +455,7 @@ static const char from_ucs4[][2] = #define BODY \ { \ char tmp[2]; \ - uint32_t ch = *((uint32_t *) inptr); \ + uint32_t ch = get32 (inptr); \ const char *cp; \ \ if (ch >= sizeof (from_ucs4) / sizeof (from_ucs4[0])) \ diff --git a/iconvdata/big5.c b/iconvdata/big5.c index 5551bbaba8..42d59c31ba 100644 --- a/iconvdata/big5.c +++ b/iconvdata/big5.c @@ -1,5 +1,5 @@ /* Mapping tables for Big5 handling. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -8475,7 +8475,8 @@ static const char from_ucs4_tab13[][2] = else \ ++inptr; \ \ - *((uint32_t *) outptr)++ = ch; \ + putr32 (outptr, ch); \ + outptr += 4; \ } #include <iconv/loop.c> @@ -8487,7 +8488,7 @@ static const char from_ucs4_tab13[][2] = #define LOOPFCT TO_LOOP #define BODY \ { \ - uint32_t ch = *((uint32_t *) inptr); \ + uint32_t ch = get32 (inptr); \ char buf[2]; \ const char *cp; \ \ diff --git a/iconvdata/euc-cn.c b/iconvdata/euc-cn.c index da10cdcc72..61601e7615 100644 --- a/iconvdata/euc-cn.c +++ b/iconvdata/euc-cn.c @@ -1,5 +1,5 @@ /* Mapping tables for EUC-CN handling. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -88,7 +88,8 @@ inptr += 2; \ } \ \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ } #include <iconv/loop.c> @@ -100,7 +101,7 @@ #define LOOPFCT TO_LOOP #define BODY \ { \ - uint32_t ch = *((uint32_t *) inptr); \ + uint32_t ch = get32 (inptr); \ \ if (ch <= L'\x7f') \ /* It's plain ASCII. */ \ diff --git a/iconvdata/euc-jp.c b/iconvdata/euc-jp.c index 3d97c01ce9..2c25d7afda 100644 --- a/iconvdata/euc-jp.c +++ b/iconvdata/euc-jp.c @@ -1,5 +1,5 @@ /* Mapping tables for EUC-JP handling. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -121,7 +121,8 @@ } \ } \ \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ } #include <iconv/loop.c> @@ -133,7 +134,7 @@ #define LOOPFCT TO_LOOP #define BODY \ { \ - uint32_t ch = *((uint32_t *) inptr); \ + uint32_t ch = get32 (inptr); \ \ if (ch <= 0x7f) \ /* It's plain ASCII. */ \ diff --git a/iconvdata/euc-kr.c b/iconvdata/euc-kr.c index f74d7748f9..19516b62eb 100644 --- a/iconvdata/euc-kr.c +++ b/iconvdata/euc-kr.c @@ -1,5 +1,5 @@ /* Mapping tables for EUC-KR handling. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jungshik Shin <jshin@pantheon.yale.edu> and Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -104,7 +104,8 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp) } \ } \ \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ } #include <iconv/loop.c> @@ -116,7 +117,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp) #define LOOPFCT TO_LOOP #define BODY \ { \ - uint32_t ch = *((uint32_t *) inptr); \ + uint32_t ch = get32 (inptr); \ unsigned char cp[2]; \ \ /* Decomposing Hangul syllables not available in KS C 5601 into \ diff --git a/iconvdata/euc-tw.c b/iconvdata/euc-tw.c index 036baaebb1..a508c848ef 100644 --- a/iconvdata/euc-tw.c +++ b/iconvdata/euc-tw.c @@ -1,5 +1,5 @@ /* Mapping tables for EUC-TW handling. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -115,7 +115,8 @@ } \ } \ \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ } #include <iconv/loop.c> @@ -127,7 +128,7 @@ #define LOOPFCT TO_LOOP #define BODY \ { \ - uint32_t ch = *((uint32_t *) inptr); \ + uint32_t ch = get32 (inptr); \ \ if (ch <= 0x7f) \ /* It's plain ASCII. */ \ diff --git a/iconvdata/gbk.c b/iconvdata/gbk.c index 45bfcbcada..9956ea36cf 100644 --- a/iconvdata/gbk.c +++ b/iconvdata/gbk.c @@ -1,5 +1,5 @@ /* Mapping tables for GBK handling. - Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Sean Chen <sean.chen@turbolinux.com>, 1999. @@ -13167,7 +13167,8 @@ static const char __gbk_from_ucs4_tab12[][2] = inptr += 2; \ } \ \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ } #include <iconv/loop.c> @@ -13179,7 +13180,7 @@ static const char __gbk_from_ucs4_tab12[][2] = #define LOOPFCT TO_LOOP #define BODY \ { \ - uint32_t ch = *((uint32_t *) inptr); \ + uint32_t ch = get32 (inptr); \ unsigned char buf[2]; \ const unsigned char *cp = buf; \ \ diff --git a/iconvdata/iso-2022-cn.c b/iconvdata/iso-2022-cn.c index 563d173d66..1b0eefbd40 100644 --- a/iconvdata/iso-2022-cn.c +++ b/iconvdata/iso-2022-cn.c @@ -1,5 +1,5 @@ /* Conversion module for ISO-2022-CN. - Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999. @@ -221,7 +221,8 @@ enum } \ } \ \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ } #define EXTRA_LOOP_DECLS , int *setp #define INIT_PARAMS int set = *setp & CURRENT_MASK; \ @@ -240,7 +241,7 @@ enum uint32_t ch; \ size_t written = 0; \ \ - ch = *((uint32_t *) inptr); \ + ch = get32 (inptr); \ \ /* First see whether we can write the character using the currently \ selected character set. */ \ diff --git a/iconvdata/iso-2022-jp.c b/iconvdata/iso-2022-jp.c index a3c9f7d354..decb6c12a7 100644 --- a/iconvdata/iso-2022-jp.c +++ b/iconvdata/iso-2022-jp.c @@ -1,5 +1,5 @@ /* Conversion module for ISO-2022-JP. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -436,7 +436,8 @@ gconv_end (struct __gconv_step *data) } \ } \ \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ } #define EXTRA_LOOP_DECLS , enum variant var, int *setp #define INIT_PARAMS int set = *setp % 0x100, set2 = *setp / 0x100 @@ -454,7 +455,7 @@ gconv_end (struct __gconv_step *data) uint32_t ch; \ size_t written = 0; \ \ - ch = *((uint32_t *) inptr); \ + ch = get32 (inptr); \ \ /* First see whether we can write the character using the currently \ selected character set. */ \ diff --git a/iconvdata/iso-2022-kr.c b/iconvdata/iso-2022-kr.c index 8ed5d210ff..ea03353065 100644 --- a/iconvdata/iso-2022-kr.c +++ b/iconvdata/iso-2022-kr.c @@ -1,5 +1,5 @@ /* Conversion module for ISO-2022-KR. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -189,7 +189,8 @@ enum } \ } \ \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ } #define EXTRA_LOOP_DECLS , int *setp #define INIT_PARAMS int set = *setp @@ -207,7 +208,7 @@ enum uint32_t ch; \ size_t written = 0; \ \ - ch = *((uint32_t *) inptr); \ + ch = get32 (inptr); \ \ /* First see whether we can write the character using the currently \ selected character set. */ \ diff --git a/iconvdata/iso646.c b/iconvdata/iso646.c index 5b2ba7282f..c8d0a02121 100644 --- a/iconvdata/iso646.c +++ b/iconvdata/iso646.c @@ -1,5 +1,5 @@ /* Conversion to and from the various ISO 646 CCS. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -410,7 +410,8 @@ gconv_end (struct __gconv_step *data) result = failure; \ break; \ } \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ ++inptr; \ } #define EXTRA_LOOP_DECLS , enum variant var @@ -426,7 +427,7 @@ gconv_end (struct __gconv_step *data) unsigned char ch; \ int failure = __GCONV_OK; \ \ - ch = *((uint32_t *) inptr); \ + ch = get32 (inptr); \ switch (*((uint32_t *) inptr)) \ { \ case 0x23: \ diff --git a/iconvdata/iso_6937-2.c b/iconvdata/iso_6937-2.c index 1ec0976aac..a688b7c695 100644 --- a/iconvdata/iso_6937-2.c +++ b/iconvdata/iso_6937-2.c @@ -1,5 +1,5 @@ /* Generic conversion to and from ISO 6937-2. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -446,7 +446,8 @@ static const char from_ucs4[][2] = ++inptr; \ } \ \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ } #include <iconv/loop.c> @@ -459,7 +460,7 @@ static const char from_ucs4[][2] = #define BODY \ { \ char tmp[2]; \ - uint32_t ch = *((uint32_t *) inptr); \ + uint32_t ch = get32 (inptr); \ const char *cp; \ \ if (ch >= sizeof (from_ucs4) / sizeof (from_ucs4[0])) \ diff --git a/iconvdata/iso_6937.c b/iconvdata/iso_6937.c index ca4ab0fada..81e5d0c867 100644 --- a/iconvdata/iso_6937.c +++ b/iconvdata/iso_6937.c @@ -1,5 +1,5 @@ /* Generic conversion to and from ISO 6937. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -438,7 +438,8 @@ static const char from_ucs4[][2] = ++inptr; \ } \ \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ } #include <iconv/loop.c> @@ -451,7 +452,7 @@ static const char from_ucs4[][2] = #define BODY \ { \ char tmp[2]; \ - uint32_t ch = *((uint32_t *) inptr); \ + uint32_t ch = get32 (inptr); \ const char *cp; \ \ if (ch >= sizeof (from_ucs4) / sizeof (from_ucs4[0])) \ diff --git a/iconvdata/johab.c b/iconvdata/johab.c index 4cff932c2f..1822b0d491 100644 --- a/iconvdata/johab.c +++ b/iconvdata/johab.c @@ -1,5 +1,5 @@ /* Mapping tables for JOHAB handling. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jungshik Shin <jshin@pantheon.yale.edu> and Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -274,7 +274,8 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2) inptr += 2; \ } \ \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ } #include <iconv/loop.c> @@ -286,7 +287,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2) #define LOOPFCT TO_LOOP #define BODY \ { \ - uint32_t ch = *((uint32_t *) inptr); \ + uint32_t ch = get32 (inptr); \ /* \ if (ch >= (sizeof (from_ucs4_lat1) / sizeof (from_ucs4_lat1[0]))) \ { \ diff --git a/iconvdata/sjis.c b/iconvdata/sjis.c index d18ab9b25e..4ca7ce985a 100644 --- a/iconvdata/sjis.c +++ b/iconvdata/sjis.c @@ -1,5 +1,5 @@ /* Mapping tables for SJIS handling. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -4410,7 +4410,8 @@ static const char from_ucs4_extra[0x100][2] = } \ } \ \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ } #include <iconv/loop.c> @@ -4422,7 +4423,7 @@ static const char from_ucs4_extra[0x100][2] = #define LOOPFCT TO_LOOP #define BODY \ { \ - uint32_t ch = *((uint32_t *) inptr); \ + uint32_t ch = get32 (inptr); \ const char *cp; \ \ if (ch >= (sizeof (from_ucs4_lat1) / sizeof (from_ucs4_lat1[0]))) \ diff --git a/iconvdata/t.61.c b/iconvdata/t.61.c index 2b8d896238..10a52a1f38 100644 --- a/iconvdata/t.61.c +++ b/iconvdata/t.61.c @@ -1,5 +1,5 @@ /* Generic conversion to and from T.61. - Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -422,7 +422,8 @@ static const char from_ucs4[][2] = break; \ } \ \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ } #include <iconv/loop.c> @@ -435,7 +436,7 @@ static const char from_ucs4[][2] = #define BODY \ { \ char tmp[2]; \ - uint32_t ch = *((uint32_t *) inptr); \ + uint32_t ch = get32 (inptr); \ const char *cp; \ \ if (ch >= sizeof (from_ucs4) / sizeof (from_ucs4[0])) \ diff --git a/iconvdata/uhc.c b/iconvdata/uhc.c index ac4be8a5aa..e42cb2e000 100644 --- a/iconvdata/uhc.c +++ b/iconvdata/uhc.c @@ -1,5 +1,5 @@ /* Mapping tables for UHC handling. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jungshik Shin <jshin@pantheon.yale.edu>, 1998. @@ -3140,7 +3140,8 @@ static const char uhc_hangul_from_ucs[11172][2] = } \ } \ \ - *((uint32_t *) outptr)++ = ch; \ + put32 (outptr, ch); \ + outptr += 4; \ } #include <iconv/loop.c> @@ -3152,7 +3153,7 @@ static const char uhc_hangul_from_ucs[11172][2] = #define LOOPFCT TO_LOOP #define BODY \ { \ - uint32_t ch = *((uint32_t *) inptr); \ + uint32_t ch = get32 (inptr); \ \ if (ch < 0x7f) \ /* XXX Think about 0x5c ; '\'. */ \ diff --git a/iconvdata/unicode.c b/iconvdata/unicode.c index b29976b0c8..0db7a0106b 100644 --- a/iconvdata/unicode.c +++ b/iconvdata/unicode.c @@ -50,10 +50,10 @@ if (inptr + 2 > inbufend) \ return __GCONV_EMPTY_INPUT; \ \ - if (*(uint16_t *) inptr == BOM) \ + if (get16u (inptr) == BOM) \ /* Simply ignore the BOM character. */ \ inptr += 2; \ - else if (*(uint16_t *) inptr == BOM_OE) \ + else if (get16u (inptr) == BOM_OE) \ { \ ((struct unicode_data *) step->__data)->swap = 1; \ inptr += 2; \ @@ -66,7 +66,7 @@ if (outbuf + 2 > outend) \ return __GCONV_FULL_OUTPUT; \ \ - *(uint16_t *) outbuf = BOM; \ + put16u (outbuf, BOM); \ outbuf += 2; \ } \ swap = ((struct unicode_data *) step->__data)->swap; @@ -147,7 +147,7 @@ gconv_end (struct __gconv_step *data) #define LOOPFCT TO_LOOP #define BODY \ { \ - uint32_t c = *((uint32_t *) inptr); \ + uint32_t c = get32 (inptr); \ \ if (c >= 0x10000) \ { \ @@ -155,7 +155,7 @@ gconv_end (struct __gconv_step *data) break; \ } \ \ - *((uint16_t *) outptr) = c; \ + put16 (outptr, c); \ \ outptr += 2; \ inptr += 4; \ @@ -171,12 +171,12 @@ gconv_end (struct __gconv_step *data) #define LOOPFCT FROM_LOOP #define BODY \ { \ - uint16_t u1 = *(uint16_t *) inptr; \ + uint16_t u1 = get16 (inptr); \ \ if (swap) \ u1 = bswap_16 (u1); \ \ - *((uint32_t *) outptr) = u1; \ + put32 (outptr, u1); \ \ inptr += 2; \ outptr += 4; \ diff --git a/iconvdata/utf-16.c b/iconvdata/utf-16.c index c7e677e376..b0b9c47896 100644 --- a/iconvdata/utf-16.c +++ b/iconvdata/utf-16.c @@ -52,10 +52,10 @@ if (inptr + 2 > inbufend) \ return __GCONV_EMPTY_INPUT; \ \ - if (*(uint16_t *) inptr == BOM) \ + if (get16u (inptr) == BOM) \ /* Simply ignore the BOM character. */ \ inptr += 2; \ - else if (*(uint16_t *) inptr == BOM_OE) \ + else if (get16u (inptr) == BOM_OE) \ { \ ((struct utf16_data *) step->__data)->swap = 1; \ inptr += 2; \ @@ -69,7 +69,7 @@ if (outbuf + 2 > outend) \ return __GCONV_FULL_OUTPUT; \ \ - *(uint16_t *) outbuf = BOM; \ + put16u (outbuf, BOM); \ outbuf += 2; \ } #define EXTRA_LOOP_ARGS , var, data, swap @@ -193,7 +193,7 @@ gconv_end (struct __gconv_step *data) #define LOOPFCT TO_LOOP #define BODY \ { \ - uint32_t c = *((uint32_t *) inptr); \ + uint32_t c = get32 (inptr); \ \ if (swap) \ { \ @@ -213,12 +213,12 @@ gconv_end (struct __gconv_step *data) break; \ } \ \ - *((uint16_t *) outptr) = bswap_16 (0xd7c0 + (c >> 10)); \ + put16 (outptr, bswap_16 (0xd7c0 + (c >> 10))); \ outptr += 2; \ - *((uint16_t *) outptr) = bswap_16 (0xdc00 + (c & 0x3ff)); \ + put16 (outptr, bswap_16 (0xdc00 + (c & 0x3ff))); \ } \ else \ - *((uint16_t *) outptr) = bswap_16 (c); \ + put16 (outptr, bswap_16 (c)); \ } \ else \ { \ @@ -238,12 +238,12 @@ gconv_end (struct __gconv_step *data) break; \ } \ \ - *((uint16_t *) outptr) = 0xd7c0 + (c >> 10); \ + put16 (outptr, 0xd7c0 + (c >> 10)); \ outptr += 2; \ - *((uint16_t *) outptr) = 0xdc00 + (c & 0x3ff); \ + put16 (outptr, 0xdc00 + (c & 0x3ff)); \ } \ else \ - *((uint16_t *) outptr) = c; \ + put16 (outptr, c); \ } \ outptr += 2; \ inptr += 4; \ @@ -260,7 +260,7 @@ gconv_end (struct __gconv_step *data) #define LOOPFCT FROM_LOOP #define BODY \ { \ - uint16_t u1 = *(uint16_t *) inptr; \ + uint16_t u1 = get16 (inptr); \ \ if (swap) \ { \ @@ -269,7 +269,7 @@ gconv_end (struct __gconv_step *data) if (u1 < 0xd800 || u1 > 0xdfff) \ { \ /* No surrogate. */ \ - *((uint32_t *) outptr) = u1; \ + put32 (outptr, u1); \ inptr += 2; \ } \ else \ @@ -286,16 +286,18 @@ gconv_end (struct __gconv_step *data) break; \ } \ \ - u2 = bswap_16 (((uint16_t *) inptr)[1]); \ + inptr += 2; \ + u2 = bswap_16 (get16 (inptr)); \ if (u2 < 0xdc00 || u2 >= 0xdfff) \ { \ /* This is no valid second word for a surrogate. */ \ result = __GCONV_ILLEGAL_INPUT; \ + inptr -= 2; \ break; \ } \ \ - *((uint32_t *) outptr) = ((u1 - 0xd7c0) << 10) + (u2 - 0xdc00); \ - inptr += 4; \ + put32 (outptr, ((u1 - 0xd7c0) << 10) + (u2 - 0xdc00)); \ + inptr += 2; \ } \ } \ else \ @@ -303,7 +305,7 @@ gconv_end (struct __gconv_step *data) if (u1 < 0xd800 || u1 > 0xdfff) \ { \ /* No surrogate. */ \ - *((uint32_t *) outptr) = u1; \ + put32 (outptr, u1); \ inptr += 2; \ } \ else \ @@ -320,16 +322,18 @@ gconv_end (struct __gconv_step *data) break; \ } \ \ - u2 = ((uint16_t *) inptr)[1]; \ + inptr += 2; \ + u2 = get16 (inptr); \ if (u2 < 0xdc00 || u2 >= 0xdfff) \ { \ /* This is no valid second word for a surrogate. */ \ result = __GCONV_ILLEGAL_INPUT; \ + inptr -= 2; \ break; \ } \ \ - *((uint32_t *) outptr) = ((u1 - 0xd7c0) << 10) + (u2 - 0xdc00); \ - inptr += 4; \ + put32 (outptr, ((u1 - 0xd7c0) << 10) + (u2 - 0xdc00)); \ + inptr += 2; \ } \ } \ outptr += 4; \ |