[Libreoffice-commits] core.git: sfx2/source
Stephan Bergmann
sbergman at redhat.com
Wed Mar 8 10:00:27 UTC 2017
sfx2/source/appl/workwin.cxx | 34 ++++++++++++++++------------------
sfx2/source/control/bindings.cxx | 2 +-
sfx2/source/control/msgpool.cxx | 13 +++++++------
sfx2/source/dialog/splitwin.cxx | 15 ++++++---------
sfx2/source/doc/docfile.cxx | 4 ++--
sfx2/source/doc/objxtor.cxx | 2 +-
sfx2/source/view/viewfrm.cxx | 2 +-
sfx2/source/view/viewsh.cxx | 2 +-
8 files changed, 35 insertions(+), 39 deletions(-)
New commits:
commit 6271381baa0d2db257070cb7ecfc9abf89faaf0f
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Mar 8 10:59:43 2017 +0100
loplugin:loopvartoosmall
Change-Id: I788afd92bb404d8faf96b631d2e7c6f869e49c2d
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 4ea26b0..867e38d 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -441,7 +441,7 @@ void SfxWorkWindow::Sort_Impl()
SfxChild_Impl *pCli = aChildren[i];
if (pCli)
{
- sal_uInt16 k;
+ decltype(aSortedList)::size_type k;
for (k=0; k<aSortedList.size(); k++)
if (ChildAlignValue( aChildren[aSortedList[k]]->eAlign ) >
ChildAlignValue(pCli->eAlign))
@@ -884,7 +884,7 @@ void SfxWorkWindow::ReleaseChild_Impl( vcl::Window& rWindow )
{
SfxChild_Impl *pChild = nullptr;
- sal_uInt16 nPos;
+ decltype(aChildren)::size_type nPos;
for ( nPos = 0; nPos < aChildren.size(); ++nPos )
{
pChild = aChildren[nPos];
@@ -980,12 +980,11 @@ void SfxWorkWindow::HideChildren_Impl()
void SfxWorkWindow::ResetObjectBars_Impl()
{
- sal_uInt16 n;
- for ( n = 0; n < aObjBarList.size(); n++ )
- aObjBarList[n].bDestroy = true;
+ for ( auto & n: aObjBarList )
+ n.bDestroy = true;
- for ( n = 0; n < aChildWins.size(); ++n )
- aChildWins[n]->nId = 0;
+ for ( auto & n: aChildWins )
+ n->nId = 0;
}
void SfxWorkWindow::SetObjectBar_Impl(sal_uInt16 nPos, SfxVisibilityFlags nFlags, sal_uInt32 nResId,
@@ -1154,8 +1153,7 @@ void SfxWorkWindow::UpdateObjectBars_Impl2()
{
// Lock SplitWindows (which means suppressing the Resize-Reaction of the
// DockingWindows)
- sal_uInt16 n;
- for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
+ for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
{
VclPtr<SfxSplitWindow> const & p = pSplit[n];
if (p->GetWindowCount())
@@ -1186,13 +1184,13 @@ void SfxWorkWindow::UpdateObjectBars_Impl2()
// Iterate over all Toolboxes
xLayoutManager->lock();
- for ( n = 0; n < aObjBarList.size(); ++n )
+ for ( auto const & n: aObjBarList )
{
- sal_uInt16 nId = aObjBarList[n].nId;
- bool bDestroy = aObjBarList[n].bDestroy;
+ sal_uInt16 nId = n.nId;
+ bool bDestroy = n.bDestroy;
// Determine the valid mode for the ToolBox
- SfxVisibilityFlags nTbxMode = aObjBarList[n].nMode;
+ SfxVisibilityFlags nTbxMode = n.nMode;
bool bFullScreenTbx( nTbxMode & SfxVisibilityFlags::FullScreen );
nTbxMode &= ~SfxVisibilityFlags::FullScreen;
nTbxMode &= ~SfxVisibilityFlags::Viewer;
@@ -1202,14 +1200,14 @@ void SfxWorkWindow::UpdateObjectBars_Impl2()
if ( bDestroy )
{
OUString aTbxId( m_aTbxTypeName );
- aTbxId += GetResourceURLFromResId( aObjBarList[n].nId );
+ aTbxId += GetResourceURLFromResId( nId );
xLayoutManager->destroyElement( aTbxId );
}
else if ( nId != 0 && ( ( bModesMatching && !bIsFullScreen ) ||
( bIsFullScreen && bFullScreenTbx ) ) )
{
OUString aTbxId( m_aTbxTypeName );
- aTbxId += GetResourceURLFromResId( aObjBarList[n].nId );
+ aTbxId += GetResourceURLFromResId( nId );
if ( !IsDockingAllowed() && !xLayoutManager->isElementFloating( aTbxId ))
xLayoutManager->destroyElement( aTbxId );
else
@@ -1223,7 +1221,7 @@ void SfxWorkWindow::UpdateObjectBars_Impl2()
{
// Delete the Toolbox at this Position if possible
OUString aTbxId( m_aTbxTypeName );
- aTbxId += GetResourceURLFromResId( aObjBarList[n].nId );
+ aTbxId += GetResourceURLFromResId( nId );
xLayoutManager->destroyElement( aTbxId );
}
}
@@ -1236,7 +1234,7 @@ void SfxWorkWindow::UpdateObjectBars_Impl2()
UpdateChildWindows_Impl();
// Unlock the SplitWindows again
- for ( n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
+ for ( sal_uInt16 n=0; n<SFX_SPLITWINDOWS_MAX; n++ )
{
VclPtr<SfxSplitWindow> const & p = pSplit[n];
if (p->GetWindowCount())
@@ -1584,7 +1582,7 @@ void SfxWorkWindow::ConfigChild_Impl(SfxChildIdentifier eChild,
// windows may have been registered and released without an update until now
Sort_Impl();
- sal_uInt16 n;
+ decltype(aSortedList)::size_type n;
for ( n=0; n<aSortedList.size(); ++n )
{
SfxChild_Impl *pChild = aChildren[aSortedList[n]];
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index c72f303..bf9ce8d 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -1319,7 +1319,7 @@ SfxItemSet* SfxBindings::CreateSet_Impl
// Create a Set from the ranges
std::unique_ptr<sal_uInt16[]> pRanges(new sal_uInt16[rFound.size() * 2 + 1]);
int j = 0;
- sal_uInt16 i = 0;
+ size_t i = 0;
while ( i < rFound.size() )
{
pRanges[j++] = rFound[i].nWhichId;
diff --git a/sfx2/source/control/msgpool.cxx b/sfx2/source/control/msgpool.cxx
index b771e1e..adbb0e6 100644
--- a/sfx2/source/control/msgpool.cxx
+++ b/sfx2/source/control/msgpool.cxx
@@ -285,12 +285,13 @@ SfxInterface* SfxSlotPool::FirstInterface()
const SfxSlot* SfxSlotPool::GetUnoSlot( const OUString& rName )
{
const SfxSlot *pSlot = nullptr;
- for (sal_uInt16 nInterface = 0; _pInterfaces && nInterface < _pInterfaces->size(); ++nInterface)
- {
- pSlot = (*_pInterfaces)[nInterface]->GetSlot( rName );
- if ( pSlot )
- break;
- }
+ if (_pInterfaces)
+ for (auto const & nInterface: *_pInterfaces)
+ {
+ pSlot = nInterface->GetSlot( rName );
+ if ( pSlot )
+ break;
+ }
if ( !pSlot && _pParentPool )
pSlot = _pParentPool->GetUnoSlot( rName );
diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx
index 35bbc1c..2c817be 100644
--- a/sfx2/source/dialog/splitwin.cxx
+++ b/sfx2/source/dialog/splitwin.cxx
@@ -311,25 +311,22 @@ void SfxSplitWindow::SaveConfig_Impl()
aWinData.append(',');
sal_uInt16 nCount = 0;
- sal_uInt16 n;
- for ( n=0; n<pDockArr->size(); n++ )
+ for ( auto const & rDock: *pDockArr )
{
- const SfxDock_Impl& rDock = *(*pDockArr)[n].get();
- if ( rDock.bHide || rDock.pWin )
+ if ( rDock->bHide || rDock->pWin )
nCount++;
}
aWinData.append(static_cast<sal_Int32>(nCount));
- for ( n=0; n<pDockArr->size(); n++ )
+ for ( auto const & rDock: *pDockArr )
{
- const SfxDock_Impl& rDock = *(*pDockArr)[n].get();
- if ( !rDock.bHide && !rDock.pWin )
+ if ( !rDock->bHide && !rDock->pWin )
continue;
- if ( rDock.bNewLine )
+ if ( rDock->bNewLine )
aWinData.append(",0");
aWinData.append(',');
- aWinData.append(static_cast<sal_Int32>(rDock.nType));
+ aWinData.append(static_cast<sal_Int32>(rDock->nType));
}
OUString aWindowId("SplitWindow");
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index a53ca5e..aae4e62 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -3228,9 +3228,9 @@ void SfxMedium::AddVersion_Impl( util::RevisionTag& rRevision )
aLongs.insert( aLongs.begin()+n, nVer );
}
- sal_uInt16 nKey;
+ std::vector<sal_uInt32>::size_type nKey;
for ( nKey=0; nKey<aLongs.size(); ++nKey )
- if ( aLongs[nKey] > ( sal_uIntPtr ) nKey+1 )
+ if ( aLongs[nKey] > nKey+1 )
break;
OUString aRevName = "Version" + OUString::number( nKey + 1 );
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 78b8126b..5cd1609 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -490,7 +490,7 @@ SfxObjectShell* SfxObjectShell::GetNext
SfxObjectShellArr_Impl &rDocs = SfxGetpApp()->GetObjectShells_Impl();
// refind the specified predecessor
- sal_uInt16 nPos;
+ size_t nPos;
for ( nPos = 0; nPos < rDocs.size(); ++nPos )
if ( rDocs[nPos] == &rPrev )
break;
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 9819022..818a519 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1506,7 +1506,7 @@ SfxViewFrame* SfxViewFrame::GetNext
SfxViewFrameArr_Impl &rFrames = pSfxApp->GetViewFrames_Impl();
// refind the specified predecessor
- sal_uInt16 nPos;
+ size_t nPos;
for ( nPos = 0; nPos < rFrames.size(); ++nPos )
if ( rFrames[nPos] == &rPrev )
break;
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index eaaaa99..9053ebe 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -1365,7 +1365,7 @@ SfxViewShell* SfxViewShell::GetNext
{
SfxViewShellArr_Impl &rShells = SfxGetpApp()->GetViewShells_Impl();
SfxViewFrameArr_Impl &rFrames = SfxGetpApp()->GetViewFrames_Impl();
- sal_uInt16 nPos;
+ size_t nPos;
for ( nPos = 0; nPos < rShells.size(); ++nPos )
if ( rShells[nPos] == &rPrev )
break;
More information about the Libreoffice-commits
mailing list