comparison lisp/image.el @ 96253:1c3bafe6e816

(image-jpeg-p): Convert DATA to unibyte at first.
author Kenichi Handa <handa@m17n.org>
date Wed, 25 Jun 2008 02:48:03 +0000
parents b4e36ff621b3
children 044f3969e191
comparison
equal deleted inserted replaced
96252:8c22ce277d5d 96253:1c3bafe6e816
206 206
207 207
208 (defun image-jpeg-p (data) 208 (defun image-jpeg-p (data)
209 "Value is non-nil if DATA, a string, consists of JFIF image data. 209 "Value is non-nil if DATA, a string, consists of JFIF image data.
210 We accept the tag Exif because that is the same format." 210 We accept the tag Exif because that is the same format."
211 (setq data (string-to-unibyte data))
211 (when (string-match "\\`\xff\xd8" data) 212 (when (string-match "\\`\xff\xd8" data)
212 (catch 'jfif 213 (catch 'jfif
213 (let ((len (length data)) (i 2)) 214 (let ((len (length data)) (i 2))
214 (while (< i len) 215 (while (< i len)
215 (when (/= (aref data i) #xff) 216 (when (/= (aref data i) #xff)