diff --git a/ChangeLog b/ChangeLog index 2cbb692eea..f72dd395a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,46 @@ +2001-10-29 Sven Neumann + + * app/base/temp-buf.c (temp_buf_to_gray): rewrote so gcc-3.0 doesn't + complain. + + * app/widgets/gimpfontselection-dialog.c: use g_ascii_strcasecmp(). + + * libgimp/gimpintl.h + * libgimp/stdplugins-intl.h + * plug-ins/script-fu/script-fu-intl.h: don't call gtk_set_locale() + since gtk_init() does it for us now. Don't set LC_NUMERIC to "C". + INIT_I18N_UI() is the same as INIT_I18N_UI() now. + + * app/devices.c + * app/gimprc.c + * app/core/gimpbrushgenerated.c + * app/core/gimpgradient.c + * app/gui/color-notebook.c + * app/gui/gradients-commands.c + * plug-ins/gfig/gfig.c + * plug-ins/gflare/gflare.c + * plug-ins/gimpressionist/presets.c + * plug-ins/ifscompose/ifscompose_storage.c: use g_ascii_formatd() and + g_ascii_strtod() to serialize and deserialize floats. These functions + are locale-independent. There are probably more places that need to be + fixed in this fashion. + + * plug-ins/script-fu/script-fu-console.c + * plug-ins/script-fu/script-fu-scripts.c + * plug-ins/script-fu/script-fu-server.c + * plug-ins/script-fu/script-fu.c: s/INIT_I18N_UI/INIT_I18N/ + + * tools/gimp-remote.c + * app/widgets/gimpwidgets-utils.c + * app/core/gimpimage-contiguous-region.c + * app/paint-funcs/paint-funcs-indexeda.c + * app/paint-funcs/paint-funcs.c + * app/tools/gimppathtool.c + * app/tools/path_tool.c + * modules/colorsel_triangle.c + * plug-ins/common/mpeg.c + * plug-ins/imagemap/imap_csim_parse.c: cleanups + 2001-10-29 Michael Natterer Cleanup weekend... @@ -141,7 +184,8 @@ * app/*/makefile.msc : updated * app/file/makefile.msc app/display/makefile.msc : new files - * app/user_install.c : make the G_OS_WIN32 part compile again (fn -> filename) + * app/user_install.c : make the G_OS_WIN32 part compile again + (fn -> filename) * app/core/gimptoolinfo.c (gimp_tool_info_init) : cosmetic change, make implementation signature static like the local prototype diff --git a/app/actions/gradients-commands.c b/app/actions/gradients-commands.c index 7e173129f9..5a2535a5cb 100644 --- a/app/actions/gradients-commands.c +++ b/app/actions/gradients-commands.c @@ -159,6 +159,7 @@ gradients_save_as_pov_ok_callback (GtkWidget *widget, const gchar *filename; FILE *file; GimpGradientSegment *seg; + gchar buf[3][G_ASCII_DTOSTR_BUF_SIZE]; filesel = GTK_FILE_SELECTION (gtk_widget_get_toplevel (widget)); filename = gtk_file_selection_get_filename (filesel); @@ -179,28 +180,46 @@ gradients_save_as_pov_ok_callback (GtkWidget *widget, for (seg = gradient->segments; seg; seg = seg->next) { /* Left */ - fprintf (file, "\t[%f color rgbt <%f, %f, %f, %f>]\n", + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", + seg->left_color.r); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", + seg->left_color.g); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", + seg->left_color.b); + g_ascii_formatd (buf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", + 1.0 - seg->left_color.a); + + fprintf (file, "\t[%f color rgbt <%s, %s, %s, %s>]\n", seg->left, - seg->left_color.r, - seg->left_color.g, - seg->left_color.b, - 1.0 - seg->left_color.a); + buf[0], buf[1], buf[2], buf[3]); /* Middle */ + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", + (seg->left_color.r + seg->right_color.r) / 2.0); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", + (seg->left_color.g + seg->right_color.g) / 2.0); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", + (seg->left_color.b + seg->right_color.b) / 2.0); + g_ascii_formatd (buf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", + 1.0 - (seg->left_color.a + seg->right_color.a) / 2.0); + fprintf (file, "\t[%f color rgbt <%f, %f, %f, %f>]\n", seg->middle, - (seg->left_color.r + seg->right_color.r) / 2.0, - (seg->left_color.g + seg->right_color.g) / 2.0, - (seg->left_color.b + seg->right_color.b) / 2.0, - 1.0 - (seg->left_color.a + seg->right_color.a) / 2.0); + buf[0], buf[1], buf[2], buf[3]); /* Right */ + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", + seg->right_color.r); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", + seg->right_color.g); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", + seg->right_color.b); + g_ascii_formatd (buf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", + 1.0 - seg->right_color.a); + fprintf (file, "\t[%f color rgbt <%f, %f, %f, %f>]\n", seg->right, - seg->right_color.r, - seg->right_color.g, - seg->right_color.b, - 1.0 - seg->right_color.a); + buf[0], buf[1], buf[2], buf[3]); } fprintf (file, "} /* color_map */\n"); diff --git a/app/base/temp-buf.c b/app/base/temp-buf.c index 87adf4be5c..e44bbe043c 100644 --- a/app/base/temp-buf.c +++ b/app/base/temp-buf.c @@ -107,11 +107,12 @@ temp_buf_to_gray (TempBuf *src_buf, while (num_bytes--) { - *dest++ = *src++; /* alpha channel */ - - pix = INTENSITY (*src++, *src++, *src++); + *dest++ = src[0]; /* alpha channel */ + pix = INTENSITY (src[1], src[2], src[3]); *dest++ = (guchar) pix; + + src += 4; } } diff --git a/app/core/gimpbrushgenerated-load.c b/app/core/gimpbrushgenerated-load.c index dca48cad88..1658866616 100644 --- a/app/core/gimpbrushgenerated-load.c +++ b/app/core/gimpbrushgenerated-load.c @@ -114,6 +114,7 @@ gimp_brush_generated_save (GimpData *data) { GimpBrushGenerated *brush; FILE *fp; + gchar buf[G_ASCII_DTOSTR_BUF_SIZE]; g_return_val_if_fail (data != NULL, FALSE); g_return_val_if_fail (GIMP_IS_BRUSH_GENERATED (data), FALSE); @@ -137,19 +138,29 @@ gimp_brush_generated_save (GimpData *data) fprintf (fp, "%.255s\n", GIMP_OBJECT (brush)->name); /* write brush spacing */ - fprintf (fp, "%f\n", (gfloat) GIMP_BRUSH (brush)->spacing); + fprintf (fp, "%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", + GIMP_BRUSH (brush)->spacing)); /* write brush radius */ - fprintf (fp, "%f\n", brush->radius); + fprintf (fp, "%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", + brush->radius)); /* write brush hardness */ - fprintf (fp, "%f\n", brush->hardness); + fprintf (fp, "%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", + brush->hardness)); /* write brush aspect_ratio */ - fprintf (fp, "%f\n", brush->aspect_ratio); + fprintf (fp, "%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", + brush->aspect_ratio)); /* write brush angle */ - fprintf (fp, "%f\n", brush->angle); + fprintf (fp, "%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", + brush->angle)); fclose (fp); @@ -351,8 +362,6 @@ gimp_brush_generated_load (const gchar *filename) GimpBrushGenerated *brush; FILE *fp; gchar string[256]; - gfloat fl; - gfloat version; if ((fp = fopen (filename, "rb")) == NULL) return NULL; @@ -365,8 +374,8 @@ gimp_brush_generated_load (const gchar *filename) /* make sure we are reading a compatible version */ fgets (string, 255, fp); - sscanf (string, "%f", &version); - g_return_val_if_fail (version < 2.0, NULL); + if (strncmp (string, "1.0", 3)) + return NULL; /* create new brush */ brush = GIMP_BRUSH_GENERATED (g_object_new (GIMP_TYPE_BRUSH_GENERATED, NULL)); @@ -382,24 +391,24 @@ gimp_brush_generated_load (const gchar *filename) gimp_object_set_name (GIMP_OBJECT (brush), string); /* read brush spacing */ - fscanf (fp, "%f", &fl); - GIMP_BRUSH (brush)->spacing = fl; + fgets (string, 255, fp); + GIMP_BRUSH (brush)->spacing = g_ascii_strtod (string, NULL); /* read brush radius */ - fscanf (fp, "%f", &fl); - gimp_brush_generated_set_radius (brush, fl); + fgets (string, 255, fp); + gimp_brush_generated_set_radius (brush, g_ascii_strtod (string, NULL)); /* read brush hardness */ - fscanf (fp, "%f", &fl); - gimp_brush_generated_set_hardness (brush, fl); + fgets (string, 255, fp); + gimp_brush_generated_set_hardness (brush, g_ascii_strtod (string, NULL)); /* read brush aspect_ratio */ - fscanf (fp, "%f", &fl); - gimp_brush_generated_set_aspect_ratio (brush, fl); + fgets (string, 255, fp); + gimp_brush_generated_set_aspect_ratio (brush, g_ascii_strtod (string, NULL)); /* read brush angle */ - fscanf (fp, "%f", &fl); - gimp_brush_generated_set_angle (brush, fl); + fgets (string, 255, fp); + gimp_brush_generated_set_angle (brush, g_ascii_strtod (string, NULL)); fclose (fp); diff --git a/app/core/gimpbrushgenerated-save.c b/app/core/gimpbrushgenerated-save.c index dca48cad88..1658866616 100644 --- a/app/core/gimpbrushgenerated-save.c +++ b/app/core/gimpbrushgenerated-save.c @@ -114,6 +114,7 @@ gimp_brush_generated_save (GimpData *data) { GimpBrushGenerated *brush; FILE *fp; + gchar buf[G_ASCII_DTOSTR_BUF_SIZE]; g_return_val_if_fail (data != NULL, FALSE); g_return_val_if_fail (GIMP_IS_BRUSH_GENERATED (data), FALSE); @@ -137,19 +138,29 @@ gimp_brush_generated_save (GimpData *data) fprintf (fp, "%.255s\n", GIMP_OBJECT (brush)->name); /* write brush spacing */ - fprintf (fp, "%f\n", (gfloat) GIMP_BRUSH (brush)->spacing); + fprintf (fp, "%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", + GIMP_BRUSH (brush)->spacing)); /* write brush radius */ - fprintf (fp, "%f\n", brush->radius); + fprintf (fp, "%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", + brush->radius)); /* write brush hardness */ - fprintf (fp, "%f\n", brush->hardness); + fprintf (fp, "%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", + brush->hardness)); /* write brush aspect_ratio */ - fprintf (fp, "%f\n", brush->aspect_ratio); + fprintf (fp, "%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", + brush->aspect_ratio)); /* write brush angle */ - fprintf (fp, "%f\n", brush->angle); + fprintf (fp, "%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", + brush->angle)); fclose (fp); @@ -351,8 +362,6 @@ gimp_brush_generated_load (const gchar *filename) GimpBrushGenerated *brush; FILE *fp; gchar string[256]; - gfloat fl; - gfloat version; if ((fp = fopen (filename, "rb")) == NULL) return NULL; @@ -365,8 +374,8 @@ gimp_brush_generated_load (const gchar *filename) /* make sure we are reading a compatible version */ fgets (string, 255, fp); - sscanf (string, "%f", &version); - g_return_val_if_fail (version < 2.0, NULL); + if (strncmp (string, "1.0", 3)) + return NULL; /* create new brush */ brush = GIMP_BRUSH_GENERATED (g_object_new (GIMP_TYPE_BRUSH_GENERATED, NULL)); @@ -382,24 +391,24 @@ gimp_brush_generated_load (const gchar *filename) gimp_object_set_name (GIMP_OBJECT (brush), string); /* read brush spacing */ - fscanf (fp, "%f", &fl); - GIMP_BRUSH (brush)->spacing = fl; + fgets (string, 255, fp); + GIMP_BRUSH (brush)->spacing = g_ascii_strtod (string, NULL); /* read brush radius */ - fscanf (fp, "%f", &fl); - gimp_brush_generated_set_radius (brush, fl); + fgets (string, 255, fp); + gimp_brush_generated_set_radius (brush, g_ascii_strtod (string, NULL)); /* read brush hardness */ - fscanf (fp, "%f", &fl); - gimp_brush_generated_set_hardness (brush, fl); + fgets (string, 255, fp); + gimp_brush_generated_set_hardness (brush, g_ascii_strtod (string, NULL)); /* read brush aspect_ratio */ - fscanf (fp, "%f", &fl); - gimp_brush_generated_set_aspect_ratio (brush, fl); + fgets (string, 255, fp); + gimp_brush_generated_set_aspect_ratio (brush, g_ascii_strtod (string, NULL)); /* read brush angle */ - fscanf (fp, "%f", &fl); - gimp_brush_generated_set_angle (brush, fl); + fgets (string, 255, fp); + gimp_brush_generated_set_angle (brush, g_ascii_strtod (string, NULL)); fclose (fp); diff --git a/app/core/gimpbrushgenerated.c b/app/core/gimpbrushgenerated.c index dca48cad88..1658866616 100644 --- a/app/core/gimpbrushgenerated.c +++ b/app/core/gimpbrushgenerated.c @@ -114,6 +114,7 @@ gimp_brush_generated_save (GimpData *data) { GimpBrushGenerated *brush; FILE *fp; + gchar buf[G_ASCII_DTOSTR_BUF_SIZE]; g_return_val_if_fail (data != NULL, FALSE); g_return_val_if_fail (GIMP_IS_BRUSH_GENERATED (data), FALSE); @@ -137,19 +138,29 @@ gimp_brush_generated_save (GimpData *data) fprintf (fp, "%.255s\n", GIMP_OBJECT (brush)->name); /* write brush spacing */ - fprintf (fp, "%f\n", (gfloat) GIMP_BRUSH (brush)->spacing); + fprintf (fp, "%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", + GIMP_BRUSH (brush)->spacing)); /* write brush radius */ - fprintf (fp, "%f\n", brush->radius); + fprintf (fp, "%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", + brush->radius)); /* write brush hardness */ - fprintf (fp, "%f\n", brush->hardness); + fprintf (fp, "%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", + brush->hardness)); /* write brush aspect_ratio */ - fprintf (fp, "%f\n", brush->aspect_ratio); + fprintf (fp, "%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", + brush->aspect_ratio)); /* write brush angle */ - fprintf (fp, "%f\n", brush->angle); + fprintf (fp, "%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", + brush->angle)); fclose (fp); @@ -351,8 +362,6 @@ gimp_brush_generated_load (const gchar *filename) GimpBrushGenerated *brush; FILE *fp; gchar string[256]; - gfloat fl; - gfloat version; if ((fp = fopen (filename, "rb")) == NULL) return NULL; @@ -365,8 +374,8 @@ gimp_brush_generated_load (const gchar *filename) /* make sure we are reading a compatible version */ fgets (string, 255, fp); - sscanf (string, "%f", &version); - g_return_val_if_fail (version < 2.0, NULL); + if (strncmp (string, "1.0", 3)) + return NULL; /* create new brush */ brush = GIMP_BRUSH_GENERATED (g_object_new (GIMP_TYPE_BRUSH_GENERATED, NULL)); @@ -382,24 +391,24 @@ gimp_brush_generated_load (const gchar *filename) gimp_object_set_name (GIMP_OBJECT (brush), string); /* read brush spacing */ - fscanf (fp, "%f", &fl); - GIMP_BRUSH (brush)->spacing = fl; + fgets (string, 255, fp); + GIMP_BRUSH (brush)->spacing = g_ascii_strtod (string, NULL); /* read brush radius */ - fscanf (fp, "%f", &fl); - gimp_brush_generated_set_radius (brush, fl); + fgets (string, 255, fp); + gimp_brush_generated_set_radius (brush, g_ascii_strtod (string, NULL)); /* read brush hardness */ - fscanf (fp, "%f", &fl); - gimp_brush_generated_set_hardness (brush, fl); + fgets (string, 255, fp); + gimp_brush_generated_set_hardness (brush, g_ascii_strtod (string, NULL)); /* read brush aspect_ratio */ - fscanf (fp, "%f", &fl); - gimp_brush_generated_set_aspect_ratio (brush, fl); + fgets (string, 255, fp); + gimp_brush_generated_set_aspect_ratio (brush, g_ascii_strtod (string, NULL)); /* read brush angle */ - fscanf (fp, "%f", &fl); - gimp_brush_generated_set_angle (brush, fl); + fgets (string, 255, fp); + gimp_brush_generated_set_angle (brush, g_ascii_strtod (string, NULL)); fclose (fp); diff --git a/app/core/gimpgradient.c b/app/core/gimpgradient.c index 8d7b616a16..23cdf16bce 100644 --- a/app/core/gimpgradient.c +++ b/app/core/gimpgradient.c @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -360,6 +361,8 @@ gimp_gradient_load (const gchar *filename) for (i = 0; i < num_segments; i++) { + gchar *end; + seg = gimp_gradient_segment_new (); seg->prev = prev; @@ -371,27 +374,42 @@ gimp_gradient_load (const gchar *filename) fgets (line, 1024, file); - if (sscanf (line, "%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%lf%d%d", - &(seg->left), &(seg->middle), &(seg->right), - &(seg->left_color.r), - &(seg->left_color.g), - &(seg->left_color.b), - &(seg->left_color.a), - &(seg->right_color.r), - &(seg->right_color.g), - &(seg->right_color.b), - &(seg->right_color.a), - &type, &color) != 13) - { + seg->left = g_ascii_strtod (line, &end); + if (end && errno != ERANGE) + seg->middle = g_ascii_strtod (end, &end); + if (end && errno != ERANGE) + seg->right = g_ascii_strtod (end, &end); + + if (end && errno != ERANGE) + seg->left_color.r = g_ascii_strtod (end, &end); + if (end && errno != ERANGE) + seg->left_color.g = g_ascii_strtod (end, &end); + if (end && errno != ERANGE) + seg->left_color.b = g_ascii_strtod (end, &end); + if (end && errno != ERANGE) + seg->left_color.a = g_ascii_strtod (end, &end); + + if (end && errno != ERANGE) + seg->right_color.r = g_ascii_strtod (end, &end); + if (end && errno != ERANGE) + seg->right_color.g = g_ascii_strtod (end, &end); + if (end && errno != ERANGE) + seg->right_color.b = g_ascii_strtod (end, &end); + if (end && errno != ERANGE) + seg->right_color.a = g_ascii_strtod (end, &end); + + if (errno != ERANGE && + sscanf (end, "%d %d", &type, &color) == 2) + { + seg->type = (GimpGradientSegmentType) type; + seg->color = (GimpGradientSegmentColor) color; + } + else + { g_message ("%s(): badly formatted gradient segment %d in \"%s\" --- " "bad things may happen soon", G_GNUC_FUNCTION, i, filename); } - else - { - seg->type = (GimpGradientSegmentType) type; - seg->color = (GimpGradientSegmentColor) color; - } prev = seg; } @@ -463,16 +481,23 @@ gimp_gradient_save (GimpData *data) for (seg = gradient->segments; seg; seg = seg->next) { - fprintf (file, "%f %f %f %f %f %f %f %f %f %f %f %d %d\n", - seg->left, seg->middle, seg->right, - seg->left_color.r, - seg->left_color.g, - seg->left_color.b, - seg->left_color.a, - seg->right_color.r, - seg->right_color.g, - seg->right_color.b, - seg->right_color.a, + gchar buf[11][G_ASCII_DTOSTR_BUF_SIZE]; + + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", seg->left); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", seg->middle); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", seg->right); + g_ascii_formatd (buf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", seg->left_color.r); + g_ascii_formatd (buf[4], G_ASCII_DTOSTR_BUF_SIZE, "%f", seg->left_color.g); + g_ascii_formatd (buf[5], G_ASCII_DTOSTR_BUF_SIZE, "%f", seg->left_color.b); + g_ascii_formatd (buf[6], G_ASCII_DTOSTR_BUF_SIZE, "%f", seg->left_color.a); + g_ascii_formatd (buf[7], G_ASCII_DTOSTR_BUF_SIZE, "%f", seg->right_color.r); + g_ascii_formatd (buf[8], G_ASCII_DTOSTR_BUF_SIZE, "%f", seg->right_color.g); + g_ascii_formatd (buf[9], G_ASCII_DTOSTR_BUF_SIZE, "%f", seg->right_color.b); + g_ascii_formatd (buf[10], G_ASCII_DTOSTR_BUF_SIZE, "%f", seg->right_color.a); + + fprintf (file, "%s %s %s %s %s %s %s %s %s %s %s %d %d\n", + buf[0], buf[1], buf[2], buf[3], buf[4], + buf[5], buf[6], buf[7], buf[8], buf[9], buf[10], (gint) seg->type, (gint) seg->color); } diff --git a/app/core/gimpimage-contiguous-region.c b/app/core/gimpimage-contiguous-region.c index 44316e5de9..def7d4f2c5 100644 --- a/app/core/gimpimage-contiguous-region.c +++ b/app/core/gimpimage-contiguous-region.c @@ -18,6 +18,8 @@ #include "config.h" +#include + #include #include "libgimpcolor/gimpcolor.h" diff --git a/app/devices.c b/app/devices.c index 3a50fbe72e..2bd0287dc0 100644 --- a/app/devices.c +++ b/app/devices.c @@ -665,16 +665,25 @@ devices_write_rc_device (DeviceInfo *device_info, { GimpRGB color; + gchar buf[3][G_ASCII_DTOSTR_BUF_SIZE]; gimp_context_get_foreground (device_info->context, &color); - fprintf (fp, "\n (foreground (color-rgb %f %f %f))", - color.r, color.g, color.b); + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.r); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.g); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.b); + + fprintf (fp, "\n (foreground (color-rgb %s %s %s))", + buf[0], buf[1], buf[2]); gimp_context_get_background (device_info->context, &color); - fprintf (fp, "\n (background (color-rgb %f %f %f))", - color.r, color.g, color.b); + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.r); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.g); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.b); + + fprintf (fp, "\n (background (color-rgb %s %s %s))", + buf[0], buf[1], buf[2]); } if (gimp_context_get_brush (device_info->context)) diff --git a/app/dialogs/color-dialog.c b/app/dialogs/color-dialog.c index 43652db0a3..dfc36cafed 100644 --- a/app/dialogs/color-dialog.c +++ b/app/dialogs/color-dialog.c @@ -1290,11 +1290,19 @@ color_history_write (FILE *fp) for (i = 0; i < COLOR_HISTORY_SIZE; i++) { - fprintf (fp, "\n (color-rgba %f %f %f %f)", - color_history[i].r, - color_history[i].g, - color_history[i].b, - color_history[i].a); + gchar buf[4][G_ASCII_DTOSTR_BUF_SIZE]; + + g_ascii_formatd (buf[0], + G_ASCII_DTOSTR_BUF_SIZE, "%f", color_history[i].r); + g_ascii_formatd (buf[1], + G_ASCII_DTOSTR_BUF_SIZE, "%f", color_history[i].g); + g_ascii_formatd (buf[2], + G_ASCII_DTOSTR_BUF_SIZE, "%f", color_history[i].b); + g_ascii_formatd (buf[3], + G_ASCII_DTOSTR_BUF_SIZE, "%f", color_history[i].a); + + fprintf (fp, "\n (color-rgba %s %s %s %s)", + buf[0], buf[1], buf[2], buf[3]); } fprintf (fp, ")\n\n"); diff --git a/app/gimprc.c b/app/gimprc.c index d177a1b1bf..89c9abbacc 100644 --- a/app/gimprc.c +++ b/app/gimprc.c @@ -166,7 +166,6 @@ static gint parse_unknown (gchar *token_sym); static inline gchar * string_to_str (gpointer val1p, gpointer val2p); static inline gchar * path_to_str (gpointer val1p, gpointer val2p); static inline gchar * double_to_str (gpointer val1p, gpointer val2p); -static inline gchar * float_to_str (gpointer val1p, gpointer val2p); static inline gchar * int_to_str (gpointer val1p, gpointer val2p); static inline gchar * boolean_to_str (gpointer val1p, gpointer val2p); static inline gchar * position_to_str (gpointer val1p, gpointer val2p); @@ -2857,9 +2856,8 @@ gimprc_value_to_str (const gchar *name) case TT_PATH: return path_to_str (func->val1p, func->val2p); case TT_DOUBLE: - return double_to_str (func->val1p, func->val2p); case TT_FLOAT: - return float_to_str (func->val1p, func->val2p); + return double_to_str (func->val1p, func->val2p); case TT_INT: return int_to_str (func->val1p, func->val2p); case TT_BOOLEAN: @@ -2924,14 +2922,10 @@ static inline gchar * double_to_str (gpointer val1p, gpointer val2p) { - return g_strdup_printf ("%f", *((gdouble *)val1p)); -} + gchar buf[G_ASCII_DTOSTR_BUF_SIZE]; -static inline gchar * -float_to_str (gpointer val1p, - gpointer val2p) -{ - return g_strdup_printf ("%f", (gdouble)(*((float *)val1p))); + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", *((gdouble *)val1p)); + return g_strdup (buf); } static inline gchar * diff --git a/app/gui/color-notebook.c b/app/gui/color-notebook.c index 43652db0a3..dfc36cafed 100644 --- a/app/gui/color-notebook.c +++ b/app/gui/color-notebook.c @@ -1290,11 +1290,19 @@ color_history_write (FILE *fp) for (i = 0; i < COLOR_HISTORY_SIZE; i++) { - fprintf (fp, "\n (color-rgba %f %f %f %f)", - color_history[i].r, - color_history[i].g, - color_history[i].b, - color_history[i].a); + gchar buf[4][G_ASCII_DTOSTR_BUF_SIZE]; + + g_ascii_formatd (buf[0], + G_ASCII_DTOSTR_BUF_SIZE, "%f", color_history[i].r); + g_ascii_formatd (buf[1], + G_ASCII_DTOSTR_BUF_SIZE, "%f", color_history[i].g); + g_ascii_formatd (buf[2], + G_ASCII_DTOSTR_BUF_SIZE, "%f", color_history[i].b); + g_ascii_formatd (buf[3], + G_ASCII_DTOSTR_BUF_SIZE, "%f", color_history[i].a); + + fprintf (fp, "\n (color-rgba %s %s %s %s)", + buf[0], buf[1], buf[2], buf[3]); } fprintf (fp, ")\n\n"); diff --git a/app/gui/device-status-dialog.c b/app/gui/device-status-dialog.c index 3a50fbe72e..2bd0287dc0 100644 --- a/app/gui/device-status-dialog.c +++ b/app/gui/device-status-dialog.c @@ -665,16 +665,25 @@ devices_write_rc_device (DeviceInfo *device_info, { GimpRGB color; + gchar buf[3][G_ASCII_DTOSTR_BUF_SIZE]; gimp_context_get_foreground (device_info->context, &color); - fprintf (fp, "\n (foreground (color-rgb %f %f %f))", - color.r, color.g, color.b); + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.r); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.g); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.b); + + fprintf (fp, "\n (foreground (color-rgb %s %s %s))", + buf[0], buf[1], buf[2]); gimp_context_get_background (device_info->context, &color); - fprintf (fp, "\n (background (color-rgb %f %f %f))", - color.r, color.g, color.b); + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.r); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.g); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.b); + + fprintf (fp, "\n (background (color-rgb %s %s %s))", + buf[0], buf[1], buf[2]); } if (gimp_context_get_brush (device_info->context)) diff --git a/app/gui/gradients-commands.c b/app/gui/gradients-commands.c index 7e173129f9..5a2535a5cb 100644 --- a/app/gui/gradients-commands.c +++ b/app/gui/gradients-commands.c @@ -159,6 +159,7 @@ gradients_save_as_pov_ok_callback (GtkWidget *widget, const gchar *filename; FILE *file; GimpGradientSegment *seg; + gchar buf[3][G_ASCII_DTOSTR_BUF_SIZE]; filesel = GTK_FILE_SELECTION (gtk_widget_get_toplevel (widget)); filename = gtk_file_selection_get_filename (filesel); @@ -179,28 +180,46 @@ gradients_save_as_pov_ok_callback (GtkWidget *widget, for (seg = gradient->segments; seg; seg = seg->next) { /* Left */ - fprintf (file, "\t[%f color rgbt <%f, %f, %f, %f>]\n", + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", + seg->left_color.r); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", + seg->left_color.g); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", + seg->left_color.b); + g_ascii_formatd (buf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", + 1.0 - seg->left_color.a); + + fprintf (file, "\t[%f color rgbt <%s, %s, %s, %s>]\n", seg->left, - seg->left_color.r, - seg->left_color.g, - seg->left_color.b, - 1.0 - seg->left_color.a); + buf[0], buf[1], buf[2], buf[3]); /* Middle */ + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", + (seg->left_color.r + seg->right_color.r) / 2.0); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", + (seg->left_color.g + seg->right_color.g) / 2.0); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", + (seg->left_color.b + seg->right_color.b) / 2.0); + g_ascii_formatd (buf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", + 1.0 - (seg->left_color.a + seg->right_color.a) / 2.0); + fprintf (file, "\t[%f color rgbt <%f, %f, %f, %f>]\n", seg->middle, - (seg->left_color.r + seg->right_color.r) / 2.0, - (seg->left_color.g + seg->right_color.g) / 2.0, - (seg->left_color.b + seg->right_color.b) / 2.0, - 1.0 - (seg->left_color.a + seg->right_color.a) / 2.0); + buf[0], buf[1], buf[2], buf[3]); /* Right */ + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", + seg->right_color.r); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", + seg->right_color.g); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", + seg->right_color.b); + g_ascii_formatd (buf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", + 1.0 - seg->right_color.a); + fprintf (file, "\t[%f color rgbt <%f, %f, %f, %f>]\n", seg->right, - seg->right_color.r, - seg->right_color.g, - seg->right_color.b, - 1.0 - seg->right_color.a); + buf[0], buf[1], buf[2], buf[3]); } fprintf (file, "} /* color_map */\n"); diff --git a/app/gui/input-dialog.c b/app/gui/input-dialog.c index 3a50fbe72e..2bd0287dc0 100644 --- a/app/gui/input-dialog.c +++ b/app/gui/input-dialog.c @@ -665,16 +665,25 @@ devices_write_rc_device (DeviceInfo *device_info, { GimpRGB color; + gchar buf[3][G_ASCII_DTOSTR_BUF_SIZE]; gimp_context_get_foreground (device_info->context, &color); - fprintf (fp, "\n (foreground (color-rgb %f %f %f))", - color.r, color.g, color.b); + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.r); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.g); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.b); + + fprintf (fp, "\n (foreground (color-rgb %s %s %s))", + buf[0], buf[1], buf[2]); gimp_context_get_background (device_info->context, &color); - fprintf (fp, "\n (background (color-rgb %f %f %f))", - color.r, color.g, color.b); + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.r); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.g); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.b); + + fprintf (fp, "\n (background (color-rgb %s %s %s))", + buf[0], buf[1], buf[2]); } if (gimp_context_get_brush (device_info->context)) diff --git a/app/paint-funcs/paint-funcs-indexeda.c b/app/paint-funcs/paint-funcs-indexeda.c index bfa6144977..62b1724eca 100644 --- a/app/paint-funcs/paint-funcs-indexeda.c +++ b/app/paint-funcs/paint-funcs-indexeda.c @@ -674,9 +674,9 @@ shrink_line (gdouble *dest, register const gdouble inv_step = 1.0 / step; gdouble position; - fprintf(stderr, "shrink_line bytes=%d old_width=%d width=%d interp=%d " - "step=%f inv_step=%f\n", - bytes, old_width, width, interp, step, inv_step); + g_printerr ("shrink_line bytes=%d old_width=%d width=%d interp=%d " + "step=%f inv_step=%f\n", + bytes, old_width, width, interp, step, inv_step); for (b = 0; b < bytes; b++) { diff --git a/app/paint-funcs/paint-funcs.c b/app/paint-funcs/paint-funcs.c index 5f6d13d548..5784ea48bc 100644 --- a/app/paint-funcs/paint-funcs.c +++ b/app/paint-funcs/paint-funcs.c @@ -4161,9 +4161,9 @@ shrink_line (gdouble *dest, register const gdouble inv_step = 1.0 / step; gdouble position; - fprintf(stderr, "shrink_line bytes=%d old_width=%d width=%d interp=%d " - "step=%f inv_step=%f\n", - bytes, old_width, width, interp, step, inv_step); + g_printerr ("shrink_line bytes=%d old_width=%d width=%d interp=%d " + "step=%f inv_step=%f\n", + bytes, old_width, width, interp, step, inv_step); for (b = 0; b < bytes; b++) { diff --git a/app/tools/gimplevelstool.c b/app/tools/gimplevelstool.c index 765e929e25..1de13871ec 100644 --- a/app/tools/gimplevelstool.c +++ b/app/tools/gimplevelstool.c @@ -1645,7 +1645,7 @@ levels_read_from_file (FILE *f) if (!fgets (buf, 50, f)) return FALSE; - gamma[i] = strtod(buf, &nptr); + gamma[i] = g_ascii_strtod (buf, &nptr); if (buf == nptr || errno == ERANGE) return FALSE; @@ -1671,17 +1671,19 @@ levels_read_from_file (FILE *f) static void levels_write_to_file (FILE *f) { - int i; + gint i; + gchar buf[G_ASCII_DTOSTR_BUF_SIZE]; fprintf (f, "# GIMP Levels File\n"); for (i = 0; i < 5; i++) { - fprintf (f, "%d %d %d %d %f\n", + fprintf (f, "%d %d %d %d %s\n", levels_dialog->low_input[i], levels_dialog->high_input[i], levels_dialog->low_output[i], levels_dialog->high_output[i], - levels_dialog->gamma[i]); + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", + levels_dialog->gamma[i])); } } diff --git a/app/tools/gimppathtool.c b/app/tools/gimppathtool.c index 9931e01dcd..1b7418929f 100644 --- a/app/tools/gimppathtool.c +++ b/app/tools/gimppathtool.c @@ -19,8 +19,6 @@ #include "config.h" -#include - #include #include "libgimpmath/gimpmath.h" @@ -219,8 +217,8 @@ gimp_path_tool_finalize (GObject *object) path_tool = GIMP_PATH_TOOL (object); #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "gimp_path_tool_free start\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("gimp_path_tool_free start\n"); +#endif if (path_tool->cur_path) { @@ -239,8 +237,8 @@ gimp_path_tool_control (GimpTool *tool, GimpPathTool *path_tool; #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "path_tool_control\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_control\n"); +#endif path_tool = GIMP_PATH_TOOL (tool); @@ -275,14 +273,14 @@ gimp_path_tool_button_press (GimpTool *tool, gint halfwidth, dummy; #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "path_tool_button_press\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_button_press\n"); +#endif /* Transform window-coordinates to canvas-coordinates */ gdisplay_untransform_coords_f (gdisp, bevent->x, bevent->y, &x, &y, TRUE); #ifdef PATH_TOOL_DEBUG - fprintf(stderr, "Clickcoordinates %.2f, %.2f\n",x,y); -#endif PATH_TOOL_DEBUG + g_printerr ("Clickcoordinates %.2f, %.2f\n",x,y); +#endif path_tool->click_x = x; path_tool->click_y = y; path_tool->click_modifier = bevent->state; @@ -354,15 +352,15 @@ gimp_path_tool_button_press_anchor (GimpPathTool *path_tool, gint grab_pointer; #ifdef PATH_TOOL_DEBUG - fprintf(stderr, "path_tool_button_press_anchor:\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_button_press_anchor:\n"); +#endif grab_pointer = 1; if (!cur_path) { #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Fatal error: No current Path\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Fatal error: No current Path\n"); +#endif return 0; } @@ -374,8 +372,8 @@ gimp_path_tool_button_press_anchor (GimpPathTool *path_tool, if (bevent->time - last_click_time < 250) { doubleclick=TRUE; #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Doppelclick!\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Doppelclick!\n"); +#endif } else doubleclick=FALSE; last_click_time = bevent->time; @@ -395,8 +393,8 @@ gimp_path_tool_button_press_anchor (GimpPathTool *path_tool, p_sas = path_tool->single_active_segment; #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "p_sas: %p\n", p_sas); -#endif PATH_TOOL_DEBUG + g_printerr ("p_sas: %p\n", p_sas); +#endif if (path_tool->click_modifier & GDK_SHIFT_MASK) { if (path_tool->active_count == 1 && p_sas && p_sas != path_tool->click_segment && @@ -477,15 +475,15 @@ gimp_path_tool_button_press_handle (GimpPathTool *path_tool, gint grab_pointer; #ifdef PATH_TOOL_DEBUG - fprintf(stderr, "path_tool_button_press_handle:\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_button_press_handle:\n"); +#endif grab_pointer = 1; if (!cur_path) { #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Fatal error: No current Path\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Fatal error: No current Path\n"); +#endif return 0; } @@ -497,8 +495,8 @@ gimp_path_tool_button_press_handle (GimpPathTool *path_tool, if (bevent->time - last_click_time < 250) { doubleclick=TRUE; #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Doppelclick!\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Doppelclick!\n"); +#endif } else doubleclick=FALSE; last_click_time = bevent->time; @@ -518,15 +516,15 @@ gimp_path_tool_button_press_canvas (GimpPathTool *path_tool, gint grab_pointer; #ifdef PATH_TOOL_DEBUG - fprintf(stderr, "path_tool_button_press_canvas:\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_button_press_canvas:\n"); +#endif grab_pointer = 1; if (!cur_path) { #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Fatal error: No current Path\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Fatal error: No current Path\n"); +#endif return 0; } @@ -571,15 +569,15 @@ gimp_path_tool_button_press_curve (GimpPathTool *path_tool, gint grab_pointer; #ifdef PATH_TOOL_DEBUG - fprintf(stderr, "path_tool_button_press_curve:\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_button_press_curve:\n"); +#endif grab_pointer = 1; if (!cur_path) { #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Fatal error: No current NPath\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Fatal error: No current NPath\n"); +#endif return 0; } @@ -611,8 +609,8 @@ gimp_path_tool_button_release (GimpTool *tool, GimpPathTool *path_tool = GIMP_PATH_TOOL (tool); #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "path_tool_button_release\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_button_release\n"); +#endif path_tool->state &= ~PATH_TOOL_DRAG; @@ -809,10 +807,9 @@ gimp_path_tool_cursor_update (GimpTool *tool, #if 0 gint x, y, halfwidth, dummy, cursor_location; -#idef PATH_TOOL_DEBUG - /* fprintf (stderr, "path_tool_cursor_update\n"); - */ -#edif PATH_TOOL_DEBUG +#ifdef PATH_TOOL_DEBUG + g_printerr ("path_tool_cursor_update\n"); +#endif gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y, TRUE, 0); /* get halfwidth in image coord */ diff --git a/app/tools/path_tool.c b/app/tools/path_tool.c index 3bd165dd85..4166f82f60 100644 --- a/app/tools/path_tool.c +++ b/app/tools/path_tool.c @@ -250,8 +250,8 @@ path_traverse_segment (NPath *path, gpointer data) { #ifdef PATH_TOOL_DEBUG - fprintf(stderr, "path_traverse_segment\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_traverse_segment\n"); +#endif /* XXX: here we need path_curve_get_point(s) */ @@ -276,8 +276,8 @@ path_add_curve (NPath * cur_path, PathCurve * new_curve = NULL; #ifdef PATH_TOOL_DEBUG - fprintf(stderr, "path_add_curve\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_add_curve\n"); +#endif if (cur_path) { new_curve = g_new (PathCurve, 1); @@ -296,8 +296,8 @@ path_add_curve (NPath * cur_path, } #ifdef PATH_TOOL_DEBUG else - fprintf (stderr, "Fatal Error: path_add_curve called without valid path\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Fatal Error: path_add_curve called without valid path\n"); +#endif return new_curve; } @@ -314,8 +314,8 @@ path_append_segment (NPath * cur_path, PathSegment * new_segment = NULL; #ifdef PATH_TOOL_DEBUG - fprintf(stderr, "path_append_segment\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_append_segment\n"); +#endif if (cur_curve) { tmp = cur_curve->segments; @@ -345,13 +345,13 @@ path_append_segment (NPath * cur_path, } #ifdef PATH_TOOL_DEBUG else - fprintf(stderr, "Fatal Error: path_append_segment called with a closed curve\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Fatal Error: path_append_segment called with a closed curve\n"); +#endif } #ifdef PATH_TOOL_DEBUG else - fprintf(stderr, "Fatal Error: path_append_segment called without valid curve\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Fatal Error: path_append_segment called without valid curve\n"); +#endif return new_segment; } @@ -368,8 +368,8 @@ path_prepend_segment (NPath * cur_path, PathSegment * new_segment = NULL; #ifdef PATH_TOOL_DEBUG - fprintf(stderr, "path_prepend_segment\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_prepend_segment\n"); +#endif if (cur_curve) { tmp = cur_curve->segments; @@ -396,13 +396,13 @@ path_prepend_segment (NPath * cur_path, } #ifdef PATH_TOOL_DEBUG else - fprintf(stderr, "Fatal Error: path_prepend_segment called with a closed curve\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Fatal Error: path_prepend_segment called with a closed curve\n"); +#endif } #ifdef PATH_TOOL_DEBUG else - fprintf(stderr, "Fatal Error: path_prepend_segment called without valid curve\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Fatal Error: path_prepend_segment called without valid curve\n"); +#endif return new_segment; } @@ -414,8 +414,8 @@ path_split_segment (PathSegment *segment, PathSegment * new_segment = NULL; #ifdef PATH_TOOL_DEBUG - fprintf(stderr, "path_split_segment\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_split_segment\n"); +#endif if (segment && segment->next) { new_segment = g_new (PathSegment, 1); @@ -437,8 +437,8 @@ path_split_segment (PathSegment *segment, } #ifdef PATH_TOOL_DEBUG else - fprintf(stderr, "path_split_segment without valid segment\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_split_segment without valid segment\n"); +#endif return NULL; } @@ -457,14 +457,14 @@ path_join_curves (PathSegment *segment1, if ((segment1->next && segment1->prev) || (segment2->next && segment2->prev)) { #ifdef PATH_TOOL_DEBUG - fprintf(stderr, "Fatal Error: path_join_curves called with a closed segment\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Fatal Error: path_join_curves called with a closed segment\n"); +#endif return; } if (segment1->parent == segment2->parent) { #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Joining beginning and end of the same curve...\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Joining beginning and end of the same curve...\n"); +#endif if (segment2->next == NULL) { segment2->next = segment1; segment1->prev = segment2; @@ -478,8 +478,8 @@ path_join_curves (PathSegment *segment1, if (segment1->next == NULL && segment2->next == NULL) { #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Flipping second curve (next, next)...\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Flipping second curve (next, next)...\n"); +#endif path_flip_curve (segment2->parent); /* segment2 = segment2->parent->segments; */ @@ -487,8 +487,8 @@ path_join_curves (PathSegment *segment1, if (segment1->prev == NULL && segment2->prev == NULL) { #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Flipping second curve (prev, prev)...\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Flipping second curve (prev, prev)...\n"); +#endif path_flip_curve (segment2->parent); /* segment2 = segment2->parent->segments; * while (segment2->next) @@ -498,8 +498,8 @@ path_join_curves (PathSegment *segment1, if (segment1->next == NULL && segment2->prev == NULL) { #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Appending second to first curve...\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Appending second to first curve...\n"); +#endif curve1 = segment1->parent; curve2 = segment2->parent; @@ -530,8 +530,8 @@ path_join_curves (PathSegment *segment1, if (segment1->prev == NULL && segment2->next == NULL) { #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Prepending second to first curve...\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Prepending second to first curve...\n"); +#endif curve1 = segment1->parent; curve2 = segment2->parent; @@ -559,9 +559,9 @@ path_join_curves (PathSegment *segment1, } #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Cant join these curves yet...\nThis should not happen."); + g_printerr ("Cant join these curves yet...\nThis should not happen."); return; -#endif PATH_TOOL_DEBUG +#endif } @@ -579,8 +579,8 @@ path_flip_curve (PathCurve *curve) if (!curve && !curve->segments) { #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "path_flip_curve: No curve o no segments to flip!\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_flip_curve: No curve o no segments to flip!\n"); +#endif return; } @@ -773,8 +773,8 @@ path_tool_button_press (Tool *tool, gint x, y, halfwidth, dummy; #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "path_tool_button_press\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_button_press\n"); +#endif path_tool = (PathTool *) tool->private; tool->gdisp = gdisp; @@ -782,8 +782,8 @@ path_tool_button_press (Tool *tool, /* Transform window-coordinates to canvas-coordinates */ gdisplay_untransform_coords (gdisp, bevent->x, bevent->y, &x, &y, TRUE, 0); #ifdef PATH_TOOL_DEBUG - fprintf(stderr, "Clickcoordinates %d, %d\n",x,y); -#endif PATH_TOOL_DEBUG + g_printerr ("Clickcoordinates %d, %d\n",x,y); +#endif path_tool->click_x = x; path_tool->click_y = y; path_tool->click_modifier = bevent->state; @@ -853,15 +853,15 @@ path_tool_button_press_anchor (Tool *tool, gint grab_pointer; #ifdef PATH_TOOL_DEBUG - fprintf(stderr, "path_tool_button_press_anchor:\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_button_press_anchor:\n"); +#endif grab_pointer = 1; if (!cur_path) { #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Fatal error: No current Path\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Fatal error: No current Path\n"); +#endif return 0; } @@ -873,8 +873,8 @@ path_tool_button_press_anchor (Tool *tool, if (bevent->time - last_click_time < 250) { doubleclick=TRUE; #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Doppelclick!\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Doppelclick!\n"); +#endif } else doubleclick=FALSE; last_click_time = bevent->time; @@ -894,8 +894,8 @@ path_tool_button_press_anchor (Tool *tool, p_sas = path_tool->single_active_segment; #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "p_sas: %p\n", p_sas); -#endif PATH_TOOL_DEBUG + g_printerr ("p_sas: %p\n", p_sas); +#endif if (path_tool->click_modifier & GDK_SHIFT_MASK) { if (path_tool->active_count == 1 && p_sas && p_sas != path_tool->click_segment && @@ -977,15 +977,15 @@ path_tool_button_press_handle (Tool *tool, gint grab_pointer; #ifdef PATH_TOOL_DEBUG - fprintf(stderr, "path_tool_button_press_handle:\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_button_press_handle:\n"); +#endif grab_pointer = 1; if (!cur_path) { #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Fatal error: No current Path\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Fatal error: No current Path\n"); +#endif return 0; } @@ -997,8 +997,8 @@ path_tool_button_press_handle (Tool *tool, if (bevent->time - last_click_time < 250) { doubleclick=TRUE; #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Doppelclick!\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Doppelclick!\n"); +#endif } else doubleclick=FALSE; last_click_time = bevent->time; @@ -1019,15 +1019,15 @@ path_tool_button_press_canvas (Tool *tool, gint grab_pointer; #ifdef PATH_TOOL_DEBUG - fprintf(stderr, "path_tool_button_press_canvas:\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_button_press_canvas:\n"); +#endif grab_pointer = 1; if (!cur_path) { #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Fatal error: No current Path\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Fatal error: No current Path\n"); +#endif return 0; } @@ -1074,15 +1074,15 @@ path_tool_button_press_curve (Tool *tool, gint grab_pointer; #ifdef PATH_TOOL_DEBUG - fprintf(stderr, "path_tool_button_press_curve:\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_button_press_curve:\n"); +#endif grab_pointer = 1; if (!cur_path) { #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Fatal error: No current NPath\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Fatal error: No current NPath\n"); +#endif return 0; } @@ -1113,8 +1113,8 @@ path_tool_button_release (Tool *tool, PathTool * path_tool; #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "path_tool_button_release\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_button_release\n"); +#endif path_tool = (PathTool *) tool->private; @@ -1325,9 +1325,9 @@ path_tool_cursor_update (Tool *tool, gint x, y, halfwidth, dummy, cursor_location; #ifdef PATH_TOOL_DEBUG - /* fprintf (stderr, "path_tool_cursor_update\n"); + /* g_printerr ("path_tool_cursor_update\n"); */ -#endif PATH_TOOL_DEBUG +#endif path_tool = (PathTool *) tool->private; @@ -1369,8 +1369,8 @@ path_tool_control (Tool *tool, PathTool * path_tool; #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "path_tool_control\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_control\n"); +#endif path_tool = (PathTool *) tool->private; @@ -1386,8 +1386,8 @@ path_tool_control (Tool *tool, case HALT: #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "path_tool_control: HALT\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_control: HALT\n"); +#endif draw_core_stop (path_tool->core, tool); tool->state = INACTIVE; break; @@ -1396,8 +1396,8 @@ path_tool_control (Tool *tool, break; } #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "path_tool_control: end\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_control: end\n"); +#endif } Tool * @@ -1460,8 +1460,8 @@ tools_free_path_tool (Tool *tool) PathTool * path_tool; #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "tools_free_path_tool start\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("tools_free_path_tool start\n"); +#endif path_tool = (PathTool *) tool->private; gdisp = tool->gdisp; @@ -1476,8 +1476,8 @@ tools_free_path_tool (Tool *tool) g_free (path_tool); #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "tools_free_path_tool end\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("tools_free_path_tool end\n"); +#endif } @@ -1848,8 +1848,8 @@ path_tool_draw_helper (NPath *path, if (!tool) { #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "Fatal Error: path_tool_draw_segment called without valid tool *\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("Fatal Error: path_tool_draw_segment called without valid tool *\n"); +#endif return; } @@ -1882,8 +1882,8 @@ path_tool_draw_helper (NPath *path, } #ifdef PATH_TOOL_DEBUG else if (!segment) - fprintf(stderr, "path_tool_draw_segment: no segment to draw\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_draw_segment: no segment to draw\n"); +#endif #endif } @@ -1896,8 +1896,8 @@ path_tool_draw (Tool *tool) PathTool * path_tool; #ifdef PATH_TOOL_DEBUG - fprintf (stderr, "path_tool_draw\n"); -#endif PATH_TOOL_DEBUG + g_printerr ("path_tool_draw\n"); +#endif gdisp = tool->gdisp; path_tool = tool->private; @@ -1906,9 +1906,9 @@ path_tool_draw (Tool *tool) path_traverse_path (cur_path, NULL, path_tool_draw_helper, NULL, tool); #ifdef PATH_TOOL_DEBUG - /* fprintf (stderr, "path_tool_draw end.\n"); + /* g_printerr ("path_tool_draw end.\n"); */ -#endif PATH_TOOL_DEBUG +#endif } #endif diff --git a/app/widgets/gimpcolordialog.c b/app/widgets/gimpcolordialog.c index 43652db0a3..dfc36cafed 100644 --- a/app/widgets/gimpcolordialog.c +++ b/app/widgets/gimpcolordialog.c @@ -1290,11 +1290,19 @@ color_history_write (FILE *fp) for (i = 0; i < COLOR_HISTORY_SIZE; i++) { - fprintf (fp, "\n (color-rgba %f %f %f %f)", - color_history[i].r, - color_history[i].g, - color_history[i].b, - color_history[i].a); + gchar buf[4][G_ASCII_DTOSTR_BUF_SIZE]; + + g_ascii_formatd (buf[0], + G_ASCII_DTOSTR_BUF_SIZE, "%f", color_history[i].r); + g_ascii_formatd (buf[1], + G_ASCII_DTOSTR_BUF_SIZE, "%f", color_history[i].g); + g_ascii_formatd (buf[2], + G_ASCII_DTOSTR_BUF_SIZE, "%f", color_history[i].b); + g_ascii_formatd (buf[3], + G_ASCII_DTOSTR_BUF_SIZE, "%f", color_history[i].a); + + fprintf (fp, "\n (color-rgba %s %s %s %s)", + buf[0], buf[1], buf[2], buf[3]); } fprintf (fp, ")\n\n"); diff --git a/app/widgets/gimpdeviceinfo.c b/app/widgets/gimpdeviceinfo.c index 3a50fbe72e..2bd0287dc0 100644 --- a/app/widgets/gimpdeviceinfo.c +++ b/app/widgets/gimpdeviceinfo.c @@ -665,16 +665,25 @@ devices_write_rc_device (DeviceInfo *device_info, { GimpRGB color; + gchar buf[3][G_ASCII_DTOSTR_BUF_SIZE]; gimp_context_get_foreground (device_info->context, &color); - fprintf (fp, "\n (foreground (color-rgb %f %f %f))", - color.r, color.g, color.b); + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.r); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.g); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.b); + + fprintf (fp, "\n (foreground (color-rgb %s %s %s))", + buf[0], buf[1], buf[2]); gimp_context_get_background (device_info->context, &color); - fprintf (fp, "\n (background (color-rgb %f %f %f))", - color.r, color.g, color.b); + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.r); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.g); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.b); + + fprintf (fp, "\n (background (color-rgb %s %s %s))", + buf[0], buf[1], buf[2]); } if (gimp_context_get_brush (device_info->context)) diff --git a/app/widgets/gimpdevices.c b/app/widgets/gimpdevices.c index 3a50fbe72e..2bd0287dc0 100644 --- a/app/widgets/gimpdevices.c +++ b/app/widgets/gimpdevices.c @@ -665,16 +665,25 @@ devices_write_rc_device (DeviceInfo *device_info, { GimpRGB color; + gchar buf[3][G_ASCII_DTOSTR_BUF_SIZE]; gimp_context_get_foreground (device_info->context, &color); - fprintf (fp, "\n (foreground (color-rgb %f %f %f))", - color.r, color.g, color.b); + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.r); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.g); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.b); + + fprintf (fp, "\n (foreground (color-rgb %s %s %s))", + buf[0], buf[1], buf[2]); gimp_context_get_background (device_info->context, &color); - fprintf (fp, "\n (background (color-rgb %f %f %f))", - color.r, color.g, color.b); + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.r); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.g); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", color.b); + + fprintf (fp, "\n (background (color-rgb %s %s %s))", + buf[0], buf[1], buf[2]); } if (gimp_context_get_brush (device_info->context)) diff --git a/app/widgets/gimpfontselection-dialog.c b/app/widgets/gimpfontselection-dialog.c index 53f4a3d1ec..90760256dc 100644 --- a/app/widgets/gimpfontselection-dialog.c +++ b/app/widgets/gimpfontselection-dialog.c @@ -279,8 +279,8 @@ gimp_font_selection_dialog_set_font_desc (GimpFontSelectionDialog *dialog, for (i = 0; i < dialog->n_families; i++) { - if (!g_strcasecmp (name, - pango_font_family_get_name (dialog->families[i]))) + if (!g_ascii_strcasecmp (name, + pango_font_family_get_name (dialog->families[i]))) { row = i; break; diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c index af412cf3c0..b2bb1291eb 100644 --- a/app/widgets/gimpwidgets-utils.c +++ b/app/widgets/gimpwidgets-utils.c @@ -21,7 +21,6 @@ #include "config.h" -#include #include #include @@ -77,7 +76,7 @@ gimp_message_box (gchar *message, if (g_list_length (message_boxes) > MESSAGE_BOX_MAXIMUM) { - fprintf (stderr, "%s: %s\n", prog_name, message); + g_printerr ("%s: %s\n", prog_name, message); return; } @@ -115,7 +114,7 @@ gimp_message_box (gchar *message, if (g_list_length (message_boxes) == MESSAGE_BOX_MAXIMUM) { - fprintf (stderr, "%s: %s\n", prog_name, message); + g_printerr ("%s: %s\n", prog_name, message); message = _("WARNING:\n" "Too many open message dialogs.\n" "Messages are redirected to stderr."); diff --git a/libgimp/gimpintl.h b/libgimp/gimpintl.h index b641286f92..7be40d3394 100644 --- a/libgimp/gimpintl.h +++ b/libgimp/gimpintl.h @@ -61,8 +61,7 @@ #endif #define INIT_LOCALE( domain ) G_STMT_START{ \ - gtk_set_locale (); \ - setlocale (LC_NUMERIC, "C"); \ + setlocale (LC_ALL, ""); \ bindtextdomain (domain, LOCALEDIR); \ bind_textdomain_codeset (domain, "UTF-8"); \ textdomain (domain); \ diff --git a/libgimp/stdplugins-intl.h b/libgimp/stdplugins-intl.h index c84e0eba2b..899badbbcf 100644 --- a/libgimp/stdplugins-intl.h +++ b/libgimp/stdplugins-intl.h @@ -26,18 +26,15 @@ #define INIT_I18N() G_STMT_START{ \ + setlocale (LC_ALL, ""); \ bindtextdomain(GETTEXT_PACKAGE"-libgimp", LOCALEDIR); \ bind_textdomain_codeset (GETTEXT_PACKAGE"-libgimp", "UTF-8"); \ bindtextdomain(GETTEXT_PACKAGE"-std-plugins", LOCALEDIR); \ bind_textdomain_codeset (GETTEXT_PACKAGE"-std-plugins", "UTF-8"); \ textdomain(GETTEXT_PACKAGE"-std-plugins"); \ - setlocale (LC_NUMERIC, "C"); \ }G_STMT_END -#define INIT_I18N_UI() G_STMT_START{ \ - gtk_set_locale(); \ - INIT_I18N(); \ -}G_STMT_END +#define INIT_I18N_UI() INIT_I18N() #endif /* __STDPLUGINS_INTL_H__ */ diff --git a/modules/colorsel_triangle.c b/modules/colorsel_triangle.c index 9296694d86..4379e62fac 100644 --- a/modules/colorsel_triangle.c +++ b/modules/colorsel_triangle.c @@ -22,6 +22,8 @@ #include "config.h" +#include + #include #include diff --git a/plug-ins/common/mpeg.c b/plug-ins/common/mpeg.c index c4542a456d..1c512dbba7 100644 --- a/plug-ins/common/mpeg.c +++ b/plug-ins/common/mpeg.c @@ -74,6 +74,7 @@ #include #include +#include #include #include diff --git a/plug-ins/gfig/gfig.c b/plug-ins/gfig/gfig.c index 94596fe98e..0b1eba99cc 100644 --- a/plug-ins/gfig/gfig.c +++ b/plug-ins/gfig/gfig.c @@ -1182,7 +1182,8 @@ gfig_load (const gchar *filename, gfig->draw_name = g_strdup (load_buf); get_line (load_buf, MAX_LOAD_LINE, fp, 0); - sscanf (load_buf, "Version: %f", &gfig->version); + if (strncmp (load_buf, "Version: ", 9) == 0) + gfig->version = g_ascii_strtod (load_buf + 9, NULL); get_line (load_buf, MAX_LOAD_LINE, fp, 0); sscanf (load_buf, "ObjCount: %d", &load_count); @@ -1448,7 +1449,8 @@ gfig_save_callbk (void) gint count = 0; gchar *savename; gchar *message; - gchar conv_buf[MAX_LOAD_LINE*3 +1]; + gchar buf[G_ASCII_DTOSTR_BUF_SIZE]; + gchar conv_buf[MAX_LOAD_LINE*3 +1]; savename = current_obj->filename; @@ -1477,7 +1479,8 @@ gfig_save_callbk (void) gfig_name_encode (conv_buf, current_obj->draw_name); fprintf (fp, "Name: %s\n", conv_buf); - fprintf (fp, "Version: %f\n", current_obj->version); + fprintf (fp, "Version: %s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", current_obj->version)); objs = current_obj->obj_list; count = gfig_obj_counts (objs); diff --git a/plug-ins/gflare/gflare.c b/plug-ins/gflare/gflare.c index 25c88e3958..dc24f2bc9a 100644 --- a/plug-ins/gflare/gflare.c +++ b/plug-ins/gflare/gflare.c @@ -1500,10 +1500,14 @@ gflare_read_int (gint *intvar, GFlareFile *gf) static void gflare_read_double (gdouble *dblvar, GFlareFile *gf) { + gchar buf[30]; + if (gf->error) return; - if (fscanf (gf->fp, "%le", dblvar) != 1) + if (fscanf (gf->fp, "%30s", buf) == 1) + *dblvar = g_ascii_strtod (buf, NULL); + else gf->error = TRUE; } @@ -1578,6 +1582,7 @@ gflare_save (GFlare *gflare) { FILE *fp; gchar *path; + gchar buf[3][G_ASCII_DTOSTR_BUF_SIZE]; static gboolean message_ok = FALSE; if (gflare->filename == NULL) @@ -1624,25 +1629,38 @@ gflare_save (GFlare *gflare) } fprintf (fp, "%s", GFLARE_FILE_HEADER); - fprintf (fp, "%f %s\n", gflare->glow_opacity, gflare_modes[gflare->glow_mode]); - fprintf (fp, "%f %s\n", gflare->rays_opacity, gflare_modes[gflare->rays_mode]); - fprintf (fp, "%f %s\n", gflare->sflare_opacity, gflare_modes[gflare->sflare_mode]); + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->glow_opacity); + fprintf (fp, "%s %s\n", buf[0], gflare_modes[gflare->glow_mode]); + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->rays_opacity); + fprintf (fp, "%s %s\n", buf[0], gflare_modes[gflare->rays_mode]); + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->sflare_opacity); + fprintf (fp, "%s %s\n", buf[0], gflare_modes[gflare->sflare_mode]); gflare_write_gradient_name (gflare->glow_radial, fp); gflare_write_gradient_name (gflare->glow_angular, fp); gflare_write_gradient_name (gflare->glow_angular_size, fp); - fprintf (fp, "%f %f %f\n", gflare->glow_size, gflare->glow_rotation, gflare->glow_hue); + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->glow_size); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->glow_rotation); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->glow_hue); + fprintf (fp, "%s %s %s\n", buf[0], buf[1], buf[2]); gflare_write_gradient_name (gflare->rays_radial, fp); gflare_write_gradient_name (gflare->rays_angular, fp); gflare_write_gradient_name (gflare->rays_angular_size, fp); - fprintf (fp, "%f %f %f\n", gflare->rays_size, gflare->rays_rotation, gflare->rays_hue); - fprintf (fp, "%d %f\n", gflare->rays_nspikes, gflare->rays_thickness); + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->rays_size); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->rays_rotation); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->rays_hue); + fprintf (fp, "%s %s %s\n", buf[0], buf[1], buf[2]); + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->rays_thickness); + fprintf (fp, "%d %s\n", gflare->rays_nspikes, buf[0]); gflare_write_gradient_name (gflare->sflare_radial, fp); gflare_write_gradient_name (gflare->sflare_sizefac, fp); gflare_write_gradient_name (gflare->sflare_probability, fp); - fprintf (fp, "%f %f %f\n", gflare->sflare_size, gflare->sflare_rotation, gflare->sflare_hue); + g_ascii_formatd (buf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->sflare_size); + g_ascii_formatd (buf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->sflare_rotation); + g_ascii_formatd (buf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", gflare->sflare_hue); + fprintf (fp, "%s %s %s\n", buf[0], buf[1], buf[2]); fprintf (fp, "%s %d %d\n", gflare_shapes[gflare->sflare_shape], gflare->sflare_nverts, gflare->sflare_seed_time ? -1 : gflare->sflare_seed); fclose (fp); diff --git a/plug-ins/gimpressionist/presets.c b/plug-ins/gimpressionist/presets.c index 7f3ad2f109..85739866e2 100644 --- a/plug-ins/gimpressionist/presets.c +++ b/plug-ins/gimpressionist/presets.c @@ -95,25 +95,25 @@ void setorientvector(char *str) n = atoi(tmps); if(!(tmps = strchr(tmps, ','))) return; - pcvals.orientvector[n].x = atof(++tmps); + pcvals.orientvector[n].x = g_ascii_strtod (++tmps, NULL); if(!(tmps = strchr(tmps, ','))) return; - pcvals.orientvector[n].y = atof(++tmps); + pcvals.orientvector[n].y = g_ascii_strtod (++tmps, NULL); if(!(tmps = strchr(tmps, ','))) return; - pcvals.orientvector[n].dir = atof(++tmps); + pcvals.orientvector[n].dir = g_ascii_strtod (++tmps, NULL); if(!(tmps = strchr(tmps, ','))) return; - pcvals.orientvector[n].dx = atof(++tmps); + pcvals.orientvector[n].dx = g_ascii_strtod (++tmps, NULL); if(!(tmps = strchr(tmps, ','))) return; - pcvals.orientvector[n].dy = atof(++tmps); + pcvals.orientvector[n].dy = g_ascii_strtod (++tmps, NULL); if(!(tmps = strchr(tmps, ','))) return; - pcvals.orientvector[n].str = atof(++tmps); + pcvals.orientvector[n].str = g_ascii_strtod (++tmps, NULL); if(!(tmps = strchr(tmps, ','))) return; - pcvals.orientvector[n].type = atoi(++tmps); + pcvals.orientvector[n].type = atoi (++tmps); } @@ -126,16 +126,16 @@ void setsizevector(char *str) n = atoi(tmps); if(!(tmps = strchr(tmps, ','))) return; - pcvals.sizevector[n].x = atof(++tmps); + pcvals.sizevector[n].x = g_ascii_strtod (++tmps, NULL); if(!(tmps = strchr(tmps, ','))) return; - pcvals.sizevector[n].y = atof(++tmps); + pcvals.sizevector[n].y = g_ascii_strtod (++tmps, NULL); if(!(tmps = strchr(tmps, ','))) return; - pcvals.sizevector[n].siz = atof(++tmps); + pcvals.sizevector[n].siz = g_ascii_strtod (++tmps, NULL); if(!(tmps = strchr(tmps, ','))) return; - pcvals.sizevector[n].str = atof(++tmps); + pcvals.sizevector[n].str = g_ascii_strtod (++tmps, NULL); } @@ -161,39 +161,39 @@ void setval(char *key, char *val) else if(!strcmp(key, "orientnum")) pcvals.orientnum = atoi(val); else if(!strcmp(key, "orientfirst")) - pcvals.orientfirst = atof(val); + pcvals.orientfirst = g_ascii_strtod (val, NULL); else if(!strcmp(key, "orientlast")) - pcvals.orientlast = atof(val); + pcvals.orientlast = g_ascii_strtod (val, NULL); else if(!strcmp(key, "orienttype")) pcvals.orienttype = atoi(val); else if(!strcmp(key, "sizenum")) pcvals.sizenum = atoi(val); else if(!strcmp(key, "sizefirst")) - pcvals.sizefirst = atof(val); + pcvals.sizefirst = g_ascii_strtod (val, NULL); else if(!strcmp(key, "sizelast")) - pcvals.sizelast = atof(val); + pcvals.sizelast = g_ascii_strtod (val, NULL); else if(!strcmp(key, "sizetype")) pcvals.sizetype = atoi(val); else if(!strcmp(key, "brushrelief")) - pcvals.brushrelief = atof(val); + pcvals.brushrelief = g_ascii_strtod (val, NULL); else if(!strcmp(key, "brushscale")) { /* For compatibility */ pcvals.sizenum = 1; - pcvals.sizefirst = pcvals.sizelast = atof(val); + pcvals.sizefirst = pcvals.sizelast = g_ascii_strtod (val, NULL); } else if(!strcmp(key, "brushdensity")) - pcvals.brushdensity = atof(val); + pcvals.brushdensity = g_ascii_strtod (val, NULL); else if(!strcmp(key, "brushgamma")) - pcvals.brushgamma = atof(val); + pcvals.brushgamma = g_ascii_strtod (val, NULL); else if(!strcmp(key, "brushaspect")) - pcvals.brushaspect = atof(val); + pcvals.brushaspect = g_ascii_strtod (val, NULL); else if(!strcmp(key, "generalbgtype")) pcvals.generalbgtype = atoi(val); else if(!strcmp(key, "generaldarkedge")) - pcvals.generaldarkedge = atof(val); + pcvals.generaldarkedge = g_ascii_strtod (val, NULL); else if(!strcmp(key, "generalpaintedges")) pcvals.generalpaintedges = atoi(val); else if(!strcmp(key, "generaltileable")) @@ -201,18 +201,18 @@ void setval(char *key, char *val) else if(!strcmp(key, "generaldropshadow")) pcvals.generaldropshadow = atoi(val); else if(!strcmp(key, "generalshadowdarkness")) - pcvals.generalshadowdarkness = atof(val); + pcvals.generalshadowdarkness = g_ascii_strtod (val, NULL); else if(!strcmp(key, "generalshadowdepth")) pcvals.generalshadowdepth = atoi(val); else if(!strcmp(key, "generalshadowblur")) pcvals.generalshadowblur = atoi(val); else if(!strcmp(key, "devthresh")) - pcvals.devthresh = atof(val); + pcvals.devthresh = g_ascii_strtod (val, NULL); else if(!strcmp(key, "paperrelief")) - pcvals.paperrelief = atof(val); + pcvals.paperrelief = g_ascii_strtod (val, NULL); else if(!strcmp(key, "paperscale")) - pcvals.paperscale = atof(val); + pcvals.paperscale = g_ascii_strtod (val, NULL); else if(!strcmp(key, "paperinvert")) pcvals.paperinvert = atoi(val); else if(!strcmp(key, "paperoverlay")) @@ -236,9 +236,9 @@ void setval(char *key, char *val) else if(!strcmp(key, "orientvector")) setorientvector(val); else if(!strcmp(key, "orientangoff")) - pcvals.orientangoff = atof(val); + pcvals.orientangoff = g_ascii_strtod (val, NULL); else if(!strcmp(key, "orientstrexp")) - pcvals.orientstrexp = atof(val); + pcvals.orientstrexp = g_ascii_strtod (val, NULL); else if(!strcmp(key, "orientvoronoi")) pcvals.orientvoronoi = atoi(val); @@ -247,14 +247,14 @@ void setval(char *key, char *val) else if(!strcmp(key, "sizevector")) setsizevector(val); else if(!strcmp(key, "sizestrexp")) - pcvals.sizestrexp = atof(val); + pcvals.sizestrexp = g_ascii_strtod (val, NULL); else if(!strcmp(key, "sizevoronoi")) pcvals.sizevoronoi = atoi(val); else if(!strcmp(key, "colortype")) pcvals.colortype = atoi(val); else if(!strcmp(key, "colornoise")) - pcvals.colornoise = atof(val); + pcvals.colornoise = g_ascii_strtod (val, NULL); } int loadpreset(char *fn) @@ -422,6 +422,8 @@ void savepreset(GtkWidget *wg, GtkWidget *p) static char fname[200]; FILE *f; GList *thispath; + gchar buf[G_ASCII_DTOSTR_BUF_SIZE]; + gchar vbuf[6][G_ASCII_DTOSTR_BUF_SIZE]; int i; l = gtk_entry_get_text(GTK_ENTRY(presetnameentry)); @@ -443,32 +445,45 @@ void savepreset(GtkWidget *wg, GtkWidget *p) fprintf(f, "%s\n", PRESETMAGIC); fprintf(f, "desc=%s\n", presetdesc); fprintf(f, "orientnum=%d\n", pcvals.orientnum); - fprintf(f, "orientfirst=%f\n", pcvals.orientfirst); - fprintf(f, "orientlast=%f\n", pcvals.orientlast); + fprintf(f, "orientfirst=%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientfirst)); + fprintf(f, "orientlast=%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientlast)); fprintf(f, "orienttype=%d\n", pcvals.orienttype); fprintf(f, "sizenum=%d\n", pcvals.sizenum); - fprintf(f, "sizefirst=%f\n", pcvals.sizefirst); - fprintf(f, "sizelast=%f\n", pcvals.sizelast); + fprintf(f, "sizefirst=%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.sizefirst)); + fprintf(f, "sizelast=%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.sizelast)); fprintf(f, "sizetype=%d\n", pcvals.sizetype); - fprintf(f, "brushrelief=%f\n", pcvals.brushrelief); - fprintf(f, "brushdensity=%f\n", pcvals.brushdensity); - fprintf(f, "brushgamma=%f\n", pcvals.brushgamma); - fprintf(f, "brushaspect=%f\n", pcvals.brushaspect); + fprintf(f, "brushrelief=%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.brushrelief)); + fprintf(f, "brushdensity=%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.brushdensity)); + fprintf(f, "brushgamma=%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.brushgamma)); + fprintf(f, "brushaspect=%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.brushaspect)); fprintf(f, "generalbgtype=%d\n", pcvals.generalbgtype); - fprintf(f, "generaldarkedge=%f\n", pcvals.generaldarkedge); + fprintf(f, "generaldarkedge=%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.generaldarkedge)); fprintf(f, "generalpaintedges=%d\n", pcvals.generalpaintedges); fprintf(f, "generaltileable=%d\n", pcvals.generaltileable); fprintf(f, "generaldropshadow=%d\n", pcvals.generaldropshadow); - fprintf(f, "generalshadowdarkness=%f\n", pcvals.generalshadowdarkness); + fprintf(f, "generalshadowdarkness=%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.generalshadowdarkness)); fprintf(f, "generalshadowdepth=%d\n", pcvals.generalshadowdepth); fprintf(f, "generalshadowblur=%d\n", pcvals.generalshadowblur); - fprintf(f, "devthresh=%f\n", pcvals.devthresh); + fprintf(f, "devthresh=%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.devthresh)); - fprintf(f, "paperrelief=%f\n", pcvals.paperrelief); - fprintf(f, "paperscale=%f\n", pcvals.paperscale); + fprintf(f, "paperrelief=%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.paperrelief)); + fprintf(f, "paperscale=%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.paperscale)); fprintf(f, "paperinvert=%d\n", pcvals.paperinvert); fprintf(f, "paperoverlay=%d\n", pcvals.paperoverlay); @@ -482,33 +497,43 @@ void savepreset(GtkWidget *wg, GtkWidget *p) fprintf(f, "placecenter=%d\n", pcvals.placecenter); fprintf(f, "numorientvector=%d\n", pcvals.numorientvector); - for(i = 0; i < pcvals.numorientvector; i++) { - fprintf(f, "orientvector=%d,%f,%f,%f,%f,%f,%f,%d\n", i, - pcvals.orientvector[i].x, - pcvals.orientvector[i].y, - pcvals.orientvector[i].dir, - pcvals.orientvector[i].dx, - pcvals.orientvector[i].dy, - pcvals.orientvector[i].str, - pcvals.orientvector[i].type); - } - fprintf(f, "orientangoff=%f\n", pcvals.orientangoff); - fprintf(f, "orientstrexp=%f\n", pcvals.orientstrexp); + for(i = 0; i < pcvals.numorientvector; i++) + { + g_ascii_formatd (vbuf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientvector[i].x); + g_ascii_formatd (vbuf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientvector[i].y); + g_ascii_formatd (vbuf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientvector[i].dir); + g_ascii_formatd (vbuf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientvector[i].dx); + g_ascii_formatd (vbuf[4], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientvector[i].dy); + g_ascii_formatd (vbuf[5], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientvector[i].str); + + fprintf (f, "orientvector=%d,%s,%s,%s,%s,%s,%s,%d\n", i, + vbuf[0], vbuf[1], vbuf[2], vbuf[3], vbuf[4], vbuf[5], + pcvals.orientvector[i].type); + } + + fprintf(f, "orientangoff=%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientangoff)); + fprintf(f, "orientstrexp=%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.orientstrexp)); fprintf(f, "orientvoronoi=%d\n", pcvals.orientvoronoi); fprintf(f, "numsizevector=%d\n", pcvals.numsizevector); - for(i = 0; i < pcvals.numsizevector; i++) { - fprintf(f, "sizevector=%d,%f,%f,%f,%f\n", i, - pcvals.sizevector[i].x, - pcvals.sizevector[i].y, - pcvals.sizevector[i].siz, - pcvals.sizevector[i].str); - } - fprintf(f, "sizestrexp=%f\n", pcvals.sizestrexp); + for (i = 0; i < pcvals.numsizevector; i++) + { + g_ascii_formatd (vbuf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.sizevector[i].x); + g_ascii_formatd (vbuf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.sizevector[i].y); + g_ascii_formatd (vbuf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.sizevector[i].siz); + g_ascii_formatd (vbuf[3], G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.sizevector[i].str); + fprintf (f, "sizevector=%d,%s,%s,%s,%s\n", i, + vbuf[0], vbuf[1], vbuf[2], vbuf[3]); + } + fprintf(f, "sizestrexp=%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.sizestrexp)); fprintf(f, "sizevoronoi=%d\n", pcvals.sizevoronoi); fprintf(f, "colortype=%d\n", pcvals.colortype); - fprintf(f, "colornoise=%f\n", pcvals.colornoise); + fprintf(f, "colornoise=%s\n", + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", pcvals.colornoise)); fclose(f); presetsrefresh(); diff --git a/plug-ins/ifscompose/ifscompose_storage.c b/plug-ins/ifscompose/ifscompose_storage.c index 5f0c8aa7c2..0e2be0623e 100644 --- a/plug-ins/ifscompose/ifscompose_storage.c +++ b/plug-ins/ifscompose/ifscompose_storage.c @@ -450,53 +450,77 @@ char * ifsvals_stringify (IfsComposeVals *vals, AffElement **elements) { gint i; + gchar buf[G_ASCII_DTOSTR_BUF_SIZE]; + gchar cbuf[3][G_ASCII_DTOSTR_BUF_SIZE]; GString *result = g_string_new (NULL); g_string_append_printf (result, "iterations %d\n", vals->iterations); g_string_append_printf (result, "max_memory %d\n", vals->max_memory); g_string_append_printf (result, "subdivide %d\n", vals->subdivide); - g_string_append_printf (result, "radius %f\n", vals->radius); - g_string_append_printf (result, "aspect_ratio %f\n", vals->aspect_ratio); - g_string_append_printf (result, "center_x %f\n", vals->center_x); - g_string_append_printf (result, "center_y %f\n", vals->center_y); + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", vals->radius); + g_string_append_printf (result, "radius %s\n", buf); + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", vals->aspect_ratio); + g_string_append_printf (result, "aspect_ratio %s\n", buf); + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", vals->center_x); + g_string_append_printf (result, "center_x %s\n", buf); + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", vals->center_y); + g_string_append_printf (result, "center_y %s\n", buf); for (i=0; inum_elements; i++) { g_string_append (result, "element {\n"); - g_string_append_printf (result, " x %f\n", elements[i]->v.x); - g_string_append_printf (result, " y %f\n", elements[i]->v.y); - g_string_append_printf (result, " theta %f\n", elements[i]->v.theta); - g_string_append_printf (result, " scale %f\n", elements[i]->v.scale); - g_string_append_printf (result, " asym %f\n", elements[i]->v.asym); - g_string_append_printf (result, " shear %f\n", elements[i]->v.shear); + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.x); + g_string_append_printf (result, " x %s\n", buf); + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.y); + g_string_append_printf (result, " y %s\n", buf); + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.theta); + g_string_append_printf (result, " theta %s\n", buf); + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.scale); + g_string_append_printf (result, " scale %s\n", buf); + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.asym); + g_string_append_printf (result, " asym %s\n", buf); + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.shear); + g_string_append_printf (result, " shear %s\n", buf); g_string_append_printf (result, " flip %d\n", elements[i]->v.flip); - g_string_append_printf (result, " red_color { %f,%f,%f }\n", - elements[i]->v.red_color.r, - elements[i]->v.red_color.g, - elements[i]->v.red_color.b); - g_string_append_printf (result, " green_color { %f,%f,%f }\n", - elements[i]->v.green_color.r, - elements[i]->v.green_color.g, - elements[i]->v.green_color.b); - g_string_append_printf (result, " blue_color { %f,%f,%f }\n", - elements[i]->v.blue_color.r, - elements[i]->v.blue_color.g, - elements[i]->v.blue_color.b); - g_string_append_printf (result, " black_color { %f,%f,%f }\n", - elements[i]->v.black_color.r, - elements[i]->v.black_color.g, - elements[i]->v.black_color.b); - g_string_append_printf (result, " target_color { %f,%f,%f }\n", - elements[i]->v.target_color.r, - elements[i]->v.target_color.g, - elements[i]->v.target_color.b); - g_string_append_printf (result, " hue_scale %f\n", - elements[i]->v.hue_scale); - g_string_append_printf (result, " value_scale %f\n", - elements[i]->v.value_scale); + + g_ascii_formatd (cbuf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.red_color.r); + g_ascii_formatd (cbuf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.red_color.g); + g_ascii_formatd (cbuf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.red_color.b); + g_string_append_printf (result, " red_color { %s,%s,%s }\n", + cbuf[0], cbuf[1], cbuf[2]); + + g_ascii_formatd (cbuf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.green_color.r); + g_ascii_formatd (cbuf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.green_color.g); + g_ascii_formatd (cbuf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.green_color.b); + g_string_append_printf (result, " green_color { %s,%s,%s }\n", + cbuf[0], cbuf[1], cbuf[2]); + + g_ascii_formatd (cbuf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.blue_color.r); + g_ascii_formatd (cbuf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.blue_color.g); + g_ascii_formatd (cbuf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.blue_color.b); + g_string_append_printf (result, " blue_color { %s,%s,%s }\n", + cbuf[0], cbuf[1], cbuf[2]); + + g_ascii_formatd (cbuf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.black_color.r); + g_ascii_formatd (cbuf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.black_color.g); + g_ascii_formatd (cbuf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.black_color.b); + g_string_append_printf (result, " black_color { %s,%s,%s }\n", + cbuf[0], cbuf[1], cbuf[2]); + + g_ascii_formatd (cbuf[0], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.target_color.r); + g_ascii_formatd (cbuf[1], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.target_color.g); + g_ascii_formatd (cbuf[2], G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.target_color.b); + g_string_append_printf (result, " target_color { %s,%s,%s }\n", + cbuf[0], cbuf[1], cbuf[2]); + + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.hue_scale); + g_string_append_printf (result, " hue_scale %s\n", buf); + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.value_scale); + g_string_append_printf (result, " value_scale %s\n", buf); g_string_append_printf (result, " simple_color %d\n", elements[i]->v.simple_color); - g_string_append_printf (result, " prob %f\n", elements[i]->v.prob); + g_ascii_formatd (buf, G_ASCII_DTOSTR_BUF_SIZE, "%f", elements[i]->v.prob); + g_string_append_printf (result, " prob %s\n", buf); g_string_append (result, "}\n"); } diff --git a/plug-ins/imagemap/imap_csim_parse.c b/plug-ins/imagemap/imap_csim_parse.c index ee0ed907b5..8cfd0ecec7 100644 --- a/plug-ins/imagemap/imap_csim_parse.c +++ b/plug-ins/imagemap/imap_csim_parse.c @@ -882,16 +882,16 @@ case 23: case 36: #line 159 "imap_csim.y" { - if (!g_strcasecmp(yyvsp[0].id, "RECT")) { + if (!g_ascii_strcasecmp(yyvsp[0].id, "RECT")) { current_object = create_rectangle(0, 0, 0, 0); current_type = RECTANGLE; - } else if (!g_strcasecmp(yyvsp[0].id, "CIRCLE")) { + } else if (!g_ascii_strcasecmp(yyvsp[0].id, "CIRCLE")) { current_object = create_circle(0, 0, 0); current_type = CIRCLE; - } else if (!g_strcasecmp(yyvsp[0].id, "POLY")) { + } else if (!g_ascii_strcasecmp(yyvsp[0].id, "POLY")) { current_object = create_polygon(NULL); current_type = POLYGON; - } else if (!g_strcasecmp(yyvsp[0].id, "DEFAULT")) { + } else if (!g_ascii_strcasecmp(yyvsp[0].id, "DEFAULT")) { current_type = UNDEFINED; } ; diff --git a/plug-ins/script-fu/script-fu-console.c b/plug-ins/script-fu/script-fu-console.c index 15c86a2352..b52a5578f6 100644 --- a/plug-ins/script-fu/script-fu-console.c +++ b/plug-ins/script-fu/script-fu-console.c @@ -165,8 +165,6 @@ script_fu_console_interface (void) GtkWidget *hbox; GIOChannel *input_channel; - INIT_I18N_UI(); - gimp_ui_init ("script-fu", FALSE); dialog = gimp_dialog_new (_("Script-Fu Console"), "script-fu-console", diff --git a/plug-ins/script-fu/script-fu-interface.c b/plug-ins/script-fu/script-fu-interface.c index a5f13cbc52..1081b0f3f1 100644 --- a/plug-ins/script-fu/script-fu-interface.c +++ b/plug-ins/script-fu/script-fu-interface.c @@ -1195,7 +1195,7 @@ script_fu_interface (SFScript *script) if (!gtk_initted) { - INIT_I18N_UI(); + INIT_I18N(); gimp_ui_init ("script-fu", TRUE); diff --git a/plug-ins/script-fu/script-fu-intl.h b/plug-ins/script-fu/script-fu-intl.h index 4b5bba1f75..0459f5b8b3 100644 --- a/plug-ins/script-fu/script-fu-intl.h +++ b/plug-ins/script-fu/script-fu-intl.h @@ -23,25 +23,11 @@ #include "libgimp/gimpintl.h" -#ifdef HAVE_LC_MESSAGES -#define INIT_I18N() G_STMT_START{ \ - setlocale(LC_MESSAGES, ""); \ - bindtextdomain(GETTEXT_PACKAGE"-libgimp", LOCALEDIR); \ - bindtextdomain(GETTEXT_PACKAGE"-script-fu", LOCALEDIR); \ - textdomain(GETTEXT_PACKAGE"-script-fu"); \ - }G_STMT_END -#else #define INIT_I18N() G_STMT_START{ \ + setlocale (LC_ALL, ""); \ bindtextdomain(GETTEXT_PACKAGE"-libgimp", LOCALEDIR); \ bindtextdomain(GETTEXT_PACKAGE"-script-fu", LOCALEDIR); \ textdomain(GETTEXT_PACKAGE"-script-fu"); \ - }G_STMT_END -#endif - -#define INIT_I18N_UI() G_STMT_START{ \ - gtk_set_locale(); \ - setlocale (LC_NUMERIC, "C"); \ - INIT_I18N(); \ - }G_STMT_END +}G_STMT_END #endif /* __SCRIPT_FU_INTL_H__ */ diff --git a/plug-ins/script-fu/script-fu-scripts.c b/plug-ins/script-fu/script-fu-scripts.c index a5f13cbc52..1081b0f3f1 100644 --- a/plug-ins/script-fu/script-fu-scripts.c +++ b/plug-ins/script-fu/script-fu-scripts.c @@ -1195,7 +1195,7 @@ script_fu_interface (SFScript *script) if (!gtk_initted) { - INIT_I18N_UI(); + INIT_I18N(); gimp_ui_init ("script-fu", TRUE); diff --git a/plug-ins/script-fu/script-fu-server.c b/plug-ins/script-fu/script-fu-server.c index c49e74bfcc..fa86a41e2f 100644 --- a/plug-ins/script-fu/script-fu-server.c +++ b/plug-ins/script-fu/script-fu-server.c @@ -544,7 +544,7 @@ server_interface (void) GtkWidget *dlg; GtkWidget *table; - INIT_I18N_UI(); + INIT_I18N(); gimp_ui_init ("script-fu", FALSE); diff --git a/plug-ins/script-fu/script-fu.c b/plug-ins/script-fu/script-fu.c index 671b6e43d4..762bab757d 100644 --- a/plug-ins/script-fu/script-fu.c +++ b/plug-ins/script-fu/script-fu.c @@ -180,6 +180,8 @@ script_fu_run (gchar *name, gint *nreturn_vals, GimpParam **return_vals) { + INIT_I18N(); + siod_set_output_file (stdout); /* Determine before we allow scripts to register themselves @@ -275,8 +277,6 @@ script_fu_auxillary_init (void) }; static gint nargs = sizeof (args) / sizeof (args[0]); - INIT_I18N_UI(); - gimp_install_temp_proc ("script_fu_refresh", _("Re-read all available scripts"), _("Re-read all available scripts"), diff --git a/tools/gimp-remote.c b/tools/gimp-remote.c index d3dbda8112..28715c6b16 100644 --- a/tools/gimp-remote.c +++ b/tools/gimp-remote.c @@ -319,7 +319,7 @@ main (gint argc, exit (-1); } - gimp_window = gdk_window_foreign_new (gimp_x_window); + gimp_window = gdk_window_foreign_new ((GdkNativeWindow) gimp_x_window); if (!gimp_window) { g_printerr ("Couldn't create gdk_window for gimp_x_window\n");