]> code.delx.au - gnu-emacs/blobdiff - lisp/image.el
File regenerated.
[gnu-emacs] / lisp / image.el
index 9603f1ea95cd761661fe79709e60a27f215c1d53..e4c2387d78e3a86b0e89fd74d1ae211bebe16b55 100644 (file)
 
 
 (defconst image-type-regexps
-  '(("\\`/\\*.*XPM.\\*/" . xpm)
+  '(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm)
     ("\\`P[1-6]" . pbm)
     ("\\`GIF8" . gif)
     ("\\`\211PNG\r\n" . png)
-    ("\\`#define" . xbm)
-    ("\\`\\(MM\0\\*\\)\\|\\(II\\*\0\\)" . tiff)
-    ("\\`%!PS" . postscript)
+    ("\\`[\t\n\r ]*#define" . xbm)
+    ("\\`\\(MM\0\\*\\|II\\*\0\\)" . tiff)
+    ("\\`[\t\n\r ]*%!PS" . postscript)
     ("\\`\xff\xd8" . (image-jpeg-p . jpeg)))
   "Alist of (REGEXP . IMAGE-TYPE) pairs used to auto-detect image types.
 When the first bytes of an image file match REGEXP, it is assumed to
@@ -59,12 +59,13 @@ a non-nil value, TYPE is the image's type ")
          (when (>= (+ i 2) len)
            (throw 'jfif nil))
          (let ((nbytes (+ (lsh (aref data (+ i 1)) 8)
-                          (aref data (+ i 2)))))
-           (when (= (aref data i) #xe0)
+                          (aref data (+ i 2))))
+               (code (aref data i)))
+           (when (and (>= code #xe0) (<= code #xef))
              ;; APP0 LEN1 LEN2 "JFIF\0"
-             (throw 'jfif (string-match "\\`\xe0..JFIF\0" 
-                                        (substring data i (+ i 10)))))
-           (setq i (+ i nbytes))))))))
+             (throw 'jfif 
+                    (string-match "JFIF" (substring data i (+ i nbytes)))))
+           (setq i (+ i nbytes))))))))
 
 
 ;;;###autoload