loplugin:simplifybool for negation of comparison operator

Change-Id: Ie56daf560185274754afbc7a09c432b5c2793791
Reviewed-on: https://gerrit.libreoffice.org/45068
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2017-11-23 06:59:31 +01:00
parent c24c32bf71
commit 7a1c21e53f
77 changed files with 188 additions and 151 deletions
+1 -1
View File
@@ -222,7 +222,7 @@ IMPL_LINK( BreakPointDialog, ButtonHdl, Button *, pButton, void )
{
delete m_aModifiedBreakPointList.remove( pBrk );
m_pComboBox->RemoveEntryAt(nEntry);
if ( nEntry && !( nEntry < m_pComboBox->GetEntryCount() ) )
if ( nEntry && nEntry >= m_pComboBox->GetEntryCount() )
nEntry--;
m_pComboBox->SetText( m_pComboBox->GetEntry( nEntry ) );
if (SfxDispatcher* pDispatcher = GetDispatcher())
+1 -1
View File
@@ -137,7 +137,7 @@ Type getSequenceElementType(const Type& _rSequenceType)
OSL_ENSURE(_rSequenceType.getTypeClass() == TypeClass_SEQUENCE,
"getSequenceElementType: must be called with a sequence type!");
if (!(_rSequenceType.getTypeClass() == TypeClass_SEQUENCE))
if (_rSequenceType.getTypeClass() != TypeClass_SEQUENCE)
return Type();
TypeDescription aTD(_rSequenceType);
+35 -17
View File
@@ -87,25 +87,43 @@ bool SimplifyBool::VisitUnaryLNot(UnaryOperator const * expr) {
return true;
}
auto e = getSubExprOfLogicalNegation(expr->getSubExpr());
if (e == nullptr) {
if (e) {
// Ignore macros, otherwise
// OSL_ENSURE(!b, ...);
// triggers.
if (e->getLocStart().isMacroID())
return true;
// double logical not of an int is an idiom to convert to bool
if (!e->IgnoreImpCasts()->getType()->isBooleanType())
return true;
report(
DiagnosticsEngine::Warning,
("double logical negation expression of the form '!!A' (with A of type"
" %0) can %select{logically|literally}1 be simplified as 'A'"),
expr->getLocStart())
<< e->IgnoreImpCasts()->getType()
<< e->IgnoreImpCasts()->getType()->isBooleanType()
<< expr->getSourceRange();
return true;
}
// Ignore macros, otherwise
// OSL_ENSURE(!b, ...);
// triggers.
if (e->getLocStart().isMacroID())
return true;
// double logical not of an int is an idiom to convert to bool
if (!e->IgnoreImpCasts()->getType()->isBooleanType())
return true;
report(
DiagnosticsEngine::Warning,
("double logical negation expression of the form '!!A' (with A of type"
" %0) can %select{logically|literally}1 be simplified as 'A'"),
expr->getLocStart())
<< e->IgnoreImpCasts()->getType()
<< e->IgnoreImpCasts()->getType()->isBooleanType()
<< expr->getSourceRange();
if (auto binaryOp = dyn_cast<BinaryOperator>(expr->getSubExpr()->IgnoreParenImpCasts())) {
// Ignore macros, otherwise
// OSL_ENSURE(!b, ...);
// triggers.
if (binaryOp->getLocStart().isMacroID())
return true;
auto t = binaryOp->getLHS()->IgnoreImpCasts()->getType()->getUnqualifiedDesugaredType();
// RecordType would require more smarts - we'd need to verify that an inverted operator actually existed
if (t->isTemplateTypeParmType() || t->isRecordType() || t->isDependentType())
return true;
if (!binaryOp->isComparisonOp())
return true;
report(
DiagnosticsEngine::Warning,
("logical negation of comparison operator, can be simplified by inverting operator"),
expr->getLocStart())
<< expr->getSourceRange();
}
return true;
}
@@ -0,0 +1,18 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
void f1(int a, int b)
{
if (!(a < b))
{ // expected-error@-1 {{logical negation of comparison operator, can be simplified by inverting operator [loplugin:simplifybool]}}
a = b;
}
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
@@ -136,7 +136,7 @@ OResultSet::OResultSet(SQLHANDLE _pStatementHandle ,OStatement_Base* pStmt) :
// In other words, isolate them from ODBC restrictions.
// TODO: we assume SQL_GD_BLOCK, unless fetchSize is 1
OTools::GetInfo(m_pStatement->getOwnConnection(),m_aConnectionHandle,SQL_GETDATA_EXTENSIONS,nValueLen,nullptr);
m_bFetchDataInOrder = !((SQL_GD_ANY_ORDER & nValueLen) == SQL_GD_ANY_ORDER);
m_bFetchDataInOrder = ((SQL_GD_ANY_ORDER & nValueLen) != SQL_GD_ANY_ORDER);
}
catch(const Exception&)
{
+1 -1
View File
@@ -1831,7 +1831,7 @@ sal_uInt16 SvxSwPosSizeTabPage::FillPosLB(FrmMap const *_pMap,
// #i22341# - add condition to handle map <aVCharMap>
// that is ambiguous in the alignment.
if ( _pMap[i].nAlign == _nAlign &&
( !(_pMap == aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) )
( _pMap != aVCharMap || _pMap[i].nLBRelations & nLBRelations ) )
{
sSelEntry = sEntry;
}
+1 -1
View File
@@ -227,7 +227,7 @@ public:
OSL_ASSERT( m_xNodeList.is() );
OSL_ASSERT( m_xUpdateInformationProvider.is() );
if( !(m_nCount < m_nNodes ) )
if( m_nCount >= m_nNodes )
throw container::NoSuchElementException(OUString::number(m_nCount), *this);
try
+2 -2
View File
@@ -395,7 +395,7 @@ void CGM::ImplDoClass4()
fStartAngle = fEndAngle;
fEndAngle = fG;
}
if ( ! ( fInterAngle > fStartAngle ) && ( fInterAngle < fEndAngle ) )
if ( ( fInterAngle <= fStartAngle ) && ( fInterAngle < fEndAngle ) )
{
nSwitch ^=1;
aIntermediatePoint = aEndingPoint;
@@ -465,7 +465,7 @@ void CGM::ImplDoClass4()
fStartAngle = fEndAngle;
fEndAngle = fG;
}
if ( ! ( fInterAngle > fStartAngle ) && ( fInterAngle < fEndAngle ) )
if ( ( fInterAngle <= fStartAngle ) && ( fInterAngle < fEndAngle ) )
{
aIntermediatePoint = aEndingPoint;
aEndingPoint = aStartingPoint;
@@ -105,7 +105,7 @@ void SAL_CALL PropertySetContainer::removeByIndex( sal_Int32 nIndex )
{
SolarMutexGuard g;
if ( !((sal_Int32)m_aPropertySetVector.size() > nIndex) )
if ( (sal_Int32)m_aPropertySetVector.size() <= nIndex )
throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
m_aPropertySetVector.erase(m_aPropertySetVector.begin() + nIndex);
@@ -114,7 +114,7 @@ void SAL_CALL PropertySetContainer::removeByIndex( sal_Int32 nIndex )
// XIndexReplace
void SAL_CALL PropertySetContainer::replaceByIndex( sal_Int32 Index, const css::uno::Any& Element )
{
if ( !((sal_Int32)m_aPropertySetVector.size() > Index) )
if ( (sal_Int32)m_aPropertySetVector.size() <= Index )
throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
Reference< XPropertySet > aPropertySetElement;
@@ -210,7 +210,7 @@ void SAL_CALL ItemContainer::replaceByIndex( sal_Int32 Index, const Any& aItem )
static_cast<OWeakObject *>(this), 2 );
ShareGuard aLock( m_aShareMutex );
if ( !(sal_Int32( m_aItemVector.size()) > Index) )
if ( sal_Int32( m_aItemVector.size()) <= Index )
throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
m_aItemVector[Index] = aSeq;
@@ -224,7 +224,7 @@ void SAL_CALL RootItemContainer::replaceByIndex( sal_Int32 Index, const Any& aIt
throw IllegalArgumentException( WRONG_TYPE_EXCEPTION, static_cast<OWeakObject *>(this), 2 );
ShareGuard aLock( m_aShareMutex );
if ( !(sal_Int32( m_aItemVector.size()) > Index) )
if ( sal_Int32( m_aItemVector.size()) <= Index )
throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
m_aItemVector[Index] = aSeq;
+2 -2
View File
@@ -61,7 +61,7 @@ namespace framework
if ( m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_TOP ||
m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
{
if ( !( m_aDockedData.m_aPos.Y == aUIElement.m_aDockedData.m_aPos.Y ) )
if ( m_aDockedData.m_aPos.Y != aUIElement.m_aDockedData.m_aPos.Y )
return ( m_aDockedData.m_aPos.Y < aUIElement.m_aDockedData.m_aPos.Y );
else
{
@@ -76,7 +76,7 @@ namespace framework
}
else
{
if ( !( m_aDockedData.m_aPos.X == aUIElement.m_aDockedData.m_aPos.X ) )
if ( m_aDockedData.m_aPos.X != aUIElement.m_aDockedData.m_aPos.X )
return ( m_aDockedData.m_aPos.X < aUIElement.m_aDockedData.m_aPos.X );
else
{
+14 -14
View File
@@ -123,7 +123,7 @@ bool Bookmark::Read(HWPFile & hwpf)
if (!hwpf.Read2b(dummy))
return false;
if (!(len == 34))// 2 * (BMK_COMMENT_LEN + 1) + 2
if (len != 34)// 2 * (BMK_COMMENT_LEN + 1) + 2
{
return hwpf.SetState(HWP_InvalidFileFormat);
}
@@ -282,7 +282,7 @@ bool TxtBox::Read(HWPFile & hwpf)
UpdateBBox(this);
ncell = nCell;
if (!(ncell > 0)){
if (ncell <= 0){
return hwpf.SetState(HWP_InvalidFileFormat);
}
@@ -656,7 +656,7 @@ bool AutoNum::Read(HWPFile & hwpf)
hwpf.Read2b(&number, 1);
hwpf.Read2b(&dummy, 1);
if (!(hh == dummy)){
if (hh != dummy){
return hwpf.SetState(HWP_InvalidFileFormat);
}
return !hwpf.State();
@@ -679,7 +679,7 @@ bool NewNum::Read(HWPFile & hwpf)
hwpf.Read2b(&number, 1);
hwpf.Read2b(&dummy, 1);
if (!(hh == dummy)){
if (hh != dummy){
return hwpf.SetState(HWP_InvalidFileFormat);
}
return !hwpf.State();
@@ -701,7 +701,7 @@ bool ShowPageNum::Read(HWPFile & hwpf)
hwpf.Read2b(&shape, 1);
hwpf.Read2b(&dummy, 1);
if (!(hh == dummy)){
if (hh != dummy){
return hwpf.SetState(HWP_InvalidFileFormat);
}
m_nPageNumber = hwpf.getCurrentPage();
@@ -725,7 +725,7 @@ bool PageNumCtrl::Read(HWPFile & hwpf)
hwpf.Read2b(&what, 1);
hwpf.Read2b(&dummy, 1);
if (!(hh == dummy)){
if (hh != dummy){
return hwpf.SetState(HWP_InvalidFileFormat);
}
return !hwpf.State();
@@ -744,7 +744,7 @@ bool MailMerge::Read(HWPFile & hwpf)
hwpf.Read1b(field_name, 20);
hwpf.Read2b(&dummy, 1);
if (!(hh == dummy)){
if (hh != dummy){
return hwpf.SetState(HWP_InvalidFileFormat);
}
return !hwpf.State();
@@ -762,7 +762,7 @@ bool Compose::Read(HWPFile & hwpf)
hwpf.Read2b(compose, 3);
hwpf.Read2b(&dummy, 1);
if (!(hh == dummy)){
if (hh != dummy){
return hwpf.SetState(HWP_InvalidFileFormat);
}
return !hwpf.State();
@@ -781,7 +781,7 @@ bool Hyphen::Read(HWPFile & hwpf)
hwpf.Read2b(&width, 1);
hwpf.Read2b(&dummy, 1);
if (!(hh == dummy)){
if (hh != dummy){
return hwpf.SetState(HWP_InvalidFileFormat);
}
return !hwpf.State();
@@ -802,7 +802,7 @@ bool TocMark::Read(HWPFile & hwpf)
hwpf.Read2b(&kind, 1);
hwpf.Read2b(&dummy, 1);
if (!(hh == dummy)){
if (hh != dummy){
return hwpf.SetState(HWP_InvalidFileFormat);
}
return !hwpf.State();
@@ -825,7 +825,7 @@ bool IndexMark::Read(HWPFile & hwpf)
hwpf.Read2b(&pgno, 1);
hwpf.Read2b(&dummy, 1);
if (!(hh == dummy)){
if (hh != dummy){
return hwpf.SetState(HWP_InvalidFileFormat);
}
return !hwpf.State();
@@ -851,7 +851,7 @@ bool Outline::Read(HWPFile & hwpf)
hwpf.Read2b(deco, 14);
hwpf.Read2b(&dummy, 1);
if (!(hh == dummy)){
if (hh != dummy){
return hwpf.SetState(HWP_InvalidFileFormat);
}
return !hwpf.State();
@@ -870,7 +870,7 @@ bool KeepSpace::Read(HWPFile & hwpf)
{
hwpf.Read2b(&dummy, 1);
if (!(hh == dummy)){
if (hh != dummy){
return hwpf.SetState(HWP_InvalidFileFormat);
}
return !hwpf.State();
@@ -889,7 +889,7 @@ bool FixedSpace::Read(HWPFile & hwpf)
{
hwpf.Read2b(&dummy, 1);
if (!(hh == dummy)){
if (hh != dummy){
return hwpf.SetState(HWP_InvalidFileFormat);
}
return !hwpf.State();
+3 -3
View File
@@ -284,13 +284,13 @@ OUString ODataInputStream::readUTF()
case 12: case 13:
// 110x xxxx 10xx xxxx
nCount += 2;
if( ! ( nCount <= nUTFLen ) )
if( nCount > nUTFLen )
{
throw WrongFormatException( );
}
char2 = (sal_uInt8)readByte();
if( ! ( (char2 & 0xC0) == 0x80 ) )
if( (char2 & 0xC0) != 0x80 )
{
throw WrongFormatException( );
}
@@ -301,7 +301,7 @@ OUString ODataInputStream::readUTF()
case 14:
// 1110 xxxx 10xx xxxx 10xx xxxx
nCount += 3;
if( !( nCount <= nUTFLen) )
if( nCount > nUTFLen )
{
throw WrongFormatException( );
}
@@ -85,7 +85,7 @@ bool SunVersion::init(const char *szVersion)
}
//if correct separator then form integer
else if (
! (nPartPos == 0) // prevents: ".4.1", "..1", part must start with digit
(nPartPos != 0) // prevents: ".4.1", "..1", part must start with digit
&& (
//separators after maintenance (1.4.1_01, 1.4.1-beta, or 1.4.1)
(pCur == pEnd || *pCur == '_' || *pCur == '-')
+1 -1
View File
@@ -122,7 +122,7 @@ bool VbaInputStream::updateChunk()
if( mbEof ) return false;
// check header signature
bool bIgnoreBrokenSig = !( (nHeader & VBACHUNK_SIGMASK) == VBACHUNK_SIG );
bool bIgnoreBrokenSig = ( (nHeader & VBACHUNK_SIGMASK) != VBACHUNK_SIG );
// decode length of chunk data and compression flag
bool bCompressed = getFlag( nHeader, VBACHUNK_COMPRESSED );
+1 -1
View File
@@ -789,7 +789,7 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con
}
else if( PyObject_IsInstance( o, getAnyClass( runtime ).get() ) )
{
if( !(ACCEPT_UNO_ANY == mode) )
if( ACCEPT_UNO_ANY != mode )
{
throw RuntimeException(
"uno.Any instance not accepted during method call, "
+1 -1
View File
@@ -713,7 +713,7 @@ RegError ORegistry::closeKey(RegKeyHandle hKey)
REG_GUARD(m_mutex);
OUString const aKeyName (pKey->getName());
if (!(m_openKeyTable.count(aKeyName) > 0))
if (m_openKeyTable.count(aKeyName) <= 0)
return RegError::KEY_NOT_OPEN;
if (pKey->isModified())
+1 -1
View File
@@ -441,7 +441,7 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe)
/* set close-on-exec flag */
int flags;
if (!((flags = fcntl(s, F_GETFD, 0)) < 0))
if ((flags = fcntl(s, F_GETFD, 0)) >= 0)
{
flags |= FD_CLOEXEC;
if (fcntl(s, F_SETFD, flags) < 0)
+9 -9
View File
@@ -347,7 +347,7 @@ rtlDigestError SAL_CALL rtl_digest_updateMD2(
if (!pImpl || !pData)
return rtl_Digest_E_Argument;
if (!(pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmMD2))
if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmMD2)
return rtl_Digest_E_Algorithm;
if (nDatLen == 0)
@@ -406,7 +406,7 @@ rtlDigestError SAL_CALL rtl_digest_getMD2(
if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmMD2)
return rtl_Digest_E_Algorithm;
if (!(pImpl->m_digest.m_length <= nBufLen))
if (pImpl->m_digest.m_length > nBufLen)
return rtl_Digest_E_BufferSize;
ctx = &(pImpl->m_context);
@@ -686,7 +686,7 @@ rtlDigestError SAL_CALL rtl_digest_updateMD5(
if (!pImpl || !pData)
return rtl_Digest_E_Argument;
if (!(pImpl->m_digest.m_algorithm == rtl_Digest_AlgorithmMD5))
if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmMD5)
return rtl_Digest_E_Algorithm;
if (nDatLen == 0)
@@ -760,7 +760,7 @@ rtlDigestError SAL_CALL rtl_digest_getMD5(
if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmMD5)
return rtl_Digest_E_Algorithm;
if (!(pImpl->m_digest.m_length <= nBufLen))
if (pImpl->m_digest.m_length > nBufLen)
return rtl_Digest_E_BufferSize;
ctx = &(pImpl->m_context);
@@ -790,7 +790,7 @@ rtlDigestError SAL_CALL rtl_digest_rawMD5(
if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmMD5)
return rtl_Digest_E_Algorithm;
if (!(pImpl->m_digest.m_length <= nBufLen))
if (pImpl->m_digest.m_length > nBufLen)
return rtl_Digest_E_BufferSize;
ctx = &(pImpl->m_context);
@@ -1201,7 +1201,7 @@ rtlDigestError SAL_CALL rtl_digest_getSHA(
if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmSHA)
return rtl_Digest_E_Algorithm;
if (!(pImpl->m_digest.m_length <= nBufLen))
if (pImpl->m_digest.m_length > nBufLen)
return rtl_Digest_E_BufferSize;
ctx = &(pImpl->m_context);
@@ -1361,7 +1361,7 @@ rtlDigestError SAL_CALL rtl_digest_getSHA1 (
if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmSHA1)
return rtl_Digest_E_Algorithm;
if (!(pImpl->m_digest.m_length <= nBufLen))
if (pImpl->m_digest.m_length > nBufLen)
return rtl_Digest_E_BufferSize;
ctx = &(pImpl->m_context);
@@ -1555,7 +1555,7 @@ rtlDigestError SAL_CALL rtl_digest_getHMAC_MD5(
if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmHMAC_MD5)
return rtl_Digest_E_Algorithm;
if (!(pImpl->m_digest.m_length <= nBufLen))
if (pImpl->m_digest.m_length > nBufLen)
return rtl_Digest_E_BufferSize;
nBufLen = pImpl->m_digest.m_length;
@@ -1751,7 +1751,7 @@ rtlDigestError SAL_CALL rtl_digest_getHMAC_SHA1(
if (pImpl->m_digest.m_algorithm != rtl_Digest_AlgorithmHMAC_SHA1)
return rtl_Digest_E_Algorithm;
if (!(pImpl->m_digest.m_length <= nBufLen))
if (pImpl->m_digest.m_length > nBufLen)
return rtl_Digest_E_BufferSize;
nBufLen = pImpl->m_digest.m_length;
+1 -1
View File
@@ -170,7 +170,7 @@ bool isRepresentableInteger(double fAbsValue)
// this here.
double fInt;
return (nInt <= kMaxInt &&
(!((fInt = static_cast< double >(nInt)) < fAbsValue) && !(fInt > fAbsValue)));
(((fInt = static_cast< double >(nInt)) >= fAbsValue) && (fInt <= fAbsValue)));
}
return false;
}
+1 -1
View File
@@ -611,7 +611,7 @@ inline SaxInvalidCharacterError SaxWriterHelper::startElement(const OUString& rN
nCurrentPos = writeSequence();
if (!writeString(xAttribs->getValueByIndex( i ), true, true) &&
!(eRet == SAX_ERROR))
eRet != SAX_ERROR)
eRet = SAX_WARNING;
mp_Sequence[nCurrentPos] = '"';
+2 -2
View File
@@ -4803,7 +4803,7 @@ void ScDocument::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
void ScDocument::AddCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_uInt32 nIndex )
{
if(!(static_cast<size_t>(nTab) < maTabs.size()))
if(static_cast<size_t>(nTab) >= maTabs.size())
return;
if(!maTabs[nTab])
@@ -4814,7 +4814,7 @@ void ScDocument::AddCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_u
void ScDocument::RemoveCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_uInt32 nIndex )
{
if(!(static_cast<size_t>(nTab) < maTabs.size()))
if(static_cast<size_t>(nTab) >= maTabs.size())
return;
if(!maTabs[nTab])
+2 -2
View File
@@ -1533,8 +1533,8 @@ void OpDcount2::GenSlidingWindowFunction(std::stringstream &ss,
GenTmpVariables(ss,vSubArguments);
int dataCol = 0;
int dataRow = 0;
if(!(vSubArguments[0]->GetFormulaToken()->GetType() ==
formula::svDoubleVectorRef))
if(vSubArguments[0]->GetFormulaToken()->GetType() !=
formula::svDoubleVectorRef)
throw Unhandled(__FILE__, __LINE__);
formula::FormulaToken *tmpCur = vSubArguments[0]->GetFormulaToken();
+1 -1
View File
@@ -258,7 +258,7 @@ void ScChartHelper::SetChartRanges( const uno::Reference< chart2::XChartDocument
xLabeledSequence->setLabel( xNewSeq );
}
if( !(nRange<rRanges.getLength()) )
if( nRange >= rRanges.getLength() )
break;
if( xValues.is())
+1 -1
View File
@@ -2300,7 +2300,7 @@ void XclImpOptionButtonObj::DoProcessControl( ScfPropertySet& rPropSet ) const
}
else
pTbxObj = nullptr;
} while ( pTbxObj && !( pTbxObj->mnFirstInGroup == 1 ) );
} while ( pTbxObj && ( pTbxObj->mnFirstInGroup != 1 ) );
}
else
{
+1 -1
View File
@@ -1069,7 +1069,7 @@ void ScHTMLLayoutParser::TableOn( HtmlImportInfo* pInfo )
}
}
bInCell = false;
if ( bTabInTabCell && !(nTableWidth < nLastWidth) )
if ( bTabInTabCell && (nTableWidth >= nLastWidth) )
{ // Multiple tables in one cell, underneath each other
bTabInTabCell = false;
NextRow( pInfo );
+1 -1
View File
@@ -75,7 +75,7 @@ OUString OrcusFormatDetect::detect(css::uno::Sequence<css::beans::PropertyValue>
while(!bEnd)
{
sal_Int32 nReadBytes = xInputStream->readBytes(aSeq, nBytes);
bEnd = !(nReadBytes == nBytes);
bEnd = (nReadBytes != nBytes);
aContent.append(reinterpret_cast<const char*>(aSeq.getConstArray()), nReadBytes);
}
@@ -815,7 +815,7 @@ sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable,
const sal_Int32 nColumn, const sal_Int32 nRow, bool& bIsAutoStyle) const
{
OSL_ENSURE(static_cast<size_t>(nTable) < aTables.size(), "wrong table");
if (!(static_cast<size_t>(nTable) < aTables.size()))
if (static_cast<size_t>(nTable) >= aTables.size())
return -1;
ScMyFormatRangeAddresses* pFormatRanges(aTables[nTable]);
ScMyFormatRangeAddresses::iterator aItr(pFormatRanges->begin());
@@ -840,7 +840,7 @@ sal_Int32 ScFormatRangeStyles::GetStyleNameIndex(const sal_Int32 nTable, const s
bool& bIsAutoStyle, sal_Int32& nValidationIndex, sal_Int32& nNumberFormat, const sal_Int32 nRemoveBeforeRow)
{
OSL_ENSURE(static_cast<size_t>(nTable) < aTables.size(), "wrong table");
if (!(static_cast<size_t>(nTable) < aTables.size()))
if (static_cast<size_t>(nTable) >= aTables.size())
return -1;
ScMyFormatRangeAddresses* pFormatRanges(aTables[nTable]);
ScMyFormatRangeAddresses::iterator aItr(pFormatRanges->begin());
@@ -1107,7 +1107,7 @@ void ScRowStyles::AddNewTable(const sal_Int32 nTable, const sal_Int32 nFields)
sal_Int32 ScRowStyles::GetStyleNameIndex(const sal_Int32 nTable, const sal_Int32 nField)
{
OSL_ENSURE(static_cast<size_t>(nTable) < aTables.size(), "wrong table");
if (!(static_cast<size_t>(nTable) < aTables.size()))
if (static_cast<size_t>(nTable) >= aTables.size())
return -1;
if (maCache.hasCache(nTable, nField))
+1 -1
View File
@@ -2436,7 +2436,7 @@ void BoundsProvider<IndexType>::Compute(
SAL_INFO("sc.lok.header", "BoundsProvider: rBottomNearest: index: " << aSecondNearest.first
<< ", pos: " << aSecondNearest.second << ", diff: " << nSecondDiff);
bool bReverse = !(std::abs(nFirstDiff) < std::abs(nSecondDiff));
bool bReverse = (std::abs(nFirstDiff) >= std::abs(nSecondDiff));
if(bReverse)
{
+6 -6
View File
@@ -1120,7 +1120,7 @@ void ScViewData::ResetOldCursor()
SCCOL ScViewData::GetCurXForTab( SCTAB nTabIndex ) const
{
if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size())))
if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size())))
return -1;
return maTabData[nTabIndex]->nCurX;
@@ -1128,7 +1128,7 @@ SCCOL ScViewData::GetCurXForTab( SCTAB nTabIndex ) const
SCROW ScViewData::GetCurYForTab( SCTAB nTabIndex ) const
{
if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size())))
if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size())))
return -1;
return maTabData[nTabIndex]->nCurY;
@@ -1136,7 +1136,7 @@ SCROW ScViewData::GetCurYForTab( SCTAB nTabIndex ) const
void ScViewData::SetCurXForTab( SCCOL nNewCurX, SCTAB nTabIndex )
{
if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size())))
if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size())))
return;
maTabData[nTabIndex]->nCurX = nNewCurX;
@@ -1144,7 +1144,7 @@ void ScViewData::SetCurXForTab( SCCOL nNewCurX, SCTAB nTabIndex )
void ScViewData::SetCurYForTab( SCCOL nNewCurY, SCTAB nTabIndex )
{
if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size())))
if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size())))
return;
maTabData[nTabIndex]->nCurY = nNewCurY;
@@ -1853,7 +1853,7 @@ void ScViewData::SetTabNo( SCTAB nNewTab )
ScPositionHelper* ScViewData::GetLOKWidthHelper(SCTAB nTabIndex)
{
if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size())))
if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size())))
{
return nullptr;
}
@@ -1862,7 +1862,7 @@ ScPositionHelper* ScViewData::GetLOKWidthHelper(SCTAB nTabIndex)
ScPositionHelper* ScViewData::GetLOKHeightHelper(SCTAB nTabIndex)
{
if (!ValidTab(nTabIndex) || !(nTabIndex < static_cast<SCTAB>(maTabData.size())))
if (!ValidTab(nTabIndex) || (nTabIndex >= static_cast<SCTAB>(maTabData.size())))
{
return nullptr;
}
+1 -1
View File
@@ -439,7 +439,7 @@ void SdPageObjsTLB::Fill( const SdDrawDocument* pInDoc, bool bAllPages,
{
const SdPage* pPage = static_cast<const SdPage*>( mpDoc->GetPage( nPage ) );
if( (mbShowAllPages || pPage->GetPageKind() == PageKind::Standard)
&& !(pPage->GetPageKind()==PageKind::Handout) ) //#94954# never list the normal handout page ( handout-masterpage is used instead )
&& (pPage->GetPageKind() != PageKind::Handout) ) //#94954# never list the normal handout page ( handout-masterpage is used instead )
{
bool bPageExluded = pPage->IsExcluded();
+1 -1
View File
@@ -117,7 +117,7 @@ void SAL_CALL PresenterTextView::initialize (const Sequence<Any>& rArguments)
{
ThrowIfDisposed();
if (!(rArguments.getLength() == 1))
if (rArguments.getLength() != 1)
{
throw RuntimeException("PresenterTextView: invalid number of arguments",
static_cast<XWeak*>(this));
+1 -1
View File
@@ -327,7 +327,7 @@ void SfxActionListBox::Recalc()
VclPtr<PopupMenu> SfxActionListBox::CreateContextMenu()
{
if( !( GetSelectionCount() > 0 ) )
if( GetSelectionCount() <= 0 )
{
pDialog->EnableEdit( false );
pDialog->EnableDel( false );
+1 -1
View File
@@ -685,7 +685,7 @@ retry:
readStream(i_rImpl, i_xStorage, s_manifest, i_xBaseURI->getStringValue());
} catch (const ucb::InteractiveAugmentedIOException & e) {
// no manifest.rdf: this is not an error in ODF < 1.2
if (!(ucb::IOErrorCode_NOT_EXISTING_PATH == e.Code)) {
if (ucb::IOErrorCode_NOT_EXISTING_PATH != e.Code) {
iaioe = e;
err = true;
}
@@ -39,6 +39,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
compilerplugins/clang/test/refcounting \
compilerplugins/clang/test/salbool \
compilerplugins/clang/test/salunicodeliteral \
compilerplugins/clang/test/simplifybool \
compilerplugins/clang/test/simplifydynamiccast \
compilerplugins/clang/test/stringconstant \
compilerplugins/clang/test/unnecessarycatchthrow \
+7 -7
View File
@@ -415,7 +415,7 @@ sal_Bool SAL_CALL SmGraphicAccessible::setCaretPosition( sal_Int32 nIndex )
{
SolarMutexGuard aGuard;
OUString aTxt( GetAccessibleText_Impl() );
if (!(nIndex < aTxt.getLength()))
if (nIndex >= aTxt.getLength())
throw IndexOutOfBoundsException();
return false;
}
@@ -424,7 +424,7 @@ sal_Unicode SAL_CALL SmGraphicAccessible::getCharacter( sal_Int32 nIndex )
{
SolarMutexGuard aGuard;
OUString aTxt( GetAccessibleText_Impl() );
if (!(nIndex < aTxt.getLength()))
if (nIndex >= aTxt.getLength())
throw IndexOutOfBoundsException();
return aTxt[nIndex];
}
@@ -621,8 +621,8 @@ OUString SAL_CALL SmGraphicAccessible::getTextRange(
OUString aTxt( GetAccessibleText_Impl() );
sal_Int32 nStart = std::min(nStartIndex, nEndIndex);
sal_Int32 nEnd = std::max(nStartIndex, nEndIndex);
if (!(nStart <= aTxt.getLength()) ||
!(nEnd <= aTxt.getLength()))
if ((nStart > aTxt.getLength()) ||
(nEnd > aTxt.getLength()))
throw IndexOutOfBoundsException();
return aTxt.copy( nStart, nEnd - nStart );
}
@@ -632,7 +632,7 @@ css::accessibility::TextSegment SAL_CALL SmGraphicAccessible::getTextAtIndex( sa
SolarMutexGuard aGuard;
OUString aTxt( GetAccessibleText_Impl() );
//!! nIndex is allowed to be the string length
if (!(nIndex <= aTxt.getLength()))
if (nIndex > aTxt.getLength())
throw IndexOutOfBoundsException();
css::accessibility::TextSegment aResult;
@@ -652,7 +652,7 @@ css::accessibility::TextSegment SAL_CALL SmGraphicAccessible::getTextBeforeIndex
SolarMutexGuard aGuard;
OUString aTxt( GetAccessibleText_Impl() );
//!! nIndex is allowed to be the string length
if (!(nIndex <= aTxt.getLength()))
if (nIndex > aTxt.getLength())
throw IndexOutOfBoundsException();
css::accessibility::TextSegment aResult;
@@ -673,7 +673,7 @@ css::accessibility::TextSegment SAL_CALL SmGraphicAccessible::getTextBehindIndex
SolarMutexGuard aGuard;
OUString aTxt( GetAccessibleText_Impl() );
//!! nIndex is allowed to be the string length
if (!(nIndex <= aTxt.getLength()))
if (nIndex > aTxt.getLength())
throw IndexOutOfBoundsException();
css::accessibility::TextSegment aResult;
+4 -4
View File
@@ -80,11 +80,11 @@ storeError ILockBytes::readAt (sal_uInt32 nOffset, void * pBuffer, sal_uInt32 nB
{
// [SECURITY:ValInput]
sal_uInt8 * dst_lo = static_cast<sal_uInt8*>(pBuffer);
if (!(dst_lo != nullptr))
if (dst_lo == nullptr)
return store_E_InvalidParameter;
sal_uInt8 * dst_hi = dst_lo + nBytes;
if (!(dst_lo < dst_hi))
if (dst_lo >= dst_hi)
return (dst_lo > dst_hi) ? store_E_InvalidParameter : store_E_None;
OSL_PRECOND(!(nOffset == STORE_PAGE_NULL), "store::ILockBytes::readAt(): invalid Offset");
@@ -102,11 +102,11 @@ storeError ILockBytes::writeAt (sal_uInt32 nOffset, void const * pBuffer, sal_uI
{
// [SECURITY:ValInput]
sal_uInt8 const * src_lo = static_cast<sal_uInt8 const*>(pBuffer);
if (!(src_lo != nullptr))
if (src_lo == nullptr)
return store_E_InvalidParameter;
sal_uInt8 const * src_hi = src_lo + nBytes;
if (!(src_lo < src_hi))
if (src_lo >= src_hi)
return (src_lo > src_hi) ? store_E_InvalidParameter : store_E_None;
OSL_PRECOND(!(nOffset == STORE_PAGE_NULL), "store::ILockBytes::writeAt(): invalid Offset");
+3 -3
View File
@@ -218,7 +218,7 @@ storeError OStoreIndirectionPageObject::read (
// Check arguments.
sal_uInt16 const nLimit = rPage.capacityCount();
if (!(nSingle < nLimit))
if (nSingle >= nLimit)
return store_E_InvalidAccess;
// Obtain data page location.
@@ -308,7 +308,7 @@ storeError OStoreIndirectionPageObject::write (
// Check arguments.
sal_uInt16 const nLimit = rPage.capacityCount();
if (!(nSingle < nLimit))
if (nSingle >= nLimit)
return store_E_InvalidAccess;
// Obtain data page location.
@@ -416,7 +416,7 @@ storeError OStoreIndirectionPageObject::truncate (
// Check arguments.
sal_uInt16 const nLimit = rPage.capacityCount();
if (!(nSingle < nLimit))
if (nSingle >= nLimit)
return store_E_InvalidAccess;
// Truncate.
+3 -3
View File
@@ -160,7 +160,7 @@ storeError OStorePageManager::remove_Impl (entry & rEntry)
// Check current page index.
PageHolderObject< page > xPage (aNode.get());
sal_uInt16 i = xPage->find (rEntry), n = xPage->usageCount();
if (!(i < n))
if (i >= n)
{
// Path to entry not exists (Must not happen(?)).
return store_E_NotExists;
@@ -191,7 +191,7 @@ storeError OStorePageManager::remove_Impl (entry & rEntry)
// Check index.
i = xPage->find (rEntry);
n = xPage->usageCount();
if (!(i < n))
if (i >= n)
{
// Path to entry not exists (Must not happen(?)).
return store_E_NotExists;
@@ -229,7 +229,7 @@ storeError OStorePageManager::namei (
return store_E_InvalidParameter;
// Check name length.
if (!(pName->length < STORE_MAXIMUM_NAMESIZE))
if (pName->length >= STORE_MAXIMUM_NAMESIZE)
return store_E_NameTooLong;
// Transform pathname into key.
+5 -5
View File
@@ -232,7 +232,7 @@ storeError OStoreBTreeNodeObject::remove (
{
// Check link entry.
T const aEntryL (rPage.m_pData[nIndexL]);
if (!(rEntryL.compare (aEntryL) == T::COMPARE_EQUAL))
if (rEntryL.compare (aEntryL) != T::COMPARE_EQUAL)
return store_E_InvalidAccess;
// Load link node.
@@ -270,7 +270,7 @@ storeError OStoreBTreeNodeObject::remove (
else
{
// Check leaf entry.
if (!(rEntryL.compare (rPage.m_pData[nIndexL]) == T::COMPARE_EQUAL))
if (rEntryL.compare (rPage.m_pData[nIndexL]) != T::COMPARE_EQUAL)
return store_E_NotExists;
// Save leaf entry.
@@ -400,7 +400,7 @@ storeError OStoreBTreeRootObject::find_lookup (
page const & rPage = (*xPage);
sal_uInt16 const i = rPage.find(entry);
sal_uInt16 const n = rPage.usageCount();
if (!(i < n))
if (i >= n)
{
// Path to entry not exists (Must not happen(?)).
return store_E_NotExists;
@@ -423,7 +423,7 @@ storeError OStoreBTreeRootObject::find_lookup (
// Find index.
page const & rPage = (*xPage);
rIndex = rPage.find(entry);
if (!(rIndex < rPage.usageCount()))
if (rIndex >= rPage.usageCount())
return store_E_NotExists;
// Compare entry.
@@ -485,7 +485,7 @@ storeError OStoreBTreeRootObject::find_insert (
page const & rPage = (*xPage);
sal_uInt16 const i = rPage.find (entry);
sal_uInt16 const n = rPage.usageCount();
if (!(i < n))
if (i >= n)
{
// Path to entry not exists (Must not happen(?)).
return store_E_NotExists;
+1 -1
View File
@@ -176,7 +176,7 @@ struct OStoreBTreeNodeData : public store::PageData
*/
bool querySplit() const
{
return (!(usageCount() < capacityCount()));
return usageCount() >= capacityCount();
}
/** Operation.
+1 -1
View File
@@ -242,7 +242,7 @@ void INetURLHistory_Impl::putUrl (const OUString &rUrl)
sal_uInt16 nLRU = m_pList[m_aHead.m_nNext].m_nPrev;
sal_uInt16 nSI = find (m_pList[nLRU].m_nHash);
if (!(nLRU == m_pHash[nSI].m_nLru))
if (nLRU != m_pHash[nSI].m_nLru)
{
// Update LRU chain.
nLRU = m_pHash[nSI].m_nLru;
+2 -2
View File
@@ -1689,8 +1689,8 @@ bool SvNumberFormatter::GetPreviewStringGuess( const OUString& sFormatString,
if ( !bEnglishFormat )
{
if ( !(nCheckPos == 0) || xTransliteration->isEqual( sFormatString,
pEntry->GetFormatstring() ) )
if ( nCheckPos != 0 || xTransliteration->isEqual( sFormatString,
pEntry->GetFormatstring() ) )
{
// other Format
sTmpString = sFormatString;
+1 -1
View File
@@ -2368,7 +2368,7 @@ bool SvNumberformat::GetOutputString(double fNumber,
{
if (::rtl::math::isSignBitSet(fNumber))
{
if (!(fNumber < 0.0))
if (fNumber >= 0.0)
fNumber = -fNumber; // do not display -0.0
}
if (fNumber == 0.0)
+1 -1
View File
@@ -501,7 +501,7 @@ sal_Bool SAL_CALL ValueSetAcc::isAccessibleChildSelected( sal_Int32 nChildIndex
const SolarMutexGuard aSolarGuard;
ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex));
if (!(pItem != nullptr))
if (pItem == nullptr)
throw lang::IndexOutOfBoundsException();
bool bRet = mpParent->IsItemSelected( pItem->mnId );
@@ -682,7 +682,7 @@ tools::Rectangle SvxGraphCtrlAccessibleContext::GetBoundingBox()
tools::Rectangle aBounds ( 0, 0, 0, 0 );
vcl::Window* pWindow = mpControl;
if (!(pWindow != nullptr))
if (pWindow == nullptr)
throw DisposedException();
aBounds = pWindow->GetWindowExtentsRelative (nullptr);
+2 -2
View File
@@ -98,8 +98,8 @@ bool RecoveryCore::isBrokenTempEntry(const TURLInfo& rInfo)
// Note: If the original files was recovery ... but a temp file
// exists ... an error inside the temp file exists!
if (
!(rInfo.RecoveryState == E_RECOVERY_FAILED ) &&
!(rInfo.RecoveryState == E_ORIGINAL_DOCUMENT_RECOVERED)
(rInfo.RecoveryState != E_RECOVERY_FAILED ) &&
(rInfo.RecoveryState != E_ORIGINAL_DOCUMENT_RECOVERED)
)
return false;
+1 -1
View File
@@ -425,7 +425,7 @@ namespace svxform
lcl_initializeCharacterAttributes( _rxControlModel );
if ( !_rControlBoundRect.IsEmpty()
&& !( _rControlBoundRect.GetWidth() > 4 * _rControlBoundRect.GetHeight() )
&& ( _rControlBoundRect.GetWidth() <= 4 * _rControlBoundRect.GetHeight() )
)
{
if ( xPSI->hasPropertyByName( FM_PROP_MULTILINE ) )
@@ -2709,7 +2709,7 @@ void DocumentRedlineManager::checkRedlining(RedlineFlags& _rReadlineMode)
SwEditShell* pEditShell = m_rDoc.GetEditShell();
vcl::Window* pParent = pEditShell ? pEditShell->GetWin() : nullptr;
if ( pParent && !mbReadlineChecked && rRedlineTable.size() > MAX_REDLINE_COUNT
&& !((_rReadlineMode & RedlineFlags::ShowDelete) == RedlineFlags::ShowDelete) )
&& ((_rReadlineMode & RedlineFlags::ShowDelete) != RedlineFlags::ShowDelete) )
{
ScopedVclPtrInstance< MessageDialog > aQuery(pParent, "QueryShowChangesDialog", "modules/swriter/ui/queryshowchangesdialog.ui");
sal_uInt16 nResult = aQuery->Execute();
+1 -1
View File
@@ -903,7 +903,7 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode )
break;
case SwFieldIds::SetExp:
if ( !(eGetMode == GETFLD_EXPAND) ||
if ( (eGetMode != GETFLD_EXPAND) ||
(nsSwGetSetExpType::GSE_STRING & pField->GetSubType()) )
{
sFormula = sTrue;
+1 -1
View File
@@ -956,7 +956,7 @@ void SwNodes::SectionUp(SwNodeRange *pRange)
if( pRange->aStart >= pRange->aEnd ||
pRange->aEnd >= Count() ||
!CheckNodesRange( pRange->aStart, pRange->aEnd ) ||
!( HighestLevel( *this, *pRange ) > 1 ))
( HighestLevel( *this, *pRange ) <= 1 ))
return;
// If the beginning of a range is before or at a start node position, so
+2 -2
View File
@@ -133,8 +133,8 @@ void SwFlyAtContentFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pN
else
pContent = pContent->GetPrevContentFrame();
} while ( pContent &&
!( bBodyFootnote == ( pContent->IsInDocBody() ||
pContent->IsInFootnote() ) ) );
( bBodyFootnote != ( pContent->IsInDocBody() ||
pContent->IsInFootnote() ) ) );
if ( pContent )
aOldIdx = *pContent->GetNode();
+1 -1
View File
@@ -673,7 +673,7 @@ void SwSectionFrame::MoveContentAndDelete( SwSectionFrame* pDel, bool bSave )
{ // Here we can insert ourselves at the beginning
pUp = FirstLeaf( pNxtSct );
pPrv = nullptr;
if( pPrvSct && !( pPrvSct->GetFormat() == pParent ) )
if( pPrvSct && ( pPrvSct->GetFormat() != pParent ) )
pPrvSct = nullptr; // In order that nothing is merged
}
else if( pPrvSct && pPrvSct->GetFormat() == pParent )
+1 -1
View File
@@ -2242,7 +2242,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor)
Sub( aRegion, aTmp );
// The next statement means neither ruby nor rotate(90):
if( !( MultiPortionType::RUBY == pEnd2Pos->nMultiType ) )
if( MultiPortionType::RUBY != pEnd2Pos->nMultiType )
{
SwTwips nTmp = fnRectX.GetTop(pEnd2Pos->aLine);
if( fnRectX.GetTop(aEndRect) != nTmp )
@@ -235,7 +235,7 @@ bool lcl_HasPreviousParaSameNumRule( const SwTextNode& rNode )
const SwNode* pNode = &rNode;
const SwNumRule* pNumRule = rNode.GetNumRule();
while (! (pNode == rNodes.DocumentSectionStartNode(const_cast<SwNode*>(static_cast<SwNode const *>(&rNode))) ) )
while (pNode != rNodes.DocumentSectionStartNode(const_cast<SwNode*>(static_cast<SwNode const *>(&rNode))) )
{
--aIdx;
+1 -1
View File
@@ -602,7 +602,7 @@ void SwLineLayout::MaxAscentDescent( SwTwips& _orAscent,
const bool bFlyCmp = pTmpPortion->IsFlyCntPortion() ?
static_cast<const SwFlyCntPortion*>(pTmpPortion)->IsMax() :
!( pTmpPortion == _pDontConsiderPortion );
( pTmpPortion != _pDontConsiderPortion );
if ( bFlyCmp )
{
+2 -2
View File
@@ -1802,7 +1802,7 @@ void SwTextNode::CopyText( SwTextNode *const pDest,
SwTextAttr * const pHt = m_pSwpHints->Get(n);
const sal_Int32 nAttrStartIdx = pHt->GetStart();
if (!( nAttrStartIdx < nEnd))
if ( nAttrStartIdx >= nEnd )
break;
const sal_Int32 * const pEndIdx = pHt->GetEnd();
@@ -2163,7 +2163,7 @@ void SwTextNode::CutImpl( SwTextNode * const pDest, const SwIndex & rDestStart,
{
SwTextAttr * const pHt = m_pSwpHints->Get(nAttrCnt);
const sal_Int32 nAttrStartIdx = pHt->GetStart();
if (!( nAttrStartIdx < nEnd ))
if ( nAttrStartIdx >= nEnd )
break;
const sal_Int32 * const pEndIdx = pHt->GetEnd();
const sal_uInt16 nWhich = pHt->Which();
+1 -1
View File
@@ -2985,7 +2985,7 @@ uno::Any SAL_CALL SwXFieldEnumeration::nextElement()
{
SolarMutexGuard aGuard;
if (!(m_pImpl->m_nNextIndex < (sal_Int32)m_pImpl->m_Items.size()))
if (m_pImpl->m_nNextIndex >= (sal_Int32)m_pImpl->m_Items.size())
throw container::NoSuchElementException(
"SwXFieldEnumeration::nextElement",
css::uno::Reference<css::uno::XInterface>());
+1 -1
View File
@@ -2998,7 +2998,7 @@ void AttributeOutputBase::TextField( const SwFormatField& rField )
case REF_SEQUENCEFLD:
{
// Not implemented for RTF
if(!(GetExport().GetExportFormat() != MSWordExportBase::ExportFormat::RTF))
if(GetExport().GetExportFormat() == MSWordExportBase::ExportFormat::RTF)
break;
switch (pField->GetFormat())
+1 -1
View File
@@ -2146,7 +2146,7 @@ void WW8FormulaControl::FormulaRead(SwWw8ControlType nWhich,
// we should verify that bits.iType & nWhich concur
OSL_ENSURE( iType == nWhich, "something wrong, expect control type read from stream doesn't match nWhich passed in");
if ( !( iType == nWhich ) )
if ( iType != nWhich )
return; // bail out
sal_uInt8 iRes = (bits1 & 0x7C) >> 2;
+1 -1
View File
@@ -1433,7 +1433,7 @@ sal_Int32 SwFramePage::FillPosLB(const FrameMap* _pMap,
// i#22341 - add condition to handle map <aVCharMap>
// that is ambiguous in the alignment.
if ( _pMap[i].nAlign == _nAlign &&
( !(_pMap == aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) )
( (_pMap != aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) )
{
sSelEntry = sEntry;
}
+1 -1
View File
@@ -421,7 +421,7 @@ void SwModule::SetRedlineAuthor(const OUString &rAuthor)
OUString SwModule::GetRedlineAuthor(std::size_t nPos)
{
OSL_ENSURE(nPos < m_pAuthorNames.size(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash
while(!(nPos < m_pAuthorNames.size()))
while(nPos >= m_pAuthorNames.size())
{
InsertRedlineAuthor("nn");
}
+2 -2
View File
@@ -335,8 +335,8 @@ void SwFlyFrameAttrMgr::ValidateMetrics( SvxSwFrameValidation& rVal,
// aligned at character or top of line in a special case
else if ((eAnchorType == RndStdIds::FLY_AT_PARA) ||
((eAnchorType == RndStdIds::FLY_AT_CHAR) &&
!(rVal.nVRelOrient == text::RelOrientation::CHAR) &&
!(rVal.nVRelOrient == text::RelOrientation::TEXT_LINE) ) )
(rVal.nVRelOrient != text::RelOrientation::CHAR) &&
(rVal.nVRelOrient != text::RelOrientation::TEXT_LINE) ) )
{
if (rVal.nHPos + rVal.nWidth > aBoundRect.Right())
{
+1 -1
View File
@@ -644,7 +644,7 @@ void SwTextShell::ExecField(SfxRequest &rReq)
bIsUrl = pIsUrl->GetValue();
SwScriptField* pField = static_cast<SwScriptField*>(aMgr.GetCurField());
bNew = !pField || !(pField->GetTyp()->Which() == SwFieldIds::Script);
bNew = !pField || (pField->GetTyp()->Which() != SwFieldIds::Script);
bUpdate = pField && ( bIsUrl != (bool)pField->GetFormat() || pField->GetPar2() != aType || pField->GetPar1() != aText );
}
else
+1 -1
View File
@@ -354,7 +354,7 @@ void SwXPrintSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo,
sal_Int16 nTmp = 0;
rValue >>= nTmp;
SwPostItMode nVal = static_cast<SwPostItMode>(nTmp);
if(!(nVal <= SwPostItMode::EndPage))
if(nVal > SwPostItMode::EndPage)
throw lang::IllegalArgumentException();
mpPrtOpt->SetPrintPostIts(nVal);
+1 -1
View File
@@ -1379,7 +1379,7 @@ void SwContentTree::RequestingChildren( SvTreeListEntry* pParent )
assert(!pChild || lcl_IsContentType(pChild) || dynamic_cast<SwOutlineContent*>(static_cast<SwTypeNumber*>(pChild->GetUserData())));
while(pChild &&
lcl_IsContent(pChild) &&
!(static_cast<SwOutlineContent*>(pChild->GetUserData())->GetOutlineLevel() < nLevel)
(static_cast<SwOutlineContent*>(pChild->GetUserData())->GetOutlineLevel() >= nLevel)
)
{
pChild = Prev(pChild);
+1 -1
View File
@@ -225,7 +225,7 @@ namespace toolkitform
}
}
if ( !( i < nCount ) )
if ( i >= nCount )
{
// the loop terminated because there were no more elements
// -> step up, if possible
+2 -2
View File
@@ -59,11 +59,11 @@ void B3dTransformationSet::Orientation(basegfx::B3DHomMatrix& rTarget, const bas
void B3dTransformationSet::Frustum(basegfx::B3DHomMatrix& rTarget, double fLeft, double fRight, double fBottom, double fTop, double fNear, double fFar)
{
if(!(fNear > 0.0))
if(fNear <= 0.0)
{
fNear = 0.001;
}
if(!(fFar > 0.0))
if(fFar <= 0.0)
{
fFar = 1.0;
}
+1 -1
View File
@@ -210,7 +210,7 @@ void Font::SetKerning( FontKerning eKerning )
bool Font::IsKerning() const
{
return !(mpImplFont->meKerning == FontKerning::NONE);
return mpImplFont->meKerning != FontKerning::NONE;
}
void Font::SetWeight( FontWeight eWeight )
+1 -1
View File
@@ -7929,7 +7929,7 @@ void PDFWriterImpl::endTransparencyGroup( const tools::Rectangle& rBoundingBox,
SAL_WARN_IF( nTransparentPercent > 100, "vcl.pdfwriter", "invalid alpha value" );
nTransparentPercent = nTransparentPercent % 100;
if( !(m_aContext.Version >= PDFWriter::PDFVersion::PDF_1_4) )
if( m_aContext.Version < PDFWriter::PDFVersion::PDF_1_4 )
return;
// create XObject
+1 -1
View File
@@ -348,7 +348,7 @@ namespace
GLenum nBinaryFormat = GL_NONE;
glGetProgramiv( nProgramID, GL_PROGRAM_BINARY_LENGTH, &nBinaryLength );
if( !( nBinaryLength > 0 ) )
if( nBinaryLength <= 0 )
{
SAL_WARN( "vcl.opengl", "Binary size is zero" );
return;
+1 -1
View File
@@ -531,7 +531,7 @@ void ImplDrawButton( OutputDevice *const pDev, tools::Rectangle aFillRect,
ImplDraw2ColorFrame( pDev, aFillRect, aColor1, aColor2 );
if ( !((nStyle & BUTTON_DRAW_FLATTEST) == DrawButtonFlags::Flat) )
if ( (nStyle & BUTTON_DRAW_FLATTEST) != DrawButtonFlags::Flat )
{
if ( nStyle & (DrawButtonFlags::Pressed | DrawButtonFlags::Checked) )
{
+2 -2
View File
@@ -583,8 +583,8 @@ bool ImplHandleMouseEvent( const VclPtr<vcl::Window>& xWindow, MouseNotifyEvent
pChild->ImplGetFrameData()->mnFirstMouseX = nMouseX;
pChild->ImplGetFrameData()->mnFirstMouseY = nMouseY;
pChild->ImplGetFrameData()->mnFirstMouseCode = nCode;
pChild->ImplGetFrameData()->mbStartDragCalled = !((nCode & (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)) ==
(rMSettings.GetStartDragCode() & (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)));
pChild->ImplGetFrameData()->mbStartDragCalled = (nCode & (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)) !=
(rMSettings.GetStartDragCode() & (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE));
}
pChild->ImplGetFrameData()->mnMouseDownTime = nMsgTime;
}
+2 -2
View File
@@ -378,7 +378,7 @@ void
PrinterGfx::DrawPolygon (sal_uInt32 nPoints, const Point* pPath)
{
// premature end of operation
if (!(nPoints > 1) || (pPath == nullptr) || !(maFillColor.Is() || maLineColor.Is()))
if (nPoints <= 0 || (pPath == nullptr) || !(maFillColor.Is() || maLineColor.Is()))
return;
// setup closed path
@@ -529,7 +529,7 @@ PrinterGfx::DrawPolygonBezier (sal_uInt32 nPoints, const Point* pPath, const Pol
const sal_uInt32 nBezString = 1024;
sal_Char pString[nBezString];
// premature end of operation
if (!(nPoints > 1) || (pPath == nullptr) || !(maFillColor.Is() || maLineColor.Is()))
if (nPoints <= 0 || (pPath == nullptr) || !(maFillColor.Is() || maLineColor.Is()))
return;
snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(), pPath[0].Y());
@@ -321,7 +321,7 @@ OUString ConvertMSFormatStringToSO(
{
++nI;
//While not at the end and not at an unescaped end quote
while ((nI < nLen) && (!(aNewFormat[nI] == '\"') && (aNewFormat[nI-1] != '\\')))
while ((nI < nLen) && ((aNewFormat[nI] != '\"') && (aNewFormat[nI-1] != '\\')))
++nI;
}
else //normal unquoted section
+1 -1
View File
@@ -1641,7 +1641,7 @@ sal_Int32 SvXMLNumFormatContext::CreateAndInsert( css::uno::Reference< css::util
void SvXMLNumFormatContext::CreateAndInsert(bool /*bOverwrite*/)
{
if (!(nKey > -1))
if (nKey <= -1)
CreateAndInsert(pData->GetNumberFormatter());
}