From 957b3c5f2f6280605908e0b7694bead9539082b4 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 12 Apr 2006 05:48:37 +0000 Subject: (setup_coding_system): Use system_eol_type for default coding->eol_type. --- src/coding.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index 105d4038b1f..3ffc976079c 100644 --- a/src/coding.c +++ b/src/coding.c @@ -3621,7 +3621,7 @@ setup_coding_system (coding_system, coding) = CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK; } else - coding->eol_type = CODING_EOL_LF; + coding->eol_type = system_eol_type; coding_type = XVECTOR (coding_spec)->contents[0]; /* Try short cut. */ @@ -3922,7 +3922,7 @@ setup_coding_system (coding_system, coding) coding->type = coding_type_no_conversion; coding->category_idx = CODING_CATEGORY_IDX_BINARY; coding->common_flags = 0; - coding->eol_type = CODING_EOL_LF; + coding->eol_type = NILP (coding_system) ? system_eol_type : CODING_EOL_LF; coding->pre_write_conversion = coding->post_read_conversion = Qnil; return -1; } -- cgit v1.2.1 From 2b89a53fc49171ca0cbbfe66c71e629840417655 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Thu, 13 Apr 2006 04:25:44 +0000 Subject: (setup_coding_system): Fix previous change. --- src/coding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index 3ffc976079c..51e76e51b71 100644 --- a/src/coding.c +++ b/src/coding.c @@ -3621,7 +3621,7 @@ setup_coding_system (coding_system, coding) = CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK; } else - coding->eol_type = system_eol_type; + coding->eol_type = CODING_EOL_LF; coding_type = XVECTOR (coding_spec)->contents[0]; /* Try short cut. */ -- cgit v1.2.1 From 9642847f36380bc6c39bf8d19b907266d72fbd61 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Thu, 13 Apr 2006 04:39:20 +0000 Subject: (encode_coding): If eol_type is not yet decided, use system_eol_type. --- src/coding.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index 51e76e51b71..5fb4c202b85 100644 --- a/src/coding.c +++ b/src/coding.c @@ -4998,6 +4998,8 @@ encode_coding (coding, source, destination, src_bytes, dst_bytes) coding->consumed = coding->consumed_char = 0; coding->errors = 0; coding->result = CODING_FINISH_NORMAL; + if (coding->eol_type == CODING_EOL_UNDECIDED) + coding->eol_type = system_eol_type; switch (coding->type) { -- cgit v1.2.1 From 73ec0f8900908f70f8b5daafc7f114f6e53a1ae2 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Thu, 13 Apr 2006 04:58:07 +0000 Subject: (shrink_encoding_region): If eol_type is not yet decided and system_eol_type is not LF, don't shrink. --- src/coding.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/coding.c') diff --git a/src/coding.c b/src/coding.c index 5fb4c202b85..ba121df242e 100644 --- a/src/coding.c +++ b/src/coding.c @@ -5256,6 +5256,8 @@ shrink_encoding_region (beg, end, coding, str) if (coding->type == coding_type_ccl || coding->eol_type == CODING_EOL_CRLF || coding->eol_type == CODING_EOL_CR + || (coding->eol_type == CODING_EOL_UNDECIDED + && system_eol_type != CODING_EOL_LF) || (coding->cmp_data && coding->cmp_data->used > 0)) { /* We can't skip any data. */ -- cgit v1.2.1 From 6e9715ae06a1e9444e5148af381793430938dc2d Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Thu, 13 Apr 2006 06:47:18 +0000 Subject: (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. --- src/coding.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/coding.c') 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) { coding->eol_type = CODING_EOL_UNDECIDED; coding->common_flags = CODING_REQUIRE_DETECTION_MASK; + if (system_eol_type != CODING_EOL_LF) + coding->common_flags |= CODING_REQUIRE_ENCODING_MASK; } else if (XFASTINT (eol_type) == 1) { @@ -3923,8 +3925,11 @@ setup_coding_system (coding_system, coding) coding->category_idx = CODING_CATEGORY_IDX_BINARY; coding->common_flags = 0; coding->eol_type = NILP (coding_system) ? system_eol_type : CODING_EOL_LF; + if (coding->eol_type != CODING_EOL_LF) + coding->common_flags + |= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK; coding->pre_write_conversion = coding->post_read_conversion = Qnil; - return -1; + return NILP (coding_system) ? 0 : -1; } /* Free memory blocks allocated for storing composition information. */ @@ -7113,7 +7118,7 @@ code_convert_region1 (start, end, coding_system, encodep) from = XFASTINT (start); to = XFASTINT (end); - if (NILP (coding_system)) + if (NILP (coding_system) && system_eol_type == CODING_EOL_LF) return make_number (to - from); if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) @@ -7168,7 +7173,7 @@ code_convert_string1 (string, coding_system, nocopy, encodep) CHECK_STRING (string); CHECK_SYMBOL (coding_system); - if (NILP (coding_system)) + if (NILP (coding_system) && system_eol_type == CODING_EOL_LF) return (NILP (nocopy) ? Fcopy_sequence (string) : string); if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) @@ -7227,7 +7232,7 @@ code_convert_string_norecord (string, coding_system, encodep) CHECK_STRING (string); CHECK_SYMBOL (coding_system); - if (NILP (coding_system)) + if (NILP (coding_system) && system_eol_type == CODING_EOL_LF) return string; if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0) -- cgit v1.2.1