diff options
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/coding.c b/src/coding.c index 26d47da9317..d261418def5 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -3603,6 +3603,8 @@ setup_coding_system (coding_system, coding) | |||
| 3603 | { | 3603 | { |
| 3604 | coding->eol_type = CODING_EOL_UNDECIDED; | 3604 | coding->eol_type = CODING_EOL_UNDECIDED; |
| 3605 | coding->common_flags = CODING_REQUIRE_DETECTION_MASK; | 3605 | coding->common_flags = CODING_REQUIRE_DETECTION_MASK; |
| 3606 | if (system_eol_type != CODING_EOL_LF) | ||
| 3607 | coding->common_flags |= CODING_REQUIRE_ENCODING_MASK; | ||
| 3606 | } | 3608 | } |
| 3607 | else if (XFASTINT (eol_type) == 1) | 3609 | else if (XFASTINT (eol_type) == 1) |
| 3608 | { | 3610 | { |
| @@ -3918,9 +3920,12 @@ setup_coding_system (coding_system, coding) | |||
| 3918 | coding->type = coding_type_no_conversion; | 3920 | coding->type = coding_type_no_conversion; |
| 3919 | coding->category_idx = CODING_CATEGORY_IDX_BINARY; | 3921 | coding->category_idx = CODING_CATEGORY_IDX_BINARY; |
| 3920 | coding->common_flags = 0; | 3922 | coding->common_flags = 0; |
| 3921 | coding->eol_type = CODING_EOL_LF; | 3923 | coding->eol_type = NILP (coding_system) ? system_eol_type : CODING_EOL_LF; |
| 3924 | if (coding->eol_type != CODING_EOL_LF) | ||
| 3925 | coding->common_flags | ||
| 3926 | |= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK; | ||
| 3922 | coding->pre_write_conversion = coding->post_read_conversion = Qnil; | 3927 | coding->pre_write_conversion = coding->post_read_conversion = Qnil; |
| 3923 | return -1; | 3928 | return NILP (coding_system) ? 0 : -1; |
| 3924 | } | 3929 | } |
| 3925 | 3930 | ||
| 3926 | /* Free memory blocks allocated for storing composition information. */ | 3931 | /* Free memory blocks allocated for storing composition information. */ |
| @@ -4994,6 +4999,8 @@ encode_coding (coding, source, destination, src_bytes, dst_bytes) | |||
| 4994 | coding->consumed = coding->consumed_char = 0; | 4999 | coding->consumed = coding->consumed_char = 0; |
| 4995 | coding->errors = 0; | 5000 | coding->errors = 0; |
| 4996 | coding->result = CODING_FINISH_NORMAL; | 5001 | coding->result = CODING_FINISH_NORMAL; |
| 5002 | if (coding->eol_type == CODING_EOL_UNDECIDED) | ||
| 5003 | coding->eol_type = system_eol_type; | ||
| 4997 | 5004 | ||
| 4998 | switch (coding->type) | 5005 | switch (coding->type) |
| 4999 | { | 5006 | { |
| @@ -5250,6 +5257,8 @@ shrink_encoding_region (beg, end, coding, str) | |||
| 5250 | if (coding->type == coding_type_ccl | 5257 | if (coding->type == coding_type_ccl |
| 5251 | || coding->eol_type == CODING_EOL_CRLF | 5258 | || coding->eol_type == CODING_EOL_CRLF |
| 5252 | || coding->eol_type == CODING_EOL_CR | 5259 | || coding->eol_type == CODING_EOL_CR |
| 5260 | || (coding->eol_type == CODING_EOL_UNDECIDED | ||
| 5261 | && system_eol_type != CODING_EOL_LF) | ||
| 5253 | || (coding->cmp_data && coding->cmp_data->used > 0)) | 5262 | || (coding->cmp_data && coding->cmp_data->used > 0)) |
| 5254 | { | 5263 | { |
| 5255 | /* We can't skip any data. */ | 5264 | /* We can't skip any data. */ |
| @@ -7105,7 +7114,7 @@ code_convert_region1 (start, end, coding_system, encodep) | |||
| 7105 | from = XFASTINT (start); | 7114 | from = XFASTINT (start); |
| 7106 | to = XFASTINT (end); | 7115 | to = XFASTINT (end); |
| 7107 | 7116 | ||
| 7108 | if (NILP (coding_system)) | 7117 | if (NILP (coding_system) && system_eol_type == CODING_EOL_LF) |
| 7109 | return make_number (to - from); | 7118 | return make_number (to - from); |
| 7110 | 7119 | ||
| 7111 | if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) | 7120 | if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) |
| @@ -7160,7 +7169,7 @@ code_convert_string1 (string, coding_system, nocopy, encodep) | |||
| 7160 | CHECK_STRING (string); | 7169 | CHECK_STRING (string); |
| 7161 | CHECK_SYMBOL (coding_system); | 7170 | CHECK_SYMBOL (coding_system); |
| 7162 | 7171 | ||
| 7163 | if (NILP (coding_system)) | 7172 | if (NILP (coding_system) && system_eol_type == CODING_EOL_LF) |
| 7164 | return (NILP (nocopy) ? Fcopy_sequence (string) : string); | 7173 | return (NILP (nocopy) ? Fcopy_sequence (string) : string); |
| 7165 | 7174 | ||
| 7166 | if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) | 7175 | if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) |
| @@ -7219,7 +7228,7 @@ code_convert_string_norecord (string, coding_system, encodep) | |||
| 7219 | CHECK_STRING (string); | 7228 | CHECK_STRING (string); |
| 7220 | CHECK_SYMBOL (coding_system); | 7229 | CHECK_SYMBOL (coding_system); |
| 7221 | 7230 | ||
| 7222 | if (NILP (coding_system)) | 7231 | if (NILP (coding_system) && system_eol_type == CODING_EOL_LF) |
| 7223 | return string; | 7232 | return string; |
| 7224 | 7233 | ||
| 7225 | if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) | 7234 | if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) |