From 6fc3dfd3f1b5cb13101299df42444f2ff0493846 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 11 Apr 2022 14:49:08 +0200 Subject: use more string_view found by tweaking the loplugin:stringview and making it whitelist getLength Change-Id: Ic41cd4e3026d93b70a76fe1279c6de3abbe6b4a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132820 Tested-by: Jenkins Reviewed-by: Noel Grandin --- idl/source/prj/parser.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'idl') diff --git a/idl/source/prj/parser.cxx b/idl/source/prj/parser.cxx index 3e53e9d35d93..31bbee9a9d85 100644 --- a/idl/source/prj/parser.cxx +++ b/idl/source/prj/parser.cxx @@ -233,9 +233,9 @@ void SvIdlParser::ReadEnum() rBase.GetTypeList().push_back( xEnum.get() ); } -static OString getCommonSubPrefix(const OString &rA, const OString &rB) +static std::string_view getCommonSubPrefix(std::string_view rA, std::string_view rB) { - sal_Int32 nMax = std::min(rA.getLength(), rB.getLength()); + sal_Int32 nMax = std::min(rA.size(), rB.size()); sal_Int32 nI = 0; while (nI < nMax) { @@ -243,7 +243,7 @@ static OString getCommonSubPrefix(const OString &rA, const OString &rB) break; ++nI; } - return rA.copy(0, nI); + return rA.substr(0, nI); } void SvIdlParser::ReadEnumValue( SvMetaTypeEnum& rEnum ) @@ -257,7 +257,7 @@ void SvIdlParser::ReadEnumValue( SvMetaTypeEnum& rEnum ) } else { - rEnum.aPrefix = getCommonSubPrefix(rEnum.aPrefix, aEnumVal->GetName()); + rEnum.aPrefix = OString(getCommonSubPrefix(rEnum.aPrefix, aEnumVal->GetName())); } rEnum.aEnumValueList.push_back( aEnumVal.get() ); } -- cgit