summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-08-13 09:05:19 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-08-13 12:44:31 +0200
commitab76a889713661030c5839e5cc04820726a31c38 (patch)
treec8b60aeb80999a6e6a153922aca20224f6ed3815
parentfbc0524ee19e039cadea92d2dd163525bad5f661 (diff)
Various loplugin warnings in mysql
I assume the "0 == " around columnStringValue.equalsIgnoreAsciiCase in ODatabaseMetaData::getSchemas (mysqlc/source/mysqlc_databasemetadata.cxx) was just a thinko, as the latter already returns sal_Bool, not a <0 / 0 / >0 integer value. (Rebased atop ce24919c01d1ab77f962137ff04a31dd5ec944af "loplugin, various in mysqlc", which covered the same warnings, but didn't consider the negated call to equalsIgnoreAsciiCase to be an accident as I do here (see above), and accidentally reversed the logic of OResultSetMetaData::isNullable in mysqlc/source/mysqlc_resultsetmetadata.cxx, I think.) Change-Id: Ie89cc8ef7c7638d28307a4b240930d387d75b8f2 Reviewed-on: https://gerrit.libreoffice.org/58908 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--compilerplugins/clang/check.cxx2
-rw-r--r--mysqlc/source/mysqlc_connection.cxx2
-rw-r--r--mysqlc/source/mysqlc_databasemetadata.cxx2
-rw-r--r--mysqlc/source/mysqlc_resultsetmetadata.cxx2
4 files changed, 4 insertions, 4 deletions
diff --git a/compilerplugins/clang/check.cxx b/compilerplugins/clang/check.cxx
index b31e40b23e2b..86484d6828cf 100644
--- a/compilerplugins/clang/check.cxx
+++ b/compilerplugins/clang/check.cxx
@@ -89,7 +89,7 @@ TerminalCheck TypeCheck::AnyBoolean() const {
n == "sal_Bool" || n == "BOOL" || n == "Boolean" || n == "FT_Bool"
|| n == "FcBool" || n == "GLboolean" || n == "NPBool" || n == "TW_BOOL"
|| n == "UBool" || n == "boolean" || n == "dbus_bool_t"
- || n == "gboolean" || n == "hb_bool_t" || n == "jboolean");
+ || n == "gboolean" || n == "hb_bool_t" || n == "jboolean" || n == "my_bool");
}
TypeCheck TypeCheck::LvalueReference() const {
diff --git a/mysqlc/source/mysqlc_connection.cxx b/mysqlc/source/mysqlc_connection.cxx
index 02b6af026534..1b3169845e19 100644
--- a/mysqlc/source/mysqlc_connection.cxx
+++ b/mysqlc/source/mysqlc_connection.cxx
@@ -277,7 +277,7 @@ void SAL_CALL OConnection::setAutoCommit(sal_Bool autoCommit)
{
MutexGuard aGuard(m_aMutex);
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- if(!mysql_autocommit(&m_mysql, static_cast<my_bool>(autoCommit)))
+ if(!mysql_autocommit(&m_mysql, autoCommit))
mysqlc_sdbc_driver::throwSQLExceptionWithMsg(mysql_error(&m_mysql), mysql_errno(&m_mysql), *this, getConnectionEncoding());
}
diff --git a/mysqlc/source/mysqlc_databasemetadata.cxx b/mysqlc/source/mysqlc_databasemetadata.cxx
index a63a7fe0f5a5..310ce4c1c678 100644
--- a/mysqlc/source/mysqlc_databasemetadata.cxx
+++ b/mysqlc/source/mysqlc_databasemetadata.cxx
@@ -909,7 +909,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas()
for (sal_uInt32 i = 1; i <= columns; i++) {
rtl::OUString columnStringValue = xRow->getString(i);
if (i == 1) { // TABLE_SCHEM
- informationSchema = !columnStringValue.equalsIgnoreAsciiCase("information_schema");
+ informationSchema = columnStringValue.equalsIgnoreAsciiCase("information_schema");
}
aRow.push_back(makeAny(columnStringValue));
}
diff --git a/mysqlc/source/mysqlc_resultsetmetadata.cxx b/mysqlc/source/mysqlc_resultsetmetadata.cxx
index c260e4bc4bc0..f3375df2201e 100644
--- a/mysqlc/source/mysqlc_resultsetmetadata.cxx
+++ b/mysqlc/source/mysqlc_resultsetmetadata.cxx
@@ -165,7 +165,7 @@ sal_Int32 SAL_CALL OResultSetMetaData::isNullable(sal_Int32 column)
{
checkColumnIndex(column);
MYSQL_FIELD* pField = getField(column);
- return sal_Int32((pField->flags & NOT_NULL_FLAG) != 0);
+ return (pField->flags & NOT_NULL_FLAG) ? 0 : 1;
}
sal_Bool SAL_CALL OResultSetMetaData::isSearchable(sal_Int32 /*column*/)