emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 2a0740b95a 4/5: lisp/thumbs.el: Fix calling the "convert" command


From: Lars Ingebrigtsen
Subject: master 2a0740b95a 4/5: lisp/thumbs.el: Fix calling the "convert" command
Date: Mon, 4 Jul 2022 07:08:47 -0400 (EDT)

branch: master
commit 2a0740b95af87167c2954d7106dc0dc4143a31ca
Author: Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    lisp/thumbs.el: Fix calling the "convert" command
    
    * lisp/thumbs.el (thumbs-call-convert): Pass 'action-prefix' and
    'action' as a combined parameter.  Do not pass 'arg' if it is nil.
    (thumbs-modify-image): Do not pass "" as 'arg' to
    'thumbs-call-convert' (bug#56375).
    
    Some time in the past this was converted from using the shell to
    passing the parameters directly, but the fallout was not handled
    correctly.
---
 lisp/thumbs.el | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/lisp/thumbs.el b/lisp/thumbs.el
index 3bf08dd6a5..e622bcedc4 100644
--- a/lisp/thumbs.el
+++ b/lisp/thumbs.el
@@ -215,16 +215,17 @@ FILEIN is the input file,
 FILEOUT is the output file,
 ACTION is the command to send to convert.
 Optional arguments are:
-ARG any arguments to the ACTION command,
+ARG if non-nil, the argument of the ACTION command,
 OUTPUT-FORMAT is the file format to output (default is jpeg),
 ACTION-PREFIX is the symbol to place before the ACTION command
               (defaults to `-' but can sometimes be `+')."
-  (call-process thumbs-conversion-program nil nil nil
-               (or action-prefix "-")
-               action
-               (or arg "")
-               filein
-               (format "%s:%s" (or output-format "jpeg") fileout)))
+  (let ((action-param (concat (or action-prefix "-") action))
+       (fileout-param (format "%s:%s" (or output-format "jpeg") fileout)))
+    (if arg
+       (call-process thumbs-conversion-program nil nil nil
+                     action-param arg filein fileout-param)
+      (call-process thumbs-conversion-program nil nil nil
+                   action-param filein fileout-param))))
 
 (defun thumbs-new-image-size (s increment)
   "New image (a cons of width x height)."
@@ -610,7 +611,7 @@ ACTION and ARG should be a valid convert command."
     (thumbs-call-convert (or old thumbs-current-image-filename)
                         tmp
                         action
-                        (or arg ""))
+                        arg)
     (save-excursion
       (thumbs-insert-image tmp 'jpeg 0))
     (setq thumbs-current-tmp-filename tmp)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]