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


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

The following commit has been merged in the master branch:
commit 15b0cf42ad8d940a0d49beb255d9c742aca8e77e
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Sat Apr 29 10:10:53 2006 +0000

    New TIFF parser: Simplified Makernote design.
---
 src/Makefile         |   8 --
 src/canonmn2.cpp     |  99 -------------
 src/canonmn2.hpp     | 109 --------------
 src/fujimn2.cpp      | 120 ----------------
 src/fujimn2.hpp      | 132 -----------------
 src/makernote2.cpp   | 338 +++++++++++++++++++++++++++++++++++++++++--
 src/makernote2.hpp   | 399 ++++++++++++++++++++++++++++++++++++++++++++-------
 src/mnreg.cpp        |  80 -----------
 src/nikonmn2.cpp     | 166 ---------------------
 src/nikonmn2.hpp     | 221 ----------------------------
 src/olympusmn2.cpp   | 103 -------------
 src/olympusmn2.hpp   | 126 ----------------
 src/panasonicmn2.cpp |  99 -------------
 src/panasonicmn2.hpp | 126 ----------------
 src/sigmamn2.cpp     | 103 -------------
 src/sigmamn2.hpp     | 127 ----------------
 src/sonymn2.cpp      |  99 -------------
 src/sonymn2.hpp      | 126 ----------------
 src/tiffparser.cpp   |  38 +++--
 src/tiffvisitor.cpp  |  13 +-
 src/tiffvisitor.hpp  |  57 +++++---
 21 files changed, 742 insertions(+), 1947 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index 6ded735..3aadbe7 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -55,14 +55,12 @@ CCHDR = exv_conf.h            \
 # Add library C++ source files to this list
 CCSRC = basicio.cpp           \
 	canonmn.cpp           \
-	canonmn2.cpp          \
 	crwimage.cpp          \
 	datasets.cpp          \
 	error.cpp             \
 	exif.cpp              \
 	futils.cpp            \
 	fujimn.cpp            \
-	fujimn2.cpp           \
 	ifd.cpp               \
 	image.cpp             \
 	imgreg.cpp            \
@@ -71,17 +69,11 @@ CCSRC = basicio.cpp           \
 	makernote.cpp         \
 	makernote2.cpp        \
 	metadatum.cpp         \
-	mnreg.cpp             \
 	nikonmn.cpp           \
-	nikonmn2.cpp          \
 	olympusmn.cpp         \
-	olympusmn2.cpp        \
 	panasonicmn.cpp       \
-	panasonicmn2.cpp      \
 	sigmamn.cpp           \
-	sigmamn2.cpp          \
 	sonymn.cpp            \
-	sonymn2.cpp           \
 	tags.cpp              \
 	tiffcomposite.cpp     \
 	tiffimage.cpp         \
