Mercurial > emacs
comparison src/coding.c @ 89462:4e359ebf3984
(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.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Thu, 05 Jun 2003 12:34:31 +0000 |
| parents | de8b460070cc |
| children | e911ca706166 |
comparison
equal
deleted
inserted
replaced
| 89461:108e326323e3 | 89462:4e359ebf3984 |
|---|---|
| 3184 { | 3184 { |
| 3185 if (ASCII_BYTE_P (*src_base)) | 3185 if (ASCII_BYTE_P (*src_base)) |
| 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) |
| 3193 { | 3192 { |
| 3194 *charbuf++ = c; | 3193 *charbuf++ = c; |
| 4983 Lisp_Object coding_system; | 4982 Lisp_Object coding_system; |
| 4984 { | 4983 { |
| 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 |
| 4991 if (EQ (CODING_ATTR_TYPE (attrs), Qraw_text)) | 4992 if (EQ (CODING_ATTR_TYPE (attrs), Qraw_text)) |
| 4992 return coding_system; | 4993 return coding_system; |
| 5010 coding_inherit_eol_type (coding_system, parent) | 5011 coding_inherit_eol_type (coding_system, parent) |
| 5011 Lisp_Object coding_system, parent; | 5012 Lisp_Object 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; |
| 5022 | 5026 |
| 5023 parent_spec | 5027 parent_spec |
| 5495 else | 5499 else |
| 5496 *dst++ = CHAR_TO_BYTE8 (c); | 5500 *dst++ = CHAR_TO_BYTE8 (c); |
| 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 |
| 5505 { | 5510 { |
| 5506 unsigned char *src = coding->source; | 5511 unsigned char *src = coding->source; |
| 6041 ? stop_composition : stop_charset); | 6046 ? stop_composition : stop_charset); |
| 6042 } | 6047 } |
| 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++; |
| 6052 } | 6058 } |
| 6053 else | 6059 else |
