*plug-ins/ edge.c added a check so it woudlnt segfault when passed a

*plug-ins/ edge.c
                added a check so it woudlnt segfault when
        passed a non-existend drawable

        threshold_alpha  added a non-interactive mode

        *app/brightness_contrast.c
         app/color_balance.c
         app/colormaps.c
         app/curves.c
         app/hue_saturation.c
         app/posterize.c
         app/threshold.c

                -added a check so it wouldnt except
         a indexed drawable. This was previosly possible via the pdb.

-adrian
This commit is contained in:
Adrian Likins 1998-02-01 01:58:47 +00:00
parent 88bcda0a20
commit bae5bae79d
31 changed files with 167 additions and 4 deletions

View File

@ -1,3 +1,21 @@
Sat Jan 31 20:49:11 EST 1998 Adrian Likins <adrian@gimp.org>
*plug-ins/ edge.c
added a check so it woudlnt segfault when
passed a non-existend drawable
threshold_alpha added a non-interactive mode
*app/brightness_contrast.c
app/color_balance.c
app/colormaps.c
app/curves.c
app/hue_saturation.c
app/posterize.c
app/threshold.c
-added an additioanl check so it wouldnt except
a indexed drawable. This was previosly possible via the pdb.
Sat Jan 31 00:16:22 PST 1998 Manish Singh <yosh@gimp.org>
* plug-ins/xpm/xpm.c: Changed to use g_strcasecmp

View File

