diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-17 11:39:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-17 12:44:46 +0200 |
commit | 0b2ddcda730897cb5b2801731f03191d77409273 (patch) | |
tree | 063c9beae80927710fef7ac8b5bc22d458004de9 /tools | |
parent | 3cb8e9e211c30089516f56f465176d3a959631f9 (diff) |
loplugin:buriedassign in tools..xmloff
Change-Id: I31df6c4fd82c6f6d15bbe5228e92e5171cacba51
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92410
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/generic/poly.cxx | 16 | ||||
-rw-r--r-- | tools/source/memtools/multisel.cxx | 23 | ||||
-rw-r--r-- | tools/source/zcodec/zcodec.cxx | 10 |
3 files changed, 31 insertions, 18 deletions
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index fba7a80bd23d..72e7532874ad 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -332,10 +332,12 @@ ImplPolygon::ImplPolygon( const Point& rBezPt1, const Point& rCtrlPt1, Point& rPt = mxPointAry[i]; fK_2 = fK_1; - fK_3 = ( fK_2 *= fK_1 ); + fK_2 *= fK_1; + fK_3 = fK_2; fK_3 *= fK_1; fK1_2 = fK1_1; - fK1_3 = ( fK1_2 *= fK1_1 ); + fK1_2 *= fK1_1; + fK1_3 = fK1_2; fK1_3 *= fK1_1; double fK12 = fK_1 * fK1_2; double fK21 = fK_2 * fK1_1; @@ -1250,10 +1252,14 @@ Vector2D& Vector2D::Normalize() { double fLen = Scalar( *this ); - if( ( fLen != 0.0 ) && ( fLen != 1.0 ) && ( ( fLen = sqrt( fLen ) ) != 0.0 ) ) + if( ( fLen != 0.0 ) && ( fLen != 1.0 ) ) { - mfX /= fLen; - mfY /= fLen; + fLen = sqrt( fLen ); + if( fLen != 0.0 ) + { + mfX /= fLen; + mfY /= fLen; + } } return *this; diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx index 8fd0c61aeb27..7a8df48d0049 100644 --- a/tools/source/memtools/multisel.cxx +++ b/tools/source/memtools/multisel.cxx @@ -379,10 +379,11 @@ sal_Int32 MultiSelection::FirstSelected() nCurSubSel = 0; bCurValid = !aSels.empty(); - if ( bCurValid ) - return nCurIndex = aSels[ 0 ].Min(); + if ( !bCurValid ) + return SFX_ENDOFSELECTION; - return SFX_ENDOFSELECTION; + nCurIndex = aSels[ 0 ].Min(); + return nCurIndex; } sal_Int32 MultiSelection::LastSelected() @@ -390,10 +391,11 @@ sal_Int32 MultiSelection::LastSelected() nCurSubSel = aSels.size() - 1; bCurValid = !aSels.empty(); - if ( bCurValid ) - return nCurIndex = aSels[ nCurSubSel ].Max(); + if ( !bCurValid ) + return SFX_ENDOFSELECTION; - return SFX_ENDOFSELECTION; + nCurIndex = aSels[ nCurSubSel ].Max(); + return nCurIndex; } sal_Int32 MultiSelection::NextSelected() @@ -406,11 +408,12 @@ sal_Int32 MultiSelection::NextSelected() return ++nCurIndex; // are there further sub selections? - if ( ++nCurSubSel < sal_Int32(aSels.size()) ) - return nCurIndex = aSels[ nCurSubSel ].Min(); + if ( ++nCurSubSel >= sal_Int32(aSels.size()) ) + // we are at the end! + return SFX_ENDOFSELECTION; - // we are at the end! - return SFX_ENDOFSELECTION; + nCurIndex = aSels[ nCurSubSel ].Min(); + return nCurIndex; } void MultiSelection::SetTotalRange( const Range& rTotRange ) diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx index a29127be7232..b6b1b2112b32 100644 --- a/tools/source/zcodec/zcodec.cxx +++ b/tools/source/zcodec/zcodec.cxx @@ -119,9 +119,12 @@ void ZCodec::Compress( SvStream& rIStm, SvStream& rOStm ) InitCompress(); mpInBuf = new sal_uInt8[ mnInBufSize ]; auto pStream = static_cast<z_stream*>(mpsC_Stream); - while ((pStream->avail_in = rIStm.ReadBytes( - pStream->next_in = mpInBuf, mnInBufSize )) != 0) + for (;;) { + pStream->next_in = mpInBuf; + pStream->avail_in = rIStm.ReadBytes( pStream->next_in, mnInBufSize ); + if (pStream->avail_in == 0) + break; if ( pStream->avail_out == 0 ) ImplWriteBack(); if ( deflate( pStream, Z_NO_FLUSH ) < 0 ) @@ -142,7 +145,8 @@ long ZCodec::Decompress( SvStream& rIStm, SvStream& rOStm ) assert(meState == STATE_INIT); mpOStm = &rOStm; InitDecompress(rIStm); - pStream->next_out = mpOutBuf = new sal_uInt8[ pStream->avail_out = mnOutBufSize ]; + pStream->avail_out = mnOutBufSize; + pStream->next_out = mpOutBuf = new sal_uInt8[ pStream->avail_out ]; do { if ( pStream->avail_out == 0 ) ImplWriteBack(); |