Related: fdo#47644 compound storage backend is poor at knowing stream size
Change-Id: Ie4aa6939f9f37e04fda5425a6e28c5d846a9cb62
This commit is contained in:
@@ -94,6 +94,7 @@ public:
|
||||
virtual sal_Bool Commit() = 0;
|
||||
virtual sal_Bool Revert() = 0;
|
||||
virtual sal_Bool Equals( const BaseStorageStream& rStream ) const = 0;
|
||||
virtual sal_Size remainingSize() = 0;
|
||||
};
|
||||
|
||||
class BaseStorage : public StorageBase
|
||||
@@ -178,6 +179,7 @@ public:
|
||||
virtual sal_Bool ValidateMode( StreamMode ) const;
|
||||
const SvStream* GetSvStream() const;
|
||||
virtual sal_Bool Equals( const BaseStorageStream& rStream ) const;
|
||||
virtual sal_Size remainingSize();
|
||||
};
|
||||
|
||||
class UCBStorageStream;
|
||||
@@ -270,6 +272,7 @@ public:
|
||||
virtual sal_Bool Revert();
|
||||
virtual sal_Bool Validate( sal_Bool=sal_False ) const;
|
||||
virtual sal_Bool ValidateMode( StreamMode ) const;
|
||||
virtual sal_Size remainingSize();
|
||||
const SvStream* GetSvStream() const;
|
||||
virtual sal_Bool Equals( const BaseStorageStream& rStream ) const;
|
||||
sal_Bool SetProperty( const String& rName, const ::com::sun::star::uno::Any& rValue );
|
||||
|
@@ -95,6 +95,7 @@ public:
|
||||
sal_Bool GetProperty( const String& rName, ::com::sun::star::uno::Any& rValue );
|
||||
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
|
||||
GetXInputStream() const;
|
||||
virtual sal_Size remainingSize();
|
||||
};
|
||||
|
||||
#ifndef SOT_DECL_SOTSTORAGESTREAM_DEFINED
|
||||
|
@@ -234,6 +234,13 @@ sal_uLong StorageStream::Seek( sal_uLong n )
|
||||
return n;
|
||||
}
|
||||
|
||||
sal_Size StorageStream::remainingSize()
|
||||
{
|
||||
if( Validate() )
|
||||
return pEntry->GetSize() - Tell();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void StorageStream::Flush()
|
||||
{
|
||||
// Flushing means committing, since streams are never transacted
|
||||
|
@@ -286,6 +286,13 @@ sal_uInt32 SotStorageStream::GetSize() const
|
||||
return nSize;
|
||||
}
|
||||
|
||||
sal_Size SotStorageStream::remainingSize()
|
||||
{
|
||||
if (pOwnStm)
|
||||
return pOwnStm->remainingSize();
|
||||
return SvStream::remainingSize();
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
|* SotStorageStream::CopyTo()
|
||||
|*
|
||||
|
@@ -1554,6 +1554,11 @@ sal_Bool UCBStorageStream::GetProperty( const String& rName, ::com::sun::star::u
|
||||
return sal_False;
|
||||
}
|
||||
|
||||
sal_Size UCBStorageStream::remainingSize()
|
||||
{
|
||||
return pImp->GetSize() - Tell();
|
||||
}
|
||||
|
||||
UCBStorage::UCBStorage( SvStream& rStrm, sal_Bool bDirect )
|
||||
{
|
||||
String aURL = GetLinkedFile( rStrm );
|
||||
|
@@ -374,7 +374,7 @@ public:
|
||||
sal_Size SeekRel( sal_sSize nPos );
|
||||
sal_Size Tell() const { return nBufFilePos+nBufActualPos; }
|
||||
//length between current (Tell()) pos and end of stream
|
||||
sal_Size remainingSize();
|
||||
virtual sal_Size remainingSize();
|
||||
void Flush();
|
||||
sal_Bool IsEof() const { return bIsEof; }
|
||||
// next Tell() <= nSize
|
||||
@@ -789,6 +789,7 @@ public:
|
||||
sal_Bool IsObjectMemoryOwner() { return bOwnsData; }
|
||||
void SetResizeOffset( sal_Size nNewResize ) { nResize = nNewResize; }
|
||||
sal_Size GetResizeOffset() const { return nResize; }
|
||||
virtual sal_Size remainingSize() { return GetSize() - Tell(); }
|
||||
};
|
||||
|
||||
// --------------------
|
||||
|
@@ -1703,9 +1703,9 @@ sal_Size SvStream::Seek( sal_Size nFilePos )
|
||||
return nBufFilePos + nBufActualPos;
|
||||
}
|
||||
|
||||
//probably not as inefficient as it looks seeing as STREAM_SEEK_TO_END in the
|
||||
//Seek backends is nomally special cased feel free to make this virtual and add
|
||||
//good implementations for SvFileStream etc
|
||||
//STREAM_SEEK_TO_END in the some of the Seek backends is special cased to be
|
||||
//efficient, in others e.g. SotStorageStream it's really horribly slow, and in
|
||||
//those this should be overridden
|
||||
sal_Size SvStream::remainingSize()
|
||||
{
|
||||
sal_Size nCurr = Tell();
|
||||
|
Reference in New Issue
Block a user