Fixed uninitialized variable.

This commit is contained in:
Robert Osfield 2004-11-10 22:11:28 +00:00
parent 141c3cadbf
commit 9fcda76143
2 changed files with 5 additions and 2 deletions

View File

@ -120,7 +120,7 @@ class OSGDB_EXPORT Archive : public ReaderWriter
inline bool spaceAvailable(pos_type, size_type, const std::string& filename) const inline bool spaceAvailable(pos_type, size_type, const std::string& filename) const
{ {
unsigned requiredSize = sizeof(pos_type)+sizeof(unsigned int)+filename.size(); unsigned requiredSize = sizeof(pos_type)+sizeof(size_type)+sizeof(unsigned int)+filename.size();
return (_offsetOfNextAvailableSpace + requiredSize)<_blockSize; return (_offsetOfNextAvailableSpace + requiredSize)<_blockSize;
} }

View File

@ -40,6 +40,7 @@ Archive::IndexBlock::IndexBlock(unsigned int blockSize):
_requiresWrite(false), _requiresWrite(false),
_filePosition(0), _filePosition(0),
_blockSize(0), _blockSize(0),
_filePositionNextIndexBlock(0),
_offsetOfNextAvailableSpace(0), _offsetOfNextAvailableSpace(0),
_data(0) _data(0)
{ {
@ -198,7 +199,7 @@ void Archive::IndexBlock::write(std::ostream& out)
out.write(reinterpret_cast<char*>(_data),_blockSize); out.write(reinterpret_cast<char*>(_data),_blockSize);
osg::notify(osg::INFO)<<"Archive::IndexBlock::write()"<<std::endl; osg::notify(osg::INFO)<<"Archive::IndexBlock::write() end"<<std::endl;
} }
@ -465,6 +466,8 @@ bool Archive::addFileReference(pos_type position, size_type size, const std::str
// if not one available create a new block. // if not one available create a new block.
if (!indexBlock) if (!indexBlock)
{ {
osg::notify(osg::NOTICE)<<"Creating new block"<<std::endl;
if (previousBlock.valid()) previousBlock->setPositionNextIndexBlock(_output.tellp()); if (previousBlock.valid()) previousBlock->setPositionNextIndexBlock(_output.tellp());
indexBlock = new IndexBlock(blockSize); indexBlock = new IndexBlock(blockSize);