From 866af14f86e410a65d06dffbff22d5b83156b7b9 Mon Sep 17 00:00:00 2001 From: Don BURNS Date: Mon, 9 Sep 2002 04:40:50 +0000 Subject: [PATCH] Added ability to accept '.tif' files (as well as '.tiff') and printed notify() on error --- src/osgPlugins/tiff/ReaderWriterTIFF.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/osgPlugins/tiff/ReaderWriterTIFF.cpp b/src/osgPlugins/tiff/ReaderWriterTIFF.cpp index 4972bed39..7c7e5f1f6 100644 --- a/src/osgPlugins/tiff/ReaderWriterTIFF.cpp +++ b/src/osgPlugins/tiff/ReaderWriterTIFF.cpp @@ -403,11 +403,15 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter { public: virtual const char* className() { return "TIFF Image Reader"; } - virtual bool acceptsExtension(const std::string& extension) { return extension=="tiff"; } + virtual bool acceptsExtension(const std::string& extension) + { + if( extension == "tiff" ) return true; + if( extension == "tif" ) return true; + return false; + } virtual ReadResult readImage(const std::string& fileName, const osgDB::ReaderWriter::Options*) { - unsigned char *imageData = NULL; int width_ret; int height_ret; @@ -415,7 +419,13 @@ class ReaderWriterTIFF : public osgDB::ReaderWriter imageData = simage_tiff_load(fileName.c_str(),&width_ret,&height_ret,&numComponents_ret); - if (imageData==NULL) return ReadResult::FILE_NOT_HANDLED; + if (imageData==NULL) + { + char err_msg[256]; + simage_tiff_error( err_msg, sizeof(err_msg)); + osg::notify(osg::WARN) << err_msg << std::endl; + return ReadResult::FILE_NOT_HANDLED; + } int s = width_ret; int t = height_ret;