From: Christophe CURIS <christophe.cu...@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.cu...@free.fr>
---
 wrlib/load_magick.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/wrlib/load_magick.c b/wrlib/load_magick.c
index 397ed34..009c554 100644
--- a/wrlib/load_magick.c
+++ b/wrlib/load_magick.c
@@ -21,9 +21,8 @@
  */
 
 #include "config.h"
-#include <X11/Xlib.h>
 
-#include <wand/magick_wand.h>
+#include <wand/MagickWand.h>
 
 #include "wraster.h"
 #include "imgformat.h"
@@ -67,14 +66,15 @@ RImage *RLoadMagick(const char *file_name)
        }
 
        ptr = image->data;
-       if (hasAlfa == MagickTrue)
-               mrc = MagickExportImagePixels(m_wand, 0, 0, (size_t)w, 
(size_t)h, "RGBA", CharPixel, ptr);
-       else
+       if (hasAlfa == MagickFalse)
                mrc = MagickExportImagePixels(m_wand, 0, 0, (size_t)w, 
(size_t)h, "RGB", CharPixel, ptr);
+       else
+               mrc = MagickExportImagePixels(m_wand, 0, 0, (size_t)w, 
(size_t)h, "RGBA", CharPixel, ptr);
 
        if (mrc == MagickFalse) {
                RErrorCode = RERR_BADIMAGEFILE;
                RReleaseImage(image);
+               image = NULL;
                goto bye;
        }
 
-- 
1.9.2


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to