diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-04-01 10:34:25 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-04-01 10:34:25 -0700 |
commit | 5c5cdd398e5220a8bd77a5842c8013ac17c7e420 (patch) | |
tree | 56853f83f362eed12accf7dafbfaaa5ec3f5bbd6 /src/term.c | |
parent | 66ebf9838b3b7744bcf2ad63d62e9cd6c7690066 (diff) | |
download | emacs-5c5cdd398e5220a8bd77a5842c8013ac17c7e420.tar.gz |
* term.c (tty_write_glyphs): Use size_t; this avoids overflow warning.
Diffstat (limited to 'src/term.c')
-rw-r--r-- | src/term.c | 9 |
1 files changed, 4 insertions, 5 deletions
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) { unsigned char *conversion_buffer; struct coding_system *coding; + size_t n, stringlen; struct tty_display_info *tty = FRAME_TTY (f); @@ -734,13 +735,12 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len) the tail. */ coding->mode &= ~CODING_MODE_LAST_BLOCK; - while (len > 0) + for (stringlen = len; stringlen != 0; stringlen -= n) { /* Identify a run of glyphs with the same face. */ int face_id = string->face_id; - int n; - for (n = 1; n < len; ++n) + for (n = 1; n < stringlen; ++n) if (string[n].face_id != face_id) break; @@ -748,7 +748,7 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len) tty_highlight_if_desired (tty); turn_on_face (f, face_id); - if (n == len) + if (n == stringlen) /* This is the last run. */ coding->mode |= CODING_MODE_LAST_BLOCK; conversion_buffer = encode_terminal_code (string, n, coding); @@ -762,7 +762,6 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len) fwrite (conversion_buffer, 1, coding->produced, tty->termscript); UNBLOCK_INPUT; } - len -= n; string += n; /* Turn appearance modes off. */ |