[ooo-build-commit] patches/dev300

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Jul 31 15:54:16 PDT 2009


 patches/dev300/calc-perf-sort.diff |   68 +++++++++++++++++++------------------
 1 file changed, 36 insertions(+), 32 deletions(-)

New commits:
commit 3213ee386a5bbaa0b4b40d10f92d595d7fcdbd07
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Fri Jul 31 18:50:16 2009 -0400

    Fixed a crash on sort when the first row was not 0.
    
    * patches/dev300/calc-perf-sort.diff: fixed a silly mistake that
      always assumed the start row to be always 0. (n#524215)

diff --git a/patches/dev300/calc-perf-sort.diff b/patches/dev300/calc-perf-sort.diff
index 8ccad6b..84a9a82 100644
--- a/patches/dev300/calc-perf-sort.diff
+++ b/patches/dev300/calc-perf-sort.diff
@@ -1,5 +1,5 @@
 diff --git sc/source/core/data/column.cxx sc/source/core/data/column.cxx
-index 374606a..bf98488 100644
+index b455d90..76ecf13 100644
 --- sc/source/core/data/column.cxx
 +++ sc/source/core/data/column.cxx
 @@ -854,6 +854,10 @@ void lclTakeBroadcaster( ScBaseCell*& rpCell, SvtBroadcaster* pBC )
@@ -28,23 +28,23 @@ index 374606a..bf98488 100644
 +                ScHint aHint2( SC_HINT_DATACHANGED, aPos2, pCell1 );
 +                pDocument->Broadcast( aHint2 );
 +            }
- 		}
- 		else
- 		{
+         }
+         else
+         {
 @@ -936,7 +943,8 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
  
              // insert ColEntry at new position
- 			Insert( nRow2, pCell1 );
+             Insert( nRow2, pCell1 );
 -			pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED, aPos1, pDummyCell ) );
 +            if (bBroadcast)
 +                pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED, aPos1, pDummyCell ) );
- 		}
+         }
  
- 		return;
+         return;
 @@ -1021,10 +1029,13 @@ void ScColumn::SwapRow(SCROW nRow1, SCROW nRow2)
- 	//	#64122# Bei Formeln hinterher nochmal broadcasten, damit die Formel nicht in irgendwelchen
- 	//	FormulaTrack-Listen landet, ohne die Broadcaster beruecksichtigt zu haben
- 	//	(erst hier, wenn beide Zellen eingefuegt sind)
+     //	#64122# Bei Formeln hinterher nochmal broadcasten, damit die Formel nicht in irgendwelchen
+     //	FormulaTrack-Listen landet, ohne die Broadcaster beruecksichtigt zu haben
+     //	(erst hier, wenn beide Zellen eingefuegt sind)
 -	if ( pBC1 && pFmlaCell2 )
 -		pDocument->Broadcast( ScHint( SC_HINT_DATACHANGED, aPos1, pNew1 ) );
 -	if ( pBC2 && pFmlaCell1 )
@@ -60,37 +60,41 @@ index 374606a..bf98488 100644
  
  
 diff --git sc/source/core/data/table3.cxx sc/source/core/data/table3.cxx
-index 95f68fc..9082beb 100644
+index c9f4a00..724ae58 100644
 --- sc/source/core/data/table3.cxx
 +++ sc/source/core/data/table3.cxx
-@@ -349,15 +349,11 @@ void ScTable::SortReorder( ScSortInfoArray* pArray, ScProgress& rProgress )
- 	BOOL bByRow = aSortParam.bByRow;
- 	SCSIZE nCount = pArray->GetCount();
- 	ScSortInfo** ppInfo = pArray->GetFirstArray();
+@@ -348,17 +348,14 @@ void ScTable::SortReorder( ScSortInfoArray* pArray, ScProgress& rProgress )
+ {
+     BOOL bByRow = aSortParam.bByRow;
+     SCSIZE nCount = pArray->GetCount();
++    SCCOLROW nStart = pArray->GetStart();
+     ScSortInfo** ppInfo = pArray->GetFirstArray();
 -    // hngngn.. Win16 legacy? Table has ULONG count but can only be initialized using USHORT :-/
 -    // FIXME: use std::vector instead, would be better anyway (type safe)
 -    USHORT nArghl = (nCount > USHRT_MAX ? USHRT_MAX : static_cast<USHORT>(nCount));
 -	Table aTable( nArghl );
-+    ::std::vector<ScSortInfo*> aTable2(nCount+1);
- 	SCSIZE nPos;
- 	for ( nPos = 0; nPos < nCount; nPos++ )
++    ::std::vector<ScSortInfo*> aTable(nCount);
+     SCSIZE nPos;
+     for ( nPos = 0; nPos < nCount; nPos++ )
 -	{
 -		aTable.Insert( ppInfo[nPos]->nOrg, (void*) ppInfo[nPos] );
 -	}
-+        aTable2[ppInfo[nPos]->nOrg] = ppInfo[nPos];
+-    SCCOLROW nDest = pArray->GetStart();
++        aTable[ppInfo[nPos]->nOrg - nStart] = ppInfo[nPos];
 +
- 	SCCOLROW nDest = pArray->GetStart();
- 	for ( nPos = 0; nPos < nCount; nPos++, nDest++ )
- 	{
-@@ -371,9 +367,9 @@ void ScTable::SortReorder( ScSortInfoArray* pArray, ScProgress& rProgress )
- 			// neue Position des weggeswapten eintragen
- 			ScSortInfo* p = ppInfo[nPos];
- 			p->nOrg = nDest;
++    SCCOLROW nDest = nStart;
+     for ( nPos = 0; nPos < nCount; nPos++, nDest++ )
+     {
+         SCCOLROW nOrg = ppInfo[nPos]->nOrg;
+@@ -371,9 +368,9 @@ void ScTable::SortReorder( ScSortInfoArray* pArray, ScProgress& rProgress )
+             // neue Position des weggeswapten eintragen
+             ScSortInfo* p = ppInfo[nPos];
+             p->nOrg = nDest;
 -			p = (ScSortInfo*) aTable.Replace( nDest, (void*) p );
-+            ::std::swap(p, aTable2[nDest]);
- 			p->nOrg = nOrg;
++            ::std::swap(p, aTable[nDest-nStart]);
+             p->nOrg = nOrg;
 -			p = (ScSortInfo*) aTable.Replace( nOrg, (void*) p );
-+            ::std::swap(p, aTable2[nOrg]);
- 			DBG_ASSERT( p == ppInfo[nPos], "SortReorder: nOrg MisMatch" );
- 		}
- 		rProgress.SetStateOnPercent( nPos );
++            ::std::swap(p, aTable[nOrg-nStart]);
+             DBG_ASSERT( p == ppInfo[nPos], "SortReorder: nOrg MisMatch" );
+         }
+         rProgress.SetStateOnPercent( nPos );


More information about the ooo-build-commit mailing list