MagickMorphologyImage function definition not matching arguments
Posted: 2019-09-02T10:07:37-07:00
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.
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);
}