aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-04-01 10:34:25 -0700
committerPaul Eggert2011-04-01 10:34:25 -0700
commit5c5cdd398e5220a8bd77a5842c8013ac17c7e420 (patch)
tree56853f83f362eed12accf7dafbfaaa5ec3f5bbd6 /src
parent66ebf9838b3b7744bcf2ad63d62e9cd6c7690066 (diff)
downloademacs-5c5cdd398e5220a8bd77a5842c8013ac17c7e420.tar.gz
emacs-5c5cdd398e5220a8bd77a5842c8013ac17c7e420.zip
* term.c (tty_write_glyphs): Use size_t; this avoids overflow warning.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog2
-rw-r--r--src/term.c9
2 files changed, 6 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 89946731630..30a45692ea6 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,7 @@
12011-04-01 Paul Eggert <eggert@cs.ucla.edu> 12011-04-01 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * term.c (tty_write_glyphs): Use size_t; this avoids overflow warning.
4
3 * coding.c: Remove vars that are set but not used. 5 * coding.c: Remove vars that are set but not used.
4 (DECODE_COMPOSITION_RULE): Remove 2nd arg, which is unused. 6 (DECODE_COMPOSITION_RULE): Remove 2nd arg, which is unused.
5 All callers changed. 7 All callers changed.
diff --git a/src/term.c b/src/term.c
index fc7726298c5..fc07c2b8d06 100644
--- a/src/term.c
+++ b/src/term.c
@@ -707,6 +707,7 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len)
707{ 707{
708 unsigned char *conversion_buffer; 708 unsigned char *conversion_buffer;
709 struct coding_system *coding; 709 struct coding_system *coding;
710 size_t n, stringlen;
710 711
711 struct tty_display_info *tty = FRAME_TTY (f); 712 struct tty_display_info *tty = FRAME_TTY (f);
712 713
@@ -734,13 +735,12 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len)
734 the tail. */ 735 the tail. */
735 coding->mode &= ~CODING_MODE_LAST_BLOCK; 736 coding->mode &= ~CODING_MODE_LAST_BLOCK;
736 737
737 while (len > 0) 738 for (stringlen = len; stringlen != 0; stringlen -= n)
738 { 739 {
739 /* Identify a run of glyphs with the same face. */ 740 /* Identify a run of glyphs with the same face. */
740 int face_id = string->face_id; 741 int face_id = string->face_id;
741 int n;
742 742
743 for (n = 1; n < len; ++n) 743 for (n = 1; n < stringlen; ++n)
744 if (string[n].face_id != face_id) 744 if (string[n].face_id != face_id)
745 break; 745 break;
746 746
@@ -748,7 +748,7 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len)
748 tty_highlight_if_desired (tty); 748 tty_highlight_if_desired (tty);
749 turn_on_face (f, face_id); 749 turn_on_face (f, face_id);
750 750
751 if (n == len) 751 if (n == stringlen)
752 /* This is the last run. */ 752 /* This is the last run. */
753 coding->mode |= CODING_MODE_LAST_BLOCK; 753 coding->mode |= CODING_MODE_LAST_BLOCK;
754 conversion_buffer = encode_terminal_code (string, n, coding); 754 conversion_buffer = encode_terminal_code (string, n, coding);
@@ -762,7 +762,6 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len)
762 fwrite (conversion_buffer, 1, coding->produced, tty->termscript); 762 fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
763 UNBLOCK_INPUT; 763 UNBLOCK_INPUT;
764 } 764 }
765 len -= n;
766 string += n; 765 string += n;
767 766
768 /* Turn appearance modes off. */ 767 /* Turn appearance modes off. */