Bugs in signalplotter.cpp

John Tapsell johnflux at gmail.com
Mon Sep 21 12:15:18 CEST 2009


2009/9/20 Albert Astals Cid <aacid at kde.org>:
> Hi, not sure who's the responsible on that, blame says 73% of lines are from
> "leonhard" but CIA says he left KDE time ago, copyright mentions John so i'm
> mailing for John and plasma-devel (as replacement of leonhard).
>
> In plasma/widgets/signalplotter.cpp there is code like this

Bah, reason number 412 why code copying is evil.  This is a copy of an
old version.

I'll look into it.

>
>    foreach (QList<double> data, d->plotData) {
>        data.append(0);
>    }
>
>
>    foreach (QList<double> data, d->plotData) {
>        if (newOrder.count() != data.count()) {
>            kDebug() << "Serious problem in move sample.  plotdata[i] has "
>                     << data.count() << " and neworder has " <<
> newOrder.count();
>        } else {
>            QList<double> newPlot;
>            for (int i = 0; i < newOrder.count(); i++) {
>                int newIndex = newOrder[i];
>                newPlot.append(data.at(newIndex));
>            }
>            data = newPlot;
>        }
>    }
>
>
>    foreach (QList<double> data, d->plotData) {
>        if ((uint)data.size() >= pos) {
>            data.removeAt(pos);
>        }
>    }
>
>
>
> This code does nothing, it is only working over temporary copies of the lists,
> the orginal ones are not modified, please read
> http://tsdgeos.blogspot.com/2008/04/qforeach-is-your-friend.html if you don't
> understand what i say.
>
> Albert
>


More information about the Plasma-devel mailing list