cppu/source/typelib/static_types.cxx | 12 ++-- cppuhelper/source/servicemanager.cxx | 17 ++--- filter/source/xsltdialog/xmlfiltercommon.hxx | 2 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 56 +++++++++---------- 4 files changed, 42 insertions(+), 45 deletions(-)
New commits: commit e8fdc8a4ff60a392f51326e90212fc73d515e270 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Wed May 1 20:07:21 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu May 2 02:51:23 2024 +0200 elide some OUString temporaries Change-Id: I8364489639c8c02e9670ee597f48d61007244f5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166973 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/cppu/source/typelib/static_types.cxx b/cppu/source/typelib/static_types.cxx index 67b63550e1cd..f91dbed71ddb 100644 --- a/cppu/source/typelib/static_types.cxx +++ b/cppu/source/typelib/static_types.cxx @@ -118,11 +118,11 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( MutexGuard aGuard( typelib_StaticInitMutex() ); if (! s_aTypes[eTypeClass]) { - static const char * s_aTypeNames[] = { - "void", "char", "boolean", "byte", - "short", "unsigned short", "long", "unsigned long", - "hyper", "unsigned hyper", "float", "double", - "string", "type", "any" }; + static constexpr OUString s_aTypeNames[] = { + u"void"_ustr, u"char"_ustr, u"boolean"_ustr, u"byte"_ustr, + u"short"_ustr, u"unsigned short"_ustr, u"long"_ustr, u"unsigned long"_ustr, + u"hyper"_ustr, u"unsigned hyper"_ustr, u"float"_ustr, u"double"_ustr, + u"string"_ustr, u"type"_ustr, u"any"_ustr }; switch (eTypeClass) { @@ -258,7 +258,7 @@ typelib_TypeDescriptionReference ** SAL_CALL typelib_static_type_getByTypeClass( } default: { - OUString aTypeName( OUString::createFromAscii( s_aTypeNames[eTypeClass] ) ); + OUString aTypeName( s_aTypeNames[eTypeClass] ); ::typelib_typedescriptionreference_new( &s_aTypes[eTypeClass], eTypeClass, aTypeName.pData ); // another static ref: ++s_aTypes[eTypeClass]->nStaticRefCount; diff --git a/cppuhelper/source/servicemanager.cxx b/cppuhelper/source/servicemanager.cxx index 790a776392c4..415d0edb0e3c 100644 --- a/cppuhelper/source/servicemanager.cxx +++ b/cppuhelper/source/servicemanager.cxx @@ -2007,21 +2007,18 @@ void cppuhelper::ServiceManager::preloadImplementations() { // Various rather important uno mappings. static struct { - const char *mpFrom; - const char *mpTo; - const char *mpPurpose; - } const aMappingLoad[] = { - { "gcc3", "uno", "" }, - { "uno", "gcc3", "" }, + OUString maFrom; + OUString maTo; + OUString maPurpose; + } constexpr aMappingLoad[] = { + { u"gcc3"_ustr, u"uno"_ustr, u""_ustr }, + { u"uno"_ustr, u"gcc3"_ustr, u""_ustr }, }; static std::vector<css::uno::Mapping> maMaps; for (auto &it : aMappingLoad) { - maMaps.push_back(css::uno::Mapping( - OUString::createFromAscii(it.mpFrom), - OUString::createFromAscii(it.mpTo), - OUString::createFromAscii(it.mpPurpose))); + maMaps.push_back(css::uno::Mapping(it.maFrom, it.maTo, it.maPurpose)); } #endif } diff --git a/filter/source/xsltdialog/xmlfiltercommon.hxx b/filter/source/xsltdialog/xmlfiltercommon.hxx index 9482fb0b2b63..34bf5a04d807 100644 --- a/filter/source/xsltdialog/xmlfiltercommon.hxx +++ b/filter/source/xsltdialog/xmlfiltercommon.hxx @@ -70,7 +70,7 @@ struct application_info_impl OUString maXMLImporter; OUString maXMLExporter; - application_info_impl(const char * pDocumentService, const OUString& rUINameRes, const char * mpXMLImporter, const char * mpXMLExporter); + application_info_impl(const OUString& rDocumentService, const OUString& rUINameRes, const OUString& rXMLImporter, const OUString& rXMLExporter); }; diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index ce06b716e20b..0248ae75c9c3 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -1111,11 +1111,11 @@ void XMLFilterSettingsDialog::initFilterList() } } -application_info_impl::application_info_impl( const char * pDocumentService, const OUString& rUINameRes, const char * mpXMLImporter, const char * mpXMLExporter ) -: maDocumentService( pDocumentService, strlen( pDocumentService ), RTL_TEXTENCODING_ASCII_US ), +application_info_impl::application_info_impl( const OUString& rDocumentService, const OUString& rUINameRes, const OUString& rXMLImporter, const OUString& rXMLExporter ) +: maDocumentService( rDocumentService ), maDocumentUIName(Translate::ExpandVariables(rUINameRes)), - maXMLImporter( mpXMLImporter, strlen( mpXMLImporter ), RTL_TEXTENCODING_ASCII_US ), - maXMLExporter( mpXMLExporter, strlen( mpXMLExporter ), RTL_TEXTENCODING_ASCII_US ) + maXMLImporter( rXMLImporter ), + maXMLExporter( rXMLExporter ) { } @@ -1123,46 +1123,46 @@ std::vector< application_info_impl > const & getApplicationInfos() { static std::vector< application_info_impl > const aInfos { - { "com.sun.star.text.TextDocument", + { u"com.sun.star.text.TextDocument"_ustr, STR_APPL_NAME_WRITER, - "com.sun.star.comp.Writer.XMLImporter", - "com.sun.star.comp.Writer.XMLExporter" }, + u"com.sun.star.comp.Writer.XMLImporter"_ustr, + u"com.sun.star.comp.Writer.XMLExporter"_ustr }, - { "com.sun.star.sheet.SpreadsheetDocument", + { u"com.sun.star.sheet.SpreadsheetDocument"_ustr, STR_APPL_NAME_CALC, - "com.sun.star.comp.Calc.XMLImporter", - "com.sun.star.comp.Calc.XMLExporter" }, + u"com.sun.star.comp.Calc.XMLImporter"_ustr, + u"com.sun.star.comp.Calc.XMLExporter"_ustr }, - { "com.sun.star.presentation.PresentationDocument", + { u"com.sun.star.presentation.PresentationDocument"_ustr, STR_APPL_NAME_IMPRESS, - "com.sun.star.comp.Impress.XMLImporter", - "com.sun.star.comp.Impress.XMLExporter" }, + u"com.sun.star.comp.Impress.XMLImporter"_ustr, + u"com.sun.star.comp.Impress.XMLExporter"_ustr }, - { "com.sun.star.drawing.DrawingDocument", + { u"com.sun.star.drawing.DrawingDocument"_ustr, STR_APPL_NAME_DRAW, - "com.sun.star.comp.Draw.XMLImporter", - "com.sun.star.comp.Draw.XMLExporter" }, + u"com.sun.star.comp.Draw.XMLImporter"_ustr, + u"com.sun.star.comp.Draw.XMLExporter"_ustr }, // --- oasis file formats... - { "com.sun.star.text.TextDocument", + { u"com.sun.star.text.TextDocument"_ustr, STR_APPL_NAME_OASIS_WRITER, - "com.sun.star.comp.Writer.XMLOasisImporter", - "com.sun.star.comp.Writer.XMLOasisExporter" }, + u"com.sun.star.comp.Writer.XMLOasisImporter"_ustr, + u"com.sun.star.comp.Writer.XMLOasisExporter"_ustr }, - { "com.sun.star.sheet.SpreadsheetDocument", + { u"com.sun.star.sheet.SpreadsheetDocument"_ustr, STR_APPL_NAME_OASIS_CALC, - "com.sun.star.comp.Calc.XMLOasisImporter", - "com.sun.star.comp.Calc.XMLOasisExporter" }, + u"com.sun.star.comp.Calc.XMLOasisImporter"_ustr, + u"com.sun.star.comp.Calc.XMLOasisExporter"_ustr }, - { "com.sun.star.presentation.PresentationDocument", + { u"com.sun.star.presentation.PresentationDocument"_ustr, STR_APPL_NAME_OASIS_IMPRESS, - "com.sun.star.comp.Impress.XMLOasisImporter", - "com.sun.star.comp.Impress.XMLOasisExporter" }, + u"com.sun.star.comp.Impress.XMLOasisImporter"_ustr, + u"com.sun.star.comp.Impress.XMLOasisExporter"_ustr }, - { "com.sun.star.drawing.DrawingDocument", + { u"com.sun.star.drawing.DrawingDocument"_ustr, STR_APPL_NAME_OASIS_DRAW, - "com.sun.star.comp.Draw.XMLOasisImporter", - "com.sun.star.comp.Draw.XMLOasisExporter" }, + u"com.sun.star.comp.Draw.XMLOasisImporter"_ustr, + u"com.sun.star.comp.Draw.XMLOasisExporter"_ustr }, }; return aInfos;