diff --git a/src/canonmn2.cpp b/src/canonmn2.cpp
deleted file mode 100644
index d1b5acf..0000000
--- a/src/canonmn2.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-// ***************************************************************** -*- C++ -*-
-/*
- * Copyright (C) 2006 Andreas Huggel <ahuggel at gmx.net>
- *
- * This program is part of the Exiv2 distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
- */
-/*
-  File:      canonmn2.cpp
-  Version:   $Rev$
-  Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
-  History:   18-Apr-06, ahu: created
- */
-// *****************************************************************************
-#include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Id$");
-
-// *****************************************************************************
-// included header files
-#ifdef _MSC_VER
-# include "exv_msvc.h"
-#else
-# include "exv_conf.h"
-#endif
-
-#include "canonmn2.hpp"
-#include "tiffcomposite.hpp"
-#include "types.hpp"
-
-// + standard includes
-
-// *****************************************************************************
-// class member definitions
-namespace Exiv2 {
-
-    const TiffStructure TiffCanonCreator::tiffStructure_[] = {
-        // ext. tag           group  create function      new group
-        //---------  --------------  -------------------  --------------
-        {    0x0001, Group::canonmn, newTiffArrayEntry,   Group::canoncs },
-        {    0x0004, Group::canonmn, newTiffArrayEntry,   Group::canonsi },
-        {    0x000f, Group::canonmn, newTiffArrayEntry,   Group::canoncf },
-        {  Tag::all, Group::canoncs, newTiffArrayElement, Group::canoncs },
-        {  Tag::all, Group::canonsi, newTiffArrayElement, Group::canonsi },
-        {  Tag::all, Group::canoncf, newTiffArrayElement, Group::canoncf }
-    };
-
-    TiffComponent::AutoPtr TiffCanonCreator::create(uint32_t extendedTag,
-                                                    uint16_t group)
-    {
-        TiffComponent::AutoPtr tc(0);
-        uint16_t tag = static_cast<uint16_t>(extendedTag & 0xffff);
-        const TiffStructure* ts = find(tiffStructure_,
-                                       TiffStructure::Key(extendedTag, group));
-        if (ts && ts->newTiffCompFct_) {
-            tc = ts->newTiffCompFct_(tag, ts);
-        }
-        if (!ts && extendedTag != Tag::next) {
-            tc = TiffComponent::AutoPtr(new TiffEntry(tag, group));
-        }
-        return tc;
-    } // TiffCanonCreator::create
-
-    TiffRwState::AutoPtr TiffCanonMn::doGetState(uint32_t /*mnOffset*/,
-                                                 ByteOrder byteOrder) const
-    {
-        // Byteorder: No change
-        // Offsets  : No change (relative to the start of the TIFF header)
-        // Creator  : Canon TIFF component factory
-        return TiffRwState::AutoPtr(
-            new TiffRwState(byteOrder, 0, TiffCanonCreator::create));
-    }
-
-    // *************************************************************************
-    // free functions
-
-    TiffComponent* newCanonMn(uint16_t    tag,
-                              uint16_t    group,
-                              uint16_t    mnGroup,
-                              const byte* /*pData*/,
-                              uint32_t    /*size*/, 
-                              ByteOrder   /*byteOrder*/)
-    {
-        return new TiffCanonMn(tag, group, mnGroup);
-    }
-
-}                                       // namespace Exiv2
diff --git a/src/canonmn2.hpp b/src/canonmn2.hpp
deleted file mode 100644
index 3879d0b..0000000
--- a/src/canonmn2.hpp
+++ /dev/null
@@ -1,109 +0,0 @@
-// ***************************************************************** -*- C++ -*-
-/*
- * Copyright (C) 2006 Andreas Huggel <ahuggel at gmx.net>
- *
- * This program is part of the Exiv2 distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
- */
-/*!
-  @file    canonmn2.hpp
-  @brief   TIFF Canon makernote
-  @version $Rev$
-  @author  Andreas Huggel (ahu)
-           <a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
-  @date    18-Apr-06, ahu: created
- */
-#ifndef CANONMN2_HPP_
-#define CANONMN2_HPP_
-
-// *****************************************************************************
-// included header files
-#include "makernote2.hpp"
-#include "tiffcomposite.hpp"
-#include "types.hpp"
-
-// + standard includes
-
-// *****************************************************************************
-// namespace extensions
-namespace Exiv2 {
-
-// *****************************************************************************
-// class definitions
-
-    namespace Group {
-        const uint16_t canonmn = 259; //!< Canon makernote
-        const uint16_t canoncs = 260; //!< Canon camera settings
-        const uint16_t canonsi = 261; //!< Canon shot info
-        const uint16_t canoncf = 262; //!< Canon customer functions
-    }
-
-    /*!
-      @brief Canon Makernote
-     */
-    class TiffCanonMn : public TiffIfdMakernote {
-    public:
-        //! @name Creators
-        //@{
-        //! Default constructor
-        TiffCanonMn(uint16_t tag, uint16_t group, uint16_t mnGroup)
-            : TiffIfdMakernote(tag, group, mnGroup) {}
-        //! Virtual destructor
-        virtual ~TiffCanonMn() {}
-        //@}
-    private:
-        //! @name Accessors
-        //@{
-        virtual TiffRwState::AutoPtr doGetState(uint32_t  mnOffset,
-                                                ByteOrder byteOrder) const;
-        //@}
-
-    }; // class TiffCanonMn
-
-    /*!
-      @brief TIFF component factory for Canon TIFF components.
-     */
-    class TiffCanonCreator {
-    public:
-        /*!
-          @brief Create the TiffComponent for TIFF entry \em extendedTag and 
-                 \em group based on the embedded lookup table.
-
-          If a tag and group combination is not found in the table, a TiffEntry
-          is created.  If the pointer that is returned is 0, then the TIFF entry
-          should be ignored.
-        */
-        static TiffComponent::AutoPtr create(uint32_t extendedTag,
-                                             uint16_t group);
-
-    private:
-        static const TiffStructure tiffStructure_[]; //<! TIFF structure
-    }; // class TiffCanonCreator
-
-// *****************************************************************************
-// template, inline and free functions
-
-    //! Function to create a Canon makernote
-    TiffComponent* newCanonMn(uint16_t    tag,
-                              uint16_t    group,
-                              uint16_t    mnGroup,
-                              const byte* pData,
-                              uint32_t    size, 
-                              ByteOrder   byteOrder);
-
-}                                       // namespace Exiv2
-
-#endif                                  // #ifndef CANONMN2_HPP_
diff --git a/src/fujimn2.cpp b/src/fujimn2.cpp
deleted file mode 100644
index 0b795bb..0000000
--- a/src/fujimn2.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-// ***************************************************************** -*- C++ -*-
-/*
- * Copyright (C) 2006 Andreas Huggel <ahuggel at gmx.net>
- *
- * This program is part of the Exiv2 distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
- */
-/*
-  File:      fujimn2.cpp
-  Version:   $Rev$
-  Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
-  History:   15-Apr-06, ahu: created
- */
-// *****************************************************************************
-#include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Id$");
-
-// *****************************************************************************
-// included header files
-#ifdef _MSC_VER
-# include "exv_msvc.h"
-#else
-# include "exv_conf.h"
-#endif
-
-#include "fujimn2.hpp"
-#include "tiffcomposite.hpp"
-#include "tiffparser.hpp"
-#include "types.hpp"
-
-// + standard includes
-#include <cstring>
-#include <cassert>
-
-// *****************************************************************************
-// class member definitions
-namespace Exiv2 {
-
-    const byte FujiMnHeader::signature_[] = {
-        'F', 'U', 'J', 'I', 'F', 'I', 'L', 'M', 0x0c, 0x00, 0x00, 0x00
-    };
-    const uint32_t FujiMnHeader::size_ = 12;
-    const ByteOrder FujiMnHeader::byteOrder_ = littleEndian;
-
-    FujiMnHeader::FujiMnHeader()
-    {
-        read(signature_, size_, byteOrder_);
-    }
-
-    bool FujiMnHeader::read(const byte* pData,
-                            uint32_t size, 
-                            ByteOrder /*byteOrder*/)
-    {
-        assert (pData != 0);
-
-        if (size < size_) return false;
-
-        header_.alloc(size_);
-        memcpy(header_.pData_, pData, header_.size_);
-
-        // Read offset to the IFD relative to the start of the makernote
-        // from the header. Note that we ignore the byteOrder argument
-        start_ = getUShort(header_.pData_ + 8, byteOrder_);
-
-        if (   static_cast<uint32_t>(header_.size_) < size_ 
-            || 0 != memcmp(header_.pData_, signature_, 8)) {
-            return false;
-        }
-        return true;
-    } // FujiMnHeader::read
-
-    bool TiffFujiMn::doReadHeader(const byte* pData,
-                                  uint32_t size,
-                                  ByteOrder byteOrder)
-    {
-        return header_.read(pData, size, byteOrder);
-    }
-    
-    uint32_t TiffFujiMn::doIfdOffset() const
-    {
-        return header_.ifdOffset();
-    }
-
-    TiffRwState::AutoPtr TiffFujiMn::doGetState(uint32_t mnOffset,
-                                                ByteOrder /*byteOrder*/) const
-    {
-        // Byteorder: from the header (little endian) 
-        // Offsets  : relative to the start of the makernote
-        // Creator  : no change
-        return TiffRwState::AutoPtr(
-            new TiffRwState(header_.byteOrder(), mnOffset, 0));
-    }
-
-    // *************************************************************************
-    // free functions
-
-    TiffComponent* newFujiMn(uint16_t    tag,
-                             uint16_t    group,
-                             uint16_t    mnGroup,
-                             const byte* /*pData*/,
-                             uint32_t    /*size*/, 
-                             ByteOrder   /*byteOrder*/)
-    {
-        return new TiffFujiMn(tag, group, mnGroup);
-    }
-
-}                                       // namespace Exiv2
diff --git a/src/fujimn2.hpp b/src/fujimn2.hpp
deleted file mode 100644
index d4ccd8f..0000000
--- a/src/fujimn2.hpp
+++ /dev/null
@@ -1,132 +0,0 @@
-// ***************************************************************** -*- C++ -*-
-/*
- * Copyright (C) 2006 Andreas Huggel <ahuggel at gmx.net>
- *
- * This program is part of the Exiv2 distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
- */
-/*!
-  @file    fujimn2.hpp
-  @brief   TIFF Fujifilm makernote
-  @version $Rev$
-  @author  Andreas Huggel (ahu)
-           <a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
-  @date    15-Apr-06, ahu: created
- */
-#ifndef FUJIMN2_HPP_
-#define FUJIMN2_HPP_
-
-// *****************************************************************************
-// included header files
-#include "makernote2.hpp"
-#include "tiffcomposite.hpp"
-#include "types.hpp"
-
-// + standard includes
-
-// *****************************************************************************
-// namespace extensions
-namespace Exiv2 {
-
-// *****************************************************************************
-// class definitions
-
-    namespace Group {
-        const uint16_t fujimn = 258; //!< Fujifilm makernote
-    }
-
-    //! Header of a Fujifilm Makernote
-    class FujiMnHeader : public MnHeader {
-    public:
-        //! @name Creators
-        //@{
-        //! Default constructor
-        FujiMnHeader();
-        //! Virtual destructor.
-        virtual ~FujiMnHeader() {}
-        //@}
-        //! @name Manipulators
-        //@{
-        virtual bool read(const byte* pData, 
-                          uint32_t    size, 
-                          ByteOrder   byteOrder);
-        //@}
-        //! @name Accessors
-        //@{
-        virtual uint32_t size()      const { return header_.size_; }
-        virtual uint32_t ifdOffset() const { return start_; }
-        //! Return the byte order for the header
-        ByteOrder        byteOrder() const { return byteOrder_; }
-        //@}
-
-    private:
-        DataBuf header_;                //!< Data buffer for the makernote header
-        static const byte signature_[]; //!< Fujifilm makernote header signature
-        static const uint32_t size_;    //!< Size of the signature
-        static const ByteOrder byteOrder_; //!< Byteorder for makernote (II)
-        uint32_t start_;                //!< Start of the mn IFD rel. to mn start
-
-    }; // class FujiMnHeader
-
-    /*!
-      @brief Fujifilm Makernote
-     */
-    class TiffFujiMn : public TiffIfdMakernote {
-    public:
-        //! @name Creators
-        //@{
-        //! Default constructor
-        TiffFujiMn(uint16_t tag, uint16_t group, uint16_t mnGroup)
-            : TiffIfdMakernote(tag, group, mnGroup) {}
-        //! Virtual destructor
-        virtual ~TiffFujiMn() {}
-        //@}
-
-    private:
-        //! @name Manipulators
-        //@{
-        virtual bool doReadHeader(const byte* pData,
-                                  uint32_t    size, 
-                                  ByteOrder   byteOrder);
-        //@}
-
-        //! @name Accessors
-        //@{
-        virtual uint32_t doIfdOffset() const;
-        virtual TiffRwState::AutoPtr doGetState(uint32_t  mnOffset,
-                                                ByteOrder byteOrder) const;
-        //@}
-
-    private:
-        // DATA
-        FujiMnHeader header_;                //!< Makernote header
-
-    }; // TiffFujiMn
-
-// *****************************************************************************
-// template, inline and free functions
-
-    //! Function to create a Fujifilm makernote
-    TiffComponent* newFujiMn(uint16_t    tag,
-                             uint16_t    group,
-                             uint16_t    mnGroup,
-                             const byte* pData,
-                             uint32_t    size, 
-                             ByteOrder   byteOrder);
-
-}                                       // namespace Exiv2
-
-#endif                                  // #ifndef FUJIMN2_HPP_
diff --git a/src/makernote2.cpp b/src/makernote2.cpp
index e8d9e91..aae68b9 100644
--- a/src/makernote2.cpp
+++ b/src/makernote2.cpp
@@ -39,6 +39,7 @@ EXIV2_RCSID("@(#) $Id$");
 #include "makernote2.hpp"
 #include "tiffcomposite.hpp"
 #include "tiffvisitor.hpp"
