Mercurial > emacs
comparison src/coding.c @ 34536:aa667988f2b0
(decode_coding_string): Set coding->src_multibyte and
coding->dst_multibyte before calling detect_coding and detect_eol.
Update them after some coding system is detected.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 14 Dec 2000 01:27:43 +0000 |
parents | 37f85e931855 |
children | 9d5d795f9315 |
comparison
equal
deleted
inserted
replaced
34535:336e98ecc067 | 34536:aa667988f2b0 |
---|---|
5326 from = 0; | 5326 from = 0; |
5327 to = XSTRING (str)->size; | 5327 to = XSTRING (str)->size; |
5328 to_byte = STRING_BYTES (XSTRING (str)); | 5328 to_byte = STRING_BYTES (XSTRING (str)); |
5329 | 5329 |
5330 saved_coding_symbol = Qnil; | 5330 saved_coding_symbol = Qnil; |
5331 coding->src_multibyte = STRING_MULTIBYTE (str); | |
5332 coding->dst_multibyte = 1; | |
5331 if (CODING_REQUIRE_DETECTION (coding)) | 5333 if (CODING_REQUIRE_DETECTION (coding)) |
5332 { | 5334 { |
5333 /* See the comments in code_convert_region. */ | 5335 /* See the comments in code_convert_region. */ |
5334 if (coding->type == coding_type_undecided) | 5336 if (coding->type == coding_type_undecided) |
5335 { | 5337 { |
5348 encounter an inconsitent eol format while decoding. */ | 5350 encounter an inconsitent eol format while decoding. */ |
5349 coding->mode |= CODING_MODE_INHIBIT_INCONSISTENT_EOL; | 5351 coding->mode |= CODING_MODE_INHIBIT_INCONSISTENT_EOL; |
5350 } | 5352 } |
5351 } | 5353 } |
5352 | 5354 |
5353 coding->src_multibyte = 0; | 5355 if (coding->type == coding_type_no_conversion |
5354 coding->dst_multibyte = (coding->type != coding_type_no_conversion | 5356 || coding->type == coding_type_raw_text) |
5355 && coding->type != coding_type_raw_text); | 5357 coding->dst_multibyte = 0; |
5358 | |
5356 require_decoding = CODING_REQUIRE_DECODING (coding); | 5359 require_decoding = CODING_REQUIRE_DECODING (coding); |
5357 | 5360 |
5358 if (STRING_MULTIBYTE (str)) | 5361 if (STRING_MULTIBYTE (str)) |
5359 { | 5362 { |
5360 /* Decoding routines expect the source text to be unibyte. */ | 5363 /* Decoding routines expect the source text to be unibyte. */ |
5361 str = Fstring_as_unibyte (str); | 5364 str = Fstring_as_unibyte (str); |
5362 to_byte = STRING_BYTES (XSTRING (str)); | 5365 to_byte = STRING_BYTES (XSTRING (str)); |
5363 nocopy = 1; | 5366 nocopy = 1; |
5367 coding->src_multibyte = 0; | |
5364 } | 5368 } |
5365 | 5369 |
5366 /* Try to skip the heading and tailing ASCIIs. */ | 5370 /* Try to skip the heading and tailing ASCIIs. */ |
5367 if (require_decoding && coding->type != coding_type_ccl) | 5371 if (require_decoding && coding->type != coding_type_ccl) |
5368 { | 5372 { |