From 367faecf0c45ac3fce7cd64f9966426de3ae24ec Mon Sep 17 00:00:00 2001 From: Andreas Huggel Date: Sat, 26 Aug 2006 06:38:16 +0000 Subject: [PATCH] Changed exiv2 del command to delete all occurences of a tag (Toff) --- src/actions.cpp | 16 ++++++++++------ src/exiv2.1 | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/actions.cpp b/src/actions.cpp index 88fb70b0..15b7ac4b 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -1235,14 +1235,18 @@ namespace Action { Exiv2::ExifData &exifData = image_->exifData(); Exiv2::IptcData &iptcData = image_->iptcData(); if (modifyCmd.metadataId_ == exif) { - Exiv2::ExifData::iterator pos = - exifData.findKey(Exiv2::ExifKey(modifyCmd.key_)); - if (pos != exifData.end()) exifData.erase(pos); + Exiv2::ExifData::iterator pos; + Exiv2::ExifKey exifKey = Exiv2::ExifKey(modifyCmd.key_); + while((pos = exifData.findKey(exifKey)) != exifData.end()) { + exifData.erase(pos); + } } if (modifyCmd.metadataId_ == iptc) { - Exiv2::IptcData::iterator pos = - iptcData.findKey(Exiv2::IptcKey(modifyCmd.key_)); - if (pos != iptcData.end()) iptcData.erase(pos); + Exiv2::IptcData::iterator pos; + Exiv2::IptcKey iptcKey = Exiv2::IptcKey(modifyCmd.key_); + while((pos = iptcData.findKey(iptcKey)) != iptcData.end()) { + iptcData.erase(pos); + } } } diff --git a/src/exiv2.1 b/src/exiv2.1 index d53dff4e..2183d6de 100644 --- a/src/exiv2.1 +++ b/src/exiv2.1 @@ -237,7 +237,7 @@ Add a tag (unless \fIkey\fP is a non\-repeatable IPTC key; nothing prevents you from adding duplicate EXIF tags). .TP .B del -Delete a tag (requires only a \fIkey\fP). +Delete all occurences of a tag (requires only a \fIkey\fP). .TP .I key Exiv2 EXIF or IPTC key.