Subject: bug#13981: closed (Re: bug#13981: 24.3.50; Incorrect declaration of image_background)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 17 Mar 2013 14:39:02 +0000

Your bug report

#13981: 24.3.50; Incorrect declaration of image_background

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
13981: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13981
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#13981: 24.3.50; Incorrect declaration of image_background
From: Ken Brown <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked]
Date: Sun, 17 Mar 2013 10:36:25 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

On 3/16/2013 11:48 PM, Eli Zaretskii wrote:
>> Date: Sat, 16 Mar 2013 15:57:09 -0400
>> From: Ken Brown <[email-masked]>
>> OK to apply?
>
> Yes, but please move the definition of RGB_PIXEL_COLOR so it is just
> before the prototype of image_background, since that is its only user.

Done as bzr revision 112064.  I'm closing the bug.

Ken

Subject: 24.3.50; Incorrect declaration of image_background
From: Ken Brown <[email-masked]>
To: [email-masked]
Date: Sat, 16 Mar 2013 15:57:09 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

image_background() is declared in dispextern.h with a return type of 
`unsigned long'.  But it is defined in image.c with a return type of 
RGB_PIXEL_COLOR, where the latter is a platform-dependent macro defined 
in image.c.

By luck, this doesn't cause any problems in the currently-supported 
platforms.  But it will cause problems in the cygw32 build on 64-bit 
Cygwin (which is currently under development).  The attached patch fixes 
this by moving the definition of RGB_PIXEL_COLOR to dispextern.h and 
changing the return type in the declaration.

OK to apply?

Ken

=== modified file 'src/dispextern.h'
--- src/dispextern.h	2013-01-02 16:13:04 +0000
+++ src/dispextern.h	2013-03-16 19:55:58 +0000
@@ -3160,6 +3160,14 @@
 
 #ifdef HAVE_WINDOW_SYSTEM
 
+#if defined (HAVE_X_WINDOWS) ||  defined (HAVE_NS)
+#define RGB_PIXEL_COLOR unsigned long
+#endif
+
+#ifdef HAVE_NTGUI
+#define RGB_PIXEL_COLOR COLORREF
+#endif
+
 extern int x_bitmap_height (struct frame *, ptrdiff_t);
 extern int x_bitmap_width (struct frame *, ptrdiff_t);
 extern ptrdiff_t x_bitmap_pixmap (struct frame *, ptrdiff_t);
@@ -3186,7 +3194,7 @@
 void prepare_image_for_display (struct frame *, struct image *);
 ptrdiff_t lookup_image (struct frame *, Lisp_Object);
 
-unsigned long image_background (struct image *, struct frame *,
+RGB_PIXEL_COLOR image_background (struct image *, struct frame *,
                                 XImagePtr_or_DC ximg);
 int image_background_transparent (struct image *, struct frame *,
                                   XImagePtr_or_DC mask);

=== modified file 'src/image.c'
--- src/image.c	2013-03-04 17:35:29 +0000
+++ src/image.c	2013-03-16 19:17:45 +0000
@@ -68,8 +68,6 @@
 #define GET_PIXEL(ximg, x, y) XGetPixel (ximg, x, y)
 #define NO_PIXMAP None
 
-#define RGB_PIXEL_COLOR unsigned long
-
 #define PIX_MASK_RETAIN	0
 #define PIX_MASK_DRAW	1
 #endif /* HAVE_X_WINDOWS */
@@ -88,8 +86,6 @@
 #define GET_PIXEL(ximg, x, y) GetPixel (ximg, x, y)
 #define NO_PIXMAP 0
 
-#define RGB_PIXEL_COLOR COLORREF
-
 #define PIX_MASK_RETAIN	0
 #define PIX_MASK_DRAW	1
 
@@ -110,7 +106,6 @@
 #define GET_PIXEL(ximg, x, y) XGetPixel (ximg, x, y)
 #define NO_PIXMAP 0
 
-#define RGB_PIXEL_COLOR unsigned long
 #define ZPixmap 0
 
 #define PIX_MASK_RETAIN	0