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


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

The following commit has been merged in the master branch:
commit 431ee85816196e71dfb189fb611e00d8f49b0768
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Sat May 13 15:43:55 2006 +0000

    Added support for MRW images (read-only), first try
---
 src/Makefile                        |   1 +
 src/imgreg.cpp                      |   4 +-
 src/{tiffimage.cpp => mrwimage.cpp} | 128 ++++++++++++++----------------------
 src/{tiffimage.hpp => mrwimage.hpp} | 124 ++++++++++------------------------
 4 files changed, 89 insertions(+), 168 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index f1a3d5d..f5942e3 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -70,6 +70,7 @@ CCSRC = basicio.cpp           \
 	makernote2.cpp        \
 	metadatum.cpp         \
 	minoltamn.cpp         \
+	mrwimage.cpp          \
 	nikonmn.cpp           \
 	olympusmn.cpp         \
 	panasonicmn.cpp       \
diff --git a/src/imgreg.cpp b/src/imgreg.cpp
index 0f524d8..ee24017 100644
--- a/src/imgreg.cpp
+++ b/src/imgreg.cpp
@@ -35,6 +35,7 @@ EXIV2_RCSID("@(#) $Id$");
 #include "jpgimage.hpp"
 //#include "cr2image.hpp"
 #include "crwimage.hpp"
+#include "mrwimage.hpp"
 #include "tiffimage.hpp"
 
 // + standard includes
