Cppcheck:"Logical disjunction always evaluates to true" in svdotextdecomposition.cxx (svx module)
David Tardon
dtardon at redhat.com
Sun Sep 7 04:30:01 PDT 2014
Hi,
On Sat, Sep 06, 2014 at 04:16:43AM -0700, julien2412 wrote:
> Hello,
>
> Cppcheck reported this:
> 1237 incorrectLogicOperator style Logical disjunction always evaluates to
> true: nRepeat||!nRepeat.
> in svx/source/svdraw/svdotextdecomposition.cxx
> Indeed, we've got this:
> 1236 // loop. In loop, move through
> 1237 if(nRepeat || 0L == nRepeat)
> 1238 {
> 1239 drawinglayer::animation::AnimationEntryLoop aLoop(nRepeat ?
> nRepeat : ENDLESS_LOOP);
> 1240 drawinglayer::animation::AnimationEntryLinear
> aThrough(fTimeFullPath, fFrequency, bForward ? 0.0 : 1.0, bForward ? 1.0 :
> 0.0);
> 1241 aLoop.append(aThrough);
> 1242 rAnimList.append(aLoop);
> 1243 }
> See
> http://opengrok.libreoffice.org/xref/core/svx/source/svdraw/svdotextdecomposition.cxx#1237
>
> First I thought about removing the test about nRepeat == 0L but line 1239
> expects to have nRepeat different or equal to 0.
>
> Any idea?
Just remove the whole test. 0 is a valid value for nRepeat and means an
infinite number of repetitions.
D.
More information about the LibreOffice
mailing list