Cppcheck reports an 2 assignments which isn't used in drawinglayer module

Caolán McNamara caolanm at redhat.com
Fri Feb 22 05:50:54 PST 2013


On Fri, 2012-12-28 at 09:28 -0800, julien2412 wrote:
> Hello,
> 
> Cppcheck reported these:
> [drawinglayer/source/primitive2d/sceneprimitive2d.cxx:196]: (style) Variable
> 'fViewSizeX' is assigned a value that is never used.
> [drawinglayer/source/primitive2d/sceneprimitive2d.cxx:197]: (style) Variable
> 'fViewSizeY' is assigned a value that is never used.
...

> Indeed, fViewSizeX and fViewSizeY. this time I don't think they should be
> removed, I rather think something is lacking.
> 
> Any idea?

So taking fViewSizeX lets have a look at what the history of these lines
is.

git log --follow -S fViewSizeX
drawinglayer/source/primitive2d/sceneprimitive2d.cxx

gives....

commit 2a0a3168f4354285e59dd79d4477a4199c2f773b
Author: Armin Weiss <aw at openoffice.org>
Date:   Tue Oct 20 15:36:32 2009 +0000

    #i105065# speedup 3D/FontWork

commit 407f7ae14844d0e55b9f0f87a19a7208762b05ed
Author: Armin Le Grand <Armin.Le.Grand at Sun.COM>
Date:   Wed Oct 7 14:25:40 2009 +0200

    #i105323# added FastPath for 3D scene HitTest for 3d CustomShapes by
re-using the buffered last render result 

commit 2d634e6084547875a170d8350850110238b9e55c
Author: Armin Le Grand <Armin.Le.Grand at Sun.COM>
Date:   Tue Sep 29 15:35:35 2009 +0200

    #i105323# speedup of 3D handling mostly for CustomShapes; HitTest
and interactions optimized

commit 57cc1366165559c8a958486c12af08790e6995f9
Author: Armin Weiss <aw at openoffice.org>
Date:   Tue Feb 26 07:28:52 2008 +0000

    removals, OLE, optimizations for primitives

commit 821e3b2b3026f21e396a8da3e152781a546ef5f5
Author: Armin Weiss <aw at openoffice.org>
Date:   Thu Oct 19 09:40:02 2006 +0000

    #i39532# primitive

To see what the file actually looked like at a given revision...

git show
57cc1366165559c8a958486c12af08790e6995f9:drawinglayer/source/primitive2d/sceneprimitive2d.cxx

git show
821e3b2b3026f21e396a8da3e152781a546ef5f5:drawinglayer/source/primitive2d/sceneprimitive2d.cxx

So looking through those fViewSizeX became assigned a value that is
never used with 57cc1366165559c8a958486c12af08790e6995f9 and every other
commit just moved it around or adapted it to later changes. Seeing as
this commit happened in 2008 and the rest of that commit looks
reasonable I think you should go ahead and remove those never used
variables.

C.



More information about the LibreOffice mailing list