diff options
-rw-r--r-- | connectivity/source/drivers/dbase/DTable.cxx | 4 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltertestdialog.cxx | 6 | ||||
-rw-r--r-- | framework/source/services/autorecovery.cxx | 5 | ||||
-rw-r--r-- | include/sfx2/docfile.hxx | 2 | ||||
-rw-r--r-- | include/unotools/tempfile.hxx | 6 | ||||
-rw-r--r-- | reportdesign/source/core/api/ReportEngineJFree.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 3 | ||||
-rw-r--r-- | sd/qa/unit/HtmlExportTest.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/appl/sfxhelp.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/doc/graphhelp.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/doc/docglbl.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/dbui/addresslistdialog.cxx | 3 | ||||
-rw-r--r-- | sw/source/ui/dbui/mmlayoutpage.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/dbui/dbmgr.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/misc/glosdoc.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/uno/unomailmerge.cxx | 2 | ||||
-rw-r--r-- | unotools/source/ucbhelper/tempfile.cxx | 10 | ||||
-rw-r--r-- | vcl/qa/cppunit/png/PngFilterTest.cxx | 3 |
19 files changed, 37 insertions, 51 deletions
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 3f6441753e52..e19abc6ed1f3 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -2477,10 +2477,8 @@ OUString ODbaseTable::createTempFile() if ( aIdent.lastIndexOf('/') != (aIdent.getLength()-1) ) aIdent += "/"; - OUString sTempName(aIdent); OUString sExt("." + m_pConnection->getExtension()); - OUString sName(m_Name); - TempFile aTempFile(sName, true, &sExt, &sTempName); + TempFile aTempFile(m_Name, true, sExt, &aIdent); if(!aTempFile.IsValid()) getConnection()->throwGenericSQLException(STR_COULD_NOT_ALTER_TABLE, *this); diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx index 78b913684d7f..1923243834f7 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx @@ -418,8 +418,7 @@ void XMLFilterTestDialog::doExport( const Reference< XComponent >& xComp ) Reference< XStorable > xStorable( xComp, UNO_QUERY ); if( xStorable.is() ) { - OUString const ext(".xml"); - utl::TempFile aTempFile(u"", true, &ext); + utl::TempFile aTempFile(u"", true, u".xml"); OUString aTempFileURL( aTempFile.GetURL() ); const application_info_impl* pAppInfo = getApplicationInfo( m_xFilterInfo->maExportService ); @@ -578,8 +577,7 @@ void XMLFilterTestDialog::import( const OUString& rURL ) if( m_xCBXDisplaySource->get_active() ) { - OUString const ext(".xml"); - TempFile aTempFile(u"", true, &ext); + TempFile aTempFile(u"", true, u".xml"); OUString aTempFileURL( aTempFile.GetURL() ); Reference< XImportFilter > xImporter( mxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.documentconversion.XSLTFilter", mxContext ), UNO_QUERY ); diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 3ecc95ced885..a17e9464e715 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -3485,10 +3485,7 @@ void AutoRecovery::implts_generateNewTempURL(const OUString& sBack // TODO: Must we strip some illegal signs - if we use the title? - OUString sName(sUniqueName.makeStringAndClear()); - OUString sExtension(rInfo.Extension); - OUString sPath(sBackupPath); - ::utl::TempFile aTempFile(sName, true, &sExtension, &sPath, true); + ::utl::TempFile aTempFile(sUniqueName, true, rInfo.Extension, &sBackupPath, true); rInfo.NewTempURL = aTempFile.GetURL(); } diff --git a/include/sfx2/docfile.hxx b/include/sfx2/docfile.hxx index bc6e0cf1e02c..ff3ea024e19b 100644 --- a/include/sfx2/docfile.hxx +++ b/include/sfx2/docfile.hxx @@ -252,7 +252,7 @@ public: SAL_DLLPRIVATE void DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalContent ); SAL_DLLPRIVATE void DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalContent, std::u16string_view aPrefix, - const OUString& aExtension, + std::u16string_view aExtension, const OUString& aDestDir ); SAL_DLLPRIVATE bool UseBackupToRestore_Impl( ::ucbhelper::Content& aOriginalContent, diff --git a/include/unotools/tempfile.hxx b/include/unotools/tempfile.hxx index b7f691abb1cd..bb44b2bf46a1 100644 --- a/include/unotools/tempfile.hxx +++ b/include/unotools/tempfile.hxx @@ -58,7 +58,7 @@ public: The temporary object is created in the local file system, even if there is no UCB that can access it. If the given folder is part of the local file system, the TempFile is created in this folder. */ - TempFile( const OUString* pParent=nullptr, bool bDirectory=false ); + TempFile( const OUString* pParent = nullptr, bool bDirectory=false ); /** Same as above; additionally the name starts with some given characters followed by a counter ( example: @@ -68,8 +68,8 @@ public: @param bCreateParentDirs If rLeadingChars contains a slash, this will create the required parent directories. */ - TempFile( std::u16string_view rLeadingChars, bool _bStartWithZero=true, const OUString* pExtension=nullptr, - const OUString* pParent=nullptr, bool bCreateParentDirs=false ); + TempFile( std::u16string_view rLeadingChars, bool _bStartWithZero=true, std::u16string_view pExtension={}, + const OUString* pParent = nullptr, bool bCreateParentDirs=false ); TempFile(TempFile && other) noexcept; diff --git a/reportdesign/source/core/api/ReportEngineJFree.cxx b/reportdesign/source/core/api/ReportEngineJFree.cxx index 30a51d7b9a25..5b290b6d4639 100644 --- a/reportdesign/source/core/api/ReportEngineJFree.cxx +++ b/reportdesign/source/core/api/ReportEngineJFree.cxx @@ -172,11 +172,11 @@ OUString OReportEngineJFree::getNewOutputName() if ( sName.isEmpty() ) sName = m_xReport->getName(); { - ::utl::TempFile aTestFile(sName, false, &sExt); + ::utl::TempFile aTestFile(sName, false, sExt); if ( !aTestFile.IsValid() ) { sName = RptResId(RID_STR_REPORT); - ::utl::TempFile aFile(sName, false, &sExt); + ::utl::TempFile aFile(sName, false, sExt); sFileURL = aFile.GetURL(); } else diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index c2795c70673b..ee240c5c3663 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -3444,8 +3444,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportDBF(SvStream &rStream) aTmpDir.EnableKillingFile(); OUString sTmpDir = aTmpDir.GetURL(); - OUString sExtension(".dbf"); - utl::TempFile aTempInput(u"", true, &sExtension, &sTmpDir); + utl::TempFile aTempInput(u"", true, u".dbf", &sTmpDir); aTempInput.EnableKillingFile(); SvStream* pInputStream = aTempInput.GetStream(StreamMode::WRITE); diff --git a/sd/qa/unit/HtmlExportTest.cxx b/sd/qa/unit/HtmlExportTest.cxx index c409dc12f468..1390b267de7f 100644 --- a/sd/qa/unit/HtmlExportTest.cxx +++ b/sd/qa/unit/HtmlExportTest.cxx @@ -21,7 +21,7 @@ private: { FileFormat* pFormat = getFormat(HTML); OUString aExt = "." + OUString::createFromAscii(pFormat->pName); - utl::TempFile aTempFile(u"", true, &aExt); + utl::TempFile aTempFile(u"", true, aExt); aTempFile.EnableKillingFile(); exportTo(xDocShRef.get(), pFormat, aTempFile); return parseHtml(aTempFile); diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 4a2f493279c1..01641418de9f 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -961,7 +961,7 @@ static bool impl_showOfflineHelp(const OUString& rURL, weld::Widget* pDialogPare if (flatpak::isFlatpak() && !flatpak::createTemporaryHtmlDirectory(&parent)) { return false; } - ::utl::TempFile aTempFile(u"NewHelp", true, &aExtension, parent, false ); + ::utl::TempFile aTempFile(u"NewHelp", true, aExtension, parent, false ); SvStream* pStream = aTempFile.GetStream(StreamMode::WRITE); pStream->SetStreamCharSet(RTL_TEXTENCODING_UTF8); diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index a4712e022a4d..826e77f2533a 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2513,13 +2513,13 @@ void SfxMedium::Transfer_Impl() void SfxMedium::DoInternalBackup_Impl( const ::ucbhelper::Content& aOriginalContent, std::u16string_view aPrefix, - const OUString& aExtension, + std::u16string_view aExtension, const OUString& aDestDir ) { if ( !pImpl->m_aBackupURL.isEmpty() ) return; // the backup was done already - ::utl::TempFile aTransactTemp( aPrefix, true, &aExtension, &aDestDir ); + ::utl::TempFile aTransactTemp( aPrefix, true, aExtension, &aDestDir ); INetURLObject aBackObj( aTransactTemp.GetURL() ); OUString aBackupName = aBackObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset ); @@ -4270,9 +4270,9 @@ OUString SfxMedium::CreateTempCopyWithExt( std::u16string_view aURL ) if ( !aURL.empty() ) { size_t nPrefixLen = aURL.rfind( '.' ); - OUString aExt = ( nPrefixLen == std::u16string_view::npos ) ? OUString() : OUString(aURL.substr( nPrefixLen )); + std::u16string_view aExt = ( nPrefixLen == std::u16string_view::npos ) ? std::u16string_view() : aURL.substr( nPrefixLen ); - OUString aNewTempFileURL = ::utl::TempFile( u"", true, &aExt ).GetURL(); + OUString aNewTempFileURL = ::utl::TempFile( u"", true, aExt ).GetURL(); if ( !aNewTempFileURL.isEmpty() ) { INetURLObject aSource( aURL ); @@ -4342,10 +4342,10 @@ OUString SfxMedium::SwitchDocumentToTempFile() if ( !aOrigURL.isEmpty() ) { sal_Int32 nPrefixLen = aOrigURL.lastIndexOf( '.' ); - OUString const aExt = (nPrefixLen == -1) - ? OUString() - : aOrigURL.copy(nPrefixLen); - OUString aNewURL = ::utl::TempFile( u"", true, &aExt ).GetURL(); + std::u16string_view aExt = (nPrefixLen == -1) + ? std::u16string_view() + : aOrigURL.subView(nPrefixLen); + OUString aNewURL = ::utl::TempFile( u"", true, aExt ).GetURL(); // TODO/LATER: In future the aLogicName should be set to shared folder URL // and a temporary file should be created. Transport_Impl should be impossible then. diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx index 136e3ac9a113..84da6209172a 100644 --- a/sfx2/source/doc/graphhelp.cxx +++ b/sfx2/source/doc/graphhelp.cxx @@ -77,8 +77,7 @@ void* GraphicHelper::getEnhMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta ) #ifdef _WIN32 if ( pGDIMeta ) { - OUString const aStr(".emf"); - ::utl::TempFile aTempFile( u"", true, &aStr ); + ::utl::TempFile aTempFile( u"", true, u".emf" ); OUString aMetaFile = aTempFile.GetFileName(); OUString aMetaURL = aTempFile.GetURL(); diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index ca71fa98c707..ea0fd1453aef 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -240,7 +240,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, OUString sLeading(aEntry.GetBase()); aEntry.removeSegment(); OUString sPath = aEntry.GetMainURL( INetURLObject::DecodeMechanism::NONE ); - utl::TempFile aTemp(sLeading, true, &sExt, &sPath); + utl::TempFile aTemp(sLeading, true, sExt, &sPath); aTemp.EnableKillingFile(); DateTime aTmplDate( DateTime::SYSTEM ); @@ -315,7 +315,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, pDoc->GetNodes().GetEndOfContent().GetIndex() ) pDoc->GetNodes().Delete( aIdx ); - utl::TempFile aTempFile2(sLeading, true, &sExt, &sPath); + utl::TempFile aTempFile2(sLeading, true, sExt, &sPath); sFileName = aTempFile2.GetURL(); SfxMedium* pTmpMed = new SfxMedium( sFileName, StreamMode::STD_READWRITE ); diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index d0030c358c0f..947955516c22 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -367,11 +367,10 @@ IMPL_LINK_NOARG(SwAddressListDialog, CreateHdl_Impl, weld::Button&, void) uno::Reference<sdb::XDocumentDataSource> xDS(xNewInstance, UNO_QUERY_THROW); uno::Reference<frame::XStorable> xStore(xDS->getDatabaseDocument(), UNO_QUERY_THROW); - OUString const sExt(".odb"); OUString sTmpName; { OUString sHomePath(SvtPathOptions().GetWorkPath()); - utl::TempFile aTempFile(sFind, true, &sExt, &sHomePath); + utl::TempFile aTempFile(sFind, true, u".odb", &sHomePath); aTempFile.EnableKillingFile(); sTmpName = aTempFile.GetURL(); } diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx index 86d705b2bac6..10845d1aa67a 100644 --- a/sw/source/ui/dbui/mmlayoutpage.cxx +++ b/sw/source/ui/dbui/mmlayoutpage.cxx @@ -95,7 +95,7 @@ SwMailMergeLayoutPage::SwMailMergeLayoutPage(weld::Container* pPage, SwMailMerge //creating with extension is not supported by a static method :-( OUString const sExt( comphelper::string::stripStart(pSfxFlt->GetDefaultExtension(),'*')); - utl::TempFile aTempFile( u"", true, &sExt ); + utl::TempFile aTempFile( u"", true, sExt ); m_sExampleURL = aTempFile.GetURL(); aTempFile.EnableKillingFile(); } diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 2cef62c22f05..ac6aa2df1e6b 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -786,12 +786,11 @@ static void lcl_SaveDebugDoc( SfxObjectShell *xTargetDocShell, if( sTempDirURL.isEmpty() ) return; - const OUString sExt( ".odt" ); OUString basename = OUString::createFromAscii( name ); if (no > 0) basename += OUString::number(no) + "-"; // aTempFile is not deleted, but that seems to be intentional - utl::TempFile aTempFile( basename, true, &sExt, &sTempDirURL ); + utl::TempFile aTempFile( basename, true, u".odt", &sTempDirURL ); INetURLObject aTempFileURL( aTempFile.GetURL() ); auto pDstMed = std::make_unique<SfxMedium>( aTempFileURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), @@ -1324,7 +1323,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, } OUString sExt(comphelper::string::stripStart(pStoreToFilter->GetDefaultExtension(), '*')); - aTempFile.reset( new utl::TempFile(sLeading, sColumnData.isEmpty(), &sExt, &sPrefix, true) ); + aTempFile.reset( new utl::TempFile(sLeading, sColumnData.isEmpty(), sExt, &sPrefix, true) ); if( !aTempFile->IsValid() ) { ErrorHandler::HandleError( ERRCODE_IO_NOTSUPPORTED ); @@ -2743,9 +2742,8 @@ OUString LoadAndRegisterDataSource_Impl(DBConnURIType type, const uno::Reference if (aOwnURL.isEmpty()) { // Cannot embed, as embedded data source would need the URL of the parent document. - OUString const sOutputExt = ".odb"; OUString sHomePath(SvtPathOptions().GetWorkPath()); - utl::TempFile aTempFile(sNewName, true, &sOutputExt, pDestDir ? pDestDir : &sHomePath); + utl::TempFile aTempFile(sNewName, true, u".odb", pDestDir ? pDestDir : &sHomePath); const OUString& sTmpName = aTempFile.GetURL(); xStore->storeAsURL(sTmpName, uno::Sequence<beans::PropertyValue>()); } diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx index 28f080af3e1b..5e187e0431dc 100644 --- a/sw/source/uibase/misc/glosdoc.cxx +++ b/sw/source/uibase/misc/glosdoc.cxx @@ -77,9 +77,8 @@ OUString lcl_CheckFileName( const OUString& rNewFilePath, return sRet; } - OUString rSG = SwGlossaries::GetExtension(); //generate generic name - utl::TempFile aTemp(u"group", true, &rSG, &rNewFilePath); + utl::TempFile aTemp(u"group", true, SwGlossaries::GetExtension(), &rNewFilePath); aTemp.EnableKillingFile(); INetURLObject aTempURL( aTemp.GetURL() ); diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx index 7ce046980111..e5875417e778 100644 --- a/sw/source/uibase/uno/unomailmerge.cxx +++ b/sw/source/uibase/uno/unomailmerge.cxx @@ -767,7 +767,7 @@ uno::Any SAL_CALL SwXMailMerge::execute( FILTER_XML, SwDocShell::Factory().GetFilterContainer() ); OUString aExtension(comphelper::string::stripStart(pSfxFlt->GetDefaultExtension(), '*')); - utl::TempFile aTempFile( u"SwMM", true, &aExtension ); + utl::TempFile aTempFile( u"SwMM", true, aExtension ); m_aTmpFileName = aTempFile.GetURL(); Reference< XStorable > xStorable( xCurModel, UNO_QUERY ); diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx index faca685d2676..5ec8df4a3263 100644 --- a/unotools/source/ucbhelper/tempfile.cxx +++ b/unotools/source/ucbhelper/tempfile.cxx @@ -246,7 +246,7 @@ namespace }; static OUString lcl_createName( - std::u16string_view rLeadingChars, Tokens & tokens, const OUString* pExtension, + std::u16string_view rLeadingChars, Tokens & tokens, std::u16string_view pExtension, const OUString* pParent, bool bDirectory, bool bKeep, bool bLock, bool bCreateParentDirs ) { @@ -270,8 +270,8 @@ static OUString lcl_createName( while (tokens.next(&token)) { OUString aTmp( aName + token ); - if ( pExtension ) - aTmp += *pExtension; + if ( !pExtension.empty() ) + aTmp += pExtension; else aTmp += ".tmp"; if ( bDirectory ) @@ -342,7 +342,7 @@ static OUString CreateTempName_Impl( const OUString* pParent, bool bKeep, bool b aEyeCatcher += aPidString; #endif UniqueTokens t; - return lcl_createName( aEyeCatcher, t, nullptr, pParent, bDir, bKeep, + return lcl_createName( aEyeCatcher, t, u"", pParent, bDir, bKeep, false, false); } @@ -365,7 +365,7 @@ TempFile::TempFile( const OUString* pParent, bool bDirectory ) } TempFile::TempFile( std::u16string_view rLeadingChars, bool _bStartWithZero, - const OUString* pExtension, const OUString* pParent, + std::u16string_view pExtension, const OUString* pParent, bool bCreateParentDirs ) : bIsDirectory( false ) , bKillingFileEnabled( false ) diff --git a/vcl/qa/cppunit/png/PngFilterTest.cxx b/vcl/qa/cppunit/png/PngFilterTest.cxx index 8635165ad705..a3ae29216d7e 100644 --- a/vcl/qa/cppunit/png/PngFilterTest.cxx +++ b/vcl/qa/cppunit/png/PngFilterTest.cxx @@ -1730,8 +1730,7 @@ void PngFilterTest::testMsGifInPng() aFilterProperty.Value <<= aAdditionalChunkSequence; uno::Sequence<beans::PropertyValue> aPNGParameters{ aFilterProperty }; // Export the png with the chunk - OUString ext = u".png"; - utl::TempFile aTempFile(u"testPngExportMsGif", true, &ext); + utl::TempFile aTempFile(u"testPngExportMsGif", true, u".png"); if (!bKeepTemp) aTempFile.EnableKillingFile(); { |