aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
authorKenichi Handa2004-01-29 01:25:50 +0000
committerKenichi Handa2004-01-29 01:25:50 +0000
commit75e2a253147e8843a5ff6aff6a6159f5e10c133c (patch)
tree8fd8d128a1ba591cfb7653c7c86aa64d4ae64d0b /src/coding.c
parentc6876370476a2e4f760b784dbf7872423f739be8 (diff)
downloademacs-75e2a253147e8843a5ff6aff6a6159f5e10c133c.tar.gz
emacs-75e2a253147e8843a5ff6aff6a6159f5e10c133c.zip
(detect_coding_iso_2022): Fix handling of SS2 and SS3.
(detect_coding): Treat '\0' as normal ASCII byte.. (detect_coding_system): Likewise.
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/coding.c b/src/coding.c
index eadc55adf6a..457b1ac7801 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -2616,20 +2616,21 @@ detect_coding_iso_2022 (coding, detect_info)
2616 found |= CATEGORY_MASK_ISO_8_ELSE; 2616 found |= CATEGORY_MASK_ISO_8_ELSE;
2617 goto check_extra_latin; 2617 goto check_extra_latin;
2618 2618
2619
2620 case ISO_CODE_SS2: 2619 case ISO_CODE_SS2:
2621 case ISO_CODE_SS3: 2620 case ISO_CODE_SS3:
2622 /* Single shift. */ 2621 /* Single shift. */
2623 if (inhibit_iso_escape_detection) 2622 if (inhibit_iso_escape_detection)
2624 break; 2623 break;
2625 single_shifting = 1; 2624 single_shifting = 0;
2626 rejected |= CATEGORY_MASK_ISO_7BIT; 2625 rejected |= CATEGORY_MASK_ISO_7BIT;
2627 if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1]) 2626 if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1])
2628 & CODING_ISO_FLAG_SINGLE_SHIFT) 2627 & CODING_ISO_FLAG_SINGLE_SHIFT)
2629 found |= CATEGORY_MASK_ISO_8_1; 2628 found |= CATEGORY_MASK_ISO_8_1, single_shifting = 1;
2630 if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_2]) 2629 if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_2])
2631 & CODING_ISO_FLAG_SINGLE_SHIFT) 2630 & CODING_ISO_FLAG_SINGLE_SHIFT)
2632 found |= CATEGORY_MASK_ISO_8_2; 2631 found |= CATEGORY_MASK_ISO_8_2, single_shifting = 1;
2632 if (single_shifting)
2633 break;
2633 goto check_extra_latin; 2634 goto check_extra_latin;
2634 2635
2635 default: 2636 default:
@@ -2680,11 +2681,7 @@ detect_coding_iso_2022 (coding, detect_info)
2680 found |= CATEGORY_MASK_ISO_8_1; 2681 found |= CATEGORY_MASK_ISO_8_1;
2681 else 2682 else
2682 rejected |= CATEGORY_MASK_ISO_8_1; 2683 rejected |= CATEGORY_MASK_ISO_8_1;
2683 if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_2]) 2684 rejected |= CATEGORY_MASK_ISO_8_2;
2684 & CODING_ISO_FLAG_LATIN_EXTRA)
2685 found |= CATEGORY_MASK_ISO_8_2;
2686 else
2687 rejected |= CATEGORY_MASK_ISO_8_2;
2688 } 2685 }
2689 } 2686 }
2690 detect_info->rejected |= CATEGORY_MASK_ISO; 2687 detect_info->rejected |= CATEGORY_MASK_ISO;
@@ -5349,8 +5346,7 @@ detect_coding (coding)
5349 for (i = 0, src = coding->source; src < src_end; i++, src++) 5346 for (i = 0, src = coding->source; src < src_end; i++, src++)
5350 { 5347 {
5351 c = *src; 5348 c = *src;
5352 if (c & 0x80 || (c < 0x20 && (c == 0 5349 if (c & 0x80 || (c < 0x20 && (c == ISO_CODE_ESC
5353 || c == ISO_CODE_ESC
5354 || c == ISO_CODE_SI 5350 || c == ISO_CODE_SI
5355 || c == ISO_CODE_SO))) 5351 || c == ISO_CODE_SO)))
5356 break; 5352 break;
@@ -6878,8 +6874,7 @@ detect_coding_system (src, src_chars, src_bytes, highest, multibytep,
6878 for (i = 0; src < src_end; i++, src++) 6874 for (i = 0; src < src_end; i++, src++)
6879 { 6875 {
6880 c = *src; 6876 c = *src;
6881 if (c & 0x80 || (c < 0x20 && (c == 0 6877 if (c & 0x80 || (c < 0x20 && (c == ISO_CODE_ESC
6882 || c == ISO_CODE_ESC
6883 || c == ISO_CODE_SI 6878 || c == ISO_CODE_SI
6884 || c == ISO_CODE_SO))) 6879 || c == ISO_CODE_SO)))
6885 break; 6880 break;