summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-26 13:27:39 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-26 19:37:20 +0200
commit5fe702f1b69a02a274621a01db68256a94edfd36 (patch)
tree8b07b80a9046040ba7da685e4063f5f21e1f0eaa
parentcf2dc247ff5f726238856e9b46a4926a30430e14 (diff)
add o3tl::toUInt32
Change-Id: I07f11bf12fbe1d1c2d812fa0965d6e632e1e1aba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133437 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--chart2/source/tools/InternalDataProvider.cxx4
-rw-r--r--comphelper/source/misc/sequenceashashmap.cxx8
-rw-r--r--compilerplugins/clang/stringview.cxx8
-rw-r--r--compilerplugins/clang/stringviewparam.cxx2
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx3
-rw-r--r--i18nutil/source/utility/unicode.cxx5
-rw-r--r--include/o3tl/string_view.hxx16
-rw-r--r--include/oox/helper/attributelist.hxx2
-rw-r--r--oox/source/helper/attributelist.cxx4
-rw-r--r--oox/source/ppt/comments.cxx8
-rw-r--r--oox/source/vml/vmlformatting.cxx8
-rw-r--r--oox/source/vml/vmlshape.cxx2
-rw-r--r--sc/source/filter/oox/drawingfragment.cxx9
-rw-r--r--sc/source/ui/view/cellsh1.cxx5
-rw-r--r--sd/source/filter/eppt/pptexanimations.cxx5
-rw-r--r--sd/source/ui/dlg/copydlg.cxx4
-rw-r--r--sfx2/source/doc/SfxRedactionHelper.cxx3
-rw-r--r--svl/source/passwordcontainer/passwordcontainer.cxx5
-rw-r--r--svx/source/customshapes/EnhancedCustomShape2d.cxx2
-rw-r--r--svx/source/gallery2/galbrws2.cxx9
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx2
-rw-r--r--sw/source/uibase/misc/glosdoc.cxx2
-rw-r--r--tools/source/generic/color.cxx3
-rw-r--r--vcl/source/filter/ipdf/pdfdocument.cxx3
-rw-r--r--vcl/source/window/builder.cxx3
-rw-r--r--vcl/source/window/debugevent.cxx3
-rw-r--r--vcl/unx/generic/window/salframe.cxx5
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx2
-rw-r--r--xmlscript/source/xmldlg_imexp/imp_share.hxx3
-rw-r--r--xmlscript/source/xmllib_imexp/imp_share.hxx3
30 files changed, 86 insertions, 55 deletions
diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx
index 010e3c202924..8508c8453c70 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -887,7 +887,7 @@ Sequence< uno::Any > SAL_CALL InternalDataProvider::getDataByRangeRepresentation
if( aRange.match( lcl_aLabelRangePrefix ) )
{
- auto nIndex = aRange.copy( strlen(lcl_aLabelRangePrefix)).toUInt32();
+ auto nIndex = o3tl::toUInt32(aRange.subView( strlen(lcl_aLabelRangePrefix)));
vector< uno::Any > aComplexLabel = m_bDataInColumns
? m_aInternalData.getComplexColumnLabel( nIndex )
: m_aInternalData.getComplexRowLabel( nIndex );
@@ -896,7 +896,7 @@ Sequence< uno::Any > SAL_CALL InternalDataProvider::getDataByRangeRepresentation
}
else if( aRange.match( lcl_aCategoriesPointRangeNamePrefix ) )
{
- auto nPointIndex = aRange.copy( strlen(lcl_aCategoriesPointRangeNamePrefix) ).toUInt32();
+ auto nPointIndex = o3tl::toUInt32(aRange.subView( strlen(lcl_aCategoriesPointRangeNamePrefix) ));
vector< uno::Any > aComplexCategory = m_bDataInColumns
? m_aInternalData.getComplexRowLabel( nPointIndex )
: m_aInternalData.getComplexColumnLabel( nPointIndex );
diff --git a/comphelper/source/misc/sequenceashashmap.cxx b/comphelper/source/misc/sequenceashashmap.cxx
index 21a7f0971b94..0f15823651f9 100644
--- a/comphelper/source/misc/sequenceashashmap.cxx
+++ b/comphelper/source/misc/sequenceashashmap.cxx
@@ -80,7 +80,7 @@ uno::Any jsonToUnoAny(const boost::property_tree::ptree& aTree)
else if (aTypeClass == uno::TypeClass_SHORT)
aAny <<= static_cast<sal_Int16>(o3tl::toInt32(rValue));
else if (aTypeClass == uno::TypeClass_UNSIGNED_SHORT)
- aAny <<= static_cast<sal_uInt16>(OString(rValue.c_str()).toUInt32());
+ aAny <<= static_cast<sal_uInt16>(o3tl::toUInt32(rValue));
else if (aTypeClass == uno::TypeClass_LONG)
aAny <<= o3tl::toInt32(rValue);
else if (aTypeClass == uno::TypeClass_UNSIGNED_LONG)
@@ -331,7 +331,7 @@ std::vector<css::beans::PropertyValue> JsonToPropertyValues(const OString& rJson
else if (rType == "short")
aValue.Value <<= sal_Int16(o3tl::toInt32(rValue));
else if (rType == "unsigned short")
- aValue.Value <<= sal_uInt16(OString(rValue.c_str()).toUInt32());
+ aValue.Value <<= sal_uInt16(o3tl::toUInt32(rValue));
else if (rType == "int64")
aValue.Value <<= o3tl::toInt64(rValue);
else if (rType == "int32")
@@ -341,9 +341,9 @@ std::vector<css::beans::PropertyValue> JsonToPropertyValues(const OString& rJson
else if (rType == "uint64")
aValue.Value <<= OString(rValue.c_str()).toUInt64();
else if (rType == "uint32")
- aValue.Value <<= OString(rValue.c_str()).toUInt32();
+ aValue.Value <<= o3tl::toUInt32(rValue);
else if (rType == "uint16")
- aValue.Value <<= sal_uInt16(OString(rValue.c_str()).toUInt32());
+ aValue.Value <<= sal_uInt16(o3tl::toUInt32(rValue));
else if (rType == "[]byte")
{
aNodeValue = rPair.second.get_child("value", aNodeNull);
diff --git a/compilerplugins/clang/stringview.cxx b/compilerplugins/clang/stringview.cxx
index bcb8b79eded6..e1cac4195265 100644
--- a/compilerplugins/clang/stringview.cxx
+++ b/compilerplugins/clang/stringview.cxx
@@ -376,10 +376,10 @@ bool StringView::VisitCXXMemberCallExpr(CXXMemberCallExpr const* expr)
|| tc.Class("OString").Namespace("rtl").GlobalNamespace())
{
auto const dc = loplugin::DeclCheck(expr->getMethodDecl());
- if (dc.Function("toInt32") || dc.Function("toInt64") || dc.Function("toDouble")
- || dc.Function("equalsIgnoreAsciiCase") || dc.Function("compareToIgnoreAsciiCase")
- || dc.Function("trim") || dc.Function("startsWith") || dc.Function("endsWith")
- || dc.Function("match"))
+ if (dc.Function("toInt32") || dc.Function("toUInt32") || dc.Function("toInt64")
+ || dc.Function("toDouble") || dc.Function("equalsIgnoreAsciiCase")
+ || dc.Function("compareToIgnoreAsciiCase") || dc.Function("trim")
+ || dc.Function("startsWith") || dc.Function("endsWith") || dc.Function("match"))
{
handleSubExprThatCouldBeView(expr->getImplicitObjectArgument());
}
diff --git a/compilerplugins/clang/stringviewparam.cxx b/compilerplugins/clang/stringviewparam.cxx
index 42595e887e45..a20691a3a4d1 100644
--- a/compilerplugins/clang/stringviewparam.cxx
+++ b/compilerplugins/clang/stringviewparam.cxx
@@ -139,7 +139,7 @@ DeclRefExpr const* relevantCXXMemberCallExpr(CXXMemberCallExpr const* expr)
auto const n = i->getName();
if (n == "endsWith" || n == "isEmpty" || n == "startsWith" || n == "subView"
|| n == "indexOf" || n == "lastIndexOf" || n == "compareTo" || n == "match"
- || n == "trim" || n == "toInt32" || n == "toInt64" || n == "toDouble"
+ || n == "trim" || n == "toInt32" || n == "toUInt32" || n == "toInt64" || n == "toDouble"
|| n == "equalsIgnoreAsciiCase" || n == "compareToIgnoreAsciiCase" || n == "getToken"
|| n == "copy")
{
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 80065f2bc855..560377d0d5d5 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -23,6 +23,7 @@
#include <formula/errorcodes.hxx>
#include <formula/token.hxx>
#include <formula/tokenarray.hxx>
+#include <o3tl/string_view.hxx>
#include <core_resource.hxx>
#include <core_resource.hrc>
@@ -1234,7 +1235,7 @@ FormulaError FormulaCompiler::GetErrorConstant( const OUString& rName ) const
// digits.
if (rName.startsWithIgnoreAsciiCase("#ERR") && rName.getLength() <= 10 && rName[rName.getLength()-1] == '!')
{
- sal_uInt32 nErr = rName.copy( 4, rName.getLength() - 5).toUInt32();
+ sal_uInt32 nErr = o3tl::toUInt32(rName.subView( 4, rName.getLength() - 5));
if (0 < nErr && nErr <= SAL_MAX_UINT16 && isPublishedFormulaError(static_cast<FormulaError>(nErr)))
nError = static_cast<FormulaError>(nErr);
}
diff --git a/i18nutil/source/utility/unicode.cxx b/i18nutil/source/utility/unicode.cxx
index be34ea58f44a..5e479989eae9 100644
--- a/i18nutil/source/utility/unicode.cxx
+++ b/i18nutil/source/utility/unicode.cxx
@@ -26,6 +26,7 @@
#include <unicode/numfmt.h>
#include "unicode_data.h"
#include <rtl/character.hxx>
+#include <o3tl/string_view.hxx>
#include <memory>
// Workaround for glibc braindamage:
@@ -1019,7 +1020,7 @@ OUString ToggleUnicodeCodepoint::StringToReplace()
sIn = maInput.toString();
while( nUPlus != -1 )
{
- nUnicode = sIn.copy(0, nUPlus).toUInt32(16);
+ nUnicode = o3tl::toUInt32(sIn.subView(0, nUPlus), 16);
//prevent creating control characters or invalid Unicode values
if( !rtl::isUnicodeCodePoint(nUnicode) || nUnicode < 0x20 )
maInput = sIn.subView(nUPlus);
@@ -1062,7 +1063,7 @@ OUString ToggleUnicodeCodepoint::ReplacementString()
}
while( nUPlus > 0 )
{
- nUnicode = sIn.copy(0, nUPlus).toUInt32(16);
+ nUnicode = o3tl::toUInt32(sIn.subView(0, nUPlus), 16);
output.appendUtf32( nUnicode );
sIn = sIn.copy(nUPlus+2);
diff --git a/include/o3tl/string_view.hxx b/include/o3tl/string_view.hxx
index 2438500768fe..6138f5c09c88 100644
--- a/include/o3tl/string_view.hxx
+++ b/include/o3tl/string_view.hxx
@@ -424,6 +424,22 @@ inline sal_Int32 toInt32(std::string_view str, sal_Int16 radix = 10)
return n;
}
+// Like OString::toUInt32, but for std::string_view:
+inline sal_uInt32 toUInt32(std::u16string_view str, sal_Int16 radix = 10)
+{
+ sal_Int64 n = rtl_ustr_toInt64_WithLength(str.data(), radix, str.size());
+ if (n < 0 || n > SAL_MAX_UINT32)
+ n = 0;
+ return n;
+}
+inline sal_uInt32 toUInt32(std::string_view str, sal_Int16 radix = 10)
+{
+ sal_Int64 n = rtl_str_toInt64_WithLength(str.data(), radix, str.size());
+ if (n < 0 || n > SAL_MAX_UINT32)
+ n = 0;
+ return n;
+}
+
// Like OString::toInt64, but for std::string_view:
inline sal_Int64 toInt64(std::u16string_view str, sal_Int16 radix = 10)
{
diff --git a/include/oox/helper/attributelist.hxx b/include/oox/helper/attributelist.hxx
index 511b00fce2a2..27101657f140 100644
--- a/include/oox/helper/attributelist.hxx
+++ b/include/oox/helper/attributelist.hxx
@@ -69,7 +69,7 @@ public:
static sal_Int64 decodeHyper( std::u16string_view rValue );
/** Returns the 32-bit signed integer value from the passed string (hexadecimal). */
- static sal_Int32 decodeIntegerHex( const OUString& rValue );
+ static sal_Int32 decodeIntegerHex( std::u16string_view rValue );
};
diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx
index 6afab21c33d8..e0bea17c22e6 100644
--- a/oox/source/helper/attributelist.cxx
+++ b/oox/source/helper/attributelist.cxx
@@ -120,11 +120,11 @@ sal_Int64 AttributeConversion::decodeHyper( std::u16string_view rValue )
return o3tl::toInt64(rValue);
}
-sal_Int32 AttributeConversion::decodeIntegerHex( const OUString& rValue )
+sal_Int32 AttributeConversion::decodeIntegerHex( std::u16string_view rValue )
{
// It looks like all Office Open XML attributes containing hexadecimal
// values are based on xsd:hexBinary and so use an unsigned representation:
- return static_cast< sal_Int32 >(rValue.toUInt32( 16 ));
+ return static_cast< sal_Int32 >(o3tl::toUInt32(rValue, 16));
//TODO: Change this function to return sal_uInt32 and get rid of the
// cast, but that will have a ripple effect
}
diff --git a/oox/source/ppt/comments.cxx b/oox/source/ppt/comments.cxx
index a255dd010950..73b78c34459a 100644
--- a/oox/source/ppt/comments.cxx
+++ b/oox/source/ppt/comments.cxx
@@ -35,10 +35,10 @@ void Comment::setDateTime(const OUString& sDateTime)
{
sal_Int32 nIdx{ 0 };
aDateTime.Year = o3tl::toInt32(o3tl::getToken(sDateTime, 0, '-', nIdx));
- 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();
+ aDateTime.Month = o3tl::toUInt32(o3tl::getToken(sDateTime, 0, '-', nIdx));
+ aDateTime.Day = o3tl::toUInt32(o3tl::getToken(sDateTime, 0, 'T', nIdx));
+ aDateTime.Hours = o3tl::toUInt32(o3tl::getToken(sDateTime, 0, ':', nIdx));
+ aDateTime.Minutes = o3tl::toUInt32(o3tl::getToken(sDateTime, 0, ':', nIdx));
double seconds = rtl_math_uStringToDouble(sDateTime.getStr() + nIdx,
sDateTime.getStr() + sDateTime.getLength(), '.', 0,
nullptr, nullptr);
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index e195a1e94183..f3b29150b1b6 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -246,16 +246,16 @@ Color ConversionHelper::decodeColor( const GraphicHelper& rGraphicHelper,
// RGB colors in the format '#RRGGBB'
if( (aColorName.getLength() == 7) && (aColorName[ 0 ] == '#') )
{
- aDmlColor.setSrgbClr( aColorName.copy( 1 ).toUInt32( 16 ) );
+ aDmlColor.setSrgbClr( o3tl::toUInt32(aColorName.subView( 1 ), 16) );
return aDmlColor;
}
// RGB colors in the format '#RGB'
if( (aColorName.getLength() == 4) && (aColorName[ 0 ] == '#') )
{
- sal_Int32 nR = aColorName.copy( 1, 1 ).toUInt32( 16 ) * 0x11;
- sal_Int32 nG = aColorName.copy( 2, 1 ).toUInt32( 16 ) * 0x11;
- sal_Int32 nB = aColorName.copy( 3, 1 ).toUInt32( 16 ) * 0x11;
+ sal_Int32 nR = o3tl::toUInt32(aColorName.subView( 1, 1 ), 16 ) * 0x11;
+ sal_Int32 nG = o3tl::toUInt32(aColorName.subView( 2, 1 ), 16 ) * 0x11;
+ sal_Int32 nB = o3tl::toUInt32(aColorName.subView( 3, 1 ), 16 ) * 0x11;
aDmlColor.setSrgbClr( (nR << 16) | (nG << 8) | nB );
return aDmlColor;
}
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 188e3303449c..4e2e6e2d224e 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -119,7 +119,7 @@ sal_Int32 lclConvertCrop(const OUString& rCrop, sal_uInt32 nSize)
if (rCrop.endsWith("f"))
{
// Numeric value is specified in 1/65536-ths.
- sal_uInt32 nCrop = rCrop.copy(0, rCrop.getLength() - 1).toUInt32();
+ sal_uInt32 nCrop = o3tl::toUInt32(rCrop.subView(0, rCrop.getLength() - 1));
return (nCrop * nSize) / 65536;
}
diff --git a/sc/source/filter/oox/drawingfragment.cxx b/sc/source/filter/oox/drawingfragment.cxx
index 033720a1bf1e..adf499d996f3 100644
--- a/sc/source/filter/oox/drawingfragment.cxx
+++ b/sc/source/filter/oox/drawingfragment.cxx
@@ -45,6 +45,7 @@
#include <oox/vml/vmlshape.hxx>
#include <oox/vml/vmlshapecontainer.hxx>
#include <osl/diagnose.h>
+#include <o3tl/string_view.hxx>
#include <formulaparser.hxx>
#include <stylesbuffer.hxx>
#include <themebuffer.hxx>
@@ -703,14 +704,14 @@ sal_uInt32 VmlDrawing::convertControlTextColor( const OUString& rTextColor ) con
{
// RGB colors in the format '#RRGGBB'
if( rTextColor.getLength() == 7 )
- return OleHelper::encodeOleColor( rTextColor.copy( 1 ).toUInt32( 16 ) );
+ return OleHelper::encodeOleColor( o3tl::toUInt32(rTextColor.subView( 1 ), 16) );
// RGB colors in the format '#RGB'
if( rTextColor.getLength() == 4 )
{
- sal_Int32 nR = rTextColor.copy( 1, 1 ).toUInt32( 16 ) * 0x11;
- sal_Int32 nG = rTextColor.copy( 2, 1 ).toUInt32( 16 ) * 0x11;
- sal_Int32 nB = rTextColor.copy( 3, 1 ).toUInt32( 16 ) * 0x11;
+ sal_Int32 nR = o3tl::toUInt32(rTextColor.subView( 1, 1 ), 16) * 0x11;
+ sal_Int32 nG = o3tl::toUInt32(rTextColor.subView( 2, 1 ), 16) * 0x11;
+ sal_Int32 nB = o3tl::toUInt32(rTextColor.subView( 3, 1 ), 16) * 0x11;
return OleHelper::encodeOleColor( (nR << 16) | (nG << 8) | nB );
}
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 943df5b926ff..ca337a557cd1 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -94,6 +94,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/bootstrap.hxx>
+#include <o3tl/string_view.hxx>
#include <memory>
@@ -149,7 +150,7 @@ OUString FlagsToString( InsertDeleteFlags nFlags,
return aFlagsStr;
}
-void SetTabNoAndCursor( const ScViewData& rViewData, const OUString& rCellId )
+void SetTabNoAndCursor( const ScViewData& rViewData, std::u16string_view rCellId )
{
ScTabViewShell* pTabViewShell = rViewData.GetViewShell();
assert(pTabViewShell);
@@ -157,7 +158,7 @@ void SetTabNoAndCursor( const ScViewData& rViewData, const OUString& rCellId )
std::vector<sc::NoteEntry> aNotes;
rDoc.GetAllNoteEntries(aNotes);
- sal_uInt32 nId = rCellId.toUInt32();
+ sal_uInt32 nId = o3tl::toUInt32(rCellId);
auto lComp = [nId](const sc::NoteEntry& rNote) { return rNote.mpNote->GetId() == nId; };
const auto& aFoundNoteIt = std::find_if(aNotes.begin(), aNotes.end(), lComp);
diff --git a/sd/source/filter/eppt/pptexanimations.cxx b/sd/source/filter/eppt/pptexanimations.cxx
index 74ef8cd96619..bbab0ed2d8b9 100644
--- a/sd/source/filter/eppt/pptexanimations.cxx
+++ b/sd/source/filter/eppt/pptexanimations.cxx
@@ -59,6 +59,7 @@
#include <osl/diagnose.h>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
+#include <o3tl/string_view.hxx>
#include <algorithm>
@@ -890,8 +891,8 @@ sal_uInt32 AnimationExporter::GetPresetID( const OUString& rPreset, sal_uInt32 n
sal_Int32 nLast = rPreset.lastIndexOf( '_' );
if ( ( nLast != -1 ) && ( ( nLast + 1 ) < rPreset.getLength() ) )
{
- OUString aNumber( rPreset.copy( nLast + 1 ) );
- nPresetId = aNumber.toUInt32();
+ std::u16string_view aNumber( rPreset.subView( nLast + 1 ) );
+ nPresetId = o3tl::toUInt32(aNumber);
bPresetId = true;
}
}
diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx
index 66a13be8ed74..70ccf9c4b9be 100644
--- a/sd/source/ui/dlg/copydlg.cxx
+++ b/sd/source/ui/dlg/copydlg.cxx
@@ -169,8 +169,8 @@ void CopyDlg::Reset()
m_xMtrFldAngle->set_value(o3tl::toInt64(o3tl::getToken(aStr, 0, TOKEN, nIdx)), FieldUnit::NONE);
m_xMtrFldWidth->set_value(o3tl::toInt64(o3tl::getToken(aStr, 0, TOKEN, nIdx)), FieldUnit::NONE);
m_xMtrFldHeight->set_value(o3tl::toInt64(o3tl::getToken(aStr, 0, TOKEN, nIdx)), FieldUnit::NONE);
- m_xLbStartColor->SelectEntry( Color( ColorTransparency, aStr.getToken(0, TOKEN, nIdx).toUInt32() ) );
- m_xLbEndColor->SelectEntry( Color( ColorTransparency, aStr.getToken(0, TOKEN, nIdx).toUInt32() ) );
+ m_xLbStartColor->SelectEntry( Color( ColorTransparency, o3tl::toUInt32(o3tl::getToken(aStr, 0, TOKEN, nIdx)) ) );
+ m_xLbEndColor->SelectEntry( Color( ColorTransparency, o3tl::toUInt32(o3tl::getToken(aStr, 0, TOKEN, nIdx)) ) );
}
}
diff --git a/sfx2/source/doc/SfxRedactionHelper.cxx b/sfx2/source/doc/SfxRedactionHelper.cxx
index 28cf18d94ebf..34643e721478 100644
--- a/sfx2/source/doc/SfxRedactionHelper.cxx
+++ b/sfx2/source/doc/SfxRedactionHelper.cxx
@@ -55,6 +55,7 @@
#include <vcl/metaact.hxx>
#include <vcl/outdev.hxx>
#include <vcl/vcllayout.hxx>
+#include <o3tl/string_view.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::lang;
@@ -543,7 +544,7 @@ void SfxRedactionHelper::fillSearchOptions(i18nutil::SearchOptions2& rSearchOpt,
rSearchOpt.Locale = GetAppLanguageTag().getLocale();
if (rTarget.sType == RedactionTargetType::REDACTION_TARGET_PREDEFINED)
{
- auto nPredefIndex = rTarget.sContent.getToken(0, ';').toUInt32();
+ auto nPredefIndex = o3tl::toUInt32(o3tl::getToken(rTarget.sContent, 0, ';'));
rSearchOpt.searchString = m_aPredefinedTargets[nPredefIndex];
}
else
diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx
index 66cfda5e9aad..6a2537a56bda 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -29,6 +29,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/propertyvalue.hxx>
#include <comphelper/sequence.hxx>
+#include <o3tl/string_view.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
#include <com/sun/star/task/MasterPasswordRequest.hpp>
@@ -425,7 +426,7 @@ std::vector< OUString > PasswordContainer::DecodePasswords( std::u16string_view
unsigned char code[RTL_DIGEST_LENGTH_MD5];
for( int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ )
- code[ ind ] = static_cast<char>(aMasterPasswd.copy( ind*2, 2 ).toUInt32(16));
+ code[ ind ] = static_cast<char>(o3tl::toUInt32(aMasterPasswd.subView( ind*2, 2 ), 16));
unsigned char iv[RTL_DIGEST_LENGTH_MD5] = {0};
if (!aIV.empty())
@@ -487,7 +488,7 @@ OUString PasswordContainer::EncodePasswords(const std::vector< OUString >& lines
unsigned char code[RTL_DIGEST_LENGTH_MD5];
for( int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ )
- code[ ind ] = static_cast<char>(aMasterPasswd.copy( ind*2, 2 ).toUInt32(16));
+ code[ ind ] = static_cast<char>(o3tl::toUInt32(aMasterPasswd.subView( ind*2, 2 ), 16));
unsigned char iv[RTL_DIGEST_LENGTH_MD5] = {0};
if (!aIV.empty())
diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index 1aa482769711..1215433044ab 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -791,7 +791,7 @@ EnhancedCustomShape2d::EnhancedCustomShape2d(SdrObjCustomShape& rSdrObjCustomSha
}
else if (sShapeType.getLength() > 4 && sShapeType.match( "col-" ))
{
- nColorData = sShapeType.copy( 4 ).toUInt32( 16 );
+ nColorData = o3tl::toUInt32(sShapeType.subView( 4 ), 16);
}
}
break;
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 2e715fa95071..27ba2634d451 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -53,6 +53,7 @@
#include <memory>
#include <cppuhelper/implbase.hxx>
#include <osl/diagnose.h>
+#include <o3tl/string_view.hxx>
GalleryBrowserMode GalleryBrowser2::meInitMode = GALLERYBROWSERMODE_ICON;
@@ -112,7 +113,7 @@ private:
static void Execute( const CommandInfo &rCmdInfo,
const css::uno::Sequence< css::beans::PropertyValue > &rArguments );
- void MenuSelectHdl(const OString& rIdent);
+ void MenuSelectHdl(std::string_view rIdent);
void BackgroundMenuSelectHdl(sal_uInt16 nId);
public:
GalleryThemePopup(weld::Widget* pParent,
@@ -286,12 +287,12 @@ void GalleryThemePopup::ExecutePopup(weld::Widget* pParent, const ::Point &rPos)
MenuSelectHdl(mxPopupMenu->popup_at_rect(pParent, tools::Rectangle(rPos, Size(1,1))));
}
-void GalleryThemePopup::MenuSelectHdl(const OString& rIdent)
+void GalleryThemePopup::MenuSelectHdl(std::string_view rIdent)
{
- if (rIdent.isEmpty())
+ if (rIdent.empty())
return;
- sal_uInt16 nSubMenuId = rIdent.toUInt32();
+ sal_uInt16 nSubMenuId = o3tl::toUInt32(rIdent);
if (nSubMenuId)
{
BackgroundMenuSelectHdl(nSubMenuId-1);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 9a554b9d4a5c..cd13745d4e43 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3471,7 +3471,7 @@ bool DocxAttributeOutput::StartURL( const OUString& rUrl, const OUString& rTarge
// Extract <seqname>, the field instruction text has the name quoted.
OUString aSequenceName = sMark.copy(0, nPos);
// Extract <index>.
- sal_uInt32 nIndex = sMark.copy(nPos + 1, sMark.getLength() - nPos - sizeof("|sequence")).toUInt32();
+ sal_uInt32 nIndex = o3tl::toUInt32(sMark.subView(nPos + 1, sMark.getLength() - nPos - sizeof("|sequence")));
std::map<OUString, std::vector<OString> >::iterator it = m_aSeqBookmarksNames.find(aSequenceName);
if (it != m_aSeqBookmarksNames.end())
{
diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx
index 53c4d2df5338..be7b4291e0bd 100644
--- a/sw/source/uibase/misc/glosdoc.cxx
+++ b/sw/source/uibase/misc/glosdoc.cxx
@@ -122,7 +122,7 @@ bool SwGlossaries::FindGroupName(OUString& rGroup)
for(size_t i = 0; i < nCount; ++i)
{
const OUString sTemp( GetGroupName( i ));
- sal_uInt16 nPath = sTemp.getToken(1, GLOS_DELIM).toUInt32();
+ sal_uInt16 nPath = o3tl::toUInt32(o3tl::getToken(sTemp, 1, GLOS_DELIM));
if (!SWUnoHelper::UCB_IsCaseSensitiveFileName( m_PathArr[nPath] )
&& rSCmp.isEqual( rGroup, sTemp.getToken( 0, GLOS_DELIM) ) )
diff --git a/tools/source/generic/color.cxx b/tools/source/generic/color.cxx
index 5df32719eb2c..0493b5250f62 100644
--- a/tools/source/generic/color.cxx
+++ b/tools/source/generic/color.cxx
@@ -27,6 +27,7 @@
#include <tools/color.hxx>
#include <tools/helpers.hxx>
#include <tools/long.hxx>
+#include <o3tl/string_view.hxx>
#include <basegfx/color/bcolortools.hxx>
void Color::IncreaseLuminance(sal_uInt8 cLumInc)
@@ -165,7 +166,7 @@ Color Color::STRtoRGB(const OUString& colorname)
switch(colorname.getLength()){
case 7:
- col.mValue = colorname.copy(1,6).toUInt32(16);
+ col.mValue = o3tl::toUInt32(colorname.subView(1,6), 16);
break;
case 6:
col.mValue = colorname.toUInt32(16);
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx
index dd6728faff08..3a65d06a1540 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -18,6 +18,7 @@
#include <comphelper/scopeguard.hxx>
#include <comphelper/string.hxx>
+#include <o3tl/string_view.hxx>
#include <rtl/character.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/string.hxx>
@@ -114,7 +115,7 @@ sal_uInt32 PDFDocument::GetNextSignature()
if (!rValue.startsWith(aPrefix))
continue;
- nRet = std::max(nRet, rValue.copy(aPrefix.getLength()).toUInt32());
+ nRet = std::max(nRet, o3tl::toUInt32(rValue.subView(aPrefix.getLength())));
}
return nRet + 1;
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index fa7294d2295e..fbbbb678de37 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -18,6 +18,7 @@
#include <comphelper/lok.hxx>
#include <i18nutil/unicode.hxx>
#include <jsdialog/enabled.hxx>
+#include <o3tl/string_view.hxx>
#include <officecfg/Office/Common.hxx>
#include <osl/module.hxx>
#include <sal/log.hxx>
@@ -3387,7 +3388,7 @@ namespace
return vcl::KeyCode(KEY_MULTIPLY, bShift, bMod1, bMod2, bMod3);
else if (rKey.first.getLength() > 1 && rKey.first[0] == 'F')
{
- sal_uInt32 nIndex = rKey.first.copy(1).toUInt32();
+ sal_uInt32 nIndex = o3tl::toUInt32(rKey.first.subView(1));
assert(nIndex >= 1 && nIndex <= 26);
return vcl::KeyCode(KEY_F1 + nIndex - 1, bShift, bMod1, bMod2, bMod3);
}
diff --git a/vcl/source/window/debugevent.cxx b/vcl/source/window/debugevent.cxx
index 94238967164b..f9f6978f0e33 100644
--- a/vcl/source/window/debugevent.cxx
+++ b/vcl/source/window/debugevent.cxx
@@ -8,6 +8,7 @@
*/
#include <comphelper/random.hxx>
+#include <o3tl/string_view.hxx>
#include <rtl/string.hxx>
#include <sal/log.hxx>
#include <vcl/keycodes.hxx>
@@ -260,7 +261,7 @@ DebugEventInjector *DebugEventInjector::getCreate()
const char *pEvents = getenv("VCL_EVENT_INJECTION");
if (!pEvents)
return nullptr;
- nEvents = OString( pEvents ).toUInt32();
+ nEvents = o3tl::toUInt32( pEvents );
if (nEvents > 0)
return new DebugEventInjector( nEvents );
else
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 4b1a00e2eed3..8c2d67c70565 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -52,6 +52,7 @@
#include <sal/macros.h>
#include <sal/log.hxx>
+#include <o3tl/string_view.hxx>
#include <com/sun/star/uno/Exception.hpp>
#include <svdata.hxx>
@@ -2916,8 +2917,8 @@ bool X11SalFrame::endUnicodeSequence()
if( rSeq.getLength() > 1 && rSeq.getLength() < 6 )
{
// cut the "u"
- OUString aNumbers( rSeq.copy( 1 ) );
- sal_uInt32 nValue = aNumbers.toUInt32( 16 );
+ std::u16string_view aNumbers( rSeq.subView( 1 ) );
+ sal_uInt32 nValue = o3tl::toUInt32(aNumbers, 16);
if( nValue >= 32 )
{
ExtTextInputAttr nTextAttr = ExtTextInputAttr::Underline;
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 5422d261d992..949fafd7252a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -6802,7 +6802,7 @@ void DomainMapper_Impl::CloseFieldCommand()
case FIELD_SYMBOL:
{
uno::Reference< text::XTextAppend > xTextAppend = m_aTextAppendStack.top().xTextAppend;
- OUString sSymbol( sal_Unicode( sFirstParam.startsWithIgnoreAsciiCase("0x") ? sFirstParam.copy(2).toUInt32(16) : sFirstParam.toUInt32() ) );
+ OUString sSymbol( sal_Unicode( sFirstParam.startsWithIgnoreAsciiCase("0x") ? o3tl::toUInt32(sFirstParam.subView(2),16) : sFirstParam.toUInt32() ) );
OUString sFont;
bool bHasFont = lcl_FindInCommand( pContext->GetCommand(), 'f', sFont);
if ( bHasFont )
diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx
index 2cc574c01b93..3b52f683b1e0 100644
--- a/xmlscript/source/xmldlg_imexp/imp_share.hxx
+++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx
@@ -36,6 +36,7 @@
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <osl/diagnose.h>
#include <rtl/ref.hxx>
+#include <o3tl/string_view.hxx>
#include <memory>
#include <vector>
@@ -46,7 +47,7 @@ inline sal_Int32 toInt32( OUString const & rStr )
{
sal_Int32 nVal;
if (rStr.getLength() > 2 && rStr[ 0 ] == '0' && rStr[ 1 ] == 'x')
- nVal = rStr.copy( 2 ).toUInt32( 16 );
+ nVal = o3tl::toUInt32(rStr.subView( 2 ), 16);
else
nVal = rStr.toInt32();
return nVal;
diff --git a/xmlscript/source/xmllib_imexp/imp_share.hxx b/xmlscript/source/xmllib_imexp/imp_share.hxx
index 5178a36a47cd..d9ec1c442402 100644
--- a/xmlscript/source/xmllib_imexp/imp_share.hxx
+++ b/xmlscript/source/xmllib_imexp/imp_share.hxx
@@ -26,6 +26,7 @@
#include <com/sun/star/xml/input/XRoot.hpp>
#include <com/sun/star/xml/sax/SAXException.hpp>
#include <rtl/ref.hxx>
+#include <o3tl/string_view.hxx>
#include <vector>
@@ -36,7 +37,7 @@ inline sal_Int32 toInt32( OUString const & rStr )
sal_Int32 nVal;
if (rStr.getLength() > 2 && rStr[ 0 ] == '0' && rStr[ 1 ] == 'x')
{
- nVal = rStr.copy( 2 ).toUInt32( 16 );
+ nVal = o3tl::toUInt32(rStr.subView( 2 ), 16);
}
else
{