diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/term.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/term.c b/src/term.c index 17607cea5d5..a4ddf976455 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -815,6 +815,7 @@ encode_terminal_code (src, dst, src_len, dst_len, consumed) | |||
| 815 | int len; | 815 | int len; |
| 816 | register int tlen = GLYPH_TABLE_LENGTH; | 816 | register int tlen = GLYPH_TABLE_LENGTH; |
| 817 | register Lisp_Object *tbase = GLYPH_TABLE_BASE; | 817 | register Lisp_Object *tbase = GLYPH_TABLE_BASE; |
| 818 | int result; | ||
| 818 | struct coding_system *coding; | 819 | struct coding_system *coding; |
| 819 | 820 | ||
| 820 | coding = (CODING_REQUIRE_ENCODING (&terminal_coding) | 821 | coding = (CODING_REQUIRE_ENCODING (&terminal_coding) |
| @@ -857,19 +858,24 @@ encode_terminal_code (src, dst, src_len, dst_len, consumed) | |||
| 857 | buf = GLYPH_STRING (tbase, g); | 858 | buf = GLYPH_STRING (tbase, g); |
| 858 | } | 859 | } |
| 859 | 860 | ||
| 860 | encode_coding (coding, buf, dst, len, dst_end - dst); | 861 | result = encode_coding (coding, buf, dst, len, dst_end - dst); |
| 861 | len -= coding->consumed; | 862 | len -= coding->consumed; |
| 862 | dst += coding->produced; | 863 | dst += coding->produced; |
| 864 | if (result == CODING_FINISH_INSUFFICIENT_DST | ||
| 865 | || (result == CODING_FINISH_INSUFFICIENT_SRC | ||
| 866 | && len > dst_end - dst)) | ||
| 867 | /* The remaining output buffer is too short. We must | ||
| 868 | break the loop here without increasing SRC so that the | ||
| 869 | next call of this function starts from the same glyph. */ | ||
| 870 | break; | ||
| 871 | |||
| 863 | if (len > 0) | 872 | if (len > 0) |
| 864 | { | 873 | { |
| 865 | if (len > dst_end - dst) | 874 | /* This is the case that a code of the range 0200..0237 |
| 866 | /* The remaining output buffer is too short. We must | 875 | exists in buf. We must just write out such a code. */ |
| 867 | break the loop here without increasing SRC so that | 876 | buf += coding->consumed; |
| 868 | the next call of this function start from the same | 877 | while (len--) |
| 869 | glyph. */ | 878 | *dst++ = *buf++; |
| 870 | break; | ||
| 871 | buf += len; | ||
| 872 | while (len--) *dst++ = *buf++; | ||
| 873 | } | 879 | } |
| 874 | } | 880 | } |
| 875 | src++; | 881 | src++; |