Cppcheck : Variable 'bRet' is reassigned a value in autoform.cxx

julien2412 serval2412 at yahoo.fr
Thu Jan 17 13:54:22 PST 2013


Hello,

Cppcheck reported this:
sc/source/core/tool/autoform.cxx
1105	redundantAssignment	style	Variable 'bRet' is reassigned a value before
the old one has been used.

   1102         bRet = (rStream.GetError() == 0);
   1103        
//-----------------------------------------------------------
   1104         rStream << (sal_uInt16)(maData.size() - 1);
   1105         bRet = (rStream.GetError() == 0);
   1106         MapType::iterator it = maData.begin(), itEnd = maData.end();
   1107         for (++it; bRet && it != itEnd; ++it) // Skip the first
item.
   1108             bRet = it->second->Save(rStream, fileVersion);

What should we do with bRet value, after line 1102?

Also, notice the line 1107 "++it" to skip the first item. Shouldn't we add a
wrapper if(it != itEnd) for the "for loop" to be sure?

see
http://opengrok.libreoffice.org/xref/core/sc/source/core/tool/autoform.cxx#1105

Julien 



--
View this message in context: http://nabble.documentfoundation.org/Cppcheck-Variable-bRet-is-reassigned-a-value-in-autoform-cxx-tp4030054.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list