summaryrefslogtreecommitdiff
path: root/xmloff
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 /xmloff
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 'xmloff')
-rw-r--r--xmloff/source/chart/SchXMLChartContext.cxx5
-rw-r--r--xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx3
-rw-r--r--xmloff/source/core/xmlimp.cxx7
-rw-r--r--xmloff/source/xforms/SchemaRestrictionContext.cxx7
4 files changed, 13 insertions, 9 deletions
diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx
index 331a928feb97..b5aaf117cf45 100644
--- a/xmloff/source/chart/SchXMLChartContext.cxx
+++ b/xmloff/source/chart/SchXMLChartContext.cxx
@@ -57,6 +57,7 @@
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <comphelper/string.hxx>
using namespace com::sun::star;
using namespace ::xmloff::token;
@@ -180,7 +181,7 @@ uno::Sequence< sal_Int32 > lcl_getNumberSequenceFromString( const OUString& rStr
nPos = rStr.indexOf( aSpace, nLastPos );
if( nPos > nLastPos )
{
- aVec.push_back( rStr.copy( nLastPos, (nPos - nLastPos) ).toInt32() );
+ aVec.push_back( comphelper::string::toInt32(rStr.subView( nLastPos, (nPos - nLastPos) )) );
}
if( nPos != -1 )
nLastPos = nPos + 1;
@@ -189,7 +190,7 @@ uno::Sequence< sal_Int32 > lcl_getNumberSequenceFromString( const OUString& rStr
if( nLastPos != 0 &&
rStr.getLength() > nLastPos )
{
- aVec.push_back( rStr.copy( nLastPos ).toInt32() );
+ aVec.push_back( comphelper::string::toInt32(rStr.subView( nLastPos )) );
}
const sal_Int32 nVecSize = aVec.size();
diff --git a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
index 4884d0ba5823..1e61b1f52a58 100644
--- a/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
+++ b/xmloff/source/core/unointerfacetouniqueidentifiermapper.cxx
@@ -21,6 +21,7 @@
#include <o3tl/safeint.hxx>
#include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
+#include <comphelper/string.hxx>
#include <algorithm>
using namespace ::com::sun::star;
@@ -94,7 +95,7 @@ bool UnoInterfaceToUniqueIdentifierMapper::registerReference( const OUString& rI
// the identifier is a pure integer value
// so we make sure we will never generate
// an integer value like this one
- sal_Int32 nId = rIdentifier.copy(2).toInt32();
+ sal_Int32 nId = comphelper::string::toInt32(rIdentifier.subView(2));
if (nId > 0 && mnNextId <= o3tl::make_unsigned(nId))
mnNextId = nId + 1;
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index a710e87b3bb7..e18769e9f6a4 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -62,6 +62,7 @@
#include <comphelper/fileformat.h>
#include <comphelper/namecontainer.hxx>
#include <comphelper/servicehelper.hxx>
+#include <comphelper/string.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/extract.hxx>
@@ -1829,11 +1830,11 @@ bool SvXMLImport::getBuildIds( sal_Int32& rUPD, sal_Int32& rBuild ) const
sal_Int32 nIndex = aBuildId.indexOf('$');
if (nIndex != -1)
{
- rUPD = aBuildId.copy( 0, nIndex ).toInt32();
+ rUPD = comphelper::string::toInt32(aBuildId.subView( 0, nIndex ));
sal_Int32 nIndexEnd = aBuildId.indexOf(';', nIndex);
rBuild = (nIndexEnd == -1)
- ? aBuildId.copy(nIndex + 1).toInt32()
- : aBuildId.copy(nIndex + 1, nIndexEnd - nIndex - 1).toInt32();
+ ? comphelper::string::toInt32(aBuildId.subView(nIndex + 1))
+ : comphelper::string::toInt32(aBuildId.subView(nIndex + 1, nIndexEnd - nIndex - 1));
bRet = true;
}
}
diff --git a/xmloff/source/xforms/SchemaRestrictionContext.cxx b/xmloff/source/xforms/SchemaRestrictionContext.cxx
index ea6db4f1befb..68da0bdd95c9 100644
--- a/xmloff/source/xforms/SchemaRestrictionContext.cxx
+++ b/xmloff/source/xforms/SchemaRestrictionContext.cxx
@@ -38,6 +38,7 @@
#include <com/sun/star/xsd/DataTypeClass.hpp>
#include <com/sun/star/xsd/WhiteSpaceTreatment.hpp>
+#include <comphelper/string.hxx>
#include <sal/log.hxx>
#include <tools/diagnose_ex.h>
@@ -150,11 +151,11 @@ static Any xforms_date( const OUString& rValue )
{
util::Date aDate;
aDate.Year = static_cast<sal_uInt16>(
- rValue.copy( 0, nPos1 ).toInt32() );
+ comphelper::string::toInt32(rValue.subView( 0, nPos1 )) );
aDate.Month = static_cast<sal_uInt16>(
- rValue.copy( nPos1 + 1, nPos2 - nPos1 - 1 ).toInt32() );
+ comphelper::string::toInt32(rValue.subView( nPos1 + 1, nPos2 - nPos1 - 1 )) );
aDate.Day = static_cast<sal_uInt16>(
- rValue.copy( nPos2 + 1 ).toInt32() );
+ comphelper::string::toInt32(rValue.subView( nPos2 + 1 )) );
aAny <<= aDate;
}
return aAny;