From b1c6d03760632cb0d46b138233d754a8ccb7960e Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Sat, 26 Oct 2013 01:01:06 +0200 Subject: [PATCH] * grub-core/normal/menu_entry.c (get_logical_num_lines): Use unsigned division as the one making more sense. (update_screen): Likewise. (complete): Likewise. --- ChangeLog | 7 +++++++ grub-core/normal/menu_entry.c | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index abe03cd51..ec6052472 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-10-26 Vladimir Serbinenko + + * grub-core/normal/menu_entry.c (get_logical_num_lines): Use unsigned + division as the one making more sense. + (update_screen): Likewise. + (complete): Likewise. + 2013-10-25 Vladimir Serbinenko * grub-core/normal/menu_entry.c (complete): Make sure that width is >0. diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c index 8ab9e753d..b485df821 100644 --- a/grub-core/normal/menu_entry.c +++ b/grub-core/normal/menu_entry.c @@ -128,7 +128,7 @@ get_logical_num_lines (struct line *linep, struct per_term_screen *term_screen) { return (grub_getstringwidth (linep->buf, linep->buf + linep->len, term_screen->term) - / term_screen->geo.entry_width) + 1; + / (unsigned) term_screen->geo.entry_width) + 1; } static void @@ -230,8 +230,8 @@ update_screen (struct screen *screen, struct per_term_screen *term_screen, linep = screen->lines + screen->line; grub_size_t t = grub_getstringwidth (linep->buf, linep->buf + screen->column, term_screen->term); - y += t / term_screen->geo.entry_width; - if (t % term_screen->geo.entry_width == 0 + y += t / (unsigned) term_screen->geo.entry_width; + if (t % (unsigned) term_screen->geo.entry_width == 0 && t != 0 && screen->column == linep->len) y--; /* Check if scrolling is necessary. */ @@ -1082,7 +1082,7 @@ complete (struct screen *screen, int continuous, int update) grub_puts_terminal ("\n ", screen->terms[i].term); } - p += (count % num_sections) * width; + p += ((unsigned) count % num_sections) * width; endp = p + width; if (p != ucs4)