summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2000-11-20 11:56:37 +0000
committerMathias Bauer <mba@openoffice.org>2000-11-20 11:56:37 +0000
commit9b86f6942b96f5513be53ed5b033657c5267a778 (patch)
treee48ac52a3e08b5ca4ed978ecf20bf34ac4e9fbb9
parent066f06e8cab65ff100d0986565c0884474999f1e (diff)
#80466#: new Copy method to support new JAR storages
-rw-r--r--sot/source/sdstor/stgdir.cxx29
-rw-r--r--sot/source/sdstor/stgdir.hxx6
2 files changed, 31 insertions, 4 deletions
diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx
index c5f4db205021..d71d38e4a2d3 100644
--- a/sot/source/sdstor/stgdir.cxx
+++ b/sot/source/sdstor/stgdir.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: stgdir.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+ * last change: $Author: mba $ $Date: 2000-11-20 12:56:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -519,6 +519,31 @@ void StgDirEntry::Copy( StgDirEntry& rDest )
}
}
+void StgDirEntry::Copy( BaseStorageStream& rDest )
+{
+ INT32 n = GetSize();
+ if( rDest.SetSize( n ) && n )
+ {
+ ULONG nPos = rDest.Tell();
+ void* p = new BYTE[ 4096 ];
+ Seek( 0L );
+ rDest.Seek( 0L );
+ while( n )
+ {
+ INT32 nn = n;
+ if( nn > 4096 )
+ nn = 4096;
+ if( Read( p, nn ) != nn )
+ break;
+ if( rDest.Write( p, nn ) != nn )
+ break;
+ n -= nn;
+ }
+ delete p;
+ rDest.Seek( nPos ); // ?! Seems to be undocumented !
+ }
+}
+
// Commit this entry
BOOL StgDirEntry::Commit()
diff --git a/sot/source/sdstor/stgdir.hxx b/sot/source/sdstor/stgdir.hxx
index 44b1614a590f..288f256fc227 100644
--- a/sot/source/sdstor/stgdir.hxx
+++ b/sot/source/sdstor/stgdir.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: stgdir.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:56:51 $
+ * last change: $Author: mba $ $Date: 2000-11-20 12:56:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -77,6 +77,7 @@ class StgEntry;
class StgDirEntry;
class StgDirStrm;
+class BaseStorageStream;
class StgDirEntry : public StgAvlNode
{
friend class StgIterator;
@@ -135,6 +136,7 @@ public:
INT32 Read( void*, INT32 );
INT32 Write( const void*, INT32 );
void Copy( StgDirEntry& );
+ void Copy( BaseStorageStream& );
};
class StgDirStrm : public StgDataStrm