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

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


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

The following commit has been merged in the master branch:
commit a8aea29b5a48fa95d6894a09e58e27df381b1ba8
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Sat Jun 28 11:18:37 2008 +0000

    Fixed reading duplicate tags (barely tested).
---
 src/tiffvisitor.cpp     | 41 +++++++++++++++++++++++++++++------------
 src/tiffvisitor_int.hpp |  7 +++++--
 2 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/src/tiffvisitor.cpp b/src/tiffvisitor.cpp
index fdf490b..502c40d 100644
--- a/src/tiffvisitor.cpp
+++ b/src/tiffvisitor.cpp
@@ -52,6 +52,7 @@ EXIV2_RCSID("@(#) $Id$")
 #include <iostream>
 #include <iomanip>
 #include <cassert>
+#include <set>
 
 // *****************************************************************************
 // class member definitions
@@ -340,7 +341,7 @@ namespace Exiv2 {
         // Todo: ExifKey should have an appropriate c'tor, it should not be
         //       necessary to use groupName here
         ExifKey key(object->tag(), tiffGroupName(Group::ifd0));
-        setExifTag(key, object->pValue());
+        setExifTag(key, object->pValue(), pvHigh);
 
     }
 
@@ -365,22 +366,38 @@ namespace Exiv2 {
     void TiffDecoder::decodeStdTiffEntry(const TiffEntryBase* object)
     {
         assert(object !=0);
-        // "Normal" tag has low priority: only decode if it doesn't exist yet.
-        // Todo: This also filters duplicates (common in some makernotes)
         // Todo: ExifKey should have an appropriate c'tor, it should not be
         //       necessary to use groupName here
         ExifKey key(object->tag(), tiffGroupName(object->group()));
-        ExifData::iterator pos = exifData_.findKey(key);
-        if (pos == exifData_.end()) {
-            exifData_.add(key, object->pValue());
-        }
+        setExifTag(key, object->pValue(), pvNormal);
+
     } // TiffDecoder::decodeTiffEntry
 
-    void TiffDecoder::setExifTag(const ExifKey& key, const Value* pValue)
-    {
-        ExifData::iterator pos = exifData_.findKey(key);
-        if (pos != exifData_.end()) exifData_.erase(pos);
-        exifData_.add(key, pValue);
+    void TiffDecoder::setExifTag(const ExifKey& key, const Value* pValue, Prio prio)
+    {
+        typedef std::set<std::string> PriorityKeys;
+        static PriorityKeys priorityKeys;
+
+        bool isRegPrioTag = (priorityKeys.find(key.key()) != priorityKeys.end());
+
+        switch (prio) {
+        case pvNormal:
+            // If key is not registered as high prio tag, add it
+            if (!isRegPrioTag) exifData_.add(key, pValue);
+            break;
+        case pvHigh:
+            // Register the key as a high prio tag, erase low prio tags, add this
+            if (!isRegPrioTag) {
+                priorityKeys.insert(key.key());
+                ExifData::iterator pos = exifData_.findKey(key);
+                while (pos != exifData_.end()) {
+                    exifData_.erase(pos);
+                    pos = exifData_.findKey(key);
+                }
+            }
+            exifData_.add(key, pValue);
+            break;
+        }
 
     } // TiffDecoder::setExifTag
 
diff --git a/src/tiffvisitor_int.hpp b/src/tiffvisitor_int.hpp
index 60f0553..20ba36c 100644
--- a/src/tiffvisitor_int.hpp
+++ b/src/tiffvisitor_int.hpp
@@ -271,10 +271,13 @@ namespace Exiv2 {
         //@}
 
     private:
+        //! Tag priorities
+        enum Prio { pvNormal, pvHigh };
+
         //! @name Manipulators
         //@{
-        //! Set an Exif tag in the image. Overwrites existing tags
-        void setExifTag(const ExifKey& key, const Value* pValue);
+        //! Set an Exif tag in the image.
+        void setExifTag(const ExifKey& key, const Value* pValue, Prio prio);
         /*!
           @brief Get the data for a \em tag and \em group, either from the
                  \em object provided, if it matches or from the matching element

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list