+#include "tiffimage.hpp"
 
 // + standard includes
 #include <string>
@@ -47,38 +48,70 @@ EXIV2_RCSID("@(#) $Id$");
 // class member definitions
 namespace Exiv2 {
 
+    const TiffMnRegistry TiffMnCreator::registry_[] = {
+        { "Canon",     newCanonMn,     Group::canonmn },
+        { "FOVEON",    newSigmaMn,     Group::sigmamn },
+        { "FUJIFILM",  newFujiMn,      Group::fujimn  },
+        { "NIKON",     newNikonMn,     Group::nikonmn },
+        { "OLYMPUS",   newOlympusMn,   Group::olympmn },
+        { "Panasonic", newPanasonicMn, Group::panamn  },
+        { "SIGMA",     newSigmaMn,     Group::sigmamn },
+        { "SONY",      newSonyMn,      Group::sonymn  }
+    };
+
     bool TiffMnRegistry::operator==(const TiffMnRegistry::Key& key) const
     {
         std::string make(make_);
         return make == key.make_.substr(0, make.length());
     }
 
+    TiffComponent* TiffMnCreator::create(uint16_t           tag,
+                                         uint16_t           group,
+                                         const std::string& make,
+                                         const byte*        pData,
+                                         uint32_t           size,
+                                         ByteOrder          byteOrder)
+    {
+        TiffComponent* tc = 0;
+        const TiffMnRegistry* tmr = find(registry_, TiffMnRegistry::Key(make));
+        if (tmr) tc = tmr->newMnFct_(tag, 
+                                     group, 
+                                     tmr->mnGroup_,
+                                     pData,
+                                     size,
+                                     byteOrder);
+        return tc;
+    } // TiffMnCreator::create
+
     TiffIfdMakernote::~TiffIfdMakernote()
     {
+        delete pHeader_;
     }
 
-    bool TiffIfdMakernote::readHeader(const byte* pData, 
-                                      uint32_t    size,
-                                      ByteOrder   byteOrder)
+    uint32_t TiffIfdMakernote::ifdOffset() const
     {
-        return doReadHeader(pData, size, byteOrder);
+        if (!pHeader_) return 0;
+        return pHeader_->ifdOffset(); 
     }
 
-    uint32_t TiffIfdMakernote::ifdOffset() const
+    ByteOrder TiffIfdMakernote::byteOrder () const 
     {
-        return doIfdOffset();
+        if (!pHeader_) return invalidByteOrder;
+        return pHeader_->byteOrder(); 
     }
 
-    TiffRwState::AutoPtr TiffIfdMakernote::getState(uint32_t  mnOffset,
-                                                    ByteOrder byteOrder) const
+    uint32_t TiffIfdMakernote::baseOffset(uint32_t mnOffset) const 
     {
-        return doGetState(mnOffset, byteOrder);
+        if (!pHeader_) return 0;
+        return pHeader_->baseOffset(mnOffset);
     }
 
-    TiffRwState::AutoPtr TiffIfdMakernote::doGetState(uint32_t /*mnOffset*/,
-                                                      ByteOrder /*byteOrder*/) const
+    bool TiffIfdMakernote::readHeader(const byte* pData, 
+                                      uint32_t    size,
+                                      ByteOrder   byteOrder)
     {
-        return TiffRwState::AutoPtr(0);
+        if (!pHeader_) return true;
+        return pHeader_->read(pData, size, byteOrder);
     }
 
     void TiffIfdMakernote::doAddChild(TiffComponent::AutoPtr tiffComponent)
@@ -98,4 +131,285 @@ namespace Exiv2 {
         if (visitor.go()) visitor.visitIfdMakernoteEnd(this);
     }
 
+    const byte OlympusMnHeader::signature_[] = {
+        'O', 'L', 'Y', 'M', 'P', 0x00, 0x01, 0x00
+    };
+    const uint32_t OlympusMnHeader::size_ = 8;
+
+    OlympusMnHeader::OlympusMnHeader()
+    {
+        read(signature_, size_, invalidByteOrder);
+    }
+
+    bool OlympusMnHeader::read(const byte* pData, 
+                               uint32_t size, 
+                               ByteOrder /*byteOrder*/)
+    {
+        assert (pData != 0);
+
+        if (size < size_) return false;
+
+        header_.alloc(size_);
+        memcpy(header_.pData_, pData, header_.size_);
+        if (   static_cast<uint32_t>(header_.size_) < size_ 
+            || 0 != memcmp(header_.pData_, signature_, 5)) {
+            return false;
+        }
+        return true;
+    } // OlympusMnHeader::read
+
+    const byte FujiMnHeader::signature_[] = {
+        'F', 'U', 'J', 'I', 'F', 'I', 'L', 'M', 0x0c, 0x00, 0x00, 0x00
+    };
+    const uint32_t FujiMnHeader::size_ = 12;
+    const ByteOrder FujiMnHeader::byteOrder_ = littleEndian;
+
+    FujiMnHeader::FujiMnHeader()
+    {
+        read(signature_, size_, byteOrder_);
+    }
+
+    bool FujiMnHeader::read(const byte* pData,
+                            uint32_t size, 
+                            ByteOrder /*byteOrder*/)
+    {
+        assert (pData != 0);
+
+        if (size < size_) return false;
+
+        header_.alloc(size_);
+        memcpy(header_.pData_, pData, header_.size_);
+
+        // Read offset to the IFD relative to the start of the makernote
+        // from the header. Note that we ignore the byteOrder argument
+        start_ = getUShort(header_.pData_ + 8, byteOrder_);
+
+        if (   static_cast<uint32_t>(header_.size_) < size_ 
+            || 0 != memcmp(header_.pData_, signature_, 8)) {
+            return false;
+        }
+        return true;
+    } // FujiMnHeader::read
+
+
+    const byte Nikon2MnHeader::signature_[] = {
+        'N', 'i', 'k', 'o', 'n', '

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list