1From e158ec88b6ced0f793660bada32c6a54f1075608 Mon Sep 17 00:00:00 2001
2From: Jerome Duval <jerome.duval@gmail.com>
3Date: Wed, 3 May 2023 17:37:52 +0200
4Subject: imagemagick7 patch from Arch
5
6
7diff --git a/src/subgen-image.c b/src/subgen-image.c
8index 24e0dab..8f5d8d5 100644
9--- a/src/subgen-image.c
10+++ b/src/subgen-image.c
11@@ -30,7 +30,7 @@
12 
13 #if defined(HAVE_MAGICK) || defined(HAVE_GMAGICK)
14 #include <stdarg.h>
15-#include <magick/api.h>
16+#include <MagickWand/MagickWand.h>
17 #else
18 #include <png.h>
19 #endif
20@@ -176,18 +176,18 @@ static int read_magick(pict *s)
21 {
22     Image *im;
23     ImageInfo *ii;
24-    ExceptionInfo ei;
25+    ExceptionInfo *ei;
26     int x,y;
27     unsigned long magickver;
28     unsigned char amask;
29 
30-    GetExceptionInfo(&ei);
31+    ei = AcquireExceptionInfo();
32     ii=CloneImageInfo(NULL);
33     strcpy(ii->filename,s->fname);
34-    im=ReadImage(ii,&ei);
35+    im=ReadImage(ii,ei);
36 
37     if( !im ) {
38-        MagickError(ei.severity,"Unable to load file",ii->filename);
39+        MagickError(ei->severity,"Unable to load file",ii->filename);
40         return -1;
41     }
42 
43@@ -202,10 +202,10 @@ static int read_magick(pict *s)
44     for( y=0; y<im->rows; y++ ) {
45         char pdata[MAXX*4];
46 
47-        if(!ExportImagePixels(im,0,y,im->columns,1,"RGBA",CharPixel,pdata,&ei)) {
48-            fprintf(stderr,"ERR:  Extracting row %d from %s (%s,%s)\n",y,s->fname,ei.reason,ei.description);
49-            CatchException(&ei);
50-            MagickError(ei.severity,ei.reason,ei.description);
51+        if(!ExportImagePixels(im,0,y,im->columns,1,"RGBA",CharPixel,pdata,ei)) {
52+            fprintf(stderr,"ERR:  Extracting row %d from %s (%s,%s)\n",y,s->fname,ei->reason,ei->description);
53+            CatchException(ei);
54+            MagickError(ei->severity,ei->reason,ei->description);
55             DestroyImage(im);
56             return -1;
57         }
58@@ -219,7 +219,7 @@ static int read_magick(pict *s)
59         }
60     }
61     DestroyImage(im);
62-    DestroyExceptionInfo(&ei);
63+    DestroyExceptionInfo(ei);
64     fprintf(stderr,"INFO: Picture %s had %d colors\n",s->fname,s->numpal);
65 
66     return 0;
67@@ -1098,13 +1098,13 @@ bool process_subtitle(stinfo *s)
68 void image_init()
69 {
70 #if defined(HAVE_MAGICK) || defined(HAVE_GMAGICK)
71-    InitializeMagick(NULL);
72+    MagickCoreGenesis("", MagickFalse);
73 #endif
74 }
75 
76 void image_shutdown()
77 {
78 #if defined(HAVE_MAGICK) || defined(HAVE_GMAGICK)
79-    DestroyMagick();
80+    MagickCoreTerminus();
81 #endif
82 }
83-- 
842.37.3
85
86