huh???

Frerich Raabe raabe at kde.org
Wed Apr 28 16:25:13 BST 2004


On Wednesday 28 April 2004 17:23, George Staikos wrote:
> void KMdiMainFrm::removeFromActiveDockList(KMdiDockContainer* td) {
>   for (int i=0;i<4;i++) {
>     if (d->activeDockPriority[i]==td) {

It's iterating through the first four entries in the activeDockPriority, 
looking for whether the given dock container pointer 'td' is listed.

>       // FIXME: HUH??  i2 is never used here, and this for() loop modifies 
the
>       //        variable from the outer loop!! 
>       for (int i2=i;i<3;i++)
>         d->activeDockPriority[i]=d->activeDockPriority[i+1];
>       d->activeDockPriority[3]=0;
>       break;

If the dock container is found, it gets removed by shifting the subsequent 
dock containers one position forward. The comment is silly, IMHO it's quite 
obvious that for the inner loop references to "i" (except in the "int i2=i" 
part) should be changed to "i2".

For instance, if the current activeDockPriority list looks like "Foo Bar Blah 
Blubb" and "Bar" gets passed to this function, the list will AFAICS look like 
"Foo Blah Blubb 0".

- Frerich




More information about the kde-core-devel mailing list