aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-07-28 02:40:05 -0700
committerPaul Eggert2011-07-28 02:40:05 -0700
commit476371c4fd0e57d0aaf53c59e473ab705c8c4047 (patch)
tree76bd18392864abaa40ac05f5f2224bfeda327abb /src
parentf3fcc40d5ed0afb87f8c448b4b92c590b541ad17 (diff)
downloademacs-476371c4fd0e57d0aaf53c59e473ab705c8c4047.tar.gz
emacs-476371c4fd0e57d0aaf53c59e473ab705c8c4047.zip
* image.c (x_check_image_size) [!HAVE_X_WINDOWS]: Return 1.
In other words, assume that every image size is allowed, on non-X hosts. This assumption is probably wrong, but it lets Emacs compile.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/image.c12
2 files changed, 15 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 7da6dcbee8f..045c4311789 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12011-07-28 Paul Eggert <eggert@cs.ucla.edu>
2
3 * image.c (x_check_image_size) [!HAVE_X_WINDOWS]: Return 1.
4 In other words, assume that every image size is allowed, on non-X
5 hosts. This assumption is probably wrong, but it lets Emacs compile.
6
12011-07-28 Andreas Schwab <schwab@linux-m68k.org> 72011-07-28 Andreas Schwab <schwab@linux-m68k.org>
2 8
3 * regex.c (re_iswctype): Convert return values to boolean. 9 * regex.c (re_iswctype): Convert return values to boolean.
diff --git a/src/image.c b/src/image.c
index 7a5ac40b3d2..fb1d825fa54 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1906,16 +1906,17 @@ static int x_create_x_image_and_pixmap (struct frame *, int, int, int,
1906static void x_destroy_x_image (XImagePtr); 1906static void x_destroy_x_image (XImagePtr);
1907static void x_put_x_image (struct frame *, XImagePtr, Pixmap, int, int); 1907static void x_put_x_image (struct frame *, XImagePtr, Pixmap, int, int);
1908 1908
1909/* Return nonzero if XIMG's size WIDTH x HEIGHT doesn't break X. 1909/* Return nonzero if XIMG's size WIDTH x HEIGHT doesn't break the
1910 windowing system.
1910 WIDTH and HEIGHT must both be positive. 1911 WIDTH and HEIGHT must both be positive.
1911 If XIMG is null, assume it is a bitmap. */ 1912 If XIMG is null, assume it is a bitmap. */
1912static int 1913static int
1913x_check_image_size (XImagePtr ximg, int width, int height) 1914x_check_image_size (XImagePtr ximg, int width, int height)
1914{ 1915{
1916#ifdef HAVE_X_WINDOWS
1915 /* Respect Xlib's limits: it cannot deal with images that have more 1917 /* Respect Xlib's limits: it cannot deal with images that have more
1916 than INT_MAX (and/or UINT_MAX) bytes. And respect Emacs's limits 1918 than INT_MAX (and/or UINT_MAX) bytes. And respect Emacs's limits
1917 of PTRDIFF_MAX (and/or SIZE_MAX) bytes for any object. For now, 1919 of PTRDIFF_MAX (and/or SIZE_MAX) bytes for any object. */
1918 assume all windowing systems have the same limits that X does. */
1919 enum 1920 enum
1920 { 1921 {
1921 XLIB_BYTES_MAX = min (INT_MAX, UINT_MAX), 1922 XLIB_BYTES_MAX = min (INT_MAX, UINT_MAX),
@@ -1937,6 +1938,11 @@ x_check_image_size (XImagePtr ximg, int width, int height)
1937 } 1938 }
1938 return (width <= (INT_MAX - (bitmap_pad - 1)) / depth 1939 return (width <= (INT_MAX - (bitmap_pad - 1)) / depth
1939 && height <= X_IMAGE_BYTES_MAX / bytes_per_line); 1940 && height <= X_IMAGE_BYTES_MAX / bytes_per_line);
1941#else
1942 /* FIXME: Implement this check for the HAVE_NS and HAVE_NTGUI cases.
1943 For now, assume that every image size is allowed on these systems. */
1944 return 1;
1945#endif
1940} 1946}
1941 1947
1942/* Create an XImage and a pixmap of size WIDTH x HEIGHT for use on 1948/* Create an XImage and a pixmap of size WIDTH x HEIGHT for use on