MagickMorphologyImage function definition not matching arguments

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
coloring
Posts: 82
Joined: 2015-08-27T10:17:36-07:00
Authentication code: 1151

MagickMorphologyImage function definition not matching arguments

Post by coloring »

The function for MagickWand's MagickMorphologyImage has two non-const arguments, method and kernel, which are both used in const only ways -> MorhplogyImage takes only const arguments. For clarity reasons, maybe it should be changed to a const signature?

Rationale: I thought that somehow the code would be trying to modify the *kernel I passed into it, only to find that it's actually const and doesn't modify it.

Code: Select all

MagickExport Image *MorphologyImage(const Image *image,
  const MorphologyMethod method,const ssize_t iterations,
  const KernelInfo *kernel,ExceptionInfo *exception)

Code: Select all

WandExport MagickBooleanType MagickMorphologyImage(MagickWand *wand,
  MorphologyMethod method,const ssize_t iterations,KernelInfo *kernel)
{
  Image
    *morphology_image;

  assert(wand != (MagickWand *) NULL);
  assert(wand->signature == MagickWandSignature);
  if (wand->debug != MagickFalse)
    (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  if (kernel == (const KernelInfo *) NULL)
    return(MagickFalse);
  if (wand->images == (Image *) NULL)
    ThrowWandException(WandError,"ContainsNoImages",wand->name);
  morphology_image=MorphologyImage(wand->images,method,iterations,kernel,
    wand->exception);
  if (morphology_image == (Image *) NULL)
    return(MagickFalse);
  ReplaceImageInList(&wand->images,morphology_image);
  return(MagickTrue);
}
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: MagickMorphologyImage function definition not matching arguments

Post by magick »

Agree. Will add a patch to the Git repo by tomorrow.
coloring
Posts: 82
Joined: 2015-08-27T10:17:36-07:00
Authentication code: 1151

Re: MagickMorphologyImage function definition not matching arguments

Post by coloring »

Thanks for the always quick reply, and attention to detail :D
Post Reply