diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-07 10:46:26 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-08 10:26:10 +0200 |
commit | 3a88b513fd90f4793b6de7a7412fa33369542f40 (patch) | |
tree | 293467f4143a28a2a19f037f3215f4391794c854 /forms | |
parent | lok: unit test for invalid entry save (diff) | |
download | core-3a88b513fd90f4793b6de7a7412fa33369542f40.tar.gz core-3a88b513fd90f4793b6de7a7412fa33369542f40.zip |
loplugin:stringviewparam convert methods using trim
for which we add a new o3tl::trim method
Change-Id: I9d37b6264eea106aa2f3502bd24b8cccf7850938
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132658
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/xforms/xpathlib/xpathlib.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/forms/source/xforms/xpathlib/xpathlib.cxx b/forms/source/xforms/xpathlib/xpathlib.cxx index 12a955639538..ee30f710419c 100644 --- a/forms/source/xforms/xpathlib/xpathlib.cxx +++ b/forms/source/xforms/xpathlib/xpathlib.cxx @@ -21,6 +21,7 @@ #include <string.h> #include <comphelper/servicehelper.hxx> +#include <o3tl/string_view.hxx> #include <sal/types.h> #include <rtl/ustring.hxx> #include <rtl/string.hxx> @@ -284,12 +285,12 @@ void xforms_nowFunction(xmlXPathParserContextPtr ctxt, int /*nargs*/) xmlXPathReturnString(ctxt, pString); } -static bool parseDateTime(const OUString& aString, DateTime& aDateTime) +static bool parseDateTime(std::u16string_view aString, DateTime& aDateTime) { // take apart a canonical literal xsd:dateTime string //CCYY-MM-DDThh:mm:ss(Z) - OUString aDateTimeString = aString.trim(); + OUString aDateTimeString( o3tl::trim(aString) ); // check length if (aDateTimeString.getLength() < 19 || aDateTimeString.getLength() > 20) @@ -306,7 +307,7 @@ static bool parseDateTime(const OUString& aString, DateTime& aDateTime) Date tmpDate(static_cast<sal_uInt16>(nDay), static_cast<sal_uInt16>(nMonth), static_cast<sal_uInt16>(nYear)); tools::Time tmpTime(nHour, nMinute, nSecond); DateTime tmpDateTime(tmpDate, tmpTime); - if (aString.lastIndexOf('Z') < 0) + if (aString.rfind('Z') == std::u16string_view::npos) tmpDateTime.ConvertToUTC(); aDateTime = tmpDateTime; |