diff options
| author | Kenichi Handa | 2003-06-05 12:34:31 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2003-06-05 12:34:31 +0000 |
| commit | d3e4cb56a3c9db1838b934256c4442512a131df4 (patch) | |
| tree | c40cde6fca33da5725390abd6d7030071a1648da /src/coding.c | |
| parent | 54ab3d3bb06d0102b9c17da9db464607399d220f (diff) | |
| download | emacs-d3e4cb56a3c9db1838b934256c4442512a131df4.tar.gz emacs-d3e4cb56a3c9db1838b934256c4442512a131df4.zip | |
(decode_coding_iso_2022): Fix handling of invalid
bytes.
(raw_text_coding_system): Check NILP (coding_system).
(coding_inherit_eol_type): Check NILP (coding_system) and
NILP (parent).
(consume_chars): Fix for the case of raw-text.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/coding.c b/src/coding.c index 8e5efe82746..7fc2a007ad7 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -3186,7 +3186,6 @@ decode_coding_iso_2022 (coding) | |||
| 3186 | *charbuf++ = *src_base; | 3186 | *charbuf++ = *src_base; |
| 3187 | else | 3187 | else |
| 3188 | *charbuf++ = BYTE8_TO_CHAR (*src_base); | 3188 | *charbuf++ = BYTE8_TO_CHAR (*src_base); |
| 3189 | char_offset++; | ||
| 3190 | } | 3189 | } |
| 3191 | } | 3190 | } |
| 3192 | else if (composition_state == COMPOSING_NO) | 3191 | else if (composition_state == COMPOSING_NO) |
| @@ -4985,6 +4984,8 @@ raw_text_coding_system (coding_system) | |||
| 4985 | Lisp_Object spec, attrs; | 4984 | Lisp_Object spec, attrs; |
| 4986 | Lisp_Object eol_type, raw_text_eol_type; | 4985 | Lisp_Object eol_type, raw_text_eol_type; |
| 4987 | 4986 | ||
| 4987 | if (NILP (coding_system)) | ||
| 4988 | return Qraw_text; | ||
| 4988 | spec = CODING_SYSTEM_SPEC (coding_system); | 4989 | spec = CODING_SYSTEM_SPEC (coding_system); |
| 4989 | attrs = AREF (spec, 0); | 4990 | attrs = AREF (spec, 0); |
| 4990 | 4991 | ||
| @@ -5012,10 +5013,13 @@ coding_inherit_eol_type (coding_system, parent) | |||
| 5012 | { | 5013 | { |
| 5013 | Lisp_Object spec, attrs, eol_type; | 5014 | Lisp_Object spec, attrs, eol_type; |
| 5014 | 5015 | ||
| 5016 | if (NILP (coding_system)) | ||
| 5017 | coding_system = Qraw_text; | ||
| 5015 | spec = CODING_SYSTEM_SPEC (coding_system); | 5018 | spec = CODING_SYSTEM_SPEC (coding_system); |
| 5016 | attrs = AREF (spec, 0); | 5019 | attrs = AREF (spec, 0); |
| 5017 | eol_type = AREF (spec, 2); | 5020 | eol_type = AREF (spec, 2); |
| 5018 | if (VECTORP (eol_type)) | 5021 | if (VECTORP (eol_type) |
| 5022 | && ! NILP (parent)) | ||
| 5019 | { | 5023 | { |
| 5020 | Lisp_Object parent_spec; | 5024 | Lisp_Object parent_spec; |
| 5021 | Lisp_Object parent_eol_type; | 5025 | Lisp_Object parent_eol_type; |
| @@ -5497,8 +5501,9 @@ produce_chars (coding) | |||
| 5497 | produced_chars++; | 5501 | produced_chars++; |
| 5498 | } | 5502 | } |
| 5499 | else | 5503 | else |
| 5500 | /* This is an annotation datum. */ | 5504 | /* This is an annotation datum. (-C) is the length of |
| 5501 | buf -= c + 1; | 5505 | it. */ |
| 5506 | buf += -c - 1; | ||
| 5502 | } | 5507 | } |
| 5503 | } | 5508 | } |
| 5504 | else | 5509 | else |
| @@ -6043,9 +6048,10 @@ consume_chars (coding) | |||
| 6043 | 6048 | ||
| 6044 | if (! multibytep) | 6049 | if (! multibytep) |
| 6045 | { | 6050 | { |
| 6046 | EMACS_INT bytes = MULTIBYTE_LENGTH (src, src_end); | 6051 | EMACS_INT bytes; |
| 6047 | 6052 | ||
| 6048 | if (bytes > 0) | 6053 | if (! CODING_FOR_UNIBYTE (coding) |
| 6054 | && (bytes = MULTIBYTE_LENGTH (src, src_end)) > 0) | ||
| 6049 | c = STRING_CHAR_ADVANCE (src), pos += bytes; | 6055 | c = STRING_CHAR_ADVANCE (src), pos += bytes; |
| 6050 | else | 6056 | else |
| 6051 | c = *src++, pos++; | 6057 | c = *src++, pos++; |