summaryrefslogtreecommitdiff
path: root/lisp/image/exif.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2023-01-03 14:03:58 +0100
committerMattias EngdegÄrd <mattiase@acm.org>2023-01-03 14:03:58 +0100
commit0bece4d33f6b1c9de573cc6457ae851bde1958a4 (patch)
treead455b03a2849156db7186406bc037ce41741f53 /lisp/image/exif.el
parentb5b6159d036fd167c6cab21532c2fdd587051d28 (diff)
downloademacs-0bece4d33f6b1c9de573cc6457ae851bde1958a4.tar.gz
Data argument to `signal` should be a list
* lisp/calendar/iso8601.el (iso8601-parse, iso8601-parse-date) (iso8601-parse-time, iso8601-parse-zone, iso8601-parse-duration) (iso8601-parse-interval): * lisp/emacs-lisp/cl-lib.el (cl-values-list): * lisp/emacs-lisp/comp.el (comp-decrypt-arg-list) (comp-spill-lap-function, comp-emit-switch) (comp-compute-dominator-tree, comp-final): * lisp/image.el (image-type): * lisp/image/exif.el (exif--parse-jpeg, exif--parse-exif-chunk) (exif--parse-directory, exif--read-chunk, exif--read-number-be) (exif--read-number-le): * lisp/vc/vc.el (vc-default-last-change): Wrap obvious non-list data arguments to `signal` in a list.
Diffstat (limited to 'lisp/image/exif.el')
-rw-r--r--lisp/image/exif.el21
1 files changed, 11 insertions, 10 deletions
diff --git a/lisp/image/exif.el b/lisp/image/exif.el
index c561ea729af..50428c3a31a 100644
--- a/lisp/image/exif.el
+++ b/lisp/image/exif.el
@@ -151,7 +151,7 @@ If the orientation isn't present in the data, return nil."
(defun exif--parse-jpeg ()
(unless (= (exif--read-number-be 2) #xffd8) ; SOI (start of image)
- (signal 'exif-error "Not a valid JPEG file"))
+ (signal 'exif-error '("Not a valid JPEG file")))
(cl-loop for segment = (exif--read-number-be 2)
for size = (exif--read-number-be 2)
;; Stop parsing when we get to SOS (start of stream);
@@ -168,7 +168,7 @@ If the orientation isn't present in the data, return nil."
;; The Exif data is in the APP1 JPEG chunk and starts with
;; "Exif\0\0".
(unless (equal (exif--read-chunk 6) (string ?E ?x ?i ?f ?\0 ?\0))
- (signal 'exif-error "Not a valid Exif chunk"))
+ (signal 'exif-error '("Not a valid Exif chunk")))
(delete-region (point-min) (point))
(let* ((endian-marker (exif--read-chunk 2))
(le (cond
@@ -180,14 +180,15 @@ If the orientation isn't present in the data, return nil."
t)
(t
(signal 'exif-error
- (format "Invalid endian-ness %s" endian-marker))))))
+ (list (format "Invalid endian-ness %s"
+ endian-marker)))))))
;; Another magical number.
(unless (= (exif--read-number 2 le) #x002a)
- (signal 'exif-error "Invalid TIFF header length"))
+ (signal 'exif-error '("Invalid TIFF header length")))
(let ((offset (exif--read-number 4 le)))
;; Jump to where the IFD (directory) starts and parse it.
(when (> (1+ offset) (point-max))
- (signal 'exif-error "Invalid IFD (directory) offset"))
+ (signal 'exif-error '("Invalid IFD (directory) offset")))
(goto-char (1+ offset))
(exif--parse-directory le)))))
@@ -230,7 +231,7 @@ If the orientation isn't present in the data, return nil."
(when (> (+ (1+ value) length)
(point-max))
(signal 'exif-error
- "Premature end of file"))
+ '("Premature end of file")))
(buffer-substring
(1+ value)
(+ (1+ value) length)))
@@ -248,7 +249,7 @@ If the orientation isn't present in the data, return nil."
;; keep parsing.
(progn
(when (> (1+ next) (point-max))
- (signal 'exif-error "Invalid IFD (directory) next-offset"))
+ (signal 'exif-error '("Invalid IFD (directory) next-offset")))
(goto-char (1+ next))
(nconc dir (exif--parse-directory le)))
;; We've reached the end of the directories.
@@ -283,7 +284,7 @@ VALUE is an integer representing BYTES characters."
(defun exif--read-chunk (bytes)
"Return BYTES octets from the buffer and advance point that much."
(when (> (+ (point) bytes) (point-max))
- (signal 'exif-error "Premature end of file"))
+ (signal 'exif-error '("Premature end of file")))
(prog1
(buffer-substring (point) (+ (point) bytes))
(forward-char bytes)))
@@ -292,7 +293,7 @@ VALUE is an integer representing BYTES characters."
"Read BYTES octets from the buffer as a chunk of big-endian bytes.
Advance point to after the read bytes."
(when (> (+ (point) bytes) (point-max))
- (signal 'exif-error "Premature end of file"))
+ (signal 'exif-error '("Premature end of file")))
(let ((sum 0))
(dotimes (_ bytes)
(setq sum (+ (* sum 256) (following-char)))
@@ -303,7 +304,7 @@ Advance point to after the read bytes."
"Read BYTES octets from the buffer as a chunk of low-endian bytes.
Advance point to after the read bytes."
(when (> (+ (point) bytes) (point-max))
- (signal 'exif-error "Premature end of file"))
+ (signal 'exif-error '("Premature end of file")))
(let ((sum 0))
(dotimes (i bytes)
(setq sum (+ (* (following-char) (expt 256 i)) sum))