[Libreoffice-commits] core.git: connectivity/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Dec 28 15:57:49 UTC 2018
connectivity/source/commontools/AutoRetrievingBase.cxx | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
New commits:
commit 217ec9aba798777ccab58f2382a1d0592f15249f
Author: Matteo Casalin <matteo.casalin at yahoo.com>
AuthorDate: Sun Dec 9 19:47:06 2018 +0100
Commit: Matteo Casalin <matteo.casalin at yahoo.com>
CommitDate: Fri Dec 28 16:57:27 2018 +0100
Simplify use of indexes in getToken/lastIndexOf
Change-Id: Icb275c611dec8427121fea5e197b976a2c1b8166
Reviewed-on: https://gerrit.libreoffice.org/65667
Tested-by: Jenkins
Reviewed-by: Matteo Casalin <matteo.casalin at yahoo.com>
diff --git a/connectivity/source/commontools/AutoRetrievingBase.cxx b/connectivity/source/commontools/AutoRetrievingBase.cxx
index e4f10831f12c..75cc214138b1 100644
--- a/connectivity/source/commontools/AutoRetrievingBase.cxx
+++ b/connectivity/source/commontools/AutoRetrievingBase.cxx
@@ -32,14 +32,12 @@ namespace connectivity
{
sStatement = m_sGeneratedValueStatement;
static const char sTable[] = "$table";
- sal_Int32 nIndex = 0;
- nIndex = sStatement.indexOf("$column",nIndex);
- if ( -1 != nIndex )
+ const sal_Int32 nColumnIndex {sStatement.indexOf("$column")};
+ if ( nColumnIndex>=0 )
{ // we need a column
}
- nIndex = 0;
- nIndex = sStatement.indexOf(sTable,nIndex);
- if ( -1 != nIndex )
+ const sal_Int32 nTableIndex {sStatement.indexOf(sTable)};
+ if ( nTableIndex>=0 )
{ // we need a table name
sal_Int32 nIntoIndex = sStmt.indexOf("INTO ");
sStmt = sStmt.copy(nIntoIndex+5);
@@ -47,10 +45,8 @@ namespace connectivity
{
sStmt = sStmt.copy(1);
}
-
- nIntoIndex = 0;
- OUString sTableName = sStmt.getToken(0,' ',nIntoIndex);
- sStatement = sStatement.replaceAt(nIndex, strlen(sTable), sTableName);
+ const OUString sTableName = sStmt.getToken(0, ' ');
+ sStatement = sStatement.replaceAt(nTableIndex, strlen(sTable), sTableName);
}
}
return sStatement;
More information about the Libreoffice-commits
mailing list