summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-06-01 03:08:05 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-06-01 03:12:09 +0200
commitc3f55ac35a0c051b39d608d89558f741f347a898 (patch)
treeb0d987ca2db1387e8ebdb8b30150e9f834112c59
parentcc50d6744f4d07356761021e336e63a96fd86fcc (diff)
switch to size_t in sfx2::LinkManager
Change-Id: I7558ead872ab0e6894689f78fcfbbd1d8fb69877
-rw-r--r--include/sfx2/linkmgr.hxx2
-rw-r--r--sfx2/source/appl/linkmgr2.cxx29
2 files changed, 15 insertions, 16 deletions
diff --git a/include/sfx2/linkmgr.hxx b/include/sfx2/linkmgr.hxx
index 27b84b69e13a..768e913ee2b4 100644
--- a/include/sfx2/linkmgr.hxx
+++ b/include/sfx2/linkmgr.hxx
@@ -90,7 +90,7 @@ public:
void SetPersist( SfxObjectShell * p ) { pPersist = p; }
void Remove( SvBaseLink *pLink );
- void Remove( sal_uInt16 nPos, sal_uInt16 nCnt = 1 );
+ void Remove( size_t nPos, size_t nCnt = 1 );
sal_Bool Insert( SvBaseLink* pLink );
// the links connect to a SvLinkSource and adds to the list
diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index 61483de27cf2..6c0219b38a6b 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -70,7 +70,7 @@ LinkManager::LinkManager(SfxObjectShell* p)
LinkManager::~LinkManager()
{
- for( sal_uInt16 n = 0; n < aLinkTbl.size(); ++n)
+ for( size_t n = 0; n < aLinkTbl.size(); ++n)
{
SvBaseLinkRef* pTmp = aLinkTbl[ n ];
if( pTmp->Is() )
@@ -107,7 +107,7 @@ void LinkManager::Remove( SvBaseLink *pLink )
{
// No duplicate links inserted
int bFound = sal_False;
- for( sal_uInt16 n = 0; n < aLinkTbl.size(); )
+ for( size_t n = 0; n < aLinkTbl.size(); )
{
SvBaseLinkRef* pTmp = aLinkTbl[ n ];
if( pLink == *pTmp )
@@ -132,14 +132,14 @@ void LinkManager::Remove( SvBaseLink *pLink )
}
-void LinkManager::Remove( sal_uInt16 nPos, sal_uInt16 nCnt )
+void LinkManager::Remove( size_t nPos, size_t nCnt )
{
if( nCnt && nPos < aLinkTbl.size() )
{
if (sal::static_int_cast<size_t>(nPos + nCnt) > aLinkTbl.size())
nCnt = aLinkTbl.size() - nPos;
- for( sal_uInt16 n = nPos; n < nPos + nCnt; ++n)
+ for( size_t n = nPos; n < nPos + nCnt; ++n)
{
SvBaseLinkRef* pTmp = aLinkTbl[ n ];
if( pTmp->Is() )
@@ -156,7 +156,7 @@ void LinkManager::Remove( sal_uInt16 nPos, sal_uInt16 nCnt )
sal_Bool LinkManager::Insert( SvBaseLink* pLink )
{
- for( sal_uInt16 n = 0; n < aLinkTbl.size(); ++n )
+ for( size_t n = 0; n < aLinkTbl.size(); ++n )
{
SvBaseLinkRef* pTmp = aLinkTbl[ n ];
if( !pTmp->Is() )
@@ -308,8 +308,7 @@ void LinkManager::UpdateAllLinks(
// First make a copy of the array in order to update links
// links in ... no contact between them!
std::vector<SvBaseLink*> aTmpArr;
- sal_uInt16 n;
- for( n = 0; n < aLinkTbl.size(); ++n )
+ for( size_t n = 0; n < aLinkTbl.size(); ++n )
{
SvBaseLink* pLink = *aLinkTbl[ n ];
if( !pLink )
@@ -320,20 +319,20 @@ void LinkManager::UpdateAllLinks(
aTmpArr.push_back( pLink );
}
- for( n = 0; n < aTmpArr.size(); ++n )
+ for( size_t n = 0; n < aTmpArr.size(); ++n )
{
SvBaseLink* pLink = aTmpArr[ n ];
// search first in the array after the entry
- sal_uInt16 nFndPos = USHRT_MAX;
- for( sal_uInt16 i = 0; i < aLinkTbl.size(); ++i )
+ bool bFound = false;
+ for( size_t i = 0; i < aLinkTbl.size(); ++i )
if( pLink == *aLinkTbl[ i ] )
{
- nFndPos = i;
+ bFound = true;
break;
}
- if( USHRT_MAX == nFndPos )
+ if( !bFound )
continue; // was not available!
// Graphic-Links not to update yet
@@ -421,9 +420,9 @@ void LinkManager::ReconnectDdeLink(SfxObjectShell& rServer)
return;
const ::sfx2::SvBaseLinks& rLinks = GetLinks();
- sal_uInt16 n = rLinks.size();
+ size_t n = rLinks.size();
- for (sal_uInt16 i = 0; i < n; ++i)
+ for (size_t i = 0; i < n; ++i)
{
::sfx2::SvBaseLink* p = *rLinks[i];
String aType, aFile, aLink, aFilter;
@@ -515,7 +514,7 @@ void LinkManager::CancelTransfers()
sfx2::SvBaseLink* pLnk;
const sfx2::SvBaseLinks& rLnks = GetLinks();
- for( sal_uInt16 n = rLnks.size(); n; )
+ for( size_t n = rLnks.size(); n; )
if( 0 != ( pLnk = &(*rLnks[ --n ])) &&
OBJECT_CLIENT_FILE == (OBJECT_CLIENT_FILE & pLnk->GetObjType()) &&
0 != ( pFileObj = (SvFileObject*)pLnk->GetObj() ) )