Cppcheck: ''bSkipBreaks' is assigned a value that is never used (sc)

Kohei Yoshida kohei.yoshida at gmail.com
Tue Feb 5 16:27:39 PST 2013


On Tue, Feb 5, 2013 at 6:03 PM, Caolán McNamara <caolanm at redhat.com> wrote:

> On Tue, 2013-02-05 at 14:26 -0800, julien2412 wrote:
> > Hello,
> >
> > Cppcheck detected this:
> > sc/source/core/data/table5.cxx
> > 147   unreadVariable  style   Variable 'bSkipBreaks' is assigned a value
> that is
> > never used.
>
> Hmm, I reckon kohei should have a look at that. bSkipBreaks doesn't go
> anywhere so its doing nothing. git blame shows d8c68b41b and references
> #i94698 and looking at the context of the original patch there it seems
> that back then there was only a single "bSkipBreaks" bool while now
> there are two, bSkipColBreaks and bSkipRowBreaks.
>
> Presumably somewhere along the go-ooo time
> sc-fit-to-width-height-skip-breaks.diff didn't apply after bSkipBreaks
> got split into bSkipColBreaks and bSkipRowBreaks and the fixup didn't
> take account of that.
>

Yup, that's probably what happened.  When you look closely at the two if
statement blocks where the values of bSkipBreaks, bSkipColBreaks and
bSkipRowBreaks are assigned, they are almost identical. The second one came
from the patch I wrote back in the Go-OO times, and the first one was added
by Niklas later.  My patch was against the code before Niklas' change, and
as a result of this mixup and merge hiccups bSkipBreaks got left out in
limbo.

Given this, and the way the code looks today, we can safely remove
bSkipBreaks and the whole if statement (the 2nd one) where bSkipBreaks is
assigned a value.

Kohei


>
> C.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20130205/fbb75f20/attachment.html>


More information about the LibreOffice mailing list