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


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

The following commit has been merged in the master branch:
commit 5823ceaff37b1c01939f212be63ef7e83bd9a7e6
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Sun Jul 31 08:50:09 2005 +0000

    Changed Ifd::read() to allow it to access the complete Exif data buffer. Corresponding changes done to makernotes. Fixes bug #424.
---
 src/canonmn.cpp          |  9 ++++---
 src/canonmn.hpp          |  5 ++--
 src/dataarea-test.cpp    |  8 +++---
 src/exif.cpp             | 17 ++++--------
 src/fujimn.cpp           |  8 +++---
 src/ifd-test.cpp         | 22 +++++++--------
 src/ifd.cpp              | 69 ++++++++++++++++++++++++++----------------------
 src/ifd.hpp              | 31 +++++++++++++---------
 src/key-test.cpp         |  2 +-
 src/makernote.cpp        | 30 ++++++++++-----------
 src/makernote.hpp        | 56 ++++++++++++++++++++++++---------------
 src/nikonmn.cpp          | 11 ++++----
 src/olympusmn.cpp        |  3 +--
 src/panasonicmn.cpp      |  2 +-
 src/sigmamn.cpp          |  2 +-
 src/sonymn.cpp           |  2 +-
 test/data/exiv2-test.out | 28 +-------------------
 test/data/ifd-test.out   | 14 +++++-----
 18 files changed, 153 insertions(+), 166 deletions(-)

