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


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

The following commit has been merged in the master branch:
commit bdf8d3ad5b7275b10eef3a0e3a713859cb3f6c2f
Author: Robin Mills <robin at clanmills.com>
Date:   Fri Mar 11 20:48:36 2016 +0000

    #1108  Added photoshop/iptc parser to png/jpeg parser.
---
 src/jpgimage.cpp            |  31 +++++++++++++++++++++++++++----
 src/pngimage.cpp            |  25 +++++++++++++++++++------
 test/bugfixes-test.sh       |  10 ++++++++++
 test/data/bugfixes-test.out | Bin 1858026 -> 1871740 bytes
 test/data/exiv2-bug1108.exv | Bin 0 -> 17989 bytes
 5 files changed, 56 insertions(+), 10 deletions(-)

diff --git a/src/jpgimage.cpp b/src/jpgimage.cpp
index a7979ff..1f800a9 100644
--- a/src/jpgimage.cpp
+++ b/src/jpgimage.cpp
@@ -676,7 +676,8 @@ namespace Exiv2 {
                     bool bFlir = option == kpsRecursive && marker == (app0_+1) && std::strcmp(signature,"FLIR")==0;
                     bool bExif = option == kpsRecursive && marker == (app0_+1) && std::strcmp(signature,"Exif")==0;
                     bool bMPF  = option == kpsRecursive && marker == (app0_+2) && std::strcmp(signature,"MPF")==0;
-                    if( bFlir || bExif || bMPF ) {
+                    bool bPS   = option == kpsRecursive                        && std::strcmp(signature,"Photoshop 3.0")==0;
+                    if( bFlir || bExif || bMPF || bPS ) {
                         // extract Exif data block which is tiff formatted
                         if ( size > 0 ) {
                             out << std::endl;
@@ -717,14 +718,36 @@ namespace Exiv2 {
                                 // << " index = " << pFFF->dwIndexOff << std::endl;
                             }
 
-                            // create a copy on write memio object with the data, then print the structure
-                            BasicIo::AutoPtr p = BasicIo::AutoPtr(new MemIo(exif+start,size-start));
-                            if ( start < max ) TiffImage::printTiffStructure(*p,out,option,depth);
+                            if ( bPS ) {
+                                uint32_t i     = 0 ;
+                                byte*    bytes = exif;
+                                DataBuf  dataBuf(bytes,size);
+                                while ( i < size-3 && exif[i] != 0x1c ) i++;
+                            	depth++;
+                            	out << "  Record | DataSet | Name                     | Length | Data" << std::endl;
+                            	while ( bytes[i] == 0x1c && i < size-3 ) {
+                            		char buff[100];
+                            		uint16_t record  = bytes[i+1];
+                            		uint16_t dataset = bytes[i+2];
+                            		uint16_t len     = getUShort(bytes+i+3,bigEndian);
+                            		sprintf(buff,"  %6d | %7d | %-24s | %6d | ",record,dataset, Exiv2::IptcDataSets::dataSetName(dataset,record).c_str(), len);
+
+                            		out << buff << Internal::binaryToString(dataBuf,len,i+5) << std::endl;
+                            		i += 5 + len;
+                            	}
+                            	depth--;
+                            } else {
+
+	                            // create a copy on write memio object with the data, then print the structure
+    	                        BasicIo::AutoPtr p = BasicIo::AutoPtr(new MemIo(exif+start,size-start));
+        	                    if ( start < max ) TiffImage::printTiffStructure(*p,out,option,depth);
+        	                }
 
                             // restore and clean up
                             io_->seek(restore,Exiv2::BasicIo::beg);
                             delete [] exif;
                             bLF    = false;
+
                         }
                     }
                 }
diff --git a/src/pngimage.cpp b/src/pngimage.cpp
index 4ad97e2..6b59645 100644
--- a/src/pngimage.cpp
+++ b/src/pngimage.cpp
@@ -34,6 +34,7 @@ EXIV2_RCSID("@(#) $Id$")
 
 #ifdef   EXV_HAVE_LIBZ
 #include "pngchunk_int.hpp"
+#include "image_int.hpp"
 #include "pngimage.hpp"
 #include "jpgimage.hpp"
 #include "tiffimage.hpp"
@@ -42,6 +43,7 @@ EXIV2_RCSID("@(#) $Id$")
 #include "basicio.hpp"
 #include "error.hpp"
 #include "futils.hpp"
+#include "types.hpp"
 
 // + standard includes
 #include <string>
@@ -296,12 +298,23 @@ namespace Exiv2 {
                             out.write((const char*) dataBuf.pData_,dataBuf.size_);
                         }
 
-                        if ( bIptc && bSoft ) { // we require a photoshop parser to recover IPTC data
-                            const char* bytes = (const char*) dataBuf.pData_;
-                            uint32_t    l     = (uint32_t) std::strlen(bytes)+2;
-                            // create a copy on write memio object with the data, then print the structure
-                            BasicIo::AutoPtr p = BasicIo::AutoPtr(new MemIo(dataBuf.pData_+l,dataBuf.size_-l));
-                            TiffImage::printTiffStructure(*p,out,option,depth);
+                        if ( bIptc ) {
+                            const byte* bytes = dataBuf.pData_;
+                            uint32_t    l     = (uint32_t) dataBuf.size_ ; // std::strlen(bytes)+2;
+                            uint32_t    i     = 0 ;
+                            depth++;
+                            out << indent(depth) << "Record | DataSet | Name                     | Length | Data" << std::endl;
+                            while ( bytes[i] == 0x1c && i < l-3 ) {
+                            	char buff[100];
+                            	uint16_t record  = bytes[i+1];
+                            	uint16_t dataset = bytes[i+2];
+                            	uint16_t len     = getUShort(bytes+i+3,bigEndian);
+                            	sprintf(buff,"%6d | %7d | %-24s | %6d | ",record,dataset, Exiv2::IptcDataSets::dataSetName(dataset,record).c_str(), len);
+
+                            	out << indent(depth) << buff << Internal::binaryToString(dataBuf,len,i+5) << std::endl;
+                            	i += 5 + len;
+                            }
+                            depth--;
                         }
                     }
                     delete [] data;
diff --git a/test/bugfixes-test.sh b/test/bugfixes-test.sh
index f4bd1f6..e1008bd 100755
--- a/test/bugfixes-test.sh
+++ b/test/bugfixes-test.sh
@@ -423,6 +423,16 @@ source ./functions.source
 	runTest exiv2 -pC http://dev.exiv2.org/attachments/download/821/Reagan.tiff | cksum
 	runTest exiv2 -pC http://dev.exiv2.org/attachments/download/820/Reagan.jpg  | cksum
 
+	num=1108
+	filename=exiv2-bug$num.xmp
+	printf "$num " >&3
+	echo '------>' Bug $num '<-------' >&2
+	copyTestFile    imagemagick.png     $filename
+	runTest exiv2 -pR                   $filename
+	copyTestFile                        $filename
+	runTest exiv2 -pR                   $filename
+	echo ''
+
 	num=1112
 	filename=exiv2-bug$num.xmp
 	printf "$num " >&3
diff --git a/test/data/bugfixes-test.out b/test/data/bugfixes-test.out
index a454fed..379e604 100644
Binary files a/test/data/bugfixes-test.out and b/test/data/bugfixes-test.out differ
diff --git a/test/data/exiv2-bug1108.exv b/test/data/exiv2-bug1108.exv
new file mode 100644
index 0000000..185f9b1
Binary files /dev/null and b/test/data/exiv2-bug1108.exv differ

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list