diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-01 17:42:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-02 13:31:19 +0200 |
commit | 1927b51993fb68907a75765676179b08ab195196 (patch) | |
tree | 1b7d09c1b5e7ea945fb6ea618a4c100e8630ebb4 /connectivity/source | |
parent | 0dfa444f393a5766d36fe7d2480d0c8ec832e329 (diff) |
loplugin:stringviewparam convert methods using indexOf
.. and lastIndexOf, which convert to find and rfind
Change-Id: I6c4156cf904774c0d867f85a4c2785dba7593f62
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132445
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity/source')
-rw-r--r-- | connectivity/source/commontools/CommonTools.cxx | 8 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/DTable.cxx | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/connectivity/source/commontools/CommonTools.cxx b/connectivity/source/commontools/CommonTools.cxx index b7467c6933ab..739fe6e66345 100644 --- a/connectivity/source/commontools/CommonTools.cxx +++ b/connectivity/source/commontools/CommonTools.cxx @@ -165,15 +165,15 @@ namespace connectivity namespace dbtools { -static bool isCharOk(sal_Unicode c,const OUString& _rSpecials) +static bool isCharOk(sal_Unicode c, std::u16string_view _rSpecials) { return ( ((c >= 97) && (c <= 122)) || ((c >= 65) && (c <= 90)) || ((c >= 48) && (c <= 57)) || - c == '_' || _rSpecials.indexOf(c) != -1); + c == '_' || _rSpecials.find(c) != std::u16string_view::npos); } -bool isValidSQLName(const OUString& rName,const OUString& _rSpecials) +bool isValidSQLName(const OUString& rName, std::u16string_view _rSpecials) { // Test for correct naming (in SQL sense) // This is important for table names for example @@ -202,7 +202,7 @@ bool isValidSQLName(const OUString& rName,const OUString& _rSpecials) } // Creates a new name if necessary -OUString convertName2SQLName(const OUString& rName,const OUString& _rSpecials) +OUString convertName2SQLName(const OUString& rName, std::u16string_view _rSpecials) { if(isValidSQLName(rName,_rSpecials)) return rName; diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index d7a5b1c458a6..ad3aa66f2dd1 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -1015,7 +1015,7 @@ bool ODbaseTable::CreateImpl() { OSL_ENSURE(!m_pFileStream, "SequenceError"); - if ( m_pConnection->isCheckEnabled() && ::dbtools::convertName2SQLName(m_Name,OUString()) != m_Name ) + if ( m_pConnection->isCheckEnabled() && ::dbtools::convertName2SQLName(m_Name, u"") != m_Name ) { const OUString sError( getConnection()->getResources().getResourceStringWithSubstitution( STR_SQL_NAME_ERROR, |