unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Mitchel Humpherys <mitch.special@gmail.com>, emacs-devel@gnu.org
Subject: Re: [PATCH] * image.c: Fix compiler warning due to missing const
Date: Thu, 10 Sep 2015 02:52:05 -0700	[thread overview]
Message-ID: <55F152C5.9050306@cs.ucla.edu> (raw)
In-Reply-To: <1441856303-4171-1-git-send-email-mitch.special@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 483 bytes --]

Thanks for the bug reports.  I installed patches that should address the two 
issues you raised, though not quite in the ways you suggested.  GIFLIB before 
5.1 has problems with GifErrorString's signature; a simple workaround is to 
avoid using GifErrorString in GIFLIB 5.0.x.  Please see:

http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=6ee7eabb5dbdf39f2d7471c9e42fc90c315e6a9f

http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=f962c5d6472804f788cdd54631bcc46aab5f59ce

[-- Attachment #2: 0001-Port-to-GIFLIB-5.0.6-and-later.patch --]
[-- Type: text/x-diff, Size: 3453 bytes --]

From 6db8d94a896ceef473b8883ab4252778163b8f51 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 10 Sep 2015 02:39:13 -0700
Subject: [PATCH 1/2] Port to GIFLIB 5.0.6 and later

Problem reported by Mitchel Humpherys in:
http://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00420.html
* src/image.c (HAVE_GIFERRORSTRING) [HAVE_GIF]: New macro.
(GifErrorString, init_gif_functions) [HAVE_GIF && WINDOWSNT]:
(gif_load) [HAVE_GIF]: Use it.
---
 src/image.c | 38 ++++++++++++++++++++++----------------
 1 file changed, 22 insertions(+), 16 deletions(-)

diff --git a/src/image.c b/src/image.c
index 85cf801..2aa01e4 100644
--- a/src/image.c
+++ b/src/image.c
@@ -7499,6 +7499,12 @@ gif_image_p (Lisp_Object object)
 #  define GIFLIB_MAJOR 4
 # endif
 
+/* GifErrorString is declared to return char const * when GIFLIB_MAJOR
+   and GIFLIB_MINOR indicate 5.1 or later.  Do not bother using it in
+   earlier releases, where either it returns char * or GIFLIB_MINOR
+   may be incorrect.  */
+# define HAVE_GIFERRORSTRING (5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR))
+
 # ifdef WINDOWSNT
 
 /* GIF library details.  */
@@ -7514,7 +7520,9 @@ DEF_DLL_FN (GifFileType *, DGifOpenFileName, (const char *));
 #  else
 DEF_DLL_FN (GifFileType *, DGifOpen, (void *, InputFunc, int *));
 DEF_DLL_FN (GifFileType *, DGifOpenFileName, (const char *, int *));
-DEF_DLL_FN (char *, GifErrorString, (int));
+#  endif
+#  if HAVE_GIFERRORSTRING
+DEF_DLL_FN (char const *, GifErrorString, (int));
 #  endif
 
 static bool
@@ -7529,7 +7537,7 @@ init_gif_functions (void)
   LOAD_DLL_FN (library, DGifSlurp);
   LOAD_DLL_FN (library, DGifOpen);
   LOAD_DLL_FN (library, DGifOpenFileName);
-#  if GIFLIB_MAJOR >= 5
+#  if HAVE_GIFERRORSTRING
   LOAD_DLL_FN (library, GifErrorString);
 #  endif
   return 1;
@@ -7641,20 +7649,19 @@ gif_load (struct frame *f, struct image *img)
       /* Open the GIF file.  */
 #if GIFLIB_MAJOR < 5
       gif = DGifOpenFileName (SSDATA (encoded_file));
-      if (gif == NULL)
-	{
-	  image_error ("Cannot open `%s'", file);
-	  return 0;
-	}
 #else
       gif = DGifOpenFileName (SSDATA (encoded_file), &gif_err);
+#endif
       if (gif == NULL)
 	{
+#if HAVE_GIFERRORSTRING
 	  image_error ("Cannot open `%s': %s",
 		       file, build_string (GifErrorString (gif_err)));
+#else
+	  image_error ("Cannot open `%s'", file);
+#endif
 	  return 0;
 	}
-#endif
     }
   else
     {
@@ -7672,20 +7679,19 @@ gif_load (struct frame *f, struct image *img)
 
 #if GIFLIB_MAJOR < 5
       gif = DGifOpen (&memsrc, gif_read_from_memory);
-      if (!gif)
-	{
-	  image_error ("Cannot open memory source `%s'", img->spec);
-	  return 0;
-	}
 #else
       gif = DGifOpen (&memsrc, gif_read_from_memory, &gif_err);
+#endif
       if (!gif)
 	{
+#if HAVE_GIFERRORSTRING
 	  image_error ("Cannot open memory source `%s': %s",
 		       img->spec, build_string (GifErrorString (gif_err)));
+#else
+	  image_error ("Cannot open memory source `%s'", img->spec);
+#endif
 	  return 0;
 	}
-#endif
     }
 
   /* Before reading entire contents, check the declared image size. */
@@ -7980,8 +7986,8 @@ gif_load (struct frame *f, struct image *img)
 
   if (gif_close (gif, &gif_err) == GIF_ERROR)
     {
-#if 5 <= GIFLIB_MAJOR
-      char *error_text = GifErrorString (gif_err);
+#if HAVE_GIFERRORSTRING
+      char const *error_text = GifErrorString (gif_err);
 
       if (error_text)
 	image_error ("Error closing `%s': %s",
-- 
2.1.0


[-- Attachment #3: 0002-Add-patch-sending-instructions-to-git-workflow.patch --]
[-- Type: text/x-diff, Size: 1379 bytes --]

From 556a16fc5dd9996460fea9d7ff7df281723b3ff6 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 10 Sep 2015 02:43:59 -0700
Subject: [PATCH 2/2] Add patch-sending instructions to git-workflow

From a suggestion by Mitchel Humpherys in:
http://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00421.html
* admin/notes/git-workflow (Sending patches): New section.
---
 admin/notes/git-workflow | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/admin/notes/git-workflow b/admin/notes/git-workflow
index d1d105a..40dfa6b 100644
--- a/admin/notes/git-workflow
+++ b/admin/notes/git-workflow
@@ -46,6 +46,24 @@ top of that.  Then say
 git push
 
 
+Sending patches
+===============
+
+If you lack push access or would like feedback before pushing a patch,
+you can send a patch file as a bug report.  After committing your
+change locally, do:
+
+git format-patch -1
+
+This creates a file 0001-DESCRIPTION.patch containing the patch, where
+DESCRIPTION comes from the first line of your patch's commit message.
+You can attach the patch file to email that you send to
+bug-gnu-emacs@gnu.org.  You can also configure git to email patches
+directly (see <http://git-scm.com/docs/git-send-email>) and do:
+
+git send-email --to=bug-gnu-emacs@gnu.org 0001-DESCRIPTION.patch
+
+
 Backporting to emacs-24
 =======================
 
-- 
2.1.0


  reply	other threads:[~2015-09-10  9:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-10  3:38 [PATCH] * image.c: Fix compiler warning due to missing const Mitchel Humpherys
2015-09-10  9:52 ` Paul Eggert [this message]
2015-09-10 15:38   ` Eli Zaretskii
2015-09-10 15:49     ` Mitchel Humpherys
2015-09-10 15:58       ` Eli Zaretskii
2015-09-10 18:25       ` Paul Eggert
2015-09-10 18:56         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55F152C5.9050306@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=mitch.special@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).