From: Kenichi Handa Date: Wed, 3 Dec 2008 02:27:26 +0000 (+0000) Subject: (detect_coding_system): Initialize utf_16_le_eol to -1, val to X-Git-Tag: emacs-pretest-23.0.90~1352 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4533845dc4df54eb9b817b17758f437c801f4d48;p=emacs.git (detect_coding_system): Initialize utf_16_le_eol to -1, val to Qnil. (produce_chars): Initialize consumed_chars to 0. --- diff --git a/src/ChangeLog b/src/ChangeLog index 18bae46b1b6..a932a97db73 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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 diff --git a/src/coding.c b/src/coding.c index 88678a00767..acdb92214c2 100644 --- a/src/coding.c +++ b/src/coding.c @@ -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); }