summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configmgr/source/config_map.hxx6
-rw-r--r--configmgr/source/data.cxx11
-rw-r--r--connectivity/source/commontools/dbconversion.cxx4
-rw-r--r--connectivity/source/parse/sqlnode.cxx2
-rw-r--r--forms/source/xforms/convert.cxx4
-rw-r--r--i18npool/inc/nativenumbersupplier.hxx2
-rw-r--r--i18npool/inc/transliteration_Numeric.hxx2
-rw-r--r--i18npool/source/localedata/LocaleNode.cxx30
-rw-r--r--i18npool/source/localedata/LocaleNode.hxx12
-rw-r--r--i18npool/source/localedata/filewriter.cxx14
-rw-r--r--i18npool/source/nativenumber/nativenumbersupplier.cxx9
-rw-r--r--i18npool/source/transliteration/transliteration_Numeric.cxx6
-rw-r--r--i18nutil/source/utility/scripttypedetector.cxx22
-rw-r--r--idl/source/prj/parser.cxx8
-rw-r--r--include/connectivity/dbconversion.hxx2
-rw-r--r--include/connectivity/sqlnode.hxx2
-rw-r--r--include/i18nutil/scripttypedetector.hxx8
-rw-r--r--include/linguistic/misc.hxx8
-rw-r--r--include/svl/PasswordHelper.hxx8
-rw-r--r--include/svl/cryptosign.hxx2
-rw-r--r--include/svl/lngmisc.hxx2
-rw-r--r--include/unotools/configpaths.hxx6
-rw-r--r--include/unotools/datetime.hxx2
-rw-r--r--include/unotools/localedatawrapper.hxx4
-rw-r--r--linguistic/source/dicimp.cxx10
-rw-r--r--linguistic/source/dicimp.hxx6
-rw-r--r--linguistic/source/hhconvdic.cxx4
-rw-r--r--linguistic/source/misc.cxx26
-rw-r--r--sc/source/core/data/tabprotection.cxx4
-rw-r--r--sfx2/source/dialog/securitypage.cxx2
-rw-r--r--svl/source/crypto/cryptosign.cxx4
-rw-r--r--svl/source/misc/PasswordHelper.cxx12
-rw-r--r--svl/source/misc/lngmisc.cxx4
-rw-r--r--svl/source/misc/urihelper.cxx4
-rw-r--r--svl/source/passwordcontainer/passwordcontainer.cxx8
-rw-r--r--svl/source/passwordcontainer/passwordcontainer.hxx2
-rw-r--r--unotools/source/config/configitem.cxx4
-rw-r--r--unotools/source/config/configpaths.cxx21
-rw-r--r--unotools/source/i18n/localedatawrapper.cxx62
-rw-r--r--unotools/source/misc/datetime.cxx32
-rw-r--r--vcl/source/control/longcurr.cxx2
41 files changed, 193 insertions, 190 deletions
diff --git a/configmgr/source/config_map.hxx b/configmgr/source/config_map.hxx
index af15f23ae9cf..5d2990d5a0d8 100644
--- a/configmgr/source/config_map.hxx
+++ b/configmgr/source/config_map.hxx
@@ -19,12 +19,12 @@
struct LengthContentsCompare
{
- bool operator()(const OUString& a, const OUString& b) const
+ bool operator()(std::u16string_view a, std::u16string_view b) const
{
- if (a.getLength() == b.getLength())
+ if (a.size() == b.size())
return a < b;
else
- return a.getLength() < b.getLength();
+ return a.size() < b.size();
}
};
diff --git a/configmgr/source/data.cxx b/configmgr/source/data.cxx
index 6279e02cf096..518d08513ad6 100644
--- a/configmgr/source/data.cxx
+++ b/configmgr/source/data.cxx
@@ -30,6 +30,7 @@
#include <rtl/ustring.hxx>
#include <sal/log.hxx>
#include <sal/types.h>
+#include <o3tl/string_view.hxx>
#include "additions.hxx"
#include "data.hxx"
@@ -43,23 +44,23 @@ namespace configmgr {
namespace {
bool decode(
- OUString const & encoded, sal_Int32 begin, sal_Int32 end,
+ std::u16string_view encoded, sal_Int32 begin, sal_Int32 end,
OUString * decoded)
{
assert(
- begin >= 0 && begin <= end && end <= encoded.getLength() &&
+ begin >= 0 && begin <= end && end <= static_cast<sal_Int32>(encoded.size()) &&
decoded != nullptr);
OUStringBuffer buf(end - begin);
while (begin != end) {
sal_Unicode c = encoded[begin++];
if (c == '&') {
- if (encoded.match("amp;", begin)) {
+ if (o3tl::starts_with(encoded.substr(begin), u"amp;")) {
buf.append('&');
begin += RTL_CONSTASCII_LENGTH("amp;");
- } else if (encoded.match("quot;", begin)) {
+ } else if (o3tl::starts_with(encoded.substr(begin), u"quot;")) {
buf.append('"');
begin += RTL_CONSTASCII_LENGTH("quot;");
- } else if (encoded.match("apos;", begin)) {
+ } else if (o3tl::starts_with(encoded.substr(begin), u"apos;")) {
buf.append('\'');
begin += RTL_CONSTASCII_LENGTH("apos;");
} else {
diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx
index 289eb0c2de3e..af80efb60eb1 100644
--- a/connectivity/source/commontools/dbconversion.cxx
+++ b/connectivity/source/commontools/dbconversion.cxx
@@ -441,7 +441,7 @@ namespace dbtools
const sal_Unicode *const begin = p;
while (rtl::isAsciiWhiteSpace(*p)) { ++p; }
nSeparation += p - begin;
- aTime = toTime( _sSQLString.copy( nSeparation ) );
+ aTime = toTime( _sSQLString.subView( nSeparation ) );
}
return css::util::DateTime(aTime.NanoSeconds, aTime.Seconds, aTime.Minutes, aTime.Hours,
@@ -449,7 +449,7 @@ namespace dbtools
}
- css::util::Time DBTypeConversion::toTime(const OUString& _sSQLString)
+ css::util::Time DBTypeConversion::toTime(std::u16string_view _sSQLString)
{
css::util::Time aTime;
::utl::ISO8601parseTime(_sSQLString, aTime);
diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index 23a46246278d..c121eb05b474 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -234,7 +234,7 @@ OUString OSQLParseNode::convertDateTimeString(const SQLParseNodeParameter& rPara
}
-OUString OSQLParseNode::convertTimeString(const SQLParseNodeParameter& rParam, const OUString& rString)
+OUString OSQLParseNode::convertTimeString(const SQLParseNodeParameter& rParam, std::u16string_view rString)
{
css::util::Time aTime = DBTypeConversion::toTime(rString);
Reference< XNumberFormatsSupplier > xSupplier(rParam.xFormatter->getNumberFormatsSupplier());
diff --git a/forms/source/xforms/convert.cxx b/forms/source/xforms/convert.cxx
index 2dfab2d97eaa..773cbfd6f925 100644
--- a/forms/source/xforms/convert.cxx
+++ b/forms/source/xforms/convert.cxx
@@ -147,7 +147,7 @@ namespace
}
- css::util::Time lcl_toUNOTime( const OUString& rString )
+ css::util::Time lcl_toUNOTime( std::u16string_view rString )
{
css::util::Time aTime;
@@ -218,7 +218,7 @@ namespace
else
{
aDate = lcl_toUNODate( rString.copy( 0, nDateTimeSep ) );
- aTime = lcl_toUNOTime( rString.copy( nDateTimeSep + 1 ) );
+ aTime = lcl_toUNOTime( rString.subView( nDateTimeSep + 1 ) );
}
css::util::DateTime aDateTime(
aTime.NanoSeconds, aTime.Seconds, aTime.Minutes, aTime.Hours,
diff --git a/i18npool/inc/nativenumbersupplier.hxx b/i18npool/inc/nativenumbersupplier.hxx
index 01459ce9f7a5..61e336024da4 100644
--- a/i18npool/inc/nativenumbersupplier.hxx
+++ b/i18npool/inc/nativenumbersupplier.hxx
@@ -68,7 +68,7 @@ public:
const css::lang::Locale& rLocale,
sal_Int16 nNativeNumberMode,
css::uno::Sequence<sal_Int32>* pOffset,
- const OUString& rNativeNumberParams = OUString());
+ std::u16string_view rNativeNumberParams = std::u16string_view());
/// @throws css::uno::RuntimeException
static sal_Unicode getNativeNumberChar( const sal_Unicode inChar,
const css::lang::Locale& aLocale, sal_Int16 nNativeNumberMode ) ;
diff --git a/i18npool/inc/transliteration_Numeric.hxx b/i18npool/inc/transliteration_Numeric.hxx
index a01f505b929a..7c0d7ec95dfc 100644
--- a/i18npool/inc/transliteration_Numeric.hxx
+++ b/i18npool/inc/transliteration_Numeric.hxx
@@ -49,7 +49,7 @@ protected:
private:
/// @throws css::uno::RuntimeException
OUString
- transliterateBullet( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
+ transliterateBullet( std::u16string_view inStr, sal_Int32 startPos, sal_Int32 nCount,
css::uno::Sequence< sal_Int32 >* pOffset ) const;
};
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index f4c0aaefdc94..721f710151da 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -266,7 +266,7 @@ void LCInfoNode::generateCode (const OFileWriter &of) const
of.writeParameter("Variant", aVariant);
}
else
- of.writeParameter("Variant", OUString());
+ of.writeParameter("Variant", std::u16string_view());
of.writeAsciiString("\nstatic const sal_Unicode* LCInfoArray[] = {\n");
of.writeAsciiString("\tlangID,\n");
of.writeAsciiString("\tlangDefaultName,\n");
@@ -822,7 +822,7 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
if (n)
of.writeParameter("FormatDefaultName", n->getValue(), formatCount);
else
- of.writeParameter("FormatDefaultName", OUString(), formatCount);
+ of.writeParameter("FormatDefaultName", std::u16string_view(), formatCount);
}
@@ -1613,7 +1613,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const
}
}
if (!ref_name.isEmpty() && daysNode == nullptr) {
- of.writeParameter("dayRef", "ref", i);
+ of.writeParameter("dayRef", u"ref", i);
of.writeParameter("dayRefName", ref_name, i);
nbOfDays[i] = 0;
} else {
@@ -1646,7 +1646,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const
}
}
if (!ref_name.isEmpty() && monthsNode == nullptr) {
- of.writeParameter("monthRef", "ref", i);
+ of.writeParameter("monthRef", u"ref", i);
of.writeParameter("monthRefName", ref_name, i);
nbOfMonths[i] = 0;
} else {
@@ -1682,7 +1682,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const
}
}
if (!ref_name.isEmpty() && genitiveMonthsNode == nullptr) {
- of.writeParameter("genitiveMonthRef", "ref", i);
+ of.writeParameter("genitiveMonthRef", u"ref", i);
of.writeParameter("genitiveMonthRefName", ref_name, i);
nbOfGenitiveMonths[i] = 0;
} else {
@@ -1719,7 +1719,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const
}
}
if (!ref_name.isEmpty() && partitiveMonthsNode == nullptr) {
- of.writeParameter("partitiveMonthRef", "ref", i);
+ of.writeParameter("partitiveMonthRef", u"ref", i);
of.writeParameter("partitiveMonthRefName", ref_name, i);
nbOfPartitiveMonths[i] = 0;
} else {
@@ -1752,7 +1752,7 @@ void LCCalendarNode::generateCode (const OFileWriter &of) const
}
}
if (!ref_name.isEmpty() && erasNode == nullptr) {
- of.writeParameter("eraRef", "ref", i);
+ of.writeParameter("eraRef", u"ref", i);
of.writeParameter("eraRefName", ref_name, i);
nbOfEras[i] = 0;
} else {
@@ -2118,9 +2118,9 @@ void LCMiscNode::generateCode (const OFileWriter &of) const
of.writeParameter( "forbiddenEnd", forbidNode -> getChildAt(1)->getValue());
of.writeParameter( "hangingChars", forbidNode -> getChildAt(2)->getValue());
} else {
- of.writeParameter( "forbiddenBegin", OUString());
- of.writeParameter( "forbiddenEnd", OUString());
- of.writeParameter( "hangingChars", OUString());
+ of.writeParameter( "forbiddenBegin", std::u16string_view());
+ of.writeParameter( "forbiddenEnd", std::u16string_view());
+ of.writeParameter( "hangingChars", std::u16string_view());
}
of.writeAsciiString("\nstatic const sal_Unicode* LCForbiddenCharactersArray[] = {\n");
of.writeAsciiString("\tforbiddenBegin,\n");
@@ -2136,11 +2136,11 @@ void LCMiscNode::generateCode (const OFileWriter &of) const
of.writeParameter( "CharacterMode", breakNode -> getChildAt(3)->getValue());
of.writeParameter( "LineMode", breakNode -> getChildAt(4)->getValue());
} else {
- of.writeParameter( "EditMode", OUString());
- of.writeParameter( "DictionaryMode", OUString());
- of.writeParameter( "WordCountMode", OUString());
- of.writeParameter( "CharacterMode", OUString());
- of.writeParameter( "LineMode", OUString());
+ of.writeParameter( "EditMode", std::u16string_view());
+ of.writeParameter( "DictionaryMode", std::u16string_view());
+ of.writeParameter( "WordCountMode", std::u16string_view());
+ of.writeParameter( "CharacterMode", std::u16string_view());
+ of.writeParameter( "LineMode", std::u16string_view());
}
of.writeAsciiString("\nstatic const sal_Unicode* LCBreakIteratorRulesArray[] = {\n");
of.writeAsciiString("\tEditMode,\n");
diff --git a/i18npool/source/localedata/LocaleNode.hxx b/i18npool/source/localedata/LocaleNode.hxx
index bdd3eb62762e..f49b01d796f5 100644
--- a/i18npool/source/localedata/LocaleNode.hxx
+++ b/i18npool/source/localedata/LocaleNode.hxx
@@ -37,7 +37,7 @@ class OFileWriter
public:
OFileWriter(const char *pcFile, const char *locale );
~OFileWriter();
- void writeStringCharacters(const OUString& str) const;
+ void writeStringCharacters(std::u16string_view str) const;
void writeAsciiString(const char *str)const ;
void writeInt(sal_Int16 nb) const;
void writeFunction(const char *func, const char *count, const char *array) const;
@@ -50,11 +50,11 @@ public:
void writeRefFunction3(const char *func, std::u16string_view useLocale) const;
void writeIntParameter(const char* pAsciiStr, const sal_Int16 count, sal_Int16 val) const;
bool writeDefaultParameter(const char* pAsciiStr, std::u16string_view str, sal_Int16 count) const;
- void writeParameter(const char* pAsciiStr, const OUString& aChars) const;
- void writeParameter(const char* pAsciiStr, const OUString& aChars, sal_Int16 count) const;
- void writeParameter(const char* pAsciiStr, const OUString& aChars, sal_Int16 count0, sal_Int16 count1) const;
- void writeParameter(const char* pTagStr, const char* pAsciiStr, const OUString& aChars, const sal_Int16 count) const;
- void writeParameter(const char* pTagStr, const char* pAsciiStr, const OUString& aChars, sal_Int16 count0, sal_Int16 count1) const;
+ void writeParameter(const char* pAsciiStr, std::u16string_view aChars) const;
+ void writeParameter(const char* pAsciiStr, std::u16string_view aChars, sal_Int16 count) const;
+ void writeParameter(const char* pAsciiStr, std::u16string_view aChars, sal_Int16 count0, sal_Int16 count1) const;
+ void writeParameter(const char* pTagStr, const char* pAsciiStr, std::u16string_view aChars, const sal_Int16 count) const;
+ void writeParameter(const char* pTagStr, const char* pAsciiStr, std::u16string_view aChars, sal_Int16 count0, sal_Int16 count1) const;
void closeOutput() const;
/// Return the locale string, something like en_US or de_DE
const char * getLocale() const { return theLocale.c_str(); }
diff --git a/i18npool/source/localedata/filewriter.cxx b/i18npool/source/localedata/filewriter.cxx
index 4c095b14bc84..ca656a05b49d 100644
--- a/i18npool/source/localedata/filewriter.cxx
+++ b/i18npool/source/localedata/filewriter.cxx
@@ -44,9 +44,9 @@ void OFileWriter::writeAsciiString(const char* str) const
fprintf(m_f, "%s", str);
}
-void OFileWriter::writeStringCharacters(const OUString& str) const
+void OFileWriter::writeStringCharacters(std::u16string_view str) const
{
- for(int i = 0; i < str.getLength(); i++)
+ for(size_t i = 0; i < str.size(); i++)
fprintf(m_f, "0x%x, ", str[i]);
}
@@ -133,35 +133,35 @@ bool OFileWriter::writeDefaultParameter(const char* pAsciiStr, std::u16string_vi
return bBool;
}
-void OFileWriter::writeParameter(const char* pAsciiStr, const OUString& aChars) const
+void OFileWriter::writeParameter(const char* pAsciiStr, std::u16string_view aChars) const
{
fprintf(m_f, "static const sal_Unicode %s[] = {", pAsciiStr);
writeStringCharacters(aChars);
fprintf(m_f, "0x0};\n");
}
-void OFileWriter::writeParameter(const char* pAsciiStr, const OUString& aChars, sal_Int16 count) const
+void OFileWriter::writeParameter(const char* pAsciiStr, std::u16string_view aChars, sal_Int16 count) const
{
fprintf(m_f, "static const sal_Unicode %s%d[] = {", pAsciiStr, count);
writeStringCharacters(aChars);
fprintf(m_f, "0x0};\n");
}
-void OFileWriter::writeParameter(const char* pAsciiStr, const OUString& aChars, sal_Int16 count0, sal_Int16 count1) const
+void OFileWriter::writeParameter(const char* pAsciiStr, std::u16string_view aChars, sal_Int16 count0, sal_Int16 count1) const
{
fprintf(m_f, "static const sal_Unicode %s%d%d[] = {", pAsciiStr, count0, count1);
writeStringCharacters(aChars);
fprintf(m_f, "0x0};\n");
}
-void OFileWriter::writeParameter(const char* pTagStr, const char* pAsciiStr, const OUString& aChars, const sal_Int16 count) const
+void OFileWriter::writeParameter(const char* pTagStr, const char* pAsciiStr, std::u16string_view aChars, const sal_Int16 count) const
{
fprintf(m_f, "static const sal_Unicode %s%s%d[] = {", pTagStr, pAsciiStr, count);
writeStringCharacters(aChars);
fprintf(m_f, "0x0};\n");
}
-void OFileWriter::writeParameter(const char* pTagStr, const char* pAsciiStr, const OUString& aChars, sal_Int16 count0, sal_Int16 count1) const
+void OFileWriter::writeParameter(const char* pTagStr, const char* pAsciiStr, std::u16string_view aChars, sal_Int16 count0, sal_Int16 count1) const
{
fprintf(m_f, "static const sal_Unicode %s%s%d%d[] = {", pTagStr, pAsciiStr, count0, count1);
writeStringCharacters(aChars);
diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx
index c3c1cc6139ff..0f5c74f8bd56 100644
--- a/i18npool/source/nativenumber/nativenumbersupplier.cxx
+++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx
@@ -26,6 +26,7 @@
#include "data/numberchar.h"
#include <comphelper/processfactory.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <o3tl/string_view.hxx>
#include <map>
#include <mutex>
#include <memory>
@@ -637,7 +638,7 @@ OUString getNumberText(const Locale& rLocale, const OUString& rNumberString,
OUString NativeNumberSupplierService::getNativeNumberString(const OUString& aNumberString, const Locale& rLocale,
sal_Int16 nNativeNumberMode,
Sequence<sal_Int32>* pOffset,
- const OUString& rNativeNumberParams)
+ std::u16string_view rNativeNumberParams)
{
if (!isValidNatNumImpl(rLocale, nNativeNumberMode))
return aNumberString;
@@ -672,17 +673,17 @@ OUString NativeNumberSupplierService::getNativeNumberString(const OUString& aNum
size_t nCasing;
for (nCasing = 0; nCasing < SAL_N_ELEMENTS(Casings); ++nCasing)
{
- if (rNativeNumberParams.startsWith( Casings[nCasing].aLiteral))
+ if (o3tl::starts_with(rNativeNumberParams, Casings[nCasing].aLiteral))
{
nStripCase = Casings[nCasing].aLiteral.size();
break;
}
}
- if (nStripCase > 0 && (rNativeNumberParams.getLength() == nStripCase ||
+ if (nStripCase > 0 && (static_cast<sal_Int32>(rNativeNumberParams.size()) == nStripCase ||
rNativeNumberParams[nStripCase++] == ' '))
{
- OUString aStr = getNumberText(rLocale, aNumberString, rNativeNumberParams.subView(nStripCase));
+ OUString aStr = getNumberText(rLocale, aNumberString, rNativeNumberParams.substr(nStripCase));
if (!xCharClass.is())
xCharClass = CharacterClassification::create(comphelper::getProcessComponentContext());
diff --git a/i18npool/source/transliteration/transliteration_Numeric.cxx b/i18npool/source/transliteration/transliteration_Numeric.cxx
index 57c5b7e9942b..e0717379ed4c 100644
--- a/i18npool/source/transliteration/transliteration_Numeric.cxx
+++ b/i18npool/source/transliteration/transliteration_Numeric.cxx
@@ -58,13 +58,13 @@ Sequence< OUString > SAL_CALL
#define NUMBER_ZERO 0x30
OUString
-transliteration_Numeric::transliterateBullet( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
+transliteration_Numeric::transliterateBullet( std::u16string_view inStr, sal_Int32 startPos, sal_Int32 nCount,
Sequence< sal_Int32 >* pOffset ) const
{
sal_Int32 number = -1, j = 0, endPos = startPos + nCount;
- if (endPos > inStr.getLength())
- endPos = inStr.getLength();
+ if (endPos > static_cast<sal_Int32>(inStr.size()))
+ endPos = inStr.size();
rtl_uString* pStr = rtl_uString_alloc(nCount);
sal_Unicode* out = pStr->buffer;
diff --git a/i18nutil/source/utility/scripttypedetector.cxx b/i18nutil/source/utility/scripttypedetector.cxx
index a2796e42a562..bea0714f375b 100644
--- a/i18nutil/source/utility/scripttypedetector.cxx
+++ b/i18nutil/source/utility/scripttypedetector.cxx
@@ -54,11 +54,11 @@ sal_Int16 ScriptTypeDetector::getScriptDirection( std::u16string_view Text, sal_
}
// return value '-1' means either the direction on nPos is not same as scriptDirection or nPos is out of range.
-sal_Int32 ScriptTypeDetector::beginOfScriptDirection( const OUString& Text, sal_Int32 nPos, sal_Int16 direction )
+sal_Int32 ScriptTypeDetector::beginOfScriptDirection( std::u16string_view Text, sal_Int32 nPos, sal_Int16 direction )
{
sal_Int32 cPos = nPos;
- if (cPos < Text.getLength()) {
+ if (cPos < static_cast<sal_Int32>(Text.size())) {
for (; cPos >= 0; cPos--) {
if (direction != getScriptDirection(Text, cPos, direction))
break;
@@ -67,10 +67,10 @@ sal_Int32 ScriptTypeDetector::beginOfScriptDirection( const OUString& Text, sal_
return cPos == nPos ? -1 : cPos + 1;
}
-sal_Int32 ScriptTypeDetector::endOfScriptDirection( const OUString& Text, sal_Int32 nPos, sal_Int16 direction )
+sal_Int32 ScriptTypeDetector::endOfScriptDirection( std::u16string_view Text, sal_Int32 nPos, sal_Int16 direction )
{
sal_Int32 cPos = nPos;
- sal_Int32 len = Text.getLength();
+ sal_Int32 len = Text.size();
if (cPos >=0) {
for (; cPos < len; cPos++) {
@@ -95,12 +95,12 @@ sal_Int16 ScriptTypeDetector::getCTLScriptType( std::u16string_view Text, sal_In
}
// Begin of Script Type is inclusive.
-sal_Int32 ScriptTypeDetector::beginOfCTLScriptType( const OUString& Text, sal_Int32 nPos )
+sal_Int32 ScriptTypeDetector::beginOfCTLScriptType( std::u16string_view Text, sal_Int32 nPos )
{
if (nPos < 0)
return 0;
- else if (nPos >= Text.getLength())
- return Text.getLength();
+ else if (nPos >= static_cast<sal_Int32>(Text.size()))
+ return Text.size();
else {
sal_Int16 cType = getCTLScriptType(Text, nPos);
for (nPos--; nPos >= 0; nPos--) {
@@ -112,15 +112,15 @@ sal_Int32 ScriptTypeDetector::beginOfCTLScriptType( const OUString& Text, sal_In
}
// End of the Script Type is exclusive, the return value pointing to the begin of next script type
-sal_Int32 ScriptTypeDetector::endOfCTLScriptType( const OUString& Text, sal_Int32 nPos )
+sal_Int32 ScriptTypeDetector::endOfCTLScriptType( std::u16string_view Text, sal_Int32 nPos )
{
if (nPos < 0)
return 0;
- else if (nPos >= Text.getLength())
- return Text.getLength();
+ else if (nPos >= static_cast<sal_Int32>(Text.size()))
+ return Text.size();
else {
sal_Int16 cType = getCTLScriptType(Text, nPos);
- sal_Int32 len = Text.getLength();
+ sal_Int32 len = Text.size();
for (nPos++; nPos < len; nPos++) {
if (cType != getCTLScriptType(Text, nPos))
break;
diff --git a/idl/source/prj/parser.cxx b/idl/source/prj/parser.cxx
index 3e53e9d35d93..31bbee9a9d85 100644
--- a/idl/source/prj/parser.cxx
+++ b/idl/source/prj/parser.cxx
@@ -233,9 +233,9 @@ void SvIdlParser::ReadEnum()
rBase.GetTypeList().push_back( xEnum.get() );
}
-static OString getCommonSubPrefix(const OString &rA, const OString &rB)
+static std::string_view getCommonSubPrefix(std::string_view rA, std::string_view rB)
{
- sal_Int32 nMax = std::min(rA.getLength(), rB.getLength());
+ sal_Int32 nMax = std::min(rA.size(), rB.size());
sal_Int32 nI = 0;
while (nI < nMax)
{
@@ -243,7 +243,7 @@ static OString getCommonSubPrefix(const OString &rA, const OString &rB)
break;
++nI;
}
- return rA.copy(0, nI);
+ return rA.substr(0, nI);
}
void SvIdlParser::ReadEnumValue( SvMetaTypeEnum& rEnum )
@@ -257,7 +257,7 @@ void SvIdlParser::ReadEnumValue( SvMetaTypeEnum& rEnum )
}
else
{
- rEnum.aPrefix = getCommonSubPrefix(rEnum.aPrefix, aEnumVal->GetName());
+ rEnum.aPrefix = OString(getCommonSubPrefix(rEnum.aPrefix, aEnumVal->GetName()));
}
rEnum.aEnumValueList.push_back( aEnumVal.get() );
}
diff --git a/include/connectivity/dbconversion.hxx b/include/connectivity/dbconversion.hxx
index c73444a99515..e9471344cea9 100644
--- a/include/connectivity/dbconversion.hxx
+++ b/include/connectivity/dbconversion.hxx
@@ -91,7 +91,7 @@ namespace dbtools::DBTypeConversion
OOO_DLLPUBLIC_DBTOOLS css::util::Date toDate(double dVal, const css::util::Date& _rNullDate = getStandardDate());
OOO_DLLPUBLIC_DBTOOLS css::util::Date toDate(std::u16string_view _sSQLDate);
OOO_DLLPUBLIC_DBTOOLS css::util::Time toTime(double dVal, short nDigits = 9);
- OOO_DLLPUBLIC_DBTOOLS css::util::Time toTime(const OUString& _sSQLDate);
+ OOO_DLLPUBLIC_DBTOOLS css::util::Time toTime(std::u16string_view _sSQLDate);
OOO_DLLPUBLIC_DBTOOLS css::util::DateTime toDateTime(double dVal, const css::util::Date& _rNullDate = getStandardDate());
OOO_DLLPUBLIC_DBTOOLS css::util::DateTime toDateTime(const OUString& _sSQLDate);
diff --git a/include/connectivity/sqlnode.hxx b/include/connectivity/sqlnode.hxx
index 203679d25dcf..3bd9327e1ce7 100644
--- a/include/connectivity/sqlnode.hxx
+++ b/include/connectivity/sqlnode.hxx
@@ -426,7 +426,7 @@ namespace connectivity
bool addDateValue(OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const;
static OUString convertDateTimeString(const SQLParseNodeParameter& rParam, const OUString& rString);
static OUString convertDateString(const SQLParseNodeParameter& rParam, std::u16string_view rString);
- static OUString convertTimeString(const SQLParseNodeParameter& rParam, const OUString& rString);
+ static OUString convertTimeString(const SQLParseNodeParameter& rParam, std::u16string_view rString);
void parseLeaf(OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const;
};
diff --git a/include/i18nutil/scripttypedetector.hxx b/include/i18nutil/scripttypedetector.hxx
index fd098f9e7f32..a3d4d8ed2ff7 100644
--- a/include/i18nutil/scripttypedetector.hxx
+++ b/include/i18nutil/scripttypedetector.hxx
@@ -25,11 +25,11 @@
class I18NUTIL_DLLPUBLIC ScriptTypeDetector
{
public:
- static sal_Int32 beginOfScriptDirection( const OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection );
- static sal_Int32 endOfScriptDirection( const OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection );
+ static sal_Int32 beginOfScriptDirection( std::u16string_view Text, sal_Int32 nPos, sal_Int16 scriptDirection );
+ static sal_Int32 endOfScriptDirection( std::u16string_view Text, sal_Int32 nPos, sal_Int16 scriptDirection );
static sal_Int16 getScriptDirection( std::u16string_view Text, sal_Int32 nPos, sal_Int16 defaultScriptDirection );
- static sal_Int32 beginOfCTLScriptType( const OUString& Text, sal_Int32 nPos );
- static sal_Int32 endOfCTLScriptType( const OUString& Text, sal_Int32 nPos );
+ static sal_Int32 beginOfCTLScriptType( std::u16string_view Text, sal_Int32 nPos );
+ static sal_Int32 endOfCTLScriptType( std::u16string_view Text, sal_Int32 nPos );
static sal_Int16 getCTLScriptType(std::u16string_view Text, sal_Int32 nPos );
};
diff --git a/include/linguistic/misc.hxx b/include/linguistic/misc.hxx
index 21da5776a690..02b3d44b3fb4 100644
--- a/include/linguistic/misc.hxx
+++ b/include/linguistic/misc.hxx
@@ -76,7 +76,7 @@ LNG_DLLPUBLIC ::osl::Mutex& GetLinguMutex();
const LocaleDataWrapper & GetLocaleDataWrapper( LanguageType nLang );
-sal_Int32 LevDistance( const OUString &rTxt1, const OUString &rTxt2 );
+sal_Int32 LevDistance( std::u16string_view rTxt1, std::u16string_view rTxt2 );
/** Convert Locale to LanguageType for legacy handling.
Linguistic specific handling of an empty locale denoting LANGUAGE_NONE.
@@ -98,7 +98,7 @@ LNG_DLLPUBLIC bool LinguIsUnspecified( LanguageType nLanguage );
/** The same as LinguIsUnspecified(LanguageType) but taking a BCP 47 language
tag string instead. */
-LNG_DLLPUBLIC bool LinguIsUnspecified( const OUString & rBcp47 );
+LNG_DLLPUBLIC bool LinguIsUnspecified( std::u16string_view rBcp47 );
std::vector< LanguageType >
LocaleSeqToLangVec( css::uno::Sequence< css::lang::Locale > const &rLocaleSeq );
@@ -120,7 +120,7 @@ std::vector< OUString > GetDictionaryPaths();
/// The URL will point to the path given by 'GetDictionaryWriteablePath'
LNG_DLLPUBLIC OUString GetWritableDictionaryURL( std::u16string_view rDicName );
-LNG_DLLPUBLIC sal_Int32 GetPosInWordToCheck( const OUString &rTxt, sal_Int32 nPos );
+LNG_DLLPUBLIC sal_Int32 GetPosInWordToCheck( std::u16string_view rTxt, sal_Int32 nPos );
css::uno::Reference< css::linguistic2::XHyphenatedWord >
RebuildHyphensAndControlChars(
@@ -134,7 +134,7 @@ inline bool IsUpper( const OUString &rText, LanguageType nLanguage )
LNG_DLLPUBLIC CapType capitalType(const OUString&, CharClass const *);
LNG_DLLPUBLIC bool HasDigits( const OUString &rText );
-LNG_DLLPUBLIC bool IsNumeric( const OUString &rText );
+LNG_DLLPUBLIC bool IsNumeric( std::u16string_view rText );
LNG_DLLPUBLIC css::uno::Reference< css::linguistic2::XLinguProperties > GetLinguProperties();
diff --git a/include/svl/PasswordHelper.hxx b/include/svl/PasswordHelper.hxx
index 7bc97f3fcae6..aa7e55867343 100644
--- a/include/svl/PasswordHelper.hxx
+++ b/include/svl/PasswordHelper.hxx
@@ -30,13 +30,13 @@
class SvPasswordHelper
{
- static void GetHashPasswordLittleEndian(css::uno::Sequence<sal_Int8>& rPassHash, const OUString& sPass);
- static void GetHashPasswordBigEndian(css::uno::Sequence<sal_Int8>& rPassHash, const OUString& sPass);
+ static void GetHashPasswordLittleEndian(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
+ static void GetHashPasswordBigEndian(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
public:
SVL_DLLPUBLIC static void GetHashPassword(css::uno::Sequence <sal_Int8>& rPassHash, const char* pPass, sal_uInt32 nLen);
- SVL_DLLPUBLIC static void GetHashPassword(css::uno::Sequence<sal_Int8>& rPassHash, const OUString& sPass);
+ SVL_DLLPUBLIC static void GetHashPassword(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
SVL_DLLPUBLIC static void GetHashPasswordSHA1UTF8(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
SVL_DLLPUBLIC static void GetHashPasswordSHA256(css::uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass);
/**
@@ -47,7 +47,7 @@ public:
tdf#115483: also check 2 different new ways of hashing that were added in
ODF 1.2, requiring UTF-8 encoding.
*/
- SVL_DLLPUBLIC static bool CompareHashPassword(const css::uno::Sequence<sal_Int8>& rOldPassHash, const OUString& sNewPass);
+ SVL_DLLPUBLIC static bool CompareHashPassword(const css::uno::Sequence<sal_Int8>& rOldPassHash, std::u16string_view sNewPass);
};
#endif
diff --git a/include/svl/cryptosign.hxx b/include/svl/cryptosign.hxx
index fbc6121ff49d..5c971cc99f07 100644
--- a/include/svl/cryptosign.hxx
+++ b/include/svl/cryptosign.hxx
@@ -40,7 +40,7 @@ struct SignatureInformation;
namespace svl::crypto {
/// Converts a hex-encoded string into a byte array.
-SVL_DLLPUBLIC std::vector<unsigned char> DecodeHexString(const OString& rHex);
+SVL_DLLPUBLIC std::vector<unsigned char> DecodeHexString(std::string_view rHex);
/// Helper to cryptographically sign and verify
/// arbitrary data blocks.
diff --git a/include/svl/lngmisc.hxx b/include/svl/lngmisc.hxx
index 46045c13fc2e..eb7b7cbbe3c7 100644
--- a/include/svl/lngmisc.hxx
+++ b/include/svl/lngmisc.hxx
@@ -43,7 +43,7 @@ namespace linguistic
return cChar < u' ';
}
- sal_Int32 GetNumControlChars( const OUString &rTxt );
+ sal_Int32 GetNumControlChars( std::u16string_view rTxt );
SVL_DLLPUBLIC bool RemoveHyphens(OUString &rTxt);
SVL_DLLPUBLIC bool RemoveControlChars(OUString &rTxt);
diff --git a/include/unotools/configpaths.hxx b/include/unotools/configpaths.hxx
index d24e8537eb75..15bc7118efa4 100644
--- a/include/unotools/configpaths.hxx
+++ b/include/unotools/configpaths.hxx
@@ -95,8 +95,8 @@ namespace utl
If both paths are equal <TRUE/> is returned.
*/
- bool isPrefixOfConfigurationPath(OUString const& _sNestedPath,
- OUString const& _sPrefixPath);
+ bool isPrefixOfConfigurationPath(std::u16string_view _sNestedPath,
+ std::u16string_view _sPrefixPath);
/** get the relative path to a nested node with respect to a parent path.
@@ -120,7 +120,7 @@ namespace utl
*/
UNOTOOLS_DLLPUBLIC OUString dropPrefixFromConfigurationPath(OUString const& _sNestedPath,
- OUString const& _sPrefixPath);
+ std::u16string_view _sPrefixPath);
/** Create a one-level relative configuration path from a set element name
without a known set element type.
diff --git a/include/unotools/datetime.hxx b/include/unotools/datetime.hxx
index 0871edb31162..961d34c0886c 100644
--- a/include/unotools/datetime.hxx
+++ b/include/unotools/datetime.hxx
@@ -50,7 +50,7 @@ namespace utl
UNOTOOLS_DLLPUBLIC OUString toISO8601(const css::util::DateTime& _rDateTime);
UNOTOOLS_DLLPUBLIC bool ISO8601parseDateTime(const OUString &i_rIn, css::util::DateTime& o_rDateTime);
UNOTOOLS_DLLPUBLIC bool ISO8601parseDate(const OUString &i_rIn, css::util::Date& o_rDate);
- UNOTOOLS_DLLPUBLIC bool ISO8601parseTime(const OUString &i_rIn, css::util::Time& o_Time);
+ UNOTOOLS_DLLPUBLIC bool ISO8601parseTime(std::u16string_view i_rIn, css::util::Time& o_Time);
} // namespace utl
diff --git a/include/unotools/localedatawrapper.hxx b/include/unotools/localedatawrapper.hxx
index 46a657356085..8ca9167a0add 100644
--- a/include/unotools/localedatawrapper.hxx
+++ b/include/unotools/localedatawrapper.hxx
@@ -107,7 +107,7 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper
sal_Int32& nBlank, sal_Int32& nSym ) const;
void loadDateOrders();
- LongDateOrder scanDateOrderImpl( const OUString& rCode ) const;
+ LongDateOrder scanDateOrderImpl( std::u16string_view rCode ) const;
void ImplAddFormatNum( rtl::OUStringBuffer& rBuf,
sal_Int64 nNumber, sal_uInt16 nDecimals,
@@ -329,7 +329,7 @@ public:
/// "Secure" currency formatted string.
OUString getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
- const OUString& rCurrencySymbol,
+ std::u16string_view rCurrencySymbol,
bool bUseThousandSep = true ) const;
// dummy returns, to be implemented
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index d37990824f34..627cb2dd505b 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -499,8 +499,8 @@ void DictionaryNeo::launchEvent(sal_Int16 nEvent,
aDicEvtListeners.notifyEach( &XDictionaryEventListener::processDictionaryEvent, aEvt);
}
-int DictionaryNeo::cmpDicEntry(const OUString& rWord1,
- const OUString &rWord2,
+int DictionaryNeo::cmpDicEntry(std::u16string_view rWord1,
+ std::u16string_view rWord2,
bool bSimilarOnly)
{
MutexGuard aGuard( GetLinguMutex() );
@@ -511,8 +511,8 @@ int DictionaryNeo::cmpDicEntry(const OUString& rWord1,
int nRes = 0;
- sal_Int32 nLen1 = rWord1.getLength(),
- nLen2 = rWord2.getLength();
+ sal_Int32 nLen1 = rWord1.size(),
+ nLen2 = rWord2.size();
if (bSimilarOnly)
{
const sal_Unicode cChar = '.';
@@ -611,7 +611,7 @@ int DictionaryNeo::cmpDicEntry(const OUString& rWord1,
return nRes;
}
-bool DictionaryNeo::seekEntry(const OUString &rWord,
+bool DictionaryNeo::seekEntry(std::u16string_view rWord,
sal_Int32 *pPos, bool bSimilarOnly)
{
// look for entry with binary search.
diff --git a/linguistic/source/dicimp.hxx b/linguistic/source/dicimp.hxx
index fdef09909519..cec1e1866ed3 100644
--- a/linguistic/source/dicimp.hxx
+++ b/linguistic/source/dicimp.hxx
@@ -63,10 +63,10 @@ class DictionaryNeo :
ErrCode loadEntries(const OUString &rMainURL);
ErrCode saveEntries(const OUString &rMainURL);
- static int cmpDicEntry(const OUString &rWord1,
- const OUString &rWord2,
+ static int cmpDicEntry(std::u16string_view rWord1,
+ std::u16string_view rWord2,
bool bSimilarOnly = false);
- bool seekEntry(const OUString &rWord, sal_Int32 *pPos,
+ bool seekEntry(std::u16string_view rWord, sal_Int32 *pPos,
bool bSimilarOnly = false);
bool isSorted();
diff --git a/linguistic/source/hhconvdic.cxx b/linguistic/source/hhconvdic.cxx
index 76349a4d76ef..d20088a10e73 100644
--- a/linguistic/source/hhconvdic.cxx
+++ b/linguistic/source/hhconvdic.cxx
@@ -63,9 +63,9 @@ static sal_Int16 checkScriptType(sal_Unicode c)
}
-static bool TextIsAllScriptType( const OUString &rTxt, sal_Int16 nScriptType )
+static bool TextIsAllScriptType( std::u16string_view rTxt, sal_Int16 nScriptType )
{
- for (sal_Int32 i = 0; i < rTxt.getLength(); ++i)
+ for (size_t i = 0; i < rTxt.size(); ++i)
{
if (checkScriptType( rTxt[i]) != nScriptType)
return false;
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index c1e4cc7757d0..411361d38d66 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -96,11 +96,11 @@ bool LinguIsUnspecified( LanguageType nLanguage )
// For mappings between language code string and LanguageType see
// i18nlangtag/source/isolang/isolang.cxx
-bool LinguIsUnspecified( const OUString & rBcp47 )
+bool LinguIsUnspecified( std::u16string_view rBcp47 )
{
- if (rBcp47.getLength() != 3)
+ if (rBcp47.size() != 3)
return false;
- return rBcp47 == "zxx" || rBcp47 == "und" || rBcp47 == "mul";
+ return rBcp47 == u"zxx" || rBcp47 == u"und" || rBcp47 == u"mul";
}
static sal_Int32 Minimum( sal_Int32 n1, sal_Int32 n2, sal_Int32 n3 )
@@ -139,10 +139,10 @@ sal_Int32 & IntArray2D::Value( int i, int k )
return pData[ i * n2 + k ];
}
-sal_Int32 LevDistance( const OUString &rTxt1, const OUString &rTxt2 )
+sal_Int32 LevDistance( std::u16string_view rTxt1, std::u16string_view rTxt2 )
{
- sal_Int32 nLen1 = rTxt1.getLength();
- sal_Int32 nLen2 = rTxt2.getLength();
+ sal_Int32 nLen1 = rTxt1.size();
+ sal_Int32 nLen2 = rTxt2.size();
if (nLen1 == 0)
return nLen2;
@@ -463,9 +463,9 @@ static bool GetAltSpelling( sal_Int16 &rnChgPos, sal_Int16 &rnChgLen, OUString &
return bRes;
}
-static sal_Int16 GetOrigWordPos( const OUString &rOrigWord, sal_Int16 nPos )
+static sal_Int16 GetOrigWordPos( std::u16string_view rOrigWord, sal_Int16 nPos )
{
- sal_Int32 nLen = rOrigWord.getLength();
+ sal_Int32 nLen = rOrigWord.size();
sal_Int32 i = -1;
while (nPos >= 0 && i++ < nLen)
{
@@ -477,10 +477,10 @@ static sal_Int16 GetOrigWordPos( const OUString &rOrigWord, sal_Int16 nPos )
return sal::static_int_cast< sal_Int16 >((0 <= i && i < nLen) ? i : -1);
}
-sal_Int32 GetPosInWordToCheck( const OUString &rTxt, sal_Int32 nPos )
+sal_Int32 GetPosInWordToCheck( std::u16string_view rTxt, sal_Int32 nPos )
{
sal_Int32 nRes = -1;
- sal_Int32 nLen = rTxt.getLength();
+ sal_Int32 nLen = rTxt.size();
if (0 <= nPos && nPos < nLen)
{
nRes = 0;
@@ -645,12 +645,12 @@ bool HasDigits( const OUString &rText )
return false;
}
-bool IsNumeric( const OUString &rText )
+bool IsNumeric( std::u16string_view rText )
{
bool bRes = false;
- if (!rText.isEmpty())
+ if (!rText.empty())
{
- sal_Int32 nLen = rText.getLength();
+ sal_Int32 nLen = rText.size();
bRes = true;
for(sal_Int32 i = 0; i < nLen; ++i)
{
diff --git a/sc/source/core/data/tabprotection.cxx b/sc/source/core/data/tabprotection.cxx
index d005d5d5d961..12bfff06b8e9 100644
--- a/sc/source/core/data/tabprotection.cxx
+++ b/sc/source/core/data/tabprotection.cxx
@@ -111,7 +111,7 @@ ScPassHashProtectable::~ScPassHashProtectable()
class ScTableProtectionImpl
{
public:
- static Sequence<sal_Int8> hashPassword(const OUString& aPassText, ScPasswordHash eHash);
+ static Sequence<sal_Int8> hashPassword(std::u16string_view aPassText, ScPasswordHash eHash);
static Sequence<sal_Int8> hashPassword(const Sequence<sal_Int8>& rPassHash, ScPasswordHash eHash);
explicit ScTableProtectionImpl(SCSIZE nOptSize);
@@ -155,7 +155,7 @@ private:
::std::vector< ScEnhancedProtection > maEnhancedProtection;
};
-Sequence<sal_Int8> ScTableProtectionImpl::hashPassword(const OUString& aPassText, ScPasswordHash eHash)
+Sequence<sal_Int8> ScTableProtectionImpl::hashPassword(std::u16string_view aPassText, ScPasswordHash eHash)
{
Sequence<sal_Int8> aHash;
switch (eHash)
diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx
index 43ef5115908b..0ff73b44f6f9 100644
--- a/sfx2/source/dialog/securitypage.cxx
+++ b/sfx2/source/dialog/securitypage.cxx
@@ -105,7 +105,7 @@ static bool lcl_GetPassword(
}
-static bool lcl_IsPasswordCorrect( const OUString &rPassword )
+static bool lcl_IsPasswordCorrect( std::u16string_view rPassword )
{
bool bRes = false;
diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx
index 4596eeb167dd..ff8120ede34a 100644
--- a/svl/source/crypto/cryptosign.cxx
+++ b/svl/source/crypto/cryptosign.cxx
@@ -879,10 +879,10 @@ static int AsHex(char ch)
return nRet;
}
-std::vector<unsigned char> DecodeHexString(const OString& rHex)
+std::vector<unsigned char> DecodeHexString(std::string_view rHex)
{
std::vector<unsigned char> aRet;
- size_t nHexLen = rHex.getLength();
+ size_t nHexLen = rHex.size();
{
int nByte = 0;
int nCount = 2;
diff --git a/svl/source/misc/PasswordHelper.cxx b/svl/source/misc/PasswordHelper.cxx
index 047d0b09b88b..41d7bf1ea68b 100644
--- a/svl/source/misc/PasswordHelper.cxx
+++ b/svl/source/misc/PasswordHelper.cxx
@@ -58,9 +58,9 @@ void SvPasswordHelper::GetHashPassword(uno::Sequence<sal_Int8>& rPassHash, const
}
}
-void SvPasswordHelper::GetHashPasswordLittleEndian(uno::Sequence<sal_Int8>& rPassHash, const OUString& sPass)
+void SvPasswordHelper::GetHashPasswordLittleEndian(uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass)
{
- sal_Int32 nSize(sPass.getLength());
+ sal_Int32 nSize(sPass.size());
std::unique_ptr<char[]> pCharBuffer(new char[nSize * sizeof(sal_Unicode)]);
for (sal_Int32 i = 0; i < nSize; ++i)
@@ -74,9 +74,9 @@ void SvPasswordHelper::GetHashPasswordLittleEndian(uno::Sequence<sal_Int8>& rPas
rtl_secureZeroMemory(pCharBuffer.get(), nSize * sizeof(sal_Unicode));
}
-void SvPasswordHelper::GetHashPasswordBigEndian(uno::Sequence<sal_Int8>& rPassHash, const OUString& sPass)
+void SvPasswordHelper::GetHashPasswordBigEndian(uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass)
{
- sal_Int32 nSize(sPass.getLength());
+ sal_Int32 nSize(sPass.size());
std::unique_ptr<char[]> pCharBuffer(new char[nSize * sizeof(sal_Unicode)]);
for (sal_Int32 i = 0; i < nSize; ++i)
@@ -90,12 +90,12 @@ void SvPasswordHelper::GetHashPasswordBigEndian(uno::Sequence<sal_Int8>& rPassHa
rtl_secureZeroMemory(pCharBuffer.get(), nSize * sizeof(sal_Unicode));
}
-void SvPasswordHelper::GetHashPassword(uno::Sequence<sal_Int8>& rPassHash, const OUString& sPass)
+void SvPasswordHelper::GetHashPassword(uno::Sequence<sal_Int8>& rPassHash, std::u16string_view sPass)
{
GetHashPasswordLittleEndian(rPassHash, sPass);
}
-bool SvPasswordHelper::CompareHashPassword(const uno::Sequence<sal_Int8>& rOldPassHash, const OUString& sNewPass)
+bool SvPasswordHelper::CompareHashPassword(const uno::Sequence<sal_Int8>& rOldPassHash, std::u16string_view sNewPass)
{
bool bResult = false;
diff --git a/svl/source/misc/lngmisc.cxx b/svl/source/misc/lngmisc.cxx
index 4224a14429a5..7ccf0aed7215 100644
--- a/svl/source/misc/lngmisc.cxx
+++ b/svl/source/misc/lngmisc.cxx
@@ -26,10 +26,10 @@
namespace linguistic
{
- sal_Int32 GetNumControlChars(const OUString &rTxt)
+ sal_Int32 GetNumControlChars(std::u16string_view rTxt)
{
sal_Int32 nCnt = 0;
- for (sal_Int32 i = 0; i < rTxt.getLength(); ++i)
+ for (size_t i = 0; i < rTxt.size(); ++i)
if (IsControlChar(rTxt[i]))
++nCnt;
return nCnt;
diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx
index af92a9d41fe2..e5ddbc37a93e 100644
--- a/svl/source/misc/urihelper.cxx
+++ b/svl/source/misc/urihelper.cxx
@@ -282,10 +282,10 @@ OUString URIHelper::simpleNormalizedMakeRelative(
namespace {
-sal_Int32 nextChar(OUString const & rStr, sal_Int32 nPos)
+sal_Int32 nextChar(std::u16string_view rStr, sal_Int32 nPos)
{
return rtl::isHighSurrogate(rStr[nPos])
- && rStr.getLength() - nPos >= 2
+ && rStr.size() - nPos >= 2
&& rtl::isLowSurrogate(rStr[nPos + 1]) ?
nPos + 2 : nPos + 1;
}
diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx
index 4dd36e732108..04eb0951f0ac 100644
--- a/svl/source/passwordcontainer/passwordcontainer.cxx
+++ b/svl/source/passwordcontainer/passwordcontainer.cxx
@@ -165,11 +165,11 @@ static OUString getAsciiLine( const ::rtl::ByteSequence& buf )
}
-static ::rtl::ByteSequence getBufFromAsciiLine( const OUString& line )
+static ::rtl::ByteSequence getBufFromAsciiLine( std::u16string_view line )
{
- OSL_ENSURE( line.getLength() % 2 == 0, "Wrong syntax!" );
+ OSL_ENSURE( line.size() % 2 == 0, "Wrong syntax!" );
OString tmpLine = OUStringToOString( line, RTL_TEXTENCODING_ASCII_US );
- ::rtl::ByteSequence aResult(line.getLength()/2);
+ ::rtl::ByteSequence aResult(line.size()/2);
for( int ind = 0; ind < tmpLine.getLength()/2; ind++ )
{
@@ -412,7 +412,7 @@ void SAL_CALL PasswordContainer::disposing( const EventObject& )
}
}
-std::vector< OUString > PasswordContainer::DecodePasswords( const OUString& aLine, const OUString& aIV, const OUString& aMasterPasswd, css::task::PasswordRequestMode mode )
+std::vector< OUString > PasswordContainer::DecodePasswords( std::u16string_view aLine, const OUString& aIV, const OUString& aMasterPasswd, css::task::PasswordRequestMode mode )
{
if( !aMasterPasswd.isEmpty() )
{
diff --git a/svl/source/passwordcontainer/passwordcontainer.hxx b/svl/source/passwordcontainer/passwordcontainer.hxx
index 8d77f0d2abf7..7924f53bff83 100644
--- a/svl/source/passwordcontainer/passwordcontainer.hxx
+++ b/svl/source/passwordcontainer/passwordcontainer.hxx
@@ -316,7 +316,7 @@ private:
const css::uno::Reference< css::task::XInteractionHandler >& Handler );
/// @throws css::uno::RuntimeException
- static ::std::vector< OUString > DecodePasswords( const OUString& aLine, const OUString& aIV, const OUString& aMasterPassword, css::task::PasswordRequestMode mode );
+ static ::std::vector< OUString > DecodePasswords( std::u16string_view aLine, const OUString& aIV, const OUString& aMasterPassword, css::task::PasswordRequestMode mode );
/// @throws css::uno::RuntimeException
static OUString EncodePasswords(const std::vector< OUString >& lines, const OUString& aIV, const OUString& aMasterPassword );
diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx
index dd8c567e639f..d6741142a9a5 100644
--- a/unotools/source/config/configitem.cxx
+++ b/unotools/source/config/configitem.cxx
@@ -819,14 +819,14 @@ bool ConfigItem::ClearNodeElements(const OUString& rNode, Sequence< OUString > c
return bRet;
}
-static OUString lcl_extractSetPropertyName( const OUString& rInPath, const OUString& rPrefix )
+static OUString lcl_extractSetPropertyName( const OUString& rInPath, std::u16string_view rPrefix )
{
OUString const sSubPath = dropPrefixFromConfigurationPath( rInPath, rPrefix);
return extractFirstFromConfigurationPath( sSubPath );
}
static
-Sequence< OUString > lcl_extractSetPropertyNames( const Sequence< PropertyValue >& rValues, const OUString& rPrefix )
+Sequence< OUString > lcl_extractSetPropertyNames( const Sequence< PropertyValue >& rValues, std::u16string_view rPrefix )
{
Sequence< OUString > aSubNodeNames(rValues.getLength());
OUString* pSubNodeNames = aSubNodeNames.getArray();
diff --git a/unotools/source/config/configpaths.cxx b/unotools/source/config/configpaths.cxx
index 8c3ee31f2641..9cf537738889 100644
--- a/unotools/source/config/configpaths.cxx
+++ b/unotools/source/config/configpaths.cxx
@@ -25,6 +25,7 @@
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
#include <osl/diagnose.h>
+#include <o3tl/string_view.hxx>
namespace utl
{
@@ -182,22 +183,22 @@ OUString extractFirstFromConfigurationPath(OUString const& _sInPath, OUString* _
}
// find the position after the prefix in the nested path
-static sal_Int32 lcl_findPrefixEnd(OUString const& _sNestedPath, OUString const& _sPrefixPath)
+static sal_Int32 lcl_findPrefixEnd(std::u16string_view _sNestedPath, std::u16string_view _sPrefixPath)
{
// TODO: currently handles only exact prefix matches
- sal_Int32 nPrefixLength = _sPrefixPath.getLength();
+ size_t nPrefixLength = _sPrefixPath.size();
OSL_ENSURE(nPrefixLength == 0 || _sPrefixPath[nPrefixLength-1] != '/',
"Cannot handle slash-terminated prefix paths");
bool bIsPrefix;
- if (_sNestedPath.getLength() > nPrefixLength)
+ if (_sNestedPath.size() > nPrefixLength)
{
bIsPrefix = _sNestedPath[nPrefixLength] == '/' &&
- _sNestedPath.startsWith(_sPrefixPath);
+ o3tl::starts_with(_sNestedPath, _sPrefixPath);
++nPrefixLength;
}
- else if (_sNestedPath.getLength() == nPrefixLength)
+ else if (_sNestedPath.size() == nPrefixLength)
{
bIsPrefix = _sNestedPath == _sPrefixPath;
}
@@ -209,14 +210,14 @@ static sal_Int32 lcl_findPrefixEnd(OUString const& _sNestedPath, OUString const&
return bIsPrefix ? nPrefixLength : 0;
}
-bool isPrefixOfConfigurationPath(OUString const& _sNestedPath,
- OUString const& _sPrefixPath)
+bool isPrefixOfConfigurationPath(std::u16string_view _sNestedPath,
+ std::u16string_view _sPrefixPath)
{
- return _sPrefixPath.isEmpty() || lcl_findPrefixEnd(_sNestedPath,_sPrefixPath) != 0;
+ return _sPrefixPath.empty() || lcl_findPrefixEnd(_sNestedPath,_sPrefixPath) != 0;
}
OUString dropPrefixFromConfigurationPath(OUString const& _sNestedPath,
- OUString const& _sPrefixPath)
+ std::u16string_view _sPrefixPath)
{
if ( sal_Int32 nPrefixEnd = lcl_findPrefixEnd(_sNestedPath,_sPrefixPath) )
{
@@ -224,7 +225,7 @@ OUString dropPrefixFromConfigurationPath(OUString const& _sNestedPath,
}
else
{
- OSL_ENSURE(_sPrefixPath.isEmpty(), "Path does not start with expected prefix");
+ OSL_ENSURE(_sPrefixPath.empty(), "Path does not start with expected prefix");
return _sNestedPath;
}
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 904808c6a247..83a2d65ac41f 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -685,7 +685,7 @@ LongDateOrder LocaleDataWrapper::getLongDateOrder() const
return nLongDateOrder;
}
-LongDateOrder LocaleDataWrapper::scanDateOrderImpl( const OUString& rCode ) const
+LongDateOrder LocaleDataWrapper::scanDateOrderImpl( std::u16string_view rCode ) const
{
// Only some european versions were translated, the ones with different
// keyword combinations are:
@@ -693,35 +693,35 @@ LongDateOrder LocaleDataWrapper::scanDateOrderImpl( const OUString& rCode ) cons
// Dutch DMJ, Finnish PKV
// default is English keywords for every other language
- sal_Int32 nDay = rCode.indexOf('D');
- sal_Int32 nMonth = rCode.indexOf('M');
- sal_Int32 nYear = rCode.indexOf('Y');
- if (nDay == -1 || nMonth == -1 || nYear == -1)
+ size_t nDay = rCode.find('D');
+ size_t nMonth = rCode.find('M');
+ size_t nYear = rCode.find('Y');
+ if (nDay == std::u16string_view::npos || nMonth == std::u16string_view::npos || nYear == std::u16string_view::npos)
{ // This algorithm assumes that all three parts (DMY) are present
- if (nMonth == -1)
+ if (nMonth == std::u16string_view::npos)
{ // only Finnish has something else than 'M' for month
- nMonth = rCode.indexOf('K');
- if (nMonth != -1)
+ nMonth = rCode.find('K');
+ if (nMonth != std::u16string_view::npos)
{
- nDay = rCode.indexOf('P');
- nYear = rCode.indexOf('V');
+ nDay = rCode.find('P');
+ nYear = rCode.find('V');
}
}
- else if (nDay == -1)
+ else if (nDay == std::u16string_view::npos)
{ // We have a month 'M' if we reach this branch.
// Possible languages containing 'M' but no 'D':
// German, French, Italian
- nDay = rCode.indexOf('T'); // German
- if (nDay != -1)
- nYear = rCode.indexOf('J');
+ nDay = rCode.find('T'); // German
+ if (nDay != std::u16string_view::npos)
+ nYear = rCode.find('J');
else
{
- nYear = rCode.indexOf('A'); // French, Italian
- if (nYear != -1)
+ nYear = rCode.find('A'); // French, Italian
+ if (nYear != std::u16string_view::npos)
{
- nDay = rCode.indexOf('J'); // French
- if (nDay == -1)
- nDay = rCode.indexOf('G'); // Italian
+ nDay = rCode.find('J'); // French
+ if (nDay == std::u16string_view::npos)
+ nDay = rCode.find('G'); // Italian
}
}
}
@@ -729,22 +729,22 @@ LongDateOrder LocaleDataWrapper::scanDateOrderImpl( const OUString& rCode ) cons
{ // We have a month 'M' and a day 'D'.
// Possible languages containing 'D' and 'M' but not 'Y':
// Spanish, Dutch
- nYear = rCode.indexOf('A'); // Spanish
- if (nYear == -1)
- nYear = rCode.indexOf('J'); // Dutch
+ nYear = rCode.find('A'); // Spanish
+ if (nYear == std::u16string_view::npos)
+ nYear = rCode.find('J'); // Dutch
}
- if (nDay == -1 || nMonth == -1 || nYear == -1)
+ if (nDay == std::u16string_view::npos || nMonth == std::u16string_view::npos || nYear == std::u16string_view::npos)
{
if (areChecksEnabled())
{
outputCheckMessage( appendLocaleInfo( u"LocaleDataWrapper::scanDateOrder: not all DMY present" ) );
}
- if (nDay == -1)
- nDay = rCode.getLength();
- if (nMonth == -1)
- nMonth = rCode.getLength();
- if (nYear == -1)
- nYear = rCode.getLength();
+ if (nDay == std::u16string_view::npos)
+ nDay = rCode.size();
+ if (nMonth == std::u16string_view::npos)
+ nMonth = rCode.size();
+ if (nYear == std::u16string_view::npos)
+ nYear = rCode.size();
}
}
// compare with <= because each position may equal rCode.getLength()
@@ -1226,14 +1226,14 @@ OUString LocaleDataWrapper::getNum( sal_Int64 nNumber, sal_uInt16 nDecimals,
}
OUString LocaleDataWrapper::getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
- const OUString& rCurrencySymbol, bool bUseThousandSep ) const
+ std::u16string_view rCurrencySymbol, bool bUseThousandSep ) const
{
sal_Unicode cZeroChar = getCurrZeroChar();
// check if digits and separators will fit into fixed buffer or allocate
size_t nGuess = ImplGetNumberStringLengthGuess( aLocaleDataItem, nDecimals );
OUStringBuffer aNumBuf(int(nGuess + 16));
- OUStringBuffer aBuf(int(rCurrencySymbol.getLength() + nGuess + 20 ));
+ OUStringBuffer aBuf(int(rCurrencySymbol.size() + nGuess + 20 ));
bool bNeg;
if ( nNumber < 0 )
diff --git a/unotools/source/misc/datetime.cxx b/unotools/source/misc/datetime.cxx
index 703ce91273aa..5bb7280bdf50 100644
--- a/unotools/source/misc/datetime.cxx
+++ b/unotools/source/misc/datetime.cxx
@@ -31,10 +31,10 @@
namespace
{
- bool checkAllNumber(const OUString& rString)
+ bool checkAllNumber(std::u16string_view rString)
{
sal_Int32 nPos = 0;
- sal_Int32 nLen = rString.getLength();
+ sal_Int32 nLen = rString.size();
// skip white space
while( nPos < nLen && ' ' == rString[nPos] )
@@ -99,7 +99,7 @@ namespace
// o_strInt: output; integer part of token
// o_bFraction: output; was there a fractional part?
// o_strFrac: output; fractional part of token
- bool impl_getISO8601TimeToken(const OUString &i_str, sal_Int32 &nPos, OUString &resInt, bool &bFraction, OUString &resFrac)
+ bool impl_getISO8601TimeToken(std::u16string_view i_str, sal_Int32 &nPos, OUString &resInt, bool &bFraction, OUString &resFrac)
{
bFraction = false;
// all tokens are of length 2
@@ -107,7 +107,7 @@ namespace
const sal_Unicode c0 = '0';
const sal_Unicode c9 = '9';
const sal_Unicode sep = ':';
- for (;nPos < nEndPos && nPos < i_str.getLength(); ++nPos)
+ for (;nPos < nEndPos && nPos < static_cast<sal_Int32>(i_str.size()); ++nPos)
{
const sal_Unicode c = i_str[nPos];
if (c == sep)
@@ -116,13 +116,13 @@ namespace
return false;
resInt += OUStringChar(c);
}
- if (nPos == i_str.getLength() || i_str[nPos] == sep)
+ if (nPos == static_cast<sal_Int32>(i_str.size()) || i_str[nPos] == sep)
return true;
if (i_str[nPos] == ',' || i_str[nPos] == '.')
{
bFraction = true;
++nPos;
- for (; nPos < i_str.getLength(); ++nPos)
+ for (; nPos < static_cast<sal_Int32>(i_str.size()); ++nPos)
{
const sal_Unicode c = i_str[nPos];
if (c == 'Z' || c == '+' || c == '-')
@@ -137,7 +137,7 @@ namespace
return false;
resFrac += OUStringChar(c);
}
- OSL_ENSURE(nPos == i_str.getLength(), "impl_getISO8601TimeToken internal error; expected to be at end of string");
+ OSL_ENSURE(nPos == static_cast<sal_Int32>(i_str.size()), "impl_getISO8601TimeToken internal error; expected to be at end of string");
return true;
}
if (i_str[nPos] == 'Z' || i_str[nPos] == '+' || i_str[nPos] == '-')
@@ -148,7 +148,7 @@ namespace
else
return false;
}
- bool getISO8601TimeToken(const OUString &i_str, sal_Int32 &io_index, OUString &o_strInt, bool &o_bFraction, OUString &o_strFrac)
+ bool getISO8601TimeToken(std::u16string_view i_str, sal_Int32 &io_index, OUString &o_strInt, bool &o_bFraction, OUString &o_strFrac)
{
OUString resInt;
OUString resFrac;
@@ -165,7 +165,7 @@ namespace
return true;
}
}
- bool getISO8601TimeZoneToken(const OUString &i_str, sal_Int32 &io_index, OUString &o_strInt)
+ bool getISO8601TimeZoneToken(std::u16string_view i_str, sal_Int32 &io_index, OUString &o_strInt)
{
const sal_Unicode c0 = '0';
const sal_Unicode c9 = '9';
@@ -180,7 +180,7 @@ namespace
{
++io_index;
o_strInt.clear();
- for (; io_index < i_str.getLength(); ++io_index)
+ for (; io_index < static_cast<sal_Int32>(i_str.size()); ++io_index)
{
const sal_Unicode c = i_str[io_index];
if ((c < c0 || c > c9) && c != sep)
@@ -367,7 +367,7 @@ bool ISO8601parseDate(const OUString &aDateStr, css::util::Date& rDate)
}
/** convert ISO8601 Time String to util::Time */
-bool ISO8601parseTime(const OUString &aTimeStr, css::util::Time& rTime)
+bool ISO8601parseTime(std::u16string_view aTimeStr, css::util::Time& rTime)
{
sal_Int32 nHour = 0;
sal_Int32 nMin = 0;
@@ -384,7 +384,7 @@ bool ISO8601parseTime(const OUString &aTimeStr, css::util::Time& rTime)
if (!bSuccess)
return false;
- if ( bFrac && n < aTimeStr.getLength())
+ if ( bFrac && n < static_cast<sal_Int32>(aTimeStr.size()))
{
// is it junk or the timezone?
bSuccess = getISO8601TimeZoneToken(aTimeStr, n, tokTz);
@@ -419,14 +419,14 @@ bool ISO8601parseTime(const OUString &aTimeStr, css::util::Time& rTime)
}
goto end;
}
- if(n >= aTimeStr.getLength())
+ if(n >= static_cast<sal_Int32>(aTimeStr.size()))
goto end;
// minutes
bSuccess = getISO8601TimeToken(aTimeStr, n, tokInt, bFrac, tokFrac);
if (!bSuccess)
return false;
- if ( bFrac && n < aTimeStr.getLength())
+ if ( bFrac && n < static_cast<sal_Int32>(aTimeStr.size()))
{
// is it junk or the timezone?
bSuccess = getISO8601TimeZoneToken(aTimeStr, n, tokTz);
@@ -455,14 +455,14 @@ bool ISO8601parseTime(const OUString &aTimeStr, css::util::Time& rTime)
}
goto end;
}
- if(n >= aTimeStr.getLength())
+ if(n >= static_cast<sal_Int32>(aTimeStr.size()))
goto end;
// seconds
bSuccess = getISO8601TimeToken(aTimeStr, n, tokInt, bFrac, tokFrac);
if (!bSuccess)
return false;
- if (n < aTimeStr.getLength())
+ if (n < static_cast<sal_Int32>(aTimeStr.size()))
{
// is it junk or the timezone?
bSuccess = getISO8601TimeZoneToken(aTimeStr, n, tokTz);
diff --git a/vcl/source/control/longcurr.cxx b/vcl/source/control/longcurr.cxx
index 633b61faa862..c2c6e413442e 100644
--- a/vcl/source/control/longcurr.cxx
+++ b/vcl/source/control/longcurr.cxx
@@ -48,7 +48,7 @@ BigInt ImplPower10( sal_uInt16 n )
return nValue;
}
-OUString ImplGetCurr( const LocaleDataWrapper& rLocaleDataWrapper, const BigInt &rNumber, sal_uInt16 nDigits, const OUString& rCurrSymbol, bool bShowThousandSep )
+OUString ImplGetCurr( const LocaleDataWrapper& rLocaleDataWrapper, const BigInt &rNumber, sal_uInt16 nDigits, std::u16string_view rCurrSymbol, bool bShowThousandSep )
{
SAL_WARN_IF( nDigits >= 10, "vcl", "LongCurrency may only have 9 decimal places" );