From e9589ebb49643bebec3d9d50bb83ab5f3c3f3b5a Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sat, 10 May 2008 17:23:12 +0000 Subject: [PATCH] From Paul Martz, "Another round of plugin enhancements. 3DC: Output now uses osg::notify. JPEG: Now returns correct error code for empty input file. FreeType: Prevent possible crash if Options is NULL." --- src/osgPlugins/3dc/ReaderWriter3DC.cpp | 6 +++--- src/osgPlugins/freetype/ReaderWriterFreeType.cpp | 2 +- src/osgPlugins/jpeg/ReaderWriterJPEG.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/osgPlugins/3dc/ReaderWriter3DC.cpp b/src/osgPlugins/3dc/ReaderWriter3DC.cpp index 1ba8a77fd..59cf7adf3 100644 --- a/src/osgPlugins/3dc/ReaderWriter3DC.cpp +++ b/src/osgPlugins/3dc/ReaderWriter3DC.cpp @@ -31,7 +31,7 @@ class ReaderWriter3DC : public osgDB::ReaderWriter std::string fileName = osgDB::findDataFile( file, options ); if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; - std::cout << "try to read file "<0) { diff --git a/src/osgPlugins/freetype/ReaderWriterFreeType.cpp b/src/osgPlugins/freetype/ReaderWriterFreeType.cpp index a67e39a91..18871e3e3 100644 --- a/src/osgPlugins/freetype/ReaderWriterFreeType.cpp +++ b/src/osgPlugins/freetype/ReaderWriterFreeType.cpp @@ -49,7 +49,7 @@ class ReaderWriterFreeType : public osgDB::ReaderWriter return ReadResult::ERROR_IN_READING_FILE; } - if (options->getPluginData("3D")) + if ( (options != NULL) && (options->getPluginData("3D")) ) return freeTypeLibrary->getFont3D(fileName,0,getFlags(options)); else return freeTypeLibrary->getFont(fileName,0,getFlags(options)); diff --git a/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp b/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp index 9ef3b1199..b12a7d531 100644 --- a/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp +++ b/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp @@ -755,7 +755,7 @@ class ReaderWriterJPEG : public osgDB::ReaderWriter imageData = simage_jpeg_load(fin,&width_ret,&height_ret,&numComponents_ret); - if (imageData==NULL) return ReadResult::FILE_NOT_HANDLED; + if (imageData==NULL) return ReadResult::ERROR_IN_READING_FILE; int s = width_ret; int t = height_ret; @@ -811,7 +811,7 @@ class ReaderWriterJPEG : public osgDB::ReaderWriter if (fileName.empty()) return ReadResult::FILE_NOT_FOUND; std::ifstream istream(fileName.c_str(), std::ios::in | std::ios::binary); - if(!istream) return ReadResult::FILE_NOT_HANDLED; + if(!istream) return ReadResult::ERROR_IN_READING_FILE; ReadResult rr = readJPGStream(istream); if(rr.validImage()) rr.getImage()->setFileName(file); return rr;