--- gimp-1.3.14.orig/plug-ins/common/noisify.c	2003-04-12 00:16:57.000000000 +0200
+++ gimp-1.3.14/plug-ins/common/noisify.c	2003-04-27 12:18:38.000000000 +0200
@@ -52,13 +52,13 @@
 typedef struct
 {
   gint    independent;
-  gdouble noise[4];     /*  per channel  */
+  gdouble noise[3];     /*  per channel  */
 } NoisifyVals;
 
 typedef struct
 {
   gint       channels;
-  GtkObject *channel_adj[4];
+  GtkObject *channel_adj[3];
   gint       run;
 } NoisifyInterface;
 
@@ -93,13 +93,13 @@
 static NoisifyVals nvals =
 {
   TRUE,
-  { 0.20, 0.20, 0.20, 0.20 }
+  { 0.20, 0.20, 0.20 }
 };
 
 static NoisifyInterface noise_int =
 {
   0,
-  { NULL, NULL, NULL, NULL },
+  { NULL, NULL, NULL },
   FALSE     /* run */
 };
 
@@ -120,7 +120,6 @@
     { GIMP_PDB_FLOAT, "noise_1", "Noise in the first channel (red, gray)" },
     { GIMP_PDB_FLOAT, "noise_2", "Noise in the second channel (green, gray_alpha)" },
     { GIMP_PDB_FLOAT, "noise_3", "Noise in the third channel (blue)" },
-    { GIMP_PDB_FLOAT, "noise_4", "Noise in the fourth channel (alpha)" }
   };
 
   gimp_install_procedure ("plug_in_noisify",
@@ -186,7 +185,6 @@
 	  nvals.noise[0]    = param[4].data.d_float;
 	  nvals.noise[1]    = param[5].data.d_float;
 	  nvals.noise[2]    = param[6].data.d_float;
-	  nvals.noise[3]    = param[7].data.d_float;
 	}
       break;
 
@@ -233,10 +231,11 @@
 {
   GRand *gr = (GRand*) data;
   gint noise = 0, b;
+  gint color_channels = (bpp == 2 || bpp == 4) ? bpp-1 : bpp;
 
   if (!nvals.independent)
     noise = (gint) (nvals.noise[0] * gauss (gr) * 127);
-  
+
   for (b = 0; b < bpp; b++)
     {
       if (nvals.noise[b] > 0.0)
@@ -254,6 +253,9 @@
           dest[b] = src[b];
         }
     }
+
+  if (color_channels != bpp)
+    dest[color_channels] = src[color_channels];
 }
 
 static void
@@ -357,42 +359,23 @@
 
   noise_int.channels = channels;
 
-  if (channels == 1) 
-    {
-      noisify_add_channel (table, 0, _("_Gray:"), drawable);
-    }
-  else if (channels == 2)
+  switch (channels)
     {
+      case 1:
+      case 2:
       noisify_add_channel (table, 0, _("_Gray:"), drawable);
-      noisify_add_channel (table, 1, _("_Alpha:"), drawable);
-    }  
-  else if (channels == 3)
-    {
-      noisify_add_channel (table, 0, _("_Red:"), drawable);
-      noisify_add_channel (table, 1, _("_Green:"), drawable);
-      noisify_add_channel (table, 2, _("_Blue:"), drawable);
-    }
+      break;
 
-  else if (channels == 4)
-    {
+      case 3:
+      case 4:
       noisify_add_channel (table, 0, _("_Red:"), drawable);
       noisify_add_channel (table, 1, _("_Green:"), drawable);
       noisify_add_channel (table, 2, _("_Blue:"), drawable);
-      noisify_add_channel (table, 3, _("_Alpha:"), drawable);
-    }
-  else
-    {
-      gchar *buffer;
-      gint   i;
-
-      for (i = 0; i < channels; i++)
-	{
-	  buffer = g_strdup_printf (_("Channel #%d:"), i);
-
-	  noisify_add_channel (table, i, buffer, drawable);
+      break;
 
-	  g_free (buffer);
-	}
+      default:
+      /* ??? */
+      break;
     }
 
   gtk_widget_show (frame);
