]> code.delx.au - gnu-emacs/blobdiff - lisp/image.el
Improve regex to not trigger stack overflow
[gnu-emacs] / lisp / image.el
index 1c268c4fb08dc76051d6498ccb52afe2dc6ea5d7..4ee22b580e6cb0bceeb96838a9e5ba015ab36775 100644 (file)
@@ -34,7 +34,7 @@
 
 (defconst image-type-header-regexps
   `(("\\`/[\t\n\r ]*\\*.*XPM.\\*/" . xpm)
-    ("\\`P[1-6]\\\(?:\
+    ("\\`P[1-6]\\(?:\
 \\(?:\\(?:#[^\r\n]*[\r\n]\\)?[[:space:]]\\)+\
 \\(?:\\(?:#[^\r\n]*[\r\n]\\)?[0-9]\\)+\
 \\)\\{2\\}" . pbm)
@@ -154,7 +154,7 @@ compatibility with versions of Emacs that lack the variable
 
     (let* ((load-path (image-load-path-for-library \"mh-e\" \"mh-logo.xpm\"))
            (image-load-path (cons (car load-path)
-                                  (when (boundp 'image-load-path)
+                                  (when (boundp \\='image-load-path)
                                     image-load-path))))
       (mh-tool-bar-folder-buttons-init))"
   (unless library (error "No library specified"))
@@ -343,7 +343,7 @@ of image data.  If that doesn't work, and SOURCE is a file name,
 use its file extension as image type.
 Optional DATA-P non-nil means SOURCE is a string containing image data."
   (when (and (not data-p) (not (stringp source)))
-    (error "Invalid image file name ā€˜%sā€™" source))
+    (error "Invalid image file name `%s'" source))
   (unless type
     (setq type (if data-p
                   (image-type-from-data source)
@@ -351,13 +351,13 @@ Optional DATA-P non-nil means SOURCE is a string containing image data."
                     (image-type-from-file-name source))))
     (or type (error "Cannot determine image type")))
   (or (memq type (and (boundp 'image-types) image-types))
-      (error "Invalid image type ā€˜%sā€™" type))
+      (error "Invalid image type `%s'" type))
   type)
 
 
 (if (fboundp 'image-metadata)           ; eg not --without-x
     (define-obsolete-function-alias 'image-extension-data
-      'image-metadata' "24.1"))
+      'image-metadata "24.1"))
 
 (define-obsolete-variable-alias
     'image-library-alist
@@ -735,7 +735,7 @@ for the animation speed.  A negative value means to animate in reverse."
           ;; Subtract off the time we took to load the image from the
           ;; stated delay time.
           (delay (max (+ (* (or (cdr animation) image-default-frame-delay)
-                            (/ 1 (abs speed)))
+                            (/ 1.0 (abs speed)))
                          time (- (float-time)))
                       image-minimum-frame-delay))
           done)