include/svl/itemset.hxx | 3 +-- sc/source/core/data/patattr.cxx | 12 ++++++------ sc/source/core/data/table4.cxx | 6 ++++-- sc/source/core/tool/compiler.cxx | 8 ++++++-- sc/source/filter/excel/excrecds.cxx | 5 +++-- sc/source/filter/excel/xecontent.cxx | 2 +- sc/source/filter/excel/xeformula.cxx | 5 ++++- sc/source/filter/excel/xehelper.cxx | 4 ++-- sc/source/filter/excel/xestring.cxx | 2 +- sc/source/filter/excel/xestyle.cxx | 2 +- sc/source/filter/inc/ftools.hxx | 2 +- sc/source/filter/inc/xcl97rec.hxx | 19 +++++++++++-------- sc/source/filter/oox/addressconverter.cxx | 12 ++++++------ sc/source/filter/oox/pagesettings.cxx | 2 +- sc/source/ui/docshell/dbdocimp.cxx | 3 ++- sc/source/ui/view/tabvwsh3.cxx | 20 ++++++++++++++++---- 16 files changed, 66 insertions(+), 41 deletions(-)
New commits: commit 8def8ca39d28ad34106767d14273b7b7d1b0b882 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Nov 16 14:05:54 2018 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Nov 16 15:36:22 2018 +0100 loplugin:buriedassign in sc Change-Id: I1408fd35a50a95e12895979b797548c89f7f4c74 Reviewed-on: https://gerrit.libreoffice.org/63469 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx index 05618d231754..23d994ddb968 100644 --- a/include/svl/itemset.hxx +++ b/include/svl/itemset.hxx @@ -192,9 +192,8 @@ public: inline void SetParent( const SfxItemSet* pNew ); // add, delete items, work on items -protected: - virtual const SfxPoolItem* Put( const SfxPoolItem&, sal_uInt16 nWhich ); public: + virtual const SfxPoolItem* Put( const SfxPoolItem&, sal_uInt16 nWhich ); const SfxPoolItem* Put( const SfxPoolItem& rItem ) { return Put(rItem, rItem.Which()); } bool Put( const SfxItemSet&, diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx index ebe8dbd11852..1508663e0feb 100644 --- a/sc/source/core/data/patattr.cxx +++ b/sc/source/core/data/patattr.cxx @@ -755,14 +755,14 @@ void ScPatternAttr::GetFromEditItemSet( SfxItemSet& rDestSet, const SfxItemSet& const SfxPoolItem* pItem; if (rEditSet.GetItemState(EE_CHAR_COLOR,true,&pItem) == SfxItemState::SET) - rDestSet.Put( SvxColorItem(ATTR_FONT_COLOR) = *static_cast<const SvxColorItem*>(pItem) ); + rDestSet.Put( *static_cast<const SvxColorItem*>(pItem), ATTR_FONT_COLOR ); if (rEditSet.GetItemState(EE_CHAR_FONTINFO,true,&pItem) == SfxItemState::SET) - rDestSet.Put( SvxFontItem(ATTR_FONT) = *static_cast<const SvxFontItem*>(pItem) ); + rDestSet.Put( *static_cast<const SvxFontItem*>(pItem), ATTR_FONT ); if (rEditSet.GetItemState(EE_CHAR_FONTINFO_CJK,true,&pItem) == SfxItemState::SET) - rDestSet.Put( SvxFontItem(ATTR_CJK_FONT) = *static_cast<const SvxFontItem*>(pItem) ); + rDestSet.Put( *static_cast<const SvxFontItem*>(pItem), ATTR_CJK_FONT ); if (rEditSet.GetItemState(EE_CHAR_FONTINFO_CTL,true,&pItem) == SfxItemState::SET) - rDestSet.Put( SvxFontItem(ATTR_CTL_FONT) = *static_cast<const SvxFontItem*>(pItem) ); + rDestSet.Put( *static_cast<const SvxFontItem*>(pItem), ATTR_CTL_FONT ); if (rEditSet.GetItemState(EE_CHAR_FONTHEIGHT,true,&pItem) == SfxItemState::SET) rDestSet.Put( SvxFontHeightItem( HMMToTwips( static_cast<const SvxFontHeightItem*>(pItem)->GetHeight() ), @@ -786,9 +786,9 @@ void ScPatternAttr::GetFromEditItemSet( SfxItemSet& rDestSet, const SfxItemSet& // SvxTextLineItem contains enum and color if (rEditSet.GetItemState(EE_CHAR_UNDERLINE,true,&pItem) == SfxItemState::SET) - rDestSet.Put( SvxUnderlineItem(LINESTYLE_NONE,ATTR_FONT_UNDERLINE) = *static_cast<const SvxUnderlineItem*>(pItem) ); + rDestSet.Put( *static_cast<const SvxUnderlineItem*>(pItem), ATTR_FONT_UNDERLINE ); if (rEditSet.GetItemState(EE_CHAR_OVERLINE,true,&pItem) == SfxItemState::SET) - rDestSet.Put( SvxOverlineItem(LINESTYLE_NONE,ATTR_FONT_OVERLINE) = *static_cast<const SvxOverlineItem*>(pItem) ); + rDestSet.Put( *static_cast<const SvxOverlineItem*>(pItem), ATTR_FONT_OVERLINE ); if (rEditSet.GetItemState(EE_CHAR_WLM,true,&pItem) == SfxItemState::SET) rDestSet.Put( SvxWordLineModeItem( static_cast<const SvxWordLineModeItem*>(pItem)->GetValue(), ATTR_FONT_WORDLINE) ); diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 300770309447..12a23a452553 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -139,14 +139,16 @@ void setSuffixCell( OUString aValue = lcl_ValueString(nValue, nDigits); if (!bIsOrdinalSuffix) { - rColumn.SetRawString(nRow, aValue += rSuffix); + aValue += rSuffix; + rColumn.SetRawString(nRow, aValue); return; } OUString aOrdinalSuffix = ScGlobal::GetOrdinalSuffix(nValue); if (eCellType != CELLTYPE_EDIT) { - rColumn.SetRawString(nRow, aValue += aOrdinalSuffix); + aValue += aOrdinalSuffix; + rColumn.SetRawString(nRow, aValue); return; } diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 556cd49b39c3..38fa2b524aa7 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -2643,10 +2643,14 @@ Label_MaskStateMachine: ParseResult aRes = pConv->parseAnyToken( aFormula, nSrcPos, pCharClass ); if ( !aRes.TokenType ) - SetError( nErr = FormulaError::IllegalChar ); // parsed chars as string + { + nErr = FormulaError::IllegalChar; + SetError( nErr ); // parsed chars as string + } if ( aRes.EndPos <= nSrcPos ) { // ?!? - SetError( nErr = FormulaError::IllegalChar ); + nErr = FormulaError::IllegalChar; + SetError( nErr ); nSrcPos = aFormula.getLength(); aSymbol.truncate(); } diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index ef5846cf0edd..d8dd91cbb78c 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -751,8 +751,9 @@ bool XclExpAutofilter::AddEntry( const ScQueryEntry& rEntry ) double fVal = 0.0; sal_uInt32 nIndex = 0; bool bIsNum = !bLen || GetFormatter().IsNumberFormat( sText, nIndex, fVal ); - OUString* pText; - bIsNum ? pText = nullptr : pText = &sText; + OUString* pText = nullptr; + if (!bIsNum) + pText = &sText; // top10 flags sal_uInt16 nNewFlags = 0x0000; diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 920de7431839..7d8341f5b3f8 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -125,7 +125,7 @@ sal_uInt32 XclExpSstImpl::Insert( XclExpStringRef xString ) // calculate hash value in range [0,EXC_SST_HASHTABLE_SIZE) sal_uInt16 nHash = xString->GetHash(); - (nHash ^= (nHash / EXC_SST_HASHTABLE_SIZE)) %= EXC_SST_HASHTABLE_SIZE; + nHash = (nHash ^ (nHash / EXC_SST_HASHTABLE_SIZE)) % EXC_SST_HASHTABLE_SIZE; XclExpHashVec& rVec = maHashTab[ nHash ]; XclExpHashEntry aEntry( xString.get(), mnSize ); diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index 3d196c8ad535..a85d12a03081 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -650,7 +650,10 @@ void XclExpFmlaCompImpl::RecalcTokenClass( const XclExpTokenConvInfo& rConvInfo, // REF tokens in VALTYPE parameters behave like VAL tokens if( rConvInfo.mbValType && (nTokClass == EXC_TOKCLASS_REF) ) - ChangeTokenClass( rnTokenId, nTokClass = EXC_TOKCLASS_VAL ); + { + nTokClass = EXC_TOKCLASS_VAL; + ChangeTokenClass( rnTokenId, nTokClass ); + } // replace RPO conversion of operator with parent conversion XclFuncParamConv eConv = (rConvInfo.meConv == EXC_PARAMCONV_RPO) ? ePrevConv : rConvInfo.meConv; diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index f7d629ce3cd7..5f5a96caf601 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -691,7 +691,7 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico if( const XclExpFont* pFirstFont = GetFontBuffer().GetFont( EXC_FONT_APP ) ) { aFontData = pFirstFont->GetFontData(); - (aFontData.mnHeight += 10) /= 20; // using pt here, not twips + aFontData.mnHeight = (aFontData.mnHeight + 10) / 20; // using pt here, not twips } else aFontData.mnHeight = 10; @@ -754,7 +754,7 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico // is calculated wrong in ScPatternAttr::GetFromEditItemSet, because already in twips and not 100thmm // -> get it directly from edit engine item set aNewData.mnHeight = ulimit_cast< sal_uInt16 >( aEditSet.Get( EE_CHAR_FONTHEIGHT ).GetHeight() ); - (aNewData.mnHeight += 10) /= 20; + aNewData.mnHeight = (aNewData.mnHeight + 10) / 20; bool bFontHtChanged = (aFontData.mnHeight != aNewData.mnHeight); if( bFontHtChanged ) aParaText.append("&").append(OUString::number( aNewData.mnHeight )); diff --git a/sc/source/filter/excel/xestring.cxx b/sc/source/filter/excel/xestring.cxx index 38e781d579f2..eb7f56e3227a 100644 --- a/sc/source/filter/excel/xestring.cxx +++ b/sc/source/filter/excel/xestring.cxx @@ -82,7 +82,7 @@ sal_uInt16 lclHashVector( const ::std::vector< Type >& rVec, const ValueHasher& sal_uInt32 nHash = rVec.size(); typedef typename ::std::vector< Type >::const_iterator CIT; for( CIT aIt = rVec.begin(), aEnd = rVec.end(); aIt != aEnd; ++aIt ) - (nHash *= 31) += rHasher( *aIt ); + nHash = (nHash * 31) + rHasher( *aIt ); return static_cast< sal_uInt16 >( nHash ^ (nHash >> 16) ); } diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 177a15a46a5a..3002523be642 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -1490,7 +1490,7 @@ bool XclExpCellAlign::FillFromItemSet( { // text indent long nTmpIndent = rItemSet.Get( ATTR_INDENT ).GetValue(); - (nTmpIndent += 100) /= 200; // 1 Excel unit == 10 pt == 200 twips + nTmpIndent = (nTmpIndent + 100) / 200; // 1 Excel unit == 10 pt == 200 twips mnIndent = limit_cast< sal_uInt8 >( nTmpIndent, 0, 15 ); bUsed |= ScfTools::CheckItem( rItemSet, ATTR_INDENT, bStyle ); diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx index 0c67a9613c17..1fcfe6339f2f 100644 --- a/sc/source/filter/inc/ftools.hxx +++ b/sc/source/filter/inc/ftools.hxx @@ -101,7 +101,7 @@ void insert_value( Type& rnBitField, InsertType nValue, sal_uInt8 nStartBit, sal { unsigned long nMask = ((1UL << nBitCount) - 1); Type nNewValue = static_cast< Type >( nValue & nMask ); - (rnBitField &= ~(nMask << nStartBit)) |= (nNewValue << nStartBit); + rnBitField = (rnBitField & ~(nMask << nStartBit)) | (nNewValue << nStartBit); } class Color; diff --git a/sc/source/filter/inc/xcl97rec.hxx b/sc/source/filter/inc/xcl97rec.hxx index 7f2df1b43c47..1c8fa1903e33 100644 --- a/sc/source/filter/inc/xcl97rec.hxx +++ b/sc/source/filter/inc/xcl97rec.hxx @@ -119,14 +119,17 @@ public: void SetTab( SCTAB nScTab ) { mnScTab = nScTab; } SCTAB GetTab() const { return mnScTab; } - void SetLocked( bool b ) - { b ? nGrbit |= 0x0001 : nGrbit &= ~0x0001; } - void SetPrintable( bool b ) - { b ? nGrbit |= 0x0010 : nGrbit &= ~0x0010; } - void SetAutoFill( bool b ) - { b ? nGrbit |= 0x2000 : nGrbit &= ~0x2000; } - void SetAutoLine( bool b ) - { b ? nGrbit |= 0x4000 : nGrbit &= ~0x4000; } + void SetLocked( bool b ) { SetGrBit(b, 0x0001); } + void SetPrintable( bool b ) { SetGrBit(b, 0x0010); } + void SetAutoFill( bool b ) { SetGrBit(b, 0x2000); } + void SetAutoLine( bool b ) { SetGrBit(b, 0x4000); } + void SetGrBit( bool b, int f ) + { + if (b) + nGrbit |= f; + else + nGrbit &= ~f; + } // set corresponding Excel object type in OBJ/ftCmo void SetEscherShapeType( sal_uInt16 nType ); diff --git a/sc/source/filter/oox/addressconverter.cxx b/sc/source/filter/oox/addressconverter.cxx index 987cef40c99c..552bd0491d6e 100644 --- a/sc/source/filter/oox/addressconverter.cxx +++ b/sc/source/filter/oox/addressconverter.cxx @@ -101,14 +101,14 @@ bool AddressConverter::parseOoxAddress2d( case STATE_COL: { if( ('a' <= cChar) && (cChar <= 'z') ) - (cChar -= 'a') += 'A'; + cChar = (cChar - 'a') + 'A'; if( ('A' <= cChar) && (cChar <= 'Z') ) { /* Return, if 1-based column index is already 6 characters long (12356631 is column index for column AAAAAA). */ if( ornColumn >= 12356631 ) return false; - (ornColumn *= 26) += (cChar - 'A' + 1); + ornColumn = (ornColumn * 26) + (cChar - 'A' + 1); } else if( ornColumn > 0 ) { @@ -127,7 +127,7 @@ bool AddressConverter::parseOoxAddress2d( // return, if 1-based row is already 9 digits long if( ornRow >= 100000000 ) return false; - (ornRow *= 10) += (cChar - '0'); + ornRow = (ornRow * 10) + (cChar - '0'); } else return false; @@ -156,14 +156,14 @@ bool AddressConverter::parseOoxAddress2d( sal_Int32& ornColumn, sal_Int32& ornRo case STATE_COL: { if( ('a' <= cChar) && (cChar <= 'z') ) - (cChar -= 'a') += 'A'; + cChar = (cChar - 'a') + 'A'; if( ('A' <= cChar) && (cChar <= 'Z') ) { /* Return, if 1-based column index is already 6 characters long (12356631 is column index for column AAAAAA). */ if( ornColumn >= 12356631 ) return false; - (ornColumn *= 26) += (cChar - 'A' + 1); + ornColumn = (ornColumn * 26) + (cChar - 'A' + 1); } else if( ornColumn > 0 ) { @@ -182,7 +182,7 @@ bool AddressConverter::parseOoxAddress2d( sal_Int32& ornColumn, sal_Int32& ornRo // return, if 1-based row is already 9 digits long if( ornRow >= 100000000 ) return false; - (ornRow *= 10) += (cChar - '0'); + ornRow = (ornRow * 10) + (cChar - '0'); } else return false; diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx index 87297db0797f..bae8c61f6034 100644 --- a/sc/source/filter/oox/pagesettings.cxx +++ b/sc/source/filter/oox/pagesettings.cxx @@ -538,7 +538,7 @@ double HeaderFooterParser::parse( const Reference<sheet::XHeaderFooterContent>& eState = STATE_TEXT; // ignore case of token codes if( ('a' <= cChar) && (cChar <= 'z') ) - (cChar -= 'a') += 'A'; + cChar = (cChar - 'a') + 'A'; switch( cChar ) { case '&': maBuffer.append( cChar ); break; // the '&' character diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index 3cae1be94c0b..06aba93ee2e2 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -310,7 +310,8 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, aSelection[nListPos] >>= nNextRow; if ( nRowsRead+1 < nNextRow ) bRealSelection = true; - bEnd = !xRowSet->absolute(nRowsRead = nNextRow); + nRowsRead = nNextRow; + bEnd = !xRowSet->absolute(nRowsRead); } ++nListPos; } diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index 451188a77acb..7c72694a31f4 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -337,7 +337,10 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) if ( nResult & ScRefFlags::TAB_3D ) { if( aScRange.aStart.Tab() != nTab ) - SetTabNo( nTab = aScRange.aStart.Tab() ); + { + nTab = aScRange.aStart.Tab(); + SetTabNo( nTab ); + } } else { @@ -351,7 +354,10 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) if ( nResult & ScRefFlags::TAB_3D ) { if( aScAddress.Tab() != nTab ) - SetTabNo( nTab = aScAddress.Tab() ); + { + nTab = aScAddress.Tab(); + SetTabNo( nTab ); + } } else aScAddress.SetTab( nTab ); @@ -370,7 +376,10 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) { nResult |= ScRefFlags::VALID; if( aScRange.aStart.Tab() != nTab ) - SetTabNo( nTab = aScRange.aStart.Tab() ); + { + nTab = aScRange.aStart.Tab(); + SetTabNo( nTab ); + } } } @@ -875,7 +884,10 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) // special case: only hidden tables selected -> do nothing bool bVisSelected = false; for( nSelIx = 0; !bVisSelected && (nSelIx < nSelCount); ++nSelIx ) - bVisSelected = rDoc.IsVisible( nFirstVisTab = static_cast<SCTAB>(aIndexList[nSelIx]) ); + { + nFirstVisTab = static_cast<SCTAB>(aIndexList[nSelIx]); + bVisSelected = rDoc.IsVisible( nFirstVisTab ); + } if( !bVisSelected ) nSelCount = 0; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits