changeset 70520:b6740a317343

(setup_coding_system): For invalid coding-system, set coding->eol_type to CODING_EOL_UNDECIDED. (encode_coding): Cancel previous change. (shrink_encoding_region): Likewise. (code_convert_region1): Likewise. (code_convert_string1): Likewise. (code_convert_string_norecord): Likewise.
author Kenichi Handa <handa@m17n.org>
date Mon, 08 May 2006 05:25:02 +0000
parents 3731408d78da
children 2a2e0198d0cf
files src/coding.c
diffstat 1 files changed, 8 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Mon May 08 05:24:53 2006 +0000
+++ b/src/coding.c	Mon May 08 05:25:02 2006 +0000
@@ -384,7 +384,9 @@
 Lisp_Object eol_mnemonic_undecided;
 
 /* Format of end-of-line decided by system.  This is CODING_EOL_LF on
-   Unix, CODING_EOL_CRLF on DOS/Windows, and CODING_EOL_CR on Mac.  */
+   Unix, CODING_EOL_CRLF on DOS/Windows, and CODING_EOL_CR on Mac.
+   This has an effect only for external encoding (i.e. for output to
+   file and process), not for in-buffer or Lisp string encoding.  */
 int system_eol_type;
 
 #ifdef emacs
@@ -3924,10 +3926,7 @@
   coding->type = coding_type_no_conversion;
   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->eol_type = CODING_EOL_UNDECIDED;
   coding->pre_write_conversion = coding->post_read_conversion = Qnil;
   return NILP (coding_system) ? 0 : -1;
 }
@@ -5004,7 +5003,7 @@
   coding->errors = 0;
   coding->result = CODING_FINISH_NORMAL;
   if (coding->eol_type == CODING_EOL_UNDECIDED)
-    coding->eol_type = system_eol_type;
+    coding->eol_type = CODING_EOL_LF;
 
   switch (coding->type)
     {
@@ -5261,8 +5260,6 @@
   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.  */
@@ -7118,7 +7115,7 @@
   from = XFASTINT (start);
   to = XFASTINT (end);
 
-  if (NILP (coding_system) && system_eol_type == CODING_EOL_LF)
+  if (NILP (coding_system))
     return make_number (to - from);
 
   if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0)
@@ -7173,7 +7170,7 @@
   CHECK_STRING (string);
   CHECK_SYMBOL (coding_system);
 
-  if (NILP (coding_system) && system_eol_type == CODING_EOL_LF)
+  if (NILP (coding_system))
     return (NILP (nocopy) ? Fcopy_sequence (string) : string);
 
   if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0)
@@ -7232,7 +7229,7 @@
   CHECK_STRING (string);
   CHECK_SYMBOL (coding_system);
 
-  if (NILP (coding_system) && system_eol_type == CODING_EOL_LF)
+  if (NILP (coding_system))
     return string;
 
   if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0)