diff --git a/ChangeLog b/ChangeLog index b4b30ef73..c942cc668 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-10-25 Vladimir Serbinenko + + Make char and string width grub_size_t rather than grub_ssize_t. + 2013-10-25 Vladimir Serbinenko * grub-core/normal/cmdline.c (grub_history_get): Make argument into diff --git a/grub-core/normal/charset.c b/grub-core/normal/charset.c index 54e9d8b6e..f025890eb 100644 --- a/grub-core/normal/charset.c +++ b/grub-core/normal/charset.c @@ -389,7 +389,7 @@ grub_unicode_get_comb_type (grub_uint32_t c) #ifdef HAVE_UNIFONT_WIDTHSPEC -grub_ssize_t +grub_size_t grub_unicode_estimate_width (const struct grub_unicode_glyph *c) { if (grub_unicode_get_comb_type (c->base)) @@ -527,7 +527,7 @@ static grub_ssize_t bidi_line_wrap (struct grub_unicode_glyph *visual_out, struct grub_unicode_glyph *visual, grub_size_t visual_len, - grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg), + grub_size_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg), void *getcharwidth_arg, grub_size_t maxwidth, grub_size_t startwidth, grub_uint32_t contchar, @@ -767,7 +767,7 @@ static grub_ssize_t grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, grub_size_t logical_len, struct grub_unicode_glyph *visual_out, - grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg), + grub_size_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg), void *getcharwidth_arg, grub_size_t maxwidth, grub_size_t startwidth, grub_uint32_t contchar, @@ -1125,7 +1125,7 @@ grub_ssize_t grub_bidi_logical_to_visual (const grub_uint32_t *logical, grub_size_t logical_len, struct grub_unicode_glyph **visual_out, - grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg), + grub_size_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg), void *getcharwidth_arg, grub_size_t max_length, grub_size_t startwidth, grub_uint32_t contchar, struct grub_term_pos *pos, int primitive_wrap) diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c index cc85ad9ea..58042404b 100644 --- a/grub-core/normal/menu_entry.c +++ b/grub-core/normal/menu_entry.c @@ -228,8 +228,8 @@ update_screen (struct screen *screen, struct per_term_screen *term_screen, for (i = 0; i < screen->line; i++, linep++) y += get_logical_num_lines (linep, term_screen); linep = screen->lines + screen->line; - int t = grub_getstringwidth (linep->buf, linep->buf + screen->column, - term_screen->term); + 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 && t != 0 && screen->column == linep->len) diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c index 450fb508b..90f63f0da 100644 --- a/grub-core/normal/menu_text.c +++ b/grub-core/normal/menu_text.c @@ -51,7 +51,7 @@ grub_term_cursor_x (const struct grub_term_screen_geometry *geo) return (geo->first_entry_x + geo->entry_width); } -grub_ssize_t +grub_size_t grub_getstringwidth (grub_uint32_t * str, const grub_uint32_t * last_position, struct grub_term_output *term) { diff --git a/grub-core/normal/term.c b/grub-core/normal/term.c index bf970e91c..7b2b7bd33 100644 --- a/grub-core/normal/term.c +++ b/grub-core/normal/term.c @@ -866,7 +866,7 @@ print_backlog (struct grub_term_output *term, return 0; } -static grub_ssize_t +static grub_size_t getcharwidth (const struct grub_unicode_glyph *c, void *term) { return grub_term_getcharwidth (term, c); diff --git a/grub-core/term/gfxterm.c b/grub-core/term/gfxterm.c index de5479a51..dc0669b35 100644 --- a/grub-core/term/gfxterm.c +++ b/grub-core/term/gfxterm.c @@ -138,7 +138,7 @@ static unsigned char calculate_character_width (struct grub_font_glyph *glyph); static void grub_gfxterm_refresh (struct grub_term_output *term __attribute__ ((unused))); -static grub_ssize_t +static grub_size_t grub_gfxterm_getcharwidth (struct grub_term_output *term __attribute__ ((unused)), const struct grub_unicode_glyph *c); @@ -956,7 +956,7 @@ calculate_character_width (struct grub_font_glyph *glyph) / virtual_screen.normal_char_width; } -static grub_ssize_t +static grub_size_t grub_gfxterm_getcharwidth (struct grub_term_output *term __attribute__ ((unused)), const struct grub_unicode_glyph *c) { diff --git a/include/grub/normal.h b/include/grub/normal.h index d753fc184..c4ab193b3 100644 --- a/include/grub/normal.h +++ b/include/grub/normal.h @@ -104,9 +104,9 @@ grub_ucs4_count_lines (const grub_uint32_t * str, const grub_uint32_t * last_position, int margin_left, int margin_right, struct grub_term_output *term); -grub_ssize_t grub_getstringwidth (grub_uint32_t * str, - const grub_uint32_t * last_position, - struct grub_term_output *term); +grub_size_t grub_getstringwidth (grub_uint32_t * str, + const grub_uint32_t * last_position, + struct grub_term_output *term); void grub_print_message_indented (const char *msg, int margin_left, int margin_right, struct grub_term_output *term); diff --git a/include/grub/term.h b/include/grub/term.h index 9d755a965..e2110f390 100644 --- a/include/grub/term.h +++ b/include/grub/term.h @@ -187,8 +187,8 @@ struct grub_term_output /* Get the number of columns occupied by a given character C. C is encoded in Unicode. */ - grub_ssize_t (*getcharwidth) (struct grub_term_output *term, - const struct grub_unicode_glyph *c); + grub_size_t (*getcharwidth) (struct grub_term_output *term, + const struct grub_unicode_glyph *c); /* Get the screen size. */ struct grub_term_coordinate (*getwh) (struct grub_term_output *term); @@ -400,7 +400,7 @@ grub_term_cls (struct grub_term_output *term) #ifdef HAVE_UNIFONT_WIDTHSPEC -grub_ssize_t +grub_size_t grub_unicode_estimate_width (const struct grub_unicode_glyph *c); #else @@ -417,7 +417,7 @@ grub_unicode_estimate_width (const struct grub_unicode_glyph *c __attribute__ (( #define GRUB_TERM_TAB_WIDTH 8 -static inline grub_ssize_t +static inline grub_size_t grub_term_getcharwidth (struct grub_term_output *term, const struct grub_unicode_glyph *c) { diff --git a/include/grub/unicode.h b/include/grub/unicode.h index 07a2dec25..17b6ca684 100644 --- a/include/grub/unicode.h +++ b/include/grub/unicode.h @@ -253,7 +253,7 @@ grub_ssize_t grub_bidi_logical_to_visual (const grub_uint32_t *logical, grub_size_t logical_len, struct grub_unicode_glyph **visual_out, - grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg), + grub_size_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg), void *getcharwidth_arg, grub_size_t max_width, grub_size_t start_width, grub_uint32_t codechar,