From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UQJvW-0001H1-K4 for mharc-grub-devel@gnu.org; Thu, 11 Apr 2013 12:00:43 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40631) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQJvT-0001Ct-Kl for grub-devel@gnu.org; Thu, 11 Apr 2013 12:00:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQJvS-0008Qh-61 for grub-devel@gnu.org; Thu, 11 Apr 2013 12:00:39 -0400 Received: from collab.rosalab.ru ([217.199.216.181]:38242) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQJvR-0008QN-RE for grub-devel@gnu.org; Thu, 11 Apr 2013 12:00:38 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by collab.rosalab.ru (Postfix) with ESMTP id 16E9A29C266 for ; Thu, 11 Apr 2013 20:00:36 +0400 (MSK) X-Virus-Scanned: amavisd-new at rosalab.ru Received: from collab.rosalab.ru ([127.0.0.1]) by localhost (collab.rosalab.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UM1Jokzf4eZa for ; Thu, 11 Apr 2013 20:00:35 +0400 (MSK) Received: from icedphoenix.localnet (unknown [10.168.1.56]) by collab.rosalab.ru (Postfix) with ESMTPSA id 51DA029C265 for ; Thu, 11 Apr 2013 20:00:35 +0400 (MSK) From: Vladimir Testov To: grub-devel@gnu.org Subject: Re: [3/4] [PATCH] start angle (option of circular_progress) is measured in unusual quantities Date: Thu, 11 Apr 2013 20:00:34 +0400 Message-ID: <13391534.dFkmsgxtKD@icedphoenix> User-Agent: KMail/4.9.5 (Linux/3.5.0-26-generic; KDE/4.9.5; x86_64; ; ) In-Reply-To: <3795956.oYbqbziuJu@icedphoenix> References: <1777262.HjMq9z6GjJ@icedphoenix> <3795956.oYbqbziuJu@icedphoenix> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart3468591.exICHBAp3f" Content-Transfer-Encoding: 7Bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 217.199.216.181 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Apr 2013 16:00:41 -0000 This is a multi-part message in MIME format. --nextPart3468591.exICHBAp3f Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Oh, I think that version of patch is safer. -- With best regards, _______________________________ Vladimir Testov, ROSA Laboratory. www.rosalab.ru --nextPart3468591.exICHBAp3f Content-Disposition: attachment; filename="grub-2.00-angle-translation.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="grub-2.00-angle-translation.patch" diff -Naur grub-2.00/grub-core/gfxmenu/gui_circular_progress.c grub-new/grub-core/gfxmenu/gui_circular_progress.c --- grub-2.00/grub-core/gfxmenu/gui_circular_progress.c 2010-12-01 17:45:43.000000000 +0300 +++ grub-new/grub-core/gfxmenu/gui_circular_progress.c 2013-04-11 19:58:24.459060324 +0400 @@ -223,6 +223,34 @@ self->end = end; } +static int +parse_angle (const char *value) +{ + int pos = 0; + int len = grub_strlen (value); + int angle = grub_strtol (value, 0, 10); + /* Find space symbol */ + while (pos < len && value[pos] != ' ') + pos++; + /* Skip spaces */ + while (pos < len && value[pos] == ' ') + pos++; + if (pos < len) + { + char *unit = grub_new_substring (value, pos, len); + if (!unit) + return angle; + if ((grub_strcmp (unit, "degree") == 0) + || (grub_strcmp (unit, "degrees") == 0)) + angle = angle * 64 / 90; + else if ((grub_strcmp (unit, "rad") == 0) + || grub_strcmp (unit, "rads") == 0) + angle = angle * 64 / 100; + grub_free (unit); + } + return angle; +} + static grub_err_t circprog_set_property (void *vself, const char *name, const char *value) { @@ -233,7 +261,7 @@ } 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) { --nextPart3468591.exICHBAp3f--