[gtk+] fix printing of numbers



commit d92111256f818b1d2af95916a3cfe4bde16865ba
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Dec 22 21:58:31 2015 -0500

    fix printing of numbers
    
    We should be printing infinite, not inf.

 gtk/gtkcssnumbervalue.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkcssnumbervalue.c b/gtk/gtkcssnumbervalue.c
index 927e9bf..5db0758 100644
--- a/gtk/gtkcssnumbervalue.c
+++ b/gtk/gtkcssnumbervalue.c
@@ -17,6 +17,8 @@
 
 #include "config.h"
 
+#include <math.h>
+
 #include "gtkcssnumbervalueprivate.h"
 
 #include "gtkcssenumvalueprivate.h"
@@ -201,10 +203,15 @@ gtk_css_value_number_print (const GtkCssValue *number,
     /* [GTK_CSS_MS] = */ "ms",
   };
 
-  g_ascii_dtostr (buf, sizeof (buf), number->value);
-  g_string_append (string, buf);
-  if (number->value != 0.0)
-    g_string_append (string, names[number->unit]);
+  if (isinf (number->value))
+    g_string_append (string, "infinite");
+  else
+    {
+      g_ascii_dtostr (buf, sizeof (buf), number->value);
+      g_string_append (string, buf);
+      if (number->value != 0.0)
+        g_string_append (string, names[number->unit]);
+    }
 }
 
 static const GtkCssValueClass GTK_CSS_VALUE_NUMBER = {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]