(detect_coding_system): Initialize utf_16_le_eol to -1, val to
authorKenichi Handa <handa@m17n.org>
Wed, 3 Dec 2008 02:27:26 +0000 (02:27 +0000)
committerKenichi Handa <handa@m17n.org>
Wed, 3 Dec 2008 02:27:26 +0000 (02:27 +0000)
Qnil.
(produce_chars): Initialize consumed_chars to 0.

src/ChangeLog
src/coding.c

index 18bae46..a932a97 100644 (file)
@@ -3,6 +3,9 @@
        * coding.c (decode_coding_utf_16): Initialize consumed_chars_base
        to 0.
        (decode_coding_utf_8): Likewise.
+       (detect_coding_system): Initialize utf_16_le_eol to -1, val to
+       Qnil.
+       (produce_chars): Initialize consumed_chars to 0.
 
 2008-12-02  Chong Yidong  <cyd@stupidchicken.com>
 
index 88678a0..acdb922 100644 (file)
@@ -6330,7 +6330,7 @@ produce_chars (coding, translation_table, last_block)
          if (coding->src_multibyte)
            {
              int multibytep = 1;
-             EMACS_INT consumed_chars;
+             EMACS_INT consumed_chars = 0;
 
              while (1)
                {
@@ -7690,7 +7690,7 @@ detect_coding_system (src, src_chars, src_bytes, highest, multibytep,
 {
   const unsigned char *src_end = src + src_bytes;
   Lisp_Object attrs, eol_type;
-  Lisp_Object val;
+  Lisp_Object val = Qnil;
   struct coding_system coding;
   int id;
   struct coding_detection_info detect_info;
@@ -7855,7 +7855,6 @@ detect_coding_system (src, src_chars, src_bytes, highest, multibytep,
        {
          int mask = detect_info.rejected | detect_info.found;
          int found = 0;
-         val = Qnil;
 
          for (i = coding_category_raw_text - 1; i >= 0; i--)
            {
@@ -7918,7 +7917,7 @@ detect_coding_system (src, src_chars, src_bytes, highest, multibytep,
 
   /* Then, detect eol-format if necessary.  */
   {
-    int normal_eol = -1, utf_16_be_eol = -1, utf_16_le_eol;
+    int normal_eol = -1, utf_16_be_eol = -1, utf_16_le_eol = -1;
     Lisp_Object tail;
 
     if (VECTORP (eol_type))
@@ -7984,7 +7983,7 @@ detect_coding_system (src, src_chars, src_bytes, highest, multibytep,
       }
   }
 
-  return (highest ? XCAR (val) : val);
+  return (highest ? (CONSP (val) ? XCAR (val) : Qnil) : val);
 }