Just compiler warning fixes. Most of them are "warning: suggest parentheses around '&&' within '||'" fixes, but there's a couple of unused variables I removed as well.
Contributed under the MPL 1.1 / GPLv3+ / LGPLv3+ licenses.
From fc27b18c967ee10039b3c1b53f576d8b4f96573d Mon Sep 17 00:00:00 2001 From: Mattias Johnsson <[email protected]> Date: Sat, 6 Nov 2010 22:31:51 +1100 Subject: [PATCH] Clean up compiler warnings --- sw/source/core/edit/edsect.cxx | 4 ++-- sw/source/core/frmedt/tblsel.cxx | 4 ++-- sw/source/core/layout/paintfrm.cxx | 10 +++++----- sw/source/core/layout/trvlfrm.cxx | 8 ++++---- sw/source/core/layout/wsfrm.cxx | 2 +- sw/source/core/unocore/unocoll.cxx | 2 +- sw/source/core/unocore/unoframe.cxx | 2 +- sw/source/core/unocore/unostyle.cxx | 12 ++++++------ sw/source/filter/ascii/ascatr.cxx | 4 ++-- sw/source/filter/html/htmlctxt.cxx | 2 +- sw/source/filter/html/parcss1.cxx | 4 ++-- sw/source/ui/misc/glosdoc.cxx | 2 +- sw/source/ui/misc/outline.cxx | 4 ++-- sw/source/ui/misc/pggrid.cxx | 1 - sw/source/ui/shells/textsh.cxx | 2 +- sw/source/ui/shells/textsh1.cxx | 4 ++-- sw/source/ui/shells/txtattr.cxx | 4 ++-- sw/source/ui/utlui/content.cxx | 11 +++++------ 18 files changed, 40 insertions(+), 42 deletions(-) diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx index 9d29e40..9a793ab 100644 --- a/sw/source/core/edit/edsect.cxx +++ b/sw/source/core/edit/edsect.cxx @@ -144,8 +144,8 @@ BOOL SwEditShell::IsAnySectionInDoc( BOOL bChkReadOnly, BOOL bChkHidden, BOOL bC const SwSectionFmt* pFmt = rFmts[ n ]; if( pFmt->IsInNodesArr() && (bChkTOX || - (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION - && TOX_HEADER_SECTION != eTmpType )) + ((eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION + && TOX_HEADER_SECTION != eTmpType ))) { const SwSection& rSect = *rFmts[ n ]->GetSection(); if( (!bChkReadOnly && !bChkHidden ) || diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 42f053e..e0df392 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -1748,8 +1748,8 @@ void lcl_FindStartEndCol( const SwLayoutFrm *&rpStart, (!pTmp->IsCellFrm() || ( ( ! bRTL && (pTmp->Frm().*fnRect->fnGetLeft)() < nSX && (pTmp->Frm().*fnRect->fnGetRight)()< nSX2 ) || - bRTL && (pTmp->Frm().*fnRect->fnGetLeft)() > nSX && - (pTmp->Frm().*fnRect->fnGetRight)()> nSX2 ) ) ) + (bRTL && (pTmp->Frm().*fnRect->fnGetLeft)() > nSX && + (pTmp->Frm().*fnRect->fnGetRight)()> nSX2) ) ) ) pTmp = pTmp->GetNextLayoutLeaf(); if ( pTmp ) diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index bad8ae5..c67d0c6 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -530,7 +530,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut ) if ( rL2.GetTab() != rL1.GetTab() || rL2.IsPainted() || rL2.IsLocked() || - bVert == rL2.Height() > rL2.Width() ) + bVert == (rL2.Height() > rL2.Width()) ) continue; long nL2a, nL2b, nL2c, nL2d; @@ -704,12 +704,12 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects ) if ( rLine.IsLocked () ) continue; - if ( !bVerticalSubs == rLine.Height() > rLine.Width() ) //gleiche Ausrichtung? + if ( !bVerticalSubs == (rLine.Height() > rLine.Width()) ) // same direction? continue; if ( aSubsRect.IsOver( rLine ) ) { - if ( bVerticalSubs ) //Vertikal? + if ( bVerticalSubs ) // Vertical? { if ( aSubsRect.Left() <= rLine.Right() && aSubsRect.Right() >= rLine.Left() ) @@ -949,7 +949,7 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut, SwLineRect &rLk = operator[](k); if ( rLi.SSize() == rLk.SSize() ) { - if ( bVerticalSubs == rLk.Height() > rLk.Width() ) + if ( bVerticalSubs == (rLk.Height() > rLk.Width()) ) { if ( bVerticalSubs ) { @@ -6305,7 +6305,7 @@ void SwLayoutFrm::PaintSubsidiaryLines( const SwPageFrm *pPage, void SwPageFrm::RefreshExtraData( const SwRect &rRect ) const { const SwLineNumberInfo &rInfo = GetFmt()->GetDoc()->GetLineNumberInfo(); - BOOL bLineInFly = rInfo.IsPaintLineNumbers() && rInfo.IsCountInFlys() + BOOL bLineInFly = (rInfo.IsPaintLineNumbers() && rInfo.IsCountInFlys()) || (sal_Int16)SW_MOD()->GetRedlineMarkPos() != text::HoriOrientation::NONE; SwRect aRect( rRect ); diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index fb99723..86e012f 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -580,10 +580,10 @@ const SwCntntFrm * MA_FASTCALL lcl_MissProtectedFrames( const SwCntntFrm *pCnt, while ( pCell && !pCell->IsCellFrm() ) pCell = pCell->GetUpper(); if ( !pCell || - ( ( bInReadOnly || !pCell->GetFmt()->GetProtect().IsCntntProtected() ) && + (( ( bInReadOnly || !pCell->GetFmt()->GetProtect().IsCntntProtected() ) && ( !bMissHeadline || !lcl_IsInRepeatedHeadline( pCell ) ) && ( !bMissFollowFlowLine || !pCell->IsInFollowFlowRow() ) ) && - !pCell->IsCoveredCell() ) + !pCell->IsCoveredCell()) ) bProtect = FALSE; else pCnt = (*fnNxtPrv)( pCnt ); @@ -702,14 +702,14 @@ BOOL MA_FASTCALL lcl_UpDown( SwPaM *pPam, const SwCntntFrm *pStart, const long nPrtLeft = bRTL ? (pTable->*fnRect->fnGetPrtRight)() : (pTable->*fnRect->fnGetPrtLeft)(); - if ( bRTL != nX < nPrtLeft ) + if ( bRTL != (nX < nPrtLeft) ) nX = nPrtLeft; else { const long nPrtRight = bRTL ? (pTable->*fnRect->fnGetPrtLeft)() : (pTable->*fnRect->fnGetPrtRight)(); - if ( bRTL != nX > nPrtRight ) + if ( bRTL != (nX > nPrtRight) ) nX = nPrtRight; } } diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index fe99a52..a367cc4 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -3126,7 +3126,7 @@ void SwLayoutFrm::ChgLowersProp( const Size& rOldSize ) // Finally adjust the columns if width is set to auto // Possible optimisation: execute this code earlier in this function and // return??? - if ( ( bVert && bHeightChgd || ! bVert && bWidthChgd ) && + if ( ( (bVert && bHeightChgd) || (!bVert && bWidthChgd) ) && Lower()->IsColumnFrm() ) { // get column attribute diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 373ed9c..03b97b1 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -145,7 +145,7 @@ public: // need to find the page ( and index ) for this control uno::Reference< drawing::XDrawPageSupplier > xSupplier( mpDocShell->GetModel(), uno::UNO_QUERY_THROW ); uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPage(), uno::UNO_QUERY_THROW ); - sal_Int32 nLen = xIndex->getCount(); + bool bMatched = false; uno::Sequence< script::ScriptEventDescriptor > aFakeEvents; try diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index ec5e26a..692fa4b 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -964,7 +964,7 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno:: throw beans::PropertyVetoException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) ); SwDoc* pDoc = pFmt->GetDoc(); - if ((eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID) || + if ( ((eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID)) || (FN_PARAM_COUNTOUR_PP == pEntry->nWID) || (FN_UNO_IS_AUTOMATIC_CONTOUR == pEntry->nWID) || (FN_UNO_IS_PIXEL_CONTOUR == pEntry->nWID) ) diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 8f58968..8dd1d5f 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1775,8 +1775,8 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, if( pCharStyleNames[i] != SwXNumberingRules::GetInvalidStyle() && ((pCharStyleNames[i].Len() && !pFmt->GetCharFmt()) || - pCharStyleNames[i].Len() && - pFmt->GetCharFmt()->GetName() != pCharStyleNames[i] )) + (pCharStyleNames[i].Len() && + pFmt->GetCharFmt()->GetName() != pCharStyleNames[i]) )) { SwCharFmt* pCharFmt = 0; @@ -1808,8 +1808,8 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, //jetzt nochmal fuer Fonts if(pBulletFontNames[i] != SwXNumberingRules::GetInvalidStyle() && ((pBulletFontNames[i].Len() && !pFmt->GetBulletFont()) || - pBulletFontNames[i].Len() && - pFmt->GetBulletFont()->GetName() != pBulletFontNames[i] )) + (pBulletFontNames[i].Len() && + pFmt->GetBulletFont()->GetName() != pBulletFontNames[i]) )) { const SvxFontListItem* pFontListItem = (const SvxFontListItem* )pDoc->GetDocShell() @@ -3440,8 +3440,8 @@ MakeObject: { const SwPageDesc& rDesc = aBase.GetOldPageDesc(); const SwFrmFmt* pFrmFmt = 0; - sal_Bool bShare = bHeader && rDesc.IsHeaderShared()|| - !bHeader && rDesc.IsFooterShared(); + sal_Bool bShare = (bHeader && rDesc.IsHeaderShared()) || + (!bHeader && rDesc.IsFooterShared()); // TextLeft returns the left content if there is one, // Text and TextRight return the master content. // TextRight does the same as Text and is for diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx index 8073ec4..e7c82df 100644 --- a/sw/source/filter/ascii/ascatr.cxx +++ b/sw/source/filter/ascii/ascatr.cxx @@ -206,8 +206,8 @@ static Writer& OutASC_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ) } while( nStrPos < nEnde ); if( !bLastNd || - ( !rWrt.bWriteClipboardDoc && !rWrt.bASCII_NoLastLineEnd ) - && !nStrPos && nEnde == nNodeEnde ) + (( !rWrt.bWriteClipboardDoc && !rWrt.bASCII_NoLastLineEnd ) + && !nStrPos && nEnde == nNodeEnde )) rWrt.Strm().WriteUnicodeOrByteText( ((SwASCWriter&)rWrt).GetLineEnd()); return rWrt; diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx index cfbb871..46a925a 100644 --- a/sw/source/filter/html/htmlctxt.cxx +++ b/sw/source/filter/html/htmlctxt.cxx @@ -193,7 +193,7 @@ void SwHTMLParser::SplitAttrTab( const SwPosition& rNewPos ) nOldEndCnt = pPam->GetPoint()->nContent.GetIndex(); } - if( RES_PARATR_BEGIN <= nWhich && bMoveBack || + if( (RES_PARATR_BEGIN <= nWhich && bMoveBack) || pAttr->GetSttParaIdx() < pOldEndPara->GetIndex() || (pAttr->GetSttPara() == *pOldEndPara && pAttr->GetSttCnt() != nOldEndCnt) ) diff --git a/sw/source/filter/html/parcss1.cxx b/sw/source/filter/html/parcss1.cxx index 4195cc1..8a94998 100644 --- a/sw/source/filter/html/parcss1.cxx +++ b/sw/source/filter/html/parcss1.cxx @@ -174,7 +174,7 @@ CSS1Token CSS1Parser::GetNextToken() } while( ('A' <= cNextCh && cNextCh <= 'Z') || ('a' <= cNextCh && cNextCh <= 'z') || ('0' <= cNextCh && cNextCh <= '9') || - '-'==cNextCh && !IsEOF() ); + ('-'==cNextCh && !IsEOF()) ); aToken += String(sTmpBuffer.makeStringAndClear()); @@ -272,7 +272,7 @@ CSS1Token CSS1Parser::GetNextToken() } while( ('A' <= cNextCh && cNextCh <= 'Z') || ('a' <= cNextCh && cNextCh <= 'z') || ('0' <= cNextCh && cNextCh <= '9') || - '-' == cNextCh && !IsEOF() ); + ('-' == cNextCh && !IsEOF()) ); aToken += String(sTmpBuffer.makeStringAndClear()); diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx index d508837..48263ca 100644 --- a/sw/source/ui/misc/glosdoc.cxx +++ b/sw/source/ui/misc/glosdoc.cxx @@ -498,7 +498,7 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull) aDirArr.DeleteAndDestroy(0, aDirArr.Count()); if(!nTokenCount || - m_sErrPath.Len() && (bPathChanged || m_sOldErrPath != m_sErrPath) ) + (m_sErrPath.Len() && (bPathChanged || m_sOldErrPath != m_sErrPath)) ) { m_sOldErrPath = m_sErrPath; // Falscher Pfad, d.h. AutoText-Verzeichnis existiert nicht diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index 26932fc..ed6ad49 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -549,8 +549,8 @@ void SwOutlineSettingsTabPage::Update() bSameSuffix &= aNumFmtArr[i]->GetSuffix() == aNumFmtArr[0]->GetSuffix(); bSameComplete &= aNumFmtArr[i]->GetIncludeUpperLevels() == aNumFmtArr[0]->GetIncludeUpperLevels(); const SwCharFmt* pFmt = aNumFmtArr[i]->GetCharFmt(); - bSameCharFmt &= !pFirstFmt && !pFmt - || pFirstFmt && pFmt && pFmt->GetName() == pFirstFmt->GetName(); + bSameCharFmt &= (!pFirstFmt && !pFmt) + || (pFirstFmt && pFmt && pFmt->GetName() == pFirstFmt->GetName()); } } CheckForStartValue_Impl(aNumFmtArr[0]->GetNumberingType()); diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx index 91caa65..95c8265 100644 --- a/sw/source/ui/misc/pggrid.cxx +++ b/sw/source/ui/misc/pggrid.cxx @@ -455,7 +455,6 @@ IMPL_LINK(SwTextGridPage, TextSizeChangedHdl, SpinField*, pField) { if (&aTextSizeMF == pField) { - sal_Int32 nTextSize = static_cast< sal_Int32 >(aTextSizeMF.Denormalize(aTextSizeMF.GetValue(FUNIT_TWIP))); m_bRubyUserValue = sal_False; } //set maximum line per page diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index 92e8103..9c9719d 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -923,7 +923,7 @@ void SwTextShell::StateInsert( SfxItemSet &rSet ) } break; case FN_INSERT_HRULER : - if(rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel() || bCrsrInHidden ) + if ( (rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel()) || bCrsrInHidden ) rSet.DisableItem(nWhich); break; case FN_FORMAT_COLUMN : diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx index 9455945..4cb9cb0 100644 --- a/sw/source/ui/shells/textsh1.cxx +++ b/sw/source/ui/shells/textsh1.cxx @@ -1748,8 +1748,8 @@ void SwTextShell::ChangeHeaderOrFooter( String sTmp(aDesc.GetName()); if( !rStyleName.Len() || rStyleName == sTmp ) { - if( bShowWarning && !bOn && GetActiveView() && GetActiveView() == &GetView() && - (bHeader && aDesc.GetMaster().GetHeader().IsActive()) || + if( (bShowWarning && !bOn && GetActiveView() && GetActiveView() == &GetView() && + (bHeader && aDesc.GetMaster().GetHeader().IsActive())) || (!bHeader && aDesc.GetMaster().GetFooter().IsActive())) { bShowWarning = FALSE; diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx index 71571fd..498ed63 100644 --- a/sw/source/ui/shells/txtattr.cxx +++ b/sw/source/ui/shells/txtattr.cxx @@ -108,8 +108,8 @@ void SwTextShell::ExecCharAttr(SfxRequest &rReq) eEscape = nWhich == FN_SET_SUPER_SCRIPT ? SVX_ESCAPEMENT_SUPERSCRIPT: SVX_ESCAPEMENT_SUBSCRIPT; - if( nWhich == FN_SET_SUB_SCRIPT && nTmpEsc < 0 || - nWhich == FN_SET_SUPER_SCRIPT && nTmpEsc > 0 ) + if( (nWhich == FN_SET_SUB_SCRIPT && nTmpEsc < 0) || + (nWhich == FN_SET_SUPER_SCRIPT && nTmpEsc > 0) ) eEscape = SVX_ESCAPEMENT_OFF; SfxBindings& rBind = GetView().GetViewFrame()->GetBindings(); diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx index 0099a98..14d704d 100644 --- a/sw/source/ui/utlui/content.cxx +++ b/sw/source/ui/utlui/content.cxx @@ -1545,7 +1545,6 @@ void SwContentTree::Display( sal_Bool bActive ) if(nRootType != CONTENT_TYPE_OUTLINE) { - SvLBoxEntry* pEntry; for(sal_uInt16 i = 0; i < (*ppRootContentT)->GetMemberCount(); i++ ) { const SwContent* pCnt = (*ppRootContentT)->GetMember(i); @@ -2138,7 +2137,7 @@ void SwContentTree::ExecCommand(sal_uInt16 nCmd, sal_Bool bModifier) SvLBoxEntry* pFirstEntry = FirstSelected(); if (pFirstEntry && lcl_IsContent(pFirstEntry)) { - if(bIsRoot && nRootType == CONTENT_TYPE_OUTLINE || + if ( (bIsRoot && nRootType == CONTENT_TYPE_OUTLINE) || ((SwContent*)pFirstEntry->GetUserData())->GetParent()->GetType() == CONTENT_TYPE_OUTLINE) { @@ -2156,8 +2155,8 @@ void SwContentTree::ExecCommand(sal_uInt16 nCmd, sal_Bool bModifier) if( nMove ) { short nDir = nCmd == FN_ITEM_UP ? -1 : 1; - if( !bModifier && (nDir == -1 && nActPos > 0 || - nDir == 1 && nActPos < GetEntryCount() - 2 ) ) + if( !bModifier && ( (nDir == -1 && nActPos > 0) || + (nDir == 1 && nActPos < GetEntryCount() - 2) ) ) { pShell->MoveOutlinePara( nDir ); //Cursor wieder an die aktuelle Position setzen @@ -2787,8 +2786,8 @@ sal_Bool SwContentTree::Select( SvLBoxEntry* pEntry, sal_Bool bSelect ) pParentEntry = GetParent(pParentEntry); } if(!bIsLastReadOnly && (!IsVisible() || - (bIsRoot && nRootType == CONTENT_TYPE_OUTLINE && pParentEntry || - lcl_IsContent(pEntry) && ((SwContentType*)pParentEntry->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE))) + ( (bIsRoot && nRootType == CONTENT_TYPE_OUTLINE && pParentEntry) || + (lcl_IsContent(pEntry) && ((SwContentType*)pParentEntry->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE)) )) bEnable = sal_True; SwNavigationPI* pNavi = GetParentWindow(); pNavi->aContentToolBox.EnableItem(FN_ITEM_UP , bEnable); -- 1.7.1
_______________________________________________ LibreOffice mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice
