gimp r26965 - in trunk: . plug-ins/common



Author: mitch
Date: Wed Sep 17 08:37:24 2008
New Revision: 26965
URL: http://svn.gnome.org/viewvc/gimp?rev=26965&view=rev

Log:
2008-09-17  Michael Natterer  <mitch gimp org>

	* plug-ins/common/file-header.c
	* plug-ins/common/file-psp.c
	* plug-ins/common/file-xbm.c
	* plug-ins/common/file-xpm.c
	* plug-ins/common/hot.c
	* plug-ins/common/mail.c: add const plus misc. cleanups.



Modified:
   trunk/ChangeLog
   trunk/plug-ins/common/file-header.c
   trunk/plug-ins/common/file-psp.c
   trunk/plug-ins/common/file-xbm.c
   trunk/plug-ins/common/file-xpm.c
   trunk/plug-ins/common/hot.c
   trunk/plug-ins/common/mail.c

Modified: trunk/plug-ins/common/file-header.c
==============================================================================
--- trunk/plug-ins/common/file-header.c	(original)
+++ trunk/plug-ins/common/file-header.c	Wed Sep 17 08:37:24 2008
@@ -34,15 +34,15 @@
 
 /* Declare some local functions.
  */
-static void   query      (void);
-static void   run        (const gchar      *name,
-                          gint              nparams,
-                          const GimpParam  *param,
-                          gint             *nreturn_vals,
-                          GimpParam       **return_vals);
-static gint   save_image (const gchar      *filename,
-			  gint32            image_ID,
-			  gint32            drawable_ID);
+static void       query      (void);
+static void       run        (const gchar      *name,
+                              gint              nparams,
+                              const GimpParam  *param,
+                              gint             *nreturn_vals,
+                              GimpParam       **return_vals);
+static gboolean   save_image (const gchar      *filename,
+                              gint32            image_ID,
+                              gint32            drawable_ID);
 
 
 const GimpPlugInInfo PLUG_IN_INFO =
@@ -94,9 +94,6 @@
   static GimpParam  values[2];
   GimpRunMode       run_mode;
   GimpPDBStatusType status = GIMP_PDB_SUCCESS;
-  gint32            image_ID;
-  gint32            drawable_ID;
-  GimpExportReturn  export = GIMP_EXPORT_CANCEL;
 
   run_mode = param[0].data.d_int32;
 
@@ -109,6 +106,10 @@
 
   if (strcmp (name, SAVE_PROC) == 0)
     {
+      gint32           image_ID;
+      gint32           drawable_ID;
+      GimpExportReturn export = GIMP_EXPORT_CANCEL;
+
       image_ID    = param[1].data.d_int32;
       drawable_ID = param[2].data.d_int32;
 
@@ -127,6 +128,7 @@
 	      return;
 	    }
 	  break;
+
 	default:
 	  break;
 	}
@@ -147,7 +149,7 @@
   values[0].data.d_status = status;
 }
 
-static int
+static gboolean
 save_image (const gchar *filename,
 	    gint32       image_ID,
 	    gint32       drawable_ID)
@@ -155,16 +157,16 @@
   GimpPixelRgn   pixel_rgn;
   GimpDrawable  *drawable;
   GimpImageType  drawable_type;
-  FILE *fp;
-  gint x, y, b, c;
-  gchar *backslash = "\\\\";
-  gchar *quote = "\\\"";
-  gchar *newline = "\"\n\t\"";
-  gchar buf[4];
-  guchar *d = NULL;
-  guchar *data;
-  guchar *cmap;
-  gint colors;
+  FILE          *fp;
+  gint           x, y, b, c;
+  const gchar   *backslash = "\\\\";
+  const gchar   *quote     = "\\\"";
+  const gchar   *newline   = "\"\n\t\"";
+  gchar          buf[4];
+  guchar        *d         = NULL;
+  guchar        *data;
+  guchar        *cmap;
+  gint           colors;
 
   if ((fp = g_fopen (filename, "w")) == NULL)
     return FALSE;
@@ -179,10 +181,16 @@
   fprintf (fp, "static unsigned int width = %d;\n", drawable->width);
   fprintf (fp, "static unsigned int height = %d;\n\n", drawable->height);
   fprintf (fp, "/*  Call this macro repeatedly.  After each use, the pixel data can be extracted  */\n\n");
+
   switch (drawable_type)
     {
     case GIMP_RGB_IMAGE:
-      fprintf (fp, "#define HEADER_PIXEL(data,pixel) {\\\n  pixel[0] = (((data[0] - 33) << 2) | ((data[1] - 33) >> 4)); \\\n  pixel[1] = ((((data[1] - 33) & 0xF) << 4) | ((data[2] - 33) >> 2)); \\\n  pixel[2] = ((((data[2] - 33) & 0x3) << 6) | ((data[3] - 33))); \\\n  data += 4; \\\n}\n");
+      fprintf (fp,
+               "#define HEADER_PIXEL(data,pixel) {\\\n"
+               "pixel[0] = (((data[0] - 33) << 2) | ((data[1] - 33) >> 4)); \\\n"
+               "pixel[1] = ((((data[1] - 33) & 0xF) << 4) | ((data[2] - 33) >> 2)); \\\n"
+               "pixel[2] = ((((data[2] - 33) & 0x3) << 6) | ((data[3] - 33))); \\\n"
+               "data += 4; \\\n}\n");
       fprintf (fp, "static char *header_data =\n\t\"");
 
       data = g_new (guchar, drawable->width * drawable->bpp);
@@ -191,6 +199,7 @@
       for (y = 0; y < drawable->height; y++)
 	{
 	  gimp_pixel_rgn_get_row (&pixel_rgn, data, 0, y, drawable->width);
+
 	  for (x = 0; x < drawable->width; x++)
 	    {
 	      d = data + x * drawable->bpp;
@@ -201,12 +210,14 @@
 	      buf[3] = (d[2] & 0x3F) + 33;
 
 	      for (b = 0; b < 4; b++)
-		if (buf[b] == '"')
-		  fwrite (quote, 1, 2, fp);
-		else if (buf[b] == '\\')
-		  fwrite (backslash, 1, 2, fp);
-		else
-		  fwrite (buf + b, 1, 1, fp);
+                {
+                  if (buf[b] == '"')
+                    fwrite (quote, 1, 2, fp);
+                  else if (buf[b] == '\\')
+                    fwrite (backslash, 1, 2, fp);
+                  else
+                    fwrite (buf + b, 1, 1, fp);
+                }
 
 	      c++;
 	      if (c >= 16)
@@ -216,24 +227,33 @@
 		}
 	    }
 	}
+
       fprintf (fp, "\";\n");
       break;
 
     case GIMP_INDEXED_IMAGE:
-      fprintf (fp, "#define HEADER_PIXEL(data,pixel) {\\\n  pixel[0] = header_data_cmap[(unsigned char)data[0]][0]; \\\n  pixel[1] = header_data_cmap[(unsigned char)data[0]][1]; \\\n  pixel[2] = header_data_cmap[(unsigned char)data[0]][2]; \\\n  data ++; }\n\n");
+      fprintf (fp,
+               "#define HEADER_PIXEL(data,pixel) {\\\n"
+               "pixel[0] = header_data_cmap[(unsigned char)data[0]][0]; \\\n"
+               "pixel[1] = header_data_cmap[(unsigned char)data[0]][1]; \\\n"
+               "pixel[2] = header_data_cmap[(unsigned char)data[0]][2]; \\\n"
+               "data ++; }\n\n");
       /* save colormap */
       cmap = gimp_image_get_colormap (image_ID, &colors);
 
       fprintf (fp, "static char header_data_cmap[256][3] = {");
-      fprintf(fp, "\n\t{%3d,%3d,%3d}", (int)cmap[0], (int)cmap[1], (int)cmap[2]);
+      fprintf (fp, "\n\t{%3d,%3d,%3d}", (int)cmap[0], (int)cmap[1], (int)cmap[2]);
+
       for (c = 1; c < colors; c++)
-        fprintf(fp, ",\n\t{%3d,%3d,%3d}", (int)cmap[3*c], (int)cmap[3*c+1], (int)cmap[3*c+2]);
+        fprintf (fp, ",\n\t{%3d,%3d,%3d}", (int)cmap[3*c], (int)cmap[3*c+1], (int)cmap[3*c+2]);
+
       /* fill the rest */
       for ( ; c < 256; c++)
