[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a
Maximiliano Curia
maxy at moszumanska.debian.org
Thu Jul 13 17:37:16 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=4843b8a
The following commit has been merged in the master branch:
commit 4843b8a5df4b3118dccf5d179134ceaa7c6a5e44
Author: Andreas Huggel <ahuggel at gmx.net>
Date: Sat Oct 8 11:38:44 2005 +0000
Avoid adding a metadatum if reading the value fails
---
src/actions.cpp | 33 +++++++++++++++++++++++++++------
1 file changed, 27 insertions(+), 6 deletions(-)
diff --git a/src/actions.cpp b/src/actions.cpp
index be94076..61dd102 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -1075,6 +1075,8 @@ namespace Action {
}
}
+ // This function looks rather complex because we try to avoid adding an
+ // empty metadatum if reading the value fails
void Modify::setMetadatum(const ModifyCmd& modifyCmd)
{
if (Params::instance().verbose_) {
@@ -1083,26 +1085,45 @@ namespace Action {
<< Exiv2::TypeInfo::typeName(modifyCmd.typeId_)
<< ")" << std::endl;
}
-
Exiv2::ExifData &exifData = image_->exifData();
Exiv2::IptcData &iptcData = image_->iptcData();
Exiv2::Metadatum* metadatum = 0;
if (modifyCmd.metadataId_ == exif) {
- metadatum = &exifData[modifyCmd.key_];
+ Exiv2::ExifData::iterator pos =
+ exifData.findKey(Exiv2::ExifKey(modifyCmd.key_));
+ if (pos != exifData.end()) {
+ metadatum = &(*pos);
+ }
}
if (modifyCmd.metadataId_ == iptc) {
- metadatum = &iptcData[modifyCmd.key_];
+ Exiv2::IptcData::iterator pos =
+ iptcData.findKey(Exiv2::IptcKey(modifyCmd.key_));
+ if (pos != iptcData.end()) {
+ metadatum = &(*pos);
+ }
}
- assert(metadatum);
- Exiv2::Value::AutoPtr value = metadatum->getValue();
// If a type was explicitly requested, use it; else
// use the current type of the metadatum, if any;
// or the default type
+ Exiv2::Value::AutoPtr value;
+ if (metadatum) {
+ value = metadatum->getValue();
+ }
if (modifyCmd.explicitType_ || value.get() == 0) {
value = Exiv2::Value::create(modifyCmd.typeId_);
}
if (0 == value->read(modifyCmd.value_)) {
- metadatum->setValue(value.get());
+ if (metadatum) {
+ metadatum->setValue(value.get());
+ }
+ else {
+ if (modifyCmd.metadataId_ == exif) {
+ exifData.add(Exiv2::ExifKey(modifyCmd.key_), value.get());
+ }
+ if (modifyCmd.metadataId_ == iptc) {
+ iptcData.add(Exiv2::IptcKey(modifyCmd.key_), value.get());
+ }
+ }
}
}
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list