diff options
author | Noel Grandin <noel@peralex.com> | 2016-04-21 10:26:48 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-04-21 10:27:17 +0200 |
commit | 8762aa986dbca42e61cc8fb1b2c1d2ca66bcfcbe (patch) | |
tree | af1f197feb0a40e819cc4ed74efce934935c9cae | |
parent | b19ac3c4c6b4a41a1f3acac68b299fd676428a87 (diff) |
clang-tidy modernize-loop-convert in b*
Change-Id: I8ac6eb59e213eafa78e3dc4578738b53e8adef5b
-rw-r--r-- | basctl/source/accessibility/accessibledialogwindow.cxx | 20 | ||||
-rw-r--r-- | basctl/source/basicide/baside2b.cxx | 4 | ||||
-rw-r--r-- | basctl/source/basicide/bastype3.cxx | 6 | ||||
-rw-r--r-- | basctl/source/basicide/breakpoint.cxx | 13 | ||||
-rw-r--r-- | basctl/source/basicide/doceventnotifier.cxx | 6 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dpolygonclipper.cxx | 4 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dpolygoncutandtouch.cxx | 3 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dpolypolygon.cxx | 4 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dpolypolygoncutter.cxx | 4 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dtrapezoid.cxx | 3 | ||||
-rw-r--r-- | basic/source/comp/parser.cxx | 4 | ||||
-rw-r--r-- | basic/source/comp/symtbl.cxx | 7 | ||||
-rw-r--r-- | basic/source/runtime/ddectrl.cxx | 4 | ||||
-rw-r--r-- | basic/source/runtime/iosys.cxx | 4 | ||||
-rw-r--r-- | bridges/source/cpp_uno/shared/component.cxx | 4 |
15 files changed, 40 insertions, 50 deletions
diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx index 13f104da08ca..dc56db4a6dbc 100644 --- a/basctl/source/accessibility/accessibledialogwindow.cxx +++ b/basctl/source/accessibility/accessibledialogwindow.cxx @@ -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(); } diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index f612545d159c..23713427e333 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -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(); diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx index 071ebafd6630..98782ea06088 100644 --- a/basctl/source/basicide/bastype3.cxx +++ b/basctl/source/basicide/bastype3.cxx @@ -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!"); diff --git a/basctl/source/basicide/breakpoint.cxx b/basctl/source/basicide/breakpoint.cxx index 5c59bea38d5a..31321fecbf88 100644 --- a/basctl/source/basicide/breakpoint.cxx +++ b/basctl/source/basicide/breakpoint.cxx @@ -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; } } diff --git a/basctl/source/basicide/doceventnotifier.cxx b/basctl/source/basicide/doceventnotifier.cxx index 9fa70649d4b9..872cb64e05b9 100644 --- a/basctl/source/basicide/doceventnotifier.cxx +++ b/basctl/source/basicide/doceventnotifier.cxx @@ -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; } diff --git a/basegfx/source/polygon/b2dpolygonclipper.cxx b/basegfx/source/polygon/b2dpolygonclipper.cxx index d8123edcd881..7b4916993c0b 100644 --- a/basegfx/source/polygon/b2dpolygonclipper.cxx +++ b/basegfx/source/polygon/b2dpolygonclipper.cxx @@ -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); } } } diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx index e72c6ba6b7e5..22ee49622b78 100644 --- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx +++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx @@ -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())); } } diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx index f58dceca6c7a..2f7106608f50 100644 --- a/basegfx/source/polygon/b2dpolypolygon.cxx +++ b/basegfx/source/polygon/b2dpolypolygon.cxx @@ -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); } } diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx index 3332976e9768..e7bf5a0ba246 100644 --- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx +++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx @@ -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()) { diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx index e36d2af4930d..f25b7bfb884e 100644 --- a/basegfx/source/polygon/b2dtrapezoid.cxx +++ b/basegfx/source/polygon/b2dtrapezoid.cxx @@ -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()); diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx index a26f5e6e0e62..87af41228bce 100644 --- a/basic/source/comp/parser.cxx +++ b/basic/source/comp/parser.cxx @@ -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 ); diff --git a/basic/source/comp/symtbl.cxx b/basic/source/comp/symtbl.cxx index 7d9692634b26..94f1be350434 100644 --- a/basic/source/comp/symtbl.cxx +++ b/basic/source/comp/symtbl.cxx @@ -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() ); } } } diff --git a/basic/source/runtime/ddectrl.cxx b/basic/source/runtime/ddectrl.cxx index 4e965d3c9a84..384d19dd8ade 100644 --- a/basic/source/runtime/ddectrl.cxx +++ b/basic/source/runtime/ddectrl.cxx @@ -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; diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index 8e72688392fc..f08edc8d0061 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -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; diff --git a/bridges/source/cpp_uno/shared/component.cxx b/bridges/source/cpp_uno/shared/component.cxx index 02b683861c66..97a0214f6705 100644 --- a/bridges/source/cpp_uno/shared/component.cxx +++ b/bridges/source/cpp_uno/shared/component.cxx @@ -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() ); |