Added sizeof tests of istream::pos_type and off_type to osgunittests.

Added debuggin messages to endian handling code in Archive::open().
This commit is contained in:
Robert Osfield
2004-11-10 21:28:06 +00:00
parent 3523577235
commit d397b5b90b
2 changed files with 8 additions and 1 deletions

View File

@@ -112,6 +112,10 @@ void sizeOfTest()
#endif
std::cout<<"sizeof(float)=="<<sizeof(float)<<std::endl;
std::cout<<"sizeof(double)=="<<sizeof(double)<<std::endl;
std::cout<<"sizeof(std::istream::pos_type)=="<<sizeof(std::istream::pos_type)<<std::endl;
std::cout<<"sizeof(std::istream::off_type)=="<<sizeof(std::istream::off_type)<<std::endl;
}

View File

@@ -246,7 +246,7 @@ bool Archive::open(const std::string& filename, ArchiveStatus status, unsigned i
if (validArchive)
{
unsigned int endianTestWord;
unsigned int endianTestWord=0;
_input.read(reinterpret_cast<char*>(&endianTestWord),4);
bool doEndianSwap = (endianTestWord!=ENDIAN_TEST_NUMBER);
@@ -256,6 +256,9 @@ bool Archive::open(const std::string& filename, ArchiveStatus status, unsigned i
osg::swapBytes(reinterpret_cast<char*>(&_version),sizeof(_version));
}
osg::notify(osg::NOTICE)<<"Archive::open() doEndianSwap="<<doEndianSwap<<std::endl;
osg::notify(osg::NOTICE)<<"Archive::open() Version="<<_version<<std::endl;
IndexBlock *indexBlock = 0;
while ( (indexBlock=Archive::IndexBlock::read(_input, doEndianSwap)) != 0)