Bug #1322
Exception in PentaxMakerNote::printShutterCount, source: pentaxmn.cpp
100%
Description
I modified the exifprint, replacing i->value() with i->print(). In general works fine, but with images from Pentax K5 it runs into an exception when calling PentaxMakerNote::printShutterCount.
I compiled the project with Microsoft Visual Studio Community 2015
Here the code block with my modification:
    Exiv2::ExifData::const_iterator end = exifData.end();
    for (Exiv2::ExifData::const_iterator i = exifData.begin(); i != end; ++i) {
        const char* tn = i->typeName();
        std::cout << std::setw(44) << std::setfill(' ') << std::left
                  << i->key() << " " 
                  << "0x" << std::setw(4) << std::setfill('0') << std::right
                  << std::hex << i->tag() << " " 
                  << std::setw(9) << std::setfill(' ') << std::left
                  << (tn ? tn : "Unknown") << " " 
                  << std::dec << std::setw(3)
                  << std::setfill(' ') << std::right
                  << i->count() << "  " 
                  // replace << std::dec << i->value()
                  << std::dec << i->print()
                  // end of change
                  << "\n";
    }
Files
History
Updated by Robin Mills about 4 years ago
- Category set to metadata
 - Status changed from New to Assigned
 - Assignee set to Robin Mills
 - Target version set to 0.27
 
Thanks for reporting this. I'm on vacation at the moment and I've gone down with a (medical) virus. I'll try to investigate this soon. If I forget, you are welcome to "ping" me by asking for an update on this issue in a couple of weeks.
Updated by Robin Mills about 4 years ago
- Status changed from Assigned to Closed
 - % Done changed from 0 to 100
 - Estimated time set to 1.00 h
 
Good News. This is a known issue and fixed on master. It's #1305
The fix is in pentaxmn.cpp #1170:
    std::ostream& PentaxMakerNote::printShutterCount(std::ostream& os, const Value& value, const ExifData* metadata)
    {
        if (!metadata) return os << "undefined";
        ExifData::const_iterator dateIt = metadata->findKey(
                ExifKey("Exif.PentaxDng.Date"));
        ....When I apply the fix, here's the output: C:\Users\rmills\gnu\exiv2\0.26\msvc\bin\win32\release>exifprint.exe ..\..\..\Pentax-K5.jpg | grep -i shut Exif.Pentax.ShutterCount 0x005d Undefined 4 undefined C:\Users\rmills\gnu\exiv2\0.26\msvc\bin\win32\release>