[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:36:52 UTC 2017


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=861684e

The following commit has been merged in the master branch:
commit 861684eb2c440d91962c1a5b370b96c2969a1e61
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Sun Dec 12 09:10:19 2004 +0000

    Added preserve flag to metacopy (after all) to make insert and extract work more predictably
---
 src/actions.cpp | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/src/actions.cpp b/src/actions.cpp
index d96cf21..758dc72 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -85,9 +85,13 @@ namespace {
       @param source Source file path
       @param target Target file path. An *.exv file is created if target doesn't
                     exist.
+      @param preserve Indicates if existing metadata in the target file should 
+                    be kept.
       @return 0 if successful, else an error code
     */
-    int metacopy(const std::string& source, const std::string& target);
+    int metacopy(const std::string& source, 
+                 const std::string& target, 
+                 bool preserve);
 }
 
 // *****************************************************************************
@@ -797,7 +801,7 @@ namespace Action {
                 std::cin >> s;
                 if (s[0] != 'y' && s[0] != 'Y') return 0;
             }
-            rc = metacopy(path_, exvPath);
+            rc = metacopy(path_, exvPath, false);
         }
         return rc;
     }
@@ -857,6 +861,11 @@ namespace Action {
 
     int Insert::run(const std::string& path)
     try {
+        if (!Util::fileExists(path, true)) {
+            std::cerr << path
+                      << ": Failed to open the file
";
+            return -1;
+        }
         int rc = 0;
         if (Params::instance().target_ & Params::ctThumb) {
             rc = insertThumbnail(path);
@@ -867,7 +876,7 @@ namespace Action {
             || Params::instance().target_ & Params::ctComment) {
             std::string exvPath =   Util::dirname(path) + SEPERATOR_STR
                                   + Util::basename(path, true) + ".exv";
-            rc = metacopy(exvPath, path);
+            rc = metacopy(exvPath, path, true);
         }
         return rc;
     }
@@ -1038,7 +1047,9 @@ namespace {
         return os.str();
     } // time2Str
 
-    int metacopy(const std::string& source, const std::string& target) 
+    int metacopy(const std::string& source, 
+                 const std::string& target, 
+                 bool preserve) 
     {
         if (!Util::fileExists(source, true)) {
             std::cerr << source
@@ -1060,6 +1071,13 @@ namespace {
         }
         Exiv2::Image::AutoPtr targetImage 
             = Exiv2::ImageFactory::instance().open(target);
+        if (preserve && targetImage.get() != 0) {
+            if (targetImage->readMetadata()) {
+                std::cerr << target
+                          << ": Could not read metadata
";
+                return 1;
+            }
+        }
         if (targetImage.get() == 0) {
             targetImage 
                 = Exiv2::ImageFactory::instance().create(Exiv2::Image::exv, target);

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list