Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1555

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/55/1555/1

source code correction, optimization in for loop

Change-Id: I838c0849454362450f429897224157bc3b5ee2b9
---
M svx/source/table/tablemodel.cxx
1 file changed, 5 insertions(+), 3 deletions(-)



diff --git a/svx/source/table/tablemodel.cxx b/svx/source/table/tablemodel.cxx
index 46b1c9a..0751b9c 100644
--- a/svx/source/table/tablemodel.cxx
+++ b/svx/source/table/tablemodel.cxx
@@ -1028,10 +1028,11 @@
     if( !maRows.empty() && !maColumns.empty() )
     {
         sal_Int32 nCol = getColumnCountImpl() - 1;
+        sal_Int32 nRowCountImpl = getRowCountImpl();
         while( nCol > 0 )
         {
             bool bEmpty = true;
-            for( sal_Int32 nRow = 0; (nRow < getRowCountImpl()) && bEmpty; nRow++ )
+            for( sal_Int32 nRow = 0; (nRow < nRowCountImpl) && bEmpty; nRow++ )
             {
                 Reference< XMergeableCell > xCell( getCellByPosition( nCol, nRow ), UNO_QUERY );
                 if( xCell.is() && !xCell->isMerged() )
@@ -1065,10 +1066,11 @@
         }
 
         sal_Int32 nRow = getRowCountImpl() - 1;
+        sal_Int32 nColumnCountImpl = getColumnCountImpl();
         while( nRow > 0 )
         {
             bool bEmpty = true;
-            for( nCol = 0; (nCol < getColumnCountImpl()) && bEmpty; nCol++ )
+            for( nCol = 0; (nCol < nColumnCountImpl) && bEmpty; nCol++ )
             {
                 Reference< XMergeableCell > xCell( getCellByPosition( nCol, nRow ), UNO_QUERY );
                 if( xCell.is() && !xCell->isMerged() )
@@ -1116,7 +1118,7 @@
     const sal_Int32 nLastRow = nRow + nRowSpan;
     const sal_Int32 nLastCol = nCol + nColSpan;
 
-    if( (nLastRow > getRowCount()) || (nLastCol > getRowCount() ) )
+    if( (nLastRow > getRowCount()) || (nLastCol > getColumnCount() ) )
     {
         OSL_FAIL("TableModel::merge(), merge beyound the table!");
     }

-- 
To view, visit https://gerrit.libreoffice.org/1555
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I838c0849454362450f429897224157bc3b5ee2b9
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Karthikeyan Krishnamurthi <karthikeyan@kacst.edu.sa>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.