summaryrefslogtreecommitdiff
path: root/sot/source
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2000-10-16 13:11:51 +0000
committerMathias Bauer <mba@openoffice.org>2000-10-16 13:11:51 +0000
commitcd2790c9d1a7b065e286e7fafb110a50fb7067d0 (patch)
tree68c9051838b0ac7dd9b86938f5e2c3a4f02ca25a /sot/source
parent85a28d00993da7000273d6282b59189c4ddc1d49 (diff)
IsStorageFile without downloading whole file
Diffstat (limited to 'sot/source')
-rw-r--r--sot/source/sdstor/stg.cxx10
-rw-r--r--sot/source/sdstor/stgelem.cxx12
-rw-r--r--sot/source/sdstor/stgelem.hxx5
-rw-r--r--sot/source/sdstor/storage.cxx8
4 files changed, 26 insertions, 9 deletions
diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index 2048f4e14c53..ca0d18d0dcd3 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: stg.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: mm $ $Date: 2000-10-12 16:18:50 $
+ * last change: $Author: mba $ $Date: 2000-10-16 14:08:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -332,6 +332,12 @@ BOOL Storage::IsStorageFile( const String & rFileName )
return FALSE;
}
+BOOL Storage::IsStorageFile( SvStream* pStream )
+{
+ StgHeader aHdr;
+ return ( pStream && aHdr.Load( *pStream ) && aHdr.Check() );
+}
+
// Open the storage file. If writing is permitted and the file is not
// a storage file, initialize it.
diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index ef568aca861f..4a43cb207147 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: stgelem.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-10-16 14:08:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -133,6 +133,12 @@ void StgHeader::Init()
BOOL StgHeader::Load( StgIo& rIo )
{
SvStream& r = *rIo.GetStrm();
+ Load( r );
+ return rIo.Good();
+}
+
+BOOL StgHeader::Load( SvStream& r )
+{
r.Seek( 0L );
r.Read( cSignature, 8 );
r >> aClsId // 08 Class ID
@@ -151,7 +157,7 @@ BOOL StgHeader::Load( StgIo& rIo )
>> nMaster; // 48 # of additional master blocks
for( short i = 0; i < 109; i++ )
r >> nMasterFAT[ i ];
- return rIo.Good();
+ return r.GetErrorCode() == ERRCODE_NONE;
}
BOOL StgHeader::Store( StgIo& rIo )
diff --git a/sot/source/sdstor/stgelem.hxx b/sot/source/sdstor/stgelem.hxx
index 8273eb35b991..47e3e2dde270 100644
--- a/sot/source/sdstor/stgelem.hxx
+++ b/sot/source/sdstor/stgelem.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: stgelem.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-10-16 14:08:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -106,6 +106,7 @@ public:
StgHeader();
void Init(); // initialize the header
BOOL Load( StgIo& );
+ BOOL Load( SvStream& );
BOOL Store( StgIo& );
BOOL Check(); // check the signature and version
short GetByteOrder() const { return nByteOrder; }
diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx
index 207d3a5fb103..1fb542a78628 100644
--- a/sot/source/sdstor/storage.cxx
+++ b/sot/source/sdstor/storage.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: storage.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: mm $ $Date: 2000-10-12 16:18:51 $
+ * last change: $Author: mba $ $Date: 2000-10-16 14:08:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -562,6 +562,10 @@ BOOL SotStorage::IsStorageFile( const String & rFileName )
return Storage::IsStorageFile( rFileName );
}
+BOOL SotStorage::IsStorageFile( SvStream* pStream )
+{
+ return Storage::IsStorageFile( pStream );
+}
/*************************************************************************
|* SotStorage::GetStorage()
|*