clang-tidy modernize-loop-convert in b*

Change-Id: I8ac6eb59e213eafa78e3dc4578738b53e8adef5b
This commit is contained in:
Noel Grandin
2016-04-21 10:27:17 +02:00
parent b19ac3c4c6
commit 8762aa986d
15 changed files with 40 additions and 50 deletions
@@ -149,9 +149,9 @@ AccessibleDialogWindow::~AccessibleDialogWindow()
void AccessibleDialogWindow::UpdateFocused()
{
for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i )
for (ChildDescriptor & i : m_aAccessibleChildren)
{
Reference< XAccessible > xChild( m_aAccessibleChildren[i].rxAccessible );
Reference< XAccessible > xChild( i.rxAccessible );
if ( xChild.is() )
{
AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() );
@@ -166,9 +166,9 @@ void AccessibleDialogWindow::UpdateSelected()
{
NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i )
for (ChildDescriptor & i : m_aAccessibleChildren)
{
Reference< XAccessible > xChild( m_aAccessibleChildren[i].rxAccessible );
Reference< XAccessible > xChild( i.rxAccessible );
if ( xChild.is() )
{
AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() );
@@ -181,9 +181,9 @@ void AccessibleDialogWindow::UpdateSelected()
void AccessibleDialogWindow::UpdateBounds()
{
for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i )
for (ChildDescriptor & i : m_aAccessibleChildren)
{
Reference< XAccessible > xChild( m_aAccessibleChildren[i].rxAccessible );
Reference< XAccessible > xChild( i.rxAccessible );
if ( xChild.is() )
{
AccessibleDialogControlShape* pShape = static_cast< AccessibleDialogControlShape* >( xChild.get() );
@@ -413,9 +413,9 @@ void AccessibleDialogWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindo
m_pDlgEdModel = nullptr;
// dispose all children
for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i )
for (ChildDescriptor & i : m_aAccessibleChildren)
{
Reference< XComponent > xComponent( m_aAccessibleChildren[i].rxAccessible, UNO_QUERY );
Reference< XComponent > xComponent( i.rxAccessible, UNO_QUERY );
if ( xComponent.is() )
xComponent->dispose();
}
@@ -562,9 +562,9 @@ void AccessibleDialogWindow::disposing()
m_pDlgEdModel = nullptr;
// dispose all children
for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i )
for (ChildDescriptor & i : m_aAccessibleChildren)
{
Reference< XComponent > xComponent( m_aAccessibleChildren[i].rxAccessible, UNO_QUERY );
Reference< XComponent > xComponent( i.rxAccessible, UNO_QUERY );
if ( xComponent.is() )
xComponent->dispose();
}
+2 -2
View File
@@ -890,9 +890,9 @@ void EditorWindow::SetupAndShowCodeCompleteWnd( const std::vector< OUString >& a
// clear the listbox
pCodeCompleteWnd->ClearListBox();
// fill the listbox
for(size_t l = 0; l < aEntryVect.size(); ++l)
for(const auto & l : aEntryVect)
{
pCodeCompleteWnd->InsertEntry( aEntryVect[l] );
pCodeCompleteWnd->InsertEntry( l );
}
// show it
pCodeCompleteWnd->Show();
+2 -4
View File
@@ -193,9 +193,8 @@ SbxVariable* TreeListBox::FindVariable( SvTreeListEntry* pEntry )
if ( !aEntries.empty() )
{
bool bDocumentObjects = false;
for ( size_t n = 0; n < aEntries.size(); n++ )
for (SvTreeListEntry* pLE : aEntries)
{
SvTreeListEntry* pLE = aEntries[n];
assert(pLE && "Can not find entry in array");
Entry* pBE = static_cast<Entry*>(pLE->GetUserData());
assert(pBE && "The data in the entry not found!");
@@ -296,9 +295,8 @@ EntryDescriptor TreeListBox::GetEntryDescriptor( SvTreeListEntry* pEntry )
if ( !aEntries.empty() )
{
for ( size_t n = 0; n < aEntries.size(); n++ )
for (SvTreeListEntry* pLE : aEntries)
{
SvTreeListEntry* pLE = aEntries[n];
assert(pLE && "Entrie im Array nicht gefunden");
Entry* pBE = static_cast<Entry*>(pLE->GetUserData());
assert(pBE && "Keine Daten im Eintrag gefunden!");
+5 -8
View File
@@ -42,8 +42,8 @@ BreakPointList::~BreakPointList()
void BreakPointList::reset()
{
for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i )
delete maBreakPoints[ i ];
for (BreakPoint* maBreakPoint : maBreakPoints)
delete maBreakPoint;
maBreakPoints.clear();
}
@@ -74,9 +74,8 @@ void BreakPointList::SetBreakPointsInBasic(SbModule* pModule)
{
pModule->ClearAllBP();
for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i )
for (BreakPoint* pBrk : maBreakPoints)
{
BreakPoint* pBrk = maBreakPoints[ i ];
if ( pBrk->bEnabled )
pModule->SetBP( (sal_uInt16)pBrk->nLine );
}
@@ -84,9 +83,8 @@ void BreakPointList::SetBreakPointsInBasic(SbModule* pModule)
BreakPoint* BreakPointList::FindBreakPoint(size_t nLine)
{
for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i )
for (BreakPoint* pBrk : maBreakPoints)
{
BreakPoint* pBrk = maBreakPoints[ i ];
if ( pBrk->nLine == nLine )
return pBrk;
}
@@ -127,9 +125,8 @@ void BreakPointList::AdjustBreakPoints(size_t nLine, bool bInserted)
void BreakPointList::ResetHitCount()
{
for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i )
for (BreakPoint* pBrk : maBreakPoints)
{
BreakPoint* pBrk = maBreakPoints[ i ];
pBrk->nHitCount = 0;
}
}
+3 -3
View File
@@ -145,9 +145,9 @@ namespace basctl
{ "OnModeChanged", &DocumentEventListener::onDocumentModeChanged }
};
for ( size_t i=0; i < SAL_N_ELEMENTS( aEvents ); ++i )
for (EventEntry & aEvent : aEvents)
{
if ( !_rEvent.EventName.equalsAscii( aEvents[i].pEventName ) )
if ( !_rEvent.EventName.equalsAscii( aEvent.pEventName ) )
continue;
ScriptDocument aDocument( xDocument );
@@ -162,7 +162,7 @@ namespace basctl
// somebody took the chance to dispose us -> bail out
return;
(m_pListener->*aEvents[i].listenerMethod)( aDocument );
(m_pListener->*aEvent.listenerMethod)( aDocument );
}
break;
}
+2 -2
View File
@@ -828,8 +828,8 @@ namespace basegfx
else
{
// the last triangle has not been altered, simply copy to result
for(sal_uInt32 i=0; i<3; ++i)
aResult.append(stack[i]);
for(basegfx::B2DPoint & i : stack)
aResult.append(i);
}
}
}
@@ -412,9 +412,8 @@ namespace basegfx
}
// append remapped tempVector entries for edge to tempPoints for edge
for(size_t a(0); a < aTempPointVectorEdge.size(); a++)
for(temporaryPoint & rTempPoint : aTempPointVectorEdge)
{
const temporaryPoint& rTempPoint = aTempPointVectorEdge[a];
rTempPointsB.push_back(temporaryPoint(rTempPoint.getPoint(), nIndB, rTempPoint.getCut()));
}
}
+2 -2
View File
@@ -105,9 +105,9 @@ public:
void setClosed(bool bNew)
{
for(size_t a(0); a < maPolygons.size(); a++)
for(basegfx::B2DPolygon & maPolygon : maPolygons)
{
maPolygons[a].setClosed(bNew);
maPolygon.setClosed(bNew);
}
}
@@ -1038,9 +1038,9 @@ namespace basegfx
B2DPolyPolygonVector aResult;
aResult.reserve(aInput.size());
for(size_t a(0); a < aInput.size(); a++)
for(basegfx::B2DPolyPolygon & a : aInput)
{
const basegfx::B2DPolyPolygon aCandidate(prepareForPolygonOperation(aInput[a]));
const basegfx::B2DPolyPolygon aCandidate(prepareForPolygonOperation(a));
if(!aResult.empty())
{
+1 -2
View File
@@ -423,10 +423,9 @@ namespace basegfx
// there were horizontal edges. These can be excluded, but
// cuts with other edges need to be solved and added before
// ignoring them
for(size_t a = 0; a < rTrDeSimpleEdges.size(); a++)
for(TrDeSimpleEdge & rHorEdge : rTrDeSimpleEdges)
{
// get horizontal edge as candidate; prepare its range and fixed Y
const TrDeSimpleEdge& rHorEdge = rTrDeSimpleEdges[a];
const B1DRange aRange(rHorEdge.getStart().getX(), rHorEdge.getEnd().getX());
const double fFixedY(rHorEdge.getStart().getY());
+2 -2
View File
@@ -133,8 +133,8 @@ SbiParser::SbiParser( StarBASIC* pb, SbModule* pm )
bClassModule = ( pm->GetModuleType() == css::script::ModuleType::CLASS );
OSL_TRACE("Parser - %s, bClassModule %d", OUStringToOString( pm->GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), bClassModule );
pPool = &aPublics;
for( short i = 0; i < 26; i++ )
eDefTypes[ i ] = SbxVARIANT; // no explicit default type
for(SbxDataType & eDefType : eDefTypes)
eDefType = SbxVARIANT; // no explicit default type
aPublics.SetParent( &aGlobals );
aGlobals.SetParent( &aRtlSyms );
+3 -4
View File
@@ -245,12 +245,11 @@ sal_uInt32 SbiSymPool::Reference( const OUString& rName )
void SbiSymPool::CheckRefs()
{
for (size_t i = 0; i < m_Data.size(); ++i)
for (std::unique_ptr<SbiSymDef> & r : m_Data)
{
SbiSymDef &r = *m_Data[ i ];
if( !r.IsDefined() )
if( !r->IsDefined() )
{
pParser->Error( ERRCODE_BASIC_UNDEF_LABEL, r.GetName() );
pParser->Error( ERRCODE_BASIC_UNDEF_LABEL, r->GetName() );
}
}
}
+1 -3
View File
@@ -138,10 +138,8 @@ SbError SbiDdeControl::Terminate( size_t nChannel )
SbError SbiDdeControl::TerminateAll()
{
for (size_t nChannel = 0; nChannel < aConvList.size(); ++nChannel)
for (DdeConnection* conv : aConvList)
{
DdeConnection *conv = aConvList[nChannel];
if (conv != DDE_FREECHANNEL)
{
delete conv;
+2 -2
View File
@@ -657,9 +657,9 @@ SbError SbiStream::Write( const OString& rBuf )
SbiIoSystem::SbiIoSystem()
{
for( short i = 0; i < CHANNELS; i++ )
for(SbiStream* & i : pChan)
{
pChan[ i ] = nullptr;
i = nullptr;
}
nChan = 0;
nError = 0;
+2 -2
View File
@@ -60,9 +60,9 @@ const OUString & SAL_CALL cppu_cppenv_getStaticOIdPart()
// good guid
sal_uInt8 ar[16];
::rtl_getGlobalProcessId( ar );
for ( sal_Int32 i = 0; i < 16; ++i )
for (unsigned char i : ar)
{
aRet.append( (sal_Int32)ar[i], 16 );
aRet.append( (sal_Int32)i, 16 );
}
#if (defined(__GNUC__) && defined(__APPLE__))
s_pStaticOidPart = new OUString( aRet.makeStringAndClear() );