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));
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];
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)
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);
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));
}