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

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


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

The following commit has been merged in the master branch:
commit 2ab82c4bc9e8cfdbef2c3fa706df807b92ece203
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Wed Dec 20 10:22:32 2006 +0000

    Fixed and tweaked IPTC decoding code for bug #502.
---
 src/tiffvisitor.cpp | 51 +++++++++++++++++++++++++++------------------------
 src/tiffvisitor.hpp | 13 +++++++++++++
 2 files changed, 40 insertions(+), 24 deletions(-)

diff --git a/src/tiffvisitor.cpp b/src/tiffvisitor.cpp
index d53e237..989a24f 100644
--- a/src/tiffvisitor.cpp
+++ b/src/tiffvisitor.cpp
@@ -186,6 +186,27 @@ namespace Exiv2 {
         }
     }
 
+    void TiffMetadataDecoder::getObjData(byte const*& pData,
+                                         long& size,
+                                         uint16_t tag,
+                                         uint16_t group,
+                                         const TiffEntryBase* object)
+    {
+        if (object && object->tag() == tag && object->group() == group) {
+            pData = object->pData();
+            size = object->size();
+            return;
+        }
+        TiffFinder finder(tag, group);
+        pRoot_->accept(finder);
+        TiffEntryBase const* te = dynamic_cast<TiffEntryBase*>(finder.result());
+        if (te) {
+            pData = te->pData();
+            size = te->size();
+            return;
+        }
+    }
+
     void TiffMetadataDecoder::decodeIptc(const TiffEntryBase* object)
     {
         // add Exif tag anyway
@@ -200,19 +221,7 @@ namespace Exiv2 {
         // 1st choice: IPTCNAA
         byte const* pData = 0;
         long size = 0;
-        if (object->tag() == 0x83bb) {
-            pData = object->pData();
-            size = object->size();
-        }
-        if (pData == 0) {
-            TiffFinder finder(0x83bb, Group::ifd0);
-            pRoot_->accept(finder);
-            TiffEntryBase* te = dynamic_cast<TiffEntryBase*>(finder.result());
-            if (te) {
-                pData = te->pData();
-                size = te->size();
-            }
-        }
+        getObjData(pData, size, 0x83bb, Group::ifd0, object);
         if (pData) {
             if (0 == pImage_->iptcData().load(pData, size)) {
                 return;
@@ -227,20 +236,14 @@ namespace Exiv2 {
 
         // 2nd choice if no IPTCNAA record found or failed to decode it:
         // ImageResources
-        TiffEntryBase const* te = 0;
-        if (object->tag() == 0x8649) {
-            te = object;
-        }
-        else {
-            TiffFinder finder(0x83bb, Group::ifd0);
-            pRoot_->accept(finder);
-            te = dynamic_cast<TiffEntryBase*>(finder.result());
-        }
-        if (te) {
+        pData = 0;
+        size = 0;
+        getObjData(pData, size, 0x8649, Group::ifd0, object);
+        if (pData) {
             byte const* record = 0;
             uint32_t sizeHdr = 0;
             uint32_t sizeData = 0;
-            if (0 != Photoshop::locateIptcIrb(te->pData(), te->size(), 
+            if (0 != Photoshop::locateIptcIrb(pData, size, 
                                               &record, &sizeHdr, &sizeData)) {
                 return;
             }
diff --git a/src/tiffvisitor.hpp b/src/tiffvisitor.hpp
index c9c348a..fa425f7 100644
--- a/src/tiffvisitor.hpp
+++ b/src/tiffvisitor.hpp
@@ -251,6 +251,19 @@ namespace Exiv2 {
     private:
         //! Set an Exif tag in the image. Overwrites existing tags
         void setExifTag(const ExifKey& key, const Value* pValue);
+        /*!
+          @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 
+                 in the hierarchy.
+
+          Populates \em pData and \em size with the result. If no matching 
+          element is found the function leaves both of these parameters unchanged.
+        */
+        void getObjData(byte const*&         pData,
+                        long&                size,
+                        uint16_t             tag,
+                        uint16_t             group,
+                        const TiffEntryBase* object);
 
         // DATA
         Image* pImage_;              //!< Pointer to the image to which the metadata is added

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list