diff --git a/plug-ins/common/animation-play.c b/plug-ins/common/animation-play.c index 721ad02989..e2f72de6c5 100644 --- a/plug-ins/common/animation-play.c +++ b/plug-ins/common/animation-play.c @@ -192,15 +192,14 @@ run (const gchar *name, GimpRunMode run_mode; GimpPDBStatusType status = GIMP_PDB_SUCCESS; + INIT_I18N (); + gegl_init (NULL, NULL); + *nreturn_vals = 1; *return_vals = values; run_mode = param[0].data.d_int32; - INIT_I18N (); - - gegl_init (NULL, NULL); - if (run_mode == GIMP_RUN_NONINTERACTIVE && n_params != 3) { status = GIMP_PDB_CALLING_ERROR; diff --git a/plug-ins/common/file-aa.c b/plug-ins/common/file-aa.c index da741f34af..69316229c1 100644 --- a/plug-ins/common/file-aa.c +++ b/plug-ins/common/file-aa.c @@ -96,7 +96,7 @@ query (void) "Tim Newsome ", "1997", N_("ASCII art"), - "*", + "RGB*, GRAY*, INDEXED*", GIMP_PLUGIN, G_N_ELEMENTS (save_args), 0, save_args, NULL); @@ -144,29 +144,28 @@ run (const gchar *name, GimpExportReturn export = GIMP_EXPORT_CANCEL; INIT_I18N (); - gegl_init (NULL, NULL); - /* Set us up to return a status. */ *nreturn_vals = 1; *return_vals = values; + values[0].type = GIMP_PDB_STATUS; values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; + run_mode = param[0].data.d_int32; image_ID = param[1].data.d_int32; drawable_ID = param[2].data.d_int32; - /* eventually export the image */ switch (run_mode) { case GIMP_RUN_INTERACTIVE: case GIMP_RUN_WITH_LAST_VALS: gimp_ui_init (PLUG_IN_BINARY, FALSE); export = gimp_export_image (&image_ID, &drawable_ID, NULL, - (GIMP_EXPORT_CAN_HANDLE_RGB | - GIMP_EXPORT_CAN_HANDLE_GRAY | - GIMP_EXPORT_CAN_HANDLE_INDEXED | - GIMP_EXPORT_CAN_HANDLE_ALPHA )); + GIMP_EXPORT_CAN_HANDLE_RGB | + GIMP_EXPORT_CAN_HANDLE_GRAY | + GIMP_EXPORT_CAN_HANDLE_INDEXED | + GIMP_EXPORT_CAN_HANDLE_ALPHA); if (export == GIMP_EXPORT_CANCEL) { values[0].data.d_status = GIMP_PDB_CANCEL; diff --git a/plug-ins/common/file-gbr.c b/plug-ins/common/file-gbr.c index 11ac80cbc3..082056f5cf 100644 --- a/plug-ins/common/file-gbr.c +++ b/plug-ins/common/file-gbr.c @@ -151,7 +151,7 @@ query (void) "Tim Newsome, Jens Lautenbacher, Sven Neumann", "1997-2000", N_("GIMP brush"), - "*", + "RGB*, GRAY*, INDEXED*", GIMP_PLUGIN, G_N_ELEMENTS (save_args), 0, save_args, NULL); @@ -221,8 +221,9 @@ run (const gchar *name, case GIMP_RUN_WITH_LAST_VALS: gimp_ui_init (PLUG_IN_BINARY, FALSE); export = gimp_export_image (&image_ID, &drawable_ID, NULL, - GIMP_EXPORT_CAN_HANDLE_GRAY | - GIMP_EXPORT_CAN_HANDLE_RGB | + GIMP_EXPORT_CAN_HANDLE_GRAY | + GIMP_EXPORT_CAN_HANDLE_RGB | + GIMP_EXPORT_CAN_HANDLE_INDEXED | GIMP_EXPORT_CAN_HANDLE_ALPHA); if (export == GIMP_EXPORT_CANCEL) { diff --git a/plug-ins/common/file-gegl.c b/plug-ins/common/file-gegl.c index df325ff1d8..d7d350d605 100644 --- a/plug-ins/common/file-gegl.c +++ b/plug-ins/common/file-gegl.c @@ -196,15 +196,14 @@ run (const gchar *name, GError *error = NULL; gint i; - run_mode = param[0].data.d_int32; - INIT_I18N (); + gegl_init (NULL, NULL); + + run_mode = param[0].data.d_int32; *nreturn_vals = 1; *return_vals = values; - gegl_init (NULL, NULL); - values[0].type = GIMP_PDB_STATUS; values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; diff --git a/plug-ins/common/file-gif-load.c b/plug-ins/common/file-gif-load.c index 594da3af8c..cac01fe2c3 100644 --- a/plug-ins/common/file-gif-load.c +++ b/plug-ins/common/file-gif-load.c @@ -188,7 +188,6 @@ run (const gchar *name, gint32 image_ID; INIT_I18N (); - gegl_init (NULL, NULL); *nreturn_vals = 1; diff --git a/plug-ins/common/file-gif-save.c b/plug-ins/common/file-gif-save.c index b4b121667c..ae4f1e8bea 100644 --- a/plug-ins/common/file-gif-save.c +++ b/plug-ins/common/file-gif-save.c @@ -196,12 +196,11 @@ run (const gchar *name, GimpExportReturn export = GIMP_EXPORT_CANCEL; GError *error = NULL; - run_mode = param[0].data.d_int32; - INIT_I18N (); - gegl_init (NULL, NULL); + run_mode = param[0].data.d_int32; + *nreturn_vals = 1; *return_vals = values; diff --git a/plug-ins/common/file-html-table.c b/plug-ins/common/file-html-table.c index fa0331c8f5..b0da3f4982 100644 --- a/plug-ins/common/file-html-table.c +++ b/plug-ins/common/file-html-table.c @@ -222,19 +222,17 @@ save_image (const gchar *filename, GeglBuffer *buffer, GError **error) { - const Babl *format = babl_format ("R'G'B'A u8"); - gint row, col, cols, rows, x, y; - gint colcount, colspan, rowspan; - gint *palloc; - guchar *buf, *buf2; - gchar *width, *height; - FILE *fp; + const Babl *format = babl_format ("R'G'B'A u8"); + gint row, col, cols, rows, x, y; + gint colcount, colspan, rowspan; + gint *palloc; + guchar *buf, *buf2; + gchar *width, *height; + FILE *fp; cols = gegl_buffer_get_width (buffer); rows = gegl_buffer_get_height (buffer); - palloc = g_new (int, rows * cols); - fp = g_fopen (filename, "w"); if (! fp) @@ -242,10 +240,11 @@ save_image (const gchar *filename, g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno), _("Could not open '%s' for writing: %s"), gimp_filename_to_utf8 (filename), g_strerror (errno)); - g_free (palloc); return FALSE; } + palloc = g_new (int, rows * cols); + if (gtmvals.fulldoc) { fprintf (fp, "\n%s\n\n", diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c index dfe60cee12..d19f63fa78 100644 --- a/plug-ins/common/file-png.c +++ b/plug-ins/common/file-png.c @@ -407,12 +407,11 @@ run (const gchar *name, GError *error = NULL; INIT_I18N (); + gegl_init (NULL, NULL); *nreturn_vals = 1; *return_vals = values; - gegl_init (NULL, NULL); - values[0].type = GIMP_PDB_STATUS; values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; diff --git a/plug-ins/common/file-tiff-load.c b/plug-ins/common/file-tiff-load.c index aba52f2ac2..b4f3f378b8 100644 --- a/plug-ins/common/file-tiff-load.c +++ b/plug-ins/common/file-tiff-load.c @@ -110,7 +110,7 @@ static void run (const gchar *name, static gboolean load_dialog (TIFF *tif, TiffSelectedPages *pages); - + static gint32 load_image (const gchar *filename, TIFF *tif, TiffSelectedPages *pages, @@ -210,15 +210,14 @@ run (const gchar *name, gint32 image; TiffSelectedPages pages; - run_mode = param[0].data.d_int32; - INIT_I18N (); + gegl_init (NULL, NULL); + + run_mode = param[0].data.d_int32; *nreturn_vals = 1; *return_vals = values; - gegl_init (NULL, NULL); - values[0].type = GIMP_PDB_STATUS; values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; diff --git a/plug-ins/common/goat-exercise.c b/plug-ins/common/goat-exercise.c index ada7facb81..c3f631b5d6 100644 --- a/plug-ins/common/goat-exercise.c +++ b/plug-ins/common/goat-exercise.c @@ -85,16 +85,15 @@ run (const gchar *name, gint32 drawable_id; gint x, y, width, height; + INIT_I18N(); + gegl_init (NULL, NULL); + *nreturn_vals = 1; *return_vals = values; - gegl_init (NULL, NULL); - values[0].type = GIMP_PDB_STATUS; values[0].data.d_status = status; - INIT_I18N(); - drawable_id = param[2].data.d_drawable; if (gimp_drawable_mask_intersect (drawable_id, &x, &y, &width, &height)) diff --git a/plug-ins/common/screenshot.c b/plug-ins/common/screenshot.c index 44a14fa716..103c694ed6 100644 --- a/plug-ins/common/screenshot.c +++ b/plug-ins/common/screenshot.c @@ -288,23 +288,22 @@ run (const gchar *name, gint *nreturn_vals, GimpParam **return_vals) { - GimpRunMode run_mode = param[0].data.d_int32; + static GimpParam values[2]; GimpPDBStatusType status = GIMP_PDB_SUCCESS; + GimpRunMode run_mode; GdkScreen *screen = NULL; gint32 image_ID; - static GimpParam values[2]; + INIT_I18N (); + gegl_init (NULL, NULL); - /* initialize the return of the status */ - values[0].type = GIMP_PDB_STATUS; - values[0].data.d_status = status; + run_mode = param[0].data.d_int32; *nreturn_vals = 1; *return_vals = values; - INIT_I18N (); - - gegl_init (NULL, NULL); + values[0].type = GIMP_PDB_STATUS; + values[0].data.d_status = status; /* how are we running today? */ switch (run_mode) diff --git a/plug-ins/file-bmp/bmp.c b/plug-ins/file-bmp/bmp.c index 98c129bc5f..a1eb21de64 100644 --- a/plug-ins/file-bmp/bmp.c +++ b/plug-ins/file-bmp/bmp.c @@ -164,14 +164,14 @@ run (const gchar *name, GimpExportReturn export = GIMP_EXPORT_CANCEL; GError *error = NULL; - run_mode = param[0].data.d_int32; - + INIT_I18N (); gegl_init (NULL, NULL); - INIT_I18N (); + run_mode = param[0].data.d_int32; *nreturn_vals = 1; *return_vals = values; + values[0].type = GIMP_PDB_STATUS; values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; diff --git a/plug-ins/file-faxg3/faxg3.c b/plug-ins/file-faxg3/faxg3.c index 61d5d5c826..8c7e929b35 100644 --- a/plug-ins/file-faxg3/faxg3.c +++ b/plug-ins/file-faxg3/faxg3.c @@ -126,6 +126,7 @@ run (const gchar *name, gint32 image_ID; GError *error = NULL; + INIT_I18N (); gegl_init (NULL, NULL); *nreturn_vals = 1; @@ -136,8 +137,6 @@ run (const gchar *name, if (strcmp (name, LOAD_PROC) == 0) { - INIT_I18N (); - image_ID = load_image (param[1].data.d_string, &error); if (image_ID != -1) diff --git a/plug-ins/file-sgi/sgi.c b/plug-ins/file-sgi/sgi.c index f852e4c8b3..d69b948f0a 100644 --- a/plug-ins/file-sgi/sgi.c +++ b/plug-ins/file-sgi/sgi.c @@ -139,7 +139,7 @@ query (void) "Copyright 1997-1998 by Michael Sweet", PLUG_IN_VERSION, N_("Silicon Graphics IRIS image"), - "*", + "RGB*, GRAY*, INDEXED*", GIMP_PLUGIN, G_N_ELEMENTS (save_args), 0, @@ -165,17 +165,17 @@ run (const gchar *name, GimpExportReturn export = GIMP_EXPORT_CANCEL; GError *error = NULL; + INIT_I18N (); + gegl_init (NULL, NULL); + run_mode = param[0].data.d_int32; *nreturn_vals = 1; *return_vals = values; + values[0].type = GIMP_PDB_STATUS; values[0].data.d_status = GIMP_PDB_EXECUTION_ERROR; - INIT_I18N (); - - gegl_init (NULL, NULL); - if (strcmp (name, LOAD_PROC) == 0) { image_ID = load_image (param[1].data.d_string, &error); @@ -203,10 +203,10 @@ run (const gchar *name, case GIMP_RUN_WITH_LAST_VALS: gimp_ui_init (PLUG_IN_BINARY, FALSE); export = gimp_export_image (&image_ID, &drawable_ID, NULL, - (GIMP_EXPORT_CAN_HANDLE_RGB | - GIMP_EXPORT_CAN_HANDLE_GRAY | - GIMP_EXPORT_CAN_HANDLE_INDEXED | - GIMP_EXPORT_CAN_HANDLE_ALPHA)); + GIMP_EXPORT_CAN_HANDLE_RGB | + GIMP_EXPORT_CAN_HANDLE_GRAY | + GIMP_EXPORT_CAN_HANDLE_INDEXED | + GIMP_EXPORT_CAN_HANDLE_ALPHA); if (export == GIMP_EXPORT_CANCEL) { values[0].data.d_status = GIMP_PDB_CANCEL; @@ -546,20 +546,24 @@ save_image (const gchar *filename, zsize = 1; format = babl_format ("Y' u8"); break; + case GIMP_GRAYA_IMAGE: zsize = 2; format = babl_format ("Y'A u8"); break; + case GIMP_RGB_IMAGE: case GIMP_INDEXED_IMAGE: zsize = 3; format = babl_format ("R'G'B' u8"); break; + case GIMP_RGBA_IMAGE: case GIMP_INDEXEDA_IMAGE: format = babl_format ("R'G'B'A u8"); zsize = 4; break; + default: return FALSE; } diff --git a/plug-ins/print/print.c b/plug-ins/print/print.c index 6d12942904..4362b4622d 100644 --- a/plug-ins/print/print.c +++ b/plug-ins/print/print.c @@ -152,12 +152,11 @@ run (const gchar *name, gint32 image_ID; GError *error = NULL; - run_mode = param[0].data.d_int32; - INIT_I18N (); - gegl_init (NULL, NULL); + run_mode = param[0].data.d_int32; + *nreturn_vals = 1; *return_vals = values;