From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: No support for ImageMagick 7 in emacs-26 Date: Tue, 27 Nov 2018 08:14:23 +0200 Message-ID: <83in0jgi80.fsf@gnu.org> References: <83efb9jf7x.fsf@gnu.org> <056e8aae-9a70-54e2-f3fd-19ede5bef749@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1543299173 31182 195.159.176.226 (27 Nov 2018 06:12:53 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 27 Nov 2018 06:12:53 +0000 (UTC) Cc: ulm@gentoo.org, emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 27 07:12:49 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gRWc5-0007zQ-2d for ged-emacs-devel@m.gmane.org; Tue, 27 Nov 2018 07:12:49 +0100 Original-Received: from localhost ([::1]:40196 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRWeB-00056d-9d for ged-emacs-devel@m.gmane.org; Tue, 27 Nov 2018 01:14:59 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRWdY-00056I-Qw for emacs-devel@gnu.org; Tue, 27 Nov 2018 01:14:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRWdU-0001BU-Ou for emacs-devel@gnu.org; Tue, 27 Nov 2018 01:14:20 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRWdU-0001BQ-MC; Tue, 27 Nov 2018 01:14:16 -0500 Original-Received: from [176.228.60.248] (port=1755 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gRWdU-0006Fx-A9; Tue, 27 Nov 2018 01:14:16 -0500 In-reply-to: <056e8aae-9a70-54e2-f3fd-19ede5bef749@cs.ucla.edu> (message from Paul Eggert on Mon, 26 Nov 2018 17:38:28 -0800) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:231435 Archived-At: > Cc: emacs-devel@gnu.org > From: Paul Eggert > Date: Mon, 26 Nov 2018 17:38:28 -0800 > > > - MagickRealType color_scale = 65535.0 / QuantumRange; > > + double quantum_range = QuantumRange; > > + MagickRealType color_scale = 65535.0 / quantum_range; > > We don't need to apply this to the emacs-26 branch, as it does not > affect behavior and is used only to pacify a GCC warning. I suppose > Gentoo enables warnings somehow, and doesn't want that warning. But in > general we no longer worry about --enable-gcc-warnings diagnostics in > the emacs-26 branch. Agreed. > So how about the attached patch for the emacs-26 branch? Fine with me, except: > --- a/src/image.c > +++ b/src/image.c > @@ -8272,11 +8272,20 @@ imagemagick_image_p (Lisp_Object object) > /* The GIF library also defines DrawRectangle, but its never used in Emacs. > Therefore rename the function so it doesn't collide with ImageMagick. */ > #define DrawRectangle DrawRectangleGif > -#include > + > +#ifdef HAVE_IMAGEMAGICK7 > +# include > +# include > +/* ImageMagick 7 compatibility definitions. */ > +# define PixelSetMagickColor PixelSetPixelColor > +typedef PixelInfo MagickPixelPacket; > +#else > +# include > +# include > +#endif > > /* ImageMagick 6.5.3 through 6.6.5 hid PixelGetMagickColor for some reason. > Emacs seems to work fine with the hidden version, so unhide it. */ > -#include > #if 0x653 <= MagickLibVersion && MagickLibVersion <= 0x665 > extern WandExport void PixelGetMagickColor (const PixelWand *, > MagickPixelPacket *); It makes little sense to me to move the inclusion of magick/version.h into the v6 conditional, but leave the "#if 0x653" conditional fragment and its comment outside that v6 conditional. AFAIU, we are including version.h _because_ we want that second #if, right? So we should keep them close together, and keep the comment explaining why we do that before the code it explains. (Which begs the question whether we need to include MagickCore/version.h for v7, but I'm not going to bother about that.) Thanks.