From 80d260c472d12e311496a8750ee3bc0f7d45194d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 24 May 2007 16:11:42 +0000 Subject: [PATCH] From Colin McDonald, "The writeImage method in ReaderWriterPNM.cpp had an error checking the accepted file extensions, so that once the plugin was loaded in the Registry it would grab any image file write request, regardless of the file extension. This was a particular problem if it was statically loaded." --- src/osgPlugins/pnm/ReaderWriterPNM.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/osgPlugins/pnm/ReaderWriterPNM.cpp b/src/osgPlugins/pnm/ReaderWriterPNM.cpp index 66e51c36c..1dac0365b 100644 --- a/src/osgPlugins/pnm/ReaderWriterPNM.cpp +++ b/src/osgPlugins/pnm/ReaderWriterPNM.cpp @@ -468,8 +468,9 @@ class ReaderWriterPNM : public osgDB::ReaderWriter virtual WriteResult writeImage(const osg::Image& image,const std::string& fileName, const osgDB::ReaderWriter::Options* options) const { + // Only ppm format output supported std::string ext = osgDB::getFileExtension(fileName); - if (!acceptsExtension("ppm")) return WriteResult::FILE_NOT_HANDLED; + if ( !osgDB::equalCaseInsensitive(ext, "ppm") ) return WriteResult::FILE_NOT_HANDLED; // only support rgb images right now. if (image.getPixelFormat()!=GL_RGB || image.getDataType()!=GL_UNSIGNED_BYTE) return WriteResult("Error image pixel format not supported by pnm writer.");