Kaydet (Commit) eddee22b authored tarafından Mike Kaganski's avatar Mike Kaganski

tdf#120703 PVS: V560 A part of conditional expression is always true/false

Change-Id: Id7af9a6eaefc8b49a790eb299620c4fa97067a11
Reviewed-on: https://gerrit.libreoffice.org/64429
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 6ed52ecf
......@@ -1838,7 +1838,7 @@ svx::SpellPortions SentenceEditWindow_Impl::CreateSpellPortions() const
++aCursor.GetIndex();
}
if(nTextLen && aBreakPositions.empty())
if (aBreakPositions.empty())
{
//if all content has been overwritten the attributes may have been removed, too
svx::SpellPortion aPortion1;
......
......@@ -159,8 +159,8 @@ SvxSpellWrapper::SvxSpellWrapper( vcl::Window* pWn,
bOtherCntnt ( bOther ),
bHyphen ( false ),
bReverse ( false ),
bStartDone ( bOther || ( !bReverse && bStart ) ),
bEndDone ( bReverse && bStart && !bOther ),
bStartDone ( bOther || bStart ),
bEndDone ( false ),
bStartChk ( bOther ),
bRevAllowed ( false ),
bAllRight ( true )
......
......@@ -345,7 +345,7 @@ OUString SubstitutePathVariables::impl_substituteVariable( const OUString& rText
// Is there something to replace ?
bool bWorkRetrieved = false;
bool bWorkDirURLRetrieved = false;
while ( !bSubstitutionCompleted && nDepth < nMaxRecursiveDepth )
while (nDepth < nMaxRecursiveDepth)
{
while ( ( nPosition != -1 ) && ( nLength > 3 ) ) // "$(" ")"
{
......
......@@ -148,7 +148,7 @@ SdStyleSheet* SdStyleFamily::GetSheetByName( const OUString& rName )
{
// we assume that we have only SdStyleSheets
SdStyleSheet* pSdStyle = static_cast< SdStyleSheet* >( pStyle );
if( pSdStyle && pSdStyle->GetApiName() == rName)
if (pSdStyle->GetApiName() == rName)
{
pRet = pSdStyle;
break;
......
......@@ -259,7 +259,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
sal_Int32 nLevelCount = xLevel->getCount();
if(nLevelCount > 5)
nLevelCount = 5;
for( sal_Int32 i = 0; i < nLevelCount && i < 5; i++)
for( sal_Int32 i = 0; i < nLevelCount; i++)
{
long nTop = nStartY + nRectHeight * (aLinesArr[2 * i + 11])/100 ;
Point aLeft(nStartX + nRectWidth * (aLinesArr[2 * i + 10])/ 100, nTop );
......@@ -634,7 +634,7 @@ void NumValueSet::UserDraw( const UserDrawEvent& rUDEvt )
sal_Int32 nLevelCount = xLevel->getCount();
if(nLevelCount > 5)
nLevelCount = 5;
for( sal_Int32 i = 0; i < nLevelCount && i < 5; i++)
for( sal_Int32 i = 0; i < nLevelCount; i++)
{
long nTop = nStartY + nRectHeight * (aLinesArr[2 * i + 11])/100 ;
Point aLeft(nStartX + nRectWidth * (aLinesArr[2 * i + 10])/ 100, nTop );
......
......@@ -384,7 +384,7 @@ bool SdrEditView::IsMirrorAllowed(bool b45Deg, bool b90Deg) const
if (m_bMoveProtect) return false;
if (b90Deg) return m_bMirror90Allowed;
if (b45Deg) return m_bMirror45Allowed;
return m_bMirrorFreeAllowed && !m_bMoveProtect;
return m_bMirrorFreeAllowed;
}
bool SdrEditView::IsTransparenceAllowed() const
......
......@@ -1476,7 +1476,8 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
pTEObj->EndTextEdit(*pTEOutliner);
if( (pTEObj->GetRotateAngle() != 0) || (pTEObj && dynamic_cast<const SdrTextObj*>( pTEObj) != nullptr && pTEObj->IsFontwork()) )
if ((pTEObj->GetRotateAngle() != 0)
|| (dynamic_cast<const SdrTextObj*>(pTEObj) != nullptr && pTEObj->IsFontwork()))
{
pTEObj->ActionChanged();
}
......@@ -1492,7 +1493,7 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally)
// check deletion of entire TextObj
std::unique_ptr<SdrUndoAction> pDelUndo;
bool bDelObj=false;
if (pTEObj!=nullptr && bTextEditNewObj)
if (bTextEditNewObj)
{
bDelObj=pTEObj->IsTextFrame() &&
!pTEObj->HasText() &&
......@@ -1702,7 +1703,8 @@ bool SdrObjEditView::IsTextEditFrameHit(const Point& rHit) const
if( pOLV )
{
vcl::Window* pWin=pOLV->GetWindow();
if (pText!=nullptr && pText->IsTextFrame() && pOLV!=nullptr && pWin!=nullptr) {
if (pText != nullptr && pText->IsTextFrame() && pWin != nullptr)
{
sal_uInt16 nPixSiz=pOLV->GetInvalidateMore();
tools::Rectangle aEditArea(aMinTextEditArea);
aEditArea.Union(pOLV->GetOutputArea());
......
......@@ -650,7 +650,6 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
if(nullptr != mpMarkedObj)
{
bSingleTextObjMark =
mpMarkedObj &&
dynamic_cast<const SdrTextObj*>( mpMarkedObj) != nullptr &&
static_cast<SdrTextObj*>(mpMarkedObj)->IsTextFrame();
......
......@@ -370,7 +370,7 @@ GraphicAttr SdrGrafObj::GetGraphicAttr( SdrGrafObjTransformsAttrs nTransformFlag
{
const bool bMirror = bool( nTransformFlags & SdrGrafObjTransformsAttrs::MIRROR );
const bool bRotate = bool( nTransformFlags & SdrGrafObjTransformsAttrs::ROTATE ) &&
( aGeo.nRotationAngle && aGeo.nRotationAngle != 18000 ) && ( GraphicType::NONE != eType );
(aGeo.nRotationAngle && aGeo.nRotationAngle != 18000);
// Need cropping info earlier
const_cast<SdrGrafObj*>(this)->ImpSetAttrToGrafInfo();
......
......@@ -244,7 +244,7 @@ void SdrMeasureObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
rInfo.bCanConvToPoly =true;
rInfo.bCanConvToPathLineToArea=false;
rInfo.bCanConvToPolyLineToArea=false;
rInfo.bCanConvToContour = (rInfo.bCanConvToPoly || LineGeometryUsageIsNecessary());
rInfo.bCanConvToContour = LineGeometryUsageIsNecessary();
}
sal_uInt16 SdrMeasureObj::GetObjIdentifier() const
......
......@@ -584,7 +584,7 @@ void SdrTableObjImpl::DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset
const OUString sSize( "Size" );
if( mbHorizontal )
{
if( (nEdge >= 0) && (nEdge <= getRowCount()) )
if (nEdge <= getRowCount())
{
sal_Int32 nHeight = mpLayouter->getRowHeight( (!nEdge)?nEdge:(nEdge-1) );
if(nEdge==0)
......@@ -606,7 +606,7 @@ void SdrTableObjImpl::DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset
In LTR table dragging of edge 0(for RTL table edge N) does nothing.
*/
//Todo: Implement Dragging functionality for leftmost edge of table.
if( (nEdge >= 0) && (nEdge <= getColumnCount()) )
if (nEdge <= getColumnCount())
{
const bool bRTL = mpTableObj != nullptr && (mpTableObj->GetWritingMode() == WritingMode_RL_TB);
sal_Int32 nWidth;
......@@ -633,18 +633,14 @@ void SdrTableObjImpl::DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset
/* To prevent the table resizing on edge dragging */
if( nEdge > 0 && nEdge < mxTable->getColumnCount() )
{
if( bRTL )
nEdge--;
if( (bRTL && (nEdge >= 0)) || (!bRTL && (nEdge < mxTable->getColumnCount())) )
{
nWidth = mpLayouter->getColumnWidth( nEdge );
nWidth = std::max( static_cast<sal_Int32>(nWidth - nOffset), sal_Int32(0) );
nWidth = mpLayouter->getColumnWidth(nEdge);
nWidth = std::max(static_cast<sal_Int32>(nWidth - nOffset), sal_Int32(0));
Reference< XPropertySet > xColSet( xCols->getByIndex( nEdge ), UNO_QUERY_THROW );
xColSet->setPropertyValue( sSize, Any( nWidth ) );
}
Reference<XPropertySet> xColSet(xCols->getByIndex(nEdge), UNO_QUERY_THROW);
xColSet->setPropertyValue(sSize, Any(nWidth));
}
}
}
......@@ -1999,8 +1995,8 @@ void SdrTableObj::NbcReformatText()
bool SdrTableObj::IsVerticalWriting() const
{
const SvxWritingModeItem* pModeItem = &GetObjectItem( SDRATTR_TEXTDIRECTION );
return pModeItem && pModeItem->GetValue() == css::text::WritingMode_TB_RL;
const SvxWritingModeItem& rModeItem = GetObjectItem( SDRATTR_TEXTDIRECTION );
return rModeItem.GetValue() == css::text::WritingMode_TB_RL;
}
......
......@@ -173,7 +173,7 @@ static void lcl_CallModify( SwGrfNode& rGrfNd, SfxPoolItem& rItem )
if ( !bUpdate || bFrameInPaint )
return SUCCESS;
if (bUpdate && pSwGrfNode)
if (pSwGrfNode)
{
if (!SetGrfFlySize(aGrfSz, pSwGrfNode, aOldSz))
{
......@@ -236,11 +236,8 @@ static bool SetGrfFlySize( const Size& rGrfSz, SwGrfNode* pGrfNd, const Size& rO
// the table rows
const SwDoc *pDoc = pGrfNd->GetDoc();
const SwPosition* pAPos = pFormat->GetAnchor().GetContentAnchor();
SwNode *pANd;
SwTableNode *pTableNd;
if( pAPos &&
nullptr != (pANd = & pAPos->nNode.GetNode()) &&
nullptr != (pTableNd = pANd->FindTableNode()) )
if (pAPos && nullptr != (pTableNd = pAPos->nNode.GetNode().FindTableNode()))
{
const bool bLastGrf = !pTableNd->GetTable().DecGrfsThatResize();
SwHTMLTableLayout *pLayout =
......
......@@ -3327,7 +3327,7 @@ bool SwTransferable::PrivatePaste( SwWrtShell& rShell )
if( bSmart )
{
bSttWrd = rShell.IsStartWord();
if( bSmart && !bSttWrd && (bInWrd || bEndWrd) )
if (!bSttWrd && (bInWrd || bEndWrd))
rShell.SwEditShell::Insert(' ');
}
}
......
......@@ -1872,9 +1872,6 @@ void* SvMemoryStream::SwitchBuffer()
nResize = 64;
nPos = 0;
if( nResize != 0 && nResize < 16 )
nResize = 16;
ResetError();
std::size_t nInitSize = 512;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment