[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a

Maximiliano Curia maxy at moszumanska.debian.org
Thu Jul 13 17:36:50 UTC 2017


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=0fc84a1

The following commit has been merged in the master branch:
commit 0fc84a1a8067afe4246868ba8f3c6cd0d2f61402
Author: Andreas Huggel <ahuggel at gmx.net>
Date:   Fri Dec 10 18:02:31 2004 +0000

    Added unknownTag / unknownDataSet structures and replaced exceptions with return values from these where possible
---
 src/datasets.cpp | 16 +++++++++-------
 src/tags.cpp     |  9 ++++++---
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/datasets.cpp b/src/datasets.cpp
index 81c2c1c..12f0960 100644
--- a/src/datasets.cpp
+++ b/src/datasets.cpp
@@ -156,6 +156,8 @@ namespace Exiv2 {
         DataSet(0xffff, "(Invalid)", "(Invalid)", false, false, 0, 0, Exiv2::unsignedShort, IptcDataSets::application2, "")
     };
 
+    static const DataSet unknownDataSet(0xffff, "Unknown dataset", "Unknown dataset", false, true, 0, 0xffffffff, Exiv2::string, IptcDataSets::invalidRecord, "Unknown dataset");
+
     // Dataset lookup lists.This is an array with pointers to one list per IIM4 Record. 
     // The record id is used as the index into the array.
     const DataSet* IptcDataSets::records_[] = {
@@ -191,7 +193,7 @@ namespace Exiv2 {
     TypeId IptcDataSets::dataSetType(uint16_t number, uint16_t recordId)
     {
         int idx = dataSetIdx(number, recordId);
-        if (idx == -1) throw Error("No dataSet for record Id");
+        if (idx == -1) return unknownDataSet.type_;
         return records_[recordId][idx].type_;
     }
 
@@ -209,21 +211,21 @@ namespace Exiv2 {
     const char* IptcDataSets::dataSetDesc(uint16_t number, uint16_t recordId)
     {
         int idx = dataSetIdx(number, recordId);
-        if (idx == -1) throw Error("No dataSet for record Id");
+        if (idx == -1) return unknownDataSet.desc_;
         return records_[recordId][idx].desc_;
     }
 
     const char* IptcDataSets::dataSetPsName(uint16_t number, uint16_t recordId)
     {
         int idx = dataSetIdx(number, recordId);
-        if (idx == -1) throw Error("No dataSet for record Id");
+        if (idx == -1) return unknownDataSet.photoshop_;
         return records_[recordId][idx].photoshop_;
     }
 
     bool IptcDataSets::dataSetRepeatable(uint16_t number, uint16_t recordId)
     {
         int idx = dataSetIdx(number, recordId);
-        if (idx == -1) throw Error("No dataSet for record Id");
+        if (idx == -1) return unknownDataSet.repeatable_;
         return records_[recordId][idx].repeatable_;
     }
 
@@ -237,7 +239,7 @@ namespace Exiv2 {
             dataSet = records_[recordId][idx].number_;
         }
         else {
-            // Todo: Check format of tagName
+            if (!isHex(dataSetName, 4, "0x")) throw Error("Invalid dataset name");
             std::istringstream is(dataSetName);
             is >> std::hex >> dataSet;
         }
@@ -258,8 +260,8 @@ namespace Exiv2 {
 
     const char* IptcDataSets::recordDesc(uint16_t recordId)
     {
-        if( recordId != envelope && recordId != application2 ) {
-            throw Error("Unknown record");
+        if (recordId != envelope && recordId != application2) {
+            return unknownDataSet.desc_;
         }
         return recordInfo_[recordId].desc_;
     }
diff --git a/src/tags.cpp b/src/tags.cpp
index 8cd874b..8efcb9d 100644
--- a/src/tags.cpp
+++ b/src/tags.cpp
@@ -260,6 +260,9 @@ namespace Exiv2 {
         TagInfo(0xffff, "(UnknownMakerNoteTag)", "Unknown MakerNote tag", ifdIdNotSet, sectionIdNotSet, printValue)
     };
 
+    // Unknown Tag
+    static const TagInfo unknownTag(0xffff, "Unknown tag", "Unknown tag", ifdIdNotSet, sectionIdNotSet, printValue);
+
     // Tag lookup lists with tag names, desc and where they (preferably) belong to;
     // this is an array with pointers to one list per IFD. The IfdId is used as the
     // index into the array.
@@ -294,14 +297,14 @@ namespace Exiv2 {
     const char* ExifTags::tagDesc(uint16_t tag, IfdId ifdId)
     {
         int idx = tagInfoIdx(tag, ifdId);
-        if (idx == -1) throw Error("No taginfo for IFD");
+        if (idx == -1) return unknownTag.desc_;
         return tagInfos_[ifdId][idx].desc_;
     }
 
     const char* ExifTags::sectionName(uint16_t tag, IfdId ifdId)
     {
         int idx = tagInfoIdx(tag, ifdId);
-        if (idx == -1) throw Error("No taginfo for IFD");
+        if (idx == -1) return sectionInfo_[unknownTag.sectionId_].name_;
         const TagInfo* tagInfo = tagInfos_[ifdId];
         return sectionInfo_[tagInfo[idx].sectionId_].name_;
     }
@@ -309,7 +312,7 @@ namespace Exiv2 {
     const char* ExifTags::sectionDesc(uint16_t tag, IfdId ifdId)
     {
         int idx = tagInfoIdx(tag, ifdId);
-        if (idx == -1) throw Error("No taginfo for IFD");
+        if (idx == -1) return sectionInfo_[unknownTag.sectionId_].desc_;
         const TagInfo* tagInfo = tagInfos_[ifdId];
         return sectionInfo_[tagInfo[idx].sectionId_].desc_;
     }

-- 
exiv2 packaging



More information about the pkg-kde-commits mailing list