summaryrefslogtreecommitdiff
path: root/connectivity/source/commontools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-14 14:55:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-14 16:35:38 +0200
commit11785217594d863efb518aa8b8f2910cdcb9c59d (patch)
treed8460fe0e3a9ee4212d7bd964c2fd3ee0d9074b4 /connectivity/source/commontools
parent14471a694271777440c19916055d659337c0fb8d (diff)
loplugin:buriedassign in c*
Change-Id: Id14fed7e5c0f588ad3c927f12251432d12c1a7c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92190 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity/source/commontools')
-rw-r--r--connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx26
-rw-r--r--connectivity/source/commontools/dbtools2.cxx7
-rw-r--r--connectivity/source/commontools/parameters.cxx2
3 files changed, 18 insertions, 17 deletions
diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx
index 612aee377686..561953a0796c 100644
--- a/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx
+++ b/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx
@@ -32,7 +32,7 @@ ODatabaseMetaDataResultSetMetaData::~ODatabaseMetaDataResultSetMetaData()
sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnDisplaySize( sal_Int32 column )
{
- if(!m_mColumns.empty() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
+ if((m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
return (*m_mColumnsIter).second.getColumnDisplaySize();
return 0;
@@ -40,7 +40,7 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnDisplaySize( sal
sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnType( sal_Int32 column )
{
- if(!m_mColumns.empty() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
+ if((m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
return (*m_mColumnsIter).second.getColumnType();
return 1;
}
@@ -52,7 +52,7 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnCount( )
sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isCaseSensitive( sal_Int32 column )
{
- if(!m_mColumns.empty() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
+ if((m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
return (*m_mColumnsIter).second.isCaseSensitive();
return true;
}
@@ -64,14 +64,14 @@ OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getSchemaName( sal_Int32 /
OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnName( sal_Int32 column )
{
- if(!m_mColumns.empty() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
+ if((m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
return (*m_mColumnsIter).second.getColumnName();
return OUString();
}
OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getTableName( sal_Int32 column )
{
- if(!m_mColumns.empty() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
+ if((m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
return (*m_mColumnsIter).second.getTableName();
return OUString();
}
@@ -88,7 +88,7 @@ OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnTypeName( sal_Int
OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnLabel( sal_Int32 column )
{
- if(!m_mColumns.empty() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
+ if((m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
return (*m_mColumnsIter).second.getColumnLabel();
return getColumnName(column);
}
@@ -100,35 +100,35 @@ OUString SAL_CALL ODatabaseMetaDataResultSetMetaData::getColumnServiceName( sal_
sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isCurrency( sal_Int32 column )
{
- if(!m_mColumns.empty() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
+ if((m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
return (*m_mColumnsIter).second.isCurrency();
return false;
}
sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isAutoIncrement( sal_Int32 column )
{
- if(!m_mColumns.empty() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
+ if((m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
return (*m_mColumnsIter).second.isAutoIncrement();
return false;
}
sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isSigned( sal_Int32 column )
{
- if(!m_mColumns.empty() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
+ if((m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
return (*m_mColumnsIter).second.isSigned();
return false;
}
sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getPrecision( sal_Int32 column )
{
- if(!m_mColumns.empty() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
+ if((m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
return (*m_mColumnsIter).second.getPrecision();
return 0;
}
sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getScale( sal_Int32 column )
{
- if(!m_mColumns.empty() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
+ if((m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
return (*m_mColumnsIter).second.getScale();
return 0;
@@ -136,7 +136,7 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::getScale( sal_Int32 colum
sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::isNullable( sal_Int32 column )
{
- if(!m_mColumns.empty() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
+ if((m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
return (*m_mColumnsIter).second.isNullable();
return sal_Int32(false);
@@ -144,7 +144,7 @@ sal_Int32 SAL_CALL ODatabaseMetaDataResultSetMetaData::isNullable( sal_Int32 col
sal_Bool SAL_CALL ODatabaseMetaDataResultSetMetaData::isSearchable( sal_Int32 column )
{
- if(!m_mColumns.empty() && (m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
+ if((m_mColumnsIter = m_mColumns.find(column)) != m_mColumns.end())
return (*m_mColumnsIter).second.isSearchable();
return true;
}
diff --git a/connectivity/source/commontools/dbtools2.cxx b/connectivity/source/commontools/dbtools2.cxx
index 26b60b23933a..38efeea57598 100644
--- a/connectivity/source/commontools/dbtools2.cxx
+++ b/connectivity/source/commontools/dbtools2.cxx
@@ -116,10 +116,11 @@ OUString createStandardTypePart(const Reference< XPropertySet >& xColProp,const
}
}
- sal_Int32 nIndex = 0;
- if ( !sAutoIncrementValue.isEmpty() && (nIndex = sTypeName.indexOf(sAutoIncrementValue)) != -1 )
+ if ( !sAutoIncrementValue.isEmpty() )
{
- sTypeName = sTypeName.replaceAt(nIndex,sTypeName.getLength() - nIndex,OUString());
+ sal_Int32 nIndex = sTypeName.indexOf(sAutoIncrementValue);
+ if (nIndex != -1)
+ sTypeName = sTypeName.replaceAt(nIndex,sTypeName.getLength() - nIndex,OUString());
}
if ( (nPrecision > 0 || nScale > 0) && bUseLiteral )
diff --git a/connectivity/source/commontools/parameters.cxx b/connectivity/source/commontools/parameters.cxx
index 1461374173b5..bd114ea19341 100644
--- a/connectivity/source/commontools/parameters.cxx
+++ b/connectivity/source/commontools/parameters.cxx
@@ -236,7 +236,7 @@ namespace dbtools
o_rNewParamName += "_";
}
- return sFilter += " =:" + o_rNewParamName;
+ return sFilter + " =:" + o_rNewParamName;
}