gtk-demo, testgtk: Don't pass an integer to fabs

It looks like a mistake which compilers are likely to warn.
This commit is contained in:
Ting-Wei Lan 2018-04-22 21:51:36 +08:00 committed by Matthias Clasen
parent f57c1a2901
commit 2a87caf529
2 changed files with 6 additions and 6 deletions

View File

@ -33,14 +33,14 @@ hex_spin_output (GtkSpinButton *spin_button)
{
GtkAdjustment *adjustment;
gchar *buf;
gint val;
gdouble val;
adjustment = gtk_spin_button_get_adjustment (spin_button);
val = (gint) gtk_adjustment_get_value (adjustment);
val = gtk_adjustment_get_value (adjustment);
if (fabs (val) < 1e-5)
buf = g_strdup ("0x00");
else
buf = g_strdup_printf ("0x%.2X", val);
buf = g_strdup_printf ("0x%.2X", (gint) val);
if (strcmp (buf, gtk_spin_button_get_text (spin_button)))
gtk_spin_button_set_text (spin_button, buf);
g_free (buf);

View File

@ -3240,14 +3240,14 @@ spin_button_hex_output_func (GtkSpinButton *spin_button)
{
GtkAdjustment *adjustment;
static gchar buf[7];
gint val;
gdouble val;
adjustment = gtk_spin_button_get_adjustment (spin_button);
val = (gint) gtk_adjustment_get_value (adjustment);
val = gtk_adjustment_get_value (adjustment);
if (fabs (val) < 1e-5)
sprintf (buf, "0x00");
else
sprintf (buf, "0x%.2X", val);
sprintf (buf, "0x%.2X", (gint) val);
if (strcmp (buf, gtk_spin_button_get_text (spin_button)))
gtk_spin_button_set_text (spin_button, buf);