summaryrefslogtreecommitdiff
path: root/idl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-11 14:49:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-11 17:44:46 +0200
commit6fc3dfd3f1b5cb13101299df42444f2ff0493846 (patch)
tree404a816727baa934e77c6e474cc57e83a7aa2754 /idl
parent8cbb08de38fc1a2f9d2ea0dfbdc2be8e8110ff73 (diff)
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'idl')
-rw-r--r--idl/source/prj/parser.cxx8
1 files changed, 4 insertions, 4 deletions
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() );
}