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

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


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

The following commit has been merged in the master branch:
commit 8221293072d3e6b13ecc41ea7ab15b9d8eeb7b1b
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Mon Feb 21 15:57:10 2005 +0000

    Completed ExifData assignment operator and copy constructor, added related code and tests. Fixes bug #417
---
 src/Makefile                            |  15 +-
 src/canonmn.cpp                         |  21 +-
 src/canonmn.hpp                         |   9 +-
 src/exif.cpp                            | 266 +++++++++++++-------
 src/exif.hpp                            |  23 +-
 src/exifdata-test.cpp                   | 158 ++++++++++++
 src/fujimn.cpp                          |  21 +-
 src/fujimn.hpp                          |   9 +-
 src/ifd-test.cpp                        |  43 +++-
 src/ifd.cpp                             |  24 +-
 src/ifd.hpp                             |  19 +-
 src/makernote.cpp                       |  36 ++-
 src/makernote.hpp                       |  43 +++-
 src/nikonmn.cpp                         |  63 ++++-
 src/nikonmn.hpp                         |  27 +-
 src/sigmamn.cpp                         |  21 +-
 src/sigmamn.hpp                         |   9 +-
 src/tags.cpp                            |   6 +-
 test/data/exifdata-test.out             | 420 ++++++++++++++++++++++++++++++++
 test/data/exiv2-gc.jpg                  | Bin 0 -> 11623 bytes
 test/data/ifd-test.out                  |  30 +++
 test/{addmoddel.sh => exifdata-test.sh} |  13 +-
 22 files changed, 1098 insertions(+), 178 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index 156cf4f..7740f64 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -48,19 +48,20 @@ include $(top_srcdir)/config.mk
 # Source files
 
 # Add standalone C++ header files to this list
-CCHDR = rcsid.hpp error.hpp
+CCHDR = error.hpp rcsid.hpp 
 
 # Add library C++ source files to this list
-CCSRC = canonmn.cpp datasets.cpp exif.cpp fujimn.cpp ifd.cpp basicio.cpp iptc.cpp \
-        makernote.cpp metadatum.cpp nikonmn.cpp sigmamn.cpp tags.cpp types.cpp \
-        image.cpp jpgimage.cpp value.cpp
+CCSRC = basicio.cpp canonmn.cpp datasets.cpp exif.cpp fujimn.cpp ifd.cpp \
+        image.cpp iptc.cpp jpgimage.cpp makernote.cpp metadatum.cpp nikonmn.cpp \
+        sigmamn.cpp tags.cpp types.cpp value.cpp 
 
 # Add source files of simple applications to this list
-BINSRC = addmoddel.cpp exifcomment.cpp exifprint.cpp ifd-test.cpp iptcprint.cpp \
+BINSRC = addmoddel.cpp dataarea-test.cpp exifcomment.cpp exifdata-test.cpp \
+         exifprint.cpp ifd-test.cpp iotest.cpp iptceasy.cpp iptcprint.cpp \
          iptctest.cpp key-test.cpp makernote-test.cpp taglist.cpp write-test.cpp \
-         iotest.cpp write2-test.cpp dataarea-test.cpp iptceasy.cpp 
+         write2-test.cpp 
 
-# State the main source file of the Exiv2 application here
+# Main source file of the Exiv2 application
 EXIV2MAIN = exiv2.cpp
 
 # Add additional source files of the Exiv2 application to this list
