//=======================================================================
Standard_OStream& BinTools::PutBool(Standard_OStream& OS, const Standard_Boolean aValue)
{
- OS.put((Standard_Byte)aValue);
+ OS.put((Standard_Byte)(aValue ? 1 : 0));
return OS;
}
Standard_IStream& BinTools::GetReal(Standard_IStream& IS, Standard_Real& aValue)
{
if(!IS.read ((char*)&aValue, sizeof(Standard_Real)))
- Storage_StreamTypeMismatchError::Raise();
+ throw Storage_StreamTypeMismatchError();
#if DO_INVERSE
aValue = InverseReal (aValue);
#endif
Standard_IStream& BinTools::GetInteger(Standard_IStream& IS, Standard_Integer& aValue)
{
if(!IS.read ((char*)&aValue, sizeof(Standard_Integer)))
- Storage_StreamTypeMismatchError::Raise();;
+ throw Storage_StreamTypeMismatchError();;
#if DO_INVERSE
aValue = InverseInt (aValue);
#endif
Standard_IStream& BinTools::GetExtChar(Standard_IStream& IS, Standard_ExtCharacter& theValue)
{
if(!IS.read ((char*)&theValue, sizeof(Standard_ExtCharacter)))
- Storage_StreamTypeMismatchError::Raise();;
+ throw Storage_StreamTypeMismatchError();;
#if DO_INVERSE
theValue = InverseExtChar (theValue);
#endif
Standard_IStream& BinTools::GetBool(Standard_IStream& IS, Standard_Boolean& aValue)
{
- aValue = (Standard_Boolean)IS.get();
+ aValue = (IS.get() != 0);
return IS;
}
Standard_Boolean BinTools::Read (TopoDS_Shape& theShape, const Standard_CString theFile)
{
filebuf aBuf;
- OSD_OpenFileBuf (aBuf, theFile, ios::in | ios::binary);
+ OSD_OpenStream (aBuf, theFile, ios::in | ios::binary);
if (!aBuf.is_open())
return Standard_False;