Use g_snprintf instead of snprintf.

snprintf is not compatible with msvc.
This commit is contained in:
Ignacio Casal Quinteiro
2016-08-10 12:29:01 +02:00
parent 5922bf061a
commit 67b294ef5d
2 changed files with 6 additions and 4 deletions

View File

@@ -1850,12 +1850,13 @@ gtk_scale_real_get_layout_offsets (GtkScale *scale,
}
static gchar *
weed_out_neg_zero (gchar *str, gint digits)
weed_out_neg_zero (gchar *str,
gint digits)
{
if (str[0] == '-')
{
gchar neg_zero[8];
snprintf (neg_zero, 8, "%0.*f", digits, -0.0);
g_snprintf (neg_zero, 8, "%0.*f", digits, -0.0);
if (strcmp (neg_zero, str) == 0)
memmove (str, str + 1, strlen (str) - 1);
}

View File

@@ -1116,12 +1116,13 @@ measure_string_width (PangoLayout *layout,
}
static gchar *
weed_out_neg_zero (gchar *str, gint digits)
weed_out_neg_zero (gchar *str,
gint digits)
{
if (str[0] == '-')
{
gchar neg_zero[8];
snprintf (neg_zero, 8, "%0.*f", digits, -0.0);
g_snprintf (neg_zero, 8, "%0.*f", digits, -0.0);
if (strcmp (neg_zero, str) == 0)
memmove (str, str + 1, strlen (str) - 1);
}