[Libreoffice-commits] core.git: 18 commits - comphelper/source connectivity/source editeng/source filter/source formula/source i18nlangtag/source idlc/source lotuswordpro/source oox/source pyuno/source sc/source sd/source starmath/source svtools/source svx/source sw/inc sw/source unotools/source vcl/source
Stephan Bergmann
sbergman at redhat.com
Tue Nov 29 16:22:20 UTC 2016
comphelper/source/misc/threadpool.cxx | 9
connectivity/source/drivers/file/FDatabaseMetaData.cxx | 12 -
connectivity/source/drivers/firebird/ResultSet.cxx | 6
connectivity/source/drivers/postgresql/pq_tools.cxx | 9
editeng/source/misc/svxacorr.cxx | 6
filter/source/graphicfilter/ipbm/ipbm.cxx | 3
filter/source/graphicfilter/iras/iras.cxx | 3
formula/source/ui/dlg/FormulaHelper.cxx | 16 +
i18nlangtag/source/languagetag/languagetag.cxx | 4
idlc/source/options.cxx | 6
idlc/source/parser.y | 9
lotuswordpro/source/filter/lwppara1.cxx | 6
oox/source/vml/vmlinputstream.cxx | 20 +
pyuno/source/module/pyuno.cxx | 3
pyuno/source/module/pyuno_runtime.cxx | 3
sc/source/core/data/dociter.cxx | 4
sc/source/core/tool/address.cxx | 6
sc/source/core/tool/chgtrack.cxx | 42 ++--
sc/source/filter/excel/xeview.cxx | 5
sc/source/ui/docshell/dbdocimp.cxx | 3
sc/source/ui/pagedlg/areasdlg.cxx | 3
sc/source/ui/unoobj/docuno.cxx | 6
sc/source/ui/view/viewfun2.cxx | 12 -
sd/source/filter/ppt/pptin.cxx | 8
sd/source/ui/unoidl/UnoDocumentSettings.cxx | 3
starmath/source/visitors.cxx | 171 ++++++++++-------
svtools/source/misc/embedtransfer.cxx | 3
svtools/source/misc/transfer.cxx | 12 -
svx/source/gengal/gengal.cxx | 3
sw/inc/calbck.hxx | 3
sw/source/core/attr/format.cxx | 12 -
sw/source/core/crsr/crsrsh.cxx | 6
sw/source/core/crsr/swcrsr.cxx | 14 -
sw/source/core/crsr/trvltbl.cxx | 3
sw/source/core/doc/docsort.cxx | 3
sw/source/core/doc/tblrwcl.cxx | 9
sw/source/core/docnode/node.cxx | 6
sw/source/core/fields/authfld.cxx | 6
sw/source/core/layout/calcmove.cxx | 16 -
sw/source/core/layout/ftnfrm.cxx | 4
sw/source/core/layout/pagechg.cxx | 3
sw/source/core/layout/paintfrm.cxx | 20 +
sw/source/core/layout/tabfrm.cxx | 3
sw/source/core/unocore/unoframe.cxx | 23 +-
sw/source/core/view/viewsh.cxx | 3
sw/source/filter/basflt/shellio.cxx | 3
sw/source/filter/html/swhtml.cxx | 9
sw/source/filter/ww8/ww8graf2.cxx | 3
sw/source/ui/fldui/fldedt.cxx | 3
sw/source/ui/fldui/javaedit.cxx | 3
sw/source/ui/misc/srtdlg.cxx | 3
sw/source/uibase/app/docsh.cxx | 4
sw/source/uibase/dochdl/swdtflvr.cxx | 6
sw/source/uibase/fldui/fldwrap.cxx | 9
sw/source/uibase/misc/redlndlg.cxx | 5
sw/source/uibase/ribbar/conarc.cxx | 5
sw/source/uibase/ribbar/conpoly.cxx | 5
sw/source/uibase/ribbar/drawbase.cxx | 3
sw/source/uibase/shells/textsh1.cxx | 4
sw/source/uibase/uiview/viewdraw.cxx | 10
sw/source/uibase/uiview/viewtab.cxx | 6
sw/source/uibase/wrtsh/move.cxx | 8
unotools/source/misc/datetime.cxx | 5
vcl/source/app/scheduler.cxx | 4
vcl/source/control/button.cxx | 10
vcl/source/control/tabctrl.cxx | 3
vcl/source/filter/igif/gifread.cxx | 9
vcl/source/filter/ixpm/xpmread.cxx | 3
vcl/source/gdi/animate.cxx | 3
vcl/source/gdi/bitmap.cxx | 3
vcl/source/gdi/bitmap3.cxx | 6
vcl/source/gdi/impgraph.cxx | 3
vcl/source/gdi/pdfwriter_impl.cxx | 44 ++--
vcl/source/gdi/pngwrite.cxx | 3
vcl/source/gdi/sallayout.cxx | 3
vcl/source/window/debugevent.cxx | 11 -
76 files changed, 436 insertions(+), 293 deletions(-)
New commits:
commit f8e3e523e27e0a3838c292a560cf6dba9d20d267
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:21:47 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: comphelper
Change-Id: I8361f62199f45dbced45e5d4a4d5eeddf1c42d67
diff --git a/comphelper/source/misc/threadpool.cxx b/comphelper/source/misc/threadpool.cxx
index f399274..346c171 100644
--- a/comphelper/source/misc/threadpool.cxx
+++ b/comphelper/source/misc/threadpool.cxx
@@ -57,8 +57,7 @@ public:
#if defined DBG_UTIL && defined LINUX
gbIsWorkerThread = true;
#endif
- ThreadTask *pTask;
- while ( ( pTask = waitForWork() ) )
+ while ( ThreadTask * pTask = waitForWork() )
{
std::shared_ptr<ThreadTaskTag> pTag(pTask->getTag());
try {
@@ -189,8 +188,7 @@ void ThreadPool::waitAndCleanupWorkers()
if( maWorkers.empty() )
{ // no threads at all -> execute the work in-line
- ThreadTask *pTask;
- while ( ( pTask = popWork() ) )
+ while ( ThreadTask * pTask = popWork() )
{
std::shared_ptr<ThreadTaskTag> pTag(pTask->getTag());
pTask->doWork();
@@ -269,8 +267,7 @@ void ThreadPool::waitUntilDone(const std::shared_ptr<ThreadTaskTag>& rTag)
if( maWorkers.empty() )
{ // no threads at all -> execute the work in-line
- ThreadTask *pTask;
- while ( ( pTask = popWork() ) )
+ while ( ThreadTask * pTask = popWork() )
{
std::shared_ptr<ThreadTaskTag> pTag(pTask->getTag());
pTask->doWork();
commit 7222ffb79c9886d36b4c0740a51c1c94e763d178
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:21:33 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: connectivity
Change-Id: I67d4bb92db04b5103b98a2855ae6069a054f171b
diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
index 25d95d8..47f9dd6 100644
--- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
@@ -274,8 +274,7 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
}
else // no extension, filter myself
{
- bool bErg = false;
- do
+ for (;;)
{
if (aURL.getExtension().isEmpty())
{
@@ -287,12 +286,13 @@ Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
}
break;
}
- else if ( ( bErg = xResultSet->next() ) )
+ if ( !xResultSet->next() )
{
- aName = xRow->getString(1);
- aURL.SetSmartURL(aName);
+ break;
}
- } while (bErg);
+ aName = xRow->getString(1);
+ aURL.SetSmartURL(aName);
+ }
}
if(bNewRow)
{
diff --git a/connectivity/source/drivers/firebird/ResultSet.cxx b/connectivity/source/drivers/firebird/ResultSet.cxx
index f480465..f4911df 100644
--- a/connectivity/source/drivers/firebird/ResultSet.cxx
+++ b/connectivity/source/drivers/firebird/ResultSet.cxx
@@ -429,7 +429,8 @@ OUString OResultSet::makeNumericString(const sal_Int32 nColumnIndex)
template <typename T>
T OResultSet::retrieveValue(const sal_Int32 nColumnIndex, const ISC_SHORT nType)
{
- if ((m_bWasNull = isNull(nColumnIndex)))
+ m_bWasNull = isNull(nColumnIndex);
+ if (m_bWasNull)
return T();
if ((m_pSqlda->sqlvar[nColumnIndex-1].sqltype & ~1) == nType)
@@ -622,7 +623,8 @@ T OResultSet::safelyRetrieveValue(const sal_Int32 nColumnIndex, const ISC_SHORT
checkColumnIndex(nColumnIndex);
checkRowIndex();
- if ((m_bWasNull = isNull(nColumnIndex)))
+ m_bWasNull = isNull(nColumnIndex);
+ if (m_bWasNull)
return T();
return retrieveValue< T >(nColumnIndex, nType);
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx
index 53a7513..b5799ea 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -870,7 +870,8 @@ css::uno::Sequence< sal_Int32 > string2intarray( const OUString & str )
break;
if ( start == strlen)
return ret;
- } while ( (c=str.iterateCodePoints(&start)) );
+ c=str.iterateCodePoints(&start);
+ } while ( c );
do
{
if (!iswdigit(c))
@@ -878,7 +879,8 @@ css::uno::Sequence< sal_Int32 > string2intarray( const OUString & str )
if ( start == strlen)
return ret;
digits += OUString(&c, 1);
- } while ( (c = str.iterateCodePoints(&start)) );
+ c = str.iterateCodePoints(&start);
+ } while ( c );
vec.push_back( digits.toInt32() );
do
{
@@ -886,7 +888,8 @@ css::uno::Sequence< sal_Int32 > string2intarray( const OUString & str )
break;
if ( start == strlen)
return ret;
- } while ( (c=str.iterateCodePoints(&start)) );
+ c = str.iterateCodePoints(&start);
+ } while ( c );
if ( c == L'}' )
break;
if ( str.iterateCodePoints(&start) != L',' )
commit bffac17a8249416d24986d37a50c5e74a0cb32b2
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:21:18 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: editeng
Change-Id: I374fcd08bdeb37ff542447142b1b164886e0e5db
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index ccb6e26..6317adb 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -857,7 +857,8 @@ bool SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc,
else
break;
}
- } while( ! ( bAtStart = (pStart == pStr) ) );
+ bAtStart = (pStart == pStr);
+ } while( !bAtStart );
if (!pWordStt)
return false; // no character to be replaced
@@ -923,7 +924,8 @@ bool SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc,
--pStr;
if (!IsAutoCapitalizeWordDelim(*pStr))
break;
- } while( ! ( bAtStart = (pStart == pStr) ) );
+ bAtStart = (pStart == pStr);
+ } while( !bAtStart );
if( bAtStart )
return false; // no valid separator -> no replacement
commit 621687e8edae5074bd822e46755c17bb33fbe075
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:21:04 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: filter
Change-Id: I8985f24972d0efd8450de930102ce82cd383b459
diff --git a/filter/source/graphicfilter/ipbm/ipbm.cxx b/filter/source/graphicfilter/ipbm/ipbm.cxx
index 7cdc3e1..4a2961e 100644
--- a/filter/source/graphicfilter/ipbm/ipbm.cxx
+++ b/filter/source/graphicfilter/ipbm/ipbm.cxx
@@ -80,7 +80,8 @@ bool PBMReader::ReadPBM(Graphic & rGraphic )
// read header:
- if ( !( mbStatus = ImplReadHeader() ) )
+ mbStatus = ImplReadHeader();
+ if ( !mbStatus )
return false;
if ( ( mnMaxVal == 0 ) || ( mnWidth <= 0 ) || ( mnHeight <= 0 ) )
diff --git a/filter/source/graphicfilter/iras/iras.cxx b/filter/source/graphicfilter/iras/iras.cxx
index a40202c..19139a8 100644
--- a/filter/source/graphicfilter/iras/iras.cxx
+++ b/filter/source/graphicfilter/iras/iras.cxx
@@ -101,7 +101,8 @@ bool RASReader::ReadRAS(Graphic & rGraphic)
// Kopf einlesen:
- if ( !( mbStatus = ImplReadHeader() ) )
+ mbStatus = ImplReadHeader();
+ if ( !mbStatus )
return false;
maBmp = Bitmap( Size( mnWidth, mnHeight ), mnDstBitsPerPix );
commit 39a33a548b155d14a2ad8e87b54aaab5937fdb0a
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:20:52 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: formula
Change-Id: I28d41341607abae82a3bc5d9cacdb70e7431be18
diff --git a/formula/source/ui/dlg/FormulaHelper.cxx b/formula/source/ui/dlg/FormulaHelper.cxx
index 4e6c6c8..f6eae13 100644
--- a/formula/source/ui/dlg/FormulaHelper.cxx
+++ b/formula/source/ui/dlg/FormulaHelper.cxx
@@ -223,8 +223,12 @@ sal_Int32 FormulaHelper::GetFunctionStart( const OUString& rFormula,
if (nParPos > 0)
nParPos--;
}
- else if ( !(bFound = ( rFormula[nParPos] == '(' ) ) )
- nParPos--;
+ else
+ {
+ bFound = rFormula[nParPos] == '(';
+ if ( !bFound )
+ nParPos--;
+ }
}
}
else
@@ -238,8 +242,12 @@ sal_Int32 FormulaHelper::GetFunctionStart( const OUString& rFormula,
nParPos++;
nParPos++;
}
- else if ( !(bFound = ( rFormula[nParPos] == '(' ) ) )
- nParPos++;
+ else
+ {
+ bFound = rFormula[nParPos] == '(';
+ if ( !bFound )
+ nParPos++;
+ }
}
}
commit 1e8dc795559971eba4bdbaeff9c483ab56635b93
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:20:36 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: i18nlangtag
Change-Id: Ie6b8e644e01ed99559981d001a7ab95d72ffa5c2
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index 899ee5f..11df860 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -1779,8 +1779,8 @@ inline bool isUpperAscii( sal_Unicode c )
bool LanguageTag::isIsoLanguage( const OUString& rLanguage )
{
/* TODO: ignore case? For now let's see where rubbish is used. */
- bool b2chars;
- if (((b2chars = (rLanguage.getLength() == 2)) || rLanguage.getLength() == 3) &&
+ bool b2chars = rLanguage.getLength() == 2;
+ if ((b2chars || rLanguage.getLength() == 3) &&
isLowerAscii( rLanguage[0]) && isLowerAscii( rLanguage[1]) &&
(b2chars || isLowerAscii( rLanguage[2])))
return true;
commit d4864a9440ef3fecb497e1ea7018f927e2e64059
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:20:19 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: idlc
Change-Id: I6be338f54dd8e6912e48258c0a2e075dc69b2893
diff --git a/idlc/source/options.cxx b/idlc/source/options.cxx
index 9a3eee6..0d02236 100644
--- a/idlc/source/options.cxx
+++ b/idlc/source/options.cxx
@@ -69,14 +69,16 @@ bool Options::checkArgument (std::vector< std::string > & rArgs, char const * ar
switch(arg[0])
{
case '@':
- if ((result = (len > 1)))
+ result = len > 1;
+ if (result)
{
// "@<cmdfile>"
result = Options::checkCommandFile (rArgs, &(arg[1]));
}
break;
case '-':
- if ((result = (len > 1)))
+ result = len > 1;
+ if (result)
{
// "-<option>"
switch (arg[1])
diff --git a/idlc/source/parser.y b/idlc/source/parser.y
index 6e7bf78..5589e74 100644
--- a/idlc/source/parser.y
+++ b/idlc/source/parser.y
@@ -445,12 +445,11 @@ module_dcl :
AstScope* pScope = idlc()->scopes()->topNonNull();
AstModule* pModule = nullptr;
- AstDeclaration* pExists = nullptr;
if ( pScope )
{
pModule = new AstModule(*$3, pScope);
- if( (pExists = pScope->lookupForAdd(pModule)) )
+ if( AstDeclaration* pExists = pScope->lookupForAdd(pModule) )
{
pExists->setInMainfile(idlc()->isInMainFile());
pExists->setFileName(pModule->getFileName());
@@ -556,7 +555,6 @@ interface_dcl :
AstScope* pScope = idlc()->scopes()->topNonNull();
AstInterface* pInterface = nullptr;
AstInterface* pForward = nullptr;
- AstDeclaration* pDecl = nullptr;
/*
* Make a new interface node and add it to its enclosing scope
@@ -566,7 +564,7 @@ interface_dcl :
pInterface = new AstInterface(
*$1->getName(),
static_cast< AstInterface const * >(resolveTypedefs($1->getInherits())), pScope);
- if ( (pDecl = pScope->lookupByName(pInterface->getScopedName())) )
+ if ( AstDeclaration* pDecl = pScope->lookupByName(pInterface->getScopedName()) )
{
/*
* See if we're defining a forward declared interface.
@@ -1279,12 +1277,11 @@ constants_dcl :
AstScope* pScope = idlc()->scopes()->topNonNull();
AstConstants* pConstants = nullptr;
- AstDeclaration* pExists = nullptr;
if ( pScope )
{
pConstants = new AstConstants(*$3, pScope);
- if( (pExists = pScope->lookupForAdd(pConstants)) )
+ if( AstDeclaration* pExists = pScope->lookupForAdd(pConstants) )
{
pExists->setInMainfile(idlc()->isInMainFile());
delete(pConstants);
commit 2a2ed5878a79999d405e26a5c586883b19e7b09f
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:20:07 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: lotuswordpro
Change-Id: Iae2b653381562c5a46de6e05afb96954f523114a
diff --git a/lotuswordpro/source/filter/lwppara1.cxx b/lotuswordpro/source/filter/lwppara1.cxx
index 0923312..8752c9e 100644
--- a/lotuswordpro/source/filter/lwppara1.cxx
+++ b/lotuswordpro/source/filter/lwppara1.cxx
@@ -225,7 +225,8 @@ void LwpPara::GetParaNumber(sal_uInt16 nPosition, ParaNumbering* pParaNumbering)
pParaNumbering->nNumLevel = nHideLevels;
//get suffix text frib
- if ( (pFrib = pFrib->GetNext()) )
+ pFrib = pFrib->GetNext();
+ if ( pFrib )
{
if( pFrib->GetType() == FRIB_TAG_TEXT )
{
@@ -259,7 +260,8 @@ void LwpPara::GetParaNumber(sal_uInt16 nPosition, ParaNumbering* pParaNumbering)
pParaNumbering->pParaNumber = static_cast<LwpFribParaNumber*>(pFrib);
//get suffix text frib
- if ( (pFrib = pFrib->GetNext()) )
+ pFrib = pFrib->GetNext();
+ if ( pFrib )
{
if (pFrib->GetType() == FRIB_TAG_TEXT)
{
commit 40e1595de748dbcc700dae46cc81031d927865cc
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:19:53 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: oox
Change-Id: I75de45677603800baec18d03114418181c4393c2
diff --git a/oox/source/vml/vmlinputstream.cxx b/oox/source/vml/vmlinputstream.cxx
index 554b15b2..57204c3 100644
--- a/oox/source/vml/vmlinputstream.cxx
+++ b/oox/source/vml/vmlinputstream.cxx
@@ -93,19 +93,23 @@ void lclProcessAttribs( OStringBuffer& rBuffer, const sal_Char* pcBeg, const sal
{
// pcNameBeg points to begin of attribute name, find equality sign
const sal_Char* pcEqualSign = lclFindCharacter( pcNameBeg, pcEnd, '=' );
- if ((bOk = (pcEqualSign < pcEnd)))
+ bOk = (pcEqualSign < pcEnd);
+ if (bOk)
{
// find end of attribute name (ignore whitespace between name and equality sign)
const sal_Char* pcNameEnd = lclTrimWhiteSpaceFromEnd( pcNameBeg, pcEqualSign );
- if( (bOk = (pcNameBeg < pcNameEnd)) )
+ bOk = (pcNameBeg < pcNameEnd);
+ if( bOk )
{
// find begin of attribute value (must be single or double quote)
const sal_Char* pcValueBeg = lclFindNonWhiteSpace( pcEqualSign + 1, pcEnd );
- if( (bOk = (pcValueBeg < pcEnd) && ((*pcValueBeg == '\'') || (*pcValueBeg == '"'))) )
+ bOk = (pcValueBeg < pcEnd) && ((*pcValueBeg == '\'') || (*pcValueBeg == '"'));
+ if( bOk )
{
// find end of attribute value (matching quote character)
const sal_Char* pcValueEnd = lclFindCharacter( pcValueBeg + 1, pcEnd, *pcValueBeg );
- if( (bOk = (pcValueEnd < pcEnd)) )
+ bOk = (pcValueEnd < pcEnd);
+ if( bOk )
{
++pcValueEnd;
OString aAttribName( pcNameBeg, static_cast< sal_Int32 >( pcNameEnd - pcNameBeg ) );
@@ -120,8 +124,12 @@ void lclProcessAttribs( OStringBuffer& rBuffer, const sal_Char* pcBeg, const sal
aAttributes[ pcNameBeg ] = aAttribData;
// continue with next attribute (skip whitespace after this attribute)
pcNameBeg = pcValueEnd;
- if( (pcNameBeg < pcEnd) && ((bOk = lclIsWhiteSpace( *pcNameBeg ))) )
- pcNameBeg = lclFindNonWhiteSpace( pcNameBeg + 1, pcEnd );
+ if( pcNameBeg < pcEnd )
+ {
+ bOk = lclIsWhiteSpace( *pcNameBeg );
+ if( bOk )
+ pcNameBeg = lclFindNonWhiteSpace( pcNameBeg + 1, pcEnd );
+ }
}
}
}
commit 542174a24e00ab81430a4028f49222dddb3e284f
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:19:43 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: pyuno
Change-Id: I01ce742c727c66577d747e441a3794c1743f24ce
diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx
index 8c53f74..e94309d 100644
--- a/pyuno/source/module/pyuno.cxx
+++ b/pyuno/source/module/pyuno.cxx
@@ -1338,8 +1338,7 @@ int PyUNO_contains( PyObject *self, PyObject *pKey )
PyRef rIterator( PyUNO_iter( self ), SAL_NO_ACQUIRE );
if ( rIterator.is() )
{
- PyObject* pItem;
- while ( (pItem = PyIter_Next( rIterator.get() )) )
+ while ( PyObject* pItem = PyIter_Next( rIterator.get() ) )
{
PyRef rItem( pItem, SAL_NO_ACQUIRE );
if ( PyObject_RichCompareBool( pKey, rItem.get(), Py_EQ ) == 1 )
diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx
index 4dd532ff..c4b5aa9 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -630,8 +630,9 @@ bool Runtime::pyIterUnpack( PyObject *const pObj, Any &a ) const
{
PyRef rItem( pItem, SAL_NO_ACQUIRE );
items.push_back( pyObject2Any( rItem.get() ) );
+ pItem = PyIter_Next( pObj );
}
- while( (pItem = PyIter_Next( pObj )) );
+ while( pItem );
a <<= comphelper::containerToSequence(items);
return true;
}
commit 34dda497cdf0b131381c5d728a89343455d9c7d8
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:19:32 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: sc
Change-Id: Ia2dfbd64d63958d4f9c04e892cc7ebc250e9ca70
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 8bbb121..6f3467f 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -82,8 +82,8 @@ void ScAttrArray_IterGetNumberFormat( sal_uLong& nFormat, const ScAttrArray*& rp
{
SCROW nRowStart = 0;
SCROW nRowEnd = MAXROW;
- const ScPatternAttr* pPattern;
- if( !(pPattern = pNewArr->GetPatternRange( nRowStart, nRowEnd, nRow ) ) )
+ const ScPatternAttr* pPattern = pNewArr->GetPatternRange( nRowStart, nRowEnd, nRow );
+ if( !pPattern )
{
pPattern = pDoc->GetDefPattern();
nRowEnd = MAXROW;
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index 0a7a2a9..ad82b72 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -662,7 +662,8 @@ static const sal_Unicode* lcl_r1c1_get_col( const sal_Unicode* p,
return nullptr;
p++;
- if( ( isRelative = (*p == '[') ) )
+ isRelative = *p == '[';
+ if( isRelative )
p++;
n = sal_Unicode_strtol( p, &pEnd );
if( nullptr == pEnd )
@@ -708,7 +709,8 @@ static inline const sal_Unicode* lcl_r1c1_get_row(
return nullptr;
p++;
- if( ( isRelative = (*p == '[') ) )
+ isRelative = *p == '[';
+ if( isRelative )
p++;
n = sal_Unicode_strtol( p, &pEnd );
if( nullptr == pEnd )
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 9a6963f..1b34fe2 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -1013,21 +1013,18 @@ bool ScChangeActionDel::Reject( ScDocument* pDoc )
case SC_CAT_DELETE_COLS :
if ( !(aRange.aStart.Col() == 0 && aRange.aEnd.Col() == MAXCOL) )
{ // Only if not TabDelete
- if ( ( bOk = pDoc->CanInsertCol( aRange ) ) )
- bOk = pDoc->InsertCol( aRange );
+ bOk = pDoc->CanInsertCol( aRange ) && pDoc->InsertCol( aRange );
}
break;
case SC_CAT_DELETE_ROWS :
- if ( ( bOk = pDoc->CanInsertRow( aRange ) ) )
- bOk = pDoc->InsertRow( aRange );
+ bOk = pDoc->CanInsertRow( aRange ) && pDoc->InsertRow( aRange );
break;
case SC_CAT_DELETE_TABS :
{
//TODO: Remember table names?
OUString aName;
pDoc->CreateValidTabName( aName );
- if ( ( bOk = pDoc->ValidNewTabName( aName ) ) )
- bOk = pDoc->InsertTab( aRange.aStart.Tab(), aName );
+ bOk = pDoc->ValidNewTabName( aName ) && pDoc->InsertTab( aRange.aStart.Tab(), aName );
}
break;
default:
@@ -4239,11 +4236,15 @@ bool ScChangeTrack::Reject(
bOk = Reject( itChangeAction->second, nullptr, true ); // Recursion!
}
}
- if ( bOk && (bRejected = pAct->Reject( pDoc )) )
+ if ( bOk )
{
- // pRefDoc NULL := Do not save deleted Cells
- AppendDeleteRange( pAct->GetBigRange().MakeRange(), nullptr, (short) 0,
- pAct->GetActionNumber() );
+ bRejected = pAct->Reject( pDoc );
+ if ( bRejected )
+ {
+ // pRefDoc NULL := Do not save deleted Cells
+ AppendDeleteRange( pAct->GetBigRange().MakeRange(), nullptr, (short) 0,
+ pAct->GetActionNumber() );
+ }
}
}
else if ( pAct->IsDeleteType() )
@@ -4352,14 +4353,18 @@ bool ScChangeTrack::Reject(
bOk = Reject( itChangeAction->second, nullptr, true ); // Recursion!
}
}
- if ( bOk && (bRejected = pAct->Reject( pDoc )) )
+ if ( bOk )
{
- ScChangeActionMove* pReject = new ScChangeActionMove(
- pAct->GetBigRange().MakeRange(),
- static_cast<ScChangeActionMove*>(pAct)->GetFromRange().MakeRange(), this );
- pReject->SetRejectAction( pAct->GetActionNumber() );
- pReject->SetState( SC_CAS_ACCEPTED );
- Append( pReject );
+ bRejected = pAct->Reject( pDoc );
+ if ( bRejected )
+ {
+ ScChangeActionMove* pReject = new ScChangeActionMove(
+ pAct->GetBigRange().MakeRange(),
+ static_cast<ScChangeActionMove*>(pAct)->GetFromRange().MakeRange(), this );
+ pReject->SetRejectAction( pAct->GetActionNumber() );
+ pReject->SetState( SC_CAS_ACCEPTED );
+ Append( pReject );
+ }
}
}
else if ( pAct->GetType() == SC_CAT_CONTENT )
@@ -4376,7 +4381,8 @@ bool ScChangeTrack::Reject(
aCell.assign(*pDoc, aRange.aStart);
pReject->SetOldValue(aCell, pDoc, pDoc);
}
- if ( (bRejected = pAct->Reject( pDoc )) && !bRecursion )
+ bRejected = pAct->Reject( pDoc );
+ if ( bRejected && !bRecursion )
{
ScCellValue aCell;
aCell.assign(*pDoc, aRange.aStart);
diff --git a/sc/source/filter/excel/xeview.cxx b/sc/source/filter/excel/xeview.cxx
index 550c9ed..153ee4f 100644
--- a/sc/source/filter/excel/xeview.cxx
+++ b/sc/source/filter/excel/xeview.cxx
@@ -209,8 +209,11 @@ XclExpSelection::XclExpSelection( const XclTabViewData& rData, sal_uInt8 nPane )
XclRangeList& rXclSel = maSelData.maXclSelection;
bool bFound = false;
for( XclRangeVector::const_iterator aIt = rXclSel.begin(), aEnd = rXclSel.end(); !bFound && (aIt != aEnd); ++aIt )
- if( (bFound = aIt->Contains( maSelData.maXclCursor )) )
+ {
+ bFound = aIt->Contains( maSelData.maXclCursor );
+ if( bFound )
maSelData.mnCursorIdx = static_cast< sal_uInt16 >( aIt - rXclSel.begin() );
+ }
/* Cursor cell not found in list? (e.g. inactive pane, or removed in
ConvertRangeList(), because Calc cursor on invalid pos)
-> insert the valid Excel cursor. */
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index 22f07c4..408ae02 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -293,7 +293,8 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
// skip rows that are not selected
if ( !bDoSelection )
{
- if ( !(bEnd = !xRowSet->next()) )
+ bEnd = !xRowSet->next();
+ if ( !bEnd )
++nRowsRead;
}
else
diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx
index 1165a85..b0561f2 100644
--- a/sc/source/ui/pagedlg/areasdlg.cxx
+++ b/sc/source/ui/pagedlg/areasdlg.cxx
@@ -644,7 +644,8 @@ static bool lcl_CheckOne_OOO( const OUString& rStr, bool bIsRow, SCCOLROW& rVal
{
sal_Int32 n = aStr.toInt32();
- if ( ( bStrOk = (n > 0) && ( n <= MAXROWCOUNT ) ) )
+ bStrOk = (n > 0) && ( n <= MAXROWCOUNT );
+ if ( bStrOk )
nNum = static_cast<SCCOLROW>(n - 1);
}
}
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 7b61def..ca17d59 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -723,13 +723,11 @@ OString ScModelObj::getTextSelection(const char* pMimeType, OString& rUsedMimeTy
{
SolarMutexGuard aGuard;
- ScEditShell* pShell;
- ScDrawShell* pDrawShell;
TransferableDataHelper aDataHelper;
ScViewData* pViewData = ScDocShell::GetViewData();
uno::Reference<datatransfer::XTransferable> xTransferable;
- if (( pShell = dynamic_cast<ScEditShell*>( pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) )) )
+ if ( ScEditShell * pShell = dynamic_cast<ScEditShell*>( pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ) )
xTransferable = pShell->GetEditView()->GetTransferable();
else if ( nullptr != dynamic_cast<ScDrawTextObjectBar*>( pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ))
{
@@ -738,7 +736,7 @@ OString ScModelObj::getTextSelection(const char* pMimeType, OString& rUsedMimeTy
if (pOutView)
xTransferable = pOutView->GetEditView().GetTransferable();
}
- else if (( pDrawShell = dynamic_cast<ScDrawShell*>( pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) )) )
+ else if ( ScDrawShell * pDrawShell = dynamic_cast<ScDrawShell*>( pViewData->GetViewShell()->GetViewFrame()->GetDispatcher()->GetShell(0) ) )
xTransferable = pDrawShell->GetDrawView()->CopyToTransferable();
else
{
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index ee8f6f7..b790b7d 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -314,7 +314,8 @@ static bool lcl_GetAutoSumForColumnRange( ScDocument* pDoc, ScRangeList& rRangeL
{
rRangeList.Append( ScRange( nCol, nStartRow, nTab, nCol, nEndRow, nTab ) );
nEndRow = static_cast< SCROW >( nExtend );
- if ( ( bContinue = lcl_FindNextSumEntryInColumn( pDoc, nCol, nEndRow /*inout*/, nTab, nExtend /*out*/, aStart.Row() ) ) )
+ bContinue = lcl_FindNextSumEntryInColumn( pDoc, nCol, nEndRow /*inout*/, nTab, nExtend /*out*/, aStart.Row() );
+ if ( bContinue )
{
nStartRow = nEndRow;
}
@@ -356,7 +357,8 @@ static bool lcl_GetAutoSumForRowRange( ScDocument* pDoc, ScRangeList& rRangeList
{
rRangeList.Append( ScRange( nStartCol, nRow, nTab, nEndCol, nRow, nTab ) );
nEndCol = static_cast< SCCOL >( nExtend );
- if ( ( bContinue = lcl_FindNextSumEntryInRow( pDoc, nEndCol /*inout*/, nRow, nTab, nExtend /*out*/, aStart.Col() ) ) )
+ bContinue = lcl_FindNextSumEntryInRow( pDoc, nEndCol /*inout*/, nRow, nTab, nExtend /*out*/, aStart.Col() );
+ if ( bContinue )
{
nStartCol = nEndCol;
}
@@ -459,7 +461,8 @@ bool ScViewFunc::GetAutoSumArea( ScRangeList& rRangeList )
if ( bRow )
{
nEndRow = static_cast< SCROW >( nExtend );
- if ( ( bContinue = lcl_FindNextSumEntryInColumn( pDoc, nCol, nEndRow /*inout*/, nTab, nExtend /*out*/, 0 ) ) )
+ bContinue = lcl_FindNextSumEntryInColumn( pDoc, nCol, nEndRow /*inout*/, nTab, nExtend /*out*/, 0 );
+ if ( bContinue )
{
nStartRow = nEndRow;
}
@@ -467,7 +470,8 @@ bool ScViewFunc::GetAutoSumArea( ScRangeList& rRangeList )
else
{
nEndCol = static_cast< SCCOL >( nExtend );
- if ( ( bContinue = lcl_FindNextSumEntryInRow( pDoc, nEndCol /*inout*/, nRow, nTab, nExtend /*out*/, 0 ) ) )
+ bContinue = lcl_FindNextSumEntryInRow( pDoc, nEndCol /*inout*/, nRow, nTab, nExtend /*out*/, 0 );
+ if ( bContinue )
{
nStartCol = nEndCol;
}
commit 1ba9b792ccd6a27b56709917374a1ea03c0a000a
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:19:12 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: sd
Change-Id: I55472a12ad235e6a560d60671559a158eefb7c8f
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 304194b..55279ac 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -2436,10 +2436,12 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
if ( pTextObj->Count() == 1 )
{
PPTParagraphObj* pPara = pTextObj->First();
- PPTPortionObj* pPor = nullptr;
- if ( pPara && pPara->GetTextSize() == 0 && (pPor = pPara->First()))
+ if ( pPara && pPara->GetTextSize() == 0 )
{
- pPor->ApplyTo(aSet, (SdrPowerPointImport&)*this, pTextObj->GetDestinationInstance());
+ if ( PPTPortionObj * pPor = pPara->First() )
+ {
+ pPor->ApplyTo(aSet, (SdrPowerPointImport&)*this, pTextObj->GetDestinationInstance());
+ }
}
}
pPresObj->SetMergedItemSet(aSet);
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index 2f61531..32e4fa64 100644
--- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -332,7 +332,8 @@ uno::Sequence<beans::PropertyValue>
for( size_t i = 0; i < SAL_N_ELEMENTS( aURLPropertyNames ); i++ )
{
XPropertyListRef pList = pDoc->GetPropertyList( (XPropertyListType) i );
- if( ( bHasEmbed = pList.is() && pList->IsEmbedInDocument() ) )
+ bHasEmbed = pList.is() && pList->IsEmbedInDocument();
+ if( bHasEmbed )
break;
}
if( !bHasEmbed )
commit 4f2d4e20a8fe59ad4c0c8ee55ec13654556b30eb
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:19:00 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: starmath
Change-Id: I7a7eaf1e99216d3985ff654e7c4df7e19dd0ae24
diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx
index 0397c4e..d1dc6ba 100644
--- a/starmath/source/visitors.cxx
+++ b/starmath/source/visitors.cxx
@@ -846,9 +846,9 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmSubSupNode* pNode )
bodyRight->SetRight( right );
right->SetLeft( bodyRight );
- SmNode* pChild;
//If there's an LSUP
- if( ( pChild = pNode->GetSubSup( LSUP ) ) ){
+ SmNode* pChild = pNode->GetSubSup( LSUP );
+ if( pChild ){
SmCaretPosGraphEntry *cLeft; //Child left
cLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
@@ -858,7 +858,8 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmSubSupNode* pNode )
mpRightMost->SetRight( bodyLeft );
}
//If there's an LSUB
- if( ( pChild = pNode->GetSubSup( LSUB ) ) ){
+ pChild = pNode->GetSubSup( LSUB );
+ if( pChild ){
SmCaretPosGraphEntry *cLeft; //Child left
cLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
@@ -868,7 +869,8 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmSubSupNode* pNode )
mpRightMost->SetRight( bodyLeft );
}
//If there's an CSUP
- if( ( pChild = pNode->GetSubSup( CSUP ) ) ){
+ pChild = pNode->GetSubSup( CSUP );
+ if( pChild ){
SmCaretPosGraphEntry *cLeft; //Child left
cLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
@@ -878,7 +880,8 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmSubSupNode* pNode )
mpRightMost->SetRight( right );
}
//If there's an CSUB
- if( ( pChild = pNode->GetSubSup( CSUB ) ) ){
+ pChild = pNode->GetSubSup( CSUB );
+ if( pChild ){
SmCaretPosGraphEntry *cLeft; //Child left
cLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
@@ -888,7 +891,8 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmSubSupNode* pNode )
mpRightMost->SetRight( right );
}
//If there's an RSUP
- if( ( pChild = pNode->GetSubSup( RSUP ) ) ){
+ pChild = pNode->GetSubSup( RSUP );
+ if( pChild ){
SmCaretPosGraphEntry *cLeft; //Child left
cLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), bodyRight );
@@ -898,7 +902,8 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmSubSupNode* pNode )
mpRightMost->SetRight( right );
}
//If there's an RSUB
- if( ( pChild = pNode->GetSubSup( RSUB ) ) ){
+ pChild = pNode->GetSubSup( RSUB );
+ if( pChild ){
SmCaretPosGraphEntry *cLeft; //Child left
cLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), bodyRight );
@@ -976,59 +981,77 @@ void SmCaretPosGraphBuildingVisitor::Visit( SmOperNode* pNode )
SmNode* pChild;
SmCaretPosGraphEntry *childLeft;
- if( pSubSup && ( pChild = pSubSup->GetSubSup( LSUP ) ) ) {
- //Create position in front of pChild
- childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
- //Visit pChild
- mpRightMost = childLeft;
- pChild->Accept( this );
- //Set right on mpRightMost from pChild
- mpRightMost->SetRight( bodyLeft );
+ if( pSubSup ) {
+ pChild = pSubSup->GetSubSup( LSUP );
+ if( pChild ) {
+ //Create position in front of pChild
+ childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
+ //Visit pChild
+ mpRightMost = childLeft;
+ pChild->Accept( this );
+ //Set right on mpRightMost from pChild
+ mpRightMost->SetRight( bodyLeft );
+ }
}
- if( pSubSup && ( pChild = pSubSup->GetSubSup( LSUB ) ) ) {
- //Create position in front of pChild
- childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
- //Visit pChild
- mpRightMost = childLeft;
- pChild->Accept( this );
- //Set right on mpRightMost from pChild
- mpRightMost->SetRight( bodyLeft );
+ if( pSubSup ) {
+ pChild = pSubSup->GetSubSup( LSUB );
+ if( pChild ) {
+ //Create position in front of pChild
+ childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
+ //Visit pChild
+ mpRightMost = childLeft;
+ pChild->Accept( this );
+ //Set right on mpRightMost from pChild
+ mpRightMost->SetRight( bodyLeft );
+ }
}
- if( pSubSup && ( pChild = pSubSup->GetSubSup( CSUP ) ) ) {//TO
- //Create position in front of pChild
- childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
- //Visit pChild
- mpRightMost = childLeft;
- pChild->Accept( this );
- //Set right on mpRightMost from pChild
- mpRightMost->SetRight( bodyLeft );
+ if( pSubSup ) {
+ pChild = pSubSup->GetSubSup( CSUP );
+ if ( pChild ) {//TO
+ //Create position in front of pChild
+ childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
+ //Visit pChild
+ mpRightMost = childLeft;
+ pChild->Accept( this );
+ //Set right on mpRightMost from pChild
+ mpRightMost->SetRight( bodyLeft );
+ }
}
- if( pSubSup && ( pChild = pSubSup->GetSubSup( CSUB ) ) ) { //FROM
- //Create position in front of pChild
- childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
- //Visit pChild
- mpRightMost = childLeft;
- pChild->Accept( this );
- //Set right on mpRightMost from pChild
- mpRightMost->SetRight( bodyLeft );
+ if( pSubSup ) {
+ pChild = pSubSup->GetSubSup( CSUB );
+ if( pChild ) { //FROM
+ //Create position in front of pChild
+ childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
+ //Visit pChild
+ mpRightMost = childLeft;
+ pChild->Accept( this );
+ //Set right on mpRightMost from pChild
+ mpRightMost->SetRight( bodyLeft );
+ }
}
- if( pSubSup && ( pChild = pSubSup->GetSubSup( RSUP ) ) ) {
- //Create position in front of pChild
- childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
- //Visit pChild
- mpRightMost = childLeft;
- pChild->Accept( this );
- //Set right on mpRightMost from pChild
- mpRightMost->SetRight( bodyLeft );
+ if( pSubSup ) {
+ pChild = pSubSup->GetSubSup( RSUP );
+ if ( pChild ) {
+ //Create position in front of pChild
+ childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
+ //Visit pChild
+ mpRightMost = childLeft;
+ pChild->Accept( this );
+ //Set right on mpRightMost from pChild
+ mpRightMost->SetRight( bodyLeft );
+ }
}
- if( pSubSup && ( pChild = pSubSup->GetSubSup( RSUB ) ) ) {
- //Create position in front of pChild
- childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
- //Visit pChild
- mpRightMost = childLeft;
- pChild->Accept( this );
- //Set right on mpRightMost from pChild
- mpRightMost->SetRight( bodyLeft );
+ if( pSubSup ) {
+ pChild = pSubSup->GetSubSup( RSUB );
+ if ( pChild ) {
+ //Create position in front of pChild
+ childLeft = mpGraph->Add( SmCaretPos( pChild, 0 ), left );
+ //Visit pChild
+ mpRightMost = childLeft;
+ pChild->Accept( this );
+ //Set right on mpRightMost from pChild
+ mpRightMost->SetRight( bodyLeft );
+ }
}
//Return right
@@ -1988,32 +2011,36 @@ void SmNodeToTextVisitor::Visit( SmOperNode* pNode )
}
if( pNode->GetSubNode( 0 )->GetType( ) == NSUBSUP ) {
SmSubSupNode *pSubSup = static_cast<SmSubSupNode*>( pNode->GetSubNode( 0 ) );
- SmNode* pChild;
- if( ( pChild = pSubSup->GetSubSup( LSUP ) ) ) {
+ SmNode* pChild = pSubSup->GetSubSup( LSUP );
+ if( pChild ) {
Separate( );
Append( "lsup { " );
LineToText( pChild );
Append( "} " );
}
- if( ( pChild = pSubSup->GetSubSup( LSUB ) ) ) {
+ pChild = pSubSup->GetSubSup( LSUB );
+ if( pChild ) {
Separate( );
Append( "lsub { " );
LineToText( pChild );
Append( "} " );
}
- if( ( pChild = pSubSup->GetSubSup( RSUP ) ) ) {
+ pChild = pSubSup->GetSubSup( RSUP );
+ if( pChild ) {
Separate( );
Append( "^ { " );
LineToText( pChild );
Append( "} " );
}
- if( ( pChild = pSubSup->GetSubSup( RSUB ) ) ) {
+ pChild = pSubSup->GetSubSup( RSUB );
+ if( pChild ) {
Separate( );
Append( "_ { " );
LineToText( pChild );
Append( "} " );
}
- if( ( pChild = pSubSup->GetSubSup( CSUP ) ) ) {
+ pChild = pSubSup->GetSubSup( CSUP );
+ if( pChild ) {
Separate( );
if (pSubSup->IsUseLimits())
Append( "to { " );
@@ -2022,7 +2049,8 @@ void SmNodeToTextVisitor::Visit( SmOperNode* pNode )
LineToText( pChild );
Append( "} " );
}
- if( ( pChild = pSubSup->GetSubSup( CSUB ) ) ) {
+ pChild = pSubSup->GetSubSup( CSUB );
+ if( pChild ) {
Separate( );
if (pSubSup->IsUseLimits())
Append( "from { " );
@@ -2199,28 +2227,32 @@ void SmNodeToTextVisitor::Visit( SmBinDiagonalNode* pNode )
void SmNodeToTextVisitor::Visit( SmSubSupNode* pNode )
{
LineToText( pNode->GetBody( ) );
- SmNode *pChild;
- if( ( pChild = pNode->GetSubSup( LSUP ) ) ) {
+ SmNode *pChild = pNode->GetSubSup( LSUP );
+ if( pChild ) {
Separate( );
Append( "lsup " );
LineToText( pChild );
}
- if( ( pChild = pNode->GetSubSup( LSUB ) ) ) {
+ pChild = pNode->GetSubSup( LSUB );
+ if( pChild ) {
Separate( );
Append( "lsub " );
LineToText( pChild );
}
- if( ( pChild = pNode->GetSubSup( RSUP ) ) ) {
+ pChild = pNode->GetSubSup( RSUP );
+ if( pChild ) {
Separate( );
Append( "^ " );
LineToText( pChild );
}
- if( ( pChild = pNode->GetSubSup( RSUB ) ) ) {
+ pChild = pNode->GetSubSup( RSUB );
+ if( pChild ) {
Separate( );
Append( "_ " );
LineToText( pChild );
}
- if( ( pChild = pNode->GetSubSup( CSUP ) ) ) {
+ pChild = pNode->GetSubSup( CSUP );
+ if( pChild ) {
Separate( );
if (pNode->IsUseLimits())
Append( "to " );
@@ -2228,7 +2260,8 @@ void SmNodeToTextVisitor::Visit( SmSubSupNode* pNode )
Append( "csup " );
LineToText( pChild );
}
- if( ( pChild = pNode->GetSubSup( CSUB ) ) ) {
+ pChild = pNode->GetSubSup( CSUB );
+ if( pChild ) {
Separate( );
if (pNode->IsUseLimits())
Append( "from " );
commit 20b6e18ecbb3e6e5ffa18cb3230b56933f03c602
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:18:43 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: svtools
Change-Id: If7843583924d2ecebe65aef1843e510fa974d877
diff --git a/svtools/source/misc/embedtransfer.cxx b/svtools/source/misc/embedtransfer.cxx
index 1a867e2..d23ff4b 100644
--- a/svtools/source/misc/embedtransfer.cxx
+++ b/svtools/source/misc/embedtransfer.cxx
@@ -139,7 +139,8 @@ bool SvEmbedTransferHelper::GetData( const css::datatransfer::DataFlavor& rFlavo
if ( bDeleteStream )
delete pStream;
- if( ( bRet = ( aSeq.getLength() > 0 ) ) )
+ bRet = ( aSeq.getLength() > 0 );
+ if( bRet )
{
SetAny( uno::Any(aSeq), rFlavor );
}
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index 1f7fcb7..ed84be3 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -1714,14 +1714,16 @@ bool TransferableDataHelper::GetGraphic( const css::datatransfer::DataFlavor& rF
// try to get PNG first
BitmapEx aBmpEx;
- if( ( bRet = GetBitmapEx( aFlavor, aBmpEx ) ) )
+ bRet = GetBitmapEx( aFlavor, aBmpEx );
+ if( bRet )
rGraphic = aBmpEx;
}
else if (SotExchange::GetFormatDataFlavor(SotClipboardFormatId::JPEG, aFlavor) && TransferableDataHelper::IsEqual(aFlavor, rFlavor))
{
BitmapEx aBitmapEx;
- if ((bRet = GetBitmapEx(aFlavor, aBitmapEx)))
+ bRet = GetBitmapEx(aFlavor, aBitmapEx);
+ if (bRet)
rGraphic = aBitmapEx;
}
else if(SotExchange::GetFormatDataFlavor( SotClipboardFormatId::BITMAP, aFlavor ) &&
@@ -1729,7 +1731,8 @@ bool TransferableDataHelper::GetGraphic( const css::datatransfer::DataFlavor& rF
{
BitmapEx aBmpEx;
- if( ( bRet = GetBitmapEx( aFlavor, aBmpEx ) ) )
+ bRet = GetBitmapEx( aFlavor, aBmpEx );
+ if( bRet )
rGraphic = aBmpEx;
}
else if( SotExchange::GetFormatDataFlavor( SotClipboardFormatId::GDIMETAFILE, aFlavor ) &&
@@ -1737,7 +1740,8 @@ bool TransferableDataHelper::GetGraphic( const css::datatransfer::DataFlavor& rF
{
GDIMetaFile aMtf;
- if( ( bRet = GetGDIMetaFile( aFlavor, aMtf ) ) )
+ bRet = GetGDIMetaFile( aFlavor, aMtf );
+ if( bRet )
rGraphic = aMtf;
}
else
commit db37370d2c92e32e46d679fdf4630d293e475b9d
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:18:30 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: svx
Change-Id: I803f4e1a93f1b97e5446032cf557d39db68159e3
diff --git a/svx/source/gengal/gengal.cxx b/svx/source/gengal/gengal.cxx
index f8b5385..7a8f1a5 100644
--- a/svx/source/gengal/gengal.cxx
+++ b/svx/source/gengal/gengal.cxx
@@ -100,7 +100,8 @@ static void createTheme( const OUString& aThemeName, const OUString& aGalleryURL
SfxListener aListener;
- if ( !( pGalTheme = pGallery->AcquireTheme( aThemeName, aListener ) ) ) {
+ pGalTheme = pGallery->AcquireTheme( aThemeName, aListener );
+ if ( !pGalTheme ) {
fprintf( stderr, "Failed to acquire theme\n" );
exit( 1 );
}
commit 2eb991561c3ca6751bfe3bd674de28d7677e993d
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:18:20 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: sw
Change-Id: I288c5125a1316828df74f73aeaac85392638ffd8
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx
index 7ab28b1..92d457c 100644
--- a/sw/inc/calbck.hxx
+++ b/sw/inc/calbck.hxx
@@ -256,7 +256,8 @@ namespace sw
WriterListener* GetRightOfPos() { return m_pPosition->m_pRight; }
WriterListener* GoStart()
{
- if((m_pPosition = m_rRoot.m_pWriterListeners))
+ m_pPosition = m_rRoot.m_pWriterListeners;
+ if(m_pPosition)
while( m_pPosition->m_pLeft )
m_pPosition = m_pPosition->m_pLeft;
return m_pCurrent = m_pPosition;
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index a71e0ff..f9bd0a6 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -495,7 +495,8 @@ bool SwFormat::SetFormatAttr( const SfxPoolItem& rAttr )
if(IsModifyLocked())
{
- if( ( bRet = m_aSet.Put( aTempSet ) ) )
+ bRet = m_aSet.Put( aTempSet );
+ if( bRet )
{
m_aSet.SetModifyAtAttr( this );
}
@@ -528,7 +529,8 @@ bool SwFormat::SetFormatAttr( const SfxPoolItem& rAttr )
(RES_GRFFMTCOLL == nFormatWhich ||
RES_TXTFMTCOLL == nFormatWhich ) ) )
{
- if( ( bRet = (nullptr != m_aSet.Put( rAttr ))) )
+ bRet = nullptr != m_aSet.Put( rAttr );
+ if( bRet )
m_aSet.SetModifyAtAttr( this );
// #i71574#
if ( nFormatWhich == RES_TXTFMTCOLL && rAttr.Which() == RES_PARATR_NUMRULE )
@@ -599,7 +601,8 @@ bool SwFormat::SetFormatAttr( const SfxItemSet& rSet )
if(IsModifyLocked())
{
- if( ( bRet = m_aSet.Put( aTempSet ) ) )
+ bRet = m_aSet.Put( aTempSet );
+ if( bRet )
{
m_aSet.SetModifyAtAttr( this );
}
@@ -633,7 +636,8 @@ bool SwFormat::SetFormatAttr( const SfxItemSet& rSet )
( RES_GRFFMTCOLL == nFormatWhich ||
RES_TXTFMTCOLL == nFormatWhich ) ) )
{
- if( ( bRet = m_aSet.Put( aTempSet )) )
+ bRet = m_aSet.Put( aTempSet );
+ if( bRet )
m_aSet.SetModifyAtAttr( this );
// #i71574#
if ( nFormatWhich == RES_TXTFMTCOLL )
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index a6eeb6f..a16ce8d 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1320,7 +1320,8 @@ void SwCursorShell::VisPortChgd( const SwRect & rRect )
bool bVis; // switch off all cursors when scrolling
// if a cursor is visible then hide the SV cursor
- if( ( bVis = m_pVisibleCursor->IsVisible() ) )
+ bVis = m_pVisibleCursor->IsVisible();
+ if( bVis )
m_pVisibleCursor->Hide();
m_bVisPortChgd = true;
@@ -2543,7 +2544,8 @@ void SwCursorShell::ParkPams( SwPaM* pDelRg, SwShellCursor** ppDelRing )
{
if( *ppDelRing == m_pCurrentCursor )
{
- if( ( bDelete = GoNextCursor() ) )
+ bDelete = GoNextCursor();
+ if( bDelete )
{
bGoNext = false;
pTmp = pTmp->GetNext();
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index f2d4a64..931a6de 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -593,16 +593,17 @@ bool SwCursor::IsInProtectTable( bool bMove, bool bChgCursor )
SwNodeIndex aCellStt( *GetNode().FindTableBoxStartNode()->EndOfSectionNode(), 1 );
bool bProt = true;
GoNextCell:
- do {
+ for (;;) {
if( !aCellStt.GetNode().IsStartNode() )
break;
++aCellStt;
if( nullptr == ( pCNd = aCellStt.GetNode().GetContentNode() ))
pCNd = aCellStt.GetNodes().GoNext( &aCellStt );
- if( !( bProt = pCNd->IsProtect() ))
+ bProt = pCNd->IsProtect();
+ if( !bProt )
break;
aCellStt.Assign( *pCNd->FindTableBoxStartNode()->EndOfSectionNode(), 1 );
- } while( bProt );
+ }
SetNextCursor:
if( !bProt ) // found free cell
@@ -642,16 +643,17 @@ SetNextCursor:
SwNode* pNd;
bool bProt = true;
GoPrevCell:
- do {
+ for (;;) {
if( !( pNd = &aCellStt.GetNode())->IsEndNode() )
break;
aCellStt.Assign( *pNd->StartOfSectionNode(), +1 );
if( nullptr == ( pCNd = aCellStt.GetNode().GetContentNode() ))
pCNd = pNd->GetNodes().GoNext( &aCellStt );
- if( !( bProt = pCNd->IsProtect() ))
+ bProt = pCNd->IsProtect();
+ if( !bProt )
break;
aCellStt.Assign( *pNd->FindTableBoxStartNode(), -1 );
- } while( bProt );
+ }
SetPrevCursor:
if( !bProt ) // found free cell
diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx
index 62c2dc0..472c276 100644
--- a/sw/source/core/crsr/trvltbl.cxx
+++ b/sw/source/core/crsr/trvltbl.cxx
@@ -95,7 +95,8 @@ bool SwCursorShell::GoNextCell( bool bAppendLine )
static_cast<SwEditShell*>(this)->EndAllAction();
}
}
- if( bRet && ( bRet = pCursor->GoNextCell() ) )
+ bRet = bRet && pCursor->GoNextCell();
+ if( bRet )
UpdateCursor();
}
return bRet;
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index cc24c5f..e23c961 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -753,7 +753,8 @@ FlatFndBox::FlatFndBox(SwDoc* pDocPtr, const FndBox_& rBox) :
nRow(0),
nCol(0)
{ // If the array is symmetric
- if( (bSym = CheckLineSymmetry(rBoxRef)) )
+ bSym = CheckLineSymmetry(rBoxRef);
+ if( bSym )
{
// Determine column/row count
nCols = GetColCount(rBoxRef);
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 0a86446..0e4a3eb 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -3627,8 +3627,8 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType,
}
else
{
- if( ( bRet = bLeft ? nDist != 0
- : ( rSz.GetWidth() - nDist ) > COLFUZZY ) )
+ bRet = bLeft ? nDist != 0 : ( rSz.GetWidth() - nDist ) > COLFUZZY;
+ if( bRet )
{
for( n = 0; n < m_aLines.size(); ++n )
{
@@ -3780,9 +3780,8 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType,
// First, see if there is enough room at all
if( bInsDel )
{
- if( ( bRet = bLeft ? nDist != 0
- : ( rSz.GetWidth() - nDist ) > COLFUZZY ) &&
- !aParam.bBigger )
+ bRet = bLeft ? nDist != 0 : ( rSz.GetWidth() - nDist ) > COLFUZZY;
+ if( bRet && !aParam.bBigger )
{
bRet = (*fnOtherBox)( pLine, aParam, 0, true );
if( bRet && !aParam.bAnyBoxFnd )
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 7e54c68..fa98422 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1446,7 +1446,8 @@ bool SwContentNode::SetAttr(const SfxPoolItem& rAttr )
{
SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
- if( ( bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rAttr, &aOld, &aNew ) ) )
+ bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rAttr, &aOld, &aNew );
+ if( bRet )
{
SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
SwAttrSetChg aChgNew( *GetpSwAttrSet(), aNew );
@@ -1520,7 +1521,8 @@ bool SwContentNode::SetAttr( const SfxItemSet& rSet )
{
SwAttrSet aOld( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() ),
aNew( *GetpSwAttrSet()->GetPool(), GetpSwAttrSet()->GetRanges() );
- if( (bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rSet, &aOld, &aNew )) )
+ bRet = AttrSetHandleHelper::Put_BC( mpAttrSet, *this, rSet, &aOld, &aNew );
+ if( bRet )
{
// Some special treatment for Attributes
SwAttrSetChg aChgOld( *GetpSwAttrSet(), aOld );
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 27fc7d3..a2ce70de 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -423,7 +423,8 @@ bool SwAuthorityFieldType::PutValue( const Any& rAny, sal_uInt16 nWhichId )
case FIELD_PROP_LOCALE:
{
css::lang::Locale aLocale;
- if( (bRet = rAny >>= aLocale ))
+ bRet = rAny >>= aLocale;
+ if( bRet )
SetLanguage( LanguageTag::convertToLanguageType( aLocale ));
}
break;
@@ -431,7 +432,8 @@ bool SwAuthorityFieldType::PutValue( const Any& rAny, sal_uInt16 nWhichId )
case FIELD_PROP_PROP_SEQ:
{
Sequence<PropertyValues> aSeq;
- if( (bRet = rAny >>= aSeq) )
+ bRet = rAny >>= aSeq;
+ if( bRet )
{
m_SortKeyArr.clear();
const PropertyValues* pValues = aSeq.getConstArray();
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index c7ebf84..8f65b8e 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -269,14 +269,18 @@ void SwFrame::PrepareMake(vcl::RenderContext* pRenderContext)
bFoll = pThis->IsFollow();
bNoSect = false;
}
- else if ( bCnt && (bFoll = pThis->IsFollow()) && GetPrev() )
+ else if ( bCnt )
{
- //Do not follow the chain when we need only one instance
- const SwTextFrame* pMaster = static_cast<SwContentFrame*>(this)->FindMaster();
- if ( pMaster && pMaster->IsLocked() )
+ bFoll = pThis->IsFollow();
+ if ( bFoll && GetPrev() )
{
- MakeAll(pRenderContext);
- return;
+ //Do not follow the chain when we need only one instance
+ const SwTextFrame* pMaster = static_cast<SwContentFrame*>(this)->FindMaster();
+ if ( pMaster && pMaster->IsLocked() )
+ {
+ MakeAll(pRenderContext);
+ return;
+ }
}
}
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 6ec9160..44eab11 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -2672,10 +2672,10 @@ bool SwContentFrame::MoveFootnoteCntFwd( bool bMakePage, SwFootnoteBossFrame *pO
if ( pNewUpper )
{
- bool bSameBoss = true;
SwFootnoteBossFrame * const pNewBoss = pNewUpper->FindFootnoteBossFrame();
// Are we changing the column/page?
- if ( !( bSameBoss = (pNewBoss == pOldBoss) ) )
+ bool bSameBoss = pNewBoss == pOldBoss;
+ if ( !bSameBoss )
{
bSamePage = pOldBoss->FindPageFrame() == pNewBoss->FindPageFrame(); // page change?
pNewUpper->Calc(getRootFrame()->GetCurrShell()->GetOut());
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 8405280..735af25 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -192,7 +192,8 @@ SwPageFrame::SwPageFrame( SwFrameFormat *pFormat, SwFrame* pSib, SwPageDesc *pPg
// create and insert body area if it is not a blank page
SwDoc *pDoc = pFormat->GetDoc();
- if ( !(m_bEmptyPage = (pFormat == pDoc->GetEmptyPageFormat())) )
+ m_bEmptyPage = pFormat == pDoc->GetEmptyPageFormat();
+ if ( !m_bEmptyPage )
{
m_bEmptyPage = false;
Calc(pRenderContext); // so that the PrtArea is correct
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index b73b625..a5471f7 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3589,8 +3589,8 @@ void SwLayoutFrame::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRec
return;
SwShortCut aShortCut( *pFrame, rRect );
- bool bCnt;
- if ( (bCnt = pFrame->IsContentFrame()) )
+ bool bCnt = pFrame->IsContentFrame();
+ if ( bCnt )
pFrame->Calc(&rRenderContext);
if ( pFrame->IsFootnoteContFrame() )
@@ -3652,8 +3652,12 @@ void SwLayoutFrame::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRec
{
gProp.pSGlobalShell->InvalidateWindows( aPaintRect );
pFrame = pFrame->GetNext();
- if ( pFrame && (bCnt = pFrame->IsContentFrame()) )
- pFrame->Calc(&rRenderContext);
+ if ( pFrame )
+ {
+ bCnt = pFrame->IsContentFrame();
+ if ( bCnt )
+ pFrame->Calc(&rRenderContext);
+ }
continue;
}
}
@@ -3684,8 +3688,12 @@ void SwLayoutFrame::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRec
pFrame = pFrame->GetNext();
- if ( pFrame && (bCnt = pFrame->IsContentFrame()) )
- pFrame->Calc(&rRenderContext);
+ if ( pFrame )
+ {
+ bCnt = pFrame->IsContentFrame();
+ if ( bCnt )
+ pFrame->Calc(&rRenderContext);
+ }
}
}
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index e22b064..97dfccb 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3307,7 +3307,8 @@ bool SwTabFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool, bool &rReformat
long nNewWidth = (pNewUpper->Prt().*fnRectX->fnGetWidth)();
if( std::abs( nNewWidth - nOldWidth ) < 2 )
{
- if( !( bMoveAnyway = (BwdMoveNecessary( pOldPage, Frame() ) > 1) ) )
+ bMoveAnyway = BwdMoveNecessary( pOldPage, Frame() ) > 1;
+ if( !bMoveAnyway )
{
SwRect aRect( pNewUpper->Prt() );
aRect.Pos() += pNewUpper->Frame().Pos();
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 43ff3ce..33565d3 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2552,18 +2552,21 @@ void SwXFrame::setPropertyToDefault( const OUString& rPropertyName )
pFormat->SetFormatAttr(aSet);
}
}
- else if((bNextFrame = (rPropertyName == UNO_NAME_CHAIN_NEXT_NAME))
- || rPropertyName == UNO_NAME_CHAIN_PREV_NAME)
+ else
{
- SwDoc* pDoc = pFormat->GetDoc();
- if(bNextFrame)
- pDoc->Unchain(*pFormat);
- else
+ bNextFrame = rPropertyName == UNO_NAME_CHAIN_NEXT_NAME;
+ if( bNextFrame || rPropertyName == UNO_NAME_CHAIN_PREV_NAME )
{
- SwFormatChain aChain( pFormat->GetChain() );
- SwFrameFormat *pPrev = aChain.GetPrev();
- if(pPrev)
- pDoc->Unchain(*pPrev);
+ SwDoc* pDoc = pFormat->GetDoc();
+ if(bNextFrame)
+ pDoc->Unchain(*pFormat);
+ else
+ {
+ SwFormatChain aChain( pFormat->GetChain() );
+ SwFrameFormat *pPrev = aChain.GetPrev();
+ if(pPrev)
+ pDoc->Unchain(*pPrev);
+ }
}
}
}
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 9d94244..83a58af 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -1604,7 +1604,8 @@ bool SwViewShell::CheckInvalidForPaint( const SwRect &rRect )
for ( size_t i = 0; i < pRegion->size(); ++i )
{
const SwRect &rTmp = (*pRegion)[i];
- if ( !(bStop = rTmp.IsOver( VisArea() )) )
+ bStop = rTmp.IsOver( VisArea() );
+ if ( !bStop )
break;
}
if ( bStop )
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 69e5ed9..c9f3003 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -119,7 +119,8 @@ sal_uLong SwReader::Read( const Reader& rOptions )
if( bSaveUndo )
{
// the reading of the page template cannot be undone!
- if( ( bReadPageDescs = po->aOpt.IsPageDescs() ) )
+ bReadPageDescs = po->aOpt.IsPageDescs();
+ if( bReadPageDescs )
{
bSaveUndo = false;
pDoc->GetIDocumentUndoRedo().DelAllUndoObj();
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 7d81018..9b4fac0 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -593,10 +593,13 @@ void SwHTMLParser::Continue( int nToken )
}
m_bSetModEnabled = false;
- if( m_pDoc->GetDocShell() &&
- (m_bSetModEnabled = m_pDoc->GetDocShell()->IsEnableSetModified()) )
+ if( m_pDoc->GetDocShell() )
{
- m_pDoc->GetDocShell()->EnableSetModified( false );
+ m_bSetModEnabled = m_pDoc->GetDocShell()->IsEnableSetModified();
+ if( m_bSetModEnabled )
+ {
+ m_pDoc->GetDocShell()->EnableSetModified( false );
+ }
}
// waehrend des einlesens kein OLE-Modified rufen
diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx
index 90e6021..08099375 100644
--- a/sw/source/filter/ww8/ww8graf2.cxx
+++ b/sw/source/filter/ww8/ww8graf2.cxx
@@ -287,7 +287,8 @@ bool SwWW8ImplReader::ReadGrafFile(OUString& rFileName, Graphic*& rpGraphic,
if (nData > 0)
{
rpGraphic = new Graphic();
- if (!(bOk = SwWW8ImplReader::GetPictGrafFromStream(*rpGraphic, *pSt)))
+ bOk = SwWW8ImplReader::GetPictGrafFromStream(*rpGraphic, *pSt);
+ if (!bOk)
DELETEZ(rpGraphic);
}
return bOk; // Contains graphic
diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx
index 09cf8a9..c310348 100644
--- a/sw/source/ui/fldui/fldedt.cxx
+++ b/sw/source/ui/fldui/fldedt.cxx
@@ -143,7 +143,8 @@ void SwFieldEditDlg::Init()
rMgr.GoPrev();
m_pNextBT->Enable(bMove);
- if( ( bMove = rMgr.GoPrev() ) )
+ bMove = rMgr.GoPrev();
+ if( bMove )
rMgr.GoNext();
m_pPrevBT->Enable( bMove );
diff --git a/sw/source/ui/fldui/javaedit.cxx b/sw/source/ui/fldui/javaedit.cxx
index 4c8d82e..137ceb7 100644
--- a/sw/source/ui/fldui/javaedit.cxx
+++ b/sw/source/ui/fldui/javaedit.cxx
@@ -154,7 +154,8 @@ void SwJavaEditDialog::CheckTravel()
if( bNext )
pMgr->GoPrev();
- if( ( bPrev = pMgr->GoPrev() ) )
+ bPrev = pMgr->GoPrev();
+ if( bPrev )
pMgr->GoNext();
bTravel |= bNext || bPrev;
diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx
index 5c78185..aeaff22 100644
--- a/sw/source/ui/misc/srtdlg.cxx
+++ b/sw/source/ui/misc/srtdlg.cxx
@@ -358,7 +358,8 @@ void SwSortDlg::Apply()
{
SwWait aWait( *rSh.GetView().GetDocShell(), true );
rSh.StartAllAction();
- if( (bRet = rSh.Sort( aOptions )))
+ bRet = rSh.Sort( aOptions );
+ if( bRet )
rSh.SetModified();
rSh.EndAllAction();
}
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index 235c553..2872e78 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -806,8 +806,8 @@ void SwDocShell::Draw( OutputDevice* pDev, const JobSetup& rSetup,
sal_uInt16 nAspect )
{
//fix #25341# Draw should not affect the Modified
- bool bResetModified;
- if ( (bResetModified = IsEnableSetModified()) )
+ bool bResetModified = IsEnableSetModified();
+ if ( bResetModified )
EnableSetModified( false );
// When there is a JobSetup connected to the Document, we copy it to
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 9e8a3f8..b139536 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -2269,7 +2269,8 @@ bool SwTransferable::PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
case SotClipboardFormatId::NETSCAPE_BOOKMARK:
case SotClipboardFormatId::FILEGRPDESCRIPTOR:
case SotClipboardFormatId::UNIFORMRESOURCELOCATOR:
- if( ( bRet = rData.GetINetBookmark( nFormat, aBkmk ) ))
+ bRet = rData.GetINetBookmark( nFormat, aBkmk );
+ if( bRet )
{
if( SwPasteSdr::SetAttr == nAction )
nFormat = SotClipboardFormatId::NETSCAPE_BOOKMARK;
@@ -2281,7 +2282,8 @@ bool SwTransferable::PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
case SotClipboardFormatId::SIMPLE_FILE:
{
OUString sText;
- if( ( bRet = rData.GetString( nFormat, sText ) ) )
+ bRet = rData.GetString( nFormat, sText );
+ if( bRet )
{
OUString sDesc;
SwTransferable::CheckForURLOrLNKFile( rData, sText, &sDesc );
diff --git a/sw/source/uibase/fldui/fldwrap.cxx b/sw/source/uibase/fldui/fldwrap.cxx
index 38b45e5..9380d20 100644
--- a/sw/source/uibase/fldui/fldwrap.cxx
+++ b/sw/source/uibase/fldui/fldwrap.cxx
@@ -91,9 +91,8 @@ SwFieldDlgWrapper::SwFieldDlgWrapper( vcl::Window* _pParent, sal_uInt16 nId,
// newly initialise dialog after Doc switch
bool SwFieldDlgWrapper::ReInitDlg(SwDocShell *pDocSh)
{
- bool bRet;
-
- if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh))) // update immediately, Doc switch
+ bool bRet = SwChildWinWrapper::ReInitDlg(pDocSh);
+ if (bRet) // update immediately, Doc switch
{
pDlgInterface->ReInitDlg();
}
@@ -138,8 +137,8 @@ SwFieldDataOnlyDlgWrapper::SwFieldDataOnlyDlgWrapper( vcl::Window* _pParent, sal
// re-init after doc activation
bool SwFieldDataOnlyDlgWrapper::ReInitDlg(SwDocShell *pDocSh)
{
- bool bRet;
- if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh))) // update immediately, Doc switch
+ bool bRet = SwChildWinWrapper::ReInitDlg(pDocSh);
+ if (bRet) // update immediately, Doc switch
{
pDlgInterface->ReInitDlg();
}
diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx
index 891c245..ccfc18e 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -75,9 +75,8 @@ SwRedlineAcceptChild::SwRedlineAcceptChild( vcl::Window* _pParent,
// newly initialise dialog after document switch
bool SwRedlineAcceptChild::ReInitDlg(SwDocShell *pDocSh)
{
- bool bRet;
-
- if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh))) // update immediately, doc switch!
+ bool bRet = SwChildWinWrapper::ReInitDlg(pDocSh);
+ if (bRet) // update immediately, doc switch!
static_cast<SwModelessRedlineAcceptDlg*>(GetWindow())->Activate();
return bRet;
diff --git a/sw/source/uibase/ribbar/conarc.cxx b/sw/source/uibase/ribbar/conarc.cxx
index 33b4a2ca..4373c67 100644
--- a/sw/source/uibase/ribbar/conarc.cxx
+++ b/sw/source/uibase/ribbar/conarc.cxx
@@ -32,9 +32,8 @@ ConstArc::ConstArc(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* pSwView)
bool ConstArc::MouseButtonDown( const MouseEvent& rMEvt )
{
- bool bReturn;
-
- if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)))
+ bool bReturn = SwDrawBase::MouseButtonDown(rMEvt);
+ if (bReturn)
{
if (!m_nButtonUpCount)
m_aStartPoint = m_pWin->PixelToLogic(rMEvt.GetPosPixel());
diff --git a/sw/source/uibase/ribbar/conpoly.cxx b/sw/source/uibase/ribbar/conpoly.cxx
index 3a8df72..eb1125f 100644
--- a/sw/source/uibase/ribbar/conpoly.cxx
+++ b/sw/source/uibase/ribbar/conpoly.cxx
@@ -35,9 +35,8 @@ ConstPolygon::ConstPolygon(SwWrtShell* pWrtShell, SwEditWin* pEditWin, SwView* p
bool ConstPolygon::MouseButtonDown(const MouseEvent& rMEvt)
{
- bool bReturn;
-
- if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)))
+ bool bReturn = SwDrawBase::MouseButtonDown(rMEvt);
+ if (bReturn)
aLastPos = rMEvt.GetPosPixel();
return bReturn;
diff --git a/sw/source/uibase/ribbar/drawbase.cxx b/sw/source/uibase/ribbar/drawbase.cxx
index 820a99e..fbcb258 100644
--- a/sw/source/uibase/ribbar/drawbase.cxx
+++ b/sw/source/uibase/ribbar/drawbase.cxx
@@ -201,7 +201,8 @@ bool SwDrawBase::MouseButtonDown(const MouseEvent& rMEvt)
if (!m_pSh->IsSelFrameMode())
m_pSh->EnterSelFrameMode();
- if( (bReturn = m_pSh->BeginMark(m_aStartPos)) )
+ bReturn = m_pSh->BeginMark(m_aStartPos);
+ if( bReturn )
m_pWin->SetDrawAction(true);
SetDrawPointer();
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index cb4017c..010e14e 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -770,8 +770,8 @@ void SwTextShell::Execute(SfxRequest &rReq)
OUString sFormula(static_cast<const SfxStringItem*>(pItem)->GetValue());
SwFieldMgr aFieldMgr;
rWrtSh.StartAllAction();
- bool bDelSel;
- if( (bDelSel = rWrtSh.HasSelection()) )
+ bool bDelSel = rWrtSh.HasSelection();
+ if( bDelSel )
{
rWrtSh.StartUndo( UNDO_START );
rWrtSh.DelRight();
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index 9f0d1a5..1d322df 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -687,8 +687,11 @@ bool SwView::HasDrwObj(SdrObject *pSdrObj) const
const size_t nCnt = pList->GetObjCount();
for (size_t i = 0; i < nCnt; ++i)
- if ((bRet = HasDrwObj(pList->GetObj(i))))
+ {
+ bRet = HasDrwObj(pList->GetObj(i));
+ if (bRet)
break;
+ }
}
else if (SdrInventor::Default == pSdrObj->GetObjInventor() || pSdrObj->Is3DObj())
return true;
@@ -706,8 +709,11 @@ bool SwView::HasOnlyObj(SdrObject *pSdrObj, SdrInventor eObjInventor) const
const size_t nCnt = pList->GetObjCount();
for (size_t i = 0; i < nCnt; ++i)
- if (!(bRet = HasOnlyObj(pList->GetObj(i), eObjInventor)))
+ {
+ bRet = HasOnlyObj(pList->GetObj(i), eObjInventor);
+ if (!bRet)
break;
+ }
}
else if (eObjInventor == pSdrObj->GetObjInventor())
return true;
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index 84eaceb..adca076 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -1648,7 +1648,8 @@ void SwView::StateTabWin(SfxItemSet& rSet)
{
SwTabCols aTabCols;
size_t nNum = 0;
- if ( ( m_bSetTabColFromDoc = IsTabColFromDoc() ) )
+ m_bSetTabColFromDoc = IsTabColFromDoc();
+ if ( m_bSetTabColFromDoc )
{
rSh.GetMouseTabCols( aTabCols, m_aTabColFromDocPos );
nNum = rSh.GetCurMouseTabColNum( m_aTabColFromDocPos );
@@ -1892,7 +1893,8 @@ void SwView::StateTabWin(SfxItemSet& rSet)
!(nFrameType & FrameTypeFlags::COLSECT ) ) )
{
SwTabCols aTabCols;
- if ( ( m_bSetTabRowFromDoc = IsTabRowFromDoc() ) )
+ m_bSetTabRowFromDoc = IsTabRowFromDoc();
+ if ( m_bSetTabRowFromDoc )
{
rSh.GetMouseTabRows( aTabCols, m_aTabColFromDocPos );
}
diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx
index 0970b14..b26db5a 100644
--- a/sw/source/uibase/wrtsh/move.cxx
+++ b/sw/source/uibase/wrtsh/move.cxx
@@ -87,8 +87,12 @@ bool SwWrtShell::SimpleMove( FNSimpleMove FnSimpleMove, bool bSelect )
bRet = (this->*FnSimpleMove)();
EndCursorMove();
}
- else if( ( bRet = (this->*FnSimpleMove)() ) )
- MoveCursor();
+ else
+ {
+ bRet = (this->*FnSimpleMove)();
+ if( bRet )
+ MoveCursor();
+ }
return bRet;
}
commit 1c717c06c486155bf48aef3ed5e5c140f4205e6e
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:17:48 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: unotools
Change-Id: Iee52f5a3a815a782692a8ee962425ff2ab9173a8
diff --git a/unotools/source/misc/datetime.cxx b/unotools/source/misc/datetime.cxx
index bbe7405..b3623cc 100644
--- a/unotools/source/misc/datetime.cxx
+++ b/unotools/source/misc/datetime.cxx
@@ -342,8 +342,6 @@ bool ISO8601parseDate(const OUString &aDateStr, css::util::Date& rDate)
/** convert ISO8601 Time String to util::Time */
bool ISO8601parseTime(const OUString &aTimeStr, css::util::Time& rTime)
{
- bool bSuccess = true;
-
sal_Int32 nHour = 0;
sal_Int32 nMin = 0;
sal_Int32 nSec = 0;
@@ -355,7 +353,8 @@ bool ISO8601parseTime(const OUString &aTimeStr, css::util::Time& rTime)
OUString tokTz;
bool bFrac = false;
// hours
- if (bSuccess && (bSuccess = getISO8601TimeToken(aTimeStr, n, tokInt, bFrac, tokFrac)))
+ bool bSuccess = getISO8601TimeToken(aTimeStr, n, tokInt, bFrac, tokFrac);
+ if (bSuccess)
{
if ( bFrac && n < aTimeStr.getLength())
// is it junk or the timezone?
commit 8b30c5228b9d2031e5bbd2511a3bbe5f760ce836
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Nov 29 17:17:32 2016 +0100
Rewrite some (trivial) assignments inside if/while conditions: vcl
Change-Id: I26fd9bf9838b0d9d6cf35dc62195216a0c1333ee
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 4caa4d2..5cfb042 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -172,11 +172,9 @@ void Scheduler::CallbackTaskScheduling(bool)
bool Scheduler::ProcessTaskScheduling( bool bTimerOnly )
{
- ImplSchedulerData* pSchedulerData;
-
DBG_TESTSOLARMUTEX();
- if ((pSchedulerData = ImplSchedulerData::GetMostImportantTask(bTimerOnly)))
+ if (ImplSchedulerData * pSchedulerData = ImplSchedulerData::GetMostImportantTask(bTimerOnly))
{
SAL_INFO("vcl.schedule", "Invoke task " << pSchedulerData->GetDebugName());
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 025c80f..e331115 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -1041,7 +1041,8 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext)
if (!bRollOver && !HasFocus())
bDrawMenuSep = false;
}
- if ((bNativeOK = rRenderContext.IsNativeControlSupported(ControlType::Pushbutton, ControlPart::Entire)))
+ bNativeOK = rRenderContext.IsNativeControlSupported(ControlType::Pushbutton, ControlPart::Entire);
+ if (bNativeOK)
{
PushButtonValue aControlValue;
Rectangle aCtrlRegion(aInRect);
@@ -1909,7 +1910,7 @@ void RadioButton::ImplDrawRadioButtonState(vcl::RenderContext& rRenderContext)
bool bNativeOK = false;
// no native drawing for image radio buttons
- if (!maImage && (bNativeOK = rRenderContext.IsNativeControlSupported(ControlType::Radiobutton, ControlPart::Entire)))
+ if (!maImage && rRenderContext.IsNativeControlSupported(ControlType::Radiobutton, ControlPart::Entire))
{
ImplControlValue aControlValue( mbChecked ? ButtonValue::On : ButtonValue::Off );
Rectangle aCtrlRect(maStateRect.TopLeft(), maStateRect.GetSize());
@@ -2995,9 +2996,8 @@ void CheckBox::ImplInitSettings( bool bFont,
void CheckBox::ImplDrawCheckBoxState(vcl::RenderContext& rRenderContext)
{
- bool bNativeOK = true;
-
- if ((bNativeOK = rRenderContext.IsNativeControlSupported(ControlType::Checkbox, ControlPart::Entire)))
+ bool bNativeOK = rRenderContext.IsNativeControlSupported(ControlType::Checkbox, ControlPart::Entire);
+ if (bNativeOK)
{
ImplControlValue aControlValue(meState == TRISTATE_TRUE ? ButtonValue::On : ButtonValue::Off);
Rectangle aCtrlRegion(maStateRect);
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index 4ea0e0b..d9d9bcb 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -841,7 +841,8 @@ void TabControl::ImplDrawItem(vcl::RenderContext& rRenderContext, ImplTabItem* p
}
}
- if ( (bNativeOK = rRenderContext.IsNativeControlSupported(ControlType::TabItem, ControlPart::Entire)) )
+ bNativeOK = rRenderContext.IsNativeControlSupported(ControlType::TabItem, ControlPart::Entire);
+ if ( bNativeOK )
{
TabitemValue tiValue(Rectangle(pItem->maRect.Left() + TAB_TABOFFSET_X,
pItem->maRect.Top() + TAB_TABOFFSET_Y,
diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx
index bc739ef..f767f3b 100644
--- a/vcl/source/filter/igif/gifread.cxx
+++ b/vcl/source/filter/igif/gifread.cxx
@@ -727,7 +727,8 @@ bool GIFReader::ProcessGIF()
// read ScreenDescriptor
case GLOBAL_HEADER_READING:
{
- if( ( bRead = ReadGlobalHeader() ) )
+ bRead = ReadGlobalHeader();
+ if( bRead )
{
ClearImageExtensions();
eActAction = MARKER_READING;
@@ -738,7 +739,8 @@ bool GIFReader::ProcessGIF()
// read extension
case EXTENSION_READING:
{
- if( ( bRead = ReadExtension() ) )
+ bRead = ReadExtension();
+ if( bRead )
eActAction = MARKER_READING;
}
break;
@@ -746,7 +748,8 @@ bool GIFReader::ProcessGIF()
// read Image-Descriptor
case LOCAL_HEADER_READING:
{
- if( ( bRead = ReadLocalHeader() ) )
+ bRead = ReadLocalHeader();
+ if( bRead )
{
nYAcc = nImageX = nImageY = 0;
eActAction = FIRST_BLOCK_READING;
diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx
index bdeacf9..1d45b61 100644
--- a/vcl/source/filter/ixpm/xpmread.cxx
+++ b/vcl/source/filter/ixpm/xpmread.cxx
@@ -154,7 +154,8 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic )
mpStringBuf = new sal_uInt8 [ XPMSTRINGBUF ];
mpTempBuf = new sal_uInt8 [ XPMTEMPBUFSIZE ];
- if ( ( mbStatus = ImplGetString() ) )
+ mbStatus = ImplGetString();
+ if ( mbStatus )
{
mnIdentifier = XPMVALUES; // fetch Bitmap information
mnWidth = ImplGetULONG( 0 );
diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx
index 181ad8a..3b6422d 100644
--- a/vcl/source/gdi/animate.cxx
+++ b/vcl/source/gdi/animate.cxx
@@ -601,7 +601,8 @@ bool Animation::Mirror( BmpMirrorFlags nMirrorFlags )
for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i )
{
AnimationBitmap* pStepBmp = maList[ i ];
- if( ( bRet = pStepBmp->aBmpEx.Mirror( nMirrorFlags ) ) )
+ bRet = pStepBmp->aBmpEx.Mirror( nMirrorFlags );
+ if( bRet )
{
if( nMirrorFlags & BmpMirrorFlags::Horizontal )
pStepBmp->aPosPix.X() = maGlobalSize.Width() - pStepBmp->aPosPix.X() - pStepBmp->aSizePix.Width();
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index cf0bf70..f5ce798 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -710,7 +710,8 @@ bool Bitmap::Rotate( long nAngle10, const Color& rFillColor )
ReleaseAccess( pReadAcc );
}
- if( ( bRet = !!aRotatedBmp ) )
+ bRet = !!aRotatedBmp;
+ if( bRet )
ImplAssignWithSize( aRotatedBmp );
}
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index acc6c4b..fcf3751 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -774,7 +774,8 @@ bool Bitmap::ImplConvertDown(sal_uInt16 nBitCount, Color* pExtColor)
// Refill/copy row buffer
pQLine1 = pQLine2;
- pQLine2 = (bQ1 = !bQ1) ? aErrQuad2.data() : aErrQuad1.data();
+ bQ1 = !bQ1;
+ pQLine2 = bQ1 ? aErrQuad2.data() : aErrQuad1.data();
if (nYTmp < nHeight)
{
@@ -1608,7 +1609,8 @@ bool Bitmap::ImplDitherFloyd16()
// Refill/copy row buffer
pQLine1 = pQLine2;
- pQLine2 = ( bQ1 = !bQ1 ) ? pErrQuad2.get() : pErrQuad1.get();
+ bQ1 = !bQ1;
+ pQLine2 = bQ1 ? pErrQuad2.get() : pErrQuad1.get();
if( nYTmp < nHeight )
for( nX = 0; nX < nWidth; nX++ )
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index ef05e5c..2f8e645 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1137,7 +1137,8 @@ bool ImpGraphic::ImplSwapOut()
xOStm->SetVersion( SOFFICE_FILEFORMAT_50 );
xOStm->SetCompressMode( SvStreamCompressFlags::NATIVE );
- if( ( bRet = ImplSwapOut( xOStm.get() ) ) )
+ bRet = ImplSwapOut( xOStm.get() );
+ if( bRet )
{
mpSwapFile = o3tl::make_unique<ImpSwapFile>();
mpSwapFile->aSwapURL = aTmpURL;
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 2cbd8cb..88590df 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2188,7 +2188,8 @@ bool PDFWriterImpl::writeBuffer( const void* pBuffer, sal_uInt64 nBytes )
if( m_bEncryptThisStream )
{
/* implement the encryption part of the PDF spec encryption algorithm 3.1 */
- if( ( buffOK = checkEncryptionBufferSize( static_cast<sal_Int32>(nBytes) ) ) )
+ buffOK = checkEncryptionBufferSize( static_cast<sal_Int32>(nBytes) );
+ if( buffOK )
rtl_cipher_encodeARCFOUR( m_aCipher,
pBuffer, static_cast<sal_Size>(nBytes),
m_pEncryptionBuffer, static_cast<sal_Size>(nBytes) );
@@ -7444,13 +7445,13 @@ bool PDFWriter::Sign(PDFSignContext& rContext)
aSignedInfo.cCertEncoded = 1;
aSignedInfo.rgCertEncoded = &aCertBlob;
- HCRYPTMSG hMsg;
- if (!(hMsg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING | X509_ASN_ENCODING,
- CMSG_DETACHED_FLAG,
- CMSG_SIGNED,
- &aSignedInfo,
- nullptr,
- nullptr)))
+ HCRYPTMSG hMsg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING | X509_ASN_ENCODING,
+ CMSG_DETACHED_FLAG,
+ CMSG_SIGNED,
+ &aSignedInfo,
+ nullptr,
+ nullptr);
+ if (!hMsg)
{
SAL_WARN("vcl.pdfwriter", "CryptMsgOpenToEncode failed: " << WindowsErrorString(GetLastError()));
CertFreeCertificateContext(pCertContext);
@@ -7479,13 +7480,13 @@ bool PDFWriter::Sign(PDFSignContext& rContext)
return false;
}
- HCRYPTMSG hDecodedMsg;
- if (!(hDecodedMsg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING | X509_ASN_ENCODING,
- CMSG_DETACHED_FLAG,
- CMSG_SIGNED,
- NULL,
- nullptr,
- nullptr)))
+ HCRYPTMSG hDecodedMsg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING | X509_ASN_ENCODING,
+ CMSG_DETACHED_FLAG,
+ CMSG_SIGNED,
+ NULL,
+ nullptr,
+ nullptr);
+ if (!hDecodedMsg)
{
SAL_WARN("vcl.pdfwriter", "CryptMsgOpenToDecode failed: " << WindowsErrorString(GetLastError()));
CryptMsgClose(hMsg);
@@ -7608,12 +7609,13 @@ bool PDFWriter::Sign(PDFSignContext& rContext)
CryptMsgClose(hMsg);
- if (!(hMsg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING | X509_ASN_ENCODING,
- CMSG_DETACHED_FLAG,
- CMSG_SIGNED,
- &aSignedInfo,
- nullptr,
- nullptr)) ||
+ hMsg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING | X509_ASN_ENCODING,
+ CMSG_DETACHED_FLAG,
+ CMSG_SIGNED,
+ &aSignedInfo,
+ nullptr,
+ nullptr);
+ if (!hMsg ||
!CryptMsgUpdate(hMsg, static_cast<const BYTE *>(rContext.m_pByteRange1), rContext.m_nByteRange1, FALSE) ||
!CryptMsgUpdate(hMsg, static_cast<const BYTE *>(rContext.m_pByteRange1), rContext.m_nByteRange2, TRUE))
{
diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx
index eddcaf7..20c4079 100644
--- a/vcl/source/gdi/pngwrite.cxx
+++ b/vcl/source/gdi/pngwrite.cxx
@@ -180,7 +180,8 @@ PNGWriterImpl::PNGWriterImpl( const BitmapEx& rBmpEx,
mpAccess = aBmp.AcquireReadAccess(); // true RGB with alphachannel
if (mpAccess)
{
- if ((mbTrueAlpha = rBmpEx.IsAlpha()))
+ mbTrueAlpha = rBmpEx.IsAlpha();
+ if (mbTrueAlpha)
{
AlphaMask aMask(rBmpEx.GetAlpha());
mpMaskAccess = aMask.AcquireReadAccess();
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index bba21ab..b6b7ee8 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -356,7 +356,8 @@ bool ImplLayoutRuns::PosIsInAnyRun( int nCharPos ) const
for (size_t i = 0; i < maRuns.size(); i+=2)
{
- if( (bRet = PosIsInRun( nCharPos )) )
+ bRet = PosIsInRun( nCharPos );
+ if( bRet )
break;
pThis->NextRun();
}
diff --git a/vcl/source/window/debugevent.cxx b/vcl/source/window/debugevent.cxx
index 4bdc65a..4810fc5 100644
--- a/vcl/source/window/debugevent.cxx
+++ b/vcl/source/window/debugevent.cxx
@@ -35,18 +35,19 @@ static double getRandom()
vcl::Window *DebugEventInjector::ChooseWindow()
{
- vcl::Window *pWindow, *pParent;
+ vcl::Window *pParent;
- if (getRandom() < 0.80 &&
- (pWindow = Application::GetFocusWindow()))
- return pWindow;
+ if (getRandom() < 0.80)
+ if (vcl::Window * pWindow = Application::GetFocusWindow())
+ return pWindow;
if (getRandom() > 0.50 ||
!(pParent = Application::GetActiveTopWindow()))
{
// select a top window at random
long nIdx = Application::GetTopWindowCount() * getRandom();
- if (!(pParent = Application::GetTopWindow( nIdx )))
+ pParent = Application::GetTopWindow( nIdx );
+ if (!pParent)
pParent = static_cast<vcl::Window *>(Application::GetAppWindow());
}
assert (pParent != nullptr);
More information about the Libreoffice-commits
mailing list