Make char and string width grub_size_t rather than grub_ssize_t.

This commit is contained in:
Vladimir Serbinenko 2013-10-25 23:58:24 +02:00
parent 0a7e52b2ed
commit a28567364a
9 changed files with 22 additions and 18 deletions

View file

@ -1,3 +1,7 @@
2013-10-25 Vladimir Serbinenko <phcoder@gmail.com>
Make char and string width grub_size_t rather than grub_ssize_t.
2013-10-25 Vladimir Serbinenko <phcoder@gmail.com> 2013-10-25 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/cmdline.c (grub_history_get): Make argument into * grub-core/normal/cmdline.c (grub_history_get): Make argument into

View file

@ -389,7 +389,7 @@ grub_unicode_get_comb_type (grub_uint32_t c)
#ifdef HAVE_UNIFONT_WIDTHSPEC #ifdef HAVE_UNIFONT_WIDTHSPEC
grub_ssize_t grub_size_t
grub_unicode_estimate_width (const struct grub_unicode_glyph *c) grub_unicode_estimate_width (const struct grub_unicode_glyph *c)
{ {
if (grub_unicode_get_comb_type (c->base)) 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, bidi_line_wrap (struct grub_unicode_glyph *visual_out,
struct grub_unicode_glyph *visual, struct grub_unicode_glyph *visual,
grub_size_t visual_len, 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, void *getcharwidth_arg,
grub_size_t maxwidth, grub_size_t startwidth, grub_size_t maxwidth, grub_size_t startwidth,
grub_uint32_t contchar, grub_uint32_t contchar,
@ -767,7 +767,7 @@ static grub_ssize_t
grub_bidi_line_logical_to_visual (const grub_uint32_t *logical, grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
grub_size_t logical_len, grub_size_t logical_len,
struct grub_unicode_glyph *visual_out, 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, void *getcharwidth_arg,
grub_size_t maxwidth, grub_size_t startwidth, grub_size_t maxwidth, grub_size_t startwidth,
grub_uint32_t contchar, grub_uint32_t contchar,
@ -1125,7 +1125,7 @@ grub_ssize_t
grub_bidi_logical_to_visual (const grub_uint32_t *logical, grub_bidi_logical_to_visual (const grub_uint32_t *logical,
grub_size_t logical_len, grub_size_t logical_len,
struct grub_unicode_glyph **visual_out, 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, void *getcharwidth_arg,
grub_size_t max_length, grub_size_t startwidth, grub_size_t max_length, grub_size_t startwidth,
grub_uint32_t contchar, struct grub_term_pos *pos, int primitive_wrap) grub_uint32_t contchar, struct grub_term_pos *pos, int primitive_wrap)

View file

@ -228,7 +228,7 @@ update_screen (struct screen *screen, struct per_term_screen *term_screen,
for (i = 0; i < screen->line; i++, linep++) for (i = 0; i < screen->line; i++, linep++)
y += get_logical_num_lines (linep, term_screen); y += get_logical_num_lines (linep, term_screen);
linep = screen->lines + screen->line; linep = screen->lines + screen->line;
int t = grub_getstringwidth (linep->buf, linep->buf + screen->column, grub_size_t t = grub_getstringwidth (linep->buf, linep->buf + screen->column,
term_screen->term); term_screen->term);
y += t / term_screen->geo.entry_width; y += t / term_screen->geo.entry_width;
if (t % term_screen->geo.entry_width == 0 if (t % term_screen->geo.entry_width == 0

View file

@ -51,7 +51,7 @@ grub_term_cursor_x (const struct grub_term_screen_geometry *geo)
return (geo->first_entry_x + geo->entry_width); 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, grub_getstringwidth (grub_uint32_t * str, const grub_uint32_t * last_position,
struct grub_term_output *term) struct grub_term_output *term)
{ {

View file

@ -866,7 +866,7 @@ print_backlog (struct grub_term_output *term,
return 0; return 0;
} }
static grub_ssize_t static grub_size_t
getcharwidth (const struct grub_unicode_glyph *c, void *term) getcharwidth (const struct grub_unicode_glyph *c, void *term)
{ {
return grub_term_getcharwidth (term, c); return grub_term_getcharwidth (term, c);

View file

@ -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 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)), grub_gfxterm_getcharwidth (struct grub_term_output *term __attribute__ ((unused)),
const struct grub_unicode_glyph *c); const struct grub_unicode_glyph *c);
@ -956,7 +956,7 @@ calculate_character_width (struct grub_font_glyph *glyph)
/ virtual_screen.normal_char_width; / virtual_screen.normal_char_width;
} }
static grub_ssize_t static grub_size_t
grub_gfxterm_getcharwidth (struct grub_term_output *term __attribute__ ((unused)), grub_gfxterm_getcharwidth (struct grub_term_output *term __attribute__ ((unused)),
const struct grub_unicode_glyph *c) const struct grub_unicode_glyph *c)
{ {

View file

@ -104,7 +104,7 @@ grub_ucs4_count_lines (const grub_uint32_t * str,
const grub_uint32_t * last_position, const grub_uint32_t * last_position,
int margin_left, int margin_right, int margin_left, int margin_right,
struct grub_term_output *term); struct grub_term_output *term);
grub_ssize_t grub_getstringwidth (grub_uint32_t * str, grub_size_t grub_getstringwidth (grub_uint32_t * str,
const grub_uint32_t * last_position, const grub_uint32_t * last_position,
struct grub_term_output *term); struct grub_term_output *term);
void grub_print_message_indented (const char *msg, int margin_left, void grub_print_message_indented (const char *msg, int margin_left,

View file

@ -187,7 +187,7 @@ struct grub_term_output
/* Get the number of columns occupied by a given character C. C is /* Get the number of columns occupied by a given character C. C is
encoded in Unicode. */ encoded in Unicode. */
grub_ssize_t (*getcharwidth) (struct grub_term_output *term, grub_size_t (*getcharwidth) (struct grub_term_output *term,
const struct grub_unicode_glyph *c); const struct grub_unicode_glyph *c);
/* Get the screen size. */ /* Get the screen size. */
@ -400,7 +400,7 @@ grub_term_cls (struct grub_term_output *term)
#ifdef HAVE_UNIFONT_WIDTHSPEC #ifdef HAVE_UNIFONT_WIDTHSPEC
grub_ssize_t grub_size_t
grub_unicode_estimate_width (const struct grub_unicode_glyph *c); grub_unicode_estimate_width (const struct grub_unicode_glyph *c);
#else #else
@ -417,7 +417,7 @@ grub_unicode_estimate_width (const struct grub_unicode_glyph *c __attribute__ ((
#define GRUB_TERM_TAB_WIDTH 8 #define GRUB_TERM_TAB_WIDTH 8
static inline grub_ssize_t static inline grub_size_t
grub_term_getcharwidth (struct grub_term_output *term, grub_term_getcharwidth (struct grub_term_output *term,
const struct grub_unicode_glyph *c) const struct grub_unicode_glyph *c)
{ {

View file

@ -253,7 +253,7 @@ grub_ssize_t
grub_bidi_logical_to_visual (const grub_uint32_t *logical, grub_bidi_logical_to_visual (const grub_uint32_t *logical,
grub_size_t logical_len, grub_size_t logical_len,
struct grub_unicode_glyph **visual_out, 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, void *getcharwidth_arg,
grub_size_t max_width, grub_size_t max_width,
grub_size_t start_width, grub_uint32_t codechar, grub_size_t start_width, grub_uint32_t codechar,