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


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

The following commit has been merged in the master branch:
commit 5edc759cc9630183791593eba768e1c81d6640b4
Author: Robin Mills <robin at clanmills.com>
Date:   Wed Sep 14 10:02:51 2016 +0000

    #1074 For discussion see: http://dev.exiv2.org/issues/1074#note-23
---
 include/exiv2/image.hpp                            |  11 +-
 src/actions.cpp                                    |  42 +--
 src/error.cpp                                      |   5 +-
 src/image.cpp                                      |  12 +-
 src/jpgimage.cpp                                   | 101 +++---
 src/tiffimage.cpp                                  |  41 ++-
 test/data/Reagan.jpg                               | Bin 49770 -> 38376 bytes
 test/data/{big.icc => ReaganLargeJpg.jpg}          | Bin 1613600 -> 1647151 bytes
 test/data/{ReaganLarge.png => ReaganLargePng.png}  | Bin
 .../{ReaganLarge.tiff => ReaganLargeTiff.tiff}     | Bin
 test/data/bugfixes-test.out                        | Bin 1912260 -> 1912453 bytes
 test/data/icc-test.out                             | 377 +++++++++++++--------
 test/data/webp-test.out                            |  12 +-
 13 files changed, 354 insertions(+), 247 deletions(-)

diff --git a/include/exiv2/image.hpp b/include/exiv2/image.hpp
index a2ed2ed..09c8dcb 100644
--- a/include/exiv2/image.hpp
+++ b/include/exiv2/image.hpp
@@ -20,16 +20,7 @@
  */
 /*!
   @file    image.hpp
-  @brief   Class Image, defining the interface for all Image subclasses.
   @version $Rev: 3091 $
-  @author  Andreas Huggel (ahu)
-           <a href="mailto:ahuggel at gmx.net">ahuggel at gmx.net</a>
-  @author  Brad Schick (brad)
-           <a href="mailto:brad at robotbattle.com">brad at robotbattle.com</a>
-  @date    09-Jan-04, ahu: created<BR>
-           11-Feb-04, ahu: isolated as a component<BR>
-           19-Jul-04, brad: revamped to be more flexible and support IPTC<BR>
-           15-Jan-05, brad: inside-out design changes
  */
 #ifndef IMAGE_HPP_
 #define IMAGE_HPP_
@@ -233,7 +224,7 @@ namespace Exiv2 {
               to the image until the writeMetadata() method is called.
           @param iccProfile DataBuf containing profile (binary)
          */
-        virtual void setIccProfile(DataBuf& iccProfile);
+        virtual void setIccProfile(DataBuf& iccProfile,bool bTestValid=true);
         /*!
           @brief Erase iccProfile. the profile is not removed from
               the actual image until the writeMetadata() method is called.
diff --git a/src/actions.cpp b/src/actions.cpp
index 35768e4..ee51dd3 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -21,9 +21,6 @@
 /*
   File:      actions.cpp
   Version:   $Rev$
-  Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
-  History:   08-Dec-03, ahu: created
-             30-Apr-06, Roger Larsson: Print filename if processing multiple files
  */
 // *****************************************************************************
 #include "rcsid_int.hpp"
@@ -1175,25 +1172,32 @@ namespace Action {
 
     int Extract::writeIccProfile() const
     {
+        int rc = 0;
         if (!Exiv2::fileExists(path_, true)) {
             std::cerr << path_
                       << ": " << _("Failed to open the file
");
-            return -1;
+            rc = -1;
         }
-        Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_);
-        assert(image.get() != 0);
-        image->readMetadata();
 
-        std::string    iccPath   = newFilePath(path_,".icc");
-        if (Params::instance().verbose_) {
-            std::cout << _("Writing iccProfile: ") << iccPath << std::endl;
+        if ( rc == 0 ) {
+            Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_);
+            assert(image.get() != 0);
+            image->readMetadata();
+            if ( !image->iccProfileDefined() ) {
+                std::cerr << _("No embedded iccProfile: ") << path_ << std::endl;
+                rc = -2;
+            } else {
+                std::string    iccPath   = newFilePath(path_,".icc");
+                if (Params::instance().verbose_) {
+                    std::cout << _("Writing iccProfile: ") << iccPath << std::endl;
+                }
+                Exiv2::FileIo  iccFile(iccPath);
+                iccFile.open("wb") ;
+                iccFile.write(image->iccProfile()->pData_,image->iccProfile()->size_);
+                iccFile.close();
+            }
         }
-        Exiv2::FileIo  iccFile(iccPath);
-        iccFile.open("wb") ;
-        iccFile.write(image->iccProfile()->pData_,image->iccProfile()->size_);
-        iccFile.close();
-
-        return 0;
+        return rc;
     } // Extract::writeIccProfile
 
 
@@ -1330,9 +1334,9 @@ namespace Action {
                       << ": " << _("Failed to open the file
");
             rc = -1;
         } else {
-        	Exiv2::DataBuf iccProfileBlob = Exiv2::readFile(iccProfilePath);
-        	rc = insertIccProfile(path,iccProfileBlob);
-		}
+            Exiv2::DataBuf iccProfileBlob = Exiv2::readFile(iccProfilePath);
+            rc = insertIccProfile(path,iccProfileBlob);
+        }
         return rc;
 
     } // Insert::insertIccProfile
diff --git a/src/error.cpp b/src/error.cpp
index b7472b7..d92ea7f 100644
--- a/src/error.cpp
+++ b/src/error.cpp
@@ -21,8 +21,6 @@
 /*
   File:      error.cpp
   Version:   $Rev$
-  Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
-  History:   02-Apr-05, ahu: created
  */
 // *****************************************************************************
 #include "rcsid_int.hpp"
@@ -105,7 +103,8 @@ namespace {
         { 49, N_("TIFF directory %1 has too many entries") }, // %1=TIFF directory name
         { 50, N_("Multiple TIFF array element tags %1 in one directory") }, // %1=tag number
         { 51, N_("TIFF array element tag %1 has wrong type") }, // %1=tag number
-        { 52, N_("%1 has invalid XMP value type `%2'") } // %1=key, %2=value type
+        { 52, N_("%1 has invalid XMP value type `%2'") }, // %1=key, %2=value type
+        { 53, N_("Not a valid ICC Profile") },
     };
 
 }
