From 8d06b9b01977348169b6a7a307cbe718ec92a7ec Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 16 Jun 2014 08:54:54 +0000 Subject: [PATCH] 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 --- src/osgPlugins/osg/BinaryStreamOperator.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/osgPlugins/osg/BinaryStreamOperator.h b/src/osgPlugins/osg/BinaryStreamOperator.h index 1f84aa994..93c721d0d 100644 --- a/src/osgPlugins/osg/BinaryStreamOperator.h +++ b/src/osgPlugins/osg/BinaryStreamOperator.h @@ -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 _beginPositions; + std::vector _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 _beginPositions; - std::vector _blockSizes; + std::vector _beginPositions; + std::vector _blockSizes; }; #endif