diff options
author | sjg <sjg@FreeBSD.org> | 2014-04-27 08:13:43 +0000 |
---|---|---|
committer | sjg <sjg@FreeBSD.org> | 2014-04-27 08:13:43 +0000 |
commit | 0c7e03a54c8e7ddc9c3fe710f83d9ca53173692e (patch) | |
tree | b92e741b68057a24e381faa9809f32030d65574c /lib/libiconv_modules/UTF7 | |
parent | c244fcbcaa61dc2a15995e7dbdf3ae8107bc2111 (diff) | |
parent | 69c3e6933b6946c49fe99b19986f018d71621980 (diff) | |
download | FreeBSD-src-0c7e03a54c8e7ddc9c3fe710f83d9ca53173692e.zip FreeBSD-src-0c7e03a54c8e7ddc9c3fe710f83d9ca53173692e.tar.gz |
Merge head
Diffstat (limited to 'lib/libiconv_modules/UTF7')
-rw-r--r-- | lib/libiconv_modules/UTF7/Makefile | 2 | ||||
-rw-r--r-- | lib/libiconv_modules/UTF7/citrus_utf7.c | 19 |
2 files changed, 12 insertions, 9 deletions
diff --git a/lib/libiconv_modules/UTF7/Makefile b/lib/libiconv_modules/UTF7/Makefile index 8bedb73..733cb26 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 925be6d..53f4f77 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) { |