summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/tools/bigint.hxx2
-rw-r--r--include/tools/multisel.hxx6
-rw-r--r--sc/source/ui/unoobj/docuno.cxx4
-rw-r--r--tools/source/generic/bigint.cxx11
-rw-r--r--tools/source/memtools/multisel.cxx21
5 files changed, 25 insertions, 19 deletions
diff --git a/include/tools/bigint.hxx b/include/tools/bigint.hxx
index 14efb7e69248..ae33a5e67d53 100644
--- a/include/tools/bigint.hxx
+++ b/include/tools/bigint.hxx
@@ -76,7 +76,7 @@ public:
BigInt( sal_uInt32 nVal );
BigInt( sal_Int64 nVal );
BigInt( const BigInt& rBigInt );
- BigInt( const OUString& rString );
+ BigInt( std::u16string_view rString );
operator sal_Int16() const;
operator sal_uInt16() const;
diff --git a/include/tools/multisel.hxx b/include/tools/multisel.hxx
index 878080fa5c45..a5c68ca0eb23 100644
--- a/include/tools/multisel.hxx
+++ b/include/tools/multisel.hxx
@@ -89,7 +89,7 @@ class SAL_WARN_UNUSED TOOLS_DLLPUBLIC StringRangeEnumerator
sal_Int32 mnOffset;
bool mbValidInput;
- bool setRange( const OUString& i_rNewRange );
+ bool setRange( std::u16string_view i_rNewRange );
bool insertRange( sal_Int32 nFirst, sal_Int32 nLast, bool bSequence );
void insertJoinedRanges( const std::vector< sal_Int32 >& rNumbers );
bool checkValue( sal_Int32, const o3tl::sorted_vector< sal_Int32 >* i_pPossibleValues = nullptr ) const;
@@ -119,7 +119,7 @@ public:
friend class StringRangeEnumerator::Iterator;
- StringRangeEnumerator( const OUString& i_rInput,
+ StringRangeEnumerator( std::u16string_view i_rInput,
sal_Int32 i_nMinNumber,
sal_Int32 i_nMaxNumber,
sal_Int32 i_nLogicalOffset = -1
@@ -155,7 +155,7 @@ public:
- single number that doesn't fit in [i_nMinNumber,i_nMaxNumber] will be ignored
- range that doesn't fit in [i_nMinNumber,i_nMaxNumber] will be adjusted
*/
- static bool getRangesFromString( const OUString& i_rPageRange,
+ static bool getRangesFromString( std::u16string_view i_rPageRange,
std::vector< sal_Int32 >& o_rPageVector,
sal_Int32 i_nMinNumber,
sal_Int32 i_nMaxNumber,
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index e2b24d517b83..0f822195364d 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1787,9 +1787,9 @@ sal_Int32 SAL_CALL ScModelObj::getRendererCount(const uno::Any& aSelection,
return (nSelectCount > 0) ? nSelectCount : 1;
}
-static sal_Int32 lcl_GetRendererNum( sal_Int32 nSelRenderer, const OUString& rPagesStr, sal_Int32 nTotalPages )
+static sal_Int32 lcl_GetRendererNum( sal_Int32 nSelRenderer, std::u16string_view rPagesStr, sal_Int32 nTotalPages )
{
- if ( rPagesStr.isEmpty() )
+ if ( rPagesStr.empty() )
return nSelRenderer;
StringRangeEnumerator aRangeEnum( rPagesStr, 0, nTotalPages-1 );
diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx
index f6627200a61c..51810cab17c2 100644
--- a/tools/source/generic/bigint.cxx
+++ b/tools/source/generic/bigint.cxx
@@ -475,20 +475,25 @@ BigInt::BigInt( const BigInt& rBigInt )
nVal = rBigInt.nVal;
}
-BigInt::BigInt( const OUString& rString )
+BigInt::BigInt( std::u16string_view rString )
: nLen(0)
{
bIsNeg = false;
nVal = 0;
bool bNeg = false;
- const sal_Unicode* p = rString.getStr();
+ auto p = rString.begin();
+ auto pEnd = rString.end();
+ if (p == pEnd)
+ return;
if ( *p == '-' )
{
bNeg = true;
p++;
}
- while( *p >= '0' && *p <= '9' )
+ if (p == pEnd)
+ return;
+ while( p != pEnd && *p >= '0' && *p <= '9' )
{
*this *= 10;
*this += *p - '0';
diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx
index 1f3f8eb5a23a..c6dd9d8c3146 100644
--- a/tools/source/memtools/multisel.cxx
+++ b/tools/source/memtools/multisel.cxx
@@ -468,7 +468,7 @@ void MultiSelection::SetTotalRange( const Range& rTotRange )
// StringRangeEnumerator
-StringRangeEnumerator::StringRangeEnumerator( const OUString& i_rInput,
+StringRangeEnumerator::StringRangeEnumerator( std::u16string_view i_rInput,
sal_Int32 i_nMinNumber,
sal_Int32 i_nMaxNumber,
sal_Int32 i_nLogicalOffset
@@ -566,18 +566,19 @@ void StringRangeEnumerator::insertJoinedRanges(
}
}
-bool StringRangeEnumerator::setRange( const OUString& i_rNewRange )
+bool StringRangeEnumerator::setRange( std::u16string_view aNewRange )
{
mnCount = 0;
maSequence.clear();
- const sal_Unicode* pInput = i_rNewRange.getStr();
+ auto pInput = aNewRange.begin();
+ auto pInputEnd = aNewRange.end();
OUStringBuffer aNumberBuf( 16 );
std::vector< sal_Int32 > aNumbers;
bool bSequence = false;
- while( *pInput )
+ while( pInput != pInputEnd )
{
- while( *pInput >= '0' && *pInput <= '9' )
+ while( pInput != pInputEnd && *pInput >= '0' && *pInput <= '9' )
aNumberBuf.append( *pInput++ );
if( !aNumberBuf.isEmpty() )
{
@@ -585,7 +586,8 @@ bool StringRangeEnumerator::setRange( const OUString& i_rNewRange )
aNumbers.push_back( nNumber );
bSequence = false;
}
-
+ if (pInput == pInputEnd)
+ break;
if( *pInput == '-' )
{
bSequence = true;
@@ -607,11 +609,10 @@ bool StringRangeEnumerator::setRange( const OUString& i_rNewRange )
aNumbers.clear();
bSequence = false;
}
- else if( *pInput && *pInput != ' ' )
+ else if( *pInput != ' ' )
return false; // parse error
- if( *pInput )
- pInput++;
+ pInput++;
}
// insert last entries
if( bSequence && !aNumbers.empty() )
@@ -710,7 +711,7 @@ StringRangeEnumerator::Iterator StringRangeEnumerator::end( const o3tl::sorted_v
return StringRangeEnumerator::Iterator( this, i_pPossibleValues, -1, -1 );
}
-bool StringRangeEnumerator::getRangesFromString( const OUString& i_rPageRange,
+bool StringRangeEnumerator::getRangesFromString( std::u16string_view i_rPageRange,
std::vector< sal_Int32 >& o_rPageVector,
sal_Int32 i_nMinNumber,
sal_Int32 i_nMaxNumber,