[Libreoffice] Suspicious warning fixes

Regina Henschel rb.henschel at t-online.de
Tue Sep 20 14:28:44 PDT 2011


Hi Stephan,

Stephan Bergmann schrieb:
> Regina,
>
> The below two commits fix warnings from code changed through a recent
> commit by you, and in both cases I am a little unsure whether my fix is
> good (see inline below).

I'm coding only in my spare time and have no deep insight into the code, 
so it is likely I'm more unsure than you.

>
> On 09/20/2011 08:51 PM, Stephan Bergmann wrote:
>> chart2/source/view/main/ShapeFactory.cxx | 1
>> cui/source/tabpages/tpline.cxx | 4
> [...]
>> New commits:
>> commit ae8102f1e38c4da840f8343bbbd628f1c660c132
>> Author: Stephan Bergmann<sbergman at redhat.com>
>> Date: Tue Sep 20 20:13:02 2011 +0200
>>
>> Removed pPageView made unused by previous changeset 3e5edf6c.
>>
>> diff --git a/cui/source/tabpages/tpline.cxx
>> b/cui/source/tabpages/tpline.cxx
>> index b6825b9..ac170a2 100644
>> --- a/cui/source/tabpages/tpline.cxx
>> +++ b/cui/source/tabpages/tpline.cxx
>> @@ -898,7 +898,7 @@ void SvxLineTabPage::Reset( const SfxItemSet&
>> rAttrs )
>> pModel->InsertPage( pPage, 0 );
>> SdrView* pView = new SdrView( pModel,&aVDev );
>> pView->hideMarkHandles();
>> - SdrPageView* pPageView = pView->ShowSdrPage(pPage);
>> + pView->ShowSdrPage(pPage);
>> SdrObject *pObj=NULL;
>> long nSymTmp=nSymType;
>> if(pSymbolList)
>> @@ -1545,7 +1545,7 @@ IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl,
>> MenuButton *, pButton )
>> // 3D View
>> SdrView* pView = new SdrView( pModel,&aVDev );
>> pView->hideMarkHandles();
>> - SdrPageView* pPageView = pView->ShowSdrPage(pPage);
>> + pView->ShowSdrPage(pPage);
>
> I assume those ShowSdrPage calls have side effects, so should indeed be
> left in, right?

I have not written that 'SdrPageView* pPageView' lines; they have been 
there already.
The pointer pPageView was needed because marking a single object needs 
the call MarkObj(pObj, pPageView). I have changed it to MarkAll(), which 
does not need this parameters. So I think, you are right and it is OK to 
not declare pPageView.
I guess the part pView->ShowSdrPage(pPage) is needed. The German comment 
in svdview.hxx says "Seiten werden an- und abgemeldet mit 
ShowSdrPage()/HideSdrPage(). Fuer jede angemeldete Seite wird eine 
SdrPageView-Instanz im Container aPages angelegt." But I don't know when 
this container is really used. pModel, pPage, and pView are only created 
temporally to get a graphic for the marker polygon.

>
>>
>> PopupMenu* pPopup = new PopupMenu;
>> String aEmptyStr;
>> commit 122b729a5a974179265b6d7a8c1c92199262b76a
>> Author: Stephan Bergmann<sbergman at redhat.com>
>> Date: Tue Sep 20 20:06:39 2011 +0200
>>
>> Removed unused fMaxSize introduced by previous changeset 3e5edf6c.
>>
>> diff --git a/chart2/source/view/main/ShapeFactory.cxx
>> b/chart2/source/view/main/ShapeFactory.cxx
>> index dc06eba..c2626ca 100644
>> --- a/chart2/source/view/main/ShapeFactory.cxx
>> +++ b/chart2/source/view/main/ShapeFactory.cxx
>> @@ -1293,7 +1293,6 @@ drawing::PolyPolygonShape3D
>> createPolyPolygon_Symbol( const drawing::Position3D&
>> const double fWidthH = rSize.DirectionX/2.0; //fWidthH stands for Half
>> Width
>> const double fHeightH = rSize.DirectionY/2.0; //fHeightH stands for
>> Half Height
>>
>> - double fMaxSize = fHeightH> fWidthH ? fHeightH : fWidthH; //assumes
>> non negative
>
> fMaxSize was freshly introduced but not used -- was it a mistake to add
> it, or is the mistake rather that the place that should use it is missing?

You are right. It is not needed. I missed to delete it, when I changed 
my solution to handle height and width separate. Sorry.

Kind regards
Regina


More information about the LibreOffice mailing list