OpenImageIO/oiio — pull request #258 by lgritz (2012-03-22 00:29:41+00:00)
Title: Review: bug fix when extension doesn't match formats.

Change ImageInput::create to more robustly handle files whose extensions don't match their formats.

It used to be that if the file extension was recognized as corresponding to an input format, it would only try that reader type, but if the extension was not recognized, it would try every input format it knows about to see if any will open the file.

This would obviously fail if the file was named with a known extension that happened to not correspond to the actual file type (for example, an OpenEXR file named "file.tif").

With this patch, it will still try the extension-based one first, but if that fails, it will go back to the strategy of trying everything, making OIIO (as originally designed) completely agnostic to filename conventions (though it uses it as a first guess to avoid trying to open it with a long succession of reader types).