diff --git a/src/pentaxmn.cpp b/src/pentaxmn.cpp index 79e173ac..e10289e7 100644 --- a/src/pentaxmn.cpp +++ b/src/pentaxmn.cpp @@ -1157,6 +1157,15 @@ namespace Exiv2 { return result; } + static long getKeyLong(const std::string& key,const ExifData* metadata) + { + long result = -1; + if ( metadata->findKey(ExifKey(key)) != metadata->end() ) { + result = (long) metadata->findKey(ExifKey(key))->toFloat(0); + } + return result; + } + std::ostream& resolveLens0x32c(std::ostream& os, const Value& value, const ExifData* metadata) { @@ -1165,11 +1174,14 @@ namespace Exiv2 { unsigned long index = 0; std::string model = getKeyString("Exif.Image.Model" ,metadata); - std::string focalLength = getKeyString("Exif.Photo.FocalLength",metadata); + long focalLength = getKeyLong ("Exif.Photo.FocalLength",metadata); + bool bFL10_20 = 10 <= focalLength && focalLength <= 20; + bool bK10D_K3 = model.find("PENTAX K10D") != std::string::npos + || model.find("PENTAX K-3") != std::string::npos + ; // std::cout << "model,focalLength = " << model << "," << focalLength << std::endl; - - if ( model.find("PENTAX K10D") != std::string::npos && focalLength == "1700/100" ) index = 1; + if ( bFL10_20 && bK10D_K3 ) index = 1; if ( index > 0 ) { const TagDetails* td = find(pentaxLensType, lensID); diff --git a/test/bugfixes-test.sh b/test/bugfixes-test.sh index f0bcae71..24e3311f 100755 --- a/test/bugfixes-test.sh +++ b/test/bugfixes-test.sh @@ -448,12 +448,12 @@ source ./functions.source runTest exiv2 -PkV --grep GPSL http://dev.exiv2.org/attachments/download/805/DSC_7154.jpg | runTest exiv2 -m- $filename runTest exiv2 -pa $filename - for num in 1140 1144; do + for num in 1140 1144a 1144b 1144c 1144d 1144e 1144f 1144g ; do filename=exiv2-bug$num.exv printf "$num " >&3 echo '------>' Bug $num '<-------' >&2 copyTestFile $filename - runTest exiv2 -pv -g Lens $filename + runTest exiv2 -pa -g Lens $filename done diff --git a/test/data/bugfixes-test.out b/test/data/bugfixes-test.out index a081f48b..23e74edc 100644 Binary files a/test/data/bugfixes-test.out and b/test/data/bugfixes-test.out differ diff --git a/test/data/exiv2-bug1144.exv b/test/data/exiv2-bug1144a.exv similarity index 100% rename from test/data/exiv2-bug1144.exv rename to test/data/exiv2-bug1144a.exv diff --git a/test/data/exiv2-bug1144b.exv b/test/data/exiv2-bug1144b.exv new file mode 100644 index 00000000..33342265 Binary files /dev/null and b/test/data/exiv2-bug1144b.exv differ diff --git a/test/data/exiv2-bug1144c.exv b/test/data/exiv2-bug1144c.exv new file mode 100644 index 00000000..7b3cb0ba Binary files /dev/null and b/test/data/exiv2-bug1144c.exv differ diff --git a/test/data/exiv2-bug1144d.exv b/test/data/exiv2-bug1144d.exv new file mode 100644 index 00000000..caa32d8e Binary files /dev/null and b/test/data/exiv2-bug1144d.exv differ diff --git a/test/data/exiv2-bug1144e.exv b/test/data/exiv2-bug1144e.exv new file mode 100644 index 00000000..839ca205 Binary files /dev/null and b/test/data/exiv2-bug1144e.exv differ diff --git a/test/data/exiv2-bug1144f.exv b/test/data/exiv2-bug1144f.exv new file mode 100644 index 00000000..826dff73 Binary files /dev/null and b/test/data/exiv2-bug1144f.exv differ diff --git a/test/data/exiv2-bug1144g.exv b/test/data/exiv2-bug1144g.exv new file mode 100644 index 00000000..5981e152 Binary files /dev/null and b/test/data/exiv2-bug1144g.exv differ