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

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:45:38 UTC 2017


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

The following commit has been merged in the master branch:
commit 983b10770189f9cef4e7c835985dbed61c033879
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Thu Aug 27 09:12:40 2015 +0000

    #917: Tweaks to the utility -p<x> return codes and info messages.
---
 src/actions.cpp | 48 +++++++++++++++++++++++++++++-------------------
 src/actions.hpp |  4 ++--
 2 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/src/actions.cpp b/src/actions.cpp
index 2cb69aa..a47b947 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -530,40 +530,49 @@ namespace Action {
 
     int Print::printMetadata(const Exiv2::Image* image)
     {
-        std::string sMissing;
+        bool ret = false;
+        bool noExif = false;
         if (Params::instance().printTags_ & Exiv2::mdExif) {
             const Exiv2::ExifData& exifData = image->exifData();
             for (Exiv2::ExifData::const_iterator md = exifData.begin();
                  md != exifData.end(); ++md) {
-                printMetadatum(*md, image);
+                ret |= printMetadatum(*md, image);
             }
-            if (exifData.empty()) sMissing = "Exif" ;
+            if (exifData.empty()) noExif = true;
         }
 
+        bool noIptc = false;
         if (Params::instance().printTags_ & Exiv2::mdIptc) {
             const Exiv2::IptcData& iptcData = image->iptcData();
             for (Exiv2::IptcData::const_iterator md = iptcData.begin();
                  md != iptcData.end(); ++md) {
-                printMetadatum(*md, image);
+                ret |= printMetadatum(*md, image);
             }
-            if (iptcData.empty()) sMissing = "IPTC" ;
+            if (iptcData.empty()) noIptc = true;
         }
 
+        bool noXmp = false;
         if (Params::instance().printTags_ & Exiv2::mdXmp) {
             const Exiv2::XmpData& xmpData = image->xmpData();
             for (Exiv2::XmpData::const_iterator md = xmpData.begin();
                  md != xmpData.end(); ++md) {
-                printMetadatum(*md, image);
+                ret |= printMetadatum(*md, image);
             }
-            if (xmpData.empty()) sMissing = "XMP" ;
+            if (xmpData.empty()) noXmp = true;
         }
 
-        bool bTagFilterGiven = !Params::instance().greps_.empty();  // were tag filters given with -g?
-        int  result = ( sMissing.empty() || bTagFilterGiven ) ? 0 : -3;
-        if ( result ) {
-            std::cerr << path_ << ": " << "(No " << sMissing << " data found in the file)
";
+        // With -v, inform about the absence of any (requested) type of metadata
+        if (Params::instance().verbose_) {
+            if (noExif) std::cerr << path_ << ": " << _("No Exif data found in the file
");
+            if (noIptc) std::cerr << path_ << ": " << _("No IPTC data found in the file
");
+            if (noXmp)  std::cerr << path_ << ": " << _("No XMP data found in the file
");
         }
-        return result;
+
+        // With -g or -K, return -3 if no matching tags were found
+        int rc = 0;
+        if ((!Params::instance().greps_.empty() || !Params::instance().keys_.empty()) && !ret) rc = 1;
+
+        return rc;
     } // Print::printMetadata
 
     bool Print::grepTag(const std::string& key)
@@ -592,14 +601,14 @@ namespace Action {
         return result ;
     }
 
-    void Print::printMetadatum(const Exiv2::Metadatum& md, const Exiv2::Image* pImage)
+    bool Print::printMetadatum(const Exiv2::Metadatum& md, const Exiv2::Image* pImage)
     {
-        if (!grepTag(md.key())) return;
-        if (!keyTag (md.key())) return;
+        if (!grepTag(md.key())) return false;
+        if (!keyTag (md.key())) return false;
 
         if (   Params::instance().unknown_
             && md.tagName().substr(0, 2) == "0x") {
-            return;
+            return false;
         }
         bool const manyFiles = Params::instance().files_.size() > 1;
         if (manyFiles) {
@@ -675,7 +684,7 @@ namespace Action {
                     || md.typeId() == Exiv2::signedByte)
                 && md.size() > 128) {
                 std::cout << _("(Binary value suppressed)") << std::endl;
-                return;
+                return true;
             }
             bool done = false;
             if (0 == strcmp(md.key().c_str(), "Exif.Photo.UserComment")) {
@@ -700,7 +709,7 @@ namespace Action {
                     || md.typeId() == Exiv2::signedByte)
                 && md.size() > 128) {
                 std::cout << _("(Binary value suppressed)") << std::endl;
-                return;
+                return true;
             }
             bool done = false;
             if (0 == strcmp(md.key().c_str(), "Exif.Photo.UserComment")) {
@@ -721,13 +730,14 @@ namespace Action {
                     || md.typeId() == Exiv2::signedByte)
                 && md.size() > 128) {
                 std::cout << _("(Binary value suppressed)") << std::endl;
-                return;
+                return true;
             }
             Exiv2::DataBuf buf(md.size());
             md.copy(buf.pData_, pImage->byteOrder());
             Exiv2::hexdump(std::cout, buf.pData_, buf.size_);
         }
         std::cout << std::endl;
+        return true;
     } // Print::printMetadatum
 
     int Print::printComment()
diff --git a/src/actions.hpp b/src/actions.hpp
index 8970092..be2cab2 100644
--- a/src/actions.hpp
+++ b/src/actions.hpp
@@ -176,8 +176,8 @@ namespace Action {
         bool keyTag(const std::string& key);
         //! Print all metadata in a user defined format
         int printMetadata(const Exiv2::Image* image);
-        //! Print a metadatum in a user defined format
-        void printMetadatum(const Exiv2::Metadatum& md, const Exiv2::Image* image);
+        //! Print a metadatum in a user defined format, return true if something was printed
+        bool printMetadatum(const Exiv2::Metadatum& md, const Exiv2::Image* image);
         //! Print the label for a summary line
         void printLabel(const std::string& label) const;
         //! Print image Structure information

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list