@@ -46,8 +47,9 @@ namespace Exiv2 {
     ImageFactory::Registry ImageFactory::registry_[] = {
         Registry(ImageType::jpeg, newJpegInstance, isJpegType),
         Registry(ImageType::exv,  newExvInstance,  isExvType),
-//        Registry(ImageType::cr2,  newCr2Instance,  isCr2Type),
+//      Registry(ImageType::cr2,  newCr2Instance,  isCr2Type),
         Registry(ImageType::crw,  newCrwInstance,  isCrwType),
+        Registry(ImageType::mrw,  newMrwInstance,  isMrwType),
         Registry(ImageType::tiff, newTiffInstance, isTiffType)
     };
 
diff --git a/src/tiffimage.cpp b/src/mrwimage.cpp
similarity index 60%
copy from src/tiffimage.cpp
copy to src/mrwimage.cpp
index 2f8dcde..547db56 100644
--- a/src/tiffimage.cpp
+++ b/src/mrwimage.cpp
@@ -19,11 +19,11 @@
  * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
  */
 /*
-  File:      tiffimage.cpp
+  File:      mrwimage.cpp
   Version:   $Rev$
   Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
-  History:   15-Mar-06, ahu: created
-
+  History:   13-May-06, ahu: created
+  Credits:   See header file
  */
 // *****************************************************************************
 #include "rcsid.hpp"
@@ -37,84 +37,83 @@ EXIV2_RCSID("@(#) $Id$");
 # include "exv_conf.h"
 #endif
 
-#include "tiffimage.hpp"
+#include "mrwimage.hpp"
 #include "tiffparser.hpp"
 #include "image.hpp"
+#include "basicio.hpp"
 #include "error.hpp"
 #include "futils.hpp"
 
 // + standard includes
 #include <string>
+#include <cstring>
 #include <iostream>
-#include <iomanip>
 #include <cassert>
 
 // *****************************************************************************
 // class member definitions
 namespace Exiv2 {
 
-    TiffImage::TiffImage(BasicIo::AutoPtr io, bool create)
-        : Image(mdExif | mdComment), io_(io)
+    MrwImage::MrwImage(BasicIo::AutoPtr io, bool create)
+        : Image(mdExif), io_(io)
     {
         if (create) {
             IoCloser closer(*io_);
             io_->open();
         }
-    } // TiffImage::TiffImage
+    } // MrwImage::MrwImage
 
-    bool TiffImage::good() const
+    bool MrwImage::good() const
     {
         if (io_->open() != 0) return false;
         IoCloser closer(*io_);
         return isThisType(*io_, false);
     }
 
-    void TiffImage::clearMetadata()
+    void MrwImage::clearMetadata()
     {
         clearExifData();
-        clearComment();
     }
 
-    void TiffImage::setMetadata(const Image& image)
+    void MrwImage::setMetadata(const Image& image)
     {
         setExifData(image.exifData());
-        setComment(image.comment());
     }
 
-    void TiffImage::clearExifData()
+    void MrwImage::clearExifData()
     {
         exifData_.clear();
     }
 
-    void TiffImage::setExifData(const ExifData& exifData)
+    void MrwImage::setExifData(const ExifData& exifData)
     {
         exifData_ = exifData;
     }
 
-    void TiffImage::clearIptcData()
+    void MrwImage::clearIptcData()
     {
         // not supported
     }
 
-    void TiffImage::setIptcData(const IptcData& /*iptcData*/)
+    void MrwImage::setIptcData(const IptcData& /*iptcData*/)
     {
         // not supported
     }
 
-    void TiffImage::clearComment()
+    void MrwImage::clearComment()
     {
-        comment_.erase();
+        // not supported
     }
 
-    void TiffImage::setComment(const std::string& comment)
+    void MrwImage::setComment(const std::string& comment)
     {
-        comment_ = comment;
+        // not supported
     }
 
-    void TiffImage::readMetadata()
+    void MrwImage::readMetadata()
     {
 #ifdef DEBUG
-        std::cerr << "Reading TIFF file " << io_->path() << "
";
+        std::cerr << "Reading MRW file " << io_->path() << "
";
 #endif
         if (io_->open() != 0) {
             throw Error(9, io_->path(), strError());
@@ -123,27 +122,37 @@ namespace Exiv2 {
         // Ensure that this is the correct image type
         if (!isThisType(*io_, false)) {
             if (io_->error() || io_->eof()) throw Error(14);
-            throw Error(33);
+            throw Error(3, "MRW");
         }
         clearMetadata();
 
         // Read the image into a memory buffer
-        long len = io_->size();
-        DataBuf buf(len);
-        io_->read(buf.pData_, len);
+        uint32_t const len = 16;
+        byte tmp[len];
+        io_->read(tmp, len);
+        if (io_->error() || io_->eof()) throw Error(14);
+
+        io_->seek(getLong(tmp + 12, bigEndian), BasicIo::cur);
+        if (io_->error() || io_->eof()) throw Error(14);
+        
+        io_->read(tmp, 8);
+        if (io_->error() || io_->eof()) throw Error(14);
+
+        DataBuf buf(getULong(tmp + 4, bigEndian));
+        io_->read(buf.pData_, buf.size_);
         if (io_->error() || io_->eof()) throw Error(14);
 
         TiffParser::decode(this, buf.pData_, buf.size_, TiffCreator::create);
-    } // TiffImage::readMetadata
+    } // MrwImage::readMetadata
 
-    void TiffImage::writeMetadata()
+    void MrwImage::writeMetadata()
     {
 /*
 
        Todo: implement me!
 
 #ifdef DEBUG
-        std::cerr << "Writing TIFF file " << io_->path() << "
";
+        std::cerr << "Writing MRW file " << io_->path() << "
";
 #endif
         // Read existing image
         DataBuf buf;
@@ -160,7 +169,7 @@ namespace Exiv2 {
             }
         }
 
-        // Parse image, starting with a TIFF header component
+        // Parse image, starting with a MRW header component
         TiffHeade2::AutoPtr head(new TiffHeade2);
         if (buf.size_ != 0) {
             head->read(buf.pData_, buf.size_);
@@ -176,75 +185,38 @@ namespace Exiv2 {
         io_->close();
         io_->transfer(*tempIo); // may throw
 */
-    } // TiffImage::writeMetadata
+    } // MrwImage::writeMetadata
 
-    bool TiffImage::isThisType(BasicIo& iIo, bool advance) const
+    bool MrwImage::isThisType(BasicIo& iIo, bool advance) const
     {
-        return isTiffType(iIo, advance);
+        return isMrwType(iIo, advance);
     }
 
-    const uint16_t TiffHeade2::tag_ = 42;
-
-    bool TiffHeade2::read(const byte* pData, uint32_t size)
-    {
-        if (size < 8) return false;
-
-        if (pData[0] == 0x49 && pData[1] == 0x49) {
-            byteOrder_ = littleEndian;
-        }
-        else if (pData[0] == 0x4d && pData[1] == 0x4d) {
-            byteOrder_ = bigEndian;
-        }
-        else {
-            return false;
-        }
-        if (tag_ != getUShort(pData + 2, byteOrder_)) return false;
-        offset_ = getULong(pData + 4, byteOrder_);
-
-        return true;
-    } // TiffHeade2::read
-
-    void TiffHeade2::print(std::ostream& os, const std::string& prefix) const
-    {
-        os << prefix
-           << "Header, offset = 0x" << std::setw(8) << std::setfill('0')
-           << std::hex << std::right << offset_;
-
-        switch (byteOrder_) {
-        case littleEndian:     os << ", little endian encoded"; break;
-        case bigEndian:        os << ", big endian encoded"; break;
-        case invalidByteOrder: break;
-        }
-        os << "
";
-
-    } // TiffHeade2::print
-
     // *************************************************************************
     // free functions
 
-    Image::AutoPtr newTiffInstance(BasicIo::AutoPtr io, bool create)
+    Image::AutoPtr newMrwInstance(BasicIo::AutoPtr io, bool create)
     {
-        Image::AutoPtr image(new TiffImage(io, create));
+        Image::AutoPtr image(new MrwImage(io, create));
         if (!image->good()) {
             image.reset();
         }
         return image;
     }
 
-    bool isTiffType(BasicIo& iIo, bool advance)
+    bool isMrwType(BasicIo& iIo, bool advance)
     {
-        const int32_t len = 8;
+        const int32_t len = 4;
         byte buf[len];
         iIo.read(buf, len);
         if (iIo.error() || iIo.eof()) {
             return false;
         }
-        TiffHeade2 tiffHeader;
-        bool rc = tiffHeader.read(buf, len);
-        if (!advance || !rc) {
+        int rc = memcmp(buf, "

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list