[scribus-dev] Can please someone teach me how to fix the current compiler/build warnings

Franz Schmid Franz.Schmid at altmuehlnet.de
Sun Dec 13 08:36:42 UTC 2015


Am 13.12.2015 um 02:10 schrieb William Bader:
> https://travis-ci.org/scribusproject/scribus/jobs/95496650#L2421-L2428
>
> /home/travis/build/scribusproject/scribus/scribus/plugins/import/revenge/rawpainter.cpp:
> In member function virtual void RawPainter::setStyle(const
> WPXPropertyList&, const WPXPropertyListVector&):
>
> /home/travis/build/scribusproject/scribus/scribus/plugins/import/revenge/rawpainter.cpp:2335:10:
> warning: variable angle�set but not used [-Wunused-but-set-variable]
>
>     double angle = 0;
>
>
>
> The variable angle is set to propList["draw:angle"]->getDouble() and
> then never used.
>
> The choices are
>
> * remove the declaration and the assignment (maybe the code was left
> over from a cut-and-paste from another block of code)
>
> * check that this is not something that might be needed in the future.
> Maybe "angle" should be in RawPainter in plugins/import/revenge/rawpainter.h
>
> * check that this is not the wrong name. Maybe "angle" should be
> "gradientAngle".
>
>
>
> https://travis-ci.org/scribusproject/scribus/jobs/95496650#L2421-L2428
>
> /home/travis/build/scribusproject/scribus/scribus/plugins/import/revenge/rawpainter.cpp:
> In member function ‘virtual void RawPainter::drawGraphicObject(const
> WPXPropertyList&, const WPXBinaryData&)’:
>
> /home/travis/build/scribusproject/scribus/scribus/plugins/import/revenge/rawpainter.cpp:2953:20:
> warning: ‘ite’ may be used uninitialized in this function
> [-Wmaybe-uninitialized]
>
>      applyShadow(ite);
>
>
>
> I would initialize ite = NULL in the declaration at line 2848.
>
> Then at the calls to applyFlip and applyShadow, I would write "if (ite)
> { applyFlip(ite); if (CurrColorFill != CommonStrings::None)
> applyShadow(ite); }"
>
> That way, anyone reading the code later can easily see that 1) ite is
> always initialized and that 2) whatever happens in the big block of
> code, applyFlip() and applyShadow() will never be called unless they
> have an item.
Fixed these 2 warnings now, but this code is in the "old" libwpg branch
of rawpainter.cpp. You need librevenge to get the more modern branch
of this code. librevenge also allows you to build the importers for CDR,
Freehand and MSPublisher files.

Greetings,
Franz Schmid




More information about the scribus-dev mailing list