summaryrefslogtreecommitdiff
path: root/oox/source/docprop
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-07 20:54:55 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-08 13:18:41 +0200
commit36e0e88b28e818faf25b8e32cc8c4dc444b8a0be (patch)
treeb7b5c8e13b6e05f871b01a3d0bf68c1d1329ef12 /oox/source/docprop
parentcf5bbe3fce4a250ab25998053965bdc604c6114e (diff)
use more subView when converting to Int32
Change-Id: I54e3ddf79ba793fd4328bf8bda7f949b65349651 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132693 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'oox/source/docprop')
-rw-r--r--oox/source/docprop/docprophandler.cxx17
1 files changed, 9 insertions, 8 deletions
diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx
index 95043e497aea..587740f24a93 100644
--- a/oox/source/docprop/docprophandler.cxx
+++ b/oox/source/docprop/docprophandler.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/xml/sax/SAXException.hpp>
#include <cppuhelper/exc_hlp.hxx>
+#include <comphelper/string.hxx>
#include <o3tl/safeint.hxx>
#include <osl/time.h>
@@ -98,25 +99,25 @@ util::DateTime OOXMLDocPropHandler::GetDateTimeFromW3CDTF( const OUString& aChar
const sal_Int32 nLen = aChars.getLength();
if ( nLen >= 4 )
{
- aOslDTime.Year = static_cast<sal_Int16>(aChars.copy( 0, 4 ).toInt32());
+ aOslDTime.Year = static_cast<sal_Int16>(comphelper::string::toInt32(aChars.subView( 0, 4 )));
if ( nLen >= 7 && aChars[4] == '-' )
{
- aOslDTime.Month = static_cast<sal_uInt16>(aChars.copy( 5, 2 ).toInt32());
+ aOslDTime.Month = static_cast<sal_uInt16>(comphelper::string::toInt32(aChars.subView( 5, 2 )));
if ( nLen >= 10 && aChars[7] == '-' )
{
- aOslDTime.Day = static_cast<sal_uInt16>(aChars.copy( 8, 2 ).toInt32());
+ aOslDTime.Day = static_cast<sal_uInt16>(comphelper::string::toInt32(aChars.subView( 8, 2 )));
if ( nLen >= 16 && aChars[10] == 'T' && aChars[13] == ':' )
{
- aOslDTime.Hours = static_cast<sal_uInt16>(aChars.copy( 11, 2 ).toInt32());
- aOslDTime.Minutes = static_cast<sal_uInt16>(aChars.copy( 14, 2 ).toInt32());
+ aOslDTime.Hours = static_cast<sal_uInt16>(comphelper::string::toInt32(aChars.subView( 11, 2 )));
+ aOslDTime.Minutes = static_cast<sal_uInt16>(comphelper::string::toInt32(aChars.subView( 14, 2 )));
sal_Int32 nOptTime = 0;
if ( nLen >= 19 && aChars[16] == ':' )
{
- aOslDTime.Seconds = static_cast<sal_uInt16>(aChars.copy( 17, 2 ).toInt32());
+ aOslDTime.Seconds = static_cast<sal_uInt16>(comphelper::string::toInt32(aChars.subView( 17, 2 )));
nOptTime += 3;
if ( nLen >= 20 && aChars[19] == '.' )
{
@@ -162,8 +163,8 @@ util::DateTime OOXMLDocPropHandler::GetDateTimeFromW3CDTF( const OUString& aChar
if ( ( aChars[16 + nOptTime] == '+' || aChars[16 + nOptTime] == '-' )
&& aChars[16 + nOptTime + 3] == ':' )
{
- nModif = aChars.copy( 16 + nOptTime + 1, 2 ).toInt32() * 3600;
- nModif += aChars.copy( 16 + nOptTime + 4, 2 ).toInt32() * 60;
+ nModif = comphelper::string::toInt32(aChars.subView( 16 + nOptTime + 1, 2 )) * 3600;
+ nModif += comphelper::string::toInt32(aChars.subView( 16 + nOptTime + 4, 2 )) * 60;
if ( aChars[16 + nOptTime] == '-' )
nModif *= -1;
}