Mercurial > emacs
changeset 17180:364327df6e7c
(encode_terminal_code): Check validity of character code.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Tue, 18 Mar 1997 23:31:34 +0000 |
parents | 9468df9944cc |
children | 156896ccc86e |
files | src/term.c |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/term.c Tue Mar 18 23:31:34 1997 +0000 +++ b/src/term.c Tue Mar 18 23:31:34 1997 +0000 @@ -785,8 +785,8 @@ { GLYPH *src_start = src, *src_end = src + src_len; unsigned char *dst_start = dst, *dst_end = dst + dst_len; - register GLYPH g = *src; - int c = GLYPH_CHAR (selected_frame, g); + register GLYPH g; + unsigned int c; unsigned char workbuf[4], *buf; int len, produced, processed; register int tlen = GLYPH_TABLE_LENGTH; @@ -798,7 +798,12 @@ /* We must skip glyphs to be padded for a wide character. */ if (! (g & GLYPH_MASK_PADDING)) { - c = GLYPH_CHAR (selected_frame, g); + if ((c = GLYPH_CHAR (selected_frame, g)) > MAX_CHAR) + { + c = ' '; + g = MAKE_GLYPH (selected_frame, c, + GLYPH_FACE (selected_frame, g)); + } if (COMPOSITE_CHAR_P (c)) { /* If C is a composite character, we can display @@ -817,7 +822,7 @@ /* We set the multi-byte form of C at BUF. */ len = CHAR_STRING (c, workbuf, buf); else - /* We have the multi-byte form in Vglyph_table. */ + /* We have a string in Vglyph_table. */ len = GLYPH_LENGTH (tbase, g), buf = GLYPH_STRING (tbase, g); produced = encode_coding (&terminal_coding, buf, dst,