diff options
| author | Paul Eggert | 2011-03-07 20:37:19 -0800 |
|---|---|---|
| committer | Paul Eggert | 2011-03-07 20:37:19 -0800 |
| commit | 2735d0606bd871584b2e6343f3dce4c1a155b296 (patch) | |
| tree | e9068d2b26d01760d14b97c0fe28f3cbca7886d5 /src/coding.c | |
| parent | f38b440c4b40777c25631323f2501ffb5ba98251 (diff) | |
| download | emacs-2735d0606bd871584b2e6343f3dce4c1a155b296.tar.gz emacs-2735d0606bd871584b2e6343f3dce4c1a155b296.zip | |
* coding.c (Fdefine_coding_system_internal): Don't redeclare 'i' inside
a block, when the outer 'i' will do.
(decode_coding_utf_8, decode_coding_utf_16, detect_coding_emacs_mule):
(emacs_mule_char, decode_coding_emacs_mule, detect_coding_iso_2022):
(decode_coding_iso_2022, decode_coding_sjis, decode_coding_big5):
(decode_coding_raw_text, decode_coding_charset, get_translation_table):
(Fdecode_sjis_char, Fdefine_coding_system_internal):
Rename locals to avoid shadowing.
* character.h (FETCH_STRING_CHAR_ADVANCE): Likewise.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 101 |
1 files changed, 50 insertions, 51 deletions
diff --git a/src/coding.c b/src/coding.c index cb13793daba..495e8148b05 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -1320,7 +1320,7 @@ decode_coding_utf_8 (struct coding_system *coding) | |||
| 1320 | int multibytep = coding->src_multibyte; | 1320 | int multibytep = coding->src_multibyte; |
| 1321 | enum utf_bom_type bom = CODING_UTF_8_BOM (coding); | 1321 | enum utf_bom_type bom = CODING_UTF_8_BOM (coding); |
| 1322 | Lisp_Object attr, charset_list; | 1322 | Lisp_Object attr, charset_list; |
| 1323 | int eol_crlf = | 1323 | int eol_dos = |
| 1324 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); | 1324 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); |
| 1325 | int byte_after_cr = -1; | 1325 | int byte_after_cr = -1; |
| 1326 | 1326 | ||
| @@ -1381,7 +1381,7 @@ decode_coding_utf_8 (struct coding_system *coding) | |||
| 1381 | } | 1381 | } |
| 1382 | else if (UTF_8_1_OCTET_P (c1)) | 1382 | else if (UTF_8_1_OCTET_P (c1)) |
| 1383 | { | 1383 | { |
| 1384 | if (eol_crlf && c1 == '\r') | 1384 | if (eol_dos && c1 == '\r') |
| 1385 | ONE_MORE_BYTE (byte_after_cr); | 1385 | ONE_MORE_BYTE (byte_after_cr); |
| 1386 | c = c1; | 1386 | c = c1; |
| 1387 | } | 1387 | } |
| @@ -1639,7 +1639,7 @@ decode_coding_utf_16 (struct coding_system *coding) | |||
| 1639 | enum utf_16_endian_type endian = CODING_UTF_16_ENDIAN (coding); | 1639 | enum utf_16_endian_type endian = CODING_UTF_16_ENDIAN (coding); |
| 1640 | int surrogate = CODING_UTF_16_SURROGATE (coding); | 1640 | int surrogate = CODING_UTF_16_SURROGATE (coding); |
| 1641 | Lisp_Object attr, charset_list; | 1641 | Lisp_Object attr, charset_list; |
| 1642 | int eol_crlf = | 1642 | int eol_dos = |
| 1643 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); | 1643 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); |
| 1644 | int byte_after_cr1 = -1, byte_after_cr2 = -1; | 1644 | int byte_after_cr1 = -1, byte_after_cr2 = -1; |
| 1645 | 1645 | ||
| @@ -1736,7 +1736,7 @@ decode_coding_utf_16 (struct coding_system *coding) | |||
| 1736 | CODING_UTF_16_SURROGATE (coding) = surrogate = c; | 1736 | CODING_UTF_16_SURROGATE (coding) = surrogate = c; |
| 1737 | else | 1737 | else |
| 1738 | { | 1738 | { |
| 1739 | if (eol_crlf && c == '\r') | 1739 | if (eol_dos && c == '\r') |
| 1740 | { | 1740 | { |
| 1741 | ONE_MORE_BYTE (byte_after_cr1); | 1741 | ONE_MORE_BYTE (byte_after_cr1); |
| 1742 | ONE_MORE_BYTE (byte_after_cr2); | 1742 | ONE_MORE_BYTE (byte_after_cr2); |
| @@ -1920,17 +1920,17 @@ detect_coding_emacs_mule (struct coding_system *coding, | |||
| 1920 | it because analyzing it is too heavy for detecting. But, | 1920 | it because analyzing it is too heavy for detecting. But, |
| 1921 | at least, we check that the composite character | 1921 | at least, we check that the composite character |
| 1922 | constitutes of more than 4 bytes. */ | 1922 | constitutes of more than 4 bytes. */ |
| 1923 | const unsigned char *src_base; | 1923 | const unsigned char *src_start; |
| 1924 | 1924 | ||
| 1925 | repeat: | 1925 | repeat: |
| 1926 | src_base = src; | 1926 | src_start = src; |
| 1927 | do | 1927 | do |
| 1928 | { | 1928 | { |
| 1929 | ONE_MORE_BYTE (c); | 1929 | ONE_MORE_BYTE (c); |
| 1930 | } | 1930 | } |
| 1931 | while (c >= 0xA0); | 1931 | while (c >= 0xA0); |
| 1932 | 1932 | ||
| 1933 | if (src - src_base <= 4) | 1933 | if (src - src_start <= 4) |
| 1934 | break; | 1934 | break; |
| 1935 | found = CATEGORY_MASK_EMACS_MULE; | 1935 | found = CATEGORY_MASK_EMACS_MULE; |
| 1936 | if (c == 0x80) | 1936 | if (c == 0x80) |
| @@ -1990,7 +1990,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, | |||
| 1990 | const unsigned char *src_end = coding->source + coding->src_bytes; | 1990 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| 1991 | const unsigned char *src_base = src; | 1991 | const unsigned char *src_base = src; |
| 1992 | int multibytep = coding->src_multibyte; | 1992 | int multibytep = coding->src_multibyte; |
| 1993 | int charset_id; | 1993 | int charset_ID; |
| 1994 | unsigned code; | 1994 | unsigned code; |
| 1995 | int c; | 1995 | int c; |
| 1996 | int consumed_chars = 0; | 1996 | int consumed_chars = 0; |
| @@ -2000,7 +2000,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, | |||
| 2000 | if (c < 0) | 2000 | if (c < 0) |
| 2001 | { | 2001 | { |
| 2002 | c = -c; | 2002 | c = -c; |
| 2003 | charset_id = emacs_mule_charset[0]; | 2003 | charset_ID = emacs_mule_charset[0]; |
| 2004 | } | 2004 | } |
| 2005 | else | 2005 | else |
| 2006 | { | 2006 | { |
| @@ -2036,7 +2036,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, | |||
| 2036 | switch (emacs_mule_bytes[c]) | 2036 | switch (emacs_mule_bytes[c]) |
| 2037 | { | 2037 | { |
| 2038 | case 2: | 2038 | case 2: |
| 2039 | if ((charset_id = emacs_mule_charset[c]) < 0) | 2039 | if ((charset_ID = emacs_mule_charset[c]) < 0) |
| 2040 | goto invalid_code; | 2040 | goto invalid_code; |
| 2041 | ONE_MORE_BYTE (c); | 2041 | ONE_MORE_BYTE (c); |
| 2042 | if (c < 0xA0) | 2042 | if (c < 0xA0) |
| @@ -2049,7 +2049,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, | |||
| 2049 | || c == EMACS_MULE_LEADING_CODE_PRIVATE_12) | 2049 | || c == EMACS_MULE_LEADING_CODE_PRIVATE_12) |
| 2050 | { | 2050 | { |
| 2051 | ONE_MORE_BYTE (c); | 2051 | ONE_MORE_BYTE (c); |
| 2052 | if (c < 0xA0 || (charset_id = emacs_mule_charset[c]) < 0) | 2052 | if (c < 0xA0 || (charset_ID = emacs_mule_charset[c]) < 0) |
| 2053 | goto invalid_code; | 2053 | goto invalid_code; |
| 2054 | ONE_MORE_BYTE (c); | 2054 | ONE_MORE_BYTE (c); |
| 2055 | if (c < 0xA0) | 2055 | if (c < 0xA0) |
| @@ -2058,7 +2058,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, | |||
| 2058 | } | 2058 | } |
| 2059 | else | 2059 | else |
| 2060 | { | 2060 | { |
| 2061 | if ((charset_id = emacs_mule_charset[c]) < 0) | 2061 | if ((charset_ID = emacs_mule_charset[c]) < 0) |
| 2062 | goto invalid_code; | 2062 | goto invalid_code; |
| 2063 | ONE_MORE_BYTE (c); | 2063 | ONE_MORE_BYTE (c); |
| 2064 | if (c < 0xA0) | 2064 | if (c < 0xA0) |
| @@ -2073,7 +2073,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, | |||
| 2073 | 2073 | ||
| 2074 | case 4: | 2074 | case 4: |
| 2075 | ONE_MORE_BYTE (c); | 2075 | ONE_MORE_BYTE (c); |
| 2076 | if (c < 0 || (charset_id = emacs_mule_charset[c]) < 0) | 2076 | if (c < 0 || (charset_ID = emacs_mule_charset[c]) < 0) |
| 2077 | goto invalid_code; | 2077 | goto invalid_code; |
| 2078 | ONE_MORE_BYTE (c); | 2078 | ONE_MORE_BYTE (c); |
| 2079 | if (c < 0xA0) | 2079 | if (c < 0xA0) |
| @@ -2087,21 +2087,21 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, | |||
| 2087 | 2087 | ||
| 2088 | case 1: | 2088 | case 1: |
| 2089 | code = c; | 2089 | code = c; |
| 2090 | charset_id = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit; | 2090 | charset_ID = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit; |
| 2091 | break; | 2091 | break; |
| 2092 | 2092 | ||
| 2093 | default: | 2093 | default: |
| 2094 | abort (); | 2094 | abort (); |
| 2095 | } | 2095 | } |
| 2096 | CODING_DECODE_CHAR (coding, src, src_base, src_end, | 2096 | CODING_DECODE_CHAR (coding, src, src_base, src_end, |
| 2097 | CHARSET_FROM_ID (charset_id), code, c); | 2097 | CHARSET_FROM_ID (charset_ID), code, c); |
| 2098 | if (c < 0) | 2098 | if (c < 0) |
| 2099 | goto invalid_code; | 2099 | goto invalid_code; |
| 2100 | } | 2100 | } |
| 2101 | *nbytes = src - src_base; | 2101 | *nbytes = src - src_base; |
| 2102 | *nchars = consumed_chars; | 2102 | *nchars = consumed_chars; |
| 2103 | if (id) | 2103 | if (id) |
| 2104 | *id = charset_id; | 2104 | *id = charset_ID; |
| 2105 | return (mseq_found ? -c : c); | 2105 | return (mseq_found ? -c : c); |
| 2106 | 2106 | ||
| 2107 | no_more_source: | 2107 | no_more_source: |
| @@ -2374,7 +2374,7 @@ decode_coding_emacs_mule (struct coding_system *coding) | |||
| 2374 | int char_offset = coding->produced_char; | 2374 | int char_offset = coding->produced_char; |
| 2375 | int last_offset = char_offset; | 2375 | int last_offset = char_offset; |
| 2376 | int last_id = charset_ascii; | 2376 | int last_id = charset_ascii; |
| 2377 | int eol_crlf = | 2377 | int eol_dos = |
| 2378 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); | 2378 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); |
| 2379 | int byte_after_cr = -1; | 2379 | int byte_after_cr = -1; |
| 2380 | struct composition_status *cmp_status = &coding->spec.emacs_mule.cmp_status; | 2380 | struct composition_status *cmp_status = &coding->spec.emacs_mule.cmp_status; |
| @@ -2424,7 +2424,7 @@ decode_coding_emacs_mule (struct coding_system *coding) | |||
| 2424 | 2424 | ||
| 2425 | if (c < 0x80) | 2425 | if (c < 0x80) |
| 2426 | { | 2426 | { |
| 2427 | if (eol_crlf && c == '\r') | 2427 | if (eol_dos && c == '\r') |
| 2428 | ONE_MORE_BYTE (byte_after_cr); | 2428 | ONE_MORE_BYTE (byte_after_cr); |
| 2429 | id = charset_ascii; | 2429 | id = charset_ascii; |
| 2430 | if (cmp_status->state != COMPOSING_NO) | 2430 | if (cmp_status->state != COMPOSING_NO) |
| @@ -3160,7 +3160,7 @@ detect_coding_iso_2022 (struct coding_system *coding, | |||
| 3160 | if (! single_shifting | 3160 | if (! single_shifting |
| 3161 | && ! (rejected & CATEGORY_MASK_ISO_8_2)) | 3161 | && ! (rejected & CATEGORY_MASK_ISO_8_2)) |
| 3162 | { | 3162 | { |
| 3163 | int i = 1; | 3163 | int len = 1; |
| 3164 | while (src < src_end) | 3164 | while (src < src_end) |
| 3165 | { | 3165 | { |
| 3166 | src_base = src; | 3166 | src_base = src; |
| @@ -3170,20 +3170,20 @@ detect_coding_iso_2022 (struct coding_system *coding, | |||
| 3170 | src = src_base; | 3170 | src = src_base; |
| 3171 | break; | 3171 | break; |
| 3172 | } | 3172 | } |
| 3173 | i++; | 3173 | len++; |
| 3174 | } | 3174 | } |
| 3175 | 3175 | ||
| 3176 | if (i & 1 && src < src_end) | 3176 | if (len & 1 && src < src_end) |
| 3177 | { | 3177 | { |
| 3178 | rejected |= CATEGORY_MASK_ISO_8_2; | 3178 | rejected |= CATEGORY_MASK_ISO_8_2; |
| 3179 | if (composition_count >= 0) | 3179 | if (composition_count >= 0) |
| 3180 | composition_count += i; | 3180 | composition_count += len; |
| 3181 | } | 3181 | } |
| 3182 | else | 3182 | else |
| 3183 | { | 3183 | { |
| 3184 | found |= CATEGORY_MASK_ISO_8_2; | 3184 | found |= CATEGORY_MASK_ISO_8_2; |
| 3185 | if (composition_count >= 0) | 3185 | if (composition_count >= 0) |
| 3186 | composition_count += i / 2; | 3186 | composition_count += len / 2; |
| 3187 | } | 3187 | } |
| 3188 | } | 3188 | } |
| 3189 | break; | 3189 | break; |
| @@ -3311,10 +3311,10 @@ detect_coding_iso_2022 (struct coding_system *coding, | |||
| 3311 | } \ | 3311 | } \ |
| 3312 | else /* new format (after ver.21) */ \ | 3312 | else /* new format (after ver.21) */ \ |
| 3313 | { \ | 3313 | { \ |
| 3314 | int c; \ | 3314 | int b; \ |
| 3315 | \ | 3315 | \ |
| 3316 | ONE_MORE_BYTE (c); \ | 3316 | ONE_MORE_BYTE (b); \ |
| 3317 | rule = COMPOSITION_ENCODE_RULE (rule - 81, c - 32); \ | 3317 | rule = COMPOSITION_ENCODE_RULE (rule - 81, b - 32); \ |
| 3318 | if (rule >= 0) \ | 3318 | if (rule >= 0) \ |
| 3319 | rule += 0x100; /* to destinguish it from the old format */ \ | 3319 | rule += 0x100; /* to destinguish it from the old format */ \ |
| 3320 | nbytes = 2; \ | 3320 | nbytes = 2; \ |
| @@ -3506,7 +3506,7 @@ decode_coding_iso_2022 (struct coding_system *coding) | |||
| 3506 | int char_offset = coding->produced_char; | 3506 | int char_offset = coding->produced_char; |
| 3507 | int last_offset = char_offset; | 3507 | int last_offset = char_offset; |
| 3508 | int last_id = charset_ascii; | 3508 | int last_id = charset_ascii; |
| 3509 | int eol_crlf = | 3509 | int eol_dos = |
| 3510 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); | 3510 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); |
| 3511 | int byte_after_cr = -1; | 3511 | int byte_after_cr = -1; |
| 3512 | int i; | 3512 | int i; |
| @@ -3626,7 +3626,7 @@ decode_coding_iso_2022 (struct coding_system *coding) | |||
| 3626 | break; | 3626 | break; |
| 3627 | 3627 | ||
| 3628 | case ISO_control_0: | 3628 | case ISO_control_0: |
| 3629 | if (eol_crlf && c1 == '\r') | 3629 | if (eol_dos && c1 == '\r') |
| 3630 | ONE_MORE_BYTE (byte_after_cr); | 3630 | ONE_MORE_BYTE (byte_after_cr); |
| 3631 | MAYBE_FINISH_COMPOSITION (); | 3631 | MAYBE_FINISH_COMPOSITION (); |
| 3632 | charset = CHARSET_FROM_ID (charset_ascii); | 3632 | charset = CHARSET_FROM_ID (charset_ascii); |
| @@ -4031,7 +4031,6 @@ decode_coding_iso_2022 (struct coding_system *coding) | |||
| 4031 | const char *intermediate_char_94 = "()*+"; \ | 4031 | const char *intermediate_char_94 = "()*+"; \ |
| 4032 | const char *intermediate_char_96 = ",-./"; \ | 4032 | const char *intermediate_char_96 = ",-./"; \ |
| 4033 | int revision = -1; \ | 4033 | int revision = -1; \ |
| 4034 | int c; \ | ||
| 4035 | \ | 4034 | \ |
| 4036 | if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_REVISION) \ | 4035 | if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_REVISION) \ |
| 4037 | revision = CHARSET_ISO_REVISION (charset); \ | 4036 | revision = CHARSET_ISO_REVISION (charset); \ |
| @@ -4044,11 +4043,12 @@ decode_coding_iso_2022 (struct coding_system *coding) | |||
| 4044 | EMIT_ONE_ASCII_BYTE (ISO_CODE_ESC); \ | 4043 | EMIT_ONE_ASCII_BYTE (ISO_CODE_ESC); \ |
| 4045 | if (CHARSET_DIMENSION (charset) == 1) \ | 4044 | if (CHARSET_DIMENSION (charset) == 1) \ |
| 4046 | { \ | 4045 | { \ |
| 4046 | int b; \ | ||
| 4047 | if (! CHARSET_ISO_CHARS_96 (charset)) \ | 4047 | if (! CHARSET_ISO_CHARS_96 (charset)) \ |
| 4048 | c = intermediate_char_94[reg]; \ | 4048 | b = intermediate_char_94[reg]; \ |
| 4049 | else \ | 4049 | else \ |
| 4050 | c = intermediate_char_96[reg]; \ | 4050 | b = intermediate_char_96[reg]; \ |
| 4051 | EMIT_ONE_ASCII_BYTE (c); \ | 4051 | EMIT_ONE_ASCII_BYTE (b); \ |
| 4052 | } \ | 4052 | } \ |
| 4053 | else \ | 4053 | else \ |
| 4054 | { \ | 4054 | { \ |
| @@ -4709,7 +4709,7 @@ decode_coding_sjis (struct coding_system *coding) | |||
| 4709 | int char_offset = coding->produced_char; | 4709 | int char_offset = coding->produced_char; |
| 4710 | int last_offset = char_offset; | 4710 | int last_offset = char_offset; |
| 4711 | int last_id = charset_ascii; | 4711 | int last_id = charset_ascii; |
| 4712 | int eol_crlf = | 4712 | int eol_dos = |
| 4713 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); | 4713 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); |
| 4714 | int byte_after_cr = -1; | 4714 | int byte_after_cr = -1; |
| 4715 | 4715 | ||
| @@ -4744,7 +4744,7 @@ decode_coding_sjis (struct coding_system *coding) | |||
| 4744 | goto invalid_code; | 4744 | goto invalid_code; |
| 4745 | if (c < 0x80) | 4745 | if (c < 0x80) |
| 4746 | { | 4746 | { |
| 4747 | if (eol_crlf && c == '\r') | 4747 | if (eol_dos && c == '\r') |
| 4748 | ONE_MORE_BYTE (byte_after_cr); | 4748 | ONE_MORE_BYTE (byte_after_cr); |
| 4749 | charset = charset_roman; | 4749 | charset = charset_roman; |
| 4750 | } | 4750 | } |
| @@ -4826,7 +4826,7 @@ decode_coding_big5 (struct coding_system *coding) | |||
| 4826 | int char_offset = coding->produced_char; | 4826 | int char_offset = coding->produced_char; |
| 4827 | int last_offset = char_offset; | 4827 | int last_offset = char_offset; |
| 4828 | int last_id = charset_ascii; | 4828 | int last_id = charset_ascii; |
| 4829 | int eol_crlf = | 4829 | int eol_dos = |
| 4830 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); | 4830 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); |
| 4831 | int byte_after_cr = -1; | 4831 | int byte_after_cr = -1; |
| 4832 | 4832 | ||
| @@ -4859,7 +4859,7 @@ decode_coding_big5 (struct coding_system *coding) | |||
| 4859 | goto invalid_code; | 4859 | goto invalid_code; |
| 4860 | if (c < 0x80) | 4860 | if (c < 0x80) |
| 4861 | { | 4861 | { |
| 4862 | if (eol_crlf && c == '\r') | 4862 | if (eol_dos && c == '\r') |
| 4863 | ONE_MORE_BYTE (byte_after_cr); | 4863 | ONE_MORE_BYTE (byte_after_cr); |
| 4864 | charset = charset_roman; | 4864 | charset = charset_roman; |
| 4865 | } | 4865 | } |
| @@ -5263,13 +5263,13 @@ encode_coding_ccl (struct coding_system *coding) | |||
| 5263 | static void | 5263 | static void |
| 5264 | decode_coding_raw_text (struct coding_system *coding) | 5264 | decode_coding_raw_text (struct coding_system *coding) |
| 5265 | { | 5265 | { |
| 5266 | int eol_crlf = | 5266 | int eol_dos = |
| 5267 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); | 5267 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); |
| 5268 | 5268 | ||
| 5269 | coding->chars_at_source = 1; | 5269 | coding->chars_at_source = 1; |
| 5270 | coding->consumed_char = coding->src_chars; | 5270 | coding->consumed_char = coding->src_chars; |
| 5271 | coding->consumed = coding->src_bytes; | 5271 | coding->consumed = coding->src_bytes; |
| 5272 | if (eol_crlf && coding->source[coding->src_bytes - 1] == '\r') | 5272 | if (eol_dos && coding->source[coding->src_bytes - 1] == '\r') |
| 5273 | { | 5273 | { |
| 5274 | coding->consumed_char--; | 5274 | coding->consumed_char--; |
| 5275 | coding->consumed--; | 5275 | coding->consumed--; |
| @@ -5482,7 +5482,7 @@ decode_coding_charset (struct coding_system *coding) | |||
| 5482 | int char_offset = coding->produced_char; | 5482 | int char_offset = coding->produced_char; |
| 5483 | int last_offset = char_offset; | 5483 | int last_offset = char_offset; |
| 5484 | int last_id = charset_ascii; | 5484 | int last_id = charset_ascii; |
| 5485 | int eol_crlf = | 5485 | int eol_dos = |
| 5486 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); | 5486 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); |
| 5487 | int byte_after_cr = -1; | 5487 | int byte_after_cr = -1; |
| 5488 | 5488 | ||
| @@ -5516,7 +5516,7 @@ decode_coding_charset (struct coding_system *coding) | |||
| 5516 | else | 5516 | else |
| 5517 | { | 5517 | { |
| 5518 | ONE_MORE_BYTE (c); | 5518 | ONE_MORE_BYTE (c); |
| 5519 | if (eol_crlf && c == '\r') | 5519 | if (eol_dos && c == '\r') |
| 5520 | ONE_MORE_BYTE (byte_after_cr); | 5520 | ONE_MORE_BYTE (byte_after_cr); |
| 5521 | } | 5521 | } |
| 5522 | if (c < 0) | 5522 | if (c < 0) |
| @@ -6609,15 +6609,15 @@ get_translation_table (Lisp_Object attrs, int encodep, int *max_lookup) | |||
| 6609 | } | 6609 | } |
| 6610 | else if (CONSP (translation_table)) | 6610 | else if (CONSP (translation_table)) |
| 6611 | { | 6611 | { |
| 6612 | Lisp_Object tail, val; | 6612 | Lisp_Object tail; |
| 6613 | 6613 | ||
| 6614 | for (tail = translation_table; CONSP (tail); tail = XCDR (tail)) | 6614 | for (tail = translation_table; CONSP (tail); tail = XCDR (tail)) |
| 6615 | if (CHAR_TABLE_P (XCAR (tail)) | 6615 | if (CHAR_TABLE_P (XCAR (tail)) |
| 6616 | && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (XCAR (tail))) > 1) | 6616 | && CHAR_TABLE_EXTRA_SLOTS (XCHAR_TABLE (XCAR (tail))) > 1) |
| 6617 | { | 6617 | { |
| 6618 | val = XCHAR_TABLE (XCAR (tail))->extras[1]; | 6618 | Lisp_Object tailval = XCHAR_TABLE (XCAR (tail))->extras[1]; |
| 6619 | if (NATNUMP (val) && *max_lookup < XFASTINT (val)) | 6619 | if (NATNUMP (tailval) && *max_lookup < XFASTINT (tailval)) |
| 6620 | *max_lookup = XFASTINT (val); | 6620 | *max_lookup = XFASTINT (tailval); |
| 6621 | } | 6621 | } |
| 6622 | } | 6622 | } |
| 6623 | } | 6623 | } |
| @@ -9114,10 +9114,10 @@ Return the corresponding character. */) | |||
| 9114 | } | 9114 | } |
| 9115 | else | 9115 | else |
| 9116 | { | 9116 | { |
| 9117 | int s1 = c >> 8, s2 = c & 0xFF; | 9117 | int c1 = c >> 8, c2 = c & 0xFF; |
| 9118 | 9118 | ||
| 9119 | if (s1 < 0x81 || (s1 > 0x9F && s1 < 0xE0) || s1 > 0xEF | 9119 | if (c1 < 0x81 || (c1 > 0x9F && c1 < 0xE0) || c1 > 0xEF |
| 9120 | || s2 < 0x40 || s2 == 0x7F || s2 > 0xFC) | 9120 | || c2 < 0x40 || c2 == 0x7F || c2 > 0xFC) |
| 9121 | error ("Invalid code: %d", code); | 9121 | error ("Invalid code: %d", code); |
| 9122 | SJIS_TO_JIS (c); | 9122 | SJIS_TO_JIS (c); |
| 9123 | charset = charset_kanji; | 9123 | charset = charset_kanji; |
| @@ -9800,7 +9800,6 @@ usage: (define-coding-system-internal ...) */) | |||
| 9800 | else if (EQ (coding_type, Qiso_2022)) | 9800 | else if (EQ (coding_type, Qiso_2022)) |
| 9801 | { | 9801 | { |
| 9802 | Lisp_Object initial, reg_usage, request, flags; | 9802 | Lisp_Object initial, reg_usage, request, flags; |
| 9803 | int i; | ||
| 9804 | 9803 | ||
| 9805 | if (nargs < coding_arg_iso2022_max) | 9804 | if (nargs < coding_arg_iso2022_max) |
| 9806 | goto short_args; | 9805 | goto short_args; |
| @@ -9832,12 +9831,12 @@ usage: (define-coding-system-internal ...) */) | |||
| 9832 | for (tail = request; ! NILP (tail); tail = Fcdr (tail)) | 9831 | for (tail = request; ! NILP (tail); tail = Fcdr (tail)) |
| 9833 | { | 9832 | { |
| 9834 | int id; | 9833 | int id; |
| 9835 | Lisp_Object tmp; | 9834 | Lisp_Object tmp1; |
| 9836 | 9835 | ||
| 9837 | val = Fcar (tail); | 9836 | val = Fcar (tail); |
| 9838 | CHECK_CONS (val); | 9837 | CHECK_CONS (val); |
| 9839 | tmp = XCAR (val); | 9838 | tmp1 = XCAR (val); |
| 9840 | CHECK_CHARSET_GET_ID (tmp, id); | 9839 | CHECK_CHARSET_GET_ID (tmp1, id); |
| 9841 | CHECK_NATNUM_CDR (val); | 9840 | CHECK_NATNUM_CDR (val); |
| 9842 | if (XINT (XCDR (val)) >= 4) | 9841 | if (XINT (XCDR (val)) >= 4) |
| 9843 | error ("Invalid graphic register number: %d", XINT (XCDR (val))); | 9842 | error ("Invalid graphic register number: %d", XINT (XCDR (val))); |