diff options
| author | Kenichi Handa | 1998-05-18 00:59:38 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-05-18 00:59:38 +0000 |
| commit | 06274af57fcff96b71346897d2e14f3412798422 (patch) | |
| tree | e9660350ad88cdeb019d16ca2b502d6336524475 /src/syntax.c | |
| parent | c321b1908be8c325f9a0a80a583dbb73b2399871 (diff) | |
| download | emacs-06274af57fcff96b71346897d2e14f3412798422.tar.gz emacs-06274af57fcff96b71346897d2e14f3412798422.zip | |
(skip_chars): Fix bug in handling a range which
contains multibyte characters.
Diffstat (limited to 'src/syntax.c')
| -rw-r--r-- | src/syntax.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/syntax.c b/src/syntax.c index 62cc124a318..9e15cc4ff43 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -1319,9 +1319,10 @@ skip_chars (forwardp, syntaxp, string, lim) | |||
| 1319 | else | 1319 | else |
| 1320 | c = c_leading_code = XSTRING (string)->data[i++]; | 1320 | c = c_leading_code = XSTRING (string)->data[i++]; |
| 1321 | } | 1321 | } |
| 1322 | if (i < XSTRING (string)->size && XSTRING (string)->data[i] == '-') | 1322 | if (i < XSTRING (string)->size |
| 1323 | && XSTRING (string)->data[i_byte] == '-') | ||
| 1323 | { | 1324 | { |
| 1324 | unsigned int c2; | 1325 | unsigned int c2, c2_leading_code; |
| 1325 | 1326 | ||
| 1326 | /* Skip over the dash. */ | 1327 | /* Skip over the dash. */ |
| 1327 | i++, i_byte++; | 1328 | i++, i_byte++; |
| @@ -1331,18 +1332,29 @@ skip_chars (forwardp, syntaxp, string, lim) | |||
| 1331 | 1332 | ||
| 1332 | /* Get the end of the range. */ | 1333 | /* Get the end of the range. */ |
| 1333 | if (string_multibyte) | 1334 | if (string_multibyte) |
| 1334 | FETCH_STRING_CHAR_ADVANCE (c2, string, i, i_byte); | 1335 | { |
| 1336 | c2_leading_code = XSTRING (string)->data[i_byte]; | ||
| 1337 | FETCH_STRING_CHAR_ADVANCE (c2, string, i, i_byte); | ||
| 1338 | } | ||
| 1335 | else | 1339 | else |
| 1336 | c2 = XSTRING (string)->data[i++]; | 1340 | c2 = XSTRING (string)->data[i++]; |
| 1337 | 1341 | ||
| 1338 | if (SINGLE_BYTE_CHAR_P (c)) | 1342 | if (SINGLE_BYTE_CHAR_P (c)) |
| 1339 | while (c <= c2) | 1343 | { |
| 1340 | { | 1344 | if (! SINGLE_BYTE_CHAR_P (c2)) |
| 1341 | fastmap[c] = 1; | 1345 | error ("Invalid charcter range: %s", |
| 1342 | c++; | 1346 | XSTRING (string)->data); |
| 1343 | } | 1347 | while (c <= c2) |
| 1348 | { | ||
| 1349 | fastmap[c] = 1; | ||
| 1350 | c++; | ||
| 1351 | } | ||
| 1352 | } | ||
| 1344 | else | 1353 | else |
| 1345 | { | 1354 | { |
| 1355 | if (c_leading_code != c2_leading_code) | ||
| 1356 | error ("Invalid charcter range: %s", | ||
| 1357 | XSTRING (string)->data); | ||
| 1346 | fastmap[c_leading_code] = 1; | 1358 | fastmap[c_leading_code] = 1; |
| 1347 | if (c <= c2) | 1359 | if (c <= c2) |
| 1348 | { | 1360 | { |