From: <hug...@li...> - 2010-10-23 18:39:45
|
branch: details: http://hugin.hg.sourceforge.net/hgweb/hugin/hugin/hgrepo/h/hu/hugin/hugin/rev/4e81ef10194b changeset: 4518:4e81ef10194b user: James Legg <jl...@us...> date: Sat Oct 23 19:39:17 2010 +0100 description: Safer loading of EXIF metadata (thanks to Andreas Metzler). diffstat: src/hugin_base/panodata/SrcPanoImage.cpp | 6 +++--- src/lens_calibrate/ProcessImage.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diffs (51 lines): diff -r 1252d698dcc3 -r 4e81ef10194b src/hugin_base/panodata/SrcPanoImage.cpp --- a/src/hugin_base/panodata/SrcPanoImage.cpp Sat Oct 23 11:48:00 2010 +0200 +++ b/src/hugin_base/panodata/SrcPanoImage.cpp Sat Oct 23 19:39:17 2010 +0100 @@ -749,7 +749,7 @@ { Exiv2::ExifKey key(keyName); Exiv2::ExifData::iterator itr = exifData.findKey(key); - if (itr != exifData.end()) { + if (itr != exifData.end() && itr->count()) { value = itr->toLong(); DEBUG_DEBUG("" << keyName << ": " << value); return true; @@ -763,7 +763,7 @@ { Exiv2::ExifKey key(keyName); Exiv2::ExifData::iterator itr = exifData.findKey(key); - if (itr != exifData.end()) { + if (itr != exifData.end() && itr->count()) { value = itr->toFloat(); DEBUG_DEBUG("" << keyName << ": " << value); return true; @@ -777,7 +777,7 @@ { Exiv2::ExifKey key(keyName); Exiv2::ExifData::iterator itr = exifData.findKey(key); - if (itr != exifData.end()) { + if (itr != exifData.end() && itr->count()) { value = itr->toString(); DEBUG_DEBUG("" << keyName << ": " << value); return true; diff -r 1252d698dcc3 -r 4e81ef10194b src/lens_calibrate/ProcessImage.cpp --- a/src/lens_calibrate/ProcessImage.cpp Sat Oct 23 11:48:00 2010 +0200 +++ b/src/lens_calibrate/ProcessImage.cpp Sat Oct 23 19:39:17 2010 +0100 @@ -804,7 +804,7 @@ bool getExiv2Value(Exiv2::ExifData& exifData, std::string keyName, long & value){ Exiv2::ExifKey key(keyName); Exiv2::ExifData::iterator itr = exifData.findKey(key); - if (itr != exifData.end()) { + if (itr != exifData.end() && itr->count()) { value = itr->toLong(); //DEBUG_DEBUG("" << keyName << ": " << value); return true; @@ -816,7 +816,7 @@ bool getExiv2Value(Exiv2::ExifData& exifData, std::string keyName, float & value){ Exiv2::ExifKey key(keyName); Exiv2::ExifData::iterator itr = exifData.findKey(key); - if (itr != exifData.end()) { + if (itr != exifData.end() && itr->count()) { value = itr->toFloat(); //DEBUG_DEBUG("" << keyName << ": " << value); return true; |