unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#13981: 24.3.50; Incorrect declaration of image_background
@ 2013-03-16 19:57 Ken Brown
  2013-03-17  3:48 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Ken Brown @ 2013-03-16 19:57 UTC (permalink / raw)
  To: 13981

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

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




[-- Attachment #2: image_background.patch --]
[-- Type: text/plain, Size: 1689 bytes --]

=== 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#13981: 24.3.50; Incorrect declaration of image_background
  2013-03-16 19:57 bug#13981: 24.3.50; Incorrect declaration of image_background Ken Brown
@ 2013-03-17  3:48 ` Eli Zaretskii
  2013-03-17 14:36   ` Ken Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2013-03-17  3:48 UTC (permalink / raw)
  To: Ken Brown; +Cc: 13981

> Date: Sat, 16 Mar 2013 15:57:09 -0400
> From: Ken Brown <kbrown@cornell.edu>
> 
> 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?

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.

Thanks.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#13981: 24.3.50; Incorrect declaration of image_background
  2013-03-17  3:48 ` Eli Zaretskii
@ 2013-03-17 14:36   ` Ken Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Ken Brown @ 2013-03-17 14:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 13981-done

On 3/16/2013 11:48 PM, Eli Zaretskii wrote:
>> Date: Sat, 16 Mar 2013 15:57:09 -0400
>> From: Ken Brown <kbrown@cornell.edu>
>> 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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-17 14:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-16 19:57 bug#13981: 24.3.50; Incorrect declaration of image_background Ken Brown
2013-03-17  3:48 ` Eli Zaretskii
2013-03-17 14:36   ` Ken Brown

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).