diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-04-24 12:25:07 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-04-24 12:36:19 +0200 |
commit | cf7f31c1d631eaec22ea89466f7639adf9ed620f (patch) | |
tree | ccad396eff00c3601f1c6057b630990044d8f3b7 | |
parent | 820fca753b0bfed6078b9cde09430177d6a193ca (diff) |
loplugin:simplifybool
Change-Id: Ib0290487a963d665a628bd75f4140a9e2b89faa7
-rw-r--r-- | connectivity/source/commontools/TSortIndex.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/kab/KStatement.cxx | 4 | ||||
-rw-r--r-- | connectivity/source/drivers/mork/MQueryHelper.cxx | 16 | ||||
-rw-r--r-- | include/connectivity/FValue.hxx | 2 |
4 files changed, 11 insertions, 13 deletions
diff --git a/connectivity/source/commontools/TSortIndex.cxx b/connectivity/source/commontools/TSortIndex.cxx index 0d0e97a40d10..454cf06e5630 100644 --- a/connectivity/source/commontools/TSortIndex.cxx +++ b/connectivity/source/commontools/TSortIndex.cxx @@ -40,7 +40,7 @@ struct TKeyValueFunc : ::std::binary_function<OSortIndex::TIntValuePairVector::v ::std::vector<OKeyType>::const_iterator aIter = aKeyType.begin(); for (::std::vector<sal_Int16>::size_type i=0;aIter != aKeyType.end(); ++aIter,++i) { - const bool nGreater = (pIndex->getAscending(i) == SQL_ASC) ? false : true; + const bool nGreater = pIndex->getAscending(i) != SQL_ASC; const bool nLess = !nGreater; // compare depending for type diff --git a/connectivity/source/drivers/kab/KStatement.cxx b/connectivity/source/drivers/kab/KStatement.cxx index ec619ee7db5d..5eab3b7a28a5 100644 --- a/connectivity/source/drivers/kab/KStatement.cxx +++ b/connectivity/source/drivers/kab/KStatement.cxx @@ -271,9 +271,7 @@ KabOrder *KabCommonStatement::analyseOrderByClause(const OSQLParseNode *pParseNo OUString sColumnName = pColumnRef->getChild(0)->getTokenValue(); bool bAscending = - SQL_ISTOKEN(pAscendingDescending, DESC)? - false: - true; + !SQL_ISTOKEN(pAscendingDescending, DESC); return new KabSimpleOrder(sColumnName, bAscending); } diff --git a/connectivity/source/drivers/mork/MQueryHelper.cxx b/connectivity/source/drivers/mork/MQueryHelper.cxx index 5cfb9b76c908..b4394c7fbbf4 100644 --- a/connectivity/source/drivers/mork/MQueryHelper.cxx +++ b/connectivity/source/drivers/mork/MQueryHelper.cxx @@ -298,22 +298,22 @@ sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection, MQueryExpression OUString searchedValue = evStr->getValue(); if (evStr->getCond() == MQueryOp::Is) { SAL_INFO("connectivity.mork", "MQueryOp::Is; done"); - resultVector.push_back((currentValue == searchedValue) ? true : false); + resultVector.push_back(currentValue == searchedValue); } else if (evStr->getCond() == MQueryOp::IsNot) { SAL_INFO("connectivity.mork", "MQueryOp::IsNot; done"); - resultVector.push_back((currentValue == searchedValue) ? false : true); + resultVector.push_back(currentValue != searchedValue); } else if (evStr->getCond() == MQueryOp::EndsWith) { SAL_INFO("connectivity.mork", "MQueryOp::EndsWith; done"); - resultVector.push_back((currentValue.endsWith(searchedValue)) ? true : false); + resultVector.push_back(currentValue.endsWith(searchedValue)); } else if (evStr->getCond() == MQueryOp::BeginsWith) { SAL_INFO("connectivity.mork", "MQueryOp::BeginsWith; done"); - resultVector.push_back((currentValue.startsWith(searchedValue)) ? true : false); + resultVector.push_back(currentValue.startsWith(searchedValue)); } else if (evStr->getCond() == MQueryOp::Contains) { SAL_INFO("connectivity.mork", "MQueryOp::Contains; done"); - resultVector.push_back((currentValue.indexOf(searchedValue) == -1) ? false : true); + resultVector.push_back(currentValue.indexOf(searchedValue) != -1); } else if (evStr->getCond() == MQueryOp::DoesNotContain) { SAL_INFO("connectivity.mork", "MQueryOp::DoesNotContain; done"); - resultVector.push_back((currentValue.indexOf(searchedValue) == -1) ? true : false); + resultVector.push_back(currentValue.indexOf(searchedValue) == -1); } else if (evStr->getCond() == MQueryOp::RegExp) { SAL_INFO("connectivity.mork", "MQueryOp::RegExp; done"); utl::SearchParam param( @@ -326,10 +326,10 @@ sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection, MQueryExpression } } else if (evStr->getCond() == MQueryOp::Exists) { SAL_INFO("connectivity.mork", "MQueryOp::Exists; done"); - resultVector.push_back((currentValue.isEmpty()) ? false : true); + resultVector.push_back(!currentValue.isEmpty()); } else if (evStr->getCond() == MQueryOp::DoesNotExist) { SAL_INFO("connectivity.mork", "MQueryOp::DoesNotExist; done"); - resultVector.push_back((currentValue.isEmpty()) ? true : false); + resultVector.push_back(currentValue.isEmpty()); } } else if ( (*evIter)->isExpr() ) { diff --git a/include/connectivity/FValue.hxx b/include/connectivity/FValue.hxx index 4fc1d081df4f..658e3394fd94 100644 --- a/include/connectivity/FValue.hxx +++ b/include/connectivity/FValue.hxx @@ -316,7 +316,7 @@ namespace connectivity // we the possibility to save a any for bookmarks ORowSetValue& operator=(const ::com::sun::star::uno::Any& _rAny); - operator bool() const { return isNull() ? false : getBool(); } + operator bool() const { return !isNull() && getBool(); } operator sal_Int8() const { return isNull() ? static_cast<sal_Int8>(0) : getInt8(); } operator sal_uInt8() const { return isNull() ? static_cast<sal_uInt8>(0) : getUInt8(); } |