Kaydet (Commit) 7260bb71 authored tarafından Mohammed Abdul Azeem's avatar Mohammed Abdul Azeem Kaydeden (comit) Michael Meeks

Setting Buffered(threaded)Stream as default:

Also cleaning up bUseBufferedStream parameter.

Change-Id: Ibf9c9fcefbdcd229ffaa1d3b169ff87f00e91ceb
Reviewed-on: https://gerrit.libreoffice.org/38661Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
Tested-by: 's avatarMichael Meeks <michael.meeks@collabora.com>
üst febbad72
......@@ -286,7 +286,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromInputStr
const OUString& aFormat,
const uno::Reference < io::XInputStream >& xStream,
const uno::Reference< uno::XComponentContext >& rxContext,
bool bRepairStorage, bool bUseBufferedStream )
bool bRepairStorage )
{
uno::Sequence< beans::PropertyValue > aProps( 1 );
sal_Int32 nPos = 0;
......@@ -301,14 +301,6 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromInputStr
++nPos;
}
if (bUseBufferedStream)
{
aProps.realloc(nPos+1);
aProps[nPos].Name = "UseBufferedStream";
aProps[nPos].Value <<= bUseBufferedStream;
++nPos;
}
uno::Sequence< uno::Any > aArgs( 3 );
aArgs[0] <<= xStream;
aArgs[1] <<= embed::ElementModes::READ;
......@@ -325,7 +317,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromStream(
const uno::Reference < io::XStream >& xStream,
sal_Int32 nStorageMode,
const uno::Reference< uno::XComponentContext >& rxContext,
bool bRepairStorage, bool bUseBufferedStream )
bool bRepairStorage )
{
uno::Sequence< beans::PropertyValue > aProps( 1 );
sal_Int32 nPos = 0;
......@@ -340,14 +332,6 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromStream(
++nPos;
}
if (bUseBufferedStream)
{
aProps.realloc(nPos+1);
aProps[nPos].Name = "UseBufferedStream";
aProps[nPos].Value <<= bUseBufferedStream;
++nPos;
}
uno::Sequence< uno::Any > aArgs( 3 );
aArgs[0] <<= xStream;
aArgs[1] <<= nStorageMode;
......
......@@ -156,8 +156,7 @@ public:
const css::uno::Reference < css::io::XInputStream >& xStream,
const css::uno::Reference< css::uno::XComponentContext >& rxContext
= css::uno::Reference< css::uno::XComponentContext >(),
bool bRepairStorage = false,
bool bUseBufferedStream = false );
bool bRepairStorage = false );
/// @throws css::uno::Exception
static css::uno::Reference< css::embed::XStorage >
......@@ -167,8 +166,7 @@ public:
sal_Int32 nStorageMode = css::embed::ElementModes::READWRITE,
const css::uno::Reference< css::uno::XComponentContext >& rxContext
= css::uno::Reference< css::uno::XComponentContext >(),
bool bRepairStorage = false,
bool bUseBufferedStream = false );
bool bRepairStorage = false );
static css::uno::Sequence< css::beans::NamedValue >
CreatePackageEncryptionData(
......
......@@ -58,7 +58,7 @@ ZipStorage::ZipStorage( const Reference< XComponentContext >& rxContext, const R
implementation of relations handling.
*/
mxStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromInputStream(
ZIP_STORAGE_FORMAT_STRING, rxInStream, rxContext, false, true);
ZIP_STORAGE_FORMAT_STRING, rxInStream, rxContext, false);
}
catch (Exception const& e)
{
......@@ -76,7 +76,7 @@ ZipStorage::ZipStorage( const Reference< XComponentContext >& rxContext, const R
{
const sal_Int32 nOpenMode = ElementModes::READWRITE | ElementModes::TRUNCATE;
mxStorage = ::comphelper::OStorageHelper::GetStorageOfFormatFromStream(
OFOPXML_STORAGE_FORMAT_STRING, rxStream, nOpenMode, rxContext, true, true);
OFOPXML_STORAGE_FORMAT_STRING, rxStream, nOpenMode, rxContext, true);
}
catch (Exception const& e)
{
......
......@@ -64,7 +64,6 @@ class ZipFile
const css::uno::Reference < css::uno::XComponentContext > m_xContext;
bool bRecoveryMode;
bool mbUseBufferedStream;
// aMediaType parameter is used only for raw stream header creation
css::uno::Reference < css::io::XInputStream > createStreamForZipEntry(
......@@ -105,8 +104,6 @@ public:
EntryHash& GetEntryHash() { return aEntries; }
void setUseBufferedStream( bool b );
void setInputStream ( const css::uno::Reference < css::io::XInputStream >& xNewStream );
css::uno::Reference< css::io::XInputStream > getRawData(
ZipEntry& rEntry,
......
......@@ -53,11 +53,9 @@ namespace
BootstrapFixtureBase::setUp();
OUString aURL = m_directories.getURLFromSrc("/package/qa/cppunit/data/a2z.zip");
uno::Sequence<beans::NamedValue> aNVs(2);
uno::Sequence<beans::NamedValue> aNVs(1);
aNVs[0].Name = "URL";
aNVs[0].Value <<= aURL;
aNVs[1].Name = "UseBufferedStream";
aNVs[1].Value <<= true;
uno::Sequence<uno::Any> aArgs(1);
aArgs[0] <<= aNVs;
......
......@@ -190,8 +190,7 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr
if ( aDescr[nInd].Name == "InteractionHandler"
|| aDescr[nInd].Name == "Password"
|| aDescr[nInd].Name == "RepairPackage"
|| aDescr[nInd].Name == "StatusIndicator"
|| aDescr[nInd].Name == "UseBufferedStream" )
|| aDescr[nInd].Name == "StatusIndicator" )
{
aPropsToSet.realloc( ++nNumArgs );
aPropsToSet[nNumArgs-1].Name = aDescr[nInd].Name;
......
......@@ -431,8 +431,7 @@ void OStorage_Impl::OpenOwnPackage()
for ( sal_Int32 aInd = 0; aInd < m_xProperties.getLength(); aInd++ )
{
if ( m_xProperties[aInd].Name == "RepairPackage"
|| m_xProperties[aInd].Name == "ProgressHandler"
|| m_xProperties[aInd].Name == "UseBufferedStream" )
|| m_xProperties[aInd].Name == "ProgressHandler" )
{
beans::NamedValue aNamedValue( m_xProperties[aInd].Name,
m_xProperties[aInd].Value );
......
......@@ -309,7 +309,8 @@ void SAL_CALL XUnbufferedStream::skipBytes( sal_Int32 nBytesToSkip )
sal_Int32 SAL_CALL XUnbufferedStream::available( )
{
return static_cast < sal_Int32 > ( mnZipSize - mnMyCurrent );
//available size must include the prepended header in case of wrapped raw stream
return static_cast < sal_Int32 > ( mnZipSize + mnHeaderToRead - mnMyCurrent );
}
void SAL_CALL XUnbufferedStream::closeInput( )
......
......@@ -81,7 +81,6 @@ ZipFile::ZipFile( const rtl::Reference<SotMutexHolder>& aMutexHolder,
, xStream(xInput)
, m_xContext ( rxContext )
, bRecoveryMode( false )
, mbUseBufferedStream(false)
{
if (bInitialise)
{
......@@ -103,7 +102,6 @@ ZipFile::ZipFile( const rtl::Reference<SotMutexHolder>& aMutexHolder,
, xStream(xInput)
, m_xContext ( rxContext )
, bRecoveryMode( bForceRecovery )
, mbUseBufferedStream(false)
{
if (bInitialise)
{
......@@ -124,11 +122,6 @@ ZipFile::~ZipFile()
aEntries.clear();
}
void ZipFile::setUseBufferedStream( bool b )
{
mbUseBufferedStream = b;
}
void ZipFile::setInputStream ( const uno::Reference < XInputStream >& xNewStream )
{
::osl::MutexGuard aGuard( m_aMutexHolder->GetMutex() );
......@@ -623,9 +616,6 @@ uno::Reference< XInputStream > ZipFile::createStreamForZipEntry(
uno::Reference<io::XInputStream> xSrcStream = new XUnbufferedStream(
m_xContext, aMutexHolder, rEntry, xStream, rData, nStreamMode, bIsEncrypted, aMediaType, bRecoveryMode);
if (!mbUseBufferedStream)
return xSrcStream;
uno::Reference<io::XInputStream> xBufStream;
static const sal_Int32 nThreadingThreshold = 10000;
......
......@@ -555,7 +555,6 @@ void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments )
if ( aArguments.getLength() )
{
bool bHaveZipFile = true;
bool bUseBufferedStream = false;
for( int ind = 0; ind < aArguments.getLength(); ind++ )
{
......@@ -683,10 +682,6 @@ void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments )
aNamedValue.Value >>= m_bAllowRemoveOnInsert;
m_xRootFolder->setRemoveOnInsertMode_Impl( m_bAllowRemoveOnInsert );
}
else if (aNamedValue.Name == "UseBufferedStream")
{
aNamedValue.Value >>= bUseBufferedStream;
}
// for now the progress handler is not used, probably it will never be
// if ( aNamedValue.Name == "ProgressHandler" )
......@@ -726,7 +721,6 @@ void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments )
try
{
m_pZipFile = o3tl::make_unique<ZipFile>(m_aMutexHolder, m_xContentStream, m_xContext, true, m_bForceRecovery);
m_pZipFile->setUseBufferedStream(bUseBufferedStream);
getZipFileContents();
}
catch ( IOException & e )
......
......@@ -183,8 +183,6 @@ void SAL_CALL OZipFileAccess::initialize( const uno::Sequence< uno::Any >& aArgu
uno::Reference< io::XSeekable > xSeekable;
uno::Sequence<beans::NamedValue> aArgs;
bool bUseBufferedStream = false;
auto openInputStream = [&]()
{
::ucbhelper::Content aContent(
......@@ -222,8 +220,6 @@ void SAL_CALL OZipFileAccess::initialize( const uno::Sequence< uno::Any >& aArgu
if (rArg.Name == "URL")
rArg.Value >>= aParamURL;
else if (rArg.Name == "UseBufferedStream")
rArg.Value >>= bUseBufferedStream;
}
if (aParamURL.isEmpty())
......@@ -251,8 +247,6 @@ void SAL_CALL OZipFileAccess::initialize( const uno::Sequence< uno::Any >& aArgu
m_xContentStream,
m_xContext,
true );
m_pZipFile->setUseBufferedStream(bUseBufferedStream);
}
// XNameAccess
......
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