[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:04 UTC 2017


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

The following commit has been merged in the master branch:
commit 2347ae9e0a805f71e49373322a38e90248060343
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Sat Mar 19 10:59:49 2005 +0000

    Cleaned up exif.hpp dependencies
---
 src/actions.hpp       |  1 +
 src/dataarea-test.cpp |  1 +
 src/exif.cpp          | 47 +++++++++++++++++++++++++++++++++--------------
 src/exif.hpp          | 11 ++++++-----
 4 files changed, 41 insertions(+), 19 deletions(-)

diff --git a/src/actions.hpp b/src/actions.hpp
index 33c2ee8..511eaf4 100644
--- a/src/actions.hpp
+++ b/src/actions.hpp
@@ -38,6 +38,7 @@
 #include <map>
 
 #include "exiv2.hpp"
+#include "image.hpp"
 #include "exif.hpp"
 #include "iptc.hpp"
 
diff --git a/src/dataarea-test.cpp b/src/dataarea-test.cpp
index 2352978..b36ee47 100644
--- a/src/dataarea-test.cpp
+++ b/src/dataarea-test.cpp
@@ -10,6 +10,7 @@
  */
 // *****************************************************************************
 // included header files
+#include "image.hpp"
 #include "exif.hpp"
 #include <iostream>
 #include <iomanip>
diff --git a/src/exif.cpp b/src/exif.cpp
index f257299..6fb6987 100644
--- a/src/exif.cpp
+++ b/src/exif.cpp
@@ -306,13 +306,14 @@ namespace Exiv2 {
     }
 
     ExifData::ExifData() 
-        : pIfd0_(0), pExifIfd_(0), pIopIfd_(0), pGpsIfd_(0), pIfd1_(0), 
+        : pTiffHeader_(0), 
+          pIfd0_(0), pExifIfd_(0), pIopIfd_(0), pGpsIfd_(0), pIfd1_(0), 
           size_(0), pData_(0), compatible_(true)
     {
     }
 
     ExifData::ExifData(const ExifData& rhs)
-        : tiffHeader_(rhs.tiffHeader_), exifMetadata_(rhs.exifMetadata_),
+        : exifMetadata_(rhs.exifMetadata_), pTiffHeader_(0),
           pIfd0_(0), pExifIfd_(0), pIopIfd_(0), pGpsIfd_(0), pIfd1_(0), 
           size_(0), pData_(0), compatible_(rhs.compatible_)
     {
@@ -320,6 +321,9 @@ namespace Exiv2 {
         size_ = rhs.size_;
         memcpy(pData_, rhs.pData_, rhs.size_);
 
+        if (rhs.pTiffHeader_) {
+            pTiffHeader_ = new TiffHeader(*rhs.pTiffHeader_);
+        }
         if (rhs.makerNote_.get() != 0) {
             makerNote_ = rhs.makerNote_->clone();
             makerNote_->updateBase(pData_);
@@ -348,6 +352,7 @@ namespace Exiv2 {
 
     ExifData::~ExifData()
     {
+        delete pTiffHeader_;
         delete pIfd0_;
         delete pExifIfd_;
         delete pIopIfd_;
@@ -360,7 +365,6 @@ namespace Exiv2 {
     {
         if (this == &rhs) return *this;
 
-        tiffHeader_ = rhs.tiffHeader_;
         exifMetadata_ = rhs.exifMetadata_;
 
         size_ = 0;
@@ -369,6 +373,12 @@ namespace Exiv2 {
         size_ = rhs.size_;
         memcpy(pData_, rhs.pData_, rhs.size_);
 
+        delete pTiffHeader_;
+        pTiffHeader_ = 0;
+        if (rhs.pTiffHeader_) {
+            pTiffHeader_ = new TiffHeader(*rhs.pTiffHeader_);
+        }
+
         makerNote_.reset();
         if (rhs.makerNote_.get() != 0) {
             makerNote_ = rhs.makerNote_->clone();
@@ -430,18 +440,20 @@ namespace Exiv2 {
         size_ = len;
 
         // Read the TIFF header
-        int ret = 0;
-        int rc = tiffHeader_.read(pData_);
+        delete pTiffHeader_;
+        pTiffHeader_ = new TiffHeader;
+        assert(pTiffHeader_ != 0);
+        int rc = pTiffHeader_->read(pData_);
         if (rc) return rc;
 
         // Read IFD0
         delete pIfd0_;
         pIfd0_ = new Ifd(ifd0Id, 0, false); 
         assert(pIfd0_ != 0);
-        rc = pIfd0_->read(pData_ + tiffHeader_.offset(), 
-                          size_ - tiffHeader_.offset(), 
+        rc = pIfd0_->read(pData_ + pTiffHeader_->offset(), 
+                          size_ - pTiffHeader_->offset(), 
                           byteOrder(), 
-                          tiffHeader_.offset());
+                          pTiffHeader_->offset());
         if (rc) return rc;
 
         delete pExifIfd_;
@@ -515,13 +527,13 @@ namespace Exiv2 {
         pos = pIfd1_->findTag(0x8769);
         if (pos != pIfd1_->end()) {
             pIfd1_->erase(pos);
-            ret = 7;
+            rc = 7;
         }
         // Find and delete GPSInfo sub-IFD in IFD1
         pos = pIfd1_->findTag(0x8825);
         if (pos != pIfd1_->end()) {
             pIfd1_->erase(pos);
-            ret = 7;
+            rc = 7;
         }
         // Copy all entries from the IFDs and the MakerNote to the metadata
         exifMetadata_.clear();
@@ -536,7 +548,7 @@ namespace Exiv2 {
         // Read the thumbnail (but don't worry whether it was successful or not)
         readThumbnail();
 
-        return ret;
+        return rc;
     } // ExifData::load
 
 
@@ -612,7 +624,8 @@ namespace Exiv2 {
         int gpsIdx  = ifd0.erase(0x8825);
         int iopIdx  = exifIfd.erase(0xa005);
 
-        long ifd0Offset = tiffHeader_.size();
+        TiffHeader tiffHeader(byteOrder());
+        long ifd0Offset = tiffHeader.size();
         bool addOffsetTag = false;
         long exifIfdOffset = ifd0Offset + ifd0.size() + ifd0.dataSize();
         if (exifIfd.size() > 0 || iopIfd.size() > 0) {
@@ -657,7 +670,7 @@ namespace Exiv2 {
         }
 
         // Allocate a data buffer big enough for all metadata
-        long size = tiffHeader_.size();
+        long size = tiffHeader.size();
         size += ifd0.size() + ifd0.dataSize();
         size += exifIfd.size() + exifIfd.dataSize();
         size += iopIfd.size() + iopIfd.dataSize();
@@ -666,7 +679,7 @@ namespace Exiv2 {
         DataBuf buf(size);
 
         // Copy the TIFF header, all IFDs, MakerNote and thumbnail to the buffer
-        size = tiffHeader_.copy(buf.pData_);
+        size = tiffHeader.copy(buf.pData_);
         ifd0.sortByTag();
         size += ifd0.copy(buf.pData_ + ifd0Offset, byteOrder(), ifd0Offset);
         exifIfd.sortByTag();
@@ -861,6 +874,12 @@ namespace Exiv2 {
         return rc;
     } // ExifData::stdThumbPosition
 
+    ByteOrder ExifData::byteOrder() const
+    { 
+        if (pTiffHeader_) return pTiffHeader_->byteOrder();
+        return littleEndian;
+    }
+
     int ExifData::writeThumbnail(const std::string& path) const 
     {
         Thumbnail::AutoPtr thumbnail = getThumbnail();
diff --git a/src/exif.hpp b/src/exif.hpp
index 04375a4..0043bc8 100644
--- a/src/exif.hpp
+++ b/src/exif.hpp
@@ -34,7 +34,6 @@
 #include "metadatum.hpp"
 #include "types.hpp"
 #include "error.hpp"
-#include "image.hpp"
 #include "value.hpp"
 #include "ifd.hpp"
 #include "tags.hpp"
@@ -57,6 +56,7 @@ namespace Exiv2 {
 // class declarations
     class ExifData;
     class MakerNote;
+    class TiffHeader;
 
 // *****************************************************************************
 // class definitions
@@ -708,8 +708,10 @@ namespace Exiv2 {
         bool empty() const { return count() == 0; }
         //! Get the number of metadata entries
         long count() const { return static_cast<long>(exifMetadata_.size()); }
-        //! Returns the byte order as specified in the TIFF header
-        ByteOrder byteOrder() const { return tiffHeader_.byteOrder(); }
+        /*!
+          @brief Returns the byte order. Default is little endian.
+         */
+        ByteOrder byteOrder() const;
         /*!
           @brief Write the thumbnail image to a file. A filename extension
                  is appended to \em path according to the image type of the
@@ -834,12 +836,11 @@ namespace Exiv2 {
         //@}
 
         // DATA
-        TiffHeader tiffHeader_;
         ExifMetadata exifMetadata_;
 
+        TiffHeader* pTiffHeader_;      //! Pointer to the TIFF header
         //! Pointer to the MakerNote
         std::auto_ptr<MakerNote> makerNote_;
-
         Ifd* pIfd0_;                   //! Pointer to Ifd0
         Ifd* pExifIfd_;                //! Pointer to ExifIfd
         Ifd* pIopIfd_;                 //! Pointer to IopIfd

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list