Mercurial > emacs
comparison src/coding.c @ 69995:d4a5619e5025
(setup_coding_system): If eol-type is not yet decided
and system_eol_type is not LF, set CODING_REQUIRE_ENCODING_MASK.
If coding_system is nil, return 0.
(code_convert_region1): Even if coding_system is nil, don't skip
conversion if system_eol_type is not LF.
(code_convert_string1): Likewise.
(code_convert_string_norecord): Likewise.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Thu, 13 Apr 2006 06:47:00 +0000 |
| parents | 795b4e48c10e |
| children | b6740a317343 2d2f6f096f6e |
comparison
equal
deleted
inserted
replaced
| 69994:daa3b925c055 | 69995:d4a5619e5025 |
|---|---|
| 3605 eol_type = inhibit_eol_conversion ? Qnil : Fget (coding_system, Qeol_type); | 3605 eol_type = inhibit_eol_conversion ? Qnil : Fget (coding_system, Qeol_type); |
| 3606 if (VECTORP (eol_type)) | 3606 if (VECTORP (eol_type)) |
| 3607 { | 3607 { |
| 3608 coding->eol_type = CODING_EOL_UNDECIDED; | 3608 coding->eol_type = CODING_EOL_UNDECIDED; |
| 3609 coding->common_flags = CODING_REQUIRE_DETECTION_MASK; | 3609 coding->common_flags = CODING_REQUIRE_DETECTION_MASK; |
| 3610 if (system_eol_type != CODING_EOL_LF) | |
| 3611 coding->common_flags |= CODING_REQUIRE_ENCODING_MASK; | |
| 3610 } | 3612 } |
| 3611 else if (XFASTINT (eol_type) == 1) | 3613 else if (XFASTINT (eol_type) == 1) |
| 3612 { | 3614 { |
| 3613 coding->eol_type = CODING_EOL_CRLF; | 3615 coding->eol_type = CODING_EOL_CRLF; |
| 3614 coding->common_flags | 3616 coding->common_flags |
| 3921 label_invalid_coding_system: | 3923 label_invalid_coding_system: |
| 3922 coding->type = coding_type_no_conversion; | 3924 coding->type = coding_type_no_conversion; |
| 3923 coding->category_idx = CODING_CATEGORY_IDX_BINARY; | 3925 coding->category_idx = CODING_CATEGORY_IDX_BINARY; |
| 3924 coding->common_flags = 0; | 3926 coding->common_flags = 0; |
| 3925 coding->eol_type = NILP (coding_system) ? system_eol_type : CODING_EOL_LF; | 3927 coding->eol_type = NILP (coding_system) ? system_eol_type : CODING_EOL_LF; |
| 3928 if (coding->eol_type != CODING_EOL_LF) | |
| 3929 coding->common_flags | |
| 3930 |= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK; | |
| 3926 coding->pre_write_conversion = coding->post_read_conversion = Qnil; | 3931 coding->pre_write_conversion = coding->post_read_conversion = Qnil; |
| 3927 return -1; | 3932 return NILP (coding_system) ? 0 : -1; |
| 3928 } | 3933 } |
| 3929 | 3934 |
| 3930 /* Free memory blocks allocated for storing composition information. */ | 3935 /* Free memory blocks allocated for storing composition information. */ |
| 3931 | 3936 |
| 3932 void | 3937 void |
| 7111 | 7116 |
| 7112 validate_region (&start, &end); | 7117 validate_region (&start, &end); |
| 7113 from = XFASTINT (start); | 7118 from = XFASTINT (start); |
| 7114 to = XFASTINT (end); | 7119 to = XFASTINT (end); |
| 7115 | 7120 |
| 7116 if (NILP (coding_system)) | 7121 if (NILP (coding_system) && system_eol_type == CODING_EOL_LF) |
| 7117 return make_number (to - from); | 7122 return make_number (to - from); |
| 7118 | 7123 |
| 7119 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) | 7124 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) |
| 7120 error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); | 7125 error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); |
| 7121 | 7126 |
| 7166 struct coding_system coding; | 7171 struct coding_system coding; |
| 7167 | 7172 |
| 7168 CHECK_STRING (string); | 7173 CHECK_STRING (string); |
| 7169 CHECK_SYMBOL (coding_system); | 7174 CHECK_SYMBOL (coding_system); |
| 7170 | 7175 |
| 7171 if (NILP (coding_system)) | 7176 if (NILP (coding_system) && system_eol_type == CODING_EOL_LF) |
| 7172 return (NILP (nocopy) ? Fcopy_sequence (string) : string); | 7177 return (NILP (nocopy) ? Fcopy_sequence (string) : string); |
| 7173 | 7178 |
| 7174 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) | 7179 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) |
| 7175 error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); | 7180 error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); |
| 7176 | 7181 |
| 7225 struct coding_system coding; | 7230 struct coding_system coding; |
| 7226 | 7231 |
| 7227 CHECK_STRING (string); | 7232 CHECK_STRING (string); |
| 7228 CHECK_SYMBOL (coding_system); | 7233 CHECK_SYMBOL (coding_system); |
| 7229 | 7234 |
| 7230 if (NILP (coding_system)) | 7235 if (NILP (coding_system) && system_eol_type == CODING_EOL_LF) |
| 7231 return string; | 7236 return string; |
| 7232 | 7237 |
| 7233 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) | 7238 if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) |
| 7234 error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); | 7239 error ("Invalid coding system: %s", SDATA (SYMBOL_NAME (coding_system))); |
| 7235 | 7240 |
