summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2014-07-20 20:10:15 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2014-07-22 23:50:42 +0200
commit824d78b570b06237a645f8db07eb0cebb2190726 (patch)
tree23544815078e767c81d5047d0263c6c53454977b
parent3621e2d9e16be46b28c26ca9278b91b94dbbd762 (diff)
Use a dedicated constant, with a descriptive name
Change-Id: I7f3ff51ee004450ba059ba5b6995bcdb30c3235d
-rw-r--r--sw/inc/ndhints.hxx4
-rw-r--r--sw/source/core/txtnode/thints.cxx8
2 files changed, 8 insertions, 4 deletions
diff --git a/sw/inc/ndhints.hxx b/sw/inc/ndhints.hxx
index 0e6e89f145ba..291ee3434e71 100644
--- a/sw/inc/ndhints.hxx
+++ b/sw/inc/ndhints.hxx
@@ -91,6 +91,10 @@ protected:
SwpHtStart m_HintStarts;
SwpHtEnd m_HintEnds;
+ // SAL_MAX_SIZE is used by GetStartOf to return
+ // failure, so just allow SAL_MAX_SIZE-1 hints
+ static const size_t MAX_HINTS = SAL_MAX_SIZE-1;
+
//FIXME: why are the non-const methods public?
public:
void Insert( const SwTxtAttr *pHt );
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index f737039959be..d557064761ca 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -480,7 +480,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint )
InsertNesting( **itOther );
if (!bRemoveOverlap)
{
- if ( SAL_MAX_SIZE-1 == Count() )
+ if ( MAX_HINTS <= Count() )
{
OSL_FAIL("hints array full :-(");
return false;
@@ -499,7 +499,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint )
InsertNesting( **itOther );
if (!bRemoveOverlap)
{
- if ( SAL_MAX_SIZE-1 == Count() )
+ if ( MAX_HINTS <= Count() )
{
OSL_FAIL("hints array full :-(");
return false;
@@ -517,7 +517,7 @@ SwpHints::TryInsertNesting( SwTxtNode & rNode, SwTxtAttrNesting & rNewHint )
}
}
- if ( SAL_MAX_SIZE-1 - Count() <= SplitNew.size() )
+ if ( MAX_HINTS <= Count() || MAX_HINTS - Count() <= SplitNew.size() )
{
OSL_FAIL("hints array full :-(");
return false;
@@ -2947,7 +2947,7 @@ bool SwpHints::TryInsertHint(
SwTxtNode &rNode,
const SetAttrMode nMode )
{
- if ( SAL_MAX_SIZE-1 == Count() ) // we're sorry, this flight is overbooked...
+ if ( MAX_HINTS <= Count() ) // we're sorry, this flight is overbooked...
{
OSL_FAIL("hints array full :-(");
return false;