[SOLVED] Re: Cppcheck:"Logical disjunction always evaluates to true" in svdotextdecomposition.cxx (svx module)

Julien Nabet serval2412 at yahoo.fr
Sun Sep 7 06:17:33 PDT 2014


On 07/09/2014 13:30, David Tardon wrote:
> 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.
Thank you David for your feedback, I pushed the patch on master. (see 
http://cgit.freedesktop.org/libreoffice/core/commit/?id=1b02831d802ab8327a4b73528c7200289f2a0279)

Julien



More information about the LibreOffice mailing list