From 22970f8c19587ba78aa36c2370512bf393768d3f Mon Sep 17 00:00:00 2001 From: Vladimir Testov Date: Mon, 29 Apr 2013 15:32:56 +0200 Subject: [PATCH 394/471] =?UTF-8?q?=09*=20grub-core/gfxmenu/circular=5Fpro?= =?UTF-8?q?gress.c:=20Set=20start=5Fangle=20in=20degrees=20=09with=20synta?= =?UTF-8?q?x=20"XXX=20deg"/"XXX=20=C2=B0".?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog | 5 +++++ grub-core/gfxmenu/gui_circular_progress.c | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ece8586..0e6d38a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-04-29 Vladimir Testov + + * grub-core/gfxmenu/circular_progress.c: Set start_angle in degrees + with syntax "XXX deg"/"XXX °". + 2013-04-29 Vladimir Serbinenko Make PCI init in i386-qemu port more robust. diff --git a/grub-core/gfxmenu/gui_circular_progress.c b/grub-core/gfxmenu/gui_circular_progress.c index e06d40c..284a75a 100644 --- a/grub-core/gfxmenu/gui_circular_progress.c +++ b/grub-core/gfxmenu/gui_circular_progress.c @@ -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) { -- 1.8.2.1