[gimp] plug-ins: cleanup in the recently GEGL-ported plug-ins
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: cleanup in the recently GEGL-ported plug-ins
- Date: Tue, 27 Nov 2012 19:59:12 +0000 (UTC)
commit 67dda14e7784063cb24440135a22504420f76a0b
Author: Michael Natterer <mitch gimp org>
Date: Tue Nov 27 20:58:05 2012 +0100
plug-ins: cleanup in the recently GEGL-ported plug-ins
Mostly formatting consistency paranoia.
plug-ins/common/animation-play.c | 7 +++----
plug-ins/common/file-aa.c | 15 +++++++--------
plug-ins/common/file-gbr.c | 7 ++++---
plug-ins/common/file-gegl.c | 7 +++----
plug-ins/common/file-gif-load.c | 1 -
plug-ins/common/file-gif-save.c | 5 ++---
plug-ins/common/file-html-table.c | 19 +++++++++----------
plug-ins/common/file-png.c | 3 +--
plug-ins/common/file-tiff-load.c | 9 ++++-----
plug-ins/common/goat-exercise.c | 7 +++----
plug-ins/common/screenshot.c | 15 +++++++--------
plug-ins/file-bmp/bmp.c | 6 +++---
plug-ins/file-faxg3/faxg3.c | 3 +--
plug-ins/file-sgi/sgi.c | 22 +++++++++++++---------
plug-ins/print/print.c | 5 ++---
15 files changed, 62 insertions(+), 69 deletions(-)
---
diff --git a/plug-ins/common/animation-play.c b/plug-ins/common/animation-play.c
index 721ad02..e2f72de 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 da741f3..6931622 100644
--- a/plug-ins/common/file-aa.c
+++ b/plug-ins/common/file-aa.c
@@ -96,7 +96,7 @@ query (void)
"Tim Newsome <nuisance cmu edu>",
"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 11ac80c..082056f 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 df325ff..d7d350d 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 594da3a..cac01fe 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 b4b1216..ae4f1e8 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 fa0331c..b0da3f4 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, "<HTML>\n<HEAD><TITLE>%s</TITLE></HEAD>\n<BODY>\n",
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index dfe60ce..d19f63f 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 aba52f2..b4f3f37 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 ada7fac..c3f631b 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 44a14fa..103c694 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 98c129b..a1eb21d 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 61d5d5c..8c7e929 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 f852e4c..d69b948 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 6d12942..4362b46 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]