Removes the fprint function. Values are printed using g_snprintf and "%g"

2007-08-29  Jakub Friedl  <jfriedl@suse.cz>

	* 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
This commit is contained in:
Jakub Friedl 2007-08-29 12:10:56 +00:00 committed by Jakub Friedl
parent 59fb23cea9
commit d32c7ca45f
2 changed files with 9 additions and 29 deletions

View file

@ -1,3 +1,9 @@
2007-08-29 Jakub Friedl <jfriedl@suse.cz>
* 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 <raphael@gimp.org>
* plug-ins/jpeg/jpeg-save.[ch]

View file

@ -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);
}