* grub-core/gfxmenu/circular_progress.c: Set start_angle in degrees

with syntax "XXX deg"/"XXX °".
This commit is contained in:
Vladimir Testov 2013-04-29 15:32:56 +02:00 committed by Vladimir 'phcoder' Serbinenko
parent 96f33fed86
commit 3476e0ef42
2 changed files with 25 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2013-04-29 Vladimir Testov <vladimir.testov@rosalab.ru>
* grub-core/gfxmenu/circular_progress.c: Set start_angle in degrees
with syntax "XXX deg"/"XXX °".
2013-04-29 Vladimir Serbinenko <phcoder@gmail.com>
Make PCI init in i386-qemu port more robust.

View file

@ -223,6 +223,25 @@ circprog_set_state (void *vself, int visible, int start,
self->end = end;
}
static int
parse_angle (const char *value)
{
char *ptr;
int angle;
angle = grub_strtol (value, &ptr, 10);
if (grub_errno)
return 0;
while (grub_isspace (*ptr))
ptr++;
if (grub_strcmp (ptr, "deg") == 0
/* Unicode symbol of degrees (a circle, U+b0). Put here in UTF-8 to
avoid potential problem with text file reesncoding */
|| grub_strcmp (ptr, "\xc2\xb0") == 0)
angle = (angle * 64 + 45) / 90;
return angle;
}
static grub_err_t
circprog_set_property (void *vself, const char *name, const char *value)
{
@ -233,7 +252,7 @@ circprog_set_property (void *vself, const char *name, const char *value)
}
else if (grub_strcmp (name, "start_angle") == 0)
{
self->start_angle = grub_strtol (value, 0, 10);
self->start_angle = parse_angle (value);
}
else if (grub_strcmp (name, "ticks_disappear") == 0)
{