comparison src/coding.c @ 100135:0e17542db552

(detect_coding_system): Initialize utf_16_le_eol to -1, val to Qnil. (produce_chars): Initialize consumed_chars to 0.
author Kenichi Handa <handa@m17n.org>
date Wed, 03 Dec 2008 02:25:00 +0000
parents bca35d7cb3ac
children 86455974b971
comparison
equal deleted inserted replaced
100134:c48d4114962b 100135:0e17542db552
6328 if (coding->src_multibyte != coding->dst_multibyte) 6328 if (coding->src_multibyte != coding->dst_multibyte)
6329 { 6329 {
6330 if (coding->src_multibyte) 6330 if (coding->src_multibyte)
6331 { 6331 {
6332 int multibytep = 1; 6332 int multibytep = 1;
6333 EMACS_INT consumed_chars; 6333 EMACS_INT consumed_chars = 0;
6334 6334
6335 while (1) 6335 while (1)
6336 { 6336 {
6337 const unsigned char *src_base = src; 6337 const unsigned char *src_base = src;
6338 int c; 6338 int c;
7688 int multibytep; 7688 int multibytep;
7689 Lisp_Object coding_system; 7689 Lisp_Object coding_system;
7690 { 7690 {
7691 const unsigned char *src_end = src + src_bytes; 7691 const unsigned char *src_end = src + src_bytes;
7692 Lisp_Object attrs, eol_type; 7692 Lisp_Object attrs, eol_type;
7693 Lisp_Object val; 7693 Lisp_Object val = Qnil;
7694 struct coding_system coding; 7694 struct coding_system coding;
7695 int id; 7695 int id;
7696 struct coding_detection_info detect_info; 7696 struct coding_detection_info detect_info;
7697 enum coding_category base_category; 7697 enum coding_category base_category;
7698 int null_byte_found = 0, eight_bit_found = 0; 7698 int null_byte_found = 0, eight_bit_found = 0;
7853 } 7853 }
7854 else 7854 else
7855 { 7855 {
7856 int mask = detect_info.rejected | detect_info.found; 7856 int mask = detect_info.rejected | detect_info.found;
7857 int found = 0; 7857 int found = 0;
7858 val = Qnil;
7859 7858
7860 for (i = coding_category_raw_text - 1; i >= 0; i--) 7859 for (i = coding_category_raw_text - 1; i >= 0; i--)
7861 { 7860 {
7862 category = coding_priorities[i]; 7861 category = coding_priorities[i];
7863 if (! (mask & (1 << category))) 7862 if (! (mask & (1 << category)))
7916 val = Fcons (make_number (coding.id), Qnil); 7915 val = Fcons (make_number (coding.id), Qnil);
7917 } 7916 }
7918 7917
7919 /* Then, detect eol-format if necessary. */ 7918 /* Then, detect eol-format if necessary. */
7920 { 7919 {
7921 int normal_eol = -1, utf_16_be_eol = -1, utf_16_le_eol; 7920 int normal_eol = -1, utf_16_be_eol = -1, utf_16_le_eol = -1;
7922 Lisp_Object tail; 7921 Lisp_Object tail;
7923 7922
7924 if (VECTORP (eol_type)) 7923 if (VECTORP (eol_type))
7925 { 7924 {
7926 if (detect_info.found & ~CATEGORY_MASK_UTF_16) 7925 if (detect_info.found & ~CATEGORY_MASK_UTF_16)
7982 else 7981 else
7983 XSETCAR (tail, CODING_ID_NAME (id)); 7982 XSETCAR (tail, CODING_ID_NAME (id));
7984 } 7983 }
7985 } 7984 }
7986 7985
7987 return (highest ? XCAR (val) : val); 7986 return (highest ? (CONSP (val) ? XCAR (val) : Qnil) : val);
7988 } 7987 }
7989 7988
7990 7989
7991 DEFUN ("detect-coding-region", Fdetect_coding_region, Sdetect_coding_region, 7990 DEFUN ("detect-coding-region", Fdetect_coding_region, Sdetect_coding_region,
7992 2, 3, 0, 7991 2, 3, 0,