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

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:46:44 UTC 2017


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

The following commit has been merged in the master branch:
commit 043c039d2523d37538f19ae56e52283404aef4be
Author: Robin Mills <robin at clanmills.com>
Date:   Thu Aug 18 20:04:12 2016 +0000

    #1199  Fixing exiv2 -dC image-path to delete ICC profile.
---
 include/exiv2/image.hpp | 11 ++++++++---
 src/actions.cpp         | 11 +++++++++++
 src/actions.hpp         |  4 ++++
 src/webpimage.cpp       | 28 ++++++++++++++--------------
 4 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/include/exiv2/image.hpp b/include/exiv2/image.hpp
index 495ab5c..a2ed2ed 100644
--- a/include/exiv2/image.hpp
+++ b/include/exiv2/image.hpp
@@ -239,6 +239,11 @@ namespace Exiv2 {
               the actual image until the writeMetadata() method is called.
          */
         virtual void clearIccProfile();
+        /*!
+          @brief Erase iccProfile. the profile is not removed from
+              the actual image until the writeMetadata() method is called.
+         */
+        virtual bool iccProfileDefined() { return iccProfile_.size_?true:false;}
 
         /*!
           @brief return iccProfile
@@ -433,11 +438,11 @@ namespace Exiv2 {
         //@}
 
         void setTypeSupported(
-        	int              imageType,
+            int              imageType,
             uint16_t         supportedMetadata
         ) {
-        	imageType_         = imageType;
-        	supportedMetadata_ = supportedMetadata;
+            imageType_         = imageType;
+            supportedMetadata_ = supportedMetadata;
         }
 
         int imageType() const { return imageType_; }
diff --git a/src/actions.cpp b/src/actions.cpp
index 78247f8..24e8944 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -949,6 +949,9 @@ namespace Action {
         if (0 == rc && Params::instance().target_ & Params::ctXmp) {
             rc = eraseXmpData(image.get());
         }
+        if (0 == rc && Params::instance().target_ & Params::ctIccProfile) {
+            rc = eraseIccProfile(image.get());
+        }
         if (0 == rc && Params::instance().target_ & Params::ctIptcRaw) {
             rc = printStructure(std::cout,Exiv2::kpsIptcErase);
         }
@@ -1032,6 +1035,14 @@ namespace Action {
         image->clearXmpPacket();
         return 0;
     }
+    int Erase::eraseIccProfile(Exiv2::Image* image) const
+    {
+        if (Params::instance().verbose_ && image->iccProfileDefined() ) {
+            std::cout << _("Erasing ICC Profile data from the file") << std::endl;
+        }
+        image->clearIccProfile();
+        return 0;
+    }
 
     Erase::AutoPtr Erase::clone() const
     {
diff --git a/src/actions.hpp b/src/actions.hpp
index cfc1d3a..2e0a82d 100644
--- a/src/actions.hpp
+++ b/src/actions.hpp
@@ -275,6 +275,10 @@ namespace Action {
          */
         int eraseXmpData(Exiv2::Image* image) const;
         /*!
+          @brief Erase ICCProfile from the file.
+         */
+        int eraseIccProfile(Exiv2::Image* image) const;
+        /*!
           @brief Print image Structure information (used by ctIptcRaw/kpsIptcErase)
          */
         int printStructure(std::ostream& out, Exiv2::PrintStructureOption option);
diff --git a/src/webpimage.cpp b/src/webpimage.cpp
index a55537e..faa9fe6 100644
--- a/src/webpimage.cpp
+++ b/src/webpimage.cpp
@@ -131,7 +131,7 @@ namespace Exiv2 {
         bool has_exif = false;
         bool has_vp8x = false;
         bool has_alpha = false;
-        bool has_icc = false;
+        bool has_icc = iccProfileDefined();
 
         int width = 0;
         int height = 0;
@@ -140,10 +140,6 @@ namespace Exiv2 {
         std::string xmpData;
         Blob blob;
 
-        if (iccProfile_.size_ > 0) {
-            has_icc = true;
-        }
-
         if (exifData_.count() > 0) {
             ExifParser::encode(blob, littleEndian, exifData_);
             if (blob.size() > 0) {
@@ -174,7 +170,7 @@ namespace Exiv2 {
 
                 /* Chunk with color profile. */
                 if (equalsWebPTag(chunkId, "ICCP") && !has_alpha) {
-                    has_icc = true;
+                    has_icc &= true;
                 }
 
                 /* Chunk with information about features
@@ -299,6 +295,7 @@ namespace Exiv2 {
 
             DataBuf payload(size);
             io_->read(payload.pData_, size);
+            has_icc = iccProfileDefined();
 
             if (equalsWebPTag(chunkId, "VP8X")) {
                 if (has_icc){
@@ -325,14 +322,8 @@ namespace Exiv2 {
                     throw Error(21);
                 if (outIo.write(payload.pData_, payload.size_) != payload.size_)
                     throw Error(21);
-            } else if (equalsWebPTag(chunkId, "ICCP") && has_icc) {
-                ul2Data(size_buff, iccProfile_.size_, littleEndian);
-                if (outIo.write(chunkId.pData_, TAG_SIZE) != TAG_SIZE)
-                    throw Error(21);
-                if (outIo.write(size_buff, 4) != 4)
-                    throw Error(21);
-                if (outIo.write(iccProfile_.pData_, iccProfile_.size_) != iccProfile_.size_)
-                    throw Error(21);
+            } else if (equalsWebPTag(chunkId, "ICCP")) {
+                // Skip and add new data afterwards
             } else if (equalsWebPTag(chunkId, "EXIF")) {
                 // Skip and add new data afterwards
             } else if (equalsWebPTag(chunkId, "XMP ")) {
@@ -397,6 +388,15 @@ namespace Exiv2 {
                 throw Error(21);
             }
         }
+        if (has_icc) {
+            std::string header = "ICCP";
+            if (outIo.write((const byte*)header.data(), TAG_SIZE) != TAG_SIZE) throw Error(21);
+            ul2Data(data, (uint32_t) iccProfile_.size_, littleEndian);
+            if (outIo.write(data, 4) != 4) throw Error(21);
+            if (outIo.write((const byte*)iccProfile_.pData_, static_cast<long>(iccProfile_.size_) != (long)iccProfile_.size_)) {
+                throw Error(21);
+            }
+        }
 
         // Fix File Size Payload Data
         outIo.seek(0, BasicIo::beg);

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list