[Libreoffice] Same expression on both sides of '&&' on editeng/source/accessibility/AccessibleStaticTextBase.cxx

julien2412 serval2412 at yahoo.fr
Tue Jan 31 13:36:41 PST 2012


Hello,

Cppchecks reports this : 
core/editeng/source/accessibility/AccessibleStaticTextBase.cxx
346	duplicateExpression	style	Same expression on both sides of '&&'.

Here are the lines :
    342     void AccessibleStaticTextBase_Impl::CorrectTextSegment(
TextSegment&    aTextSegment,
    343                                                             int            
nPara   ) const
    344     {
    345         // Keep 'invalid' values at the TextSegment
    346         if( aTextSegment.SegmentStart != -1 &&
    347             aTextSegment.SegmentStart != -1 )
    348         {
    349             // #112814# Correct TextSegment by paragraph offset
    350             sal_Int32 nOffset(0);
    351             int i;
    352             for(i=0; i<nPara; ++i)
    353                 nOffset += GetParagraph(i).getCharacterCount();
    354 
    355             aTextSegment.SegmentStart += nOffset;
    356             aTextSegment.SegmentEnd += nOffset;
    357         }
    358     }

It's been there since the initial import in 2010.

Should it be just replaced by this :
          if( aTextSegment.SegmentStart != -1 &&
               aTextSegment.SegmentEnd != -1 )

or is it not so obvious ?

Julien.



--
View this message in context: http://nabble.documentfoundation.org/Same-expression-on-both-sides-of-on-editeng-source-accessibility-AccessibleStaticTextBase-cxx-tp3704737p3704737.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list