summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammed Abdul Azeem <azeemmysore@gmail.com>2017-06-11 17:20:15 +0530
committerMichael Meeks <michael.meeks@collabora.com>2017-06-12 13:07:17 +0200
commit7260bb7160fe58ac63b6b5dd9a322805b1eacab4 (patch)
tree2d84736890bc7dd84d21419435f4a613de2243c0
parentfebbad7263ea25b76f4e53d2f136693a52207a1c (diff)
Setting Buffered(threaded)Stream as default:
Also cleaning up bUseBufferedStream parameter. Change-Id: Ibf9c9fcefbdcd229ffaa1d3b169ff87f00e91ceb Reviewed-on: https://gerrit.libreoffice.org/38661 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r--comphelper/source/misc/storagehelper.cxx20
-rw-r--r--include/comphelper/storagehelper.hxx6
-rw-r--r--oox/source/helper/zipstorage.cxx4
-rw-r--r--package/inc/ZipFile.hxx3
-rw-r--r--package/qa/cppunit/test_package.cxx4
-rw-r--r--package/source/xstor/xfactory.cxx3
-rw-r--r--package/source/xstor/xstorage.cxx3
-rw-r--r--package/source/zipapi/XUnbufferedStream.cxx3
-rw-r--r--package/source/zipapi/ZipFile.cxx10
-rw-r--r--package/source/zippackage/ZipPackage.cxx6
-rw-r--r--package/source/zippackage/zipfileaccess.cxx6
11 files changed, 11 insertions, 57 deletions
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx
index 4aec70aebb83..91374b1712a8 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -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;
diff --git a/include/comphelper/storagehelper.hxx b/include/comphelper/storagehelper.hxx
index d852cb718f58..18b12178eb29 100644
--- a/include/comphelper/storagehelper.hxx
+++ b/include/comphelper/storagehelper.hxx
@@ -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(
diff --git a/oox/source/helper/zipstorage.cxx b/oox/source/helper/zipstorage.cxx
index c0d454d14e19..b4b883c2c471 100644
--- a/oox/source/helper/zipstorage.cxx
+++ b/oox/source/helper/zipstorage.cxx
@@ -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)
{
diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx
index 4aafaad77e6a..0362011e62d3 100644
--- a/package/inc/ZipFile.hxx
+++ b/package/inc/ZipFile.hxx
@@ -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,
diff --git a/package/qa/cppunit/test_package.cxx b/package/qa/cppunit/test_package.cxx
index d4d533f67002..04e6b0643e96 100644
--- a/package/qa/cppunit/test_package.cxx
+++ b/package/qa/cppunit/test_package.cxx
@@ -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;
diff --git a/package/source/xstor/xfactory.cxx b/package/source/xstor/xfactory.cxx
index bf73ca7525b4..24dcc03e5cb3 100644
--- a/package/source/xstor/xfactory.cxx
+++ b/package/source/xstor/xfactory.cxx
@@ -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;
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index db5ddcd8ba5a..58f30b9d29cf 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -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 );
diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx
index a7465e397e24..bc905ddd64c6 100644
--- a/package/source/zipapi/XUnbufferedStream.cxx
+++ b/package/source/zipapi/XUnbufferedStream.cxx
@@ -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( )
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index ddea09b3d824..8bb4a06764ff 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -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;
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index 61faad5600c1..f0837489bcc3 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -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 )
diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx
index 7517e772caf2..5c8938cbefe6 100644
--- a/package/source/zippackage/zipfileaccess.cxx
+++ b/package/source/zippackage/zipfileaccess.cxx
@@ -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