replaced reading and writing of std::container.size() using InputStream::readSize() and OutputStream::writeSize() to make

the type writing more explictly tied to the size type, with use of unsigned int as the default size.  This approach
ensures that we get the same results under 32 and 64bit builds.
This commit is contained in:
Robert Osfield
2010-02-10 19:36:31 +00:00
parent 5b1ca779e4
commit 725258ea54
14 changed files with 47 additions and 45 deletions

View File

@@ -11,7 +11,7 @@ static bool checkLocalParameters( const osg::VertexProgram& vp )
static bool readLocalParameters( osgDB::InputStream& is, osg::VertexProgram& vp )
{
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
GLuint key; osg::Vec4d value;
@@ -25,7 +25,7 @@ static bool readLocalParameters( osgDB::InputStream& is, osg::VertexProgram& vp
static bool writeLocalParameters( osgDB::OutputStream& os, const osg::VertexProgram& vp )
{
const osg::VertexProgram::LocalParamList& params = vp.getLocalParameters();
os << params.size() << osgDB::BEGIN_BRACKET << std::endl;
os.writeSize(params.size()); os << osgDB::BEGIN_BRACKET << std::endl;
for ( osg::VertexProgram::LocalParamList::const_iterator itr=params.begin();
itr!=params.end(); ++itr )
{
@@ -43,7 +43,7 @@ static bool checkMatrices( const osg::VertexProgram& vp )
static bool readMatrices( osgDB::InputStream& is, osg::VertexProgram& vp )
{
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
unsigned int key; osg::Matrixd value;
@@ -57,7 +57,7 @@ static bool readMatrices( osgDB::InputStream& is, osg::VertexProgram& vp )
static bool writeMatrices( osgDB::OutputStream& os, const osg::VertexProgram& vp )
{
const osg::VertexProgram::MatrixList& matrices = vp.getMatrices();
os << matrices.size() << osgDB::BEGIN_BRACKET << std::endl;
os.writeSize(matrices.size()); os << osgDB::BEGIN_BRACKET << std::endl;
for ( osg::VertexProgram::MatrixList::const_iterator itr=matrices.begin();
itr!=matrices.end(); ++itr )
{