--- psiconv/trunk/program/psiconv/magick-aux.c 2000/12/10 16:49:40 58 +++ psiconv/trunk/program/psiconv/magick-aux.c 2005/02/25 20:36:25 255 @@ -1,6 +1,6 @@ /* magick-aux.c - Part of psiconv, a PSION 5 file formats converter - Copyright (c) 2000 Frodo Looijaard + Copyright (c) 2000-2004 Frodo Looijaard This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,25 +22,59 @@ #if IMAGEMAGICK #include "magick-aux.h" -#include -#include -/* This is so ugly, but it is the only way to make ImageMagick 5 behave - * properly. It really needs a better interface. - * OpenModules makes sure all needed modules are loaded. But it may not - * be called until some things are initialized, hence the extra - * GetMagickInfo call. Ugh. - */ +#endif + +#ifdef DMALLOC +#include "dmalloc.h" +#endif + +#if IMAGEMAGICK -extern void OpenModules(void); +/* This used to be very ugly, but nowadays it is much better */ -MagickInfo * GetMagickFileList(void) +#if IMAGEMAGICK_API == 1 || IMAGEMAGICK_API == 2 +const MagickInfo * GetMagickFileList(void) { - GetMagickInfo(NULL); -#if defined(HasLTDL) - OpenModules(); -#endif - return GetMagickInfo(NULL); + ExceptionInfo exc; + GetExceptionInfo(&exc); + OpenModules(&exc); + return GetMagickInfo(NULL,&exc); } +#elif IMAGEMAGICK_API == 3 + +const MagickInfo * GetMagickFileList(void) +{ + MagickInfo **mi; + unsigned long nr; + int i; + ExceptionInfo exc; + GetExceptionInfo(&exc); + OpenModules(&exc); + mi = GetMagickInfoList("*",&nr); + for (i = 0; i < nr-1; i++) { + mi[i]->next = mi[i+1]; + } + return *mi; +} + +#elif IMAGEMAGICK_API == 4 + +const MagickInfo * GetMagickFileList(void) +{ + MagickInfo **mi; + unsigned long nr; + int i; + ExceptionInfo exc; + GetExceptionInfo(&exc); + OpenModules(&exc); + mi = GetMagickInfoList("*",&nr,&exc); + for (i = 0; i < nr-1; i++) { + mi[i]->next = mi[i+1]; + } + return *mi; +} +#endif + #endif /* IMAGEMAGICK */