STRING_LEN is no more the maximum string length + some cleanups

Change-Id: Idbdfb4dd39ce5e419f7b9338db39ddda186d014d
This commit is contained in:
Matteo Casalin
2013-11-24 13:05:05 +01:00
parent 2dda972cb9
commit 12bdbfbc43

View File

@@ -1223,22 +1223,20 @@ static std::vector<sal_uInt16> * lcl_RangesToVector(sal_uInt16 * pRanges)
static bool lcl_StrLenOverFlow( const SwPaM& rPam ) static bool lcl_StrLenOverFlow( const SwPaM& rPam )
{ {
// If we try to merge two paragraph we have to test if afterwards // If we try to merge two paragraphs we have to test if afterwards
// the string doesn't exceed the allowed string length // the string doesn't exceed the allowed string length
bool bRet = false;
if( rPam.GetPoint()->nNode != rPam.GetMark()->nNode ) if( rPam.GetPoint()->nNode != rPam.GetMark()->nNode )
{ {
const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End(); const SwPosition* pStt = rPam.Start(), *pEnd = rPam.End();
const SwTxtNode* pEndNd = pEnd->nNode.GetNode().GetTxtNode(); const SwTxtNode* pEndNd = pEnd->nNode.GetNode().GetTxtNode();
if( (0 != pEndNd) && pStt->nNode.GetNode().IsTxtNode() ) if( (0 != pEndNd) && pStt->nNode.GetNode().IsTxtNode() )
{ {
sal_uInt64 nSum = pStt->nContent.GetIndex() + const sal_uInt64 nSum = pStt->nContent.GetIndex() +
pEndNd->GetTxt().getLength() - pEnd->nContent.GetIndex(); pEndNd->GetTxt().getLength() - pEnd->nContent.GetIndex();
if( nSum > STRING_LEN ) return nSum > static_cast<sal_uInt64>(SAL_MAX_INT32);
bRet = true;
} }
} }
return bRet; return false;
} }
void sw_GetJoinFlags( SwPaM& rPam, sal_Bool& rJoinTxt, sal_Bool& rJoinPrev ) void sw_GetJoinFlags( SwPaM& rPam, sal_Bool& rJoinTxt, sal_Bool& rJoinPrev )