[Libreoffice-commits] .: Branch 'libreoffice-3-3' - sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Wed Aug 10 18:46:28 PDT 2011
sc/source/ui/view/tabview2.cxx | 46 ++++++++++++++---------------------------
1 file changed, 16 insertions(+), 30 deletions(-)
New commits:
commit ba2069b96f6b00c93daf17b92a8d270186beb8f8
Author: Eike Rathke <ooo at erack.de>
Date: Wed Aug 10 21:40:56 2011 -0400
Prevent crash at column row boundaries.
Modified from the original patch submitted by Olivier Hallot.
Signed-off-by: Kohei Yoshida <kohei.yoshida at suse.com>
diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index a4e75a4..3d746e9 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -656,53 +656,39 @@ void moveCursorByProtRule(
if (nMovX > 0)
{
- if (rCol < MAXCOL)
+ for (SCCOL i = 0; i < nMovX && rCol < MAXCOL; ++i)
{
- for (SCCOL i = 0; i < nMovX; ++i)
- {
- if (!isCellQualified(pDoc, rCol+1, rRow, nTab, bSelectLocked, bSelectUnlocked))
- break;
- ++rCol;
- }
+ if (!isCellQualified(pDoc, rCol+1, rRow, nTab, bSelectLocked, bSelectUnlocked))
+ break;
+ ++rCol;
}
}
else if (nMovX < 0)
{
- if (rCol > 0)
+ for (SCCOL i = 0; i > nMovX && rCol > 0; --i)
{
- nMovX = -nMovX;
- for (SCCOL i = 0; i < nMovX; ++i)
- {
- if (!isCellQualified(pDoc, rCol-1, rRow, nTab, bSelectLocked, bSelectUnlocked))
- break;
- --rCol;
- }
+ if (!isCellQualified(pDoc, rCol-1, rRow, nTab, bSelectLocked, bSelectUnlocked))
+ break;
+ --rCol;
}
}
if (nMovY > 0)
{
- if (rRow < MAXROW)
+ for (SCROW i = 0; i < nMovY && rRow < MAXROW; ++i)
{
- for (SCROW i = 0; i < nMovY; ++i)
- {
- if (!isCellQualified(pDoc, rCol, rRow+1, nTab, bSelectLocked, bSelectUnlocked))
- break;
- ++rRow;
- }
+ if (!isCellQualified(pDoc, rCol, rRow+1, nTab, bSelectLocked, bSelectUnlocked))
+ break;
+ ++rRow;
}
}
else if (nMovY < 0)
{
- if (rRow > 0)
+ for (SCROW i = 0; i > nMovY && rRow > 0; --i)
{
- nMovY = -nMovY;
- for (SCROW i = 0; i < nMovY; ++i)
- {
- if (!isCellQualified(pDoc, rCol, rRow-1, nTab, bSelectLocked, bSelectUnlocked))
- break;
- --rRow;
- }
+ if (!isCellQualified(pDoc, rCol, rRow-1, nTab, bSelectLocked, bSelectUnlocked))
+ break;
+ --rRow;
}
}
}
More information about the Libreoffice-commits
mailing list