diff --git a/src/canonmn.cpp b/src/canonmn.cpp
index fe545f6..d723a21 100644
--- a/src/canonmn.cpp
+++ b/src/canonmn.cpp
@@ -213,10 +213,11 @@ namespace Exiv2 {
 
     int CanonMakerNote::read(const byte* buf,
                              long len, 
-                             ByteOrder byteOrder, 
-                             long offset)
+                             long start,
+                             ByteOrder byteOrder,
+                             long shift)
     {
-        int rc = IfdMakerNote::read(buf, len, byteOrder, offset);
+        int rc = IfdMakerNote::read(buf, len, start, byteOrder, shift);
         if (rc) return rc;
 
         // Decode camera settings 1 and add settings as additional entries
@@ -337,7 +338,7 @@ namespace Exiv2 {
     void CanonMakerNote::updateBase(byte* pNewBase)
     {
         byte* pBase = ifd_.updateBase(pNewBase);
-        if (absOffset_ && !alloc_) {
+        if (absShift_ && !alloc_) {
             Entries::iterator end = entries_.end();
             for (Entries::iterator pos = entries_.begin(); pos != end; ++pos) {
                 pos->updateBase(pBase, pNewBase);
diff --git a/src/canonmn.hpp b/src/canonmn.hpp
index 890c524..87dcba0 100644
--- a/src/canonmn.hpp
+++ b/src/canonmn.hpp
@@ -111,8 +111,9 @@ namespace Exiv2 {
         //@{
         int read(const byte* buf,
                  long len, 
-                 ByteOrder byteOrder, 
-                 long offset);
+                 long start, 
+                 ByteOrder byteOrder,
+                 long shift);
         long copy(byte* buf, ByteOrder byteOrder, long offset);
         void add(const Entry& entry);
         Entries::iterator begin() { return entries_.begin(); }
diff --git a/src/dataarea-test.cpp b/src/dataarea-test.cpp
index c3c7083..b626ae8 100644
--- a/src/dataarea-test.cpp
+++ b/src/dataarea-test.cpp
@@ -128,10 +128,10 @@ int read(const std::string& path)
 
         // Read IFD0
         Ifd ifd0(ifd0Id);
-        rc = ifd0.read(exifData.pData_ + tiffHeader.offset(), 
-                       size - tiffHeader.offset(), 
-                       tiffHeader.byteOrder(),
-                       tiffHeader.offset());
+        rc = ifd0.read(exifData.pData_,
+                       size,
+                       tiffHeader.offset(),
+                       tiffHeader.byteOrder());
         if (rc) return rc;
         ifd0.print(std::cout);
 
diff --git a/src/exif.cpp b/src/exif.cpp
index 6e01734..73685ca 100644
--- a/src/exif.cpp
+++ b/src/exif.cpp
@@ -477,10 +477,7 @@ namespace Exiv2 {
         delete pIfd0_;
         pIfd0_ = new Ifd(ifd0Id, 0, false); 
         assert(pIfd0_ != 0);
-        rc = pIfd0_->read(pData_ + pTiffHeader_->offset(), 
-                          size_ - pTiffHeader_->offset(), 
-                          byteOrder(), 
-                          pTiffHeader_->offset());
+        rc = pIfd0_->read(pData_, size_, pTiffHeader_->offset(), byteOrder());
         if (rc) return rc;
 
         delete pExifIfd_;
@@ -508,10 +505,9 @@ namespace Exiv2 {
         }
         // Read the MakerNote
         if (pMakerNote_) {
-            rc = pMakerNote_->read(pos->data(), 
-                                   pos->size(),
-                                   byteOrder(),
-                                   pExifIfd_->offset() + pos->offset());
+            rc = pMakerNote_->read(pData_, size_, 
+                                   pExifIfd_->offset() + pos->offset(),
+                                   byteOrder());
             if (rc) {
 #ifndef SUPPRESS_WARNINGS
                 std::cerr << "Warning: Failed to read Makernote, rc = "
@@ -546,10 +542,7 @@ namespace Exiv2 {
         assert(pIfd1_ != 0);
         // Read IFD1
         if (pIfd0_->next()) {
-            rc = pIfd1_->read(pData_ + pIfd0_->next(), 
-                              size_ - pIfd0_->next(), 
-                              byteOrder(), 
-                              pIfd0_->next());
+            rc = pIfd1_->read(pData_, size_, pIfd0_->next(), byteOrder());
             if (rc) return rc;
         }
         // Find and delete ExifIFD sub-IFD of IFD1
diff --git a/src/fujimn.cpp b/src/fujimn.cpp
index dec06a1..a70a159 100644
--- a/src/fujimn.cpp
+++ b/src/fujimn.cpp
@@ -91,7 +91,7 @@ namespace Exiv2 {
         : IfdMakerNote(fujiIfdId, alloc)
     {
         byteOrder_ = littleEndian;
-        absOffset_ = false;
+        absShift_ = false;
         byte buf[] = {
             'F', 'U', 'J', 'I', 'F', 'I', 'L', 'M', 0x0c, 0x00, 0x00, 0x00
         };
@@ -111,9 +111,9 @@ namespace Exiv2 {
 
         header_.alloc(12);
         memcpy(header_.pData_, buf, header_.size_);
-        // Read the offset relative to the start of the makernote from the header
-        // Note: we ignore the byteOrder paramter
-        adjOffset_ = getUShort(header_.pData_ + 8, byteOrder_);
+        // Read offset to the IFD relative to the start of the makernote 
+        // from the header. Note that we ignore the byteOrder paramter
+        start_ = getUShort(header_.pData_ + 8, byteOrder_);
         return 0;
     }
 
diff --git a/src/ifd-test.cpp b/src/ifd-test.cpp
index ad57416..fba97a8 100644
--- a/src/ifd-test.cpp
+++ b/src/ifd-test.cpp
@@ -40,7 +40,7 @@ try {
         };
 
     Exiv2::Ifd ifd(Exiv2::ifd0Id, 0, false);
-    int rc = ifd.read(buf+1, len-1, Exiv2::bigEndian, 1);
+    int rc = ifd.read(buf, len, 1, Exiv2::bigEndian);
     if (rc) {
         std::cout << "Ifd::read (1) failed, rc = " << rc << "
";
         return rc;
@@ -58,9 +58,9 @@ try {
     pos->setValue(2, 6, data, 6);
 
     Exiv2::DataBuf db(1024);
-    rc = ifd.copy(db.pData_, Exiv2::bigEndian);
+    rc = ifd.copy(db.pData_ + 1, Exiv2::bigEndian);
     std::cout << "Wrote " << rc << " characters to data buffer
"; 
-    rc = ifd.read(db.pData_, len, Exiv2::bigEndian, 1);
+    rc = ifd.read(db.pData_, len, 1, Exiv2::bigEndian);
     if (rc) {
         std::cout << "Ifd::read (1a) failed, rc = " << rc << "
";
         return rc;
@@ -88,7 +88,7 @@ try {
         };
 
     Exiv2::Ifd ifd2(Exiv2::ifd0Id, 0, false);
-    rc = ifd2.read(buf2 + 22, len2 - 22, Exiv2::bigEndian, 22);
+    rc = ifd2.read(buf2, len2, 22, Exiv2::bigEndian);
     if (rc) {
         std::cout << "Ifd::read (2) failed, rc = " << rc << "
";
         return rc;
@@ -111,31 +111,31 @@ try {
     std::cout << "
Test boundary checks, the following reads should generate warnings or errors
";
 
     std::cout << "--- read (3)" << std::endl;
-    rc = ifd.read(buf+1, len-1-1, Exiv2::bigEndian, 1);
+    rc = ifd.read(buf, len-1, 1, Exiv2::bigEndian);
     if (rc) {
         std::cout << "Ifd::read (3) failed, rc = " << rc << "
";
     }
 
     std::cout << "--- read (4)" << std::endl;
-    rc = ifd.read(buf+1, len-1-21, Exiv2::bigEndian, 1);
+    rc = ifd.read(buf, len-17, 1, Exiv2::bigEndian);
     if (rc) {
         std::cout << "Ifd::read (4) failed, rc = " << rc << "
";
     }
 
     std::cout << "--- read (5)" << std::endl;
-    rc = ifd.read(buf+1, len-1-22, Exiv2::bigEndian, 1);
+    rc = ifd.read(buf, len-16, 1, Exiv2::bigEndian);
     if (rc) {
         std::cout << "Ifd::read (5) failed, rc = " << rc << "
";
     }
 
     std::cout << "--- read (6)" << std::endl;
-    rc = ifd.read(buf+1, len-1-23, Exiv2::bigEndian, 1);
+    rc = ifd.read(buf, len-23, 1, Exiv2::bigEndian);
     if (rc) {
         std::cout << "Ifd::read (6) failed, rc = " << rc << "
";
     }
 
     std::cout << "--- read (7)" << std::endl;
-    rc = ifd2.read(buf2+22, len2-22-1, Exiv2::bigEndian, 22);
+    rc = ifd2.read(buf2, len2-1, 22, Exiv2::bigEndian);
     if (rc) {
         std::cout << "Ifd::read (7) failed, rc = " << rc << "
";
     }
@@ -176,7 +176,7 @@ try {
     long len3 = ifd3.copy(ibuf.pData_, Exiv2::bigEndian);
 
     Exiv2::Ifd ifd4(Exiv2::ifd0Id, 0, false);
-    rc = ifd4.read(ibuf.pData_, len3, Exiv2::bigEndian, 0);
+    rc = ifd4.read(ibuf.pData_, len3, 0, Exiv2::bigEndian);
     if (rc) {
         std::cout << "Ifd::read (8) failed, rc = " << rc << "
";
     }
@@ -186,7 +186,7 @@ try {
     std::cout << "
Move data buffer
";
 
     Exiv2::Ifd ifd5(Exiv2::ifd0Id, 0, false);
-    rc = ifd5.read(buf+1, len-1, Exiv2::bigEndian, 1);
+    rc = ifd5.read(buf, len, 1, Exiv2::bigEndian);
     if (rc) {
         std::cout << "Ifd::read (1) failed, rc = " << rc << "
";
         return rc;
diff --git a/src/ifd.cpp b/src/ifd.cpp
index 7532a86..3440e05 100644
--- a/src/ifd.cpp
+++ b/src/ifd.cpp
@@ -296,20 +296,21 @@ namespace Exiv2 {
         }
     }
 
-    int Ifd::read(const byte* buf, long len, ByteOrder byteOrder, long offset)
+    int Ifd::read(const byte* buf, 
+                  long len, 
+                  long start, 
+                  ByteOrder byteOrder,
+                  long shift)
     {
-        // Todo: This is a hack to work around bug #424 - fix it properly!
-        if (ifdId_ == olympusIfdId) len = 65535;
-
         int rc = 0;
-        long o = 0;
+        long o = start;
         Ifd::PreEntries preEntries;
 
-        if (len < 2) rc = 6;
+        if (len < o + 2) rc = 6;
         if (rc == 0) {
-            offset_ = offset;
-            int n = getUShort(buf, byteOrder);
-            o = 2;
+            offset_ = start - shift;
+            int n = getUShort(buf + o, byteOrder);
+            o += 2;
 
             for (int i = 0; i < n; ++i) {
                 if (len < o + 12) {
@@ -326,7 +327,7 @@ namespace Exiv2 {
                 pe.type_ = getUShort(buf + o + 2, byteOrder);
                 pe.count_ = getULong(buf + o + 4, byteOrder);
                 pe.size_ = pe.count_ * TypeInfo::typeSize(TypeId(pe.type_));
-                pe.offsetLoc_ = o + 8;
+                pe.offsetLoc_ = o + 8 - shift;
                 pe.offset_ = pe.size_ > 4 ? getLong(buf + o + 8, byteOrder) : 0;
                 preEntries.push_back(pe);
                 o += 12;
@@ -352,10 +353,6 @@ namespace Exiv2 {
             }
         }
         // Set the offset of the first data entry outside of the IFD.
-        // At the same time we guess the offset of the IFD, if it was not
-        // given. The guess is based on the assumption that the smallest offset
-        // points to a data buffer directly following the IFD. Subsequently all
-        // offsets of IFD entries will need to be recalculated.
         if (rc == 0 && preEntries.size() > 0) {
             // Find the entry with the smallest offset
             Ifd::PreEntries::const_iterator i = std::min_element(
@@ -363,23 +360,31 @@ namespace Exiv2 {
             // Only do something if there is at least one entry with data
             // outside the IFD directory itself.
             if (i->size_ > 4) {
-                if (offset_ == 0) {
-                    // Set the 'guessed' IFD offset
-                    offset_ = i->offset_ 
-		      - (2 + 12 * static_cast<long>(preEntries.size()) 
-                         + (hasNext_ ? 4 : 0));
-                }
                 // Set the offset of the first data entry outside of the IFD
-                if (i->offset_ - offset_ >= len) {
+                if (i->offset_ + shift < 0) {
 #ifndef SUPPRESS_WARNINGS
                     std::cerr << "Error: Offset of the 1st data entry of " 
                               << ExifTags::ifdName(ifdId_) 
                               << " is out of bounds:
"
                               << " Offset = 0x" << std::setw(8) 
                               << std::setfill('0') << std::hex 
-                              << i->offset_ - offset_
+                              << i->offset_ - offset_ // relative to start of IFD
+                              << ", is before start of buffer by "
+                              << std::dec << -1 * (i->offset_ + shift)
+                              << " Bytes
";
+#endif
+                    rc = 6;
+                } 
+                else if (i->offset_ + shift + i->size_ > len) {
+#ifndef SUPPRESS_WARNINGS
+                    std::cerr << "Error: Upper boundary of the 1st data entry of " 
+                              << ExifTags::ifdName(ifdId_) 
+                              << " is out of bounds:
"
+                              << " Offset = 0x" << std::setw(8) 
+                              << std::setfill('0') << std::hex 
+                              << i->offset_ - offset_ // relative to start of IFD
                               << ", exceeds buffer size by "
-                              << std::dec << i->offset_ - len
+                              << std::dec << i->offset_ + shift + i->size_ - len
                               << " Bytes
";
 #endif
                     rc = 6;
@@ -402,9 +407,9 @@ namespace Exiv2 {
                 e.setIfdId(ifdId_);
                 e.setIdx(++idx);
                 e.setTag(i->tag_);
-                long tmpOffset = 
-                    i->size_ > 4 ? i->offset_ - offset_ : i->offsetLoc_;
-                if (tmpOffset + i->size_ > len) {
+                long tmpOffset = // still from the start of the TIFF header
+                    i->size_ > 4 ? i->offset_ : i->offsetLoc_;
+                if (tmpOffset + shift + i->size_ > len) {
 #ifndef SUPPRESS_WARNINGS
                     std::cerr << "Warning: Upper boundary of data for " 
                               << ExifTags::ifdName(ifdId_) 
@@ -412,10 +417,10 @@ namespace Exiv2 {
                               << " is out of bounds:
"
                               << " Offset = 0x" << std::setw(8) 
                               << std::setfill('0') << std::hex 
-                              << tmpOffset
+                              << tmpOffset - offset_ // relative to start of IFD
                               << ", size = " << std::dec << i->size_ 
                               << ", exceeds buffer size by "
-                              << tmpOffset + i->size_ - len
+                              << tmpOffset + shift + i->size_ - len
                               << " Bytes; Truncating the data.
";
 #endif
                     // Truncate the entry
@@ -424,14 +429,14 @@ namespace Exiv2 {
                     tmpOffset = i->offsetLoc_;
                 }
                 // Set the offset to the data, relative to start of IFD
-                e.setOffset(tmpOffset);
+                e.setOffset(tmpOffset - offset_);
                 // Set the size to at least for bytes to accomodate offset-data
-                e.setValue(i->type_, i->count_, buf + e.offset(), 
+                e.setValue(i->type_, i->count_, buf + start + e.offset(), 
                            std::max(long(4), i->size_));
                 this->add(e);
             }
         }
-        if (!alloc_) pBase_ = const_cast<byte*>(buf) - offset_;
+        if (!alloc_) pBase_ = const_cast<byte*>(buf + shift);
         if (rc) this->clear();
 
         return rc;
@@ -478,7 +483,7 @@ namespace Exiv2 {
                 rc = 6;
             }
             else {
-                rc = dest.read(buf + offset, len - offset, byteOrder, offset);
+                rc = dest.read(buf, len, offset, byteOrder);
             }
         }
         return rc;
diff --git a/src/ifd.hpp b/src/ifd.hpp
index 6204c37..d97c009 100644
--- a/src/ifd.hpp
+++ b/src/ifd.hpp
@@ -375,22 +375,24 @@ namespace Exiv2 {
         /*!
           @brief Read a complete IFD and its data from a data buffer
 
-          @param buf Pointer to the data to decode. The buffer must start with the 
-                 IFD data (unlike the readSubIfd() method).
-          @param len Number of bytes in the data buffer 
+          @param buf Pointer to the Exif data buffer that contains the IFD to 
+                     decode. Usually, the buffer will contain all Exif data 
+                     starting from the TIFF header.
+          @param len Number of bytes in the Exif data buffer.
+          @param start IFD starts at buf + start.
           @param byteOrder Applicable byte order (little or big endian).
-          @param offset (Optional) offset of the IFD from the start of the TIFF
-                 header, if known. If not given, the offset will be guessed
-                 using the assumption that the smallest offset of all IFD
-                 directory entries points to a data buffer immediately follwing
-                 the IFD.
+          @param shift IFD offsets are relative to buf + shift.
 
           @return 0 if successful;<BR>
                   6 if the data buffer is too small, e.g., if an offset points 
                     beyond the provided buffer. The IFD is cleared in this 
                     case.
          */
-        int read(const byte* buf, long len, ByteOrder byteOrder, long offset =0);
+        int read(const byte* buf, 
+                 long len, 
+                 long start, 
+                 ByteOrder byteOrder,
+                 long shift =0);
         /*!
           @brief Copy the IFD to a data array, update the offsets of the IFD and
                  all its entries, return the number of bytes written.
@@ -480,7 +482,7 @@ namespace Exiv2 {
 
           @param dest References the destination IFD.
           @param buf The data buffer to read from. The buffer must contain all Exif 
-                     data starting from the TIFF header (unlike the read() method).
+                     data starting from the TIFF header.
           @param len Number of bytes in the data buffer 
           @param byteOrder Applicable byte order (little or big endian).
           @param tag Tag to look for.
@@ -563,7 +565,7 @@ namespace Exiv2 {
         Entries entries_;
         //! IFD Id
         IfdId ifdId_;
-        //! Pointer to IFD from the start of the TIFF header
+        //! Pointer to IFD
         byte* pBase_;
         //! Offset of the IFD from the start of the TIFF header
         long offset_;
@@ -571,9 +573,12 @@ namespace Exiv2 {
         long dataOffset_;
         //! Indicates whether the IFD has a next pointer
         bool hasNext_;
-        //! Pointer to the offset of next IFD from the start of the TIFF header
+        //! Pointer to the offset of next IFD
         byte* pNext_;
-        //! The offset of the next IFD as data value (always in sync with *pNext_)
+        /*!
+          The offset of the next IFD from the start of the TIFF header as data 
+          value (always in sync with *pNext_)
+        */
         uint32_t next_;
 
     }; // class Ifd
diff --git a/src/key-test.cpp b/src/key-test.cpp
index 6393db6..19379b9 100644
--- a/src/key-test.cpp
+++ b/src/key-test.cpp
@@ -140,7 +140,7 @@ int main()
         };
 
     Ifd ifd(Exiv2::iopIfdId, 0, false);
-    int ret = ifd.read(buf, len, bigEndian, 1);
+    int ret = ifd.read(buf, len, 0, bigEndian, 1);
     if (ret) {
         std::cout << "Ifd::read failed, ret = " << ret << "
";
         return ret;
diff --git a/src/makernote.cpp b/src/makernote.cpp
index 4654228..cc1acb9 100644
--- a/src/makernote.cpp
+++ b/src/makernote.cpp
@@ -66,39 +66,37 @@ namespace Exiv2 {
 
     IfdMakerNote::IfdMakerNote(IfdId ifdId, bool alloc, bool hasNext)
         : MakerNote(alloc), 
-          absOffset_(true), adjOffset_(0), ifd_(ifdId, 0, alloc, hasNext)
+          absShift_(true), shift_(0), start_(0), ifd_(ifdId, 0, alloc, hasNext)
     {
     }
 
     IfdMakerNote::IfdMakerNote(const IfdMakerNote& rhs)
-        : MakerNote(rhs), absOffset_(rhs.absOffset_), adjOffset_(rhs.adjOffset_),
-          header_(rhs.header_.size_), ifd_(rhs.ifd_)
+        : MakerNote(rhs), absShift_(rhs.absShift_), shift_(rhs.shift_),
+          start_(rhs.start_), header_(rhs.header_.size_), ifd_(rhs.ifd_)
     {
         memcpy(header_.pData_, rhs.header_.pData_, header_.size_);
     }
 
     int IfdMakerNote::read(const byte* buf,
                            long len, 
-                           ByteOrder byteOrder, 
-                           long offset)
+                           long start, 
+                           ByteOrder byteOrder,
+                           long shift)
     {
         // Remember the offset
-        offset_ = offset;
+        offset_ = start - shift;
         // Set byte order if none is set yet
         if (byteOrder_ == invalidByteOrder) byteOrder_ = byteOrder;
         // Read and check the header (and set offset adjustment)
-        int rc = readHeader(buf, len, byteOrder);
+        int rc = readHeader(buf + start, len - start, byteOrder);
         if (rc == 0) {
             rc = checkHeader();
         }
-        // Adjust the offset
-        offset = absOffset_ ? offset + adjOffset_ : adjOffset_;
+        // Adjust shift
+        long newShift = absShift_ ? shift + shift_ : start + shift_;
         // Read the makernote IFD
         if (rc == 0) {
-            rc = ifd_.read(buf + headerSize(), 
-                           len - headerSize(),
-                           byteOrder_,
-                           offset);
+            rc = ifd_.read(buf, len, start + start_, byteOrder_, newShift);
         }
         if (rc == 0) {
             // IfdMakerNote currently does not support multiple IFDs
@@ -111,7 +109,7 @@ namespace Exiv2 {
             }
         }
 #ifdef DEBUG_MAKERNOTE
-        hexdump(std::cerr, buf, len, offset);
+        hexdump(std::cerr, buf + start, len - start);
         if (rc == 0) ifd_.print(std::cerr);
 #endif
 
@@ -125,7 +123,7 @@ namespace Exiv2 {
         // Set byte order if none is set yet
         if (byteOrder_ == invalidByteOrder) byteOrder_ = byteOrder;
         // Adjust the offset
-        offset = absOffset_ ? offset + adjOffset_ : adjOffset_;
+        offset = absShift_ ? offset + start_ - shift_ : start_ - shift_;
 
         long len = 0;
         len += copyHeader(buf);
@@ -144,7 +142,7 @@ namespace Exiv2 {
 
     void IfdMakerNote::updateBase(byte* pNewBase)
     { 
-        if (absOffset_) {
+        if (absShift_) {
             ifd_.updateBase(pNewBase);
         }
     }
diff --git a/src/makernote.hpp b/src/makernote.hpp
index d792f50..35cfa12 100644
--- a/src/makernote.hpp
+++ b/src/makernote.hpp
@@ -117,15 +117,24 @@ namespace Exiv2 {
         //! @name Manipulators
         //@{
         /*!
-          @brief Read the makernote, including the makernote header, from
-                 character buffer buf of length len at position offset (from the
-                 start of the TIFF header) and encoded in byte order byteOrder.
-                 Return 0 if successful.
-         */
+          @brief Read the makernote, including the makernote header, from the 
+                 Exif data buffer.
+
+          @param buf Pointer to the Exif data buffer that contains the 
+                     MakerNote to decode. The buffer should contain all Exif 
+                     data starting from the TIFF header.
+          @param len Number of bytes in the Exif data buffer
+          @param start MakerNote starts at buf + start.
+          @param byteOrder Applicable byte order (little or big endian).
+          @param shift IFD offsets are relative to buf + shift.
+
+          @return 0 if successful.
+        */
         virtual int read(const byte* buf, 
                          long len, 
+                         long start,
                          ByteOrder byteOrder,
-                         long offset) =0;
+                         long shift =0) =0;
         /*!
           @brief Copy (write) the makerNote to the character buffer buf at 
                  position offset (from the start of the TIFF header), encoded
@@ -256,13 +265,14 @@ namespace Exiv2 {
         //@{
         virtual int read(const byte* buf, 
                          long len, 
-                         ByteOrder byteOrder, 
-                         long offset);
+                         long start, 
+                         ByteOrder byteOrder,
+                         long shift);
         /*!
           @brief Read the makernote header from the makernote databuffer.  This
-                 method must set the offset adjustment (adjOffset_), if needed
-                 (assuming that the required information is in the header).
-                 Return 0 if successful.          
+                 method must set the offset to the start of the IFD (start_), if 
+                 needed (assuming that the required information is in the header).
+                 Return 0 if successful. 
           @note  The default implementation does nothing, assuming there is no
                  header
          */
@@ -309,20 +319,22 @@ namespace Exiv2 {
     protected:
         // DATA
         /*!
-          @brief True:  Adjustment of the IFD offsets is to be added to the
-                        offset from the start of the TIFF header (i.e., the
-                        start of the Exif data section),
-                 False: Adjustment of the IFD offsets is a suitable absolute 
-                        value. Ignore the offset from the start of the TIFF 
-                        header.
+          @brief True:  IFD offsets are relative to the start of the TIFF
+                        header (i.e., the start of the Exif data section)
+                        + shift_
+                 False: IFD offsets are relative to the start of the 
+                        makernote + shift_
+         */
+        bool absShift_;
+        /*!
+          @brief Adjustment for IFD offsets, see absShift_.
          */
-        bool absOffset_;
+        long shift_;
         /*!
-          @brief Adjustment of the IFD offsets relative to the start of the 
-                 TIFF header or to the start of the makernote, depending on 
-                 the setting of absOffset_.
+          @brief Start of the makernote IFD relative to the start of the
+                 makernote.
          */
-        long adjOffset_;
+        long start_;
         //! Data buffer for the makernote header
         DataBuf header_;
         //! The makernote IFD
diff --git a/src/nikonmn.cpp b/src/nikonmn.cpp
index 564a170..3779a02 100644
--- a/src/nikonmn.cpp
+++ b/src/nikonmn.cpp
@@ -250,7 +250,7 @@ namespace Exiv2 {
 
         header_.alloc(8);
         memcpy(header_.pData_, buf, header_.size_);
-        adjOffset_ = 8;
+        start_ = 8;
         return 0;
     }
 
@@ -463,7 +463,7 @@ namespace Exiv2 {
     Nikon3MakerNote::Nikon3MakerNote(bool alloc)
         : IfdMakerNote(nikon3IfdId, alloc)
     {
-        absOffset_ = false;
+        absShift_ = false;
         byte buf[] = {
             'N', 'i', 'k', 'o', 'n', '

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list