[gimp-perl] Avoid 5.21 sprintf warnings if no %d



commit 7c70d220c22ac226da32d7650ead124197aa6f10
Author: Ed J <edj src gnome org>
Date:   Thu Nov 20 01:46:41 2014 +0000

    Avoid 5.21 sprintf warnings if no %d

 Gimp/Fu.pm |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/Gimp/Fu.pm b/Gimp/Fu.pm
index 8814821..f99342b 100644
--- a/Gimp/Fu.pm
+++ b/Gimp/Fu.pm
@@ -242,14 +242,17 @@ Gimp::on_net {
       my @images = grep { defined $_ and ref $_ eq "Gimp::Image" } @retvals;
       if (@images) {
         for my $i (0..$#images) {
-           my $path = sprintf $outputfile, $i;
+           my $path = $outputfile =~ /%d/
+              ? sprintf $outputfile, $i : $outputfile;
            if (@images > 1 and $path eq $outputfile) {
               $path=~s/\.(?=[^.]*$)/$i./; # insert number before last dot
            }
            save_image($images[$i],$path);
         }
       } elsif ($input_image) {
-        save_image($input_image, sprintf $outputfile, 0);
+        my $path = $outputfile =~ /%d/
+           ? sprintf $outputfile, 0 : $outputfile;
+        save_image($input_image, $path);
       } else {
         die "$0: outputfile specified but plugin returned no image and no input image\n" unless $menupath =~ 
/^<Toolbox>/;
       }


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