[gnome-builder] gstyle: Fix alpha component . in some locales
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] gstyle: Fix alpha component . in some locales
- Date: Fri, 3 Aug 2018 16:56:28 +0000 (UTC)
commit 7474ecd98b7df8c8ea5f2d77eaf2df33f5e49fb5
Author: Sebastien Lafargue <slafargue gnome org>
Date: Fri Aug 3 18:52:42 2018 +0200
gstyle: Fix alpha component . in some locales
Some locales were replacing it by a comma.
src/gstyle/gstyle-color.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/gstyle/gstyle-color.c b/src/gstyle/gstyle-color.c
index 41710dfdc..abfc432f0 100644
--- a/src/gstyle/gstyle-color.c
+++ b/src/gstyle/gstyle-color.c
@@ -116,10 +116,13 @@ gstyle_color_to_hsla (GstyleColor *self,
static gchar *
truncate_trailing_zeros (gdouble number)
{
- gint c = g_snprintf(TRUNCATE_BUF, 6, "%.2f", number);
+ guint i = (guint)number;
+ guint f = (number - i) * 100;
+ gint c = g_snprintf (TRUNCATE_BUF, 5, "%d.%d", i, f);
+ /* Format the number string, e.g. "0.50" => "0.5"; "1.0" => "1" */
--c;
- while(TRUNCATE_BUF[c] == '0')
+ while (TRUNCATE_BUF[c] == '0')
c--;
if (TRUNCATE_BUF[c] == '.')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]