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


Hey,


Cppcheck reported this:
[sc/source/core/tool/interpr2.cxx:2656]: (style) The scope of the variable
'bIsDec2' can be reduced

Here are the lines:
   2651         while( bValid && (nCharIndex < nCharCount) )
   2652         {
   2653             sal_uInt16 nDigit1 = 0;
   2654             sal_uInt16 nDigit2 = 0;
   2655             bool bIsDec1 = false;
   2656             bool bIsDec2 = false;
   2657             bValid = lcl_GetArabicValue( aRoman.GetChar( nCharIndex
), nDigit1, bIsDec1 );
   2658             if( bValid && (nCharIndex + 1 < nCharCount) )
   2659                 bValid = lcl_GetArabicValue( aRoman.GetChar(
nCharIndex + 1 ), nDigit2, bIsDec2 );

But in fact, on the contrary of "bIsDec1" , "bIsDec2" isn't used in the rest
of the loop.
So either, bIsDec2 is useless and can just be replaced by "false", or
something is wrong here.


bIsDec2 can't be removed since the method requires a non const
reference. However cppcheck is right that the scope of bIsDec2 can be
reduced. You can move it into the the same scope as the call to
lcl_GetArabicValue.

Regards,
Markus

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.