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


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

The following commit has been merged in the master branch:
commit 57cdf19286822ccb5a825078735a059ec0df20cd
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Fri Apr 2 09:59:16 2004 +0000

    Added support to read from / write to *.exv files, made return values of writeThumbnail consistent with those of other write functions
---
 src/exif.cpp | 44 +++++++++++++++++++++++++++++++++-----------
 src/exif.hpp | 17 ++++++++++++++---
 2 files changed, 47 insertions(+), 14 deletions(-)

diff --git a/src/exif.cpp b/src/exif.cpp
index 64069d5..02acde1 100644
--- a/src/exif.cpp
+++ b/src/exif.cpp
@@ -20,14 +20,14 @@
  */
 /*
   File:      exif.cpp
-  Version:   $Name:  $ $Revision: 1.36 $
+  Version:   $Name:  $ $Revision: 1.37 $
   Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
   History:   26-Jan-04, ahu: created
              11-Feb-04, ahu: isolated as a component
  */
 // *****************************************************************************
 #include "rcsid.hpp"
-EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.36 $ $RCSfile: exif.cpp,v $")
+EXIV2_RCSID("@(#) $Name:  $ $Revision: 1.37 $ $RCSfile: exif.cpp,v $")
 
 // *****************************************************************************
 // included header files
@@ -270,9 +270,9 @@ namespace Exif {
     {
         std::string name = path + extension();
         std::ofstream file(name.c_str(), std::ios::binary);
-        if (!file) return 1;
+        if (!file) return -1;
         file.write(pImage_, size_);
-        if (!file.good()) return 2;
+        if (!file.good()) return 4;
         return 0;
     } // TiffThumbnail::write
 
@@ -410,9 +410,9 @@ namespace Exif {
     {
         std::string name = path + extension();
         std::ofstream file(name.c_str(), std::ios::binary);
-        if (!file) return 1;
+        if (!file) return -1;
         file.write(pImage_, size_);
-        if (!file.good()) return 2;
+        if (!file.good()) return 4;
         return 0;
     } // JpegThumbnail::write
 
@@ -483,11 +483,20 @@ namespace Exif {
         std::ifstream file(path.c_str(), std::ios::binary);
         if (!file) return -1;
         Image* pImage = ImageFactory::instance().create(file);
-        if (pImage == 0) return -2;
-        int rc = pImage->readExifData(file);
-        if (rc == 0) rc = read(pImage->exifData(), pImage->sizeExifData());
-        delete pImage;
-        return rc;
+        if (pImage) {
+            int rc = pImage->readExifData(file);
+            if (rc == 0) rc = read(pImage->exifData(), pImage->sizeExifData());
+            delete pImage;
+            return rc;
+        }
+        if (ExvFile::isThisType(file)) {
+            ExvFile exvFile;
+            int rc = exvFile.readExifData(file);
+            if (rc == 0) rc = read(exvFile.exifData(), exvFile.sizeExifData());
+            return rc;
+        }
+        // We don't know this type of file
+        return -2;
     }
 
     int ExifData::read(const char* buf, long len)
@@ -771,6 +780,19 @@ std::cerr << "->>>>>> writing from metadata <<<<<<-
";
         return size;
     } // ExifData::size
 
+    int ExifData::writeExifData(const std::string& path)
+    {
+        long size = this->size();
+        char* buf = new char[size];
+        long actualSize = copy(buf);
+        assert(actualSize <= size);
+
+        ExvFile exvFile;
+        exvFile.setExifData(buf, actualSize);
+        delete[] buf;
+        return exvFile.writeExifData(path);
+    } // ExifData::writeExifData
+
     void ExifData::add(Entries::const_iterator begin, 
                        Entries::const_iterator end,
                        ByteOrder byteOrder)
diff --git a/src/exif.hpp b/src/exif.hpp
index 97bc46d..47006b3 100644
--- a/src/exif.hpp
+++ b/src/exif.hpp
@@ -21,7 +21,7 @@
 /*!
   @file    exif.hpp
   @brief   Encoding and decoding of %Exif data
-  @version $Name:  $ $Revision: 1.36 $
+  @version $Name:  $ $Revision: 1.37 $
   @author  Andreas Huggel (ahu)
            <a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
   @date    09-Jan-04, ahu: created
@@ -276,8 +276,10 @@ namespace Exif {
         //! @name Accessors
         //@{
         /*!
-          @brief Write thumbnail to file path, return 0 if successful, -1 if 
-                 there is no thumbnail image to write.
+          @brief  Write thumbnail to file path.
+          @return  0 if successful;<BR>
+                  -1 if the file couldn't be open;<BR>
+                   4 if writing to the output stream failed.
          */
         virtual int write(const std::string& path) const =0;
         /*!
@@ -531,6 +533,15 @@ namespace Exif {
          */
         int write(const std::string& path);
         /*!
+          @brief Write the %Exif data to a binary file. By convention, the
+                 filename extension should be ".exv". This file format contains
+                 the %Exif data as it is found in a JPEG file, starting with the
+                 APP1 marker 0xffe1, the size of the data and the string
+                 "Exif

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list