changeset 89462:4e359ebf3984

(decode_coding_iso_2022): Fix handling of invalid bytes. (raw_text_coding_system): Check NILP (coding_system). (coding_inherit_eol_type): Check NILP (coding_system) and NILP (parent). (consume_chars): Fix for the case of raw-text.
author Kenichi Handa <handa@m17n.org>
date Thu, 05 Jun 2003 12:34:31 +0000
parents 108e326323e3
children 3bb3cb011f1e
files src/coding.c
diffstat 1 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Thu Jun 05 12:31:46 2003 +0000
+++ b/src/coding.c	Thu Jun 05 12:34:31 2003 +0000
@@ -3186,7 +3186,6 @@
 		*charbuf++ = *src_base;
 	      else
 		*charbuf++ = BYTE8_TO_CHAR (*src_base);
-	      char_offset++;
 	    }
 	}
       else if (composition_state == COMPOSING_NO)
@@ -4985,6 +4984,8 @@
   Lisp_Object spec, attrs;
   Lisp_Object eol_type, raw_text_eol_type;
 
+  if (NILP (coding_system))
+    return Qraw_text;
   spec = CODING_SYSTEM_SPEC (coding_system);
   attrs = AREF (spec, 0);
   
@@ -5012,10 +5013,13 @@
 {
   Lisp_Object spec, attrs, eol_type;
 
+  if (NILP (coding_system))
+    coding_system = Qraw_text;
   spec = CODING_SYSTEM_SPEC (coding_system);
   attrs = AREF (spec, 0);
   eol_type = AREF (spec, 2);
-  if (VECTORP (eol_type))
+  if (VECTORP (eol_type)
+      && ! NILP (parent))
     {
       Lisp_Object parent_spec;
       Lisp_Object parent_eol_type;
@@ -5497,8 +5501,9 @@
 	      produced_chars++;
 	    }
 	  else
-	    /* This is an annotation datum.  */
-	    buf -= c + 1;
+	    /* This is an annotation datum.  (-C) is the length of
+	       it.  */
+	    buf += -c - 1;
 	}
     }
   else
@@ -6043,9 +6048,10 @@
 
       if (! multibytep)
 	{
-	  EMACS_INT bytes = MULTIBYTE_LENGTH (src, src_end);
-
-	  if (bytes > 0)
+	  EMACS_INT bytes;
+
+	  if (! CODING_FOR_UNIBYTE (coding)
+	      && (bytes = MULTIBYTE_LENGTH (src, src_end)) > 0)
 	    c = STRING_CHAR_ADVANCE (src), pos += bytes;
 	  else
 	    c = *src++, pos++;