From: stv Date: Wed, 1 Jul 2015 11:03:50 +0000 (+0300) Subject: Allow to use one stream object for several documents. X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=66e3fd29c73f442bffbd5358b748bd36b67a0456;p=occt-copy.git Allow to use one stream object for several documents. --- diff --git a/src/CDM/CDM_MetaData.cxx b/src/CDM/CDM_MetaData.cxx index ad89a915aa..ca848d6ae1 100644 --- a/src/CDM/CDM_MetaData.cxx +++ b/src/CDM/CDM_MetaData.cxx @@ -73,9 +73,10 @@ Handle(CDM_MetaData) CDM_MetaData::LookUp(const Handle(Storage_IODevice)& aDevic if ( !aDevice.IsNull() ) aSig = aDevice->Signature(); - if( !getLookUpTable().IsBound(aSig) ) { + if ( aSig.IsEmpty() || !getLookUpTable().IsBound(aSig) ) { theMetaData = new CDM_MetaData(aDevice, ReadOnly); - getLookUpTable().Bind(aSig, theMetaData); + if ( !aSig.IsEmpty() ) + getLookUpTable().Bind(aSig, theMetaData); } else theMetaData = getLookUpTable()(aSig); @@ -89,9 +90,10 @@ Handle(CDM_MetaData) CDM_MetaData::LookUp(const Handle(Storage_IODevice)& aDevic if ( !aDevice.IsNull() ) aSig = aDevice->Signature(); - if( !getLookUpTable().IsBound(aSig) ) { + if ( aSig.IsEmpty() || !getLookUpTable().IsBound(aSig) ) { theMetaData = new CDM_MetaData(aDevice, aVersion, ReadOnly); - getLookUpTable().Bind(aSig, theMetaData); + if ( !aSig.IsEmpty() ) + getLookUpTable().Bind(aSig, theMetaData); } else theMetaData = getLookUpTable()(aSig); diff --git a/src/Storage/Storage_IStream.cxx b/src/Storage/Storage_IStream.cxx index d3db5caa22..62b4594969 100644 --- a/src/Storage/Storage_IStream.cxx +++ b/src/Storage/Storage_IStream.cxx @@ -177,9 +177,7 @@ Standard_Size Storage_IStream::Write (const Standard_Address /*theBuffer*/, cons //======================================================================= TCollection_AsciiString Storage_IStream::Signature() const { - Standard_Character buf[256]; - sprintf( buf, "%lx", (unsigned long)myStream ); - return TCollection_AsciiString( buf ); + return TCollection_AsciiString(); } //======================================================================= diff --git a/src/Storage/Storage_OStream.cxx b/src/Storage/Storage_OStream.cxx index 193ef8f754..62236cf47d 100644 --- a/src/Storage/Storage_OStream.cxx +++ b/src/Storage/Storage_OStream.cxx @@ -167,14 +167,9 @@ Standard_Size Storage_OStream::Read( const Standard_Address /*theBuffer*/, const //purpose : //======================================================================= Standard_Size Storage_OStream::Write (const Standard_Address theBuffer, const Standard_Size theSize) -{ - Storage_Position aPosBefore = Tell(); - - myStream->write ((char*)theBuffer, theSize); - - Storage_Position aPosAfter = Tell(); - - return aPosAfter - aPosBefore; +{ + myStream->write((char*)theBuffer, theSize); + return theSize; } //======================================================================= @@ -183,9 +178,7 @@ Standard_Size Storage_OStream::Write (const Standard_Address theBuffer, const St //======================================================================= TCollection_AsciiString Storage_OStream::Signature() const { - Standard_Character buf[256]; - sprintf( buf, "%lx", (unsigned long)myStream ); - return TCollection_AsciiString( buf ); + return TCollection_AsciiString(); } //=======================================================================