Fix compilation error

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-01-06 22:19:28 +01:00
parent cd622720c8
commit 34d2c9a10f

View file

@ -163,14 +163,15 @@ draw_text (grub_gui_progress_bar_t self)
grub_video_color_t text_color = grub_gui_map_color (self->text_color); grub_video_color_t text_color = grub_gui_map_color (self->text_color);
int width = self->bounds.width; int width = self->bounds.width;
int height = self->bounds.height; int height = self->bounds.height;
char *text = grub_asprintf (self->template, char *text = grub_malloc (grub_strlen (self->template) + 10);
self->value > 0 ? self->value : -self->value);
if (!text) if (!text)
{ {
grub_print_error (); grub_print_error ();
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
return; return;
} }
grub_sprintf (text, self->template,
self->value > 0 ? self->value : -self->value);
/* Center the text. */ /* Center the text. */
int text_width = grub_font_get_string_width (font, text); int text_width = grub_font_get_string_width (font, text);
int x = (width - text_width) / 2; int x = (width - text_width) / 2;