Mercurial > emacs
changeset 22116:09efd6a94b4b
(skip_chars): Fix bug in handling a range which
contains multibyte characters.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 18 May 1998 00:59:38 +0000 |
parents | b7efc1e72e26 |
children | c6b783988569 |
files | src/syntax.c |
diffstat | 1 files changed, 20 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/syntax.c Mon May 18 00:17:38 1998 +0000 +++ b/src/syntax.c Mon May 18 00:59:38 1998 +0000 @@ -1319,9 +1319,10 @@ else c = c_leading_code = XSTRING (string)->data[i++]; } - if (i < XSTRING (string)->size && XSTRING (string)->data[i] == '-') + if (i < XSTRING (string)->size + && XSTRING (string)->data[i_byte] == '-') { - unsigned int c2; + unsigned int c2, c2_leading_code; /* Skip over the dash. */ i++, i_byte++; @@ -1331,18 +1332,29 @@ /* Get the end of the range. */ if (string_multibyte) - FETCH_STRING_CHAR_ADVANCE (c2, string, i, i_byte); + { + c2_leading_code = XSTRING (string)->data[i_byte]; + FETCH_STRING_CHAR_ADVANCE (c2, string, i, i_byte); + } else c2 = XSTRING (string)->data[i++]; if (SINGLE_BYTE_CHAR_P (c)) - while (c <= c2) - { - fastmap[c] = 1; - c++; - } + { + if (! SINGLE_BYTE_CHAR_P (c2)) + error ("Invalid charcter range: %s", + XSTRING (string)->data); + while (c <= c2) + { + fastmap[c] = 1; + c++; + } + } else { + if (c_leading_code != c2_leading_code) + error ("Invalid charcter range: %s", + XSTRING (string)->data); fastmap[c_leading_code] = 1; if (c <= c2) {