diff --git a/src/osgPlugins/osga/OSGA_Archive.cpp b/src/osgPlugins/osga/OSGA_Archive.cpp index 81a9b7db1..d7dedcb3c 100644 --- a/src/osgPlugins/osga/OSGA_Archive.cpp +++ b/src/osgPlugins/osga/OSGA_Archive.cpp @@ -235,73 +235,7 @@ bool OSGA_Archive::open(const std::string& filename, ArchiveStatus status, unsig _status = status; _input.open(filename.c_str(), std::ios_base::binary | std::ios_base::in); - if (_input) - { - osg::notify(osg::INFO)<<"trying OSGA_Archive::open("<(&endianTestWord),4); - bool doEndianSwap = (endianTestWord!=ENDIAN_TEST_NUMBER); - - _input.read(reinterpret_cast(&_version),sizeof(_version)); - if (doEndianSwap) - { - osg::swapBytes(reinterpret_cast(&_version),sizeof(_version)); - } - - osg::notify(osg::INFO)<<"OSGA_Archive::open() doEndianSwap="<getFirstFileName(); - } - - for(IndexBlockList::iterator itr=_indexBlockList.begin(); - itr!=_indexBlockList.end(); - ++itr) - { - (*itr)->getFileReferences(_indexMap); - } - - for(FileNamePositionMap::iterator mitr=_indexMap.begin(); - mitr!=_indexMap.end(); - ++mitr) - { - osg::notify(osg::INFO)<<" filename "<<(mitr->first)<<" pos="<<(int)((mitr->second).first)<<" size="<<(int)((mitr->second).second)<(_output).rdbuf(fin.rdbuf()); + return false; +} + +bool OSGA_Archive::_open(std::istream& input) +{ + if (input) + { + char identifier[4]; + input.read(identifier,4); + + bool validArchive = (identifier[0]=='o' && identifier[1]=='s' && identifier[2]=='g' && identifier[3]=='a'); + if (validArchive) + { + + unsigned int endianTestWord=0; + input.read(reinterpret_cast(&endianTestWord),4); + bool doEndianSwap = (endianTestWord!=ENDIAN_TEST_NUMBER); + + input.read(reinterpret_cast(&_version),sizeof(_version)); + if (doEndianSwap) + { + osg::swapBytes(reinterpret_cast(&_version),sizeof(_version)); + } + + osg::notify(osg::INFO)<<"OSGA_Archive::open() doEndianSwap="<first)<<" pos="<<(int)((mitr->second).first)<<" size="<<(int)((mitr->second).second)< > IndexBlockList; + bool _open(std::istream& fin); + void writeIndexBlocks(); bool addFileReference(pos_type position, size_type size, const std::string& fileName); diff --git a/src/osgPlugins/osga/ReaderWriterOSGA.cpp b/src/osgPlugins/osga/ReaderWriterOSGA.cpp index dcfd61233..b0023e9e4 100644 --- a/src/osgPlugins/osga/ReaderWriterOSGA.cpp +++ b/src/osgPlugins/osga/ReaderWriterOSGA.cpp @@ -51,7 +51,7 @@ public: return archive.get(); } - virtual ReadResult readImage(const std::string& file,const Options* options) + virtual ReadResult readImage(const std::string& file,const Options*) { ReadResult result = openArchive(file,osgDB::Archive::READ); @@ -71,7 +71,7 @@ public: return result_2; } - virtual ReadResult readNode(const std::string& file,const Options* options) + virtual ReadResult readNode(const std::string& file,const Options*) { ReadResult result = openArchive(file,osgDB::Archive::READ);