Kaydet (Commit) cd7a2e8c authored tarafından Caolán McNamara's avatar Caolán McNamara

revert drop of SetBufferSize

reported spike in load time, so still necessary I guess

Change-Id: I38c139b85ed922af18674ac84263150407a3277f
Reviewed-on: https://gerrit.libreoffice.org/44231Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 91dcc2de
...@@ -121,6 +121,8 @@ ErrCode ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument* ...@@ -121,6 +121,8 @@ ErrCode ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument*
ErrCode eRet = SCERR_IMPORT_UNKNOWN_BIFF; ErrCode eRet = SCERR_IMPORT_UNKNOWN_BIFF;
if( pBookStrm ) if( pBookStrm )
{ {
pBookStrm->SetBufferSize( 0x8000 ); // still needed?
XclImpRootData aImpData( eBiff, rMedium, xRootStrg, *pDocument, RTL_TEXTENCODING_MS_1252 ); XclImpRootData aImpData( eBiff, rMedium, xRootStrg, *pDocument, RTL_TEXTENCODING_MS_1252 );
std::unique_ptr< ImportExcel > xFilter; std::unique_ptr< ImportExcel > xFilter;
switch( eBiff ) switch( eBiff )
...@@ -167,8 +169,9 @@ static ErrCode lcl_ExportExcelBiff( SfxMedium& rMedium, ScDocument *pDocument, ...@@ -167,8 +169,9 @@ static ErrCode lcl_ExportExcelBiff( SfxMedium& rMedium, ScDocument *pDocument,
// open the "Book"/"Workbook" stream // open the "Book"/"Workbook" stream
tools::SvRef<SotStorageStream> xStrgStrm = ScfTools::OpenStorageStreamWrite( xRootStrg, aStrmName ); tools::SvRef<SotStorageStream> xStrgStrm = ScfTools::OpenStorageStreamWrite( xRootStrg, aStrmName );
if (!xStrgStrm.is() || xStrgStrm->GetError()) if( !xStrgStrm.is() || xStrgStrm->GetError() ) return SCERR_IMPORT_OPEN;
return SCERR_IMPORT_OPEN;
xStrgStrm->SetBufferSize( 0x8000 ); // still needed?
ErrCode eRet = SCERR_IMPORT_UNKNOWN_BIFF; ErrCode eRet = SCERR_IMPORT_UNKNOWN_BIFF;
XclExpRootData aExpData( bBiff8 ? EXC_BIFF8 : EXC_BIFF5, rMedium, xRootStrg, *pDocument, eNach ); XclExpRootData aExpData( bBiff8 ? EXC_BIFF8 : EXC_BIFF5, rMedium, xRootStrg, *pDocument, eNach );
......
...@@ -6277,18 +6277,30 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportWW2(SvStream &rStream) ...@@ -6277,18 +6277,30 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportWW2(SvStream &rStream)
return TestImportDOC(rStream, "WW6"); return TestImportDOC(rStream, "WW6");
} }
ErrCode WW8Reader::OpenMainStream(tools::SvRef<SotStorageStream>& rRef) ErrCode WW8Reader::OpenMainStream( tools::SvRef<SotStorageStream>& rRef, sal_uInt16& rBuffSize )
{ {
ErrCode nRet = ERR_SWG_READ_ERROR; ErrCode nRet = ERR_SWG_READ_ERROR;
OSL_ENSURE( pStg.get(), "Where is my Storage?" ); OSL_ENSURE( pStg.get(), "Where is my Storage?" );
rRef = pStg->OpenSotStream( "WordDocument", StreamMode::READ | StreamMode::SHARE_DENYALL); rRef = pStg->OpenSotStream( "WordDocument", StreamMode::READ | StreamMode::SHARE_DENYALL);
if (rRef.is())
nRet = rRef->GetError(); if( rRef.is() )
{
if( ERRCODE_NONE == rRef->GetError() )
{
sal_uInt16 nOld = rRef->GetBufferSize();
rRef->SetBufferSize( rBuffSize );
rBuffSize = nOld;
nRet = ERRCODE_NONE;
}
else
nRet = rRef->GetError();
}
return nRet; return nRet;
} }
ErrCode WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, const OUString & /* FileName */) ErrCode WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, const OUString & /* FileName */)
{ {
sal_uInt16 nOldBuffSize = 32768;
bool bNew = !bInsertMode; // New Doc (no inserting) bool bNew = !bInsertMode; // New Doc (no inserting)
tools::SvRef<SotStorageStream> refStrm; // So that no one else can steal the Stream tools::SvRef<SotStorageStream> refStrm; // So that no one else can steal the Stream
...@@ -6317,7 +6329,7 @@ ErrCode WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, cons ...@@ -6317,7 +6329,7 @@ ErrCode WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, cons
if( pStg.is() ) if( pStg.is() )
{ {
nRet = OpenMainStream(refStrm); nRet = OpenMainStream( refStrm, nOldBuffSize );
pIn = refStrm.get(); pIn = refStrm.get();
} }
else else
...@@ -6351,6 +6363,7 @@ ErrCode WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, cons ...@@ -6351,6 +6363,7 @@ ErrCode WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, cons
if( refStrm.is() ) if( refStrm.is() )
{ {
refStrm->SetBufferSize( nOldBuffSize );
refStrm.clear(); refStrm.clear();
} }
else else
...@@ -6378,8 +6391,9 @@ bool WW8Reader::ReadGlossaries(SwTextBlocks& rBlocks, bool bSaveRelFiles) const ...@@ -6378,8 +6391,9 @@ bool WW8Reader::ReadGlossaries(SwTextBlocks& rBlocks, bool bSaveRelFiles) const
WW8Reader *pThis = const_cast<WW8Reader *>(this); WW8Reader *pThis = const_cast<WW8Reader *>(this);
sal_uInt16 nOldBuffSize = 32768;
tools::SvRef<SotStorageStream> refStrm; tools::SvRef<SotStorageStream> refStrm;
if (!pThis->OpenMainStream(refStrm)) if (!pThis->OpenMainStream(refStrm, nOldBuffSize))
{ {
WW8Glossary aGloss( refStrm, 8, pStg.get() ); WW8Glossary aGloss( refStrm, 8, pStg.get() );
bRet = aGloss.Load( rBlocks, bSaveRelFiles ); bRet = aGloss.Load( rBlocks, bSaveRelFiles );
......
...@@ -131,7 +131,7 @@ struct WW8LFOInfo; ...@@ -131,7 +131,7 @@ struct WW8LFOInfo;
class WW8Reader : public StgReader class WW8Reader : public StgReader
{ {
virtual ErrCode Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; virtual ErrCode Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override;
ErrCode OpenMainStream(tools::SvRef<SotStorageStream>& rRef); ErrCode OpenMainStream( tools::SvRef<SotStorageStream>& rRef, sal_uInt16& rBuffSize );
public: public:
virtual int GetReaderType() override; virtual int GetReaderType() override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment