summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-04-15 09:04:38 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-15 19:25:23 +0200
commit4cc702a7055c0e12c7cbf5e5e359e7cbc8b88020 (patch)
treef09f7167cdca22f16edb5a998c2f9714e4bdc698
parentFix typo (diff)
downloadcore-4cc702a7055c0e12c7cbf5e5e359e7cbc8b88020.tar.gz
core-4cc702a7055c0e12c7cbf5e5e359e7cbc8b88020.zip
loplugin:buriedassign in f,h,i*
Change-Id: Iac753e528e13cb2565832a484e87f88061bbc91e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92239 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--filter/source/svg/svgwriter.cxx6
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx16
-rw-r--r--formula/source/core/api/token.cxx16
-rw-r--r--framework/source/uielement/popuptoolbarcontroller.cxx44
-rw-r--r--hwpfilter/source/hiodev.cxx5
-rw-r--r--hwpfilter/source/hwpeq.cxx37
-rw-r--r--hwpfilter/source/hwpfile.cxx8
-rw-r--r--i18npool/source/breakiterator/breakiteratorImpl.cxx55
-rw-r--r--i18npool/source/localedata/LocaleNode.cxx16
-rw-r--r--i18nutil/source/utility/casefolding.cxx7
-rw-r--r--i18nutil/source/utility/unicode.cxx14
-rw-r--r--idlc/source/idlccompile.cxx4
-rw-r--r--idlc/source/parser.y34
13 files changed, 172 insertions, 90 deletions
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index a55dec5b07f2..9493174a4edd 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -1727,13 +1727,15 @@ long SVGActionWriter::ImplMap( sal_Int32 nVal ) const
Point& SVGActionWriter::ImplMap( const Point& rPt, Point& rDstPt ) const
{
- return( rDstPt = OutputDevice::LogicToLogic( rPt, mpVDev->GetMapMode(), maTargetMapMode ) );
+ rDstPt = OutputDevice::LogicToLogic( rPt, mpVDev->GetMapMode(), maTargetMapMode );
+ return rDstPt;
}
Size& SVGActionWriter::ImplMap( const Size& rSz, Size& rDstSz ) const
{
- return( rDstSz = OutputDevice::LogicToLogic( rSz, mpVDev->GetMapMode(), maTargetMapMode ) );
+ rDstSz = OutputDevice::LogicToLogic( rSz, mpVDev->GetMapMode(), maTargetMapMode );
+ return rDstSz;
}
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index e8c92c990509..f6f7e4876eb0 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1396,17 +1396,19 @@ void FormulaCompiler::Factor()
eOp = Expression();
// Do not ignore error here, regardless of mbStopOnError, to not
// change the formula expression in case of an unexpected state.
- if (pArr->GetCodeError() == FormulaError::NONE)
+ if (pArr->GetCodeError() == FormulaError::NONE && pc >= 2)
{
// Left and right operands must be reference or function
// returning reference to form a range list.
- const FormulaToken* p;
- if (pc >= 2
- && ((p = pCode[-2]) != nullptr) && isPotentialRangeType( p, true, false)
- && ((p = pCode[-1]) != nullptr) && isPotentialRangeType( p, true, true))
+ const FormulaToken* p = pCode[-2];
+ if (p && isPotentialRangeType( p, true, false))
{
- pFacToken->NewOpCode( ocUnion, FormulaToken::PrivateAccess());
- PutCode( pFacToken);
+ p = pCode[-1];
+ if (p && isPotentialRangeType( p, true, true))
+ {
+ pFacToken->NewOpCode( ocUnion, FormulaToken::PrivateAccess());
+ PutCode( pFacToken);
+ }
}
}
}
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index 54d0b52eb4b5..0b8b373a9de3 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -1392,9 +1392,12 @@ FormulaTokenArray * FormulaTokenArray::RewriteMissing( const MissingConvention &
OpCode eOp;
if (rConv.isPODF() && pCtx[ nFn ].mpFunc && pCtx[ nFn ].mpFunc->GetOpCode() == ocAddress)
pOcas[ nOcas++ ] = nFn; // entering ADDRESS() if PODF
- else if ((rConv.isODFF() || rConv.isOOXML()) && pCtx[ nFn ].mpFunc &&
- ((eOp = pCtx[ nFn ].mpFunc->GetOpCode()) == ocDBCount || eOp == ocDBCount2))
- pOcds[ nOcds++ ] = nFn; // entering DCOUNT() or DCOUNTA() if ODFF or OOXML
+ else if ((rConv.isODFF() || rConv.isOOXML()) && pCtx[ nFn ].mpFunc)
+ {
+ eOp = pCtx[ nFn ].mpFunc->GetOpCode();
+ if (eOp == ocDBCount || eOp == ocDBCount2)
+ pOcds[ nOcds++ ] = nFn; // entering DCOUNT() or DCOUNTA() if ODFF or OOXML
+ }
}
break;
case ocClose:
@@ -1608,10 +1611,11 @@ const FormulaToken* FormulaTokenIterator::PeekNextOperator()
{
const FormulaToken* t = nullptr;
short nIdx = maStack.back().nPC;
- while (!t && ((t = GetNonEndOfPathToken( ++nIdx)) != nullptr))
+ for (;;)
{
- if (t->GetOpCode() == ocPush)
- t = nullptr; // ignore operands
+ t = GetNonEndOfPathToken( ++nIdx);
+ if (t == nullptr || t->GetOpCode() != ocPush)
+ break; // ignore operands
}
if (!t && maStack.size() > 1)
{
diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx
index 5c11600c31b9..ea76be37887c 100644
--- a/framework/source/uielement/popuptoolbarcontroller.cxx
+++ b/framework/source/uielement/popuptoolbarcontroller.cxx
@@ -730,29 +730,33 @@ bool Impl_ExistURLInMenu(
{
bool bValidFallback( false );
sal_uInt16 nCount( 0 );
- if ( rPopupMenu.is() && ( nCount = rPopupMenu->getItemCount() ) != 0 && sURL.getLength() )
+ if ( rPopupMenu.is() )
{
- for ( sal_uInt16 n = 0; n < nCount; ++n )
+ nCount = rPopupMenu->getItemCount();
+ if (nCount != 0 && sURL.getLength() )
{
- sal_uInt16 nId = rPopupMenu->getItemId( n );
- OUString aCmd( rPopupMenu->getCommand( nId ) );
-
- if ( !bValidFallback && aCmd.getLength() )
- {
- sFallback = aCmd;
- bValidFallback = true;
- }
-
- // match even if the menu command is more detailed
- // (maybe an additional query) #i28667#
- if ( aCmd.match( sURL ) )
+ for ( sal_uInt16 n = 0; n < nCount; ++n )
{
- sURL = aCmd;
- const css::uno::Reference< css::graphic::XGraphic > xGraphic(
- rPopupMenu->getItemImage( nId ) );
- if ( xGraphic.is() )
- aImage = Image( xGraphic );
- return true;
+ sal_uInt16 nId = rPopupMenu->getItemId( n );
+ OUString aCmd( rPopupMenu->getCommand( nId ) );
+
+ if ( !bValidFallback && aCmd.getLength() )
+ {
+ sFallback = aCmd;
+ bValidFallback = true;
+ }
+
+ // match even if the menu command is more detailed
+ // (maybe an additional query) #i28667#
+ if ( aCmd.match( sURL ) )
+ {
+ sURL = aCmd;
+ const css::uno::Reference< css::graphic::XGraphic > xGraphic(
+ rPopupMenu->getItemImage( nId ) );
+ if ( xGraphic.is() )
+ aImage = Image( xGraphic );
+ return true;
+ }
}
}
}
diff --git a/hwpfilter/source/hiodev.cxx b/hwpfilter/source/hiodev.cxx
index f7cd75ead04a..56d4719e4302 100644
--- a/hwpfilter/source/hiodev.cxx
+++ b/hwpfilter/source/hiodev.cxx
@@ -134,7 +134,10 @@ bool HStreamIODev::setCompressed(bool flag)
{
compressed = flag;
if (flag)
- return nullptr != (_gzfp = gz_open(*_stream));
+ {
+ _gzfp = gz_open(*_stream);
+ return nullptr != _gzfp;
+ }
else if (_gzfp)
{
gz_flush(_gzfp, Z_FINISH);
diff --git a/hwpfilter/source/hwpeq.cxx b/hwpfilter/source/hwpeq.cxx
index 00cf2182866c..5aa6487fae2a 100644
--- a/hwpfilter/source/hwpeq.cxx
+++ b/hwpfilter/source/hwpeq.cxx
@@ -504,13 +504,19 @@ static int next_token(MzString &white, MzString &token, istream *strm)
token = nullptr;
white = nullptr;
- if( !strm->good() || (ch = strm->get()) == std::istream::traits_type::eof() )
+ if( !strm->good() )
+ return 0;
+ ch = strm->get();
+ if( ch == std::istream::traits_type::eof() )
return 0;
// read preceding ws
if( IS_WS(ch) ) {
- do white << static_cast<char>(ch);
- while( IS_WS(ch = strm->get()) );
+ do
+ {
+ white << static_cast<char>(ch);
+ ch = strm->get();
+ } while (IS_WS(ch));
}
if( ch == '\\' || ch & 0x80
@@ -544,8 +550,12 @@ static int next_token(MzString &white, MzString &token, istream *strm)
token = "^";
}
else if( IS_BINARY(ch) ) {
- do token << static_cast<char>(ch);
- while( IS_BINARY(ch = strm->get()) );
+ do
+ {
+ token << static_cast<char>(ch);
+ ch = strm->get();
+ }
+ while( IS_BINARY(ch) );
strm->putback(static_cast<char>(ch));
}
else if( ch != std::istream::traits_type::eof() && rtl::isAsciiDigit(ch) ) {
@@ -572,8 +582,13 @@ static std::istream::int_type read_white_space(MzString& outs, istream *strm)
}
else {
std::istream::int_type ch;
- while( IS_WS(ch = strm->get()) )
- outs << static_cast<char>(ch);
+ for (;;)
+ {
+ ch = strm->get();
+ if (!IS_WS(ch))
+ break;
+ outs << static_cast<char>(ch);
+ }
strm->putback(static_cast<char>(ch));
result = ch;
}
@@ -741,9 +756,13 @@ static char eq2ltxconv(MzString& sstr, istream *strm, const char *sentinel)
sstr.replace(pos, ' ');
}
sstr << token;
- while( (ch = strm->get()) != std::istream::traits_type::eof()
- && IS_WS(ch) )
+ for (;;)
+ {
+ ch = strm->get();
+ if ( ch == std::istream::traits_type::eof() || !IS_WS(ch) )
+ break;
sstr << static_cast<char>(ch);
+ }
if( ch != '{' )
sstr << "{}";
else {
diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx
index b7031bb10444..8be445919ed4 100644
--- a/hwpfilter/source/hwpfile.cxx
+++ b/hwpfilter/source/hwpfile.cxx
@@ -106,11 +106,11 @@ int HWPFile::Open(std::unique_ptr<HStream> stream)
char idstr[HWPIDLen];
- if (ReadBlock(idstr, HWPIDLen) < HWPIDLen
- || HWP_V30 != (version = detect_hwp_version(idstr)))
- {
+ if (ReadBlock(idstr, HWPIDLen) < HWPIDLen)
+ return SetState(HWP_UNSUPPORTED_VERSION);
+ version = detect_hwp_version(idstr);
+ if (HWP_V30 != version)
return SetState(HWP_UNSUPPORTED_VERSION);
- }
return HWP_NoError;
}
diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx
index 30a2d9105459..a6ce162270ef 100644
--- a/i18npool/source/breakiterator/breakiteratorImpl.cxx
+++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx
@@ -75,23 +75,57 @@ static sal_Int32 skipSpace(const OUString& Text, sal_Int32 nPos, sal_Int32 len,
switch (rWordType) {
case WordType::ANYWORD_IGNOREWHITESPACES:
if (bDirection)
- while (nPos < len && (u_isWhitespace(ch = Text.iterateCodePoints(&pos)) || isZWSP(ch))) nPos=pos;
+ while (nPos < len)
+ {
+ ch = Text.iterateCodePoints(&pos);
+ if (!u_isWhitespace(ch) && !isZWSP(ch))
+ break;
+ nPos = pos;
+ }
else
- while (nPos > 0 && (u_isWhitespace(ch = Text.iterateCodePoints(&pos, -1)) || isZWSP(ch))) nPos=pos;
+ while (nPos > 0)
+ {
+ ch = Text.iterateCodePoints(&pos, -1);
+ if (!u_isWhitespace(ch) && !isZWSP(ch))
+ break;
+ nPos = pos;
+ }
break;
case WordType::DICTIONARY_WORD:
if (bDirection)
- while (nPos < len && (u_isWhitespace(ch = Text.iterateCodePoints(&pos)) || isZWSP(ch) ||
- ! (ch == 0x002E || u_isalnum(ch)))) nPos=pos;
+ while (nPos < len)
+ {
+ ch = Text.iterateCodePoints(&pos);
+ if (!u_isWhitespace(ch) && !isZWSP(ch) && (ch == 0x002E || u_isalnum(ch)))
+ break;
+ nPos = pos;
+ }
else
- while (nPos > 0 && (u_isWhitespace(ch = Text.iterateCodePoints(&pos, -1)) || isZWSP(ch) ||
- ! (ch == 0x002E || u_isalnum(ch)))) nPos=pos;
+ while (nPos > 0)
+ {
+ ch = Text.iterateCodePoints(&pos, -1);
+ if (!u_isWhitespace(ch) && !isZWSP(ch) && (ch == 0x002E || u_isalnum(ch)))
+ break;
+ nPos = pos;
+ }
break;
case WordType::WORD_COUNT:
if (bDirection)
- while (nPos < len && (u_isUWhiteSpace(ch = Text.iterateCodePoints(&pos)) || isZWSP(ch))) nPos=pos;
+ while (nPos < len)
+ {
+ ch = Text.iterateCodePoints(&pos);
+ if (!u_isUWhiteSpace(ch) && !isZWSP(ch))
+ break;
+ nPos = pos;
+ }
else
- while (nPos > 0 && (u_isUWhiteSpace(ch = Text.iterateCodePoints(&pos, -1)) || isZWSP(ch))) nPos=pos;
+ while (nPos > 0)
+ {
+ ch = Text.iterateCodePoints(&pos, -1);
+ if (!u_isUWhiteSpace(ch) && !isZWSP(ch))
+ break;
+ nPos = pos;
+ }
break;
}
return nPos;
@@ -578,7 +612,10 @@ BreakIteratorImpl::getLocaleSpecificBreakIterator(const Locale& rLocale)
for (const lookupTableItem& listItem : lookupTable) {
if (rLocale == listItem.aLocale)
- return xBI = listItem.xBI;
+ {
+ xBI = listItem.xBI;
+ return xBI;
+ }
}
OUStringLiteral under("_");
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index 38c0bce2055d..dd23465bea19 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -688,14 +688,16 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
case cssi::NumberFormatIndex::CURRENCY_1000DEC2 :
// Remember the currency symbol if present.
{
- sal_Int32 nStart;
- if (sTheCompatibleCurrency.isEmpty() &&
- ((nStart = n->getValue().indexOf("[$")) >= 0))
+ if (sTheCompatibleCurrency.isEmpty())
{
- const OUString& aCode( n->getValue());
- sal_Int32 nHyphen = aCode.indexOf( '-', nStart);
- if (nHyphen >= nStart + 3)
- sTheCompatibleCurrency = aCode.copy( nStart + 2, nHyphen - nStart - 2);
+ sal_Int32 nStart = n->getValue().indexOf("[$");
+ if (nStart >= 0)
+ {
+ const OUString& aCode( n->getValue());
+ sal_Int32 nHyphen = aCode.indexOf( '-', nStart);
+ if (nHyphen >= nStart + 3)
+ sTheCompatibleCurrency = aCode.copy( nStart + 2, nHyphen - nStart - 2);
+ }
}
}
[[fallthrough]];
diff --git a/i18nutil/source/utility/casefolding.cxx b/i18nutil/source/utility/casefolding.cxx
index cf3a716701e3..57a6a23bc561 100644
--- a/i18nutil/source/utility/casefolding.cxx
+++ b/i18nutil/source/utility/casefolding.cxx
@@ -135,9 +135,10 @@ Mapping casefolding::getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 l
static bool
is_ja_voice_sound_mark(sal_Unicode& current, sal_Unicode next)
{
- sal_Unicode c = 0;
-
- if ((next == 0x3099 || next == 0x309a) && ( (c = widthfolding::getCompositionChar(current, next)) != 0 ))
+ if (!(next == 0x3099 || next == 0x309a))
+ return false;
+ sal_Unicode c = widthfolding::getCompositionChar(current, next);
+ if (c != 0)
current = c;
return c != 0;
}
diff --git a/i18nutil/source/utility/unicode.cxx b/i18nutil/source/utility/unicode.cxx
index 95b455683833..4e0a0e45e126 100644
--- a/i18nutil/source/utility/unicode.cxx
+++ b/i18nutil/source/utility/unicode.cxx
@@ -73,8 +73,11 @@ unicode::getUnicodeType( const sal_Unicode ch ) {
else c = ch;
sal_Int16 address = UnicodeTypeIndex[ch >> 8];
- return r = static_cast<sal_Int16>((address < UnicodeTypeNumberBlock) ? UnicodeTypeBlockValue[address] :
- UnicodeTypeValue[((address - UnicodeTypeNumberBlock) << 8) + (ch & 0xff)]);
+ r = static_cast<sal_Int16>(
+ (address < UnicodeTypeNumberBlock)
+ ? UnicodeTypeBlockValue[address]
+ : UnicodeTypeValue[((address - UnicodeTypeNumberBlock) << 8) + (ch & 0xff)]);
+ return r;
}
sal_uInt8
@@ -86,9 +89,10 @@ unicode::getUnicodeDirection( const sal_Unicode ch ) {
else c = ch;
sal_Int16 address = UnicodeDirectionIndex[ch >> 8];
- return r = ((address < UnicodeDirectionNumberBlock) ? UnicodeDirectionBlockValue[address] :
- UnicodeDirectionValue[((address - UnicodeDirectionNumberBlock) << 8) + (ch & 0xff)]);
-
+ r = (address < UnicodeDirectionNumberBlock)
+ ? UnicodeDirectionBlockValue[address]
+ : UnicodeDirectionValue[((address - UnicodeDirectionNumberBlock) << 8) + (ch & 0xff)];
+ return r;
}
#define bit(name) (1U << name)
diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx
index c2fc601142e2..8db6d82a026f 100644
--- a/idlc/source/idlccompile.cxx
+++ b/idlc/source/idlccompile.cxx
@@ -185,8 +185,8 @@ bool copyFile(const OString* source, const OString& target)
while ( !feof(pSource) )
{
- size_t readSize;
- if ( (readSize = fread(pBuffer, 1, totalSize, pSource)) > 0 && !ferror(pSource) )
+ size_t readSize = fread(pBuffer, 1, totalSize, pSource);
+ if ( readSize > 0 && !ferror(pSource) )
{
if ( (fwrite(pBuffer, 1, readSize, pTarget)) != readSize || ferror(pTarget) )
{
diff --git a/idlc/source/parser.y b/idlc/source/parser.y
index 40e82ef85216..1d81492562d5 100644
--- a/idlc/source/parser.y
+++ b/idlc/source/parser.y
@@ -1430,22 +1430,26 @@ const_type :
* If the constant's type is a scoped name, it must resolve
* to a scalar constant type
*/
- if ( pScope && (type = pScope->lookupByName(*$1)) ) {
- if (!ErrorHandler::checkPublished(type))
- {
- type = nullptr;
- $$ = ET_none;
- }
- else
- {
- type = resolveTypedefs(type);
- if (type->getNodeType() == NT_predefined)
+ if ( pScope ) {
+ type = pScope->lookupByName(*$1);
+ if (type) {
+ if (!ErrorHandler::checkPublished(type))
{
- $$ = static_cast< AstBaseType const * >(type)->
- getExprType();
- } else
- $$ = ET_any;
- }
+ type = nullptr;
+ $$ = ET_none;
+ }
+ else
+ {
+ type = resolveTypedefs(type);
+ if (type->getNodeType() == NT_predefined)
+ {
+ $$ = static_cast< AstBaseType const * >(type)->
+ getExprType();
+ } else
+ $$ = ET_any;
+ }
+ } else
+ $$ = ET_any;
} else
$$ = ET_any;
}