diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-10-27 00:24:50 +0100 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2014-11-16 16:52:42 +0100 |
commit | bd17413bef117a80ccfc2b7f5bbd794a6491e9b7 (patch) | |
tree | 3fe7dd1da2640770059951ba7c0cb91885513ef3 /sw | |
parent | bed58e399aaf1ee0292dc64808948780199e730a (diff) |
sal_uInt16 to more proper integer types, make some constification
Change-Id: I474006e128788336680e28c9f73d4a26e68541c6
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/layout/atrfrm.cxx | 18 | ||||
-rw-r--r-- | sw/source/core/layout/calcmove.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/colfrm.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/layout/findfrm.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/flowfrm.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/layout/fly.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/layout/flycnt.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/layout/flyincnt.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/flylay.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/layout/frmtool.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/ftnfrm.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/layout/layact.cxx | 20 | ||||
-rw-r--r-- | sw/source/core/layout/layouter.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/layout/newfrm.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/objectformatter.cxx | 4 |
15 files changed, 45 insertions, 48 deletions
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 54e710dc2454..82c4d2c211e5 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -843,7 +843,7 @@ bool SwFmtCol::operator==( const SfxPoolItem& rAttr ) const ) ) return false; - for ( sal_uInt16 i = 0; i < m_aColumns.size(); ++i ) + for ( size_t i = 0; i < m_aColumns.size(); ++i ) if ( !(m_aColumns[i] == rCmp.GetColumns()[i]) ) return false; @@ -863,7 +863,7 @@ sal_uInt16 SwFmtCol::GetGutterWidth( bool bMin ) const else if ( m_aColumns.size() > 2 ) { bool bSet = false; - for ( sal_uInt16 i = 1; i < m_aColumns.size()-1; ++i ) + for ( size_t i = 1; i+1 < m_aColumns.size(); ++i ) { const sal_uInt16 nTmp = m_aColumns[i].GetRight() + m_aColumns[i+1].GetLeft(); if ( bSet ) @@ -892,13 +892,13 @@ void SwFmtCol::SetGutterWidth( sal_uInt16 nNew, sal_uInt16 nAct ) else { sal_uInt16 nHalf = nNew / 2; - for ( sal_uInt16 i = 0; i < m_aColumns.size(); ++i ) + for ( size_t i = 0; i < m_aColumns.size(); ++i ) { SwColumn *pCol = &m_aColumns[i]; pCol->SetLeft ( nHalf ); pCol->SetRight( nHalf ); if ( i == 0 ) pCol->SetLeft( 0 ); - else if ( i == (m_aColumns.size() - 1) ) + else if ( i+1 == m_aColumns.size() ) pCol->SetRight( 0 ); } } @@ -1204,7 +1204,7 @@ bool SwFmtSurround::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) case MID_SURROUND_SURROUNDTYPE: { sal_Int32 eVal = SWUnoHelper::GetEnumAsInt32( rVal ); - if( eVal >= 0 && eVal < (sal_Int16)SURROUND_END ) + if( eVal >= 0 && eVal < SURROUND_END ) SetValue( static_cast<sal_uInt16>(eVal) ); else { //exception @@ -2443,7 +2443,7 @@ void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) SwFmtHeader *pH = 0; SwFmtFooter *pF = 0; - sal_uInt16 nWhich = pNew ? pNew->Which() : 0; + const sal_uInt16 nWhich = pNew ? pNew->Which() : 0; if( RES_ATTRSET_CHG == nWhich ) { @@ -2583,7 +2583,7 @@ SwRect SwFrmFmt::FindLayoutRect( const bool bPrtArea, const Point* pPoint, } else { - sal_uInt16 nFrmType = RES_FLYFRMFMT == Which() ? FRM_FLY : USHRT_MAX; + const sal_uInt16 nFrmType = RES_FLYFRMFMT == Which() ? FRM_FLY : USHRT_MAX; pFrm = ::GetFrmOfModify( 0, *(SwModify*)this, nFrmType, pPoint, 0, bCalcFrm ); } @@ -2645,7 +2645,7 @@ bool SwFrmFmt::IsLowerOf( const SwFrmFmt& rFmt ) const while( pFlyNd ) { // then we walk up using the anchor - sal_uInt16 n; + size_t n; for( n = 0; n < rFmts.size(); ++n ) { const SwFrmFmt* pFmt = rFmts[ n ]; @@ -2776,7 +2776,7 @@ void SwFlyFrmFmt::MakeFrms() { const SwNodeIndex &rIdx = aAnchorAttr.GetCntntAnchor()->nNode; SwFrmFmts& rFmts = *GetDoc()->GetSpzFrmFmts(); - for( sal_uInt16 i = 0; i < rFmts.size(); ++i ) + for( size_t i = 0; i < rFmts.size(); ++i ) { SwFrmFmt* pFlyFmt = rFmts[i]; if( pFlyFmt->GetCntnt().GetCntntIdx() && diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index a347ed3efd26..62b383264d67 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -487,7 +487,7 @@ void SwFrm::MakePos() } pPrv = lcl_Prev( this, false ); - sal_uInt16 nMyType = GetType(); + const sal_uInt16 nMyType = GetType(); SWRECTFN( ( IsCellFrm() && GetUpper() ? GetUpper() : this ) ) if ( !bUseUpper && pPrv ) { diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx index cb029ae5b7ee..641bb8548bec 100644 --- a/sw/source/core/layout/colfrm.cxx +++ b/sw/source/core/layout/colfrm.cxx @@ -255,8 +255,8 @@ void SwLayoutFrm::ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew, bAdjustAttributes = true; else { - sal_uInt16 nCount = std::min( rNew.GetColumns().size(), rOld.GetColumns().size() ); - for ( sal_uInt16 i = 0; i < nCount; ++i ) + const size_t nCount = std::min( rNew.GetColumns().size(), rOld.GetColumns().size() ); + for ( size_t i = 0; i < nCount; ++i ) if ( !(rOld.GetColumns()[i] == rNew.GetColumns()[i]) ) { bAdjustAttributes = true; diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index 2be7d58bbf7a..9f9413c11163 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -531,7 +531,7 @@ const SwPageFrm* SwRootFrm::GetPageAtPos( const Point& rPt, const Size* pSize, b } OSL_ENSURE( GetPageNum() <= maPageRects.size(), "number of pages differes from page rect array size" ); - sal_uInt16 nPageIdx = 0; + size_t nPageIdx = 0; while ( pPage && !pRet ) { diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index f811dee1747c..2b101b2c7a14 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -802,7 +802,7 @@ bool SwFrm::WrongPageDesc( SwPageFrm* pNew ) //My Pagedesc doesn't count if I'm a follow! SwPageDesc *pDesc = 0; - sal_uInt16 nTmp = 0; + int nTmp = 0; SwFlowFrm *pFlow = SwFlowFrm::CastFlowFrm( this ); if ( !pFlow || !pFlow->IsFollow() ) { @@ -821,8 +821,7 @@ bool SwFrm::WrongPageDesc( SwPageFrm* pNew ) // Does the Cntnt bring a Pagedesc or do we need the // virtual page number of the new layout leaf? // PageDesc isn't allowed with Follows - const bool bOdd = nTmp ? ( (nTmp % 2) ? sal_True : sal_False ) - : pNew->OnRightPage(); + const bool bOdd = nTmp ? (nTmp % 2) !=0 : pNew->OnRightPage(); if ( !pDesc ) pDesc = pNew->FindPageDesc(); diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index c8f6deeffb95..f2fc5dc10063 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -89,7 +89,7 @@ SwFlyFrm::SwFlyFrm( SwFlyFrmFmt *pFmt, SwFrm* pSib, SwFrm *pAnch ) : // Size setting: Fixed size is always the width const SwFmtFrmSize &rFrmSize = pFmt->GetFrmSize(); - sal_uInt16 nDir = + const sal_uInt16 nDir = ((SvxFrameDirectionItem&)pFmt->GetFmtAttr( RES_FRAMEDIR )).GetValue(); if( FRMDIR_ENVIRONMENT == nDir ) { @@ -1424,8 +1424,8 @@ void CalcCntnt( SwLayoutFrm *pLay, SwAnchoredObject* pAgainObj2 = 0; // FME 2007-08-30 #i81146# new loop control - sal_uInt16 nLoopControlRuns = 0; - const sal_uInt16 nLoopControlMax = 20; + int nLoopControlRuns = 0; + const int nLoopControlMax = 20; const SwFrm* pLoopControlCond = 0; SwFrm* pLast; diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index b391363f3e60..4aae102067b4 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -58,7 +58,7 @@ TYPEINIT1(SwFlyAtCntFrm,SwFlyFreeFrm); void SwFlyAtCntFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) { - sal_uInt16 nWhich = pNew ? pNew->Which() : 0; + const sal_uInt16 nWhich = pNew ? pNew->Which() : 0; const SwFmtAnchor *pAnch = 0; if( RES_ATTRSET_CHG == nWhich && SfxItemState::SET == @@ -931,7 +931,7 @@ static const SwCntntFrm * lcl_FindCnt( const Point &rPt, const SwCntntFrm *pCnt, { const SwLayoutFrm *pPge = pLay; sal_uInt64 nOldNew = SAL_MAX_UINT64; - for ( sal_uInt16 i = 0; pPge->GetPrev() && (i < 3); ++i ) + for ( int i = 0; pPge->GetPrev() && (i < 3); ++i ) { pPge = (SwLayoutFrm*)pPge->GetPrev(); const sal_uInt64 nNew = ::lcl_FindCntDiff( rPt, pPge, pNew, bBody, bFtn ); @@ -956,7 +956,7 @@ static const SwCntntFrm * lcl_FindCnt( const Point &rPt, const SwCntntFrm *pCnt, } pPge = pLay; nOldNew = SAL_MAX_UINT64; - for ( sal_uInt16 j = 0; pPge->GetNext() && (j < 3); ++j ) + for ( int j = 0; pPge->GetNext() && (j < 3); ++j ) { pPge = (SwLayoutFrm*)pPge->GetNext(); const sal_uInt64 nNew = ::lcl_FindCntDiff( rPt, pPge, pNew, bBody, bFtn ); diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx index ebd6a6963f3b..5e5956f3843e 100644 --- a/sw/source/core/layout/flyincnt.cxx +++ b/sw/source/core/layout/flyincnt.cxx @@ -83,7 +83,7 @@ void SwFlyInCntFrm::SetRefPoint( const Point& rPoint, void SwFlyInCntFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) { bool bCallPrepare = false; - sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; + const sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0; if (RES_ATTRSET_CHG == nWhich && pNew) { if(pOld && diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 4ece4e32bdc8..b9e36e059189 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -137,8 +137,8 @@ void SwFlyFreeFrm::MakeAll() } // #i81146# new loop control - sal_uInt16 nLoopControlRuns = 0; - const sal_uInt16 nLoopControlMax = 10; + int nLoopControlRuns = 0; + const int nLoopControlMax = 10; while ( !mbValidPos || !mbValidSize || !mbValidPrtArea || bFormatHeightOnly || !m_bValidContentPos ) { @@ -467,7 +467,7 @@ TYPEINIT1(SwFlyLayFrm,SwFlyFreeFrm); void SwFlyLayFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) { - sal_uInt16 nWhich = pNew ? pNew->Which() : 0; + const sal_uInt16 nWhich = pNew ? pNew->Which() : 0; SwFmtAnchor *pAnch = 0; if( RES_ATTRSET_CHG == nWhich && SfxItemState::SET == @@ -1022,7 +1022,7 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) SWRECTFN( pClip ) const SwLayoutFrm *pUp = pClip->GetUpper(); const SwFrm *pCell = pUp->IsCellFrm() ? pUp : 0; - sal_uInt16 nType = bMove ? FRM_ROOT | FRM_FLY | FRM_HEADER | + const sal_uInt16 nType = bMove ? FRM_ROOT | FRM_FLY | FRM_HEADER | FRM_FOOTER | FRM_FTN : FRM_BODY | FRM_FLY | FRM_HEADER | FRM_FOOTER | FRM_CELL| FRM_FTN; diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index e1be7def03a3..aba165298493 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -922,7 +922,7 @@ SwCntntNotify::~SwCntntNotify() SwNodeIndex *pIdx = 0; SwFrmFmts *pTbl = pDoc->GetSpzFrmFmts(); - for ( sal_uInt16 i = 0; i < pTbl->size(); ++i ) + for ( size_t i = 0; i < pTbl->size(); ++i ) { SwFrmFmt *pFmt = (*pTbl)[i]; const SwFmtAnchor &rAnch = pFmt->GetAnchor(); diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index cd24c1154e29..de205fe97be5 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -46,9 +46,9 @@ static sal_uLong lcl_FindFtnPos( const SwDoc *pDoc, const SwTxtFtn *pAttr ) SwFtnIdxs::const_iterator it = rFtnIdxs.find( pBla ); if ( it != rFtnIdxs.end() ) { - sal_uInt16 nRet = it - rFtnIdxs.begin(); + sal_uLong nRet = it - rFtnIdxs.begin(); if( pAttr->GetFtn().IsEndNote() ) - return sal_uLong(nRet) + ENDNOTE; + return nRet + ENDNOTE; return nRet; } OSL_ENSURE( !pDoc, "FtnPos not found." ); @@ -787,7 +787,7 @@ SwLayoutFrm *SwFrm::GetPrevFtnLeaf( MakePageType eMakeFtn ) { // Will be reached only if old and new boss are both either pages or the last (new) // or first (old) column of a page. In this case, check if pages were skipped. - sal_uInt16 nDiff = pOldPage->GetPhyPageNum() - pRet->FindPageFrm()->GetPhyPageNum(); + const sal_uInt16 nDiff = pOldPage->GetPhyPageNum() - pRet->FindPageFrm()->GetPhyPageNum(); if ( nDiff > 2 || (nDiff > 1 && !((SwPageFrm*)pOldPage->GetPrev())->IsEmptyPage()) ) bJump = true; @@ -1903,7 +1903,7 @@ void SwFtnBossFrm::_MoveFtns( SwFtnFrms &rFtnArr, bool bCalc ) // #i21478# - keep last inserted footnote in order to // format the content of the following one. SwFtnFrm* pLastInsertedFtn = 0L; - for ( sal_uInt16 i = 0; i < rFtnArr.size(); ++i ) + for ( size_t i = 0; i < rFtnArr.size(); ++i ) { SwFtnFrm *pFtn = rFtnArr[i]; diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index f664f7095962..80832d3b5372 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -562,8 +562,8 @@ void SwLayAction::InternalAction() XCHECKPAGE; // #i81146# new loop control - sal_uInt16 nLoopControlRuns_1 = 0; - const sal_uInt16 nLoopControlMax = 20; + int nLoopControlRuns_1 = 0; + const int nLoopControlMax = 20; while ( !IsNextCycle() && pPage->IsInvalidLayout() ) { @@ -724,8 +724,8 @@ void SwLayAction::InternalAction() XCHECKPAGE; // #i81146# new loop control - sal_uInt16 nLoopControlRuns_2 = 0; - const sal_uInt16 nLoopControlMax = 20; + int nLoopControlRuns_2 = 0; + const int nLoopControlMax = 20; // special case: interrupt content formatting // #i28701# - conditions are incorrect (macros IS_FLYS and IS_INVAFLY only @@ -746,7 +746,7 @@ void SwLayAction::InternalAction() } // #i81146# new loop control - sal_uInt16 nLoopControlRuns_3 = 0; + int nLoopControlRuns_3 = 0; while ( pPg->IsInvalidLayout() ) { @@ -1287,17 +1287,15 @@ bool SwLayAction::FormatLayout( SwLayoutFrm *pLay, bool bAddRect ) } else { - sal_uInt16 i; - SwRegionRects aRegion( aOldRect ); aRegion -= aPaint; - for ( i = 0; i < aRegion.size(); ++i ) + for ( size_t i = 0; i < aRegion.size(); ++i ) pImp->GetShell()->AddPaintRect( aRegion[i] ); aRegion.ChangeOrigin( aPaint ); aRegion.clear(); aRegion.push_back( aPaint ); aRegion -= aOldRect; - for ( i = 0; i < aRegion.size(); ++i ) + for ( size_t i = 0; i < aRegion.size(); ++i ) pImp->GetShell()->AddPaintRect( aRegion[i] ); } } @@ -2176,7 +2174,7 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) : // Further start/end actions only happen if there were paints started // somewhere or if the visibility of the CharRects has changed. bool bActions = false; - sal_uInt16 nBoolIdx = 0; + size_t nBoolIdx = 0; do { --pSh->mnStartAction; @@ -2198,7 +2196,7 @@ SwLayIdle::SwLayIdle( SwRootFrm *pRt, SwViewImp *pI ) : bActions |= aTmp != pSh->VisArea(); if ( aTmp == pSh->VisArea() && pSh->ISA(SwCrsrShell) ) { - bActions |= (aBools[nBoolIdx]) != + bActions |= aBools[nBoolIdx] != static_cast<SwCrsrShell*>(pSh)->GetCharRect().IsOver( pSh->VisArea() ); } } diff --git a/sw/source/core/layout/layouter.cxx b/sw/source/core/layout/layouter.cxx index 8d88f9a60bbf..f4368403789a 100644 --- a/sw/source/core/layout/layouter.cxx +++ b/sw/source/core/layout/layouter.cxx @@ -104,7 +104,7 @@ void SwEndnoter::CollectEndnote( SwFtnFrm* pFtn ) } else if( pEndArr ) { - for ( sal_uInt16 i = 0; i < pEndArr->size(); ++i ) + for ( size_t i = 0; i < pEndArr->size(); ++i ) { SwFtnFrm *pEndFtn = (*pEndArr)[i]; if( pEndFtn->GetAttr() == pFtn->GetAttr() ) @@ -161,7 +161,7 @@ void SwLooping::Control( SwPageFrm* pPage ) { if( !pPage ) return; - sal_uInt16 nNew = pPage->GetPhyPageNum(); + const sal_uInt16 nNew = pPage->GetPhyPageNum(); if( nNew > nMaxPage ) nMaxPage = nNew; if( nNew < nMinPage ) diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index 6ca48a712c46..ae0ff76550a1 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -358,7 +358,7 @@ void _FrmFinit() { #if OSL_DEBUG_LEVEL > 0 // The cache may only contain null pointers at this time. - for( sal_uInt16 n = SwFrm::GetCachePtr()->size(); n; ) + for( size_t n = SwFrm::GetCachePtr()->size(); n; ) if( (*SwFrm::GetCachePtr())[ --n ] ) { SwCacheObj* pObj = (*SwFrm::GetCachePtr())[ n ]; diff --git a/sw/source/core/layout/objectformatter.cxx b/sw/source/core/layout/objectformatter.cxx index 81721c20e2c8..248f171d301c 100644 --- a/sw/source/core/layout/objectformatter.cxx +++ b/sw/source/core/layout/objectformatter.cxx @@ -321,8 +321,8 @@ void SwObjectFormatter::_FormatObj( SwAnchoredObject& _rAnchoredObj ) } // #i81146# new loop control - sal_uInt16 nLoopControlRuns = 0; - const sal_uInt16 nLoopControlMax = 15; + int nLoopControlRuns = 0; + const int nLoopControlMax = 15; do { if ( mpLayAction ) |