comparison src/term.c @ 24263:e81f007b15fa

(encode_terminal_code): Fix previous change.
author Kenichi Handa <handa@m17n.org>
date Fri, 05 Feb 1999 05:40:27 +0000
parents 0a2b76b09162
children 00398ed56396
comparison
equal deleted inserted replaced
24262:1c515a6c0686 24263:e81f007b15fa
813 unsigned int c; 813 unsigned int c;
814 unsigned char workbuf[4], *buf; 814 unsigned char workbuf[4], *buf;
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)
821 ? &terminal_coding 822 ? &terminal_coding
822 : &safe_terminal_coding); 823 : &safe_terminal_coding);
855 /* We have a string in Vglyph_table. */ 856 /* We have a string in Vglyph_table. */
856 len = GLYPH_LENGTH (tbase, g); 857 len = GLYPH_LENGTH (tbase, g);
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++;
876 } 882 }
877 *consumed = src - src_start; 883 *consumed = src - src_start;