summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-11-29 17:17:32 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-11-29 17:17:32 +0100
commit8b30c5228b9d2031e5bbd2511a3bbe5f760ce836 (patch)
tree26672a40cebfdaf1f2c880b40b4b94d19ec575c8 /vcl
parent7661bbbaef31adfdb298b1447301b24a70f85834 (diff)
Rewrite some (trivial) assignments inside if/while conditions: vcl
Change-Id: I26fd9bf9838b0d9d6cf35dc62195216a0c1333ee
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/scheduler.cxx4
-rw-r--r--vcl/source/control/button.cxx10
-rw-r--r--vcl/source/control/tabctrl.cxx3
-rw-r--r--vcl/source/filter/igif/gifread.cxx9
-rw-r--r--vcl/source/filter/ixpm/xpmread.cxx3
-rw-r--r--vcl/source/gdi/animate.cxx3
-rw-r--r--vcl/source/gdi/bitmap.cxx3
-rw-r--r--vcl/source/gdi/bitmap3.cxx6
-rw-r--r--vcl/source/gdi/impgraph.cxx3
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx44
-rw-r--r--vcl/source/gdi/pngwrite.cxx3
-rw-r--r--vcl/source/gdi/sallayout.cxx3
-rw-r--r--vcl/source/window/debugevent.cxx11
13 files changed, 59 insertions, 46 deletions
diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 4caa4d27e82e..5cfb042fb00a 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 025c80f26cb1..e331115d005e 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 4ea0e0bd7e13..d9d9bcb61866 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 bc739efa9ba1..f767f3b1fb5d 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 bdeacf940121..1d45b61dd56b 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 181ad8a9e972..3b6422de69ba 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 cf0bf70343e3..f5ce79857b96 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 acc6c4baeac0..fcf3751ced12 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 ef05e5ca627a..2f8e645a81c7 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 2cbd8cbb6e54..88590df4f0ae 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 eddcaf7c81bb..20c4079ffd80 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 bba21ab22079..b6b7ee8bcb9a 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 4bdc65a6545e..4810fc5ca759 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);