Mercurial > emacs
changeset 104259:a52366907b7a
* image.c (xbm_read_bitmap_data): New arg inhibit_image_error.
(xbm_load_image): Caller changed.
(xbm_file_p): Avoid signalling an image_error.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Thu, 13 Aug 2009 17:01:21 +0000 |
parents | 81cbeb1f6df1 |
children | d1eff5d63114 |
files | src/ChangeLog src/image.c |
diffstat | 2 files changed, 18 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Thu Aug 13 15:59:34 2009 +0000 +++ b/src/ChangeLog Thu Aug 13 17:01:21 2009 +0000 @@ -1,3 +1,9 @@ +2009-08-13 Chong Yidong <cyd@stupidchicken.com> + + * image.c (xbm_read_bitmap_data): New arg inhibit_image_error. + (xbm_load_image): Caller changed. + (xbm_file_p): Avoid signalling an image_error. + 2009-08-13 Nick Roberts <nickrob@snap.net.nz> * process.c (create_pty): New function.
--- a/src/image.c Thu Aug 13 15:59:34 2009 +0000 +++ b/src/image.c Thu Aug 13 17:01:21 2009 +0000 @@ -2543,7 +2543,7 @@ static int xbm_image_p P_ ((Lisp_Object object)); static int xbm_read_bitmap_data P_ ((struct frame *f, unsigned char *, unsigned char *, - int *, int *, unsigned char **)); + int *, int *, unsigned char **, int)); static int xbm_file_p P_ ((Lisp_Object)); @@ -2934,14 +2934,17 @@ buffer's end. Set *WIDTH and *HEIGHT to the width and height of the image. Return in *DATA the bitmap data allocated with xmalloc. Value is non-zero if successful. DATA null means just test if - CONTENTS looks like an in-memory XBM file. */ + CONTENTS looks like an in-memory XBM file. If INHIBIT_IMAGE_ERROR + is non-zero, inhibit the call to image_error when the image size is + invalid (the bitmap remains unread). */ static int -xbm_read_bitmap_data (f, contents, end, width, height, data) +xbm_read_bitmap_data (f, contents, end, width, height, data, inhibit_image_error) struct frame *f; unsigned char *contents, *end; int *width, *height; unsigned char **data; + int inhibit_image_error; { unsigned char *s = contents; char buffer[BUFSIZ]; @@ -2993,7 +2996,8 @@ if (!check_image_size (f, *width, *height)) { - image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); + if (!inhibit_image_error) + image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); goto failure; } else if (data == NULL) @@ -3098,7 +3102,8 @@ unsigned char *data; int success_p = 0; - rc = xbm_read_bitmap_data (f, contents, end, &img->width, &img->height, &data); + rc = xbm_read_bitmap_data (f, contents, end, &img->width, &img->height, + &data, 0); if (rc) { unsigned long foreground = FRAME_FOREGROUND_PIXEL (f); @@ -3153,9 +3158,8 @@ int w, h; return (STRINGP (data) && xbm_read_bitmap_data (NULL, SDATA (data), - (SDATA (data) - + SBYTES (data)), - &w, &h, NULL)); + (SDATA (data) + SBYTES (data)), + &w, &h, NULL, 1)); }