Cppcheck : Variable 'bRet' is reassigned a value in autoform.cxx
Caolán McNamara
caolanm at redhat.com
Fri Jan 18 03:01:35 PST 2013
On Thu, 2013-01-17 at 13:54 -0800, julien2412 wrote:
> What should we do with bRet value, after line 1102?
bRet is supposed to return true if the save succeeded s
a) changing all the bRets after the initial initialization from
bRet = foo
to
bRet &= foo
would ensure that the failed state of any check is kept
b) alternatively, could change the
bool bRet = ...
if (bRet)
{
bRet = foo
bRet = bar
}
to something like
bool bRet = true;
do
{
bRet = foo;
if (!bRet)
break;
bRet = bar;
if (!bRet)
break;
} while(0);
c) just do one bRet = (rStream.GetError() == 0); before the Flush and
remove the other ones inside the bRet block
> 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?
Yeah, I think you definitely should
C.
More information about the LibreOffice
mailing list