diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-01-09 14:47:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-09 18:02:08 +0100 |
commit | a3fa2c3bad77b976e7f79de5d0f2abc0283e7b3e (patch) | |
tree | 9de61ffd3c1c50e23af81f02bff9a0892b0b0026 /package | |
parent | 9754b3feb4092243f30c665abc0344b1a665b5f6 (diff) |
Simplify some TempFile service code
Change-Id: Id39be33dcc5aa9378e29c850cb71d3662093ab25
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128189
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'package')
-rw-r--r-- | package/source/xstor/owriteablestream.cxx | 9 | ||||
-rw-r--r-- | package/source/zipapi/ZipOutputEntry.cxx | 9 |
2 files changed, 8 insertions, 10 deletions
diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index b141a469ece2..720632c87d60 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -222,14 +222,13 @@ OUString GetNewTempFileURL( const uno::Reference< uno::XComponentContext >& rCon { OUString aTempURL; - uno::Reference < beans::XPropertySet > xTempFile( + uno::Reference < io::XTempFile > xTempFile( io::TempFile::create(rContext), - uno::UNO_QUERY_THROW ); + uno::UNO_SET_THROW ); try { - xTempFile->setPropertyValue( "RemoveFile", uno::makeAny( false ) ); - uno::Any aUrl = xTempFile->getPropertyValue( "Uri" ); - aUrl >>= aTempURL; + xTempFile->setRemoveFile( false ); + aTempURL = xTempFile->getUri(); } catch ( const uno::Exception& ) { diff --git a/package/source/zipapi/ZipOutputEntry.cxx b/package/source/zipapi/ZipOutputEntry.cxx index 5115c7a3ebc1..a30eba7c981c 100644 --- a/package/source/zipapi/ZipOutputEntry.cxx +++ b/package/source/zipapi/ZipOutputEntry.cxx @@ -252,12 +252,11 @@ void ZipOutputEntryInThread::createBufferFile() { assert(!m_xOutStream.is() && m_aTempURL.isEmpty() && "should only be called in the threaded mode where there is no existing stream yet"); - uno::Reference < beans::XPropertySet > xTempFileProps( + uno::Reference < io::XTempFile > xTempFile( io::TempFile::create(m_xContext), - uno::UNO_QUERY_THROW ); - xTempFileProps->setPropertyValue("RemoveFile", uno::makeAny(false)); - uno::Any aUrl = xTempFileProps->getPropertyValue( "Uri" ); - aUrl >>= m_aTempURL; + uno::UNO_SET_THROW ); + xTempFile->setRemoveFile(false); + m_aTempURL = xTempFile->getUri(); assert(!m_aTempURL.isEmpty()); uno::Reference < ucb::XSimpleFileAccess3 > xTempAccess(ucb::SimpleFileAccess::create(m_xContext)); |