[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:11 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=d81e552
The following commit has been merged in the master branch:
commit d81e552cb7855b2a5e17f736393232b18f160088
Author: Robin Mills <robin at clanmills.com>
Date: Thu Jan 7 19:05:06 2016 +0000
#1074 -pC now works on tiff files. Added test convenience targets to Makefile
---
Makefile | 19 ++++++++++++--
src/exiv2.1 | 2 +-
src/tiffimage.cpp | 59 +++++++++++++++++++++++++-------------------
test/bugfixes-test.sh | 9 +++++++
test/data/bugfixes-test.out | Bin 1849505 -> 1849520 bytes
5 files changed, 61 insertions(+), 28 deletions(-)
diff --git a/Makefile b/Makefile
index b94542e..ba76ab4 100644
--- a/Makefile
+++ b/Makefile
@@ -67,18 +67,33 @@ uninstall: config/config.mk
doc: config/config.mk
cd doc && $(MAKE) $(MAKECMDGOALS)
+# exiv2 application and programs required by test suite
+exiv2 conntest exifprint remotetest:
+ cd src && $(MAKE) $0
+
samples: config/config.mk
cd samples && $(MAKE) $(MAKECMDGOALS)
+# test suite
tests:
cd test && $(MAKE) test
+# test suite sub groups
teste testx testv:
cd test && $(MAKE) $@
-exiv2 conntest exifprint remotetest:
- cd src && $(MAKE) $0
+# convenience for running individual tests
+bugfixes-test.sh crw-test.sh curliotest.sh eps-preview-test.sh eps-test.sh exifdata-test.sh \
+exiv2-test.sh httpiotest.sh imagetest.sh iotest.sh iptctest.sh modify-test.sh \
+path-test.sh preview-test.sh sshiotest.sh stringto-test.sh tiff-test.sh video-test.sh \
+write-test.sh write-video-test.sh write2-test.sh xmpparser-test.sh :
+ cd test && ./$@
+
+# convenience target for running bugfixes-test.sh
+bugtest bugstest testbugs bugfixes:
+ cd test && ./bugfixes-test.sh
+# convenience target for building individual sample programs
addmoddel exifcomment exifvalue httptest iptctest mmap-test stringto-test \
exifdata iotest key-test path-test taglist write2-test write-test \
convert-test exifdata-test exiv2json iptceasy largeiptc-test prevtest tiff-test \
diff --git a/src/exiv2.1 b/src/exiv2.1
index 29050f2..ec2e844 100644
--- a/src/exiv2.1
+++ b/src/exiv2.1
@@ -315,7 +315,7 @@ c : JPEG comment
.br
p : list available image previews, sorted by preview image size in pixels
.br
-C : print image ICC Profile (jpg and png only)
+C : print image ICC Profile (jpg, png, tiff only)
.br
R : print image structure recursively (jpg, png, tiff only)
.br
diff --git a/src/tiffimage.cpp b/src/tiffimage.cpp
index aa76c2d..b56c663 100644
--- a/src/tiffimage.cpp
+++ b/src/tiffimage.cpp
@@ -444,6 +444,10 @@ namespace Exiv2 {
{
return type == 700 && option == kpsXMP;
}
+ static bool isPrintICC(uint16_t type, Exiv2::PrintStructureOption option)
+ {
+ return type == 0x8773 && option == kpsIccProfile;
+ }
#define MIN(a,b) ((a)<(b))?(b):(a)
@@ -463,9 +467,6 @@ namespace Exiv2 {
throw Error(15);
}
- if ( option == kpsIccProfile ) {
- throw Error(13, io_->path());
- }
io_->seek(0,BasicIo::beg);
printTiffStructure(io(),out,option,depth-1);
@@ -486,16 +487,20 @@ namespace Exiv2 {
uint16_t dirLength = byteSwap2(dir,0,bSwap);
bool tooBig = dirLength > 200 ;
+ bool bPrint = option == kpsBasic || option == kpsRecursive;
- if ( bFirst && (option == kpsBasic || option == kpsRecursive) ) {
+ if ( bFirst && bPrint ) {
out << indent(depth) << Internal::stringFormat("STRUCTURE OF TIFF FILE (%c%c): ",c,c) << io.path() << std::endl;
if ( tooBig ) out << indent(depth) << "dirLength = " << dirLength << std::endl;
}
// Read the dictionary
for ( int i = 0 ; !tooBig && i < dirLength ; i ++ ) {
- if ( bFirst )
- out << indent(depth) << " address | tag | type | count | offset | value
";
+ if ( bFirst && bPrint ) {
+ out << indent(depth)
+ << " address | tag | "
+ << " type | count | offset | value
";
+ }
bFirst = false;
io.read(dir.pData_, 12);
@@ -504,23 +509,23 @@ namespace Exiv2 {
uint32_t count = byteSwap4(dir,4,bSwap);
uint32_t offset = byteSwap4(dir,8,bSwap);
- std::string sp = "" ; // output spacer
+ std::string sp = "" ; // output spacer
//prepare to print the value
- uint16_t kount = isPrintXMP(tag,option) ? count // restrict long arrays
- : isStringType(type) ? (count > 32 ? 32 : count)
- : count > 5 ? 5
- : count
- ;
- uint32_t pad = isStringType(type) ? 1 : 0;
- uint32_t size = isStringType(type) ? 1
- : is2ByteType(type) ? 2
- : is4ByteType(type) ? 4
- : 1
- ;
- uint32_t Offset = 0 ; // used by ExifTag == 0x8769 && MakerNote == 0x927c to locate an FID
-
- // if ( offset > io.size() ) offset = 0;
+ uint16_t kount = isPrintXMP(tag,option) ? count // restrict long arrays
+ : isPrintICC(tag,option) ? count //
+ : isStringType(type) ? (count > 32 ? 32 : count)
+ : count > 5 ? 5
+ : count
+ ;
+ uint32_t pad = isStringType(type) ? 1 : 0;
+ uint32_t size = isStringType(type) ? 1
+ : is2ByteType(type) ? 2
+ : is4ByteType(type) ? 4
+ : 1
+ ;
+
+ // if ( offset > io.size() ) offset = 0; // Denial of service?
DataBuf buf(MIN(size*kount + pad,48)); // allocate a buffer
if ( isStringType(type) || count*size > 4 ) { // data is in the directory => read into buffer
size_t restore = io.tell(); // save
@@ -531,12 +536,13 @@ namespace Exiv2 {
std::memcpy(buf.pData_,dir.pData_+8,12);
}
- if ( option == kpsBasic || option == kpsRecursive ) {
+ uint32_t Offset = isLongType(type) ? byteSwap4(buf,0,bSwap) : 0 ;
+
+ if ( bPrint ) {
uint32_t address = start + 2 + i*12 ;
out << indent(depth)
<< Internal::stringFormat("%8u | %#06x %-25s |%10s |%9u |%9u | "
,address,tag,tagName(tag,25),typeName(type),count,offset);
-
if ( isShortType(type) ){
for ( uint16_t k = 0 ; k < kount ; k++ ) {
out << sp << byteSwap2(buf,k*size,bSwap);
@@ -545,7 +551,6 @@ namespace Exiv2 {
} else if ( isLongType(type) ){
for ( uint16_t k = 0 ; k < kount ; k++ ) {
out << sp << byteSwap4(buf,k*size,bSwap);
- if ( k == 0 ) Offset = byteSwap4(buf,k*size,bSwap) ;
sp = " ";
}
} else if ( isRationalType(type) ){
@@ -564,6 +569,7 @@ namespace Exiv2 {
} else if ( isStringType(type) ) {
out << sp << Internal::binaryToString(buf, kount);
}
+
sp = kount == count ? "" : " ...";
out << sp << std::endl;
if ( option == kpsRecursive
@@ -579,6 +585,9 @@ namespace Exiv2 {
buf.pData_[count]=0;
out << (char*) buf.pData_;
}
+ if ( isPrintICC(tag,option) ) {
+ out.write((const char*)buf.pData_,buf.size_);
+ }
}
io.read(dir.pData_, 4);
start = tooBig ? 0 : byteSwap4(dir,0,bSwap);
@@ -593,7 +602,7 @@ namespace Exiv2 {
void TiffImage::printTiffStructure(BasicIo& io, std::ostream& out, Exiv2::PrintStructureOption option,int depth)
{
- if ( option == kpsBasic || option == kpsXMP || option == kpsRecursive ) {
+ if ( option == kpsBasic || option == kpsXMP || option == kpsRecursive || option == kpsIccProfile ) {
// buffer
const size_t dirSize = 32;
DataBuf dir(dirSize);
diff --git a/test/bugfixes-test.sh b/test/bugfixes-test.sh
index 8b20e32..b7a4257 100755
--- a/test/bugfixes-test.sh
+++ b/test/bugfixes-test.sh
@@ -414,6 +414,15 @@ source ./functions.source
copyTestFile $filename
runTest exiv2 -pa -g zone $filename
+ num=1074
+ filename=exiv2-bug$num.jpg
+ printf "$num " >&3
+ echo '------>' Bug $num '<-------' >&2
+ copyTestFile imagemagick.png $filename
+ runTest exiv2 -pC $filename | wc
+ runTest exiv2 -pC http://dev.exiv2.org/attachments/download/821/Reagan.tiff | wc
+ runTest exiv2 -pC http://dev.exiv2.org/attachments/download/820/Reagan.jpg | wc
+
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 af815cf..45fdb47 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