]> OCCT Git - occt-copy.git/commitdiff
Allow to use one stream object for several documents.
authorstv <stv@opencascade.com>
Wed, 1 Jul 2015 11:03:50 +0000 (14:03 +0300)
committerabv <abv@opencascade.com>
Thu, 17 Sep 2015 15:45:25 +0000 (18:45 +0300)
src/CDM/CDM_MetaData.cxx
src/Storage/Storage_IStream.cxx
src/Storage/Storage_OStream.cxx

index ad89a915aa5f4495b47723af381af9a78136b9ad..ca848d6ae1d25a8ce4494c2a5b250d355868f537 100644 (file)
@@ -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);
index d3db5caa22bab72a997cd1d8fb3fee38db9c54b8..62b4594969395134cd962c4e1ca44c8935b8ad72 100644 (file)
@@ -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();
 }
 
 //=======================================================================
index 193ef8f754e6d0097db2e77a0032f511f58f49d2..62236cf47db5a52f72c392b169aa76e8b3231008 100644 (file)
@@ -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();
 }
 
 //=======================================================================