oox/source/ppt/comments.cxx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
New commits: commit e79377df461075815fb5d40badd81918c256c247 Author: Matteo Casalin <matteo.casa...@yahoo.com> AuthorDate: Sun Feb 17 23:47:00 2019 +0100 Commit: Matteo Casalin <matteo.casa...@yahoo.com> CommitDate: Tue Mar 5 22:31:04 2019 +0100 Use indexed getToken and improve tokenization Third token (i.e. day) would span to the end of the string and conversion to int works just because it stops at first non-numeric character. Change-Id: I4f608aafadd634c312f7cfd986966f453bfca872 Reviewed-on: https://gerrit.libreoffice.org/68121 Tested-by: Jenkins Reviewed-by: Matteo Casalin <matteo.casa...@yahoo.com> diff --git a/oox/source/ppt/comments.cxx b/oox/source/ppt/comments.cxx index 468a648ea99a..d803b97a7877 100644 --- a/oox/source/ppt/comments.cxx +++ b/oox/source/ppt/comments.cxx @@ -29,16 +29,15 @@ void CommentAuthorList::setValues(const CommentAuthorList& list) } //DateTime is saved as : 2013-01-10T15:53:26.000 -void Comment::setDateTime (const OUString& _datetime) +void Comment::setDateTime (const OUString& sDateTime) { - OUString datetime = _datetime; - aDateTime.Year = datetime.getToken(0,'-').toInt32(); - aDateTime.Month = datetime.getToken(1,'-').toUInt32(); - aDateTime.Day = datetime.getToken(2,'-').toUInt32(); - datetime = datetime.getToken(1,'T'); - aDateTime.Hours = datetime.getToken(0,':').toUInt32(); - aDateTime.Minutes = datetime.getToken(1,':').toUInt32(); - double seconds = datetime.getToken(2,':').toDouble(); + sal_Int32 nIdx{ 0 }; + aDateTime.Year = sDateTime.getToken(0, '-', nIdx).toInt32(); + aDateTime.Month = sDateTime.getToken(0, '-', nIdx).toUInt32(); + aDateTime.Day = sDateTime.getToken(0, 'T', nIdx).toUInt32(); + aDateTime.Hours = sDateTime.getToken(0, ':', nIdx).toUInt32(); + aDateTime.Minutes = sDateTime.getToken(0, ':', nIdx).toUInt32(); + double seconds = sDateTime.copy(nIdx).toDouble(); aDateTime.Seconds = floor(seconds); seconds -= aDateTime.Seconds; aDateTime.NanoSeconds = ::rtl::math::round(seconds * 1000000000); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits