[gimp] plug-ins: various small cleanups in the plug-ins that use metadata



commit ac9101691c0caeb411373f07015b5b3373c4d55b
Author: Michael Natterer <mitch gimp org>
Date:   Thu Jun 5 21:33:40 2014 +0200

    plug-ins: various small cleanups in the plug-ins that use metadata

 plug-ins/common/file-png.c       |   33 +++++++++++++++------------------
 plug-ins/common/file-tiff-load.c |    2 +-
 plug-ins/common/file-tiff-save.c |    4 ----
 plug-ins/file-jpeg/jpeg.c        |   23 +++++++++++++----------
 4 files changed, 29 insertions(+), 33 deletions(-)
---
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index 2698b50..82637aa 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -417,8 +417,6 @@ run (const gchar      *name,
   GimpPDBStatusType status = GIMP_PDB_SUCCESS;
   gint32            image_ID;
   gint32            drawable_ID;
-  gint32            orig_image_ID;
-  GimpExportReturn  export = GIMP_EXPORT_CANCEL;
   GError           *error  = NULL;
 
   run_mode = param[0].data.d_int32;
@@ -479,7 +477,7 @@ run (const gchar      *name,
           g_object_unref (file);
 
           *nreturn_vals = 2;
-          values[1].type = GIMP_PDB_IMAGE;
+          values[1].type         = GIMP_PDB_IMAGE;
           values[1].data.d_image = image_ID;
         }
       else
@@ -493,12 +491,15 @@ run (const gchar      *name,
     {
       GimpMetadata          *metadata;
       GimpMetadataSaveFlags  metadata_flags;
+      gint32                 orig_image_ID;
+      GimpExportReturn       export = GIMP_EXPORT_CANCEL;
       gboolean               alpha;
 
-      image_ID    = orig_image_ID = param[1].data.d_int32;
+      image_ID    = param[1].data.d_int32;
       drawable_ID = param[2].data.d_int32;
 
-      /*  eventually export the image */
+      orig_image_ID = image_ID;
+
       switch (run_mode)
         {
         case GIMP_RUN_INTERACTIVE:
@@ -518,6 +519,7 @@ run (const gchar      *name,
               return;
             }
           break;
+
         default:
           break;
         }
@@ -536,23 +538,19 @@ run (const gchar      *name,
       switch (run_mode)
         {
         case GIMP_RUN_INTERACTIVE:
-          /*
-           * Possibly retrieve data...
-           */
+          /* possibly retrieve data */
           gimp_get_data (SAVE_PROC, &pngvals);
 
           alpha = gimp_drawable_has_alpha (drawable_ID);
 
-          /*
-           * If the image has no transparency, then there is usually
+          /* If the image has no transparency, then there is usually
            * no need to save a bKGD chunk.  For more information, see:
            * http://bugzilla.gnome.org/show_bug.cgi?id=92395
            */
           if (! alpha)
             pngvals.bkgd = FALSE;
 
-          /*
-           * Then acquire information with a dialog...
+          /* Then acquire information with a dialog...
            */
           if (! save_dialog (orig_image_ID, alpha))
             status = GIMP_PDB_CANCEL;
@@ -599,9 +597,7 @@ run (const gchar      *name,
           break;
 
         case GIMP_RUN_WITH_LAST_VALS:
-          /*
-           * Possibly retrieve data...
-           */
+          /* possibly retrieve data */
           gimp_get_data (SAVE_PROC, &pngvals);
           break;
 
@@ -739,7 +735,8 @@ struct read_error_data
 };
 
 static void
-on_read_error (png_structp png_ptr, png_const_charp error_msg)
+on_read_error (png_structp     png_ptr,
+               png_const_charp error_msg)
 {
   struct read_error_data *error_data = png_get_error_ptr (png_ptr);
   gint                    begin;
@@ -1596,7 +1593,7 @@ save_image (const gchar  *filename,
   if (pngvals.bkgd)
     {
       GimpRGB color;
-      guchar red, green, blue;
+      guchar  red, green, blue;
 
       gimp_context_get_background (&color);
       gimp_rgb_get_uchar (&color, &red, &green, &blue);
@@ -1689,7 +1686,7 @@ save_image (const gchar  *filename,
   if (pngvals.comment)
     {
       GimpParasite *parasite;
-      gsize text_length = 0;
+      gsize         text_length = 0;
 
       parasite = gimp_image_get_parasite (orig_image_ID, "gimp-comment");
       if (parasite)
diff --git a/plug-ins/common/file-tiff-load.c b/plug-ins/common/file-tiff-load.c
index b30ee77..5b74d95 100644
--- a/plug-ins/common/file-tiff-load.c
+++ b/plug-ins/common/file-tiff-load.c
@@ -208,7 +208,6 @@ run (const gchar      *name,
   static GimpParam   values[2];
   GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
   GError            *error  = NULL;
-  gint32             image;
   TiffSelectedPages  pages;
 
   INIT_I18N ();
@@ -272,6 +271,7 @@ run (const gchar      *name,
 
               if (run_it)
                 {
+                  gint32   image;
                   gboolean resolution_loaded = FALSE;
 
                   gimp_set_data (LOAD_PROC, &target, sizeof (target));
diff --git a/plug-ins/common/file-tiff-save.c b/plug-ins/common/file-tiff-save.c
index f88d102..66c9848 100644
--- a/plug-ins/common/file-tiff-save.c
+++ b/plug-ins/common/file-tiff-save.c
@@ -256,10 +256,6 @@ run (const gchar      *name,
       gint32                 orig_image = image;
       GimpExportReturn       export     = GIMP_EXPORT_CANCEL;
 
-      /* Do this right this time, if POSSIBLE query for parasites, otherwise
-         or if there isn't one, choose the default comment from the gimprc. */
-
-      /*  eventually export the image */
       switch (run_mode)
         {
         case GIMP_RUN_INTERACTIVE:
diff --git a/plug-ins/file-jpeg/jpeg.c b/plug-ins/file-jpeg/jpeg.c
index 0a2fa34..ef2c15c 100644
--- a/plug-ins/file-jpeg/jpeg.c
+++ b/plug-ins/file-jpeg/jpeg.c
@@ -174,9 +174,7 @@ run (const gchar      *name,
   GimpPDBStatusType  status = GIMP_PDB_SUCCESS;
   gint32             image_ID;
   gint32             drawable_ID;
-  gint32             orig_image_ID;
   GimpParasite      *parasite;
-  GimpExportReturn   export = GIMP_EXPORT_CANCEL;
   GError            *error  = NULL;
 
   run_mode = param[0].data.d_int32;
@@ -247,7 +245,6 @@ run (const gchar      *name,
         {
           status = GIMP_PDB_EXECUTION_ERROR;
         }
-
     }
   else if (strcmp (name, LOAD_THUMB_PROC) == 0)
     {
@@ -257,10 +254,10 @@ run (const gchar      *name,
         }
       else
         {
-          GFile        *file     = g_file_new_for_path (param[0].data.d_string);
-          gint          width    = 0;
-          gint          height   = 0;
-          GimpImageType type     = -1;
+          GFile        *file   = g_file_new_for_path (param[0].data.d_string);
+          gint          width  = 0;
+          gint          height = 0;
+          GimpImageType type   = -1;
 
           image_ID = load_thumbnail_image (file, &width, &height, &type,
                                            &error);
@@ -291,11 +288,14 @@ run (const gchar      *name,
     {
       GimpMetadata          *metadata;
       GimpMetadataSaveFlags  metadata_flags;
+      gint32                 orig_image_ID;
+      GimpExportReturn       export = GIMP_EXPORT_CANCEL;
 
-      image_ID = orig_image_ID = param[1].data.d_int32;
+      image_ID    = param[1].data.d_int32;
       drawable_ID = param[2].data.d_int32;
 
-       /*  eventually export the image */
+      orig_image_ID = image_ID;
+
       switch (run_mode)
         {
         case GIMP_RUN_INTERACTIVE:
@@ -321,14 +321,17 @@ run (const gchar      *name,
                 display_ID = -1;
               }
               break;
+
             case GIMP_EXPORT_IGNORE:
               break;
+
             case GIMP_EXPORT_CANCEL:
               values[0].data.d_status = GIMP_PDB_CANCEL;
               return;
               break;
             }
           break;
+
         default:
           break;
         }
@@ -504,7 +507,7 @@ run (const gchar      *name,
             gimp_display_delete (display_ID);
           else
             gimp_image_delete (image_ID);
-       }
+        }
 
       if (status == GIMP_PDB_SUCCESS)
         {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]