diff options
| author | Kenichi Handa | 1998-11-06 10:59:09 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-11-06 10:59:09 +0000 |
| commit | dfd57aa70f179105079fb6970dfce8db3f3f699e (patch) | |
| tree | a6d25659dea9a3afef39fd15f353dd4129dc9e37 | |
| parent | 7be38f7dba3ae572cf41b4267d9402065889e915 (diff) | |
| download | emacs-dfd57aa70f179105079fb6970dfce8db3f3f699e.tar.gz emacs-dfd57aa70f179105079fb6970dfce8db3f3f699e.zip | |
(SPLIT_NON_ASCII_CHAR): Check dimension of an invalid
character correctly.
(STRING_CHAR): Handle an invalid charater correctly.
| -rw-r--r-- | src/charset.h | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/charset.h b/src/charset.h index 1b33b972811..b5385a36d8e 100644 --- a/src/charset.h +++ b/src/charset.h | |||
| @@ -508,16 +508,16 @@ extern int width_by_char_head[256]; | |||
| 508 | Do not use this macro for an ASCII character. */ | 508 | Do not use this macro for an ASCII character. */ |
| 509 | 509 | ||
| 510 | #define SPLIT_NON_ASCII_CHAR(c, charset, c1, c2) \ | 510 | #define SPLIT_NON_ASCII_CHAR(c, charset, c1, c2) \ |
| 511 | ((c) < MIN_CHAR_OFFICIAL_DIMENSION2 \ | 511 | ((c) & CHAR_FIELD1_MASK \ |
| 512 | ? (charset = CHAR_FIELD2 (c) + 0x70, \ | 512 | ? (charset = ((c) < MIN_CHAR_COMPOSITION \ |
| 513 | c1 = CHAR_FIELD3 (c), \ | ||
| 514 | c2 = -1) \ | ||
| 515 | : (charset = ((c) < MIN_CHAR_COMPOSITION \ | ||
| 516 | ? (CHAR_FIELD1 (c) \ | 513 | ? (CHAR_FIELD1 (c) \ |
| 517 | + ((c) < MIN_CHAR_PRIVATE_DIMENSION2 ? 0x8F : 0xE0)) \ | 514 | + ((c) < MIN_CHAR_PRIVATE_DIMENSION2 ? 0x8F : 0xE0)) \ |
| 518 | : CHARSET_COMPOSITION), \ | 515 | : CHARSET_COMPOSITION), \ |
| 519 | c1 = CHAR_FIELD2 (c), \ | 516 | c1 = CHAR_FIELD2 (c), \ |
| 520 | c2 = CHAR_FIELD3 (c))) | 517 | c2 = CHAR_FIELD3 (c)) \ |
| 518 | : (charset = CHAR_FIELD2 (c) + 0x70, \ | ||
| 519 | c1 = CHAR_FIELD3 (c), \ | ||
| 520 | c2 = -1)) | ||
| 521 | 521 | ||
| 522 | /* The charset of character C is stored in CHARSET, and the | 522 | /* The charset of character C is stored in CHARSET, and the |
| 523 | position-codes of C are stored in C1 and C2. | 523 | position-codes of C are stored in C1 and C2. |
| @@ -576,10 +576,9 @@ extern int iso_charset_table[2][2][128]; | |||
| 576 | is at STR and the length is LEN. If STR doesn't contain valid | 576 | is at STR and the length is LEN. If STR doesn't contain valid |
| 577 | multi-byte form, only the first byte in STR is returned. */ | 577 | multi-byte form, only the first byte in STR is returned. */ |
| 578 | 578 | ||
| 579 | #define STRING_CHAR(str, len) \ | 579 | #define STRING_CHAR(str, len) \ |
| 580 | ((BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) == 1 \ | 580 | (BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) == 1 \ |
| 581 | || BYTES_BY_CHAR_HEAD ((unsigned char) *(str)) > (len)) \ | 581 | ? (unsigned char) *(str) \ |
| 582 | ? (unsigned char) *(str) \ | ||
| 583 | : string_to_non_ascii_char (str, len, 0, 0)) | 582 | : string_to_non_ascii_char (str, len, 0, 0)) |
| 584 | 583 | ||
| 585 | /* This is like STRING_CHAR but the third arg ACTUAL_LEN is set to | 584 | /* This is like STRING_CHAR but the third arg ACTUAL_LEN is set to |