# HG changeset patch # User Kenichi Handa # Date 1078787742 0 # Node ID 3edfa038a435f07ef338b480139402eb51698f73 # Parent 5caa5e061a07867e2718615803db315d43c2ce73 (detect_coding_emacs_mule): Fix counting of encoded byte sequence. (detect_coding_ccl): Fix setting of the variable valids. diff -r 5caa5e061a07 -r 3edfa038a435 src/coding.c --- a/src/coding.c Thu Mar 04 23:33:44 2004 +0000 +++ b/src/coding.c Mon Mar 08 23:15:42 2004 +0000 @@ -1808,14 +1808,19 @@ } else { - const unsigned char *src_base = src - 1; - - do + int more_bytes = emacs_mule_bytes[*src_base] - 1; + + while (more_bytes > 0) { ONE_MORE_BYTE (c); + if (c < 0xA0) + { + src--; /* Unread the last byte. */ + break; + } + more_bytes--; } - while (c >= 0xA0); - if (src - src_base != emacs_mule_bytes[*src_base]) + if (more_bytes != 0) break; found = CATEGORY_MASK_EMACS_MULE; } @@ -4354,13 +4359,14 @@ int multibytep = coding->src_multibyte; int consumed_chars = 0; int found = 0; - unsigned char *valids = CODING_CCL_VALIDS (coding); + unsigned char *valids; int head_ascii = coding->head_ascii; Lisp_Object attrs; detect_info->checked |= CATEGORY_MASK_CCL; coding = &coding_categories[coding_category_ccl]; + valids = CODING_CCL_VALIDS (coding); attrs = CODING_ID_ATTRS (coding->id); if (! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) src += head_ascii;