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

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


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

The following commit has been merged in the master branch:
commit 830206d630d70b0e3685ba8d18807de4425242ad
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Sat May 13 09:30:48 2006 +0000

    Tweaked TiffArrayEntry and TiffArrayElement in preparation for Minolta makernote support
---
 src/tiffcomposite.cpp |  9 -------
 src/tiffcomposite.hpp | 68 ++++++++++++++++++++++++++++++++++++++++++---------
 src/tiffparser.cpp    |  6 ++---
 src/tiffvisitor.cpp   | 21 +++++++++++-----
 4 files changed, 74 insertions(+), 30 deletions(-)

diff --git a/src/tiffcomposite.cpp b/src/tiffcomposite.cpp
index d868f6d..54f4467 100644
--- a/src/tiffcomposite.cpp
+++ b/src/tiffcomposite.cpp
@@ -259,15 +259,6 @@ namespace Exiv2 {
                                                       ts->newGroup_));
     }
 
-    TiffComponent::AutoPtr newTiffArrayEntry(uint16_t tag,
-                                             const TiffStructure* ts)
-    {
-        assert(ts);
-        return TiffComponent::AutoPtr(new TiffArrayEntry(tag,
-                                                         ts->group_,
-                                                         ts->newGroup_));
-    }
-
     TiffComponent::AutoPtr newTiffArrayElement(uint16_t tag,
                                                const TiffStructure* ts)
     {
diff --git a/src/tiffcomposite.hpp b/src/tiffcomposite.hpp
index 4494ece..840d0e6 100644
--- a/src/tiffcomposite.hpp
+++ b/src/tiffcomposite.hpp
@@ -471,26 +471,33 @@ namespace Exiv2 {
 
     /*!
       @brief Composite to model an array of tags, each consisting of one 
-             unsigned short value. Canon makernotes use such tags. The
-             elements of this component are usually of type TiffArrayElement.
-             If the type of the entry is not unsigned short, it degenerates 
-             to a standard TIFF entry.
+             unsigned short value. Canon and Minolta makernotes use such tags. 
+             The elements of this component are usually of type
+             TiffArrayElement.  If the type of the entry is not unsigned short,
+             it degenerates to a standard TIFF entry.
      */
     class TiffArrayEntry : public TiffEntryBase {
     public:
         //! @name Creators
         //@{
         //! Default constructor
-        TiffArrayEntry(uint16_t tag, uint16_t group, uint16_t elGroup)
-            : TiffEntryBase(tag, group), elGroup_(elGroup) {}
+        TiffArrayEntry(TypeId typeId, ByteOrder byteOrder, 
+                       uint16_t tag, uint16_t group, uint16_t elGroup)
+            : TiffEntryBase(tag, group), 
+              elTypeId_(typeId), elByteOrder_(byteOrder),
+              elGroup_(elGroup) {}
         //! Virtual destructor
         virtual ~TiffArrayEntry();
         //@}
 
         //! @name Accessors
         //@{
+        //! Return the type for the array elements
+        TypeId    elTypeId()    const { return elTypeId_; }
+        //! Return the byte order for reading and writing array elements
+        ByteOrder elByteOrder() const { return elByteOrder_; }
         //! Return the group for the array elements
-        uint16_t elGroup() const { return elGroup_; }
+        uint16_t  elGroup()     const { return elGroup_; }
         //@}
 
     private:
@@ -502,13 +509,16 @@ namespace Exiv2 {
 
     private:
         // DATA
-        uint16_t   elGroup_;  //!< Group for the elements
-        Components elements_; //!< List of elements in this composite
+        TypeId     elTypeId_;    //!< Type of the array elements
+        ByteOrder  elByteOrder_; //!< Byte order for reading/writing array elements
+        uint16_t   elGroup_;     //!< Group for the elements
+        Components elements_;    //!< List of elements in this composite
     }; // class TiffArrayEntry
 
     /*!
       @brief Element of a TiffArrayEntry. The value is exactly one unsigned
-             short component. Canon makernotes use arrays of such elements.
+             short component. Canon and Minolta makernotes use arrays of 
+             such elements.
      */
     class TiffArrayElement : public TiffEntryBase {
     public:
@@ -516,17 +526,36 @@ namespace Exiv2 {
         //@{
         //! Constructor
         TiffArrayElement(uint16_t tag, uint16_t group) 
-            : TiffEntryBase(tag, group) {}
+            : TiffEntryBase(tag, group),
+              elTypeId_(undefined), 
+              elByteOrder_(invalidByteOrder) {}
         //! Virtual destructor.
         virtual ~TiffArrayElement() {}
         //@}
 
+        //! @name Accessors
+        //@{
+        TypeId    elTypeId()    const { return elTypeId_; }
+        ByteOrder elByteOrder() const { return elByteOrder_; }
+        //@}
+
+        //! @name Manipulators
+        //@{
+        void setTypeId(TypeId typeId)          { elTypeId_ = typeId; }
+        void setByteOrder(ByteOrder byteOrder) { elByteOrder_ = byteOrder; }
+        //@}
+
     private:
         //! @name Manipulators
         //@{
         virtual void doAccept(TiffVisitor& visitor);
         //@}
 
+    private:
+        // DATA
+        TypeId    elTypeId_;      //!< Type of the element
+        ByteOrder elByteOrder_;   //!< Byte order to read/write the element 
+
     }; // class TiffArrayElement
 
 // *****************************************************************************
@@ -545,8 +574,23 @@ namespace Exiv2 {
                                           const TiffStructure* ts);
 
     //! Function to create and initialize a new array entry
+    template<TypeId typeId, ByteOrder byteOrder>
+    TiffComponent::AutoPtr newTiffArrayEntry(uint16_t tag,
+                                             const TiffStructure* ts)
+    {
+        assert(ts);
+        return TiffComponent::AutoPtr(
+            new TiffArrayEntry(typeId, byteOrder,
+                               tag, ts->group_, ts->newGroup_));
+    }
+
+    //! Function to create and initialize a new array entry
+    template<TypeId typeId>
     TiffComponent::AutoPtr newTiffArrayEntry(uint16_t tag,
-                                             const TiffStructure* ts);
+                                             const TiffStructure* ts)
+    {
+        return newTiffArrayEntry<typeId, invalidByteOrder>(tag, ts);
+    }
 
     //! Function to create and initialize a new array element
     TiffComponent::AutoPtr newTiffArrayElement(uint16_t tag,
diff --git a/src/tiffparser.cpp b/src/tiffparser.cpp
index ba7a3d4..74f964f 100644
--- a/src/tiffparser.cpp
+++ b/src/tiffparser.cpp
@@ -106,9 +106,9 @@ namespace Exiv2 {
         { Tag::next, Group::ifd1,    newTiffDirectory,    Group::ignr    },
         { Tag::next, Group::ignr,    newTiffDirectory,    Group::ignr    },
         // Canon makernote structure
-        {    0x0001, Group::canonmn, newTiffArrayEntry,   Group::canoncs },
-        {    0x0004, Group::canonmn, newTiffArrayEntry,   Group::canonsi },
-        {    0x000f, Group::canonmn, newTiffArrayEntry,   Group::canoncf },
+        {    0x0001, Group::canonmn, newTiffArrayEntry<unsignedShort>, Group::canoncs },
+        {    0x0004, Group::canonmn, newTiffArrayEntry<unsignedShort>, Group::canonsi },
+        {    0x000f, Group::canonmn, newTiffArrayEntry<unsignedShort>, Group::canoncf },
         {  Tag::all, Group::canoncs, newTiffArrayElement, Group::canoncs },
         {  Tag::all, Group::canonsi, newTiffArrayElement, Group::canonsi },
         {  Tag::all, Group::canoncf, newTiffArrayElement, Group::canoncf }
diff --git a/src/tiffvisitor.cpp b/src/tiffvisitor.cpp
index 0834345..f97d1eb 100644
--- a/src/tiffvisitor.cpp
+++ b/src/tiffvisitor.cpp
@@ -315,7 +315,9 @@ namespace Exiv2 {
             printTiffEntry(object, prefix());
         }
         else {
-            os_ << prefix() << "Array Entry " << object->groupName()
+            os_ << prefix() << "Array Entry ("
+                << TypeInfo::typeName(object->elTypeId()) << ")"
+                << object->groupName()
                 << " tag 0x" << std::setw(4) << std::setfill('0')
                 << std::hex << std::right << object->tag() << "
";
         }
@@ -682,12 +684,16 @@ namespace Exiv2 {
         assert(object != 0);
 
         readTiffEntry(object);
-        if (object->typeId() == unsignedShort) {
+        if (object->typeId() == object->elTypeId()) {
             for (uint16_t i = 0; i < static_cast<uint16_t>(object->count()); ++i) {
                 uint16_t tag = i;
                 TiffComponent::AutoPtr tc = create(tag, object->elGroup());
-                assert(tc.get());
-                tc->setStart(object->pData() + i * 2);
+                TiffArrayElement* p = dynamic_cast<TiffArrayElement*>(tc.get());
+                assert(p); // Fix TIFF structure table if this fails
+                p->setStart(  object->pData() 
+                            + i * TypeInfo::typeSize(object->elTypeId()));
+                p->setTypeId(object->elTypeId());
+                p->setByteOrder(object->elByteOrder());
                 object->addChild(tc);
             }
         }
@@ -709,14 +715,17 @@ namespace Exiv2 {
 #endif
             return;
         }
-        object->type_ = unsignedShort;
+        object->type_ = object->elTypeId();
         object->count_ = 1;
         object->size_ = TypeInfo::typeSize(object->typeId()) * object->count();
         object->offset_ = 0;
         object->pData_ = p;
         Value::AutoPtr v = Value::create(object->typeId());
         if (v.get()) {
-            v->read(object->pData(), object->size(), byteOrder());
+            ByteOrder b = 
+                object->elByteOrder() == invalidByteOrder ? 
+                byteOrder() : object->elByteOrder();
+            v->read(object->pData(), object->size(), b);
             object->pValue_ = v.release();
         }
 

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list