From 6bb8002116961e9c8e7502ca3b337fae7769f81d Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 4 Nov 2002 08:40:51 +0000 Subject: [PATCH] Added in guard to png loader so that it only accepts png files. This has been added since the png loader itself doesn't not seem robust enough at detecting non png files. Added a tab in to the flt code to make it more obvious what is happening in the flow of the code. --- src/osgPlugins/flt/ReaderWriterFLT.cpp | 2 +- src/osgPlugins/png/ReaderWriterPNG.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/osgPlugins/flt/ReaderWriterFLT.cpp b/src/osgPlugins/flt/ReaderWriterFLT.cpp index 73874c1e9..56ea03c41 100644 --- a/src/osgPlugins/flt/ReaderWriterFLT.cpp +++ b/src/osgPlugins/flt/ReaderWriterFLT.cpp @@ -23,7 +23,7 @@ osgDB::ReaderWriter::ReadResult ReaderWriterFLT::readObject(const std::string& f osgDB::ReaderWriter::ReadResult ReaderWriterFLT::readNode(const std::string& fileName, const osgDB::ReaderWriter::Options*) { if( !acceptsExtension(osgDB::getFileExtension(fileName) )) - return ReadResult::FILE_NOT_HANDLED; + return ReadResult::FILE_NOT_HANDLED; osg::ref_ptr read = new FltFile; diff --git a/src/osgPlugins/png/ReaderWriterPNG.cpp b/src/osgPlugins/png/ReaderWriterPNG.cpp index 59ee8b143..c13dd1e8b 100644 --- a/src/osgPlugins/png/ReaderWriterPNG.cpp +++ b/src/osgPlugins/png/ReaderWriterPNG.cpp @@ -1,9 +1,10 @@ #include #include "osg/Notify" #include -#include "osg/GL" +#include -#include "osgDB/Registry" +#include +#include using namespace osg; @@ -35,6 +36,9 @@ class ReaderWriterPNG : public osgDB::ReaderWriter virtual ReadResult readImage(const std::string& fileName, const osgDB::ReaderWriter::Options*) { + if( !acceptsExtension(osgDB::getFileExtension(fileName) )) + return ReadResult::FILE_NOT_HANDLED; + int trans = PNG_ALPHA; FILE *fp = NULL; pngInfo pInfo;