From d32c7ca45ff9859f2ae53700879bf9fefbf58aad Mon Sep 17 00:00:00 2001 From: Jakub Friedl Date: Wed, 29 Aug 2007 12:10:56 +0000 Subject: [PATCH] Removes the fprint function. Values are printed using g_snprintf and "%g" 2007-08-29 Jakub Friedl * plug-ins/common/convmatrix.c: Removes the fprint function. Values are printed using g_snprintf and "%g" which supresses trailing zeroes. Fixes bug #471051. svn path=/trunk/; revision=23396 --- ChangeLog | 6 ++++++ plug-ins/common/convmatrix.c | 32 +++----------------------------- 2 files changed, 9 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 50cb56726b..b98761bbdc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-08-29 Jakub Friedl + + * plug-ins/common/convmatrix.c: Removes the fprint function. + Values are printed using g_snprintf and "%g" which supresses + trailing zeroes. Fixes bug #471051. + 2007-08-29 Raphaƫl Quinet * plug-ins/jpeg/jpeg-save.[ch] diff --git a/plug-ins/common/convmatrix.c b/plug-ins/common/convmatrix.c index 255634da1f..357ea99b6e 100644 --- a/plug-ins/common/convmatrix.c +++ b/plug-ins/common/convmatrix.c @@ -706,32 +706,6 @@ convolve_image (GimpDrawable *drawable, * GUI stuff */ -static void -fprint (gfloat f, - gchar *buffer, - gsize len) -{ - guint i, t; - - g_snprintf (buffer, len, "%.7f", f); - buffer[len - 1] = '\0'; - - for (t = 0; t < len - 1 && buffer[t] != '.'; t++) - ; - - i = t + 1; - - while (buffer[i] != '\0') - { - if (buffer[i] != '0') - t = i + 1; - - i++; - } - - buffer[t] = '\0'; -} - static void redraw_matrix (void) { @@ -741,7 +715,7 @@ redraw_matrix (void) for (y = 0; y < MATRIX_SIZE; y++) for (x = 0; x < MATRIX_SIZE; x++) { - fprint (config.matrix[x][y], buffer, sizeof (buffer)); + g_snprintf (buffer, sizeof (buffer), "%g", config.matrix[x][y]); gtk_entry_set_text (GTK_ENTRY (widget_set.matrix[x][y]), buffer); } } @@ -776,10 +750,10 @@ redraw_off_and_div (void) { gchar buffer[12]; - fprint (config.divisor, buffer, sizeof (buffer)); + g_snprintf (buffer, sizeof (buffer), "%g", config.divisor); gtk_entry_set_text (GTK_ENTRY (widget_set.divisor), buffer); - fprint (config.offset, buffer, sizeof (buffer)); + g_snprintf (buffer, sizeof (buffer), "%g", config.offset); gtk_entry_set_text (GTK_ENTRY (widget_set.offset), buffer); }