diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-15 19:33:03 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-16 08:15:54 +0200 |
commit | cd7471335a05e7dd7eca16ac0b181d96cfa7912b (patch) | |
tree | ae91004516ef87f82c9a5300c0c4f2f0d7d2bddf /svl | |
parent | eca8526607d8e5b883989adf480780661380b12e (diff) |
loplugin:buriedassign in starmath..svl
Change-Id: I979faf4c476a7de91a0b6e06dd8717cee25525f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92313
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/items/itemset.cxx | 16 | ||||
-rw-r--r-- | svl/source/numbers/zforfind.cxx | 19 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 16 |
3 files changed, 38 insertions, 13 deletions
diff --git a/svl/source/items/itemset.cxx b/svl/source/items/itemset.cxx index 364fb429c5d0..180c76a6a4a7 100644 --- a/svl/source/items/itemset.cxx +++ b/svl/source/items/itemset.cxx @@ -425,7 +425,10 @@ SfxItemState SfxItemSet::GetItemState( sal_uInt16 nWhich, pPtr += 2; } } - } while (bSrchInParent && nullptr != (pCurrentSet = pCurrentSet->m_pParent)); + if (!bSrchInParent) + break; + pCurrentSet = pCurrentSet->m_pParent; + } while (nullptr != pCurrentSet); return eRet; } @@ -695,10 +698,12 @@ void SfxItemSet::MergeRange( sal_uInt16 nFrom, sal_uInt16 nTo ) {return (lhs.first-1) <= rhs.second && (rhs.first-1) <= lhs.second;}; std::vector<std::pair<sal_uInt16, sal_uInt16> >::iterator it = aRangesTable.begin(); - std::vector<std::pair<sal_uInt16, sal_uInt16> >::iterator itNext; // we got at least one range - while ((itNext = std::next(it)) != aRangesTable.end()) + for (;;) { + auto itNext = std::next(it); + if (itNext == aRangesTable.end()) + break; // check neighbouring ranges, find first range which overlaps or adjoins a previous range if (needMerge(*it, *itNext)) { @@ -923,7 +928,10 @@ const SfxPoolItem& SfxItemSet::Get( sal_uInt16 nWhich, bool bSrchInParent) const //TODO: Search until end of Range: What are we supposed to do now? To the Parent or Default?? // if( !*pPtr ) // Until the end of the search Range? // break; - } while (bSrchInParent && nullptr != (pCurrentSet = pCurrentSet->m_pParent)); + if (!bSrchInParent) + break; + pCurrentSet = pCurrentSet->m_pParent; + } while (nullptr != pCurrentSet); // Get the Default from the Pool and return SAL_WARN_IF(!m_pPool, "svl.items", "no Pool, but status is ambiguous, with ID/pos " << nWhich); diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 32b471a5df23..73a70c9efc1a 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -219,8 +219,11 @@ bool ImpSvNumberInputScan::NextNumberStringSymbol( const sal_Unicode*& pStr, const sal_Unicode* pHere = pStr; sal_Int32 nChars = 0; - while ( ((cToken = *pHere) != 0) && eState != SsStop) + for (;;) { + cToken = *pHere; + if (cToken == 0 || eState == SsStop) + break; pHere++; switch (eState) { @@ -292,8 +295,11 @@ bool ImpSvNumberInputScan::SkipThousands( const sal_Unicode*& pStr, ScanState eState = SsStart; sal_Int32 nCounter = 0; // counts 3 digits - while ( ((cToken = *pHere) != 0) && eState != SsStop) + for (;;) { + cToken = *pHere; + if (cToken == 0 || eState == SsStop) + break; pHere++; switch (eState) { @@ -1135,13 +1141,15 @@ bool ImpSvNumberInputScan::CanForceToIso8601( DateOrder eDateOrder ) switch (eDateOrder) { case DateOrder::DMY: // "day" value out of range => ISO 8601 year - if ((n = sStrArray[nNums[0]].toInt32()) < 1 || n > 31) + n = sStrArray[nNums[0]].toInt32(); + if (n < 1 || n > 31) { nCanForceToIso8601 = 2; } break; case DateOrder::MDY: // "month" value out of range => ISO 8601 year - if ((n = sStrArray[nNums[0]].toInt32()) < 1 || n > 12) + n = sStrArray[nNums[0]].toInt32(); + if (n < 1 || n > 12) { nCanForceToIso8601 = 2; } @@ -1426,7 +1434,8 @@ bool ImpSvNumberInputScan::IsAcceptedDatePattern( sal_uInt16 nStartPatternAt ) do { ++nPos; - } while ((c = rPat[--nPatCheck]) != 'Y' && c != 'M' && c != 'D'); + c = rPat[--nPatCheck]; + } while (c != 'Y' && c != 'M' && c != 'D'); } } } diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index e522977afdff..0dbe9bc25b83 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -1444,8 +1444,11 @@ sal_Int32 SvNumberformat::ImpGetNumber(OUStringBuffer& rString, sal_Unicode cToken; sal_Int32 nLen = rString.getLength(); OUStringBuffer sBuffSymbol; - while ( nPos < nLen && ((cToken = rString[nPos]) != ']') ) + while ( nPos < nLen ) { + cToken = rString[nPos]; + if (cToken == ']') + break; if (cToken == ' ') { // delete spaces rString.remove(nPos,1); @@ -1610,8 +1613,11 @@ SvNumberformat::LocaleType SvNumberformat::ImpGetLocaleType(const OUString& rStr sal_Unicode cToken = 0; sal_Int32 nStart = nPos; sal_Int32 nLen = rString.getLength(); - while ( nPos < nLen && (nPos - nStart < 8) && ((cToken = rString[nPos]) != ']') ) + while ( nPos < nLen && (nPos - nStart < 8) ) { + cToken = rString[nPos]; + if (cToken == ']') + break; if ( '0' <= cToken && cToken <= '9' ) { nNum *= 16; @@ -2010,15 +2016,17 @@ OUString SvNumberformat::StripNewCurrencyDelimiters( const OUString& rStr ) do { nDash = rStr.indexOf( '-', ++nEnd ); + nEnd = GetQuoteEnd( rStr, nDash ); } - while ( (nEnd = GetQuoteEnd( rStr, nDash )) >= 0 ); + while ( nEnd >= 0 ); sal_Int32 nClose; nEnd = nStartPos - 1; do { nClose = rStr.indexOf( ']', ++nEnd ); + nEnd = GetQuoteEnd( rStr, nClose ); } - while ( (nEnd = GetQuoteEnd( rStr, nClose )) >= 0 ); + while ( nEnd >= 0 ); if(nClose < 0) { |