Question about cppcheck report on (SwCrsrShell::GetSmartTagTerm)

julien2412 serval2412 at yahoo.fr
Wed Dec 19 15:15:40 PST 2012


Hello,

Cppcheck reported this:
[source/core/crsr/crsrsh.cxx:3357] -> [source/core/crsr/crsrsh.cxx:3365]:
(performance) Variable 'rContent' is reassigned a value before the old one
has been used.

Indeed, we have these lines:
   3356             SwIndex& rContent = GetCrsr()->GetPoint()->nContent;  
<-- Assignation 1
   3357             rContent = nWordStart;  <-- Assignation 2 without having
used Assignation1
   3358             SwRect aStartRect;
   3359             SwCrsrMoveState aState;
   3360             aState.bRealWidth = sal_True;
   3361             SwCntntNode* pCntntNode = pCrsr->GetCntntNode();
   3362             SwCntntFrm *pCntntFrame = pCntntNode->getLayoutFrm(
GetLayout(), &rPt, pCrsr->GetPoint(), sal_False);
   3363 
   3364             pCntntFrame->GetCharRect( aStartRect,
*pCrsr->GetPoint(), &aState );
   3365             rContent = nWordEnd - 1;   <-- Assignation 3 without
having used Assignation2

http://opengrok.libreoffice.org/xref/core/sw/source/core/crsr/crsrsh.cxx#3357

Any idea what to do with these assignations?

Julien




--
View this message in context: http://nabble.documentfoundation.org/Question-about-cppcheck-report-on-SwCrsrShell-GetSmartTagTerm-tp4025236.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list