diff --git a/src/canonmn.cpp b/src/canonmn.cpp
index 16e33f8..fb01f26 100644
--- a/src/canonmn.cpp
+++ b/src/canonmn.cpp
@@ -72,16 +72,31 @@ namespace Exiv2 {
     {
     }
 
-    CanonMakerNote::AutoPtr CanonMakerNote::clone(bool alloc) const
+    CanonMakerNote::CanonMakerNote(const CanonMakerNote& rhs)
+        : IfdMakerNote(rhs), ifdItem_(rhs.ifdItem_)
     {
-        return AutoPtr(clone_(alloc));
     }
 
-    CanonMakerNote* CanonMakerNote::clone_(bool alloc) const 
+    CanonMakerNote::AutoPtr CanonMakerNote::create(bool alloc) const
+    {
+        return AutoPtr(create_(alloc));
+    }
+
+    CanonMakerNote* CanonMakerNote::create_(bool alloc) const 
     {
         return new CanonMakerNote(alloc); 
     }
 
+    CanonMakerNote::AutoPtr CanonMakerNote::clone() const
+    {
+        return AutoPtr(clone_());
+    }
+
+    CanonMakerNote* CanonMakerNote::clone_() const 
+    {
+        return new CanonMakerNote(*this); 
+    }
+
     std::ostream& CanonMakerNote::printTag(std::ostream& os, 
                                            uint16_t tag, 
                                            const Value& value) const
diff --git a/src/canonmn.hpp b/src/canonmn.hpp
index 7a9c23a..9e4e634 100644
--- a/src/canonmn.hpp
+++ b/src/canonmn.hpp
@@ -97,13 +97,16 @@ namespace Exiv2 {
                  is required for the makernote entries.
          */
         CanonMakerNote(bool alloc =true);
+        //! Copy constructor
+        CanonMakerNote(const CanonMakerNote& rhs);
         //! Virtual destructor
         virtual ~CanonMakerNote() {}
         //@}
 
         //! @name Accessors
         //@{
-        AutoPtr clone(bool alloc =true) const;
+        AutoPtr create(bool alloc =true) const;
+        AutoPtr clone() const;
         //! Return the name of the makernote item ("Canon")
         std::string ifdItem() const { return ifdItem_; }
         std::ostream& printTag(std::ostream& os,
@@ -176,8 +179,10 @@ namespace Exiv2 {
         //@}
 
     private:
+        //! Internal virtual create function.
+        CanonMakerNote* create_(bool alloc =true) const;
         //! Internal virtual copy constructor.
-        CanonMakerNote* clone_(bool alloc =true) const;
+        CanonMakerNote* clone_() const;
 
         //! Structure used to auto-register the MakerNote.
         struct RegisterMakerNote {
diff --git a/src/exif.cpp b/src/exif.cpp
index 712f696..0eb2886 100644
--- a/src/exif.cpp
+++ b/src/exif.cpp
@@ -181,7 +181,7 @@ namespace Exiv2 {
         value_->read(value);
     }
 
-    int TiffThumbnail::setDataArea(ExifData& exifData, Ifd& ifd1,
+    int TiffThumbnail::setDataArea(ExifData& exifData, Ifd* pIfd1,
                                    const byte* buf, long len) const
     {
         // Create a DataBuf that can hold all strips
@@ -226,9 +226,9 @@ namespace Exiv2 {
         stripOffsets->setValue(os.str());
 
         // Set corresponding data area at IFD1, if it is a contiguous area
-        if (firstOffset + totalSize == lastOffset + lastSize) {
-            Ifd::iterator pos = ifd1.findTag(0x0111);
-            assert(pos != ifd1.end());
+        if (pIfd1 && firstOffset + totalSize == lastOffset + lastSize) {
+            Ifd::iterator pos = pIfd1->findTag(0x0111);
+            assert(pos != pIfd1->end());
             pos->setDataArea(buf + firstOffset, totalSize);
         }
 
@@ -265,7 +265,7 @@ namespace Exiv2 {
         return buf;
     }
 
-    int JpegThumbnail::setDataArea(ExifData& exifData, Ifd& ifd1,
+    int JpegThumbnail::setDataArea(ExifData& exifData, Ifd* pIfd1,
                                    const byte* buf, long len) const
     {
         ExifKey key("Exif.Thumbnail.JPEGInterchangeFormat");
@@ -279,11 +279,13 @@ namespace Exiv2 {
         if (len < offset + size) return 2;
         format->setDataArea(buf + offset, size);
         format->setValue("0");
-        Ifd::iterator pos = ifd1.findTag(0x0201);
-        assert(pos != ifd1.end());
-        pos->setDataArea(buf + offset, size);
+        if (pIfd1) {
+            Ifd::iterator pos = pIfd1->findTag(0x0201);
+            assert(pos != pIfd1->end());
+            pos->setDataArea(buf + offset, size);
+        }
         return 0;
-    } // JpegThumbnail::read
+    } // JpegThumbnail::setDataArea
 
     const char* JpegThumbnail::format() const
     {
@@ -304,44 +306,107 @@ namespace Exiv2 {
     }
 
     ExifData::ExifData() 
-        : ifd0_(ifd0Id, 0, false), 
-          exifIfd_(exifIfdId, 0, false), iopIfd_(iopIfdId, 0, false), 
-          gpsIfd_(gpsIfdId, 0, false), ifd1_(ifd1Id, 0, false), 
+        : 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_),
-          ifd0_(ifd0Id, 0, false), 
-          exifIfd_(exifIfdId, 0, false), iopIfd_(iopIfdId, 0, false), 
-          gpsIfd_(gpsIfdId, 0, false), ifd1_(ifd1Id, 0, false), 
-          size_(0), pData_(0), compatible_(false)
+          pIfd0_(0), pExifIfd_(0), pIopIfd_(0), pGpsIfd_(0), pIfd1_(0), 
+          size_(0), pData_(0), compatible_(rhs.compatible_)
     {
-        if (rhs.makerNote_.get() != 0) makerNote_ = rhs.makerNote_->clone();
+        pData_ = new byte[rhs.size_];
+        size_ = rhs.size_;
+        memcpy(pData_, rhs.pData_, rhs.size_);
+
+        if (rhs.makerNote_.get() != 0) {
+            makerNote_ = rhs.makerNote_->clone();
+            makerNote_->updateBase(pData_);
+        }
+        if (rhs.pIfd0_) {
+            pIfd0_ = new Ifd(*rhs.pIfd0_);
+            pIfd0_->updateBase(pData_);
+        }
+        if (rhs.pExifIfd_) {
+            pExifIfd_ = new Ifd(*rhs.pExifIfd_);
+            pExifIfd_->updateBase(pData_);
+        }
+        if (rhs.pIopIfd_) {
+            pIopIfd_ = new Ifd(*rhs.pIopIfd_);
+            pIopIfd_->updateBase(pData_);
+        }
+        if (rhs.pGpsIfd_) {
+            pGpsIfd_ = new Ifd(*rhs.pGpsIfd_);
+            pGpsIfd_->updateBase(pData_);
+        }
+        if (rhs.pIfd1_) {
+            pIfd1_ = new Ifd(*rhs.pIfd1_);
+            pIfd1_->updateBase(pData_);
+        }
     }
 
     ExifData::~ExifData()
     {
+        delete pIfd0_;
+        delete pExifIfd_;
+        delete pIopIfd_;
+        delete pGpsIfd_;
+        delete pIfd1_;
         delete[] pData_;
     }
 
     ExifData& ExifData::operator=(const ExifData& rhs)
     {
         if (this == &rhs) return *this;
+
         tiffHeader_ = rhs.tiffHeader_;
         exifMetadata_ = rhs.exifMetadata_;
-        makerNote_.reset();
-        if (rhs.makerNote_.get() != 0) makerNote_ = rhs.makerNote_->clone();
-        ifd0_.clear();
-        exifIfd_.clear();
-        iopIfd_.clear();
-        gpsIfd_.clear();
-        ifd1_.clear();
+
         size_ = 0;
         delete[] pData_;
-        pData_ = 0;
-        compatible_ = false;
+        pData_ = new byte[rhs.size_];
+        size_ = rhs.size_;
+        memcpy(pData_, rhs.pData_, rhs.size_);
+
+        makerNote_.reset();
+        if (rhs.makerNote_.get() != 0) {
+            makerNote_ = rhs.makerNote_->clone();
+            makerNote_->updateBase(pData_);
+        }
+
+        delete pIfd0_;
+        pIfd0_ = 0;
+        if (rhs.pIfd0_) {
+            pIfd0_ = new Ifd(*rhs.pIfd0_);
+            pIfd0_->updateBase(pData_);
+        }
+        delete pExifIfd_;
+        pExifIfd_ = 0;
+        if (rhs.pExifIfd_) {
+            pExifIfd_ = new Ifd(*rhs.pExifIfd_);
+            pExifIfd_->updateBase(pData_);
+        }
+        delete pIopIfd_;
+        pIopIfd_ = 0;
+        if (rhs.pIopIfd_) {
+            pIopIfd_ = new Ifd(*rhs.pIopIfd_);
+            pIopIfd_->updateBase(pData_);
+        }
+        delete pGpsIfd_;
+        pGpsIfd_ = 0;
+        if (rhs.pGpsIfd_) {
+            pGpsIfd_ = new Ifd(*rhs.pGpsIfd_);
+            pGpsIfd_->updateBase(pData_);
+        }
+        delete pIfd1_;
+        pIfd1_ = 0;
+        if (rhs.pIfd1_) {
+            pIfd1_ = new Ifd(*rhs.pIfd1_);
+            pIfd1_->updateBase(pData_);
+        }
+
+        compatible_ = rhs.compatible_;
         return *this;
     }
 
@@ -370,19 +435,27 @@ namespace Exiv2 {
         if (rc) return rc;
 
         // Read IFD0
-        rc = ifd0_.read(pData_ + tiffHeader_.offset(), 
-                        size_ - tiffHeader_.offset(), 
-                        byteOrder(), 
-                        tiffHeader_.offset());
+        delete pIfd0_;
+        pIfd0_ = new Ifd(ifd0Id, 0, false); 
+        assert(pIfd0_ != 0);
+        rc = pIfd0_->read(pData_ + tiffHeader_.offset(), 
+                          size_ - tiffHeader_.offset(), 
+                          byteOrder(), 
+                          tiffHeader_.offset());
         if (rc) return rc;
+
+        delete pExifIfd_;
+        pExifIfd_ = new Ifd(exifIfdId, 0, false);
+        assert(pExifIfd_ != 0);
         // Find and read ExifIFD sub-IFD of IFD0
-        rc = ifd0_.readSubIfd(exifIfd_, pData_, size_, byteOrder(), 0x8769);
+        rc = pIfd0_->readSubIfd(*pExifIfd_, pData_, size_, byteOrder(), 0x8769);
         if (rc) return rc;
         // Find MakerNote in ExifIFD, create a MakerNote class 
-        Ifd::iterator pos = exifIfd_.findTag(0x927c);
-        Ifd::iterator make = ifd0_.findTag(0x010f);
-        Ifd::iterator model = ifd0_.findTag(0x0110);
-        if (pos != exifIfd_.end() && make != ifd0_.end() && model != ifd0_.end()) {
+        Ifd::iterator pos = pExifIfd_->findTag(0x927c);
+        Ifd::iterator make = pIfd0_->findTag(0x010f);
+        Ifd::iterator model = pIfd0_->findTag(0x0110);
+        if (   pos != pExifIfd_->end() 
+            && make != pIfd0_->end() && model != pIfd0_->end()) {
             MakerNoteFactory& mnf = MakerNoteFactory::instance();
             // Todo: The conversion to string assumes that there is a 

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list