diff --git a/src/image.cpp b/src/image.cpp
index 6fc0e4a..d396c7a 100644
--- a/src/image.cpp
+++ b/src/image.cpp
@@ -21,12 +21,6 @@
 /*
   File:      image.cpp
   Version:   $Rev$
-  Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
-             Brad Schick (brad) <brad at robotbattle.com>
-  History:   26-Jan-04, ahu: created
-             11-Feb-04, ahu: isolated as a component
-             19-Jul-04, brad: revamped to be more flexible and support Iptc
-             15-Jan-05, brad: inside-out design changes
  */
 // *****************************************************************************
 #include "rcsid_int.hpp"
@@ -289,8 +283,12 @@ namespace Exiv2 {
         comment_ = comment;
     }
 
-    void Image::setIccProfile(Exiv2::DataBuf& iccProfile)
+    void Image::setIccProfile(Exiv2::DataBuf& iccProfile,bool bTestValid)
     {
+        if ( bTestValid ) {
+            long size = iccProfile.pData_ ? getULong(iccProfile.pData_, bigEndian): -1;
+            if ( size!= iccProfile.size_ ) throw Error(53);
+        }
         iccProfile_ = iccProfile;
     }
 
diff --git a/src/jpgimage.cpp b/src/jpgimage.cpp
index 4e34869..be7de85 100644
--- a/src/jpgimage.cpp
+++ b/src/jpgimage.cpp
@@ -21,11 +21,6 @@
 /*
   File:      jpgimage.cpp
   Version:   $Rev$
-  Author(s): Andreas Huggel (ahu) <ahuggel at gmx.net>
-             Brad Schick (brad) <brad at robotbattle.com>
-             Volker Grabsch (vog) <vog at notjusthosting.com>
-             Michael Ulbrich (mul) <mul at rentapacs.de>
-  History:   15-Jan-05, brad: split out from image.cpp
  */
 // *****************************************************************************
 #include "rcsid_int.hpp"
@@ -105,12 +100,12 @@ namespace Exiv2 {
 
     static inline bool inRange(int lo,int value, int hi)
     {
-    	return lo<=value && value <= hi;
+        return lo<=value && value <= hi;
     }
 
     static inline bool inRange2(int value,int lo1,int hi1, int lo2,int hi2)
     {
-    	return inRange(lo1,value,hi1) || inRange(lo2,value,hi2);
+        return inRange(lo1,value,hi1) || inRange(lo2,value,hi2);
     }
 
     bool Photoshop::isIrb(const byte* pPsData,
@@ -463,34 +458,41 @@ namespace Exiv2 {
                 --search;
             }
             else if ( marker == app2_ && memcmp(buf.pData_ + 2, iccId_,11)==0) {
-            	// ICC profile
-            	if ( ! foundIccData  ) {
-            		foundIccData = true ;
-            		--search ;
-            	}
-
+                // ICC profile
+                if ( ! foundIccData  ) {
+                    foundIccData = true ;
+                    --search ;
+                }
+                int chunk  = (int)    buf.pData_[2+12];
+                int chunks = (int)    buf.pData_[2+13];
 #ifdef DEBUG
-				int chunk  = (int) buf.pData_[2+12];
-				int chunks = (int) buf.pData_[2+13];
-                std::cerr << "Found ICC Profile chunk " << chunk <<" of "<<  chunks << "
";
+                // ICC1v43_2010-12.pdf header is 14 bytes
+                // header = "ICC_PROFILE

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list