Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

From Aurelien Albert, "I've got some issues using osgb files within a…

…n 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
  • Loading branch information...
commit 0842a55a466b5ddf023b9be498d51755b396abc7 1 parent afd0107
Robert OSFIELD authored
Showing with 9 additions and 8 deletions.
  1. +9 −8 src/osgPlugins/osg/BinaryStreamOperator.h
View
17 src/osgPlugins/osg/BinaryStreamOperator.h
@@ -90,13 +90,14 @@ class BinaryOutputIterator : public osgDB::OutputIterator
}
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 @@ class BinaryOutputIterator : public osgDB::OutputIterator
{ writeString( str ); }
protected:
- std::vector<int> _beginPositions;
+ std::vector<std::streampos> _beginPositions;
};
class BinaryInputIterator : public osgDB::InputIterator
@@ -262,7 +263,7 @@ class BinaryInputIterator : public osgDB::InputIterator
{
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 @@ class BinaryInputIterator : public osgDB::InputIterator
}
protected:
- std::vector<int> _beginPositions;
- std::vector<int> _blockSizes;
+ std::vector<std::streampos> _beginPositions;
+ std::vector<std::streampos> _blockSizes;
};
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.