diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-22 14:08:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-23 14:00:08 +0100 |
commit | ec1c4c49301758c54394f9943252e192ad54638b (patch) | |
tree | b53af3cb9154a388495b1af35c3f8ff41d6ebe1f /connectivity | |
parent | db0f2c29bf3a6ad5a08f8524ea0e65aa90792bb2 (diff) |
O[U]String::replaceAt overloads that take string_view
which results in lots of nice string_view improvements picked up by the
plugins
Change-Id: Ib0ec3887816b3d4436d003b739d9814f83e244b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125657
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/commontools/DateConversion.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/commontools/dbtools2.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/commontools/predicateinput.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/DTable.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/Tables.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/firebird/Util.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/flat/ETable.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/hsqldb/HTable.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/mysql_jdbc/YTable.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/mysql_jdbc/YTables.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/parse/sqlnode.cxx | 8 | ||||
-rw-r--r-- | connectivity/source/resource/sharedresources.cxx | 2 |
12 files changed, 16 insertions, 16 deletions
diff --git a/connectivity/source/commontools/DateConversion.cxx b/connectivity/source/commontools/DateConversion.cxx index 81338b3dc9fa..38f20af0926c 100644 --- a/connectivity/source/commontools/DateConversion.cxx +++ b/connectivity/source/commontools/DateConversion.cxx @@ -90,7 +90,7 @@ OUString DBTypeConversion::toSQLString(sal_Int32 eType, const Any& _rVal, nIndex += 2; nIndex = aTemp.indexOf(sQuot,nIndex); if(nIndex != -1) - aTemp = aTemp.replaceAt(nIndex,sQuot.getLength(), "\'\'"); + aTemp = aTemp.replaceAt(nIndex,sQuot.getLength(), u"\'\'"); } while (nIndex != -1); aRet.append(aTemp); diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx index 0adfe23bdac9..5f07a272cec2 100644 --- a/connectivity/source/commontools/dbtools2.cxx +++ b/connectivity/source/commontools/dbtools2.cxx @@ -122,7 +122,7 @@ OUString createStandardTypePart(const Reference< XPropertySet >& xColProp,const { sal_Int32 nIndex = sTypeName.indexOf(sAutoIncrementValue); if (nIndex != -1) - sTypeName = sTypeName.replaceAt(nIndex,sTypeName.getLength() - nIndex,OUString()); + sTypeName = sTypeName.replaceAt(nIndex,sTypeName.getLength() - nIndex, u""); } if ( (nPrecision > 0 || nScale > 0) && bUseLiteral ) @@ -387,7 +387,7 @@ OUString createSqlCreateTableStatement( const Reference< XPropertySet >& descri else { if ( aSql.endsWith(",") ) - aSql = aSql.replaceAt(aSql.getLength()-1, 1, ")"); + aSql = aSql.replaceAt(aSql.getLength()-1, 1, u")"); else aSql += ")"; } diff --git a/connectivity/source/commontools/predicateinput.cxx b/connectivity/source/commontools/predicateinput.cxx index 37a0d6862c62..047f9ccc7c94 100644 --- a/connectivity/source/commontools/predicateinput.cxx +++ b/connectivity/source/commontools/predicateinput.cxx @@ -153,7 +153,7 @@ namespace dbtools sal_Int32 nTemp = 0; while ( -1 != ( nIndex = sQuoted.indexOf( '\'',nTemp ) ) ) { - sQuoted = sQuoted.replaceAt( nIndex, 1, "''" ); + sQuoted = sQuoted.replaceAt( nIndex, 1, u"''" ); nTemp = nIndex+2; } diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index 90d0b9f21759..c5da1d6b2477 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -646,7 +646,7 @@ OUString ODbaseTable::getEntry(file::OConnection const * _pConnection, std::u16s // name and extension have to coincide if ( _pConnection->matchesExtension( sExt ) ) { - sName = sName.replaceAt(sName.getLength() - (sExt.getLength() + 1), sExt.getLength() + 1, OUString()); + sName = sName.replaceAt(sName.getLength() - (sExt.getLength() + 1), sExt.getLength() + 1, u""); if ( sName == _sName ) { Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY ); diff --git a/connectivity/source/drivers/firebird/Tables.cxx b/connectivity/source/drivers/firebird/Tables.cxx index 215ffe61bdf9..ebd6f2309cc8 100644 --- a/connectivity/source/drivers/firebird/Tables.cxx +++ b/connectivity/source/drivers/firebird/Tables.cxx @@ -178,7 +178,7 @@ ObjectType Tables::appendObject(const OUString& rName, else { if ( sSql.endsWith(",") ) - sSql = sSql.replaceAt(sSql.getLength()-1, 1, ")"); + sSql = sSql.replaceAt(sSql.getLength()-1, 1, u")"); else sSql += ")"; } diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx index 6cc70b4270f4..2d694eac94ec 100644 --- a/connectivity/source/drivers/firebird/Util.cxx +++ b/connectivity/source/drivers/firebird/Util.cxx @@ -417,7 +417,7 @@ OUString firebird::escapeWith( const OUString& sText, const char aKey, const cha aIndex = sRet.indexOf(aKey, aIndex); if ( aIndex <= 0 || aIndex >= sRet.getLength()) break; - sRet = sRet.replaceAt(aIndex, 1, OUStringChar(aEscapeChar) + OUStringChar(aKey) ); + sRet = sRet.replaceAt(aIndex, 1, rtl::OUStringConcatenation(OUStringChar(aEscapeChar) + OUStringChar(aKey)) ); aIndex += 2; } diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index 7c47240c27c4..68f1a82dcdd7 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -472,7 +472,7 @@ OUString OFlatTable::getEntry() const if ( m_pConnection->matchesExtension( sExt ) ) { if ( !sExt.isEmpty() ) - sName = sName.replaceAt(sName.getLength() - (sExt.getLength() + 1), sExt.getLength()+1, OUString()); + sName = sName.replaceAt(sName.getLength() - (sExt.getLength() + 1), sExt.getLength()+1, u""); if ( sName == m_Name ) { Reference< XContentAccess > xContentAccess( xDir, UNO_QUERY ); diff --git a/connectivity/source/drivers/hsqldb/HTable.cxx b/connectivity/source/drivers/hsqldb/HTable.cxx index a60898eb44f4..9a23b6052468 100644 --- a/connectivity/source/drivers/hsqldb/HTable.cxx +++ b/connectivity/source/drivers/hsqldb/HTable.cxx @@ -301,7 +301,7 @@ void OHSQLTable::executeStatement(const OUString& _rStatement ) { OUString sSQL = _rStatement; if(sSQL.endsWith(",")) - sSQL = sSQL.replaceAt(sSQL.getLength()-1, 1, ")"); + sSQL = sSQL.replaceAt(sSQL.getLength()-1, 1, u")"); Reference< XStatement > xStmt = getConnection()->createStatement( ); if ( xStmt.is() ) diff --git a/connectivity/source/drivers/mysql_jdbc/YTable.cxx b/connectivity/source/drivers/mysql_jdbc/YTable.cxx index 54b8915cab63..b5b02fefc1bc 100644 --- a/connectivity/source/drivers/mysql_jdbc/YTable.cxx +++ b/connectivity/source/drivers/mysql_jdbc/YTable.cxx @@ -312,7 +312,7 @@ void OMySQLTable::executeStatement(const OUString& _rStatement) { OUString sSQL = _rStatement; if (sSQL.endsWith(",")) - sSQL = sSQL.replaceAt(sSQL.getLength() - 1, 1, ")"); + sSQL = sSQL.replaceAt(sSQL.getLength() - 1, 1, u")"); Reference<XStatement> xStmt = getConnection()->createStatement(); if (xStmt.is()) diff --git a/connectivity/source/drivers/mysql_jdbc/YTables.cxx b/connectivity/source/drivers/mysql_jdbc/YTables.cxx index be962d3d7c33..9d598892d32b 100644 --- a/connectivity/source/drivers/mysql_jdbc/YTables.cxx +++ b/connectivity/source/drivers/mysql_jdbc/YTables.cxx @@ -153,7 +153,7 @@ OUString OTables::adjustSQL(const OUString& _sSql) sal_Int32 nPos = nIndex + strlen(s_sUNSIGNED); OUString sNewUnsigned(sSQL.copy(nPos, nParen - nPos + 1)); sSQL = sSQL.replaceAt(nIndex, strlen(s_sUNSIGNED) + sNewUnsigned.getLength(), - sNewUnsigned + s_sUNSIGNED); + rtl::OUStringConcatenation(sNewUnsigned + s_sUNSIGNED)); nIndex = sSQL.indexOf(s_sUNSIGNED, nIndex + strlen(s_sUNSIGNED) + sNewUnsigned.getLength()); } return sSQL; diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx index 48c55051ef6b..02056253c300 100644 --- a/connectivity/source/parse/sqlnode.cxx +++ b/connectivity/source/parse/sqlnode.cxx @@ -106,7 +106,7 @@ namespace @return The quoted string. */ - OUString SetQuotation(std::u16string_view rValue, const OUString& rQuot, const OUString& rQuotToReplace) + OUString SetQuotation(std::u16string_view rValue, const OUString& rQuot, std::u16string_view rQuotToReplace) { OUString rNewValue = rQuot + rValue; sal_Int32 nIndex = sal_Int32(-1); // Replace quotes with double quotes or the parser gets into problems @@ -757,7 +757,7 @@ void OSQLParseNode::impl_parseLikeNodeToString_throw( OUStringBuffer& rString, c { OUString aStr = ConvertLikeToken(pParaNode, pEscNode, rParam.bInternational); rString.append(" "); - rString.append(SetQuotation(aStr,"\'","\'\'")); + rString.append(SetQuotation(aStr, "\'", u"\'\'")); } else pParaNode->impl_parseNodeToString_throw( rString, aNewParam, false ); @@ -1140,7 +1140,7 @@ OUString OSQLParser::stringToDouble(const OUString& _rValue,sal_Int16 _nScale) aValue = OUString::number(aResult.Value); sal_Int32 nPos = aValue.lastIndexOf('.'); if((nPos+_nScale) < aValue.getLength()) - aValue = aValue.replaceAt(nPos+_nScale,aValue.getLength()-nPos-_nScale,OUString()); + aValue = aValue.replaceAt(nPos+_nScale,aValue.getLength()-nPos-_nScale, u""); aValue = aValue.replaceAt(aValue.lastIndexOf('.'),1,s_xLocaleData->getLocaleItem(m_pData->aLocale).decimalSeparator); return aValue; } @@ -2429,7 +2429,7 @@ void OSQLParseNode::parseLeaf(OUStringBuffer& rString, const SQLParseNodeParamet case SQLNodeType::String: if (!rString.isEmpty()) rString.append(" "); - rString.append(SetQuotation(m_aNodeValue,"\'","\'\'")); + rString.append(SetQuotation(m_aNodeValue, "\'", u"\'\'")); break; case SQLNodeType::Name: if (!rString.isEmpty()) diff --git a/connectivity/source/resource/sharedresources.cxx b/connectivity/source/resource/sharedresources.cxx index a6f218147e71..0f8bccefd96b 100644 --- a/connectivity/source/resource/sharedresources.cxx +++ b/connectivity/source/resource/sharedresources.cxx @@ -101,7 +101,7 @@ namespace connectivity namespace { size_t lcl_substitute( OUString& _inout_rString, - const char* _pAsciiPattern, const OUString& _rReplace ) + const char* _pAsciiPattern, std::u16string_view _rReplace ) { size_t nOccurrences = 0; |