| | @@ -245,13 +245,10 @@ |
| 245 | 245 | while( pPrior->idx > pCurrent->idx ){ |
| 246 | 246 | pPrior->railInUse |= mask; |
| 247 | 247 | pPrior = pPrior->pPrev; |
| 248 | 248 | assert( pPrior!=0 ); |
| 249 | 249 | } |
| 250 | | - if( pCurrent->pPrev ){ |
| 251 | | - pCurrent->pPrev->railInUse |= mask; |
| 252 | | - } |
| 253 | 250 | } |
| 254 | 251 | } |
| 255 | 252 | |
| 256 | 253 | |
| 257 | 254 | /* |
| | @@ -380,20 +377,19 @@ |
| 380 | 377 | } |
| 381 | 378 | pRow->iRail = findFreeRail(p, 0, pParent->idx, inUse, pParent->iRail); |
| 382 | 379 | pParent->aiRaiser[pRow->iRail] = pRow->idx; |
| 383 | 380 | } |
| 384 | 381 | mask = 1<<pRow->iRail; |
| 385 | | -/* if( pRow->pPrev ) pRow->pPrev->railInUse |= mask; */ |
| 386 | | - if( pRow->pNext ) pRow->pNext->railInUse |= mask; |
| 382 | + pRow->railInUse |= mask; |
| 387 | 383 | if( pRow->pChild==0 ){ |
| 388 | 384 | inUse &= ~mask; |
| 389 | 385 | }else{ |
| 390 | 386 | inUse |= mask; |
| 391 | 387 | assignChildrenToRail(pRow); |
| 392 | 388 | } |
| 393 | 389 | if( pParent ){ |
| 394 | | - for(pLoop=pParent; pLoop && pLoop!=pRow; pLoop=pLoop->pPrev){ |
| 390 | + for(pLoop=pParent->pPrev; pLoop && pLoop!=pRow; pLoop=pLoop->pPrev){ |
| 395 | 391 | pLoop->railInUse |= mask; |
| 396 | 392 | } |
| 397 | 393 | } |
| 398 | 394 | } |
| 399 | 395 | |
| | @@ -405,14 +401,13 @@ |
| 405 | 401 | int parentRid = pRow->aParent[i]; |
| 406 | 402 | pDesc = hashFind(p, parentRid); |
| 407 | 403 | if( pDesc==0 ) continue; |
| 408 | 404 | if( pDesc->mergeOut<0 ){ |
| 409 | 405 | int iTarget = (pRow->iRail + pDesc->iRail)/2; |
| 410 | | - pDesc->mergeOut = findFreeRail(p, pRow->idx, pDesc->idx, 0, iTarget); |
| 406 | + pDesc->mergeOut = findFreeRail(p, pRow->idx, pDesc->idx-1, 0, iTarget); |
| 411 | 407 | pDesc->mergeUpto = pRow->idx; |
| 412 | 408 | mask = 1<<pDesc->mergeOut; |
| 413 | | - pDesc->railInUse |= mask; |
| 414 | 409 | for(pLoop=pRow->pNext; pLoop && pLoop->rid!=parentRid; |
| 415 | 410 | pLoop=pLoop->pNext){ |
| 416 | 411 | pLoop->railInUse |= mask; |
| 417 | 412 | } |
| 418 | 413 | } |
| | @@ -428,14 +423,13 @@ |
| 428 | 423 | if( !pRow->isDup ) continue; |
| 429 | 424 | pDesc = hashFind(p, pRow->rid); |
| 430 | 425 | assert( pDesc!=0 && pDesc!=pRow ); |
| 431 | 426 | if( pDesc->mergeOut<0 ){ |
| 432 | 427 | int iTarget = (pRow->iRail + pDesc->iRail)/2; |
| 433 | | - pDesc->mergeOut = findFreeRail(p, pRow->idx, pDesc->idx, 0, iTarget); |
| 428 | + pDesc->mergeOut = findFreeRail(p, pRow->idx, pDesc->idx-1, 0, iTarget); |
| 434 | 429 | pDesc->mergeUpto = pRow->idx; |
| 435 | 430 | mask = 1<<pDesc->mergeOut; |
| 436 | | - pDesc->railInUse |= mask; |
| 437 | 431 | for(pLoop=pRow->pNext; pLoop && pLoop!=pDesc; pLoop=pLoop->pNext){ |
| 438 | 432 | pLoop->railInUse |= mask; |
| 439 | 433 | } |
| 440 | 434 | } |
| 441 | 435 | pRow->mergeIn |= 1<<pDesc->mergeOut; |
| 442 | 436 | |