From: stv Date: Wed, 3 Jun 2015 14:08:32 +0000 (+0300) Subject: Fixes for compilation type conversion errors on Linux. X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=f6eba5f482bf55b64dadeb0d0867a48db86590ea;p=occt-copy.git Fixes for compilation type conversion errors on Linux. --- diff --git a/src/BinDrivers/BinDrivers_DocumentRetrievalDriver.cxx b/src/BinDrivers/BinDrivers_DocumentRetrievalDriver.cxx index 144f060ef5..5615d4648e 100644 --- a/src/BinDrivers/BinDrivers_DocumentRetrievalDriver.cxx +++ b/src/BinDrivers/BinDrivers_DocumentRetrievalDriver.cxx @@ -66,7 +66,7 @@ void BinDrivers_DocumentRetrievalDriver::ReadShapeSection( BinLDrivers_DocumentS OCC_CATCH_SIGNALS aBuf = (Standard_Character*)malloc( theSection.Length() + 1 ); - Standard_Size aSize = theDevice->Read( aBuf, theSection.Length() ); + Standard_Size aSize = theDevice->Read( (Standard_Address)aBuf, theSection.Length() ); if ( aSize == theSection.Length() ) { Standard_SStream aStrStream( std::string( aBuf, aSize ), Standard_SStream::in | Standard_SStream::binary ); diff --git a/src/BinLDrivers/BinLDrivers_DocumentSection.cxx b/src/BinLDrivers/BinLDrivers_DocumentSection.cxx index 91006bd3f5..7172921ddc 100644 --- a/src/BinLDrivers/BinLDrivers_DocumentSection.cxx +++ b/src/BinLDrivers/BinLDrivers_DocumentSection.cxx @@ -137,7 +137,7 @@ void BinLDrivers_DocumentSection::WriteTOC (const Handle(Storage_IODevice)& theD #else aBufSz[0] = (Standard_Integer)aBufSize; #endif - theDevice->Write( &aBuf[0], aBufSize + sizeof(Standard_Integer) ); + theDevice->Write( (Standard_Address)&aBuf[0], aBufSize + sizeof(Standard_Integer) ); // Store the address of Offset word in the file myValue[0] = (Standard_Size) theDevice->Tell(); @@ -148,7 +148,7 @@ void BinLDrivers_DocumentSection::WriteTOC (const Handle(Storage_IODevice)& theD aBufSz[0] = 0; aBufSz[1] = 0; aBufSz[2] = 0; - theDevice->Write(&aBuf[0], 3*sizeof(Standard_Integer)); + theDevice->Write( (Standard_Address)&aBuf[0], 3*sizeof(Standard_Integer)); } } @@ -175,7 +175,7 @@ void BinLDrivers_DocumentSection::Write (const Handle(Storage_IODevice)& theDevi aVal[2] = InverseSize(aVal[2]); #endif - theDevice->Write((char*)&aVal[0], 3*sizeof(Standard_Integer)); + theDevice->Write((Standard_Address)&aVal[0], 3*sizeof(Standard_Integer)); theDevice->Seek(aSectionEnd); } @@ -189,7 +189,7 @@ void BinLDrivers_DocumentSection::ReadTOC( BinLDrivers_DocumentSection& theSecti { char aBuf[512]; Standard_Integer aNameBufferSize; - theDevice->Read( (char*)&aNameBufferSize, sizeof(Standard_Integer) ); + theDevice->Read( (Standard_Address)&aNameBufferSize, sizeof(Standard_Integer) ); #if DO_INVERSE aNameBufferSize = InverseSize(aNameBufferSize); #endif diff --git a/src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx b/src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx index 78a0a35dd5..f4aeece7e5 100644 --- a/src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx +++ b/src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx @@ -245,7 +245,7 @@ void BinLDrivers_DocumentStorageDriver::WriteSubTree(const TDF_Label& t #if DO_INVERSE anEndLabel = (BinLDrivers_Marker) InverseInt (anEndLabel); #endif - theDevice->Write((char*)&anEndLabel, sizeof(anEndLabel)); + theDevice->Write( (Standard_Address)&anEndLabel, sizeof(anEndLabel)); } //======================================================================= diff --git a/src/BinObjMgt/BinObjMgt_Persistent.cxx b/src/BinObjMgt/BinObjMgt_Persistent.cxx index c5e49cf34d..f8579aa949 100644 --- a/src/BinObjMgt/BinObjMgt_Persistent.cxx +++ b/src/BinObjMgt/BinObjMgt_Persistent.cxx @@ -123,7 +123,7 @@ void BinObjMgt_Persistent::Write (const Handle(Storage_IODevice)& theDevice) for (Standard_Integer i=1; theDevice->CanWrite() && nbWritten < mySize && i <= myData.Length(); i++) { Standard_Integer nbToWrite = Min(mySize - nbWritten, BP_PIECESIZE); - theDevice->Write( (char*)myData(i), nbToWrite ); + theDevice->Write( (Standard_Address)myData(i), nbToWrite ); nbWritten += nbToWrite; } myIndex = 1; diff --git a/src/FSD/FSD_BinaryFile.cxx b/src/FSD/FSD_BinaryFile.cxx index 94cf39a20f..63bc80fbc1 100644 --- a/src/FSD/FSD_BinaryFile.cxx +++ b/src/FSD/FSD_BinaryFile.cxx @@ -200,7 +200,7 @@ Storage_BaseDriver& FSD_BinaryFile::PutReference(const Standard_Integer aValue) Standard_Integer t = aValue; #endif - if ( Device()->Write( &t, sizeof(Standard_Integer) ) != sizeof(Standard_Integer) ) + if ( Device()->Write( (Standard_Address)&t, sizeof(Standard_Integer) ) != sizeof(Standard_Integer) ) Storage_StreamWriteError::Raise(); return *this; @@ -237,7 +237,7 @@ Storage_BaseDriver& FSD_BinaryFile::PutExtCharacter(const Standard_ExtCharacter Standard_ExtCharacter t = aValue; #endif - if ( Device()->Write(&t, sizeof(Standard_ExtCharacter)) != sizeof(Standard_ExtCharacter) ) + if ( Device()->Write((Standard_Address)&t, sizeof(Standard_ExtCharacter)) != sizeof(Standard_ExtCharacter) ) Storage_StreamWriteError::Raise(); return *this; @@ -259,7 +259,7 @@ Storage_BaseDriver& FSD_BinaryFile::PutInteger(const Standard_Integer aValue) Standard_Integer t = aValue; #endif - if ( Device()->Write(&t,sizeof(Standard_Integer)) != sizeof(Standard_Integer)) + if ( Device()->Write((Standard_Address)&t,sizeof(Standard_Integer)) != sizeof(Standard_Integer)) Storage_StreamWriteError::Raise(); return *this; @@ -281,7 +281,7 @@ Storage_BaseDriver& FSD_BinaryFile::PutBoolean(const Standard_Boolean aValue) Standard_Integer t = (Standard_Integer)aValue; #endif - if ( Device()->Write(&t,sizeof(Standard_Integer)) != sizeof(Standard_Integer) ) + if ( Device()->Write((Standard_Address)&t,sizeof(Standard_Integer)) != sizeof(Standard_Integer) ) Storage_StreamWriteError::Raise(); return *this; @@ -303,7 +303,7 @@ Storage_BaseDriver& FSD_BinaryFile::PutReal(const Standard_Real aValue) Standard_Real t = aValue; #endif - if ( Device()->Write(&t,sizeof(Standard_Real)) != sizeof(Standard_Real) ) + if ( Device()->Write((Standard_Address)&t,sizeof(Standard_Real)) != sizeof(Standard_Real) ) Storage_StreamWriteError::Raise(); return *this; @@ -325,7 +325,7 @@ Storage_BaseDriver& FSD_BinaryFile::PutShortReal(const Standard_ShortReal aValue Standard_ShortReal t = aValue; #endif - if ( Device()->Write(&t,sizeof(Standard_ShortReal)) != sizeof(Standard_ShortReal) ) + if ( Device()->Write((Standard_Address)&t,sizeof(Standard_ShortReal)) != sizeof(Standard_ShortReal) ) Storage_StreamWriteError::Raise(); return *this; @@ -341,7 +341,7 @@ Storage_BaseDriver& FSD_BinaryFile::GetReference(Standard_Integer& aValue) if ( Device().IsNull() ) Storage_StreamReadError::Raise(); - if ( Device()->Read(&aValue,sizeof(Standard_Integer)) != sizeof(Standard_Integer) ) + if ( Device()->Read( (Standard_Address)&aValue,sizeof(Standard_Integer)) != sizeof(Standard_Integer) ) Storage_StreamTypeMismatchError::Raise(); #if DO_INVERSE aValue = InverseInt (aValue); @@ -359,7 +359,7 @@ Storage_BaseDriver& FSD_BinaryFile::GetCharacter(Standard_Character& aValue) if ( Device().IsNull() ) Storage_StreamReadError::Raise(); - if ( Device()->Read(&aValue,sizeof(Standard_Character)) != sizeof(Standard_Character) ) + if ( Device()->Read( (Standard_Address)&aValue,sizeof(Standard_Character)) != sizeof(Standard_Character) ) Storage_StreamTypeMismatchError::Raise(); return *this; @@ -375,7 +375,7 @@ Storage_BaseDriver& FSD_BinaryFile::GetExtCharacter(Standard_ExtCharacter& aValu if ( Device().IsNull() ) Storage_StreamReadError::Raise(); - if ( Device()->Read(&aValue,sizeof(Standard_ExtCharacter)) != sizeof(Standard_ExtCharacter) ) + if ( Device()->Read( (Standard_Address)&aValue,sizeof(Standard_ExtCharacter)) != sizeof(Standard_ExtCharacter) ) Storage_StreamTypeMismatchError::Raise(); #if DO_INVERSE aValue = InverseExtChar (aValue); @@ -393,7 +393,7 @@ Storage_BaseDriver& FSD_BinaryFile::GetInteger(Standard_Integer& aValue) if ( Device().IsNull() ) Storage_StreamReadError::Raise(); - if ( Device()->Read(&aValue,sizeof(Standard_Integer)) != sizeof(Standard_Integer) ) + if ( Device()->Read((Standard_Address)&aValue,sizeof(Standard_Integer)) != sizeof(Standard_Integer) ) Storage_StreamTypeMismatchError::Raise(); #if DO_INVERSE aValue = InverseInt (aValue); @@ -411,7 +411,7 @@ Storage_BaseDriver& FSD_BinaryFile::GetBoolean(Standard_Boolean& aValue) if ( Device().IsNull() ) Storage_StreamReadError::Raise(); - if ( Device()->Read(&aValue,sizeof(Standard_Boolean)) != sizeof(Standard_Boolean) ) + if ( Device()->Read((Standard_Address)&aValue,sizeof(Standard_Boolean)) != sizeof(Standard_Boolean) ) Storage_StreamTypeMismatchError::Raise(); #if DO_INVERSE aValue = InverseInt ((Standard_Integer) aValue); @@ -429,7 +429,7 @@ Storage_BaseDriver& FSD_BinaryFile::GetReal(Standard_Real& aValue) if ( Device().IsNull() ) Storage_StreamReadError::Raise(); - if ( Device()->Read(&aValue,sizeof(Standard_Real)) != sizeof(Standard_Real)) + if ( Device()->Read((Standard_Address)&aValue,sizeof(Standard_Real)) != sizeof(Standard_Real)) Storage_StreamTypeMismatchError::Raise(); #if DO_INVERSE aValue = InverseReal (aValue); @@ -447,7 +447,7 @@ Storage_BaseDriver& FSD_BinaryFile::GetShortReal(Standard_ShortReal& aValue) if ( Device().IsNull() ) Storage_StreamReadError::Raise(); - if ( Device()->Read(&aValue,sizeof(Standard_ShortReal)) != sizeof(Standard_ShortReal)) + if ( Device()->Read((Standard_Address)&aValue,sizeof(Standard_ShortReal)) != sizeof(Standard_ShortReal)) Storage_StreamTypeMismatchError::Raise(); #if DO_INVERSE aValue = InverseShortReal (aValue); @@ -1160,7 +1160,7 @@ void FSD_BinaryFile::ReadString(TCollection_AsciiString& aString) GetInteger(size); if (size > 0) { Standard_Character *c = (Standard_Character *)Standard::Allocate((size+1) * sizeof(Standard_Character)); - if ( Device().IsNull() || Device()->Read(c,size) != size ) + if ( Device().IsNull() || Device()->Read((Standard_Address)c,size) != size ) Storage_StreamReadError::Raise(); c[size] = '\0'; aString = c; diff --git a/src/FSD/FSD_CmpFile.cxx b/src/FSD/FSD_CmpFile.cxx index f7ef5ba87c..aa1c4e145c 100644 --- a/src/FSD/FSD_CmpFile.cxx +++ b/src/FSD/FSD_CmpFile.cxx @@ -255,7 +255,7 @@ void FSD_CmpFile::WriteExtendedLine(const TCollection_ExtendedString& buffer) PutExtCharacter(extBuffer[i]); } - Device()->Write("\n", 1); + Device()->Write((Standard_Address)"\n", 1); } //======================================================================= diff --git a/src/FSD/FSD_File.cxx b/src/FSD/FSD_File.cxx index de9b87ab87..056712d6ee 100644 --- a/src/FSD/FSD_File.cxx +++ b/src/FSD/FSD_File.cxx @@ -243,11 +243,11 @@ void FSD_File::WriteExtendedLine(const TCollection_ExtendedString& buffer) char cc = (char)c; char cd = (char)d; - Device()->Write( &cc, sizeof(char) ); - Device()->Write( &cd, sizeof(char) ); + Device()->Write( (Standard_Address)&cc, sizeof(char) ); + Device()->Write( (Standard_Address)&cd, sizeof(char) ); } - Device()->Write("\0\n", 2); + Device()->Write((Standard_Address)"\0\n", 2); } //=======================================================================