diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2017-01-13 20:47:46 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2017-01-16 12:08:24 -0500 |
commit | a104cbe76eefca3cf23973da68893d2225fd718b (patch) | |
tree | d485c2c39bc0e3f347190e4c874aff0e0fe82364 /comphelper | |
parent | b88bf43749b859506a97bdab7d3b62687400f5c9 (diff) |
tdf#97597: Ensure that each parsing thread has its own buffer.
(cherry picked from commit 4ae705d02df0ddf75b97d0e94add6994626f487e)
Change-Id: I93077f954a49b3922930e4fc86c80228be0f4dd2
Reviewed-on: https://gerrit.libreoffice.org/33069
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/storagehelper.cxx | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx index bc83276a3a14..42aaade2805e 100644 --- a/comphelper/source/misc/storagehelper.cxx +++ b/comphelper/source/misc/storagehelper.cxx @@ -326,17 +326,28 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromInputStr const OUString& aFormat, const uno::Reference < io::XInputStream >& xStream, const uno::Reference< uno::XComponentContext >& rxContext, - bool bRepairStorage ) + bool bRepairStorage, bool bUseBufferedStream ) throw ( uno::Exception ) { uno::Sequence< beans::PropertyValue > aProps( 1 ); - aProps[0].Name = "StorageFormat"; - aProps[0].Value <<= aFormat; + sal_Int32 nPos = 0; + aProps[nPos].Name = "StorageFormat"; + aProps[nPos].Value <<= aFormat; + ++nPos; if ( bRepairStorage ) { - aProps.realloc( 2 ); - aProps[1].Name = "RepairPackage"; - aProps[1].Value <<= bRepairStorage; + aProps.realloc(nPos+1); + aProps[nPos].Name = "RepairPackage"; + aProps[nPos].Value <<= bRepairStorage; + ++nPos; + } + + if (bUseBufferedStream) + { + aProps.realloc(nPos+1); + aProps[nPos].Name = "UseBufferedStream"; + aProps[nPos].Value <<= bUseBufferedStream; + ++nPos; } uno::Sequence< uno::Any > aArgs( 3 ); @@ -358,17 +369,28 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageOfFormatFromStream( const uno::Reference < io::XStream >& xStream, sal_Int32 nStorageMode, const uno::Reference< uno::XComponentContext >& rxContext, - bool bRepairStorage ) + bool bRepairStorage, bool bUseBufferedStream ) throw ( uno::Exception ) { uno::Sequence< beans::PropertyValue > aProps( 1 ); - aProps[0].Name = "StorageFormat"; - aProps[0].Value <<= aFormat; + sal_Int32 nPos = 0; + aProps[nPos].Name = "StorageFormat"; + aProps[nPos].Value <<= aFormat; + ++nPos; if ( bRepairStorage ) { - aProps.realloc( 2 ); - aProps[1].Name = "RepairPackage"; - aProps[1].Value <<= bRepairStorage; + aProps.realloc(nPos+1); + aProps[nPos].Name = "RepairPackage"; + aProps[nPos].Value <<= bRepairStorage; + ++nPos; + } + + if (bUseBufferedStream) + { + aProps.realloc(nPos+1); + aProps[nPos].Name = "UseBufferedStream"; + aProps[nPos].Value <<= bUseBufferedStream; + ++nPos; } uno::Sequence< uno::Any > aArgs( 3 ); |