From a7ea1233631a33dbb1a7203a7f93de0d3b9bace5 Mon Sep 17 00:00:00 2001 From: tomo Date: Fri, 10 Sep 1999 11:14:06 +0000 Subject: [PATCH] (decode_coding_iso2022): Use `DECODE_ADD_UCS_CHAR'; don't use `XCHARSET_REP_BYTES'. --- src/file-coding.c | 44 +++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/src/file-coding.c b/src/file-coding.c index adfc45f..14b0ade 100644 --- a/src/file-coding.c +++ b/src/file-coding.c @@ -5005,9 +5005,23 @@ decode_coding_iso2022 (Lstream *decoding, CONST unsigned char *src, charset = new_charset; } -#ifndef UTF2000 +#ifdef UTF2000 + if (XCHARSET_DIMENSION (charset) == 1) + { + DECODE_OUTPUT_PARTIAL_CHAR (ch); + DECODE_ADD_UCS_CHAR + (MAKE_CHAR (charset, c & 0x7F, 0), dst); + } + else if (ch) + { + DECODE_ADD_UCS_CHAR + (MAKE_CHAR (charset, ch & 0x7F, c & 0x7F), dst); + ch = 0; + } + else + ch = c; +#else lb = XCHARSET_LEADING_BYTE (charset); -#endif switch (XCHARSET_REP_BYTES (charset)) { case 1: /* ASCII */ @@ -5017,44 +5031,25 @@ decode_coding_iso2022 (Lstream *decoding, CONST unsigned char *src, case 2: /* one-byte official */ DECODE_OUTPUT_PARTIAL_CHAR (ch); -#ifdef UTF2000 - DECODE_ADD_UCS_CHAR(MAKE_CHAR(charset, c & 0x7F, 0), dst); -#else Dynarr_add (dst, lb); Dynarr_add (dst, c | 0x80); -#endif break; case 3: /* one-byte private or two-byte official */ -#ifdef UTF2000 - if (XCHARSET_DIMENSION (charset) == 1) -#else if (XCHARSET_PRIVATE_P (charset)) -#endif { DECODE_OUTPUT_PARTIAL_CHAR (ch); -#ifdef UTF2000 - DECODE_ADD_UCS_CHAR(MAKE_CHAR(charset, c & 0x7F, 0), - dst); -#else Dynarr_add (dst, PRE_LEADING_BYTE_PRIVATE_1); Dynarr_add (dst, lb); Dynarr_add (dst, c | 0x80); -#endif } else { if (ch) { -#ifdef UTF2000 - DECODE_ADD_UCS_CHAR(MAKE_CHAR(charset, - ch & 0x7F, - c & 0x7F), dst); -#else Dynarr_add (dst, lb); Dynarr_add (dst, ch | 0x80); Dynarr_add (dst, c | 0x80); -#endif ch = 0; } else @@ -5065,21 +5060,16 @@ decode_coding_iso2022 (Lstream *decoding, CONST unsigned char *src, default: /* two-byte private */ if (ch) { -#ifdef UTF2000 - DECODE_ADD_UCS_CHAR(MAKE_CHAR(charset, - ch & 0x7F, - c & 0x7F), dst); -#else Dynarr_add (dst, PRE_LEADING_BYTE_PRIVATE_2); Dynarr_add (dst, lb); Dynarr_add (dst, ch | 0x80); Dynarr_add (dst, c | 0x80); -#endif ch = 0; } else ch = c; } +#endif } if (!ch) -- 1.7.10.4