From b58c0531cfb1bc9d1d948f6298b30e8afe0f6f35 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 3 May 2022 16:19:37 +0200 Subject: simplify lcl_parseHandleRef Change-Id: I0a7cb2754ab43b8b627f196c99778b5fa3f2e005 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133808 Tested-by: Jenkins Reviewed-by: Noel Grandin --- oox/source/drawingml/customshapepresetdata.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'oox') diff --git a/oox/source/drawingml/customshapepresetdata.cxx b/oox/source/drawingml/customshapepresetdata.cxx index cd4efc2d4c93..4e93f4f76a06 100644 --- a/oox/source/drawingml/customshapepresetdata.cxx +++ b/oox/source/drawingml/customshapepresetdata.cxx @@ -335,13 +335,12 @@ void lcl_parseHandleRange(std::vector& rHandle, const OStr void lcl_parseHandleRef(std::vector& rHandle, const OString& rValue, const OUString& rName) { - static const char aPrefix[] = "\", Handle = (long) 0, Value = (any) { (long) "; - const sal_Int32 nCheck = SAL_N_ELEMENTS(aPrefix) - 1; + static constexpr std::string_view aPrefix = "\", Handle = (long) 0, Value = (any) { (long) "; const sal_Int32 nStart = SAL_N_ELEMENTS("Name = \"") - 1 + rName.getLength(); - if (rValue.copy(nStart, nCheck).equalsL(aPrefix, nCheck)) + if (rValue.subView(nStart, aPrefix.size()) == aPrefix) { - sal_Int32 nIndex = nStart + nCheck; + sal_Int32 nIndex = nStart + aPrefix.size(); beans::PropertyValue aPropertyValue; aPropertyValue.Name = rName; // We only expect a Value here -- cgit