Added s/getByteSwap to teh InputStreamOperator base class and use of this method in the InputStream::start(InputStreamOperator*) method to ensure the bytes are swapped consistently.

This commit is contained in:
Robert Osfield
2012-02-24 21:07:02 +00:00
parent c3fb8dc714
commit e8ac276451
5 changed files with 52 additions and 16 deletions

View File

@@ -46,12 +46,12 @@ InputIterator* readInputIterator( std::istream& fin, const Options* options )
if ( headerLow==OSG_HEADER_LOW && headerHigh==OSG_HEADER_HIGH )
{
OSG_INFO<<"Reading OpenSceneGraph binary file with the same endian as this computer."<<std::endl;
return new BinaryInputIterator(&fin, false); // endian the same so no byte swap required
return new BinaryInputIterator(&fin, 0); // endian the same so no byte swap required
}
else if ( headerLow==OSG_REVERSE(OSG_HEADER_LOW) && headerHigh==OSG_REVERSE(OSG_HEADER_HIGH) )
{
OSG_INFO<<"Reading OpenSceneGraph binary file with the different endian to this computer, doing byte swap."<<std::endl;
return new BinaryInputIterator(&fin, true); // endian different so byte swap required
return new BinaryInputIterator(&fin, 1); // endian different so byte swap required
}
fin.seekg( 0, std::ios::beg );