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."
This commit is contained in:
parent
4d7b2edd4c
commit
e9589ebb49
@ -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 "<<fileName<<std::endl;
|
||||
osg::notify(osg::INFO) << "Reading file "<<fileName<<std::endl;
|
||||
|
||||
const int LINE_SIZE = 1024;
|
||||
char line[LINE_SIZE];
|
||||
@ -54,7 +54,7 @@ class ReaderWriter3DC : public osgDB::ReaderWriter
|
||||
}
|
||||
|
||||
|
||||
std::cout << "num="<<num<<std::endl;
|
||||
osg::notify(osg::INFO) << "num="<<num<<std::endl;
|
||||
|
||||
unsigned int targetNumVertices = 10000;
|
||||
|
||||
@ -80,7 +80,7 @@ class ReaderWriter3DC : public osgDB::ReaderWriter
|
||||
if (line[0]=='#')
|
||||
{
|
||||
// comment line
|
||||
//std::cout <<"Comment: "<<line<<std::endl;
|
||||
osg::notify(osg::INFO) <<"Comment: "<<line<<std::endl;
|
||||
}
|
||||
else if (strlen(line)>0)
|
||||
{
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user