@ -954,6 +954,10 @@ color_balance_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* transfer_mode */
if (success)
{

View File

@ -1350,6 +1350,11 @@ curves_spline_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* channel */
if (success)
{
@ -1498,6 +1503,10 @@ curves_explicit_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* channel */
if (success)
{

View File

@ -1099,6 +1099,10 @@ hue_saturation_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* hue_range */
if (success)
{

View File

@ -676,6 +676,10 @@ threshold_invoker (args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* low threhsold */
if (success)
{

View File

@ -702,6 +702,10 @@ brightness_contrast_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* brightness */
if (success)
{

View File

@ -954,6 +954,10 @@ color_balance_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* transfer_mode */
if (success)
{

View File

@ -205,6 +205,7 @@ get_standard_colormaps ()
if (g_visual->depth == 8 && info->reserved_pixels == NULL) {
g_print("GIMP cannot get enough colormaps to boot.\n");
g_print("Try exiting other color intensive applications.\n");
g_print("Also try enabling the (install-colormap) option in gimprc.\n");
swapping_free ();
brushes_free ();
patterns_free ();

View File

@ -1350,6 +1350,11 @@ curves_spline_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* channel */
if (success)
{
@ -1498,6 +1503,10 @@ curves_explicit_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* channel */
if (success)
{

View File

@ -1099,6 +1099,10 @@ hue_saturation_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* hue_range */
if (success)
{

View File

@ -1523,6 +1523,10 @@ levels_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* channel */
if (success)
{

View File

@ -507,6 +507,10 @@ posterize_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* levels */
if (success)
{

View File

@ -676,6 +676,10 @@ threshold_invoker (args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* low threhsold */
if (success)
{

View File

@ -702,6 +702,10 @@ brightness_contrast_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* brightness */
if (success)
{

View File

@ -954,6 +954,10 @@ color_balance_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* transfer_mode */
if (success)
{

View File

@ -1350,6 +1350,11 @@ curves_spline_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* channel */
if (success)
{
@ -1498,6 +1503,10 @@ curves_explicit_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* channel */
if (success)
{

View File

@ -702,6 +702,10 @@ brightness_contrast_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* brightness */
if (success)
{

View File

@ -954,6 +954,10 @@ color_balance_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* transfer_mode */
if (success)
{

View File

@ -1350,6 +1350,11 @@ curves_spline_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* channel */
if (success)
{
@ -1498,6 +1503,10 @@ curves_explicit_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* channel */
if (success)
{

View File

@ -1099,6 +1099,10 @@ hue_saturation_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* hue_range */
if (success)
{

View File

@ -1523,6 +1523,10 @@ levels_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* channel */
if (success)
{

View File

@ -507,6 +507,10 @@ posterize_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* levels */
if (success)
{

View File

@ -676,6 +676,10 @@ threshold_invoker (args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* low threhsold */
if (success)
{

View File

@ -1099,6 +1099,10 @@ hue_saturation_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* hue_range */
if (success)
{

View File

@ -1523,6 +1523,10 @@ levels_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* channel */
if (success)
{

View File

@ -507,6 +507,10 @@ posterize_invoker (Argument *args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* levels */
if (success)
{

View File

@ -676,6 +676,10 @@ threshold_invoker (args)
if (drawable == NULL || gimage != drawable_gimage (drawable))
success = FALSE;
}
/* make sure the drawable is not indexed color */
if (success)
success = ! drawable_indexed (drawable);
/* low threhsold */
if (success)
{

View File

@ -225,7 +225,8 @@ run (gchar *name,
break;
}
if (status == STATUS_SUCCESS)
/* make sure the drawable exist and is not indexed */
if (gimp_drawable_color (drawable->id) || gimp_drawable_gray (drawable->id))
{
gimp_progress_init ("Edge detection...");
@ -242,6 +243,11 @@ run (gchar *name,
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_edge", &evals, sizeof (EdgeVals));
}
else
{
/* gimp_message ("edge: cannot operate on indexed color images"); */
status = STATUS_EXECUTION_ERROR;
}
values[0].data.d_status = status;

View File

@ -178,6 +178,7 @@ query ()
{ PARAM_INT32, "run_mode", "Interactive, non-interactive"},
{ PARAM_IMAGE, "image", "Input image (not used)"},
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
{ PARAM_INT32, "threshold", "Threshold" },
};
static GParamDef *return_vals = NULL;
static int nargs = sizeof (args) / sizeof (args[0]);
@ -236,7 +237,12 @@ run (char *name,
return;
break;
case RUN_NONINTERACTIVE:
/* You must copy the values of parameters to VALS or dialog variables. */
if (nparams != 4)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
{
VALS.threshold = param[3].data.d_int32;
}
break;
case RUN_WITH_LAST_VALS:
gimp_get_data (PLUG_IN_NAME, &VALS);

View File

@ -225,7 +225,8 @@ run (gchar *name,
break;
}
if (status == STATUS_SUCCESS)
/* make sure the drawable exist and is not indexed */
if (gimp_drawable_color (drawable->id) || gimp_drawable_gray (drawable->id))
{
gimp_progress_init ("Edge detection...");
@ -242,6 +243,11 @@ run (gchar *name,
if (run_mode == RUN_INTERACTIVE)
gimp_set_data ("plug_in_edge", &evals, sizeof (EdgeVals));
}
else
{
/* gimp_message ("edge: cannot operate on indexed color images"); */
status = STATUS_EXECUTION_ERROR;
}
values[0].data.d_status = status;

View File

@ -178,6 +178,7 @@ query ()
{ PARAM_INT32, "run_mode", "Interactive, non-interactive"},
{ PARAM_IMAGE, "image", "Input image (not used)"},
{ PARAM_DRAWABLE, "drawable", "Input drawable" },
{ PARAM_INT32, "threshold", "Threshold" },
};
static GParamDef *return_vals = NULL;
static int nargs = sizeof (args) / sizeof (args[0]);
@ -236,7 +237,12 @@ run (char *name,
return;
break;
case RUN_NONINTERACTIVE:
/* You must copy the values of parameters to VALS or dialog variables. */
if (nparams != 4)
status = STATUS_CALLING_ERROR;
if (status == STATUS_SUCCESS)
{
VALS.threshold = param[3].data.d_int32;
}
break;
case RUN_WITH_LAST_VALS:
gimp_get_data (PLUG_IN_NAME, &VALS);