From 3563fca550f678a6797769cd3b5e529e95ca7e36 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 7 May 2024 13:57:38 +0200 Subject: replace createFromAscii with OUString literals in SvxPathTabPage Change-Id: I831bc78f4934c7d1c137ad70c7bb189d75237e88 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167473 Tested-by: Jenkins Reviewed-by: Noel Grandin --- cui/source/options/optpath.cxx | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'cui') diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index e81d12043ed2..6357989e5fb9 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -92,42 +92,39 @@ struct PathUserData_Impl struct Handle2CfgNameMapping_Impl { SvtPathOptions::Paths m_nHandle; - const char* m_pCfgName; + OUString m_aCfgName; }; } -Handle2CfgNameMapping_Impl const Hdl2CfgMap_Impl[] = +constexpr Handle2CfgNameMapping_Impl Hdl2CfgMap_Impl[] { - { SvtPathOptions::Paths::AutoCorrect, "AutoCorrect" }, - { SvtPathOptions::Paths::AutoText, "AutoText" }, - { SvtPathOptions::Paths::Backup, "Backup" }, - { SvtPathOptions::Paths::Gallery, "Gallery" }, - { SvtPathOptions::Paths::Graphic, "Graphic" }, - { SvtPathOptions::Paths::Temp, "Temp" }, - { SvtPathOptions::Paths::Template, "Template" }, - { SvtPathOptions::Paths::Work, "Work" }, - { SvtPathOptions::Paths::Dictionary, "Dictionary" }, - { SvtPathOptions::Paths::Classification, "Classification" }, + { SvtPathOptions::Paths::AutoCorrect, u"AutoCorrect"_ustr }, + { SvtPathOptions::Paths::AutoText, u"AutoText"_ustr }, + { SvtPathOptions::Paths::Backup, u"Backup"_ustr }, + { SvtPathOptions::Paths::Gallery, u"Gallery"_ustr }, + { SvtPathOptions::Paths::Graphic, u"Graphic"_ustr }, + { SvtPathOptions::Paths::Temp, u"Temp"_ustr }, + { SvtPathOptions::Paths::Template, u"Template"_ustr }, + { SvtPathOptions::Paths::Work, u"Work"_ustr }, + { SvtPathOptions::Paths::Dictionary, u"Dictionary"_ustr }, + { SvtPathOptions::Paths::Classification, u"Classification"_ustr }, #if OSL_DEBUG_LEVEL > 1 - { SvtPathOptions::Paths::Linguistic, "Linguistic" }, + { SvtPathOptions::Paths::Linguistic, u"Linguistic"_ustr }, #endif - { SvtPathOptions::Paths::LAST, nullptr } }; static OUString getCfgName_Impl( SvtPathOptions::Paths _nHandle ) { OUString sCfgName; - sal_uInt16 nIndex = 0; - while ( Hdl2CfgMap_Impl[ nIndex ].m_nHandle != SvtPathOptions::Paths::LAST ) + for (const auto & rMapping : Hdl2CfgMap_Impl) { - if ( Hdl2CfgMap_Impl[ nIndex ].m_nHandle == _nHandle ) + if ( rMapping.m_nHandle == _nHandle ) { // config name found - sCfgName = OUString::createFromAscii( Hdl2CfgMap_Impl[ nIndex ].m_pCfgName ); + sCfgName = rMapping.m_aCfgName; break; } - ++nIndex; } return sCfgName; -- cgit