-        fprintf(fp, ",\n\t{255,255,255}");
+        fprintf (fp, ",\n\t{255,255,255}");
+
       /* close bracket */
-      fprintf(fp, "\n\t};\n");
-      g_free(cmap);
+      fprintf (fp, "\n\t};\n");
+      g_free (cmap);
 
       /* save image */
       fprintf (fp, "static char header_data[] = {\n\t");
@@ -244,11 +264,12 @@
       for (y = 0; y < drawable->height; y++)
         {
           gimp_pixel_rgn_get_row (&pixel_rgn, data, 0, y, drawable->width);
+
           for (x = 0; x < drawable->width-1; x++)
 	    {
 	      d = data + x * drawable->bpp;
 
-              fprintf(fp, "%d,", (int)d[0]);
+              fprintf (fp, "%d,", (int)d[0]);
 
 	      c++;
 	      if (c >= 16)
@@ -259,17 +280,19 @@
 	    }
 
           if (y != drawable->height - 1)
-            fprintf(fp, "%d,\n\t", (int)d[1]);
+            fprintf (fp, "%d,\n\t", (int)d[1]);
           else
-            fprintf(fp, "%d\n\t", (int)d[1]);
+            fprintf (fp, "%d\n\t", (int)d[1]);
+
           c = 0; /* reset line counter */
         }
       fprintf (fp, "};\n");
       break;
+
     default:
       g_warning ("unhandled drawable type (%d)", drawable_type);
       return FALSE;
-    } /* switch (drawable_type) */
+    }
 
   fclose (fp);
 

Modified: trunk/plug-ins/common/file-psp.c
==============================================================================
--- trunk/plug-ins/common/file-psp.c	(original)
+++ trunk/plug-ins/common/file-psp.c	Wed Sep 17 08:37:24 2008
@@ -681,10 +681,10 @@
 /* This helper method is used to get the name of the block for the known block
  * types. The enum PSPBlockID must cover the input values.
  */
