diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2019-02-17 23:47:00 +0100 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2019-03-05 22:31:04 +0100 |
commit | e79377df461075815fb5d40badd81918c256c247 (patch) | |
tree | 1fcebcac7ca097ad75c4079ac2488e5c7218ed77 /oox | |
parent | c7ab0bff8df23661ee9304578bd9fcf63f4d2dd0 (diff) |
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.casalin@yahoo.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/ppt/comments.cxx | 17 |
1 files changed, 8 insertions, 9 deletions
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); |