[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a
Maximiliano Curia
maxy at moszumanska.debian.org
Thu Jul 13 17:45:06 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=228861d
The following commit has been merged in the master branch:
commit 228861d8507e05ddf1479527f6dc9e71c9aa0d67
Author: Robin Mills <robin at clanmills.com>
Date: Fri Apr 17 18:06:33 2015 +0000
#922. Extract Extended XMP (multiple 65k block) and remove XMP blank lines.
---
src/jpgimage.cpp | 54 ++++++++++++++++++++++++++++++++++++++++----
test/bugfixes-test.sh | 8 +++++++
test/data/bugfixes-test.out | Bin 138786 -> 140655 bytes
3 files changed, 58 insertions(+), 4 deletions(-)
diff --git a/src/jpgimage.cpp b/src/jpgimage.cpp
index 802c0a6..f4ea25e 100644
--- a/src/jpgimage.cpp
+++ b/src/jpgimage.cpp
@@ -507,6 +507,14 @@ namespace Exiv2 {
}
} // JpegBase::readMetadata
+ bool isBlank(std::string& s)
+ {
+ for ( std::size_t i = 0 ; i < s.length() ; i++ )
+ if ( s[i] != ' ' )
+ return false ;
+ return true ;
+ }
+
void JpegBase::printStructure(std::ostream& out,printStructureOption_e option)
{
if (io_->open() != 0) throw Error(9, io_->path(), strError());
@@ -542,8 +550,10 @@ namespace Exiv2 {
}
// Container for the signature
- const long bufMinSize = 36;
- long bufRead = 0, startSig = 0;
+ bool bExtXMP = false;
+ long bufRead = 0;
+ long startSig = 0;
+ const long bufMinSize = 36;
DataBuf buf(bufMinSize);
// Read section marker
@@ -594,9 +604,45 @@ namespace Exiv2 {
byte* xmp = new byte[size+1];
io_->read(xmp,size);
int start = 0 ;
- while (xmp[start]) start++; start++;
+
+ // http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/XMPSpecificationPart3.pdf
+ // if we find HasExtendedXMP, set the flag and ignore this block
+ // the first extended block is a copy of the Standard block.
+ // a robust implementation enables extended blocks to be out of sequence
+ if ( ! bExtXMP ) {
+ while (xmp[start]) start++; start++;
+ if ( ::strstr((char*)xmp+start,"HasExtendedXMP") ) {
+ start = size ; // ignore this packet, we'll get on the next time around
+ bExtXMP = true;
+ }
+ } else {
+ start = 2+35+32+4+4; // Adobe Spec, p19
+ }
xmp[size]=0;
- out << xmp + start << std::endl;
+
+ // #922: Remove blank lines.
+ // cut the xmp into (non blank) lines
+ // out << xmp + start; // this is all we need to output without the blank line dance.
+ std::vector<std::string> lines ;
+ std::string s((char*)xmp+start);
+ char nl = '
';
+
+ while( s.length() )
+ {
+ std::size_t end = s.find(nl);
+ if ( end != std::string::npos )
+ {
+ std::string line = s.substr(0,end);
+ if ( !isBlank(line) )
+ lines.push_back(line+nl);
+ s = s.substr(end+1,std::string::npos);
+ } else {
+ lines.push_back(s);
+ s="";
+ }
+ }
+ for ( size_t l = 0 ; l < lines.size() ; l++ ) out << lines[l];
+
delete [] xmp;
bufRead = size;
}
diff --git a/test/bugfixes-test.sh b/test/bugfixes-test.sh
index d00ff7c..b5e94e7 100755
--- a/test/bugfixes-test.sh
+++ b/test/bugfixes-test.sh
@@ -264,6 +264,14 @@ source ./functions.source
runTest exiv2 -pt $filename | grep -i lenstype
done
+ num=922
+ filename=exiv2-bug$num.jpg
+ printf "$num " >&3
+ echo '------>' Bug $num '<-------' >&2
+ copyTestFile $filename
+ runTest exiv2 -pX $filename | wc
+ filename=iptc-psAPP13-wIPTCempty-psAPP13-wIPTC.jpg ; copyTestFile $filename ; runTest exiv2 -pX $filename
+
num=937
filename=exiv2-bug$num.jpg
printf "$num " >&3
diff --git a/test/data/bugfixes-test.out b/test/data/bugfixes-test.out
index 77318bd..02f9cc2 100644
Binary files a/test/data/bugfixes-test.out and b/test/data/bugfixes-test.out differ
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list