Project

General

Profile

Avoid printstructure in API-access

Added by Anonymous Poster over 3 years ago

Hi - I use libexiv2 from my own project to parse image metadata. I recently updated from 0.24 to trunk.

Some files which previously worked fine are now throwing errors, which seem to originate in Image::PrintIFDStructure (called from Print::PrintStructure I believe). I don't mind if some values are out of specification and cannot be printed.

I would not have expected the print-function to be called when not using Exiv2 in command-line but as library. How can I avoid the print-function to be called, is there an option or similar? I'm getting a bit lost in the code...


Replies (2)

RE: Avoid printstructure in API-access - Added by Robin Mills over 3 years ago

Yes. I regret bringing this code into the front of the image parsing. The code has been disabled on 'master' on https://github.com/exiv2/exiv2.git

There are 5 locations in which is being called in the xxximage.cpp functions. You'll see a pairs lines involved devnull. These pairs can be commented off.

702 rmills@rmillsmbp:~/gnu/exiv2/v0.26 $ grep devnull src/*image.cpp
src/cr2image.cpp:        std::ofstream devnull;
src/cr2image.cpp:        printStructure(devnull, kpsRecursive, 0);
src/crwimage.cpp:            std::ofstream devnull;
src/crwimage.cpp:            printStructure(devnull,kpsRecursive,0);
src/orfimage.cpp:        std::ofstream devnull;
src/orfimage.cpp:        printStructure(devnull, kpsRecursive, 0);
src/rw2image.cpp:        std::ofstream devnull;
src/rw2image.cpp:        printStructure(devnull, kpsRecursive, 0);
src/tiffimage.cpp:        std::ofstream devnull;
src/tiffimage.cpp:        printStructure(devnull,kpsRecursive,0);
703 rmills@rmillsmbp:~/gnu/exiv2/v0.26 $ 
There is no API to disable it. You will have to physically comment it off in the code and rebuild the library.
    (1-2/2)