aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/xfns.c45
1 files changed, 15 insertions, 30 deletions
diff --git a/src/xfns.c b/src/xfns.c
index 399da6d6fd9..28748091279 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5441,7 +5441,7 @@ Lisp_Object Qxbm;
5441Lisp_Object QCtype, QCdata, QCascent, QCmargin, QCrelief; 5441Lisp_Object QCtype, QCdata, QCascent, QCmargin, QCrelief;
5442extern Lisp_Object QCwidth, QCheight, QCforeground, QCbackground, QCfile; 5442extern Lisp_Object QCwidth, QCheight, QCforeground, QCbackground, QCfile;
5443Lisp_Object QCalgorithm, QCcolor_symbols, QCheuristic_mask; 5443Lisp_Object QCalgorithm, QCcolor_symbols, QCheuristic_mask;
5444Lisp_Object QCindex, QCuser_data; 5444Lisp_Object QCindex;
5445 5445
5446/* Other symbols. */ 5446/* Other symbols. */
5447 5447
@@ -5576,10 +5576,8 @@ struct image_keyword
5576}; 5576};
5577 5577
5578 5578
5579static int parse_image_spec P_ ((Lisp_Object spec, 5579static int parse_image_spec P_ ((Lisp_Object, struct image_keyword *,
5580 struct image_keyword *keywords, 5580 int, Lisp_Object));
5581 int nkeywords, Lisp_Object type,
5582 int allow_other_keys_p));
5583static Lisp_Object image_spec_value P_ ((Lisp_Object, Lisp_Object, int *)); 5581static Lisp_Object image_spec_value P_ ((Lisp_Object, Lisp_Object, int *));
5584 5582
5585 5583
@@ -5587,17 +5585,14 @@ static Lisp_Object image_spec_value P_ ((Lisp_Object, Lisp_Object, int *));
5587 has the format (image KEYWORD VALUE ...). One of the keyword/ 5585 has the format (image KEYWORD VALUE ...). One of the keyword/
5588 value pairs must be `:type TYPE'. KEYWORDS is a vector of 5586 value pairs must be `:type TYPE'. KEYWORDS is a vector of
5589 image_keywords structures of size NKEYWORDS describing other 5587 image_keywords structures of size NKEYWORDS describing other
5590 allowed keyword/value pairs. ALLOW_OTHER_KEYS_P non-zero means 5588 allowed keyword/value pairs. Value is non-zero if SPEC is valid. */
5591 allow KEYWORD/VALUE pairs other than those described by KEYWORDS
5592 without checking them. Value is non-zero if SPEC is valid. */
5593 5589
5594static int 5590static int
5595parse_image_spec (spec, keywords, nkeywords, type, allow_other_keys_p) 5591parse_image_spec (spec, keywords, nkeywords, type)
5596 Lisp_Object spec; 5592 Lisp_Object spec;
5597 struct image_keyword *keywords; 5593 struct image_keyword *keywords;
5598 int nkeywords; 5594 int nkeywords;
5599 Lisp_Object type; 5595 Lisp_Object type;
5600 int allow_other_keys_p;
5601{ 5596{
5602 int i; 5597 int i;
5603 Lisp_Object plist; 5598 Lisp_Object plist;
@@ -5622,21 +5617,13 @@ parse_image_spec (spec, keywords, nkeywords, type, allow_other_keys_p)
5622 value = XCAR (plist); 5617 value = XCAR (plist);
5623 plist = XCDR (plist); 5618 plist = XCDR (plist);
5624 5619
5625 /* Always ignore :user-data DATA. */
5626 if (EQ (key, QCuser_data))
5627 continue;
5628
5629 /* Find key in KEYWORDS. Error if not found. */ 5620 /* Find key in KEYWORDS. Error if not found. */
5630 for (i = 0; i < nkeywords; ++i) 5621 for (i = 0; i < nkeywords; ++i)
5631 if (strcmp (keywords[i].name, XSYMBOL (key)->name->data) == 0) 5622 if (strcmp (keywords[i].name, XSYMBOL (key)->name->data) == 0)
5632 break; 5623 break;
5633 5624
5634 if (i == nkeywords) 5625 if (i == nkeywords)
5635 { 5626 continue;
5636 if (!allow_other_keys_p)
5637 return 0;
5638 continue;
5639 }
5640 5627
5641 /* Record that we recognized the keyword. If a keywords 5628 /* Record that we recognized the keyword. If a keywords
5642 was found more than once, it's an error. */ 5629 was found more than once, it's an error. */
@@ -6430,7 +6417,7 @@ xbm_image_p (object)
6430 struct image_keyword kw[XBM_LAST]; 6417 struct image_keyword kw[XBM_LAST];
6431 6418
6432 bcopy (xbm_format, kw, sizeof kw); 6419 bcopy (xbm_format, kw, sizeof kw);
6433 if (!parse_image_spec (object, kw, XBM_LAST, Qxbm, 0)) 6420 if (!parse_image_spec (object, kw, XBM_LAST, Qxbm))
6434 return 0; 6421 return 0;
6435 6422
6436 xassert (EQ (kw[XBM_TYPE].value, Qxbm)); 6423 xassert (EQ (kw[XBM_TYPE].value, Qxbm));
@@ -6846,7 +6833,7 @@ xbm_load (f, img)
6846 6833
6847 /* Parse the list specification. */ 6834 /* Parse the list specification. */
6848 bcopy (xbm_format, fmt, sizeof fmt); 6835 bcopy (xbm_format, fmt, sizeof fmt);
6849 parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm, 0); 6836 parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm);
6850 xassert (parsed_p); 6837 xassert (parsed_p);
6851 6838
6852 /* Get specified width, and height. */ 6839 /* Get specified width, and height. */
@@ -7005,7 +6992,7 @@ xpm_image_p (object)
7005{ 6992{
7006 struct image_keyword fmt[XPM_LAST]; 6993 struct image_keyword fmt[XPM_LAST];
7007 bcopy (xpm_format, fmt, sizeof fmt); 6994 bcopy (xpm_format, fmt, sizeof fmt);
7008 return (parse_image_spec (object, fmt, XPM_LAST, Qxpm, 0) 6995 return (parse_image_spec (object, fmt, XPM_LAST, Qxpm)
7009 /* Either `:file' or `:data' must be present. */ 6996 /* Either `:file' or `:data' must be present. */
7010 && fmt[XPM_FILE].count + fmt[XPM_DATA].count == 1 6997 && fmt[XPM_FILE].count + fmt[XPM_DATA].count == 1
7011 /* Either no `:color-symbols' or it's a list of conses 6998 /* Either no `:color-symbols' or it's a list of conses
@@ -7675,7 +7662,7 @@ pbm_image_p (object)
7675 7662
7676 bcopy (pbm_format, fmt, sizeof fmt); 7663 bcopy (pbm_format, fmt, sizeof fmt);
7677 7664
7678 if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm, 0) 7665 if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm)
7679 || (fmt[PBM_ASCENT].count 7666 || (fmt[PBM_ASCENT].count
7680 && XFASTINT (fmt[PBM_ASCENT].value) > 100)) 7667 && XFASTINT (fmt[PBM_ASCENT].value) > 100))
7681 return 0; 7668 return 0;
@@ -7989,7 +7976,7 @@ png_image_p (object)
7989 struct image_keyword fmt[PNG_LAST]; 7976 struct image_keyword fmt[PNG_LAST];
7990 bcopy (png_format, fmt, sizeof fmt); 7977 bcopy (png_format, fmt, sizeof fmt);
7991 7978
7992 if (!parse_image_spec (object, fmt, PNG_LAST, Qpng, 1) 7979 if (!parse_image_spec (object, fmt, PNG_LAST, Qpng)
7993 || (fmt[PNG_ASCENT].count 7980 || (fmt[PNG_ASCENT].count
7994 && XFASTINT (fmt[PNG_ASCENT].value) > 100)) 7981 && XFASTINT (fmt[PNG_ASCENT].value) > 100))
7995 return 0; 7982 return 0;
@@ -8410,7 +8397,7 @@ jpeg_image_p (object)
8410 8397
8411 bcopy (jpeg_format, fmt, sizeof fmt); 8398 bcopy (jpeg_format, fmt, sizeof fmt);
8412 8399
8413 if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg, 0) 8400 if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg)
8414 || (fmt[JPEG_ASCENT].count 8401 || (fmt[JPEG_ASCENT].count
8415 && XFASTINT (fmt[JPEG_ASCENT].value) > 100)) 8402 && XFASTINT (fmt[JPEG_ASCENT].value) > 100))
8416 return 0; 8403 return 0;
@@ -8657,7 +8644,7 @@ tiff_image_p (object)
8657 struct image_keyword fmt[TIFF_LAST]; 8644 struct image_keyword fmt[TIFF_LAST];
8658 bcopy (tiff_format, fmt, sizeof fmt); 8645 bcopy (tiff_format, fmt, sizeof fmt);
8659 8646
8660 if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff, 1) 8647 if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff)
8661 || (fmt[TIFF_ASCENT].count 8648 || (fmt[TIFF_ASCENT].count
8662 && XFASTINT (fmt[TIFF_ASCENT].value) > 100)) 8649 && XFASTINT (fmt[TIFF_ASCENT].value) > 100))
8663 return 0; 8650 return 0;
@@ -8833,7 +8820,7 @@ gif_image_p (object)
8833 struct image_keyword fmt[GIF_LAST]; 8820 struct image_keyword fmt[GIF_LAST];
8834 bcopy (gif_format, fmt, sizeof fmt); 8821 bcopy (gif_format, fmt, sizeof fmt);
8835 8822
8836 if (!parse_image_spec (object, fmt, GIF_LAST, Qgif, 1) 8823 if (!parse_image_spec (object, fmt, GIF_LAST, Qgif)
8837 || (fmt[GIF_ASCENT].count 8824 || (fmt[GIF_ASCENT].count
8838 && XFASTINT (fmt[GIF_ASCENT].value) > 100)) 8825 && XFASTINT (fmt[GIF_ASCENT].value) > 100))
8839 return 0; 8826 return 0;
@@ -9102,7 +9089,7 @@ gs_image_p (object)
9102 9089
9103 bcopy (gs_format, fmt, sizeof fmt); 9090 bcopy (gs_format, fmt, sizeof fmt);
9104 9091
9105 if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript, 1) 9092 if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript)
9106 || (fmt[GS_ASCENT].count 9093 || (fmt[GS_ASCENT].count
9107 && XFASTINT (fmt[GS_ASCENT].value) > 100)) 9094 && XFASTINT (fmt[GS_ASCENT].value) > 100))
9108 return 0; 9095 return 0;
@@ -10428,8 +10415,6 @@ Each element of the list is a symbol for a supported image type.");
10428 staticpro (&QCpt_height); 10415 staticpro (&QCpt_height);
10429 QCindex = intern (":index"); 10416 QCindex = intern (":index");
10430 staticpro (&QCindex); 10417 staticpro (&QCindex);
10431 QCuser_data = intern (":user-data");
10432 staticpro (&QCuser_data);
10433 Qpbm = intern ("pbm"); 10418 Qpbm = intern ("pbm");
10434 staticpro (&Qpbm); 10419 staticpro (&Qpbm);
10435 10420