summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2023-09-09 13:55:50 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2023-09-09 13:55:50 +0900
commit841f69a0337e4a700b1eb3511e3f46d6317bc4d4 (patch)
tree2b850abf69963ef70f9bb090b6fe491f61b50c98
parent682c9087bd4d6b4a2218ccf94d3b61c42dd40738 (diff)
downloadlibkexiv2-841f69a0337e4a700b1eb3511e3f46d6317bc4d4.tar.gz
libkexiv2-841f69a0337e4a700b1eb3511e3f46d6317bc4d4.zip
Remove unused code related to very old versions of libexiv2 (prior to 2011)
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rw-r--r--libkexiv2/libkexiv2/kexiv2.cpp83
-rw-r--r--libkexiv2/libkexiv2/kexiv2private.cpp26
-rw-r--r--libkexiv2/libkexiv2/kexiv2private.h11
3 files changed, 0 insertions, 120 deletions
diff --git a/libkexiv2/libkexiv2/kexiv2.cpp b/libkexiv2/libkexiv2/kexiv2.cpp
index 22fc950..4c2bafe 100644
--- a/libkexiv2/libkexiv2/kexiv2.cpp
+++ b/libkexiv2/libkexiv2/kexiv2.cpp
@@ -76,27 +76,15 @@ bool KExiv2::supportMetadataWritting(const TQString& typeMime)
}
else if (typeMime == TQString("image/tiff"))
{
-#if (EXIV2_TEST_VERSION(0,17,91))
return true;
-#else
- return false;
-#endif
}
else if (typeMime == TQString("image/png"))
{
-#if (EXIV2_TEST_VERSION(0,17,91))
return true;
-#else
- return false;
-#endif
}
else if (typeMime == TQString("image/jp2"))
{
-#if (EXIV2_TEST_VERSION(0,17,91))
return true;
-#else
- return false;
-#endif
}
return false;
@@ -112,13 +100,7 @@ TQString KExiv2::Exiv2Version()
// Since 0.14.0 release, we can extract run-time version of Exiv2.
// else we return make version.
-#if (EXIV2_TEST_VERSION(0,14,0))
return TQString(Exiv2::version());
-#else
- return TQString("%1.%2.%3").arg(EXIV2_MAJOR_VERSION)
- .arg(EXIV2_MINOR_VERSION)
- .arg(EXIV2_PATCH_VERSION);
-#endif
}
bool KExiv2::clearComments()
@@ -177,21 +159,12 @@ TQByteArray KExiv2::getExif() const
{
if (!d->exifMetadata.empty())
{
-
Exiv2::ExifData& exif = d->exifMetadata;
-
-#if (EXIV2_TEST_VERSION(0,17,91))
Exiv2::Blob blob;
Exiv2::ExifParser::encode(blob, Exiv2::bigEndian, exif);
TQByteArray ba(blob.size());
if (ba.size())
memcpy(ba.data(), (const char*)&blob[0], blob.size());
-#else
- Exiv2::DataBuf c2 = exif.copy();
- TQByteArray ba(c2.size_);
- if (ba.size())
- memcpy(ba.data(), c2.pData_, c2.size_);
-#endif
return ba;
}
@@ -218,20 +191,11 @@ TQByteArray KExiv2::getIptc(bool addIrbHeader) const
if (addIrbHeader)
{
-#if (EXIV2_TEST_VERSION(0,10,0))
c2 = Exiv2::Photoshop::setIptcIrb(0, 0, iptc);
-#else
- tqDebug("Exiv2 version is to old. Cannot add Irb header to IPTC metadata");
- return TQByteArray();
-#endif
}
else
{
-#if (EXIV2_TEST_VERSION(0,17,91))
c2 = Exiv2::IptcParser::encode(d->iptcMetadata);
-#else
- c2 = iptc.copy();
-#endif
}
TQByteArray data(c2.size_);
@@ -263,15 +227,8 @@ bool KExiv2::setExif(const TQByteArray& data)
{
if (!data.isEmpty())
{
-#if (EXIV2_TEST_VERSION(0,17,91))
Exiv2::ExifParser::decode(d->exifMetadata, (const Exiv2::byte*)data.data(), data.size());
return (!d->exifMetadata.empty());
-#else
- if (d->exifMetadata.load((const Exiv2::byte*)data.data(), data.size()) != 0)
- return false;
- else
- return true;
-#endif
}
}
catch( Exiv2::Error &e )
@@ -291,15 +248,8 @@ bool KExiv2::setIptc(const TQByteArray& data)
{
if (!data.isEmpty())
{
-#if (EXIV2_TEST_VERSION(0,17,91))
Exiv2::IptcParser::decode(d->iptcMetadata, (const Exiv2::byte*)data.data(), data.size());
return (!d->iptcMetadata.empty());
-#else
- if (d->iptcMetadata.load((const Exiv2::byte*)data.data(), data.size()) != 0)
- return false;
- else
- return true;
-#endif
}
}
catch( Exiv2::Error &e )
@@ -591,12 +541,10 @@ bool KExiv2::setImageProgramId(const TQString& program, const TQString& version)
{
// Record program info in Exif.Image.ProcessingSoftware tag (only available with Exiv2 >= 0.14.0).
-#if (EXIV2_TEST_VERSION(0,14,0))
TQString software(program);
software.append("-");
software.append(version);
d->exifMetadata["Exif.Image.ProcessingSoftware"] = software.ascii();
-#endif
// See B.K.O #142564: Check if Exif.Image.Software already exist. If yes, do not touch this tag.
@@ -715,12 +663,8 @@ TQImage KExiv2::getExifThumbnail(bool fixOrientation) const
try
{
-#if (EXIV2_TEST_VERSION(0,17,91))
Exiv2::ExifThumbC thumb(d->exifMetadata);
Exiv2::DataBuf const c1 = thumb.copy();
-#else
- Exiv2::DataBuf const c1(d->exifMetadata.copyThumbnail());
-#endif
thumbnail.loadFromData(c1.pData_, c1.size_);
if (!thumbnail.isNull())
@@ -795,21 +739,12 @@ bool KExiv2::setExifThumbnail(const TQImage& thumb, bool setProgramName)
try
{
-#if (EXIV2_TEST_VERSION(0,17,91))
TQByteArray data;
TQBuffer buffer(data);
buffer.open(IO_WriteOnly);
thumb.save(&buffer, "JPEG");
Exiv2::ExifThumb thumb(d->exifMetadata);
thumb.setJpegThumbnail((Exiv2::byte *)data.data(), data.size());
-#else
- KTempFile thumbFile(TQString(), "KExiv2ExifThumbnail");
- thumbFile.setAutoDelete(true);
- thumb.save(thumbFile.name(), "JPEG");
-
- const std::string &fileName( (const char*)(TQFile::encodeName(thumbFile.name())) );
- d->exifMetadata.setJpegThumbnail( fileName );
-#endif
return true;
}
catch( Exiv2::Error &e )
@@ -1279,15 +1214,9 @@ TQString KExiv2::getExifTagString(const char* exifTagName, bool escapeCR) const
Exiv2::ExifData::iterator it = exifData.findKey(exifKey);
if (it != exifData.end())
{
-#if (EXIV2_TEST_VERSION(0,17,91))
// See B.K.O #184156 comment #13
std::string val = it->print(&exifData);
TQString tagValue = TQString::fromLocal8Bit(val.c_str());
-#else
- std::ostringstream os;
- os << *it;
- TQString tagValue = TQString::fromLocal8Bit(os.str().c_str());
-#endif
if (escapeCR)
tagValue.replace("\n", " ");
@@ -1401,11 +1330,7 @@ TQByteArray KExiv2::getExifTagData(const char* exifTagName) const
TQByteArray data((*it).size());
if (data.size())
{
-#if (EXIV2_TEST_VERSION(0,17,91))
(*it).copy((Exiv2::byte*)data.data(), Exiv2::bigEndian);
-#else
- (*it).copy((Exiv2::byte*)data.data(), exifData.byteOrder());
-#endif
}
return data;
}
@@ -1603,11 +1528,7 @@ TQString KExiv2::getExifTagTitle(const char *exifTagName)
{
std::string exifkey(exifTagName);
Exiv2::ExifKey ek(exifkey);
-#if EXIV2_TEST_VERSION(0, 21, 0)
return TQString::fromLocal8Bit( ek.tagLabel().c_str() );
-#else
- return TQString::fromLocal8Bit( Exiv2::ExifTags::tagTitle(ek.tag(), ek.ifdId()) );
-#endif
}
catch (Exiv2::Error& e)
{
@@ -1623,11 +1544,7 @@ TQString KExiv2::getExifTagDescription(const char *exifTagName)
{
std::string exifkey(exifTagName);
Exiv2::ExifKey ek(exifkey);
-#if EXIV2_TEST_VERSION(0, 21, 0)
return TQString::fromLocal8Bit( ek.tagDesc().c_str() );
-#else
- return TQString::fromLocal8Bit( Exiv2::ExifTags::tagDesc(ek.tag(), ek.ifdId()) );
-#endif
}
catch (Exiv2::Error& e)
{
diff --git a/libkexiv2/libkexiv2/kexiv2private.cpp b/libkexiv2/libkexiv2/kexiv2private.cpp
index 4cca2be..f92776d 100644
--- a/libkexiv2/libkexiv2/kexiv2private.cpp
+++ b/libkexiv2/libkexiv2/kexiv2private.cpp
@@ -51,15 +51,8 @@ bool KExiv2Priv::setExif(Exiv2::DataBuf const data)
{
if (data.size_ != 0)
{
-#if (EXIV2_TEST_VERSION(0,17,91))
Exiv2::ExifParser::decode(exifMetadata, data.pData_, data.size_);
return (!exifMetadata.empty());
-#else
- if (exifMetadata.load(data.pData_, data.size_) != 0)
- return false;
- else
- return true;
-#endif
}
}
catch( Exiv2::Error &e )
@@ -79,15 +72,8 @@ bool KExiv2Priv::setIptc(Exiv2::DataBuf const data)
{
if (data.size_ != 0)
{
-#if (EXIV2_TEST_VERSION(0,17,91))
Exiv2::IptcParser::decode(iptcMetadata, data.pData_, data.size_);
return (!iptcMetadata.empty());
-#else
- if (iptcMetadata.load(data.pData_, data.size_) != 0)
- return false;
- else
- return true;
-#endif
}
}
catch( Exiv2::Error &e )
@@ -114,19 +100,7 @@ TQString KExiv2Priv::convertCommentValue(const Exiv2::Exifdatum &exifDatum)
std::string comment;
std::string charset;
-#if (EXIV2_TEST_VERSION(0,11,0))
comment = exifDatum.toString();
-#else
- // workaround for bug in TIFF parser: CommentValue is loaded as DataValue
- const Exiv2::Value &value = exifDatum.value();
- Exiv2::byte *data = new Exiv2::byte[value.size()];
- value.copy(data, Exiv2::invalidByteOrder);
- Exiv2::CommentValue commentValue;
- // this read method is hidden in CommentValue
- static_cast<Exiv2::Value &>(commentValue).read(data, value.size(), Exiv2::invalidByteOrder);
- comment = commentValue.toString();
- delete [] data;
-#endif
// libexiv2 will prepend "charset=\"SomeCharset\" " if charset is specified
// Before conversion to TQString, we must know the charset, so we stay with std::string for a while
diff --git a/libkexiv2/libkexiv2/kexiv2private.h b/libkexiv2/libkexiv2/kexiv2private.h
index 952e48a..906598b 100644
--- a/libkexiv2/libkexiv2/kexiv2private.h
+++ b/libkexiv2/libkexiv2/kexiv2private.h
@@ -79,17 +79,6 @@
# define _XMP_SUPPORT_ 1
#endif
-// Make sure an EXIV2_TEST_VERSION macro exists:
-
-#ifdef EXIV2_VERSION
-# ifndef EXIV2_TEST_VERSION
-# define EXIV2_TEST_VERSION(major,minor,patch) \
- ( EXIV2_VERSION >= EXIV2_MAKE_VERSION(major,minor,patch) )
-# endif
-#else
-# define EXIV2_TEST_VERSION(major,minor,patch) (false)
-#endif
-
namespace KExiv2Iface
{