It's USE_MAGICK, not USE_MAGIC. Also, we wrap the if/else statement
in an ifdef. This doesn't really affect anything since load_magick.c
won't be compiled if USE_MAGICK is undefined because of an if statement
in the Makefile. But in the off chance that it is somehow, then we will
try to load a nonexistent version 6 header file since USE_MAGICK will
be interprested as 0 and 0 < 7 is true.
We dropped ImageMagick 6 support in 0.95.9. However, ImageMagick 6 is
still widespread (e.g., ImageMagick 7 has not been packaged in Debian
yet), and upstream plans on maintaining it until at least 2028 [1].
In this patch, we detect the version of the MagickWand library installed
on the user's system and include the appropriate header file when
building wrlib.
Note: I've only tested this with ImageMagick 6, so I'd appreciate
confirmation that it works with ImageMagick 7.
[1] https://github.com/ImageMagick/ImageMagick6/blob/master/NEWS.txt
As pointed by Coverity, this value is never used, the assignation has no
effect, so Coverity reports that it is unnecessary complexity that is not
compatible with code maintainability.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
Instead of calling 'MagickWandGenesis' every time an image is loaded, only
call it the first time, and similarly do not call 'MagickWandTerminus' if
the library has not been used before.
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
- changed header used for MagickWand to the one specified in the online
documentation
- changed a comparison to 'MagickTrue' because its value does not allow a
compiler optimisation that would be expected in present case
- fixed potential crash, if loading with Magick fails it could return a
pointer to a de-allocated area
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>