From Mourad Boufarguine, "This submissions fixes the problem of the difference of std::*::size_type between 32bit and 64 bit platforms. It wraps the reading and writing of std::*::size_type values using the osgDB::InputStream::readSize and osgDB::OutputStream::writeSize methods."

This commit is contained in:
Robert Osfield 2010-04-23 08:55:23 +00:00
parent 5d0b84edd0
commit 07328f3d17
6 changed files with 19 additions and 19 deletions

View File

@ -23,7 +23,7 @@ static void readContainer( osgDB::InputStream& is, ContainerType* container )
if ( hasContainer )
{
unsigned int size = 0;
is >> size >> osgDB::BEGIN_BRACKET;
size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
double time = 0.0f;
@ -44,7 +44,7 @@ static void readContainer2( osgDB::InputStream& is, ContainerType* container )
if ( hasContainer )
{
unsigned int size = 0;
is >> size >> osgDB::BEGIN_BRACKET;
size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
double time = 0.0f;
@ -90,7 +90,7 @@ static void writeContainer( osgDB::OutputStream& os, ContainerType* container )
os << osgDB::PROPERTY("KeyFrameContainer") << (container!=NULL);
if ( container!=NULL )
{
os << container->size() << osgDB::BEGIN_BRACKET << std::endl;
os.writeSize(container->size()); os << osgDB::BEGIN_BRACKET << std::endl;
for ( unsigned int i=0; i<container->size(); ++i )
{
os << (*container)[i].getTime() << (*container)[i].getValue() << std::endl;
@ -107,7 +107,7 @@ static void writeContainer2( osgDB::OutputStream& os, ContainerType* container )
os << osgDB::PROPERTY("KeyFrameContainer") << (container!=NULL);
if ( container!=NULL )
{
os << container->size() << osgDB::BEGIN_BRACKET << std::endl;
os.writeSize(container->size()); os << osgDB::BEGIN_BRACKET << std::endl;
for ( unsigned int i=0; i<container->size(); ++i )
{
const KeyType& keyframe = (*container)[i];
@ -149,7 +149,7 @@ static bool checkChannels( const osgAnimation::Animation& ani )
static bool readChannels( osgDB::InputStream& is, osgAnimation::Animation& ani )
{
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 )
{
std::string type;
@ -194,7 +194,7 @@ static bool readChannels( osgDB::InputStream& is, osgAnimation::Animation& ani )
static bool writeChannels( osgDB::OutputStream& os, const osgAnimation::Animation& ani )
{
const osgAnimation::ChannelList& channels = ani.getChannels();
os << channels.size() << osgDB::BEGIN_BRACKET << std::endl;
os.writeSize(channels.size()); os << osgDB::BEGIN_BRACKET << std::endl;
for ( osgAnimation::ChannelList::const_iterator itr=channels.begin();
itr!=channels.end(); ++itr )
{

View File

@ -13,7 +13,7 @@ static bool checkAnimations( const osgAnimation::AnimationManagerBase& manager )
static bool readAnimations( osgDB::InputStream& is, osgAnimation::AnimationManagerBase& manager )
{
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 )
{
osgAnimation::Animation* ani = dynamic_cast<osgAnimation::Animation*>( is.readObject() );
@ -26,7 +26,7 @@ static bool readAnimations( osgDB::InputStream& is, osgAnimation::AnimationManag
static bool writeAnimations( osgDB::OutputStream& os, const osgAnimation::AnimationManagerBase& manager )
{
const osgAnimation::AnimationList& animations = manager.getAnimationList();
os << animations.size() << osgDB::BEGIN_BRACKET << std::endl;
os.writeSize(animations.size()); os << osgDB::BEGIN_BRACKET << std::endl;
for ( osgAnimation::AnimationList::const_iterator itr=animations.begin();
itr!=animations.end(); ++itr )
{

View File

@ -10,7 +10,7 @@ static bool checkMorphTargets( const osgAnimation::MorphGeometry& geom )
static bool readMorphTargets( osgDB::InputStream& is, osgAnimation::MorphGeometry& geom )
{
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 )
{
float weight = 0.0f;
@ -25,7 +25,7 @@ static bool readMorphTargets( osgDB::InputStream& is, osgAnimation::MorphGeometr
static bool writeMorphTargets( osgDB::OutputStream& os, const osgAnimation::MorphGeometry& geom )
{
const osgAnimation::MorphGeometry::MorphTargetList& targets = geom.getMorphTargetList();
os << targets.size() << osgDB::BEGIN_BRACKET << std::endl;
os.writeSize(targets.size()); os << osgDB::BEGIN_BRACKET << std::endl;
for ( osgAnimation::MorphGeometry::MorphTargetList::const_iterator itr=targets.begin();
itr!=targets.end(); ++itr )
{

View File

@ -11,12 +11,12 @@ static bool checkInfluenceMap( const osgAnimation::RigGeometry& geom )
static bool readInfluenceMap( osgDB::InputStream& is, osgAnimation::RigGeometry& geom )
{
osgAnimation::VertexInfluenceMap* map = new osgAnimation::VertexInfluenceMap;
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 )
{
std::string name;
unsigned int viSize = 0;
is >> osgDB::PROPERTY("VertexInfluence") >> name >> viSize >> osgDB::BEGIN_BRACKET;
is >> osgDB::PROPERTY("VertexInfluence") >> name; viSize = is.readSize(); is >> osgDB::BEGIN_BRACKET;
osgAnimation::VertexInfluence vi;
vi.setName( name );
@ -40,7 +40,7 @@ static bool readInfluenceMap( osgDB::InputStream& is, osgAnimation::RigGeometry&
static bool writeInfluenceMap( osgDB::OutputStream& os, const osgAnimation::RigGeometry& geom )
{
const osgAnimation::VertexInfluenceMap* map = geom.getInfluenceMap();
os << map->size() << osgDB::BEGIN_BRACKET << std::endl;
os.writeSize(map->size()); os << osgDB::BEGIN_BRACKET << std::endl;
for ( osgAnimation::VertexInfluenceMap::const_iterator itr=map->begin();
itr!=map->end(); ++itr )
{
@ -48,8 +48,8 @@ static bool writeInfluenceMap( osgDB::OutputStream& os, const osgAnimation::RigG
const osgAnimation::VertexInfluence& vi = itr->second;
if ( name.empty() ) name = "Empty";
os << osgDB::PROPERTY("VertexInfluence") << name << vi.size()
<< osgDB::BEGIN_BRACKET << std::endl;
os << osgDB::PROPERTY("VertexInfluence") << name; os.writeSize(vi.size()) ; os << osgDB::BEGIN_BRACKET << std::endl;
for ( osgAnimation::VertexInfluence::const_iterator vitr=vi.begin();
vitr != vi.end(); ++vitr )
{

View File

@ -14,7 +14,7 @@ static bool checkStackedTransforms( const osgAnimation::UpdateMatrixTransform& o
static bool readStackedTransforms( osgDB::InputStream& is, osgAnimation::UpdateMatrixTransform& obj )
{
osgAnimation::StackedTransform& transform = obj.getStackedTransforms();
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 )
{
osgAnimation::StackedTransformElement* element =
@ -28,7 +28,7 @@ static bool readStackedTransforms( osgDB::InputStream& is, osgAnimation::UpdateM
static bool writeStackedTransforms( osgDB::OutputStream& os, const osgAnimation::UpdateMatrixTransform& obj )
{
const osgAnimation::StackedTransform& transform = obj.getStackedTransforms();
os << transform.size() << osgDB::BEGIN_BRACKET << std::endl;
os.writeSize(transform.size()); os << osgDB::BEGIN_BRACKET << std::endl;
for ( osgAnimation::StackedTransform::const_iterator itr=transform.begin();
itr!=transform.end(); ++itr )
{

View File

@ -10,7 +10,7 @@ static bool checkTextureWeights( const osgFX::MultiTextureControl& ctrl )
static bool readTextureWeights( osgDB::InputStream& is, osgFX::MultiTextureControl& ctrl )
{
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 )
{
float weight = 0.0f; is >> weight;
@ -23,7 +23,7 @@ static bool readTextureWeights( osgDB::InputStream& is, osgFX::MultiTextureContr
static bool writeTextureWeights( osgDB::OutputStream& os, const osgFX::MultiTextureControl& ctrl )
{
unsigned int size = ctrl.getNumTextureWeights();
os << size << osgDB::BEGIN_BRACKET << std::endl;
os.writeSize(size); os << osgDB::BEGIN_BRACKET << std::endl;
for ( unsigned int i=0; i<size; ++i )
{
os << ctrl.getTextureWeight(i);