Kaydet (Commit) cf7f31c1 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

loplugin:simplifybool

Change-Id: Ib0290487a963d665a628bd75f4140a9e2b89faa7
üst 820fca75
...@@ -40,7 +40,7 @@ struct TKeyValueFunc : ::std::binary_function<OSortIndex::TIntValuePairVector::v ...@@ -40,7 +40,7 @@ struct TKeyValueFunc : ::std::binary_function<OSortIndex::TIntValuePairVector::v
::std::vector<OKeyType>::const_iterator aIter = aKeyType.begin(); ::std::vector<OKeyType>::const_iterator aIter = aKeyType.begin();
for (::std::vector<sal_Int16>::size_type i=0;aIter != aKeyType.end(); ++aIter,++i) 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; const bool nLess = !nGreater;
// compare depending for type // compare depending for type
......
...@@ -271,9 +271,7 @@ KabOrder *KabCommonStatement::analyseOrderByClause(const OSQLParseNode *pParseNo ...@@ -271,9 +271,7 @@ KabOrder *KabCommonStatement::analyseOrderByClause(const OSQLParseNode *pParseNo
OUString sColumnName = OUString sColumnName =
pColumnRef->getChild(0)->getTokenValue(); pColumnRef->getChild(0)->getTokenValue();
bool bAscending = bool bAscending =
SQL_ISTOKEN(pAscendingDescending, DESC)? !SQL_ISTOKEN(pAscendingDescending, DESC);
false:
true;
return new KabSimpleOrder(sColumnName, bAscending); return new KabSimpleOrder(sColumnName, bAscending);
} }
......
...@@ -298,22 +298,22 @@ sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection, MQueryExpression ...@@ -298,22 +298,22 @@ sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection, MQueryExpression
OUString searchedValue = evStr->getValue(); OUString searchedValue = evStr->getValue();
if (evStr->getCond() == MQueryOp::Is) { if (evStr->getCond() == MQueryOp::Is) {
SAL_INFO("connectivity.mork", "MQueryOp::Is; done"); 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) { } else if (evStr->getCond() == MQueryOp::IsNot) {
SAL_INFO("connectivity.mork", "MQueryOp::IsNot; done"); 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) { } else if (evStr->getCond() == MQueryOp::EndsWith) {
SAL_INFO("connectivity.mork", "MQueryOp::EndsWith; done"); 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) { } else if (evStr->getCond() == MQueryOp::BeginsWith) {
SAL_INFO("connectivity.mork", "MQueryOp::BeginsWith; done"); 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) { } else if (evStr->getCond() == MQueryOp::Contains) {
SAL_INFO("connectivity.mork", "MQueryOp::Contains; done"); 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) { } else if (evStr->getCond() == MQueryOp::DoesNotContain) {
SAL_INFO("connectivity.mork", "MQueryOp::DoesNotContain; done"); 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) { } else if (evStr->getCond() == MQueryOp::RegExp) {
SAL_INFO("connectivity.mork", "MQueryOp::RegExp; done"); SAL_INFO("connectivity.mork", "MQueryOp::RegExp; done");
utl::SearchParam param( utl::SearchParam param(
...@@ -326,10 +326,10 @@ sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection, MQueryExpression ...@@ -326,10 +326,10 @@ sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection, MQueryExpression
} }
} else if (evStr->getCond() == MQueryOp::Exists) { } else if (evStr->getCond() == MQueryOp::Exists) {
SAL_INFO("connectivity.mork", "MQueryOp::Exists; done"); 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) { } else if (evStr->getCond() == MQueryOp::DoesNotExist) {
SAL_INFO("connectivity.mork", "MQueryOp::DoesNotExist; done"); SAL_INFO("connectivity.mork", "MQueryOp::DoesNotExist; done");
resultVector.push_back((currentValue.isEmpty()) ? true : false); resultVector.push_back(currentValue.isEmpty());
} }
} }
else if ( (*evIter)->isExpr() ) { else if ( (*evIter)->isExpr() ) {
......
...@@ -316,7 +316,7 @@ namespace connectivity ...@@ -316,7 +316,7 @@ namespace connectivity
// we the possibility to save a any for bookmarks // we the possibility to save a any for bookmarks
ORowSetValue& operator=(const ::com::sun::star::uno::Any& _rAny); 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_Int8() const { return isNull() ? static_cast<sal_Int8>(0) : getInt8(); }
operator sal_uInt8() const { return isNull() ? static_cast<sal_uInt8>(0) : getUInt8(); } operator sal_uInt8() const { return isNull() ? static_cast<sal_uInt8>(0) : getUInt8(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment