aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2009-08-13 17:01:21 +0000
committerChong Yidong2009-08-13 17:01:21 +0000
commitce9593609585be06105f2084f3dd7a4b8e06f113 (patch)
tree50b7c37b39ebd7c98ca5cfde353599bd76cb3348 /src
parent6c58c39c35755510b3ff1dc85f3625d28c732d2b (diff)
downloademacs-ce9593609585be06105f2084f3dd7a4b8e06f113.tar.gz
emacs-ce9593609585be06105f2084f3dd7a4b8e06f113.zip
* image.c (xbm_read_bitmap_data): New arg inhibit_image_error.
(xbm_load_image): Caller changed. (xbm_file_p): Avoid signalling an image_error.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/image.c20
2 files changed, 18 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4e32fe46bec..23d117d5dc3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12009-08-13 Chong Yidong <cyd@stupidchicken.com>
2
3 * image.c (xbm_read_bitmap_data): New arg inhibit_image_error.
4 (xbm_load_image): Caller changed.
5 (xbm_file_p): Avoid signalling an image_error.
6
12009-08-13 Nick Roberts <nickrob@snap.net.nz> 72009-08-13 Nick Roberts <nickrob@snap.net.nz>
2 8
3 * process.c (create_pty): New function. 9 * process.c (create_pty): New function.
diff --git a/src/image.c b/src/image.c
index fa8c3ea9cda..e10f3817b69 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2543,7 +2543,7 @@ static int xbm_load_image P_ ((struct frame *f, struct image *img,
2543static int xbm_image_p P_ ((Lisp_Object object)); 2543static int xbm_image_p P_ ((Lisp_Object object));
2544static int xbm_read_bitmap_data P_ ((struct frame *f, 2544static int xbm_read_bitmap_data P_ ((struct frame *f,
2545 unsigned char *, unsigned char *, 2545 unsigned char *, unsigned char *,
2546 int *, int *, unsigned char **)); 2546 int *, int *, unsigned char **, int));
2547static int xbm_file_p P_ ((Lisp_Object)); 2547static int xbm_file_p P_ ((Lisp_Object));
2548 2548
2549 2549
@@ -2934,14 +2934,17 @@ Create_Pixmap_From_Bitmap_Data (f, img, data, fg, bg, non_default_colors)
2934 buffer's end. Set *WIDTH and *HEIGHT to the width and height of 2934 buffer's end. Set *WIDTH and *HEIGHT to the width and height of
2935 the image. Return in *DATA the bitmap data allocated with xmalloc. 2935 the image. Return in *DATA the bitmap data allocated with xmalloc.
2936 Value is non-zero if successful. DATA null means just test if 2936 Value is non-zero if successful. DATA null means just test if
2937 CONTENTS looks like an in-memory XBM file. */ 2937 CONTENTS looks like an in-memory XBM file. If INHIBIT_IMAGE_ERROR
2938 is non-zero, inhibit the call to image_error when the image size is
2939 invalid (the bitmap remains unread). */
2938 2940
2939static int 2941static int
2940xbm_read_bitmap_data (f, contents, end, width, height, data) 2942xbm_read_bitmap_data (f, contents, end, width, height, data, inhibit_image_error)
2941 struct frame *f; 2943 struct frame *f;
2942 unsigned char *contents, *end; 2944 unsigned char *contents, *end;
2943 int *width, *height; 2945 int *width, *height;
2944 unsigned char **data; 2946 unsigned char **data;
2947 int inhibit_image_error;
2945{ 2948{
2946 unsigned char *s = contents; 2949 unsigned char *s = contents;
2947 char buffer[BUFSIZ]; 2950 char buffer[BUFSIZ];
@@ -2993,7 +2996,8 @@ xbm_read_bitmap_data (f, contents, end, width, height, data)
2993 2996
2994 if (!check_image_size (f, *width, *height)) 2997 if (!check_image_size (f, *width, *height))
2995 { 2998 {
2996 image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); 2999 if (!inhibit_image_error)
3000 image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
2997 goto failure; 3001 goto failure;
2998 } 3002 }
2999 else if (data == NULL) 3003 else if (data == NULL)
@@ -3098,7 +3102,8 @@ xbm_load_image (f, img, contents, end)
3098 unsigned char *data; 3102 unsigned char *data;
3099 int success_p = 0; 3103 int success_p = 0;
3100 3104
3101 rc = xbm_read_bitmap_data (f, contents, end, &img->width, &img->height, &data); 3105 rc = xbm_read_bitmap_data (f, contents, end, &img->width, &img->height,
3106 &data, 0);
3102 if (rc) 3107 if (rc)
3103 { 3108 {
3104 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f); 3109 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f);
@@ -3153,9 +3158,8 @@ xbm_file_p (data)
3153 int w, h; 3158 int w, h;
3154 return (STRINGP (data) 3159 return (STRINGP (data)
3155 && xbm_read_bitmap_data (NULL, SDATA (data), 3160 && xbm_read_bitmap_data (NULL, SDATA (data),
3156 (SDATA (data) 3161 (SDATA (data) + SBYTES (data)),
3157 + SBYTES (data)), 3162 &w, &h, NULL, 1));
3158 &w, &h, NULL));
3159} 3163}
3160 3164
3161 3165