Author: truckman Date: Thu Sep 1 22:08:51 2016 New Revision: 1758862 URL: http://svn.apache.org/viewvc?rev=1758862&view=rev Log: Fix by far the largest source of -Wtautological-undefined-compare compile warnings.
The class definition for SdrMarkView in svx/inc/svx/svdmrkv.hxx contains two inline methods that take a reference argument and perform an &rArg == NULL test on it. The compiler warns that this condition should always be false because dereferencing a NULL pointer to generate a reference is not valid in C++ and a valid reference will never be at address 0. Warnings are generated every time this header is included in a .cxx file. It turns out that there are no callers for the IsGluePoint() method, so just comment out its definition. It also turns out that all the callers of IsPointMarked() pass it a dereferenced pointer, so convert IsPointMarked() to take a pointer argument and modify all the callers to pass a pointer without dereferencing it first. Modified: openoffice/trunk/main/sc/source/ui/drawfunc/fudraw.cxx openoffice/trunk/main/sc/source/ui/drawfunc/futext.cxx openoffice/trunk/main/sd/source/ui/animations/motionpathtag.cxx openoffice/trunk/main/sd/source/ui/func/fupoor.cxx openoffice/trunk/main/sd/source/ui/func/fusel.cxx openoffice/trunk/main/svx/inc/svx/svdmrkv.hxx openoffice/trunk/main/svx/source/dialog/graphctl.cxx openoffice/trunk/main/sw/source/ui/ribbar/drawbase.cxx Modified: openoffice/trunk/main/sc/source/ui/drawfunc/fudraw.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/drawfunc/fudraw.cxx?rev=1758862&r1=1758861&r2=1758862&view=diff ============================================================================== --- openoffice/trunk/main/sc/source/ui/drawfunc/fudraw.cxx (original) +++ openoffice/trunk/main/sc/source/ui/drawfunc/fudraw.cxx Thu Sep 1 22:08:51 2016 @@ -637,7 +637,7 @@ sal_Bool __EXPORT FuDraw::KeyInput(const sal_uInt32 nPol(pHdl->GetPolyNum()); sal_uInt32 nPnt(pHdl->GetPointNum()); - if(pView->IsPointMarked(*pHdl)) + if(pView->IsPointMarked(pHdl)) { if(rKEvt.GetKeyCode().IsShift()) { Modified: openoffice/trunk/main/sc/source/ui/drawfunc/futext.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sc/source/ui/drawfunc/futext.cxx?rev=1758862&r1=1758861&r2=1758862&view=diff ============================================================================== --- openoffice/trunk/main/sc/source/ui/drawfunc/futext.cxx (original) +++ openoffice/trunk/main/sc/source/ui/drawfunc/futext.cxx Thu Sep 1 22:08:51 2016 @@ -163,7 +163,7 @@ sal_Bool __EXPORT FuText::MouseButtonDow { if (pView->HasMarkablePoints() && pView->IsPointMarkable(*pHdl)) { - sal_Bool bPointMarked=pView->IsPointMarked(*pHdl); + sal_Bool bPointMarked=pView->IsPointMarked(pHdl); if ( rMEvt.IsShift() ) { Modified: openoffice/trunk/main/sd/source/ui/animations/motionpathtag.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/animations/motionpathtag.cxx?rev=1758862&r1=1758861&r2=1758862&view=diff ============================================================================== --- openoffice/trunk/main/sd/source/ui/animations/motionpathtag.cxx (original) +++ openoffice/trunk/main/sd/source/ui/animations/motionpathtag.cxx Thu Sep 1 22:08:51 2016 @@ -552,7 +552,7 @@ bool MotionPathTag::MouseButtonDown( con else { SmartHdl* pHdl = &rHdl; - if (!mrView.IsPointMarked(*pHdl) || rMEvt.IsShift()) + if (!mrView.IsPointMarked(pHdl) || rMEvt.IsShift()) { if (!rMEvt.IsShift()) { @@ -561,7 +561,7 @@ bool MotionPathTag::MouseButtonDown( con } else { - if (mrView.IsPointMarked(*pHdl) ) + if (mrView.IsPointMarked(pHdl) ) { mrView.UnmarkPoint(*pHdl); pHdl = NULL; @@ -698,7 +698,7 @@ bool MotionPathTag::OnMarkHandle( const sal_uInt32 nPol(pHdl->GetPolyNum()); sal_uInt32 nPnt(pHdl->GetPointNum()); - if(mrView.IsPointMarked(*pHdl)) + if(mrView.IsPointMarked(pHdl)) { if(rKEvt.GetKeyCode().IsShift()) { Modified: openoffice/trunk/main/sd/source/ui/func/fupoor.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/func/fupoor.cxx?rev=1758862&r1=1758861&r2=1758862&view=diff ============================================================================== --- openoffice/trunk/main/sd/source/ui/func/fupoor.cxx (original) +++ openoffice/trunk/main/sd/source/ui/func/fupoor.cxx Thu Sep 1 22:08:51 2016 @@ -596,7 +596,7 @@ sal_Bool FuPoor::KeyInput(const KeyEvent sal_uInt32 nPol(pHdl->GetPolyNum()); sal_uInt32 nPnt(pHdl->GetPointNum()); - if(mpView->IsPointMarked(*pHdl)) + if(mpView->IsPointMarked(pHdl)) { if(rKEvt.GetKeyCode().IsShift()) { Modified: openoffice/trunk/main/sd/source/ui/func/fusel.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/func/fusel.cxx?rev=1758862&r1=1758861&r2=1758862&view=diff ============================================================================== --- openoffice/trunk/main/sd/source/ui/func/fusel.cxx (original) +++ openoffice/trunk/main/sd/source/ui/func/fusel.cxx Thu Sep 1 22:08:51 2016 @@ -497,7 +497,7 @@ sal_Bool FuSelection::MouseButtonDown(co /****************************************************************** * Klebepunkt selektieren ******************************************************************/ - if (!mpView->IsPointMarked(*aVEvt.pHdl) || rMEvt.IsShift()) + if (!mpView->IsPointMarked(aVEvt.pHdl) || rMEvt.IsShift()) { if (!rMEvt.IsShift()) { @@ -506,7 +506,7 @@ sal_Bool FuSelection::MouseButtonDown(co } else { - if (mpView->IsPointMarked(*aVEvt.pHdl)) + if (mpView->IsPointMarked(aVEvt.pHdl)) { mpView->UnmarkPoint(*aVEvt.pHdl); pHdl = NULL; Modified: openoffice/trunk/main/svx/inc/svx/svdmrkv.hxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/inc/svx/svdmrkv.hxx?rev=1758862&r1=1758861&r2=1758862&view=diff ============================================================================== --- openoffice/trunk/main/svx/inc/svx/svdmrkv.hxx (original) +++ openoffice/trunk/main/svx/inc/svx/svdmrkv.hxx Thu Sep 1 22:08:51 2016 @@ -368,7 +368,7 @@ public: sal_Bool MarkPoints(const Rectangle& rRect, sal_Bool bUnmark=sal_False) { return MarkPoints(&rRect,bUnmark); } sal_Bool UnmarkPoint(SdrHdl& rHdl) { return MarkPoint(rHdl,sal_True); } sal_Bool UnMarkPoint(SdrHdl& rHdl) { return MarkPoint(rHdl,sal_True); } - sal_Bool IsPointMarked(const SdrHdl& rHdl) const { ForceUndirtyMrkPnt(); return &rHdl!=NULL && rHdl.IsSelected(); } + sal_Bool IsPointMarked(const SdrHdl* pHdl) const { ForceUndirtyMrkPnt(); return pHdl!=NULL && pHdl->IsSelected(); } sal_Bool MarkAllPoints() { return MarkPoints(NULL,sal_False); } sal_Bool UnmarkAllPoints() { return MarkPoints(NULL,sal_True); } sal_Bool UnMarkAllPoints() { return MarkPoints(NULL,sal_True); } @@ -437,7 +437,7 @@ public: // Hdl eines markierten GluePoints holen. Nicht markierte // GluePoints haben keine Handles SdrHdl* GetGluePointHdl(const SdrObject* pObj, sal_uInt16 nId) const; - sal_Bool IsGluePoint(const SdrHdl& rHdl) const { return &rHdl!=NULL && rHdl.GetKind()==HDL_GLUE; } + // sal_Bool IsGluePoint(const SdrHdl& rHdl) const { return &rHdl!=NULL && rHdl.GetKind()==HDL_GLUE; } // alle Punkte innerhalb dieses Rechtecks markieren (Viewkoordinaten) sal_Bool MarkGluePoints(const Rectangle& rRect) { return MarkGluePoints(&rRect,sal_False); } Modified: openoffice/trunk/main/svx/source/dialog/graphctl.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/dialog/graphctl.cxx?rev=1758862&r1=1758861&r2=1758862&view=diff ============================================================================== --- openoffice/trunk/main/svx/source/dialog/graphctl.cxx (original) +++ openoffice/trunk/main/svx/source/dialog/graphctl.cxx Thu Sep 1 22:08:51 2016 @@ -651,7 +651,7 @@ void GraphCtrl::KeyInput( const KeyEvent sal_uInt32 nPol(pHdl->GetPolyNum()); sal_uInt32 nPnt(pHdl->GetPointNum()); - if(pView->IsPointMarked(*pHdl)) + if(pView->IsPointMarked(pHdl)) { if(rKEvt.GetKeyCode().IsShift()) { Modified: openoffice/trunk/main/sw/source/ui/ribbar/drawbase.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/ui/ribbar/drawbase.cxx?rev=1758862&r1=1758861&r2=1758862&view=diff ============================================================================== --- openoffice/trunk/main/sw/source/ui/ribbar/drawbase.cxx (original) +++ openoffice/trunk/main/sw/source/ui/ribbar/drawbase.cxx Thu Sep 1 22:08:51 2016 @@ -182,7 +182,7 @@ sal_Bool SwDrawBase::MouseButtonDown(con /****************************************************************** * Klebepunkt selektieren ******************************************************************/ - if (pSdrView->HasMarkablePoints() && (!pSdrView->IsPointMarked(*aVEvt.pHdl) || rMEvt.IsShift())) + if (pSdrView->HasMarkablePoints() && (!pSdrView->IsPointMarked(aVEvt.pHdl) || rMEvt.IsShift())) { SdrHdl* pHdl = NULL; @@ -193,7 +193,7 @@ sal_Bool SwDrawBase::MouseButtonDown(con } else { - if (pSdrView->IsPointMarked(*aVEvt.pHdl)) + if (pSdrView->IsPointMarked(aVEvt.pHdl)) { bReturn = pSdrView->UnmarkPoint(*aVEvt.pHdl); pHdl = NULL;