Question about sc/source/core/data/colorscale.cxx

julien2412 serval2412 at yahoo.fr
Sat Dec 15 01:25:48 PST 2012


Hello,

I noticed these lines in file sc/source/core/data/colorscale.cxx
(because cppcheck report indicates that bNeedUpdate is reassigned before to
be used line 641)

    637 void ScDataBarFormat::DataChanged(const ScRange& rRange)
    638 {
    639     bool bNeedUpdate = false;
    640 
    641     bNeedUpdate = NeedUpdate(mpFormatData->mpUpperLimit.get());
    642     bNeedUpdate &= NeedUpdate(mpFormatData->mpLowerLimit.get());
    643 
    644     bNeedUpdate &= GetRange().Intersects(rRange);
    645 
    646     if(bNeedUpdate)
    647     {
    648         mpDoc->RepaintRange(GetRange());
    649     }
    650 }

First I wonder if we shouldn't avoid to bitwise and and logical and. But
above all, shouldn't it be logical OR?

So I would rather put:
 if( (NeedUpdate(mpFormatData->mpUpperLimit.get()))
|| (NeedUpdate(mpFormatData->mpLowerLimit.get())) ||
(GetRange().Intersects(rRange)) )
{
    mpDoc->RepaintRange(GetRange());
}

What do you think?

Julien



--
View this message in context: http://nabble.documentfoundation.org/Question-about-sc-source-core-data-colorscale-cxx-tp4024485.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list