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

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:46:51 UTC 2017


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

The following commit has been merged in the master branch:
commit b5bc66b36ac34aad9c45c43b1bf6485436602423
Author: Robin Mills <robin at clanmills.com>
Date:   Tue Sep 6 13:38:18 2016 +0000

    #1057 Added support for -iXX-
---
 src/actions.cpp | 33 ++++++++++++++++++++-------------
 src/actions.hpp | 13 ++++++++-----
 2 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/src/actions.cpp b/src/actions.cpp
index d13f7e6..1f8b016 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -1250,6 +1250,12 @@ namespace Action {
         if (Params::instance().target_ & Params::ctThumb) {
             rc = insertThumbnail(path);
         }
+
+        // -i{tgt}-  reading from stdin?
+        Exiv2::DataBuf stdIn;
+        bool          bStdin = Params::instance().target_ | Params::ctStdInOut;
+        if ( bStdin ) Params::instance().getStdin(stdIn);
+
         if (  rc == 0 && !(Params::instance().target_ & Params::ctXmpRaw)
         && (  Params::instance().target_ & Params::ctExif
            || Params::instance().target_ & Params::ctIptc
@@ -1263,20 +1269,16 @@ namespace Action {
             std::string exvPath = newFilePath(path, suffix);
             rc = metacopy(exvPath, path, Exiv2::ImageType::none, true);
         }
+
         if (0 == rc && (Params::instance().target_ & (Params::ctXmpSidecar|Params::ctXmpRaw)) ) {
             std::string xmpPath = newFilePath(path,".xmp");
-            rc = insertXmpPacket(xmpPath,path);
+            rc = bStdin ? insertXmpPacket(path,stdIn) : insertXmpPacket(path,xmpPath);
         }
+
         if (0 == rc && Params::instance().target_ & Params::ctIccProfile) {
-            Exiv2::DataBuf profile;
-            if ( Params::instance().target_ | Params::ctStdInOut ) {
-                Exiv2::DataBuf profile;
-                Params::instance().getStdin(profile);
-                rc = insertIccProfile(path,profile) ;
-            } else {
-                rc = insertIccProfile(path) ;
-            }
+            rc = bStdin ? insertIccProfile(path,stdIn): insertIccProfile(path);
         }
+
         if (Params::instance().preserve_) {
             ts.touch(path);
         }
@@ -1289,7 +1291,7 @@ namespace Action {
         return 1;
     } // Insert::run
 
-    int Insert::insertXmpPacket(const std::string& xmpPath,const std::string& path) const
+    int Insert::insertXmpPacket(const std::string& path,const std::string& xmpPath) const
     {
         if (!Exiv2::fileExists(xmpPath, true)) {
             std::cerr << xmpPath
@@ -1301,10 +1303,15 @@ namespace Action {
                       << ": " << _("Failed to open the file
");
             return -1;
         }
-        Exiv2::DataBuf buf = Exiv2::readFile(xmpPath);
+        Exiv2::DataBuf xmpBlob = Exiv2::readFile(xmpPath);
+        return insertXmpPacket(path,xmpBlob);
+    }
+
+    int Insert::insertXmpPacket(const std::string& path,const Exiv2::DataBuf& xmpBlob) const
+    {
         std::string xmpPacket;
-        for ( long i = 0 ; i < buf.size_ ; i++ ) {
-            xmpPacket += (char) buf.pData_[i];
+        for ( long i = 0 ; i < xmpBlob.size_ ; i++ ) {
+            xmpPacket += (char) xmpBlob.pData_[i];
         }
         Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path);
         assert(image.get() != 0);
diff --git a/src/actions.hpp b/src/actions.hpp
index 557893c..42adfb4 100644
--- a/src/actions.hpp
+++ b/src/actions.hpp
@@ -345,19 +345,22 @@ namespace Action {
                  filename (\em path) minus its suffix plus "-thumb.jpg".
          */
         int insertThumbnail(const std::string& path) const;
+
         /*!
-          @brief Insert an XMP packet from a file into file \em path.
-                 The filename of the XMP packet is expected to be the image
-                 filename (\em path) minus its suffix plus ".xmp".
+          @brief Insert an XMP packet from a xmpPath into file \em path.
          */
-        int insertXmpPacket(const std::string& xmpPath,const std::string& path) const;
+        int insertXmpPacket(const std::string& path,const std::string& xmpPath) const;
+        /*!
+          @brief Insert xmp from a DataBuf into file \em path.
+         */
+        int insertXmpPacket(const std::string& path,const Exiv2::DataBuf& xmpBlob) const;
+
         /*!
           @brief Insert an ICC profile from a file into file \em path.
                  The filename of the ICC profile is expected to be the image
                  filename (\em path) minus its suffix plus ".icc".
          */
         int insertIccProfile(const std::string& path) const;
-
         /*!
           @brief Insert an ICC profile from binary DataBuf into file \em path.
          */

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list