[Libreoffice-commits] core.git: forms/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Mar 20 06:31:33 UTC 2019
forms/source/xforms/xpathlib/xpathlib.cxx | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
New commits:
commit dfb2feca54147e1939b3a38f841aad566751a479
Author: Matteo Casalin <matteo.casalin at yahoo.com>
AuthorDate: Mon Mar 4 16:44:48 2019 +0100
Commit: Matteo Casalin <matteo.casalin at yahoo.com>
CommitDate: Wed Mar 20 07:31:10 2019 +0100
Improve parseDateTime tokenization and reduce OUString copies
Change-Id: If84f455c235176d56d72bdc11d813f1ee1e3122e
Reviewed-on: https://gerrit.libreoffice.org/69241
Tested-by: Jenkins
Reviewed-by: Matteo Casalin <matteo.casalin at yahoo.com>
diff --git a/forms/source/xforms/xpathlib/xpathlib.cxx b/forms/source/xforms/xpathlib/xpathlib.cxx
index 9ff6426ec456..ac73ec7990df 100644
--- a/forms/source/xforms/xpathlib/xpathlib.cxx
+++ b/forms/source/xforms/xpathlib/xpathlib.cxx
@@ -294,20 +294,13 @@ static bool parseDateTime(const OUString& aString, DateTime& aDateTime)
if (aDateTimeString.getLength() < 19 || aDateTimeString.getLength() > 20)
return false;
- sal_Int32 nDateLength = 10;
- sal_Int32 const nTimeLength = 8;
-
- OUString aDateString = aDateTimeString.copy(0, nDateLength);
- OUString aTimeString = aDateTimeString.copy(nDateLength+1, nTimeLength);
-
sal_Int32 nIndex = 0;
- sal_Int32 nYear = aDateString.getToken(0, '-', nIndex).toInt32();
- sal_Int32 nMonth = aDateString.getToken(0, '-', nIndex).toInt32();
- sal_Int32 nDay = aDateString.getToken(0, '-', nIndex).toInt32();
- nIndex = 0;
- sal_Int32 nHour = aTimeString.getToken(0, ':', nIndex).toInt32();
- sal_Int32 nMinute = aTimeString.getToken(0, ':', nIndex).toInt32();
- sal_Int32 nSecond = aTimeString.getToken(0, ':', nIndex).toInt32();
+ sal_Int32 nYear = aDateTimeString.getToken(0, '-', nIndex).toInt32();
+ sal_Int32 nMonth = aDateTimeString.getToken(0, '-', nIndex).toInt32();
+ sal_Int32 nDay = aDateTimeString.getToken(0, 'T', nIndex).toInt32();
+ sal_Int32 nHour = aDateTimeString.getToken(0, ':', nIndex).toInt32();
+ sal_Int32 nMinute = aDateTimeString.getToken(0, ':', nIndex).toInt32();
+ sal_Int32 nSecond = aDateTimeString.getToken(0, 'Z', nIndex).toInt32();
Date tmpDate(static_cast<sal_uInt16>(nDay), static_cast<sal_uInt16>(nMonth), static_cast<sal_uInt16>(nYear));
tools::Time tmpTime(nHour, nMinute, nSecond);
More information about the Libreoffice-commits
mailing list