From Aurelien Albert, "I've got some issues using osgb files within an big osga archive (file size > 2Go).

Issue is described here : http://forum.openscenegraph.org/viewtopic.php?t=13914

Here is a fix, using "std::streampos" standard type for stream positions up to 64bits.
"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14261 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield
2014-06-16 08:54:54 +00:00
parent 9195a0000b
commit 8d06b9b019

View File

@@ -90,13 +90,14 @@ public:
}
else if ( mark._name=="}" && _beginPositions.size()>0 )
{
int pos = _out->tellp(), beginPos = _beginPositions.back();
std::streampos pos = _out->tellp(), beginPos = _beginPositions.back();
_beginPositions.pop_back();
_out->seekp( beginPos, std::ios_base::beg );
_out->seekp( beginPos );
int size = pos - beginPos;
std::streampos size64 = pos - beginPos;
int size = (int) size64;
_out->write( (char*)&size, osgDB::INT_SIZE );
_out->seekp( pos, std::ios_base::beg );
_out->seekp( pos );
}
}
}
@@ -108,7 +109,7 @@ public:
{ writeString( str ); }
protected:
std::vector<int> _beginPositions;
std::vector<std::streampos> _beginPositions;
};
class BinaryInputIterator : public osgDB::InputIterator
@@ -262,7 +263,7 @@ public:
{
if ( _supportBinaryBrackets && _beginPositions.size()>0 )
{
int pos = _beginPositions.back() + _blockSizes.back();
std::streampos pos = _beginPositions.back() + _blockSizes.back();
_in->seekg( pos, std::ios_base::beg );
_beginPositions.pop_back();
_blockSizes.pop_back();
@@ -270,8 +271,8 @@ public:
}
protected:
std::vector<int> _beginPositions;
std::vector<int> _blockSizes;
std::vector<std::streampos> _beginPositions;
std::vector<std::streampos> _blockSizes;
};
#endif