[Libreoffice-commits] core.git: compilerplugins/clang mysqlc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Aug 13 10:44:56 UTC 2018


 compilerplugins/clang/check.cxx            |    2 +-
 mysqlc/source/mysqlc_connection.cxx        |    2 +-
 mysqlc/source/mysqlc_databasemetadata.cxx  |    2 +-
 mysqlc/source/mysqlc_resultsetmetadata.cxx |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit ab76a889713661030c5839e5cc04820726a31c38
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Aug 13 09:05:19 2018 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Aug 13 12:44:31 2018 +0200

    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 at redhat.com>

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*/)


More information about the Libreoffice-commits mailing list