Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


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.

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.