aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
authorKenichi Handa2006-04-13 06:47:18 +0000
committerKenichi Handa2006-04-13 06:47:18 +0000
commit6e9715ae06a1e9444e5148af381793430938dc2d (patch)
treea487314fb0a4f5af504f74f7d6116c10899bcd10 /src/coding.c
parent73ec0f8900908f70f8b5daafc7f114f6e53a1ae2 (diff)
downloademacs-6e9715ae06a1e9444e5148af381793430938dc2d.tar.gz
emacs-6e9715ae06a1e9444e5148af381793430938dc2d.zip
(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.
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/coding.c b/src/coding.c
index ba121df242e..bd96b5cc068 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -3607,6 +3607,8 @@ setup_coding_system (coding_system, coding)
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 {
@@ -3923,8 +3925,11 @@ setup_coding_system (coding_system, coding)
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. */
@@ -7113,7 +7118,7 @@ code_convert_region1 (start, end, coding_system, encodep)
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)
@@ -7168,7 +7173,7 @@ code_convert_string1 (string, coding_system, nocopy, encodep)
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)
@@ -7227,7 +7232,7 @@ code_convert_string_norecord (string, coding_system, encodep)
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)