aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2011-08-20 12:15:11 +0200
committerOlivier Tilloy <olivier@tilloy.net>2011-08-20 12:15:11 +0200
commit0d90a8a6a7339543b01f8548d330e279a2067ea6 (patch)
tree6725e64e23f7bdb46abdd0b19eabce9cde1b4e47
parent540db70d10def3cda4edd36ff175cd1af877241e (diff)
downloadpyexiv2-0d90a8a6a7339543b01f8548d330e279a2067ea6.tar.gz
Replicate the fix for type extraction when compiling against libexiv2 < 0.21.
-rw-r--r--src/exiv2wrapper.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/exiv2wrapper.cpp b/src/exiv2wrapper.cpp
index 0033b23..332b78f 100644
--- a/src/exiv2wrapper.cpp
+++ b/src/exiv2wrapper.cpp
@@ -573,6 +573,13 @@ ExifTag::ExifTag(const std::string& key,
const uint16_t tag = _datum->tag();
const Exiv2::IfdId ifd = _datum->ifdId();
_type = Exiv2::TypeInfo::typeName(Exiv2::ExifTags::tagType(tag, ifd));
+ // Where available, extract the type from the metadata, it is more reliable
+ // than static type information. The exception is for user comments, for
+ // which we’d rather keep the 'Comment' type instead of 'Undefined'.
+ if ((_data != 0) && (_type != "Comment"))
+ {
+ _type = _datum->typeName();
+ }
_name = Exiv2::ExifTags::tagName(tag, ifd);
_label = Exiv2::ExifTags::tagLabel(tag, ifd);
_description = Exiv2::ExifTags::tagDesc(tag, ifd);