editeng/source/misc/acorrcfg.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
New commits: commit 313836d19f46d0e046d1c2b8c593727b0b0192ea Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Fri Jan 26 09:44:38 2024 +0000 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Mon Jan 29 21:23:43 2024 +0100 LanguageTag ctor can canonicalize against various known tags so can optimize skipping the _lt_tag_canonicalize path which ends up using a fairly expensive xmlXPathEval Change-Id: Ie96f16482d247f3731c1c8eac6d613736b8b289a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162596 Tested-by: Jenkins Reviewed-by: Eike Rathke <er...@redhat.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx index 616d75c69600..49e48bb48be1 100644 --- a/editeng/source/misc/acorrcfg.cxx +++ b/editeng/source/misc/acorrcfg.cxx @@ -65,13 +65,12 @@ static void scanAutoCorrectDirForLanguageTags( const OUString& rURL ) continue; const OUString aBcp47( aTitle.copy( 5, aTitle.getLength() - 9)); - OUString aCanonicalized; // Ignore invalid langtags and canonicalize for good, // allow private-use tags. - if (!LanguageTag::isValidBcp47( aBcp47, &aCanonicalized)) + const LanguageTag aLanguageTag (aBcp47, true); + if (!aLanguageTag.isValidBcp47()) continue; - const LanguageTag aLanguageTag( aCanonicalized); if (SvtLanguageTable::HasLanguageType( aLanguageTag.getLanguageType())) continue; @@ -83,7 +82,7 @@ static void scanAutoCorrectDirForLanguageTags( const OUString& rURL ) // other private-use tag (which should not fallback, // but avoid). if (aLanguageTag.getCountry().isEmpty() - && LanguageTag::isValidBcp47( aCanonicalized, nullptr, + && LanguageTag::isValidBcp47( aLanguageTag.getBcp47(), nullptr, LanguageTag::PrivateUse::DISALLOW)) { LanguageTag aFallback( aLanguageTag);