diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-04 11:14:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-05 12:57:00 +0200 |
commit | 9f1701d01d9f664828356976d8592492f85b30f5 (patch) | |
tree | a91eaef0674591af87b06096fdd186283559a8de /connectivity | |
parent | b8bb44161aeb6e00526a38343b63e678ce7d4a1a (diff) |
use more o3tl::getToken
found by inspecting call sites of OUString::getToken
Change-Id: I4269c7476c7aa46fac39528227e350568f0eb34a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132644
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/commontools/AutoRetrievingBase.cxx | 3 | ||||
-rw-r--r-- | connectivity/source/drivers/flat/ETable.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/drivers/postgresql/pq_databasemetadata.cxx | 22 |
3 files changed, 15 insertions, 14 deletions
diff --git a/connectivity/source/commontools/AutoRetrievingBase.cxx b/connectivity/source/commontools/AutoRetrievingBase.cxx index d1170fdd972b..99327f27eeb5 100644 --- a/connectivity/source/commontools/AutoRetrievingBase.cxx +++ b/connectivity/source/commontools/AutoRetrievingBase.cxx @@ -20,6 +20,7 @@ #include <AutoRetrievingBase.hxx> #include <osl/diagnose.h> +#include <o3tl/string_view.hxx> namespace connectivity { @@ -39,7 +40,7 @@ namespace connectivity { // we need a table name sal_Int32 nIntoIndex = sStmt.indexOf("INTO ") + 5; while (nIntoIndex<sStmt.getLength() && sStmt[nIntoIndex]==' ') ++nIntoIndex; - const OUString sTableName = sStmt.getToken(0, ' ', nIntoIndex); + const std::u16string_view sTableName = o3tl::getToken(sStmt, 0, ' ', nIntoIndex); return m_sGeneratedValueStatement.replaceAt(nTableIndex, strlen(sTable), sTableName); } return m_sGeneratedValueStatement; diff --git a/connectivity/source/drivers/flat/ETable.cxx b/connectivity/source/drivers/flat/ETable.cxx index dd7342419d61..bd6be38d7bc2 100644 --- a/connectivity/source/drivers/flat/ETable.cxx +++ b/connectivity/source/drivers/flat/ETable.cxx @@ -265,8 +265,8 @@ void OFlatTable::impl_fillColumnInfo_nothrow(QuotedTokenizedString const & aFirs if (bNumeric && cThousandDelimiter) { // Is the delimiter correct? - const OUString aValue = aField2.getToken(0,cDecimalDelimiter); - for( sal_Int32 j = aValue.getLength() - 4; j >= 0; j -= 4) + const std::u16string_view aValue = o3tl::getToken(aField2, 0, cDecimalDelimiter); + for( sal_Int32 j = static_cast<sal_Int32>(aValue.size()) - 4; j >= 0; j -= 4) { const sal_Unicode c = aValue[j]; // just digits, decimal- and thousands-delimiter? diff --git a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx index fd1f81253fa9..7da57d1b675c 100644 --- a/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx +++ b/connectivity/source/drivers/postgresql/pq_databasemetadata.cxx @@ -2086,45 +2086,45 @@ namespace OUString nameB; a[0 /*TYPE_NAME*/] >>= nameA; b[0 /*TYPE_NAME*/] >>= nameB; - OUString nsA, tnA, nsB, tnB; + std::u16string_view nsA, tnA, nsB, tnB; // parse typename into schema and typename sal_Int32 nIndex=0; - nsA = nameA.getToken(0, '.', nIndex); + nsA = o3tl::getToken(nameA, 0, '.', nIndex); if (nIndex<0) { tnA = nsA; - nsA.clear(); + nsA = std::u16string_view(); } else { - tnA = nameA.getToken(0, '.', nIndex); + tnA = o3tl::getToken(nameA, 0, '.', nIndex); assert(nIndex < 0); } nIndex=0; - nsB = nameB.getToken(0, '.', nIndex); + nsB = o3tl::getToken(nameB, 0, '.', nIndex); if (nIndex<0) { tnB = nsB; - nsB.clear(); + nsB = std::u16string_view(); } else { - tnB = nameB.getToken(0, '.', nIndex); + tnB = o3tl::getToken(nameB, 0, '.', nIndex); assert(nIndex < 0); } const int ns_comp = compare_schema(nsA, nsB); if(ns_comp == 0) { - if(nsA.isEmpty()) + if(nsA.empty()) { - assert(nsB.isEmpty()); + assert(nsB.empty()); // within each type category, sort privileged choice first - if( tnA == "int4" || tnA == "varchar" || tnA == "char" || tnA == "text") + if( tnA == u"int4" || tnA == u"varchar" || tnA == u"char" || tnA == u"text") return true; - if( tnB == "int4" || tnB == "varchar" || tnB == "char" || tnB == "text") + if( tnB == u"int4" || tnB == u"varchar" || tnB == u"char" || tnB == u"text") return false; } return nameA.compareTo( nameB ) < 0; |