diff options
Diffstat (limited to 'lib/libiconv_modules')
32 files changed, 95 insertions, 52 deletions
diff --git a/lib/libiconv_modules/BIG5/Makefile b/lib/libiconv_modules/BIG5/Makefile index 0f755fcd582e..cdaf9ddf1889 100644 --- a/lib/libiconv_modules/BIG5/Makefile +++ b/lib/libiconv_modules/BIG5/Makefile @@ -2,6 +2,6 @@ SHLIB= BIG5 SRCS+= citrus_big5.c -CFLAGS+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=32 .include <bsd.lib.mk> diff --git a/lib/libiconv_modules/BIG5/citrus_big5.c b/lib/libiconv_modules/BIG5/citrus_big5.c index 1d7d8f8235b7..a8376eb628c9 100644 --- a/lib/libiconv_modules/BIG5/citrus_big5.c +++ b/lib/libiconv_modules/BIG5/citrus_big5.c @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_big5.c,v 1.12 2008/06/14 16:01:07 tnozaki Exp $ */ +/* $NetBSD: citrus_big5.c,v 1.13 2011/05/23 14:53:46 joerg Exp $ */ /*- * Copyright (c)2002, 2006 Citrus Project, @@ -92,8 +92,8 @@ typedef struct { typedef struct _BIG5Exclude { TAILQ_ENTRY(_BIG5Exclude) entry; - wint_t end; wint_t start; + wint_t end; } _BIG5Exclude; typedef TAILQ_HEAD(_BIG5ExcludeList, _BIG5Exclude) _BIG5ExcludeList; @@ -123,6 +123,7 @@ _citrus_BIG5_init_state(_BIG5EncodingInfo * __restrict ei __unused, memset(s, 0, sizeof(*s)); } +#if 0 static __inline void /*ARGSUSED*/ _citrus_BIG5_pack_state(_BIG5EncodingInfo * __restrict ei __unused, @@ -142,6 +143,7 @@ _citrus_BIG5_unpack_state(_BIG5EncodingInfo * __restrict ei __unused, memcpy((void *)s, pspriv, sizeof(*s)); } +#endif static __inline int _citrus_BIG5_check(_BIG5EncodingInfo *ei, unsigned int c) @@ -170,7 +172,7 @@ _citrus_BIG5_check_excludes(_BIG5EncodingInfo *ei, wint_t c) } static int -_citrus_BIG5_fill_rowcol(void ** __restrict ctx, const char * __restrict s, +_citrus_BIG5_fill_rowcol(void * __restrict ctx, const char * __restrict s, uint64_t start, uint64_t end) { _BIG5EncodingInfo *ei; @@ -189,7 +191,7 @@ _citrus_BIG5_fill_rowcol(void ** __restrict ctx, const char * __restrict s, static int /*ARGSUSED*/ -_citrus_BIG5_fill_excludes(void ** __restrict ctx, +_citrus_BIG5_fill_excludes(void * __restrict ctx, const char * __restrict s __unused, uint64_t start, uint64_t end) { _BIG5EncodingInfo *ei; @@ -235,7 +237,6 @@ static int _citrus_BIG5_encoding_module_init(_BIG5EncodingInfo * __restrict ei, const void * __restrict var, size_t lenvar) { - void *ctx = (void *)ei; const char *s; int err; @@ -257,9 +258,9 @@ _citrus_BIG5_encoding_module_init(_BIG5EncodingInfo * __restrict ei, } /* fallback Big5-1984, for backward compatibility. */ - _citrus_BIG5_fill_rowcol((void **)&ctx, "row", 0xA1, 0xFE); - _citrus_BIG5_fill_rowcol((void **)&ctx, "col", 0x40, 0x7E); - _citrus_BIG5_fill_rowcol((void **)&ctx, "col", 0xA1, 0xFE); + _citrus_BIG5_fill_rowcol(ei, "row", 0xA1, 0xFE); + _citrus_BIG5_fill_rowcol(ei, "col", 0x40, 0x7E); + _citrus_BIG5_fill_rowcol(ei, "col", 0xA1, 0xFE); return (0); } @@ -357,7 +358,7 @@ _citrus_BIG5_wcrtomb_priv(_BIG5EncodingInfo * __restrict ei, size_t n, wchar_t wc, _BIG5State * __restrict psenc __unused, size_t * __restrict nresult) { - unsigned char l; + size_t l; int ret; /* check invalid sequence */ diff --git a/lib/libiconv_modules/DECHanyu/citrus_dechanyu.c b/lib/libiconv_modules/DECHanyu/citrus_dechanyu.c index 9d1d394c4e5d..fc32018f9799 100644 --- a/lib/libiconv_modules/DECHanyu/citrus_dechanyu.c +++ b/lib/libiconv_modules/DECHanyu/citrus_dechanyu.c @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_dechanyu.c,v 1.3 2008/06/14 16:01:07 tnozaki Exp $ */ +/* $NetBSD: citrus_dechanyu.c,v 1.4 2011/11/19 18:20:13 tnozaki Exp $ */ /*- * Copyright (c)2007 Citrus Project, @@ -78,6 +78,7 @@ _citrus_DECHanyu_init_state(_DECHanyuEncodingInfo * __restrict ei __unused, psenc->chlen = 0; } +#if 0 static __inline void /*ARGSUSED*/ _citrus_DECHanyu_pack_state(_DECHanyuEncodingInfo * __restrict ei __unused, @@ -96,6 +97,7 @@ _citrus_DECHanyu_unpack_state(_DECHanyuEncodingInfo * __restrict ei __unused, memcpy((void *)psenc, pspriv, sizeof(*psenc)); } +#endif static void /*ARGSUSED*/ diff --git a/lib/libiconv_modules/EUC/Makefile b/lib/libiconv_modules/EUC/Makefile index 422aab398388..aeceff40d230 100644 --- a/lib/libiconv_modules/EUC/Makefile +++ b/lib/libiconv_modules/EUC/Makefile @@ -2,6 +2,6 @@ SHLIB= EUC SRCS+= citrus_euc.c -CFLAGS+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=32 .include <bsd.lib.mk> diff --git a/lib/libiconv_modules/EUC/citrus_euc.c b/lib/libiconv_modules/EUC/citrus_euc.c index c153bef69eb2..6483eb5a3265 100644 --- a/lib/libiconv_modules/EUC/citrus_euc.c +++ b/lib/libiconv_modules/EUC/citrus_euc.c @@ -169,6 +169,7 @@ _citrus_EUC_init_state(_EUCEncodingInfo *ei __unused, _EUCState *s) memset(s, 0, sizeof(*s)); } +#if 0 static __inline void /*ARGSUSED*/ _citrus_EUC_pack_state(_EUCEncodingInfo *ei __unused, void *pspriv, @@ -186,6 +187,7 @@ _citrus_EUC_unpack_state(_EUCEncodingInfo *ei __unused, _EUCState *s, memcpy((void *)s, pspriv, sizeof(*s)); } +#endif static int _citrus_EUC_mbrtowc_priv(_EUCEncodingInfo *ei, wchar_t *pwc, const char **s, diff --git a/lib/libiconv_modules/EUCTW/Makefile b/lib/libiconv_modules/EUCTW/Makefile index b85c0359171c..4808ca3ac58b 100644 --- a/lib/libiconv_modules/EUCTW/Makefile +++ b/lib/libiconv_modules/EUCTW/Makefile @@ -2,6 +2,6 @@ SHLIB= EUCTW SRCS+= citrus_euctw.c -CFLAGS+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=32 .include <bsd.lib.mk> diff --git a/lib/libiconv_modules/EUCTW/citrus_euctw.c b/lib/libiconv_modules/EUCTW/citrus_euctw.c index f1f8a497f5f1..c35423ea4382 100644 --- a/lib/libiconv_modules/EUCTW/citrus_euctw.c +++ b/lib/libiconv_modules/EUCTW/citrus_euctw.c @@ -119,7 +119,7 @@ _citrus_EUCTW_count(int cs) case 1: /*FALLTHROUGH*/ case 2: - return (2^cs); + return (1 << cs); case 3: abort(); /*NOTREACHED*/ @@ -136,6 +136,7 @@ _citrus_EUCTW_init_state(_EUCTWEncodingInfo * __restrict ei __unused, memset(s, 0, sizeof(*s)); } +#if 0 static __inline void /*ARGSUSED*/ _citrus_EUCTW_pack_state(_EUCTWEncodingInfo * __restrict ei __unused, @@ -153,6 +154,7 @@ _citrus_EUCTW_unpack_state(_EUCTWEncodingInfo * __restrict ei __unused, memcpy((void *)s, pspriv, sizeof(*s)); } +#endif static int /*ARGSUSED*/ diff --git a/lib/libiconv_modules/GBK2K/Makefile b/lib/libiconv_modules/GBK2K/Makefile index 28dc79603d07..39b3947aa0d7 100644 --- a/lib/libiconv_modules/GBK2K/Makefile +++ b/lib/libiconv_modules/GBK2K/Makefile @@ -2,6 +2,6 @@ SHLIB= GBK2K SRCS+= citrus_gbk2k.c -CFLAGS+= --param max-inline-insns-single=16 +CFLAGS.gcc+= --param max-inline-insns-single=16 .include <bsd.lib.mk> diff --git a/lib/libiconv_modules/GBK2K/citrus_gbk2k.c b/lib/libiconv_modules/GBK2K/citrus_gbk2k.c index 8da5c7c5e5bc..50ea2da7e914 100644 --- a/lib/libiconv_modules/GBK2K/citrus_gbk2k.c +++ b/lib/libiconv_modules/GBK2K/citrus_gbk2k.c @@ -80,6 +80,7 @@ _citrus_GBK2K_init_state(_GBK2KEncodingInfo * __restrict ei __unused, memset(s, 0, sizeof(*s)); } +#if 0 static __inline void /*ARGSUSED*/ _citrus_GBK2K_pack_state(_GBK2KEncodingInfo * __restrict ei __unused, @@ -97,6 +98,7 @@ _citrus_GBK2K_unpack_state(_GBK2KEncodingInfo * __restrict ei __unused, memcpy((void *)s, pspriv, sizeof(*s)); } +#endif static __inline bool _mb_singlebyte(int c) diff --git a/lib/libiconv_modules/HZ/citrus_hz.c b/lib/libiconv_modules/HZ/citrus_hz.c index 9bc7a5b5d60c..f9eb006af8dc 100644 --- a/lib/libiconv_modules/HZ/citrus_hz.c +++ b/lib/libiconv_modules/HZ/citrus_hz.c @@ -65,8 +65,8 @@ typedef enum { } charset_t; typedef struct { - int end; int start; + int end; int width; } range_t; @@ -153,6 +153,7 @@ _citrus_HZ_init_state(_HZEncodingInfo * __restrict ei, psenc->inuse = INIT0(ei); } +#if 0 static __inline void /*ARGSUSED*/ _citrus_HZ_pack_state(_HZEncodingInfo * __restrict ei __unused, @@ -170,6 +171,7 @@ _citrus_HZ_unpack_state(_HZEncodingInfo * __restrict ei __unused, memcpy((void *)psenc, pspriv, sizeof(*psenc)); } +#endif static int _citrus_HZ_mbrtowc_priv(_HZEncodingInfo * __restrict ei, @@ -503,12 +505,12 @@ _citrus_HZ_encoding_module_uninit(_HZEncodingInfo *ei) } static int -_citrus_HZ_parse_char(void **context, const char *name __unused, const char *s) +_citrus_HZ_parse_char(void *context, const char *name __unused, const char *s) { escape_t *escape; void **p; - p = (void **)*context; + p = (void **)context; escape = (escape_t *)p[0]; if (escape->ch != '\0') return (EINVAL); @@ -520,14 +522,14 @@ _citrus_HZ_parse_char(void **context, const char *name __unused, const char *s) } static int -_citrus_HZ_parse_graphic(void **context, const char *name, const char *s) +_citrus_HZ_parse_graphic(void *context, const char *name, const char *s) { _HZEncodingInfo *ei; escape_t *escape; graphic_t *graphic; void **p; - p = (void **)*context; + p = (void **)context; escape = (escape_t *)p[0]; ei = (_HZEncodingInfo *)p[1]; graphic = malloc(sizeof(*graphic)); @@ -589,13 +591,13 @@ _CITRUS_PROP_HINT_END }; static int -_citrus_HZ_parse_escape(void **context, const char *name, const char *s) +_citrus_HZ_parse_escape(void *context, const char *name, const char *s) { _HZEncodingInfo *ei; escape_t *escape; void *p[2]; - ei = (_HZEncodingInfo *)*context; + ei = (_HZEncodingInfo *)context; escape = malloc(sizeof(*escape)); if (escape == NULL) return (EINVAL); diff --git a/lib/libiconv_modules/ISO2022/Makefile b/lib/libiconv_modules/ISO2022/Makefile index 1e865ac74134..8eba7d359bc6 100644 --- a/lib/libiconv_modules/ISO2022/Makefile +++ b/lib/libiconv_modules/ISO2022/Makefile @@ -2,6 +2,6 @@ SHLIB= ISO2022 SRCS+= citrus_iso2022.c -CFLAGS+= --param max-inline-insns-single=128 +CFLAGS.gcc+= --param max-inline-insns-single=128 .include <bsd.lib.mk> diff --git a/lib/libiconv_modules/ISO2022/citrus_iso2022.c b/lib/libiconv_modules/ISO2022/citrus_iso2022.c index 2ae8df6ce844..3402ba8addc0 100644 --- a/lib/libiconv_modules/ISO2022/citrus_iso2022.c +++ b/lib/libiconv_modules/ISO2022/citrus_iso2022.c @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_iso2022.c,v 1.19 2008/06/14 16:01:07 tnozaki Exp $ */ +/* $NetBSD: citrus_iso2022.c,v 1.20 2010/12/07 22:01:45 joerg Exp $ */ /*- * Copyright (c)1999, 2002 Citrus Project, @@ -78,9 +78,9 @@ #define CS96MULTI (3U) typedef struct { - unsigned char interm; - unsigned char final; unsigned char type; + unsigned char final; + unsigned char interm; unsigned char vers; } _ISO2022Charset; @@ -444,6 +444,7 @@ _citrus_ISO2022_init_state(_ISO2022EncodingInfo * __restrict ei, s->flags |= _ISO2022STATE_FLAG_INITIALIZED; } +#if 0 static __inline void /*ARGSUSED*/ _citrus_ISO2022_pack_state(_ISO2022EncodingInfo * __restrict ei __unused, @@ -461,6 +462,7 @@ _citrus_ISO2022_unpack_state(_ISO2022EncodingInfo * __restrict ei __unused, memcpy((void *)s, pspriv, sizeof(*s)); } +#endif static int /*ARGSUSED*/ diff --git a/lib/libiconv_modules/JOHAB/Makefile b/lib/libiconv_modules/JOHAB/Makefile index b94544521665..6a11f7387734 100644 --- a/lib/libiconv_modules/JOHAB/Makefile +++ b/lib/libiconv_modules/JOHAB/Makefile @@ -2,6 +2,6 @@ SHLIB= JOHAB SRCS+= citrus_johab.c -CFLAGS+= --param max-inline-insns-single=16 +CFLAGS.gcc+= --param max-inline-insns-single=16 .include <bsd.lib.mk> diff --git a/lib/libiconv_modules/JOHAB/citrus_johab.c b/lib/libiconv_modules/JOHAB/citrus_johab.c index 0365379dbd04..a533a8584aea 100644 --- a/lib/libiconv_modules/JOHAB/citrus_johab.c +++ b/lib/libiconv_modules/JOHAB/citrus_johab.c @@ -80,6 +80,7 @@ _citrus_JOHAB_init_state(_JOHABEncodingInfo * __restrict ei __unused, psenc->chlen = 0; } +#if 0 static __inline void /*ARGSUSED*/ _citrus_JOHAB_pack_state(_JOHABEncodingInfo * __restrict ei __unused, @@ -97,6 +98,7 @@ _citrus_JOHAB_unpack_state(_JOHABEncodingInfo * __restrict ei __unused, memcpy((void *)psenc, pspriv, sizeof(*psenc)); } +#endif static void /*ARGSUSED*/ diff --git a/lib/libiconv_modules/MSKanji/citrus_mskanji.c b/lib/libiconv_modules/MSKanji/citrus_mskanji.c index fc0f13f36271..85496997bf86 100644 --- a/lib/libiconv_modules/MSKanji/citrus_mskanji.c +++ b/lib/libiconv_modules/MSKanji/citrus_mskanji.c @@ -130,6 +130,7 @@ _citrus_MSKanji_init_state(_MSKanjiEncodingInfo * __restrict ei __unused, s->chlen = 0; } +#if 0 static __inline void /*ARGSUSED*/ _citrus_MSKanji_pack_state(_MSKanjiEncodingInfo * __restrict ei __unused, @@ -147,6 +148,7 @@ _citrus_MSKanji_unpack_state(_MSKanjiEncodingInfo * __restrict ei __unused, memcpy((void *)s, pspriv, sizeof(*s)); } +#endif static int /*ARGSUSED*/ diff --git a/lib/libiconv_modules/Makefile.inc b/lib/libiconv_modules/Makefile.inc index 3b25374b91e5..51ae7184fbbe 100644 --- a/lib/libiconv_modules/Makefile.inc +++ b/lib/libiconv_modules/Makefile.inc @@ -14,4 +14,4 @@ SHLIBDIR= /usr/lib/i18n SHLIBDIR= /usr/lib32/i18n .endif LIBDIR= ${SHLIBDIR} -NO_PROFILE= +MK_PROFILE= no diff --git a/lib/libiconv_modules/UES/Makefile b/lib/libiconv_modules/UES/Makefile index 972e496e1a3b..dc8f2d95dbef 100644 --- a/lib/libiconv_modules/UES/Makefile +++ b/lib/libiconv_modules/UES/Makefile @@ -2,6 +2,6 @@ SHLIB= UES SRCS+= citrus_ues.c -CFLAGS+= --param max-inline-insns-single=64 +CFLAGS.gcc+= --param max-inline-insns-single=64 .include <bsd.lib.mk> diff --git a/lib/libiconv_modules/UES/citrus_ues.c b/lib/libiconv_modules/UES/citrus_ues.c index 872cc1f64a1d..45f54167cdd4 100644 --- a/lib/libiconv_modules/UES/citrus_ues.c +++ b/lib/libiconv_modules/UES/citrus_ues.c @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_ues.c,v 1.1 2006/11/13 15:16:31 tnozaki Exp $ */ +/* $NetBSD: citrus_ues.c,v 1.3 2012/02/12 13:51:29 wiz Exp $ */ /*- * Copyright (c)2006 Citrus Project, @@ -75,6 +75,7 @@ _citrus_UES_init_state(_UESEncodingInfo * __restrict ei __unused, psenc->chlen = 0; } +#if 0 static __inline void /*ARGSUSED*/ _citrus_UES_pack_state(_UESEncodingInfo * __restrict ei __unused, @@ -92,6 +93,7 @@ _citrus_UES_unpack_state(_UESEncodingInfo * __restrict ei __unused, memcpy((void *)psenc, pspriv, sizeof(*psenc)); } +#endif static __inline int to_int(int ch) diff --git a/lib/libiconv_modules/UTF1632/Makefile b/lib/libiconv_modules/UTF1632/Makefile index 71e9f881b1ae..485d0702b40d 100644 --- a/lib/libiconv_modules/UTF1632/Makefile +++ b/lib/libiconv_modules/UTF1632/Makefile @@ -2,6 +2,6 @@ SHLIB= UTF1632 SRCS+= citrus_utf1632.c -CFLAGS+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=32 .include <bsd.lib.mk> diff --git a/lib/libiconv_modules/UTF7/Makefile b/lib/libiconv_modules/UTF7/Makefile index 8bedb73ec61b..733cb26e3d43 100644 --- a/lib/libiconv_modules/UTF7/Makefile +++ b/lib/libiconv_modules/UTF7/Makefile @@ -2,6 +2,6 @@ SHLIB= UTF7 SRCS+= citrus_utf7.c -CFLAGS+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=32 .include <bsd.lib.mk> diff --git a/lib/libiconv_modules/UTF7/citrus_utf7.c b/lib/libiconv_modules/UTF7/citrus_utf7.c index 925be6d228eb..53f4f771f506 100644 --- a/lib/libiconv_modules/UTF7/citrus_utf7.c +++ b/lib/libiconv_modules/UTF7/citrus_utf7.c @@ -87,6 +87,7 @@ _citrus_UTF7_init_state(_UTF7EncodingInfo * __restrict ei __unused, memset((void *)s, 0, sizeof(*s)); } +#if 0 static __inline void /*ARGSUSED*/ _citrus_UTF7_pack_state(_UTF7EncodingInfo * __restrict ei __unused, @@ -104,6 +105,7 @@ _citrus_UTF7_unpack_state(_UTF7EncodingInfo * __restrict ei __unused, memcpy((void *)s, pspriv, sizeof(*s)); } +#endif static const char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -113,9 +115,9 @@ static const char base64[] = static const char direct[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" - "0123456789(),-./:?"; + "0123456789'(),-./:?"; -static const char option[] = "!\"#$%&';<=>@[]^_`{|}"; +static const char option[] = "!\"#$%&*;<=>@[]^_`{|}"; static const char spaces[] = " \t\r\n"; #define BASE64_BIT 6 @@ -165,6 +167,7 @@ _citrus_UTF7_mbtoutf16(_UTF7EncodingInfo * __restrict ei, *nresult = (size_t)-2; *s = s0; sv.chlen = psenc->chlen; + memcpy(sv.ch, psenc->ch, sizeof(sv.ch)); *psenc = sv; return (0); } @@ -202,6 +205,9 @@ _citrus_UTF7_mbtoutf16(_UTF7EncodingInfo * __restrict ei, goto ilseq; *u16 = (uint16_t)psenc->ch[i]; done = 1; + } else { + psenc->chlen--; + i--; } } else { psenc->cache = @@ -241,7 +247,6 @@ _citrus_UTF7_mbrtowc_priv(_UTF7EncodingInfo * __restrict ei, wchar_t * __restrict pwc, const char ** __restrict s, size_t n, _UTF7State * __restrict psenc, size_t * __restrict nresult) { - const char *s0; uint32_t u32; uint16_t hi, lo; size_t nr, siz; @@ -252,14 +257,13 @@ _citrus_UTF7_mbrtowc_priv(_UTF7EncodingInfo * __restrict ei, *nresult = (size_t)_ENCODING_IS_STATE_DEPENDENT; return (0); } - s0 = *s; if (psenc->surrogate) { - hi = (psenc->cache >> 2) & UTF16_MAX; + hi = (psenc->cache >> psenc->bits) & UTF16_MAX; if (hi < HISRG_MIN || hi > HISRG_MAX) return (EINVAL); siz = 0; } else { - err = _citrus_UTF7_mbtoutf16(ei, &hi, &s0, n, psenc, &nr); + err = _citrus_UTF7_mbtoutf16(ei, &hi, s, n, psenc, &nr); if (nr == (size_t)-1 || nr == (size_t)-2) { *nresult = nr; return (err); @@ -274,7 +278,7 @@ _citrus_UTF7_mbrtowc_priv(_UTF7EncodingInfo * __restrict ei, } psenc->surrogate = 1; } - err = _citrus_UTF7_mbtoutf16(ei, &lo, &s0, n, psenc, &nr); + err = _citrus_UTF7_mbtoutf16(ei, &lo, s, n, psenc, &nr); if (nr == (size_t)-1 || nr == (size_t)-2) { *nresult = nr; return (err); @@ -286,7 +290,6 @@ _citrus_UTF7_mbrtowc_priv(_UTF7EncodingInfo * __restrict ei, u32 = (hi << 10 | lo) + SRG_BASE; siz += nr; done: - *s = s0; if (pwc != NULL) *pwc = (wchar_t)u32; if (u32 == (uint32_t)0) { diff --git a/lib/libiconv_modules/UTF8/citrus_utf8.c b/lib/libiconv_modules/UTF8/citrus_utf8.c index cdbc53c49e37..d7c78d3d9174 100644 --- a/lib/libiconv_modules/UTF8/citrus_utf8.c +++ b/lib/libiconv_modules/UTF8/citrus_utf8.c @@ -156,6 +156,7 @@ _citrus_UTF8_init_state(_UTF8EncodingInfo *ei __unused, _UTF8State *s) s->chlen = 0; } +#if 0 static __inline void /*ARGSUSED*/ _citrus_UTF8_pack_state(_UTF8EncodingInfo *ei __unused, void *pspriv, @@ -173,6 +174,7 @@ _citrus_UTF8_unpack_state(_UTF8EncodingInfo *ei __unused, _UTF8State *s, memcpy((void *)s, pspriv, sizeof(*s)); } +#endif static int _citrus_UTF8_mbrtowc_priv(_UTF8EncodingInfo *ei, wchar_t *pwc, const char **s, diff --git a/lib/libiconv_modules/VIQR/citrus_viqr.c b/lib/libiconv_modules/VIQR/citrus_viqr.c index 20175a3b6bea..dddb0b0ce1ba 100644 --- a/lib/libiconv_modules/VIQR/citrus_viqr.c +++ b/lib/libiconv_modules/VIQR/citrus_viqr.c @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_viqr.c,v 1.4 2008/06/14 16:01:08 tnozaki Exp $ */ +/* $NetBSD: citrus_viqr.c,v 1.5 2011/11/19 18:20:13 tnozaki Exp $ */ /*- * Copyright (c)2006 Citrus Project, @@ -230,6 +230,7 @@ _citrus_VIQR_init_state(_VIQREncodingInfo * __restrict ei __unused, psenc->chlen = 0; } +#if 0 static __inline void /*ARGSUSED*/ _citrus_VIQR_pack_state(_VIQREncodingInfo * __restrict ei __unused, @@ -247,6 +248,7 @@ _citrus_VIQR_unpack_state(_VIQREncodingInfo * __restrict ei __unused, memcpy((void *)psenc, pspriv, sizeof(*psenc)); } +#endif static int _citrus_VIQR_mbrtowc_priv(_VIQREncodingInfo * __restrict ei, @@ -431,7 +433,6 @@ static int _citrus_VIQR_encoding_module_init(_VIQREncodingInfo * __restrict ei, const void * __restrict var __unused, size_t lenvar __unused) { - const mnemonic_def_t *p; const char *s; size_t i, n; int errnum; @@ -455,7 +456,10 @@ _citrus_VIQR_encoding_module_init(_VIQREncodingInfo * __restrict ei, return (errnum); } } - for (i = 0;; ++i) { + /* a + 1 < b + 1 here to silence gcc warning about unsigned < 0. */ + for (i = 0; i + 1 < mnemonic_ext_size + 1; ++i) { + const mnemonic_def_t *p; + p = &mnemonic_ext[i]; n = strlen(p->name); if (ei->mb_cur_max < n) diff --git a/lib/libiconv_modules/ZW/citrus_zw.c b/lib/libiconv_modules/ZW/citrus_zw.c index b9dc10b091f7..097fcfe0e136 100644 --- a/lib/libiconv_modules/ZW/citrus_zw.c +++ b/lib/libiconv_modules/ZW/citrus_zw.c @@ -85,6 +85,7 @@ _citrus_ZW_init_state(_ZWEncodingInfo * __restrict ei __unused, psenc->charset = NONE; } +#if 0 static __inline void /*ARGSUSED*/ _citrus_ZW_pack_state(_ZWEncodingInfo * __restrict ei __unused, @@ -102,6 +103,7 @@ _citrus_ZW_unpack_state(_ZWEncodingInfo * __restrict ei __unused, memcpy((void *)psenc, pspriv, sizeof(*psenc)); } +#endif static int _citrus_ZW_mbrtowc_priv(_ZWEncodingInfo * __restrict ei, diff --git a/lib/libiconv_modules/iconv_none/citrus_iconv_none.c b/lib/libiconv_modules/iconv_none/citrus_iconv_none.c index 76bb06f539d0..967ee130ba3d 100644 --- a/lib/libiconv_modules/iconv_none/citrus_iconv_none.c +++ b/lib/libiconv_modules/iconv_none/citrus_iconv_none.c @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_iconv_none.c,v 1.2 2003/07/01 09:42:16 tshiozak Exp $ */ +/* $NetBSD: citrus_iconv_none.c,v 1.3 2011/05/23 14:45:44 joerg Exp $ */ /*- * Copyright (c)2003 Citrus Project, diff --git a/lib/libiconv_modules/iconv_std/Makefile b/lib/libiconv_modules/iconv_std/Makefile index a873cfad5d65..88d68aafc77b 100644 --- a/lib/libiconv_modules/iconv_std/Makefile +++ b/lib/libiconv_modules/iconv_std/Makefile @@ -2,6 +2,6 @@ SHLIB= iconv_std SRCS+= citrus_iconv_std.c -CFLAGS+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=32 .include <bsd.lib.mk> diff --git a/lib/libiconv_modules/iconv_std/citrus_iconv_std.c b/lib/libiconv_modules/iconv_std/citrus_iconv_std.c index b30f09928ae8..7c9b06452f05 100644 --- a/lib/libiconv_modules/iconv_std/citrus_iconv_std.c +++ b/lib/libiconv_modules/iconv_std/citrus_iconv_std.c @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_iconv_std.c,v 1.15 2006/11/13 19:08:19 tnozaki Exp $ */ +/* $NetBSD: citrus_iconv_std.c,v 1.16 2012/02/12 13:51:29 wiz Exp $ */ /*- * Copyright (c)2003 Citrus Project, @@ -543,6 +543,16 @@ _citrus_iconv_std_iconv_convert(struct _citrus_iconv * __restrict cv, ret = do_conv(is, &csid, &idx); if (ret) { if (ret == E_NO_CORRESPONDING_CHAR) { + /* + * GNU iconv returns EILSEQ when no + * corresponding character in the output. + * Some software depends on this behavior + * though this is against POSIX specification. + */ + if (cv->cv_shared->ci_ilseq_invalid != 0) { + ret = EILSEQ; + goto err; + } inval++; szrout = 0; if ((((flags & _CITRUS_ICONV_F_HIDE_INVALID) == 0) && diff --git a/lib/libiconv_modules/mapper_parallel/Makefile b/lib/libiconv_modules/mapper_parallel/Makefile index 000c1cdd6997..b79c3ad08865 100644 --- a/lib/libiconv_modules/mapper_parallel/Makefile +++ b/lib/libiconv_modules/mapper_parallel/Makefile @@ -4,6 +4,6 @@ SHLIB= mapper_parallel SRCS+= citrus_mapper_serial.c -CFLAGS+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=32 .include <bsd.lib.mk> diff --git a/lib/libiconv_modules/mapper_serial/Makefile b/lib/libiconv_modules/mapper_serial/Makefile index 67d4bb0cbfbf..0b5907b7530d 100644 --- a/lib/libiconv_modules/mapper_serial/Makefile +++ b/lib/libiconv_modules/mapper_serial/Makefile @@ -2,6 +2,6 @@ SHLIB= mapper_serial SRCS+= citrus_mapper_serial.c -CFLAGS+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=32 .include <bsd.lib.mk> diff --git a/lib/libiconv_modules/mapper_std/Makefile b/lib/libiconv_modules/mapper_std/Makefile index 0d35e90d788e..aa46ad2b7588 100644 --- a/lib/libiconv_modules/mapper_std/Makefile +++ b/lib/libiconv_modules/mapper_std/Makefile @@ -2,6 +2,6 @@ SHLIB= mapper_std SRCS+= citrus_mapper_std.c -CFLAGS+= --param max-inline-insns-single=8 +CFLAGS.gcc+= --param max-inline-insns-single=8 .include <bsd.lib.mk> diff --git a/lib/libiconv_modules/mapper_std/citrus_mapper_std.c b/lib/libiconv_modules/mapper_std/citrus_mapper_std.c index bc756435bb81..712e9b2f039c 100644 --- a/lib/libiconv_modules/mapper_std/citrus_mapper_std.c +++ b/lib/libiconv_modules/mapper_std/citrus_mapper_std.c @@ -1,5 +1,5 @@ /* $FreeBSD$ */ -/* $NetBSD: citrus_mapper_std.c,v 1.8 2006/09/11 13:06:33 tnozaki Exp $ */ +/* $NetBSD: citrus_mapper_std.c,v 1.10 2011/11/19 18:48:39 tnozaki Exp $ */ /*- * Copyright (c)2003, 2006 Citrus Project, @@ -174,8 +174,11 @@ rowcol_parse_variable_compat(struct _citrus_mapper_std_rowcol *rc, n = be32toh(rcx->rcx_src_row_end); if (m + n > 0) { ret = set_linear_zone(lz, m, n); - if (ret != 0) + if (ret != 0) { + free(rc->rc_src_rowcol); + rc->rc_src_rowcol = NULL; return (ret); + } ++rc->rc_src_rowcol_len, ++lz; } m = be32toh(rcx->rcx_src_col_begin); diff --git a/lib/libiconv_modules/mapper_zone/Makefile b/lib/libiconv_modules/mapper_zone/Makefile index 287bc24e0072..4bdeef603a1e 100644 --- a/lib/libiconv_modules/mapper_zone/Makefile +++ b/lib/libiconv_modules/mapper_zone/Makefile @@ -2,6 +2,6 @@ SHLIB= mapper_zone SRCS+= citrus_mapper_zone.c -CFLAGS+= --param max-inline-insns-single=8 +CFLAGS.gcc+= --param max-inline-insns-single=8 .include <bsd.lib.mk> |