-static gchar *
+static const gchar *
 block_name (gint id)
 {
-  static gchar *block_names[] =
+  static const gchar *block_names[] =
   {
     "IMAGE",
     "CREATOR",
@@ -859,8 +859,8 @@
                           guint     total_len,
                           PSPimage *ia)
 {
-  long data_start;
-  guchar buf[4];
+  long    data_start;
+  guchar  buf[4];
   guint16 keyword;
   guint32 length;
 
@@ -894,15 +894,15 @@
                     guint     total_len,
                     PSPimage *ia)
 {
-  long data_start;
-  guchar buf[4];
-  guint16 keyword;
-  guint32 length;
-  gchar *string;
-  gchar *title = NULL, *artist = NULL, *copyright = NULL, *description = NULL;
-  guint32 dword;
-  guint32 cdate = 0, mdate = 0, appid, appver;
-  GString *comment;
+  long          data_start;
+  guchar        buf[4];
+  guint16       keyword;
+  guint32       length;
+  gchar        *string;
+  gchar        *title = NULL, *artist = NULL, *copyright = NULL, *description = NULL;
+  guint32       dword;
+  guint32       cdate = 0, mdate = 0, appid, appver;
+  GString      *comment;
   GimpParasite *comment_parasite;
 
   data_start = ftell (f);
@@ -1082,10 +1082,10 @@
   return -1;
 }
 
-static gchar *
+static const gchar *
 blend_mode_name (PSPBlendModes mode)
 {
-  static gchar *blend_mode_names[] =
+  static const gchar *blend_mode_names[] =
   {
     "NORMAL",
     "DARKEN",
@@ -1117,10 +1117,10 @@
   return err_name;
 }
 
-static gchar *
+static const gchar *
 bitmap_type_name (gint type)
 {
-  static gchar *bitmap_type_names[] =
+  static const gchar *bitmap_type_names[] =
   {
     "IMAGE",
     "TRANS_MASK",
@@ -1140,10 +1140,10 @@
   return err_name;
 }
 
-static gchar *
+static const gchar *
 channel_type_name (gint type)
 {
-  static char *channel_type_names[] =
+  static const gchar *channel_type_names[] =
   {
     "COMPOSITE",
     "RED",
@@ -1638,14 +1638,14 @@
                  guint     total_len,
                  PSPimage *ia)
 {
-  guint16 version;
-  guchar name[514];
-  guint32 step_size, column_count, row_count, cell_count;
-  guint32 placement_mode, selection_mode;
-  gint i;
-  GimpPixPipeParams params;
-  GimpParasite *pipe_parasite;
-  gchar *parasite_text;
+  guint16            version;
+  guchar             name[514];
+  guint32            step_size, column_count, row_count, cell_count;
+  guint32            placement_mode, selection_mode;
+  gint               i;
+  GimpPixPipeParams  params;
+  GimpParasite      *pipe_parasite;
+  gchar             *parasite_text;
 
   gimp_pixpipe_params_init (&params);
 
@@ -1707,7 +1707,7 @@
   return 0;
 }
 
-static gchar *
+static const gchar *
 compression_name (gint compression)
 {
   switch (compression)

Modified: trunk/plug-ins/common/file-xbm.c
==============================================================================
--- trunk/plug-ins/common/file-xbm.c	(original)
+++ trunk/plug-ins/common/file-xbm.c	Wed Sep 17 08:37:24 2008
@@ -93,32 +93,32 @@
 
 /* Declare some local functions.
  */
-static void   query   (void);
-static void   run     (const gchar      *name,
-		       gint              nparams,
-		       const GimpParam  *param,
-		       gint             *nreturn_vals,
-		       GimpParam       **return_vals);
-
-static gint32    load_image              (const gchar  *filename,
-                                          GError      **error);
-static gint      save_image              (const gchar  *filename,
-                                          const gchar  *prefix,
-                                          const gchar  *comment,
-                                          gboolean      save_mask,
-                                          gint32        image_ID,
-                                          gint32        drawable_ID,
-                                          GError      **error);
-static gboolean  save_dialog             (gint32        drawable_ID);
+static void      query                   (void);
+static void      run                     (const gchar      *name,
+                                          gint              nparams,
+                                          const GimpParam  *param,
+                                          gint             *nreturn_vals,
+                                          GimpParam       **return_vals);
+
+static gint32    load_image              (const gchar      *filename,
+                                          GError          **error);
+static gint      save_image              (const gchar      *filename,
+                                          const gchar      *prefix,
+                                          const gchar      *comment,
+                                          gboolean          save_mask,
+                                          gint32            image_ID,
+                                          gint32            drawable_ID,
+                                          GError          **error);
+static gboolean  save_dialog             (gint32            drawable_ID);
 #if 0
 /* DISABLED - see http://bugzilla.gnome.org/show_bug.cgi?id=82763 */
-static void      comment_entry_callback  (GtkWidget    *widget,
-                                          gpointer      data);
+static void      comment_entry_callback  (GtkWidget        *widget,
+                                          gpointer          data);
 #endif
-static void      prefix_entry_callback   (GtkWidget    *widget,
-                                          gpointer      data);
-static void      mask_ext_entry_callback (GtkWidget    *widget,
-                                          gpointer      data);
+static void      prefix_entry_callback   (GtkWidget        *widget,
+                                          gpointer          data);
+static void      mask_ext_entry_callback (GtkWidget        *widget,
+                                          gpointer          data);
 
 
 const GimpPlugInInfo PLUG_IN_INFO =
@@ -629,8 +629,8 @@
 
 /* Match a string with a file. */
 static gint
-match (FILE  *fp,
-       gchar *s)
+match (FILE        *fp,
+       const gchar *s)
 {
   gint c;
 
@@ -704,25 +704,24 @@
 }
 
 
-static gint
+static gint32
 load_image (const gchar  *filename,
             GError      **error)
 {
   GimpPixelRgn  pixel_rgn;
   GimpDrawable *drawable;
-
-  FILE   *fp;
-  gint32  image_ID;
-  gint32  layer_ID;
-  guchar *data;
-  gint    intbits;
-  gint    width = 0;
-  gint    height = 0;
-  gint    x_hot = 0;
-  gint    y_hot = 0;
-  gint    c, i, j, k;
-  gint    tileheight, rowoffset;
-  gchar  *comment;
+  FILE         *fp;
+  gint32        image_ID;
+  gint32        layer_ID;
+  guchar       *data;
+  gint          intbits;
+  gint          width  = 0;
+  gint          height = 0;
+  gint          x_hot  = 0;
+  gint          y_hot  = 0;
+  gint          c, i, j, k;
+  gint          tileheight, rowoffset;
+  gchar        *comment;
 
   const guchar cmap[] =
   {
@@ -970,15 +969,15 @@
   GimpPixelRgn  pixel_rgn;
   FILE         *fp;
 
-  gint width, height, colors, dark;
-  gint intbits, lineints, need_comma, nints, rowoffset, tileheight;
-  gint c, i, j, k, thisbit;
+  gint          width, height, colors, dark;
+  gint          intbits, lineints, need_comma, nints, rowoffset, tileheight;
+  gint          c, i, j, k, thisbit;
 
-  gboolean has_alpha;
-  gint     bpp;
+  gboolean      has_alpha;
+  gint          bpp;
 
-  guchar *data, *cmap;
-  gchar  *intfmt;
+  guchar       *data, *cmap;
+  const gchar  *intfmt;
 
 #if 0
   if (save_mask)

Modified: trunk/plug-ins/common/file-xpm.c
==============================================================================
--- trunk/plug-ins/common/file-xpm.c	(original)
+++ trunk/plug-ins/common/file-xpm.c	Wed Sep 17 08:37:24 2008
@@ -570,7 +570,9 @@
     {
       array[index].g_color = NULL;
       array[index].c_color = colorstring;
-    } else {
+    }
+  else
+    {
       array[index].c_color = NULL;
       array[index].g_color = colorstring;
     }

Modified: trunk/plug-ins/common/hot.c
==============================================================================
--- trunk/plug-ins/common/hot.c	(original)
+++ trunk/plug-ins/common/hot.c	Wed Sep 17 08:37:24 2008
@@ -142,19 +142,19 @@
 static glong	ichroma_lim2;        /* chroma limit squared (scaled integer) */
 static gint	icompos_lim;         /* composite amplitude limit (scaled integer) */
 
-static void query        (void);
-static void run          (const gchar      *name,
-			  gint              nparam,
-			  const GimpParam  *param,
-			  gint             *nretvals,
-			  GimpParam       **retvals);
-
-static gint pluginCore   (piArgs   *argp);
-static gint pluginCoreIA (piArgs   *argp);
-static gboolean hotp     (guint8  r,
-			  guint8  g,
-			  guint8  b);
-static void build_tab    (gint    m);
+static void       query         (void);
+static void       run           (const gchar      *name,
+                                 gint              nparam,
+                                 const GimpParam  *param,
+                                 gint             *nretvals,
+                                 GimpParam       **retvals);
+
+static gboolean   pluginCore    (piArgs           *argp);
+static gboolean   plugin_dialog (piArgs           *argp);
+static gboolean   hotp          (guint8            r,
+                                 guint8            g,
+                                 guint8            b);
+static void       build_tab     (gint              m);
 
 /*
  * gc: apply the gamma correction specified for this video standard.
@@ -164,8 +164,8 @@
  * Future standards may use more complex functions.
  * (e.g. SMPTE 240M's "electro-optic transfer characteristic").
  */
-#define gc(x,m) pow(x, 1.0 / mode[m].gamma)
-#define inv_gc(x,m) pow(x, mode[m].gamma)
+#define gc(x,m)     pow(x, 1.0 / mode[m].gamma)
+#define inv_gc(x,m) pow(x,       mode[m].gamma)
 
 /*
  * pix_decode: decode an integer pixel value into a floating-point
@@ -231,14 +231,14 @@
      GimpParam       **retvals)
 {
   static GimpParam rvals[1];
-  piArgs    args;
+  piArgs           args;
 
   *nretvals = 1;
   *retvals  = rvals;
 
   INIT_I18N ();
 
-  memset (&args, (int) 0, sizeof (args));
+  memset (&args, 0, sizeof (args));
   args.mode = -1;
 
   gimp_get_data (PLUG_IN_PROC, &args);
@@ -260,12 +260,19 @@
 	  args.new_layerp = 1;
 	}
 
-      if (pluginCoreIA(&args) == -1)
+      if (plugin_dialog (&args))
 	{
-	  rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
+          if (! pluginCore (&args))
+            {
+              rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
+            }
 	}
-      gimp_set_data (PLUG_IN_PROC, &args, sizeof (args));
+      else
+        {
+          rvals[0].data.d_status = GIMP_PDB_CANCEL;
+        }
 
+      gimp_set_data (PLUG_IN_PROC, &args, sizeof (args));
     break;
 
     case GIMP_RUN_NONINTERACTIVE:
@@ -279,7 +286,7 @@
       args.action     = param[4].data.d_int32;
       args.new_layerp = param[5].data.d_int32;
 
-      if (pluginCore(&args) == -1)
+      if (! pluginCore (&args))
 	{
 	  rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
 	  break;
@@ -288,7 +295,7 @@
 
     case GIMP_RUN_WITH_LAST_VALS:
       /* XXX: add code here for last-values running */
-      if (pluginCore (&args) == -1)
+      if (! pluginCore (&args))
 	{
 	  rvals[0].data.d_status = GIMP_PDB_EXECUTION_ERROR;
 	}
@@ -296,40 +303,41 @@
   }
 }
 
-static gint
+static gboolean
 pluginCore (piArgs *argp)
 {
-  GimpDrawable *drw, *ndrw=NULL;
-  GimpPixelRgn srcPr, dstPr;
-  gint retval = 0;
-  gint nl=0;
-  gint y, x, i;
-  gint Y, I, Q;
-  guint width, height, bpp;
-  gint sel_x1, sel_x2, sel_y1, sel_y2;
-  gint prog_interval;
-  guchar *src, *s, *dst, *d;
-  guchar r, prev_r=0, new_r=0;
-  guchar g, prev_g=0, new_g=0;
-  guchar b, prev_b=0, new_b=0;
-  gdouble fy, fc, t, scale;
-  gdouble pr, pg, pb;
-  gdouble py;
+  GimpDrawable *drw, *ndrw = NULL;
+  GimpPixelRgn  srcPr, dstPr;
+  gboolean      success = TRUE;
+  gint          nl      = 0;
+  gint          y, i;
+  gint          Y, I, Q;
+  guint         width, height, bpp;
+  gint          sel_x1, sel_x2, sel_y1, sel_y2;
+  gint          prog_interval;
+  guchar       *src, *s, *dst, *d;
+  guchar        r, prev_r=0, new_r=0;
+  guchar        g, prev_g=0, new_g=0;
+  guchar        b, prev_b=0, new_b=0;
+  gdouble       fy, fc, t, scale;
+  gdouble       pr, pg, pb;
+  gdouble       py;
 
   drw = gimp_drawable_get (argp->drawable);
 
-  width = drw->width;
+  width  = drw->width;
   height = drw->height;
-  bpp = drw->bpp;
+  bpp    = drw->bpp;
+
   if (argp->new_layerp)
     {
-      gchar name[40];
-      gchar *mode_names[] =
+      gchar        name[40];
+      const gchar *mode_names[] =
       {
 	"ntsc",
 	"pal",
       };
-      gchar *action_names[] =
+      const gchar *action_names[] =
       {
 	"lum redux",
 	"sat redux",
@@ -350,7 +358,7 @@
   gimp_drawable_mask_bounds (drw->drawable_id,
 			     &sel_x1, &sel_y1, &sel_x2, &sel_y2);
 
-  width = sel_x2 - sel_x1;
+  width  = sel_x2 - sel_x1;
   height = sel_y2 - sel_y1;
 
   src = g_new (guchar, width * height * bpp);
@@ -381,6 +389,8 @@
 
   for (y = sel_y1; y < sel_y2; y++)
     {
+      gint x;
+
       if (y % prog_interval == 0)
 	gimp_progress_update ((double) y / (double) (sel_y2 - sel_y1));
 
@@ -497,9 +507,11 @@
 			  pr = gc (pr, argp->mode);
 			  pg = gc (pg, argp->mode);
 			  pb = gc (pb, argp->mode);
-			  py = pr * mode[argp->mode].code[0][0] + pg *
-			    mode[argp->mode].code[0][1] + pb *
-			    mode[argp->mode].code[0][2];
+
+			  py = pr * mode[argp->mode].code[0][0] +
+                               pg * mode[argp->mode].code[0][1] +
+                               pb * mode[argp->mode].code[0][2];
+
 			  r = pix_encode (inv_gc (py + scale * (pr - py),
 						  argp->mode));
 			  g = pix_encode (inv_gc (py + scale * (pg - py),
@@ -507,10 +519,13 @@
 			  b = pix_encode (inv_gc (py + scale * (pb - py),
 						  argp->mode));
 			}
+
 		      *d++ = new_r = r;
 		      *d++ = new_g = g;
 		      *d++ = new_b = b;
+
 		      s += 3;
+
 		      if (bpp == 4)
 			*d++ = *s++;
 		      else if (argp->new_layerp)
@@ -533,6 +548,7 @@
 	    }
 	}
     }
+
   gimp_pixel_rgn_set_rect (&dstPr, dst, sel_x1, sel_y1, width, height);
 
   g_free (src);
@@ -552,11 +568,11 @@
 
   gimp_displays_flush ();
 
-  return retval;
+  return success;
 }
 
-static gint
-pluginCoreIA (piArgs *argp)
+static gboolean
+plugin_dialog (piArgs *argp)
 {
   GtkWidget *dlg;
   GtkWidget *hbox;
@@ -632,10 +648,7 @@
 
   gtk_widget_destroy (dlg);
 
-  if (run)
-    return pluginCore (argp);
-  else
-    return -1;
+  return run;
 }
 
 /*

Modified: trunk/plug-ins/common/mail.c
==============================================================================
--- trunk/plug-ins/common/mail.c	(original)
+++ trunk/plug-ins/common/mail.c	Wed Sep 17 08:37:24 2008
@@ -122,32 +122,32 @@
 } m_info;
 
 
-static void   query (void);
-static void   run   (const gchar      *name,
-		     gint              nparams,
-		     const GimpParam  *param,
-		     gint             *nreturn_vals,
-		     GimpParam       **return_vals);
-
-static GimpPDBStatusType  save_image   (const gchar *filename,
-                                        gint32       image_ID,
-                                        gint32       drawable_ID,
-                                        gint32       run_mode);
-
-static gboolean   save_dialog          (void);
-static void       mail_entry_callback  (GtkWidget     *widget,
-                                        gchar         *data);
-static void       mesg_body_callback   (GtkTextBuffer *buffer,
-                                        gpointer       data);
-
-static gboolean   valid_file     (const gchar  *filename);
-static void       create_headers (FILE         *mailpipe);
-static gchar    * find_extension (const gchar  *filename);
-static gboolean   to64           (const gchar  *filename,
-                                  FILE         *outfile,
-                                  GError      **error);
-static FILE     * sendmail_pipe  (gchar       **cmd,
-                                  GPid         *pid);
+static void               query                (void);
+static void               run                  (const gchar      *name,
+                                                gint              nparams,
+                                                const GimpParam  *param,
+                                                gint             *nreturn_vals,
+                                                GimpParam       **return_vals);
+
+static GimpPDBStatusType  save_image           (const gchar      *filename,
+                                                gint32            image_ID,
+                                                gint32            drawable_ID,
+                                                gint32            run_mode);
+
+static gboolean           save_dialog          (void);
+static void               mail_entry_callback  (GtkWidget        *widget,
+                                                gchar            *data);
+static void               mesg_body_callback   (GtkTextBuffer    *buffer,
+                                                gpointer          data);
+
+static gboolean           valid_file           (const gchar      *filename);
+static void               create_headers       (FILE             *mailpipe);
+static gchar            * find_extension       (const gchar      *filename);
+static gboolean           to64                 (const gchar      *filename,
+                                                FILE             *outfile,
+                                                GError          **error);
+static FILE             * sendmail_pipe        (gchar           **cmd,
+                                                GPid             *pid);
 
 
 const GimpPlugInInfo PLUG_IN_INFO =



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