summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-12 10:06:27 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-13 08:09:28 +0000
commitf12b17867ef8fa2cfc2ddb7ecda9d7acc57cfa59 (patch)
tree3b0a89e34cfca550b38b92423a1de4b805d2c91c
parent96fab0513215cc416e96e1b2089466afd0d2791c (diff)
clang-tidy modernize-loop-convert in vcl
Change-Id: I79e97a4826bfe3918de223cccf48646a1404f901 Reviewed-on: https://gerrit.libreoffice.org/24922 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--vcl/headless/svpgdi.cxx4
-rw-r--r--vcl/opengl/gdiimpl.cxx26
-rw-r--r--vcl/opengl/salbmp.cxx6
-rw-r--r--vcl/source/app/brand.cxx4
-rw-r--r--vcl/source/app/idlemgr.cxx3
-rw-r--r--vcl/source/bitmap/CommandImageResolver.cxx14
-rw-r--r--vcl/source/control/morebtn.cxx8
-rw-r--r--vcl/source/edit/texteng.cxx12
-rw-r--r--vcl/source/filter/wmf/wmfwr.cxx4
-rw-r--r--vcl/source/gdi/animate.cxx46
-rw-r--r--vcl/source/gdi/gdimtf.cxx4
-rw-r--r--vcl/source/gdi/octree.cxx12
-rw-r--r--vcl/source/gdi/pdfextoutdevdata.cxx6
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx18
-rw-r--r--vcl/source/gdi/print.cxx18
-rw-r--r--vcl/source/gdi/print3.cxx6
-rw-r--r--vcl/source/glyphs/graphite_layout.cxx12
-rw-r--r--vcl/source/image/ImageList.cxx4
-rw-r--r--vcl/source/window/accel.cxx7
-rw-r--r--vcl/source/window/accmgr.cxx15
-rw-r--r--vcl/source/window/debugevent.cxx6
-rw-r--r--vcl/source/window/layout.cxx4
-rw-r--r--vcl/source/window/menuitemlist.cxx4
-rw-r--r--vcl/source/window/status.cxx19
-rw-r--r--vcl/source/window/toolbox.cxx17
-rw-r--r--vcl/unx/generic/app/keysymnames.cxx8
-rw-r--r--vcl/unx/generic/app/randrwrapper.cxx12
-rw-r--r--vcl/unx/generic/app/saldisp.cxx4
-rw-r--r--vcl/unx/generic/app/wmadaptor.cxx24
-rw-r--r--vcl/unx/generic/fontmanager/fontmanager.cxx16
-rw-r--r--vcl/unx/generic/gdi/cairotextrender.cxx4
-rw-r--r--vcl/unx/generic/gdi/salgdi.cxx4
-rw-r--r--vcl/unx/generic/print/genprnpsp.cxx6
-rw-r--r--vcl/unx/generic/print/genpspgraphics.cxx4
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx10
-rw-r--r--vcl/unx/generic/printer/printerinfomanager.cxx8
-rw-r--r--vcl/unx/generic/window/salframe.cxx23
-rw-r--r--vcl/unx/gtk/a11y/atktextattributes.cxx4
-rw-r--r--vcl/unx/gtk/fpicker/resourceprovider.cxx6
-rw-r--r--vcl/unx/gtk/gtksalmenu.cxx3
40 files changed, 199 insertions, 216 deletions
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index f8a30974b5dc..2cbfb23360c7 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -837,8 +837,8 @@ void SvpSalGraphics::setupPolyPolygon(cairo_t* cr, const basegfx::B2DPolyPolygon
{
clipRegion(cr);
- for (const basegfx::B2DPolygon* pPoly = rPolyPoly.begin(); pPoly != rPolyPoly.end(); ++pPoly)
- AddPolygonToPath(cr, *pPoly, true, !getAntiAliasB2DDraw(), m_aLineColor != SALCOLOR_NONE);
+ for (const auto & rPoly : rPolyPoly)
+ AddPolygonToPath(cr, rPoly, true, !getAntiAliasB2DDraw(), m_aLineColor != SALCOLOR_NONE);
}
bool SvpSalGraphics::drawPolyPolygon(const basegfx::B2DPolyPolygon& rPolyPoly, double fTransparency)
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 2edeaaa5c17f..904834472a51 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -1335,8 +1335,8 @@ void OpenGLSalGraphicsImpl::DrawPolyPolygon( const basegfx::B2DPolyPolygon& rPol
// draw tesselation result
if( aB2DTrapVector.size())
{
- for( size_t i = 0; i < aB2DTrapVector.size(); ++i )
- DrawTrapezoid( aB2DTrapVector[ i ], blockAA );
+ for(basegfx::B2DTrapezoid & i : aB2DTrapVector)
+ DrawTrapezoid( i, blockAA );
}
}
@@ -1355,16 +1355,16 @@ void OpenGLSalGraphicsImpl::DrawRegionBand( const RegionBand& rRegion )
aVertices.push_back(GLfloat(pt.X())); \
aVertices.push_back(GLfloat(pt.Y()));
- for( size_t i = 0; i < aRects.size(); ++i )
+ for(Rectangle & rRect : aRects)
{
- aRects[i].Bottom() += 1;
- aRects[i].Right() += 1;
- ADD_VERTICE( aRects[i].TopLeft() );
- ADD_VERTICE( aRects[i].TopRight() );
- ADD_VERTICE( aRects[i].BottomLeft() );
- ADD_VERTICE( aRects[i].BottomLeft() );
- ADD_VERTICE( aRects[i].TopRight() );
- ADD_VERTICE( aRects[i].BottomRight() );
+ rRect.Bottom() += 1;
+ rRect.Right() += 1;
+ ADD_VERTICE( rRect.TopLeft() );
+ ADD_VERTICE( rRect.TopRight() );
+ ADD_VERTICE( rRect.BottomLeft() );
+ ADD_VERTICE( rRect.BottomLeft() );
+ ADD_VERTICE( rRect.TopRight() );
+ ADD_VERTICE( rRect.BottomRight() );
}
#undef ADD_VERTICE
@@ -2033,8 +2033,8 @@ bool OpenGLSalGraphicsImpl::drawPolyPolygon( const basegfx::B2DPolyPolygon& rPol
{
basegfx::B2DTrapezoidVector aB2DTrapVector;
basegfx::tools::createLineTrapezoidFromB2DPolyPolygon( aB2DTrapVector, rPolyPolygon );
- for( size_t i = 0; i < aB2DTrapVector.size(); ++i )
- DrawTrapezoid( aB2DTrapVector[ i ] );
+ for(basegfx::B2DTrapezoid & i : aB2DTrapVector)
+ DrawTrapezoid( i );
}
PostDraw();
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index b9b7a5f0b457..e317004c9470 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -402,11 +402,11 @@ void lclInstantiateTexture(OpenGLTexture& rTexture, const int nWidth, const int
sTextureAtlases.push_back(std::unique_ptr<FixedTextureAtlasManager>(new FixedTextureAtlasManager(8, 8, 48)));
sTextureAtlases.push_back(std::unique_ptr<FixedTextureAtlasManager>(new FixedTextureAtlasManager(8, 8, 64)));
}
- for (size_t i = 0; i < sTextureAtlases.size(); i++)
+ for (std::unique_ptr<FixedTextureAtlasManager> & pTextureAtlas : sTextureAtlases)
{
- if (nWidth == sTextureAtlases[i]->GetSubtextureSize())
+ if (nWidth == pTextureAtlas->GetSubtextureSize())
{
- rTexture = sTextureAtlases[i]->InsertBuffer(nWidth, nHeight, nFormat, nType, pData);
+ rTexture = pTextureAtlas->InsertBuffer(nWidth, nHeight, nFormat, nType, pData);
return;
}
}
diff --git a/vcl/source/app/brand.cxx b/vcl/source/app/brand.cxx
index 236ddead72da..3f49c3a38784 100644
--- a/vcl/source/app/brand.cxx
+++ b/vcl/source/app/brand.cxx
@@ -61,9 +61,9 @@ bool Application::LoadBrandBitmap (const char* pName, BitmapEx &rBitmap)
LanguageTag aLanguageTag( *pLoc);
::std::vector< OUString > aFallbacks( aLanguageTag.getFallbackStrings( true));
- for (size_t i=0; i < aFallbacks.size(); ++i)
+ for (const OUString & aFallback : aFallbacks)
{
- if (tryLoadPng( aBaseDir, aBaseName + "-" + aFallbacks[i] + aPng, rBitmap))
+ if (tryLoadPng( aBaseDir, aBaseName + "-" + aFallback + aPng, rBitmap))
return true;
}
diff --git a/vcl/source/app/idlemgr.cxx b/vcl/source/app/idlemgr.cxx
index 31b59e448f00..5e7086e7ff43 100644
--- a/vcl/source/app/idlemgr.cxx
+++ b/vcl/source/app/idlemgr.cxx
@@ -43,8 +43,7 @@ ImplIdleMgr::~ImplIdleMgr()
{
mbInDestruction = true;
// Liste loeschen
- for ( size_t i = 0, n = mpIdleList->size(); i < n; ++i ) {
- ImplIdleData* pIdleData = (*mpIdleList)[ i ];
+ for (ImplIdleData* pIdleData : *mpIdleList) {
pIdleData->maIdleHdl.Call( GetpApp() );
delete pIdleData;
}
diff --git a/vcl/source/bitmap/CommandImageResolver.cxx b/vcl/source/bitmap/CommandImageResolver.cxx
index 94bff8a93042..f9143b072025 100644
--- a/vcl/source/bitmap/CommandImageResolver.cxx
+++ b/vcl/source/bitmap/CommandImageResolver.cxx
@@ -63,14 +63,14 @@ OUString lclConvertToCanonicalName(const OUString& rFileName)
CommandImageResolver::CommandImageResolver()
{
- for (sal_Int32 n = 0; n < ImageType_COUNT; n++)
- m_pImageList[n] = nullptr;
+ for (ImageList*& rp : m_pImageList)
+ rp = nullptr;
}
CommandImageResolver::~CommandImageResolver()
{
- for (sal_Int32 n = 0; n < ImageType_COUNT; n++)
- delete m_pImageList[n];
+ for (ImageList* p : m_pImageList)
+ delete p;
}
bool CommandImageResolver::registerCommands(Sequence<OUString>& aCommandSequence)
@@ -128,10 +128,10 @@ ImageList* CommandImageResolver::getImageList(sal_Int16 nImageType)
if (sIconTheme != m_sIconTheme)
{
m_sIconTheme = sIconTheme;
- for (sal_Int32 n = 0; n < ImageType_COUNT; ++n)
+ for (ImageList*& rp : m_pImageList)
{
- delete m_pImageList[n];
- m_pImageList[n] = nullptr;
+ delete rp;
+ rp = nullptr;
}
}
diff --git a/vcl/source/control/morebtn.cxx b/vcl/source/control/morebtn.cxx
index fa375da538c9..2c529d6bf7fa 100644
--- a/vcl/source/control/morebtn.cxx
+++ b/vcl/source/control/morebtn.cxx
@@ -103,8 +103,8 @@ void MoreButton::Click()
{
// Show window
if ( mpMBData->mpItemList ) {
- for ( size_t i = 0, n = mpMBData->mpItemList->size(); i < n; ++i ) {
- (*mpMBData->mpItemList)[ i ]->Show();
+ for (VclPtr<Window> & i : *mpMBData->mpItemList) {
+ i->Show();
}
}
@@ -133,8 +133,8 @@ void MoreButton::Click()
// Hide window(s) again
if ( mpMBData->mpItemList ) {
- for ( size_t i = 0, n = mpMBData->mpItemList->size(); i < n; ++i ) {
- (*mpMBData->mpItemList)[ i ]->Hide();
+ for (VclPtr<Window> & i : *mpMBData->mpItemList) {
+ i->Hide();
}
}
}
diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx
index 7ddea01bd00b..df1de5bf900a 100644
--- a/vcl/source/edit/texteng.cxx
+++ b/vcl/source/edit/texteng.cxx
@@ -428,9 +428,8 @@ void TextEngine::ImpRemoveText()
ImpInitDoc();
const TextSelection aEmptySel;
- for ( size_t nView = 0; nView < mpViews->size(); nView++ )
+ for (TextView* pView : *mpViews)
{
- TextView* pView = (*mpViews)[ nView ];
pView->ImpSetSelection( aEmptySel );
}
ResetUndo();
@@ -450,9 +449,8 @@ void TextEngine::SetText( const OUString& rText )
if ( !rText.isEmpty() )
aPaM = ImpInsertText( aEmptySel, rText );
- for ( size_t nView = 0; nView < mpViews->size(); nView++ )
+ for (TextView* pView : *mpViews)
{
- TextView* pView = (*mpViews)[ nView ];
pView->ImpSetSelection( aEmptySel );
// if no text, then no Format&Update => the text remains
@@ -889,9 +887,8 @@ Rectangle TextEngine::GetEditCursor( const TextPaM& rPaM, bool bSpecial, bool bP
long nY = 0;
sal_Int32 nCurIndex = 0;
TextLine* pLine = nullptr;
- for ( size_t nLine = 0; nLine < pPortion->GetLines().size(); nLine++ )
+ for (TextLine & rTmpLine : pPortion->GetLines())
{
- TextLine& rTmpLine = pPortion->GetLines()[ nLine ];
if ( ( rTmpLine.GetStart() == rPaM.GetIndex() ) || ( rTmpLine.IsIn( rPaM.GetIndex(), bSpecial ) ) )
{
pLine = &rTmpLine;
@@ -1464,9 +1461,8 @@ void TextEngine::UpdateViews( TextView* pCurView )
DBG_ASSERT( IsFormatted(), "UpdateViews: Doc not formatted!" );
- for ( size_t nView = 0; nView < mpViews->size(); nView++ )
+ for (TextView* pView : *mpViews)
{
- TextView* pView = (*mpViews)[ nView ];
pView->HideCursor();
Rectangle aClipRect( maInvalidRect );
diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index 8e3519f8bc6c..b759697ce4ef 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -1756,8 +1756,8 @@ bool WMFWriter::WriteWMF( const GDIMetaFile& rMTF, SvStream& rTargetStream,
pAttrStack=nullptr;
- for (sal_uInt16 i=0; i<MAXOBJECTHANDLES; i++)
- bHandleAllocated[i]=false;
+ for (bool & rn : bHandleAllocated)
+ rn=false;
nDstPenHandle=0xffff;
nDstFontHandle=0xffff;
diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx
index f540d5a43b60..a6eb4300334e 100644
--- a/vcl/source/gdi/animate.cxx
+++ b/vcl/source/gdi/animate.cxx
@@ -84,8 +84,8 @@ Animation::Animation( const Animation& rAnimation ) :
mbIsWaiting ( rAnimation.mbIsWaiting )
{
- for( size_t i = 0, nCount = rAnimation.maList.size(); i < nCount; i++ )
- maList.push_back( new AnimationBitmap( *rAnimation.maList[ i ] ) );
+ for(const AnimationBitmap* i : rAnimation.maList)
+ maList.push_back( new AnimationBitmap( *i ) );
maTimer.SetTimeoutHdl( LINK( this, Animation, ImplTimeoutHdl ) );
mnLoops = mbLoopTerminated ? 0 : mnLoopCount;
@@ -97,19 +97,19 @@ Animation::~Animation()
if( mbIsInAnimation )
Stop();
- for( size_t i = 0, n = maList.size(); i < n; ++i )
- delete maList[ i ];
+ for(AnimationBitmap* i : maList)
+ delete i;
- for( size_t i = 0, n = maViewList.size(); i < n; ++i )
- delete maViewList[ i ];
+ for(ImplAnimView* i : maViewList)
+ delete i;
}
Animation& Animation::operator=( const Animation& rAnimation )
{
Clear();
- for( size_t i = 0, nCount = rAnimation.maList.size(); i < nCount; i++ )
- maList.push_back( new AnimationBitmap( *rAnimation.maList[ i ] ) );
+ for(const AnimationBitmap* i : rAnimation.maList)
+ maList.push_back( new AnimationBitmap( *i ) );
maGlobalSize = rAnimation.maGlobalSize;
maBitmapEx = rAnimation.maBitmapEx;
@@ -156,12 +156,12 @@ void Animation::Clear()
maGlobalSize = Size();
maBitmapEx.SetEmpty();
- for( size_t i = 0, n = maList.size(); i < n; ++i )
- delete maList[ i ];
+ for(AnimationBitmap* i : maList)
+ delete i;
maList.clear();
- for( size_t i = 0, n = maViewList.size(); i < n; ++i )
- delete maViewList[ i ];
+ for(ImplAnimView* i : maViewList)
+ delete i;
maViewList.clear();
}
@@ -175,10 +175,8 @@ bool Animation::IsTransparent() const
// we need to be transparent, in order to be displayed correctly
// as the application (?) does not invalidate on non-transparent
// graphics due to performance reasons.
- for( size_t i = 0, nCount = maList.size(); i < nCount; i++ )
+ for(const AnimationBitmap* pAnimBmp : maList)
{
- const AnimationBitmap* pAnimBmp = maList[ i ];
-
if( DISPOSE_BACK == pAnimBmp->eDisposal
&& Rectangle( pAnimBmp->aPosPix, pAnimBmp->aSizePix ) != aRect
)
@@ -198,9 +196,8 @@ sal_uLong Animation::GetSizeBytes() const
{
sal_uLong nSizeBytes = GetBitmapEx().GetSizeBytes();
- for( size_t i = 0, nCount = maList.size(); i < nCount; i++ )
+ for(const AnimationBitmap* pAnimBmp : maList)
{
- const AnimationBitmap* pAnimBmp = maList[ i ];
nSizeBytes += pAnimBmp->aBmpEx.GetSizeBytes();
}
@@ -225,9 +222,9 @@ BitmapChecksum Animation::GetChecksum() const
UInt32ToSVBT32( (long) meCycleMode, aBT32 );
nCrc = vcl_get_checksum( nCrc, aBT32, 4 );
- for( size_t i = 0, nCount = maList.size(); i < nCount; i++ )
+ for(const AnimationBitmap* i : maList)
{
- BCToBCOA( maList[ i ]->GetChecksum(), aBCOA );
+ BCToBCOA( i->GetChecksum(), aBCOA );
nCrc = vcl_get_checksum( nCrc, aBCOA, BITMAP_CHECKSUM_SIZE );
}
@@ -366,15 +363,14 @@ IMPL_LINK_NOARG_TYPED(Animation, ImplTimeoutHdl, Timer *, void)
if( maNotifyLink.IsSet() )
{
// create AInfo-List
- for( size_t i = 0, n = maViewList.size(); i < n; ++i )
- aAInfoList.push_back( maViewList[ i ]->createAInfo() );
+ for(ImplAnimView* i : maViewList)
+ aAInfoList.push_back( i->createAInfo() );
maNotifyLink.Call( this );
// set view state from AInfo structure
- for( size_t i = 0, n = aAInfoList.size(); i < n; ++i )
+ for(AInfo* pAInfo : aAInfoList)
{
- AInfo* pAInfo = aAInfoList[ i ];
if( !pAInfo->pViewData )
{
pView = new ImplAnimView( this, pAInfo->pOutDev,
@@ -390,8 +386,8 @@ IMPL_LINK_NOARG_TYPED(Animation, ImplTimeoutHdl, Timer *, void)
}
// delete AInfo structures
- for( size_t i = 0, n = aAInfoList.size(); i < n; ++i )
- delete aAInfoList[ i ];
+ for(AInfo* i : aAInfoList)
+ delete i;
aAInfoList.clear();
// delete all unmarked views and reset marked state
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index dad97c76d165..9185ded909c5 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -257,8 +257,8 @@ void GDIMetaFile::Clear()
if( m_bRecord )
Stop();
- for( size_t i = 0, n = m_aList.size(); i < n; ++i )
- m_aList[ i ]->Delete();
+ for(MetaAction* i : m_aList)
+ i->Delete();
m_aList.clear();
}
diff --git a/vcl/source/gdi/octree.cxx b/vcl/source/gdi/octree.cxx
index bfc96cd46477..e67f1152b165 100644
--- a/vcl/source/gdi/octree.cxx
+++ b/vcl/source/gdi/octree.cxx
@@ -115,10 +115,10 @@ void Octree::ImplCreateOctree()
void Octree::ImplDeleteOctree( NODE** ppNode )
{
- for ( sal_uLong i = 0UL; i < 8UL; i++ )
+ for (OctreeNode* i : (*ppNode)->pChild)
{
- if ( (*ppNode)->pChild[ i ] )
- ImplDeleteOctree( &(*ppNode)->pChild[ i ] );
+ if ( i )
+ ImplDeleteOctree( &i );
}
pNodeCache->ImplReleaseNode( *ppNode );
@@ -209,9 +209,9 @@ void Octree::CreatePalette( NODE* pNode )
(sal_uInt8) ( (double) pNode->nGreen / pNode->nCount ),
(sal_uInt8) ( (double) pNode->nBlue / pNode->nCount ) );
}
- else for( sal_uLong i = 0UL; i < 8UL; i++ )
- if( pNode->pChild[ i ] )
- CreatePalette( pNode->pChild[ i ] );
+ else for(OctreeNode* i : pNode->pChild)
+ if( i )
+ CreatePalette( i );
}
diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx
index a0cab66b76a6..03ed698222b0 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -821,11 +821,11 @@ bool PDFExtOutDevData::HasAdequateCompression( const Graphic &rGraphic,
{ 80, 1500 }, { 75, 1700 }
};
sal_Int32 nTargetRatio = 10000;
- for ( size_t i = 0 ; i < SAL_N_ELEMENTS( aRatios ); ++i )
+ for (auto & rRatio : aRatios)
{
- if ( mnCompressionQuality > aRatios[i].mnQuality )
+ if ( mnCompressionQuality > rRatio.mnQuality )
break;
- nTargetRatio = aRatios[i].mnRatio;
+ nTargetRatio = rRatio.mnRatio;
}
return nCurrentRatio > nTargetRatio;
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index c7a177ced98c..f42f4ef76bc2 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1352,10 +1352,10 @@ bool PDFWriterImpl::PDFPage::emit(sal_Int32 nParentObject )
unsigned int nStreamObjects = m_aStreamObjects.size();
if( nStreamObjects > 1 )
aLine.append( '[' );
- for( size_t i = 0; i < m_aStreamObjects.size(); i++ )
+ for(sal_Int32 i : m_aStreamObjects)
{
aLine.append( ' ' );
- aLine.append( m_aStreamObjects[i] );
+ aLine.append( i );
aLine.append( " 0 R" );
}
if( nStreamObjects > 1 )
@@ -3041,7 +3041,7 @@ static bool getPfbSegmentLengths( const unsigned char* pFontBytes, int nByteLen,
const unsigned char* pPtr = pFontBytes;
const unsigned char* pEnd = pFontBytes + nByteLen;
- for( int i = 0; i < 3; ++i) {
+ for(int & rSegmentLength : rSegmentLengths) {
// read segment1 header
if( pPtr+6 >= pEnd )
return false;
@@ -3050,7 +3050,7 @@ static bool getPfbSegmentLengths( const unsigned char* pFontBytes, int nByteLen,
const int nLen = (pPtr[5]<<24) + (pPtr[4]<<16) + (pPtr[3]<<8) + pPtr[2];
if( nLen <= 0)
return false;
- rSegmentLengths[i] = nLen;
+ rSegmentLength = nLen;
pPtr += nLen + 6;
}
@@ -8013,8 +8013,8 @@ bool PDFWriterImpl::emitTrailer()
{
sal_uInt8 nMD5Sum[ RTL_DIGEST_LENGTH_MD5 ];
rtl_digest_getMD5( m_aDocDigest, nMD5Sum, sizeof(nMD5Sum) );
- for( unsigned int i = 0; i < RTL_DIGEST_LENGTH_MD5; i++ )
- appendHex( nMD5Sum[i], aDocChecksum );
+ for(sal_uInt8 i : nMD5Sum)
+ appendHex( i, aDocChecksum );
}
// document id set in setDocInfo method
// emit trailer
@@ -8063,12 +8063,12 @@ bool PDFWriterImpl::emitTrailer()
if( m_aAdditionalStreams.size() > 0 )
{
aLine.append( "/AdditionalStreams [" );
- for( size_t i = 0; i < m_aAdditionalStreams.size(); i++ )
+ for(const PDFAddStream & rAdditionalStream : m_aAdditionalStreams)
{
aLine.append( "/" );
- appendName( m_aAdditionalStreams[i].m_aMimeType, aLine );
+ appendName( rAdditionalStream.m_aMimeType, aLine );
aLine.append( " " );
- aLine.append( m_aAdditionalStreams[i].m_nStreamObject );
+ aLine.append( rAdditionalStream.m_nStreamObject );
aLine.append( " 0 R\n" );
}
aLine.append( "]\n" );
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 4c451817dc17..8c267dbb5a5d 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -376,10 +376,10 @@ SalPrinterQueueInfo::~SalPrinterQueueInfo()
ImplPrnQueueList::~ImplPrnQueueList()
{
ImplSVData* pSVData = ImplGetSVData();
- for( size_t i = 0; i < m_aQueueInfos.size(); i++ )
+ for(ImplPrnQueueData & rQueueInfo : m_aQueueInfos)
{
- delete m_aQueueInfos[i].mpQueueInfo;
- pSVData->mpDefInst->DeletePrinterQueueInfo( m_aQueueInfos[i].mpSalQueueInfo );
+ delete rQueueInfo.mpQueueInfo;
+ pSVData->mpDefInst->DeletePrinterQueueInfo( rQueueInfo.mpSalQueueInfo );
}
}
@@ -850,19 +850,19 @@ SalPrinterQueueInfo* Printer::ImplGetQueueInfo( const OUString& rPrinterName,
return pInfo->mpSalQueueInfo;
// then search case insensitive
- for( size_t i = 0; i < pPrnList->m_aQueueInfos.size(); i++ )
+ for(ImplPrnQueueData & rQueueInfo : pPrnList->m_aQueueInfos)
{
- if( pPrnList->m_aQueueInfos[i].mpSalQueueInfo->maPrinterName.equalsIgnoreAsciiCase( rPrinterName ) )
- return pPrnList->m_aQueueInfos[i].mpSalQueueInfo;
+ if( rQueueInfo.mpSalQueueInfo->maPrinterName.equalsIgnoreAsciiCase( rPrinterName ) )
+ return rQueueInfo.mpSalQueueInfo;
}
// then search for driver name
if ( pDriver )
{
- for( size_t i = 0; i < pPrnList->m_aQueueInfos.size(); i++ )
+ for(ImplPrnQueueData & rQueueInfo : pPrnList->m_aQueueInfos)
{
- if( pPrnList->m_aQueueInfos[i].mpSalQueueInfo->maDriver == *pDriver )
- return pPrnList->m_aQueueInfos[i].mpSalQueueInfo;
+ if( rQueueInfo.mpSalQueueInfo->maDriver == *pDriver )
+ return rQueueInfo.mpSalQueueInfo;
}
}
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index f20da6825f54..bb8081e54320 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -1387,10 +1387,10 @@ css::uno::Sequence< css::beans::PropertyValue > PrinterController::getJobPropert
for( int i = 0; i < i_rMergeList.getLength(); i++ )
aResult[i] = i_rMergeList[i];
int nCur = i_rMergeList.getLength();
- for( size_t i = 0; i < mpImplData->maUIProperties.size(); i++ )
+ for(css::beans::PropertyValue & rPropVal : mpImplData->maUIProperties)
{
- if( aMergeSet.find( mpImplData->maUIProperties[i].Name ) == aMergeSet.end() )
- aResult[nCur++] = mpImplData->maUIProperties[i];
+ if( aMergeSet.find( rPropVal.Name ) == aMergeSet.end() )
+ aResult[nCur++] = rPropVal;
}
// append IsFirstPage
if( aMergeSet.find( OUString( "IsFirstPage" ) ) == aMergeSet.end() )
diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index 9c48b1589d7e..290f25132060 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -595,9 +595,9 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs)
// even though they may have been reordered in which case they will have
// been placed in a bigger cluster for other purposes.
int nClusterCount = 0;
- for (size_t j = 0; j < mvGlyphs.size(); j++)
+ for (GlyphItem & i : mvGlyphs)
{
- if (mvGlyphs[j].IsClusterStart() && !mvGlyphs[j].IsDiacritic())
+ if (i.IsClusterStart() && !i.IsDiacritic())
{
++nClusterCount;
}
@@ -657,9 +657,9 @@ void GraphiteLayout::expandOrCondense(ImplLayoutArgs &rArgs)
iGlyph->maLinearPos.X() = static_cast<int>(static_cast<float>(iGlyph->maLinearPos.X()) * fXFactor);
++iGlyph;
}
- for (size_t i = 0; i < mvCharDxs.size(); i++)
+ for (int & rDx : mvCharDxs)
{
- mvCharDxs[i] = static_cast<int>(fXFactor * static_cast<float>(mvCharDxs[i]));
+ rDx = static_cast<int>(fXFactor * static_cast<float>(rDx));
}
}
mnWidth = rArgs.mnLayoutWidth;
@@ -782,8 +782,8 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt
if (bRtl)
{
int diff = mvGlyphs[0].maLinearPos.X();
- for (size_t i = 0; i < mvGlyphs.size(); ++i)
- mvGlyphs[i].maLinearPos.X() -= diff;
+ for (GlyphItem & i : mvGlyphs)
+ i.maLinearPos.X() -= diff;
}
}
diff --git a/vcl/source/image/ImageList.cxx b/vcl/source/image/ImageList.cxx
index 226352997900..7c602223e4c2 100644
--- a/vcl/source/image/ImageList.cxx
+++ b/vcl/source/image/ImageList.cxx
@@ -389,9 +389,9 @@ void ImageList::GetImageNames( std::vector< OUString >& rNames ) const
if( mpImplData )
{
- for( size_t i = 0; i < mpImplData->maImages.size(); i++ )
+ for(const ImageAryData* pImage : mpImplData->maImages)
{
- const OUString& rName( mpImplData->maImages[ i ]->maName );
+ const OUString& rName( pImage->maName );
if( !rName.isEmpty())
rNames.push_back( rName );
}
diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx
index d06e6a28ebd8..9e6250323c8a 100644
--- a/vcl/source/window/accel.cxx
+++ b/vcl/source/window/accel.cxx
@@ -162,9 +162,9 @@ ImplAccelEntry* Accelerator::ImplGetAccelData( const vcl::KeyCode& rKeyCode ) co
void Accelerator::ImplCopyData( ImplAccelData& rAccelData )
{
// copy table
- for ( size_t i = 0, n = rAccelData.maIdList.size(); i < n; ++i )
+ for (ImplAccelEntry* i : rAccelData.maIdList)
{
- ImplAccelEntry* pEntry = new ImplAccelEntry( *rAccelData.maIdList[ i ] );
+ ImplAccelEntry* pEntry = new ImplAccelEntry( *i );
// sequence accelerator, then copy also
if ( pEntry->mpAccel )
@@ -183,8 +183,7 @@ void Accelerator::ImplCopyData( ImplAccelData& rAccelData )
void Accelerator::ImplDeleteData()
{
// delete accelerator-entries using the id-table
- for ( size_t i = 0, n = mpData->maIdList.size(); i < n; ++i ) {
- ImplAccelEntry* pEntry = mpData->maIdList[ i ];
+ for (ImplAccelEntry* pEntry : mpData->maIdList) {
if ( pEntry->mpAutoAccel ) {
delete pEntry->mpAutoAccel;
}
diff --git a/vcl/source/window/accmgr.cxx b/vcl/source/window/accmgr.cxx
index 295a1681d40a..3b45dc742571 100644
--- a/vcl/source/window/accmgr.cxx
+++ b/vcl/source/window/accmgr.cxx
@@ -34,8 +34,8 @@ bool ImplAccelManager::InsertAccel( Accelerator* pAccel )
if ( !mpAccelList ) {
mpAccelList = new ImplAccelList;
} else {
- for ( size_t i = 0, n = mpAccelList->size(); i < n; ++i ) {
- if ( (*mpAccelList)[ i ] == pAccel ) {
+ for (Accelerator* i : *mpAccelList) {
+ if ( i == pAccel ) {
return false;
}
}
@@ -58,8 +58,8 @@ void ImplAccelManager::RemoveAccel( Accelerator* pAccel )
if ( mpSequenceList ) {
for (sal_uInt16 i = 0; i < pAccel->GetItemCount(); ++i) {
Accelerator* pSubAccel = pAccel->GetAccel( pAccel->GetItemId(i) );
- for ( size_t j = 0, n = mpSequenceList->size(); j < n; ++j ) {
- if ( (*mpSequenceList)[ j ] == pSubAccel ) {
+ for (Accelerator* j : *mpSequenceList) {
+ if ( j == pSubAccel ) {
EndSequence();
i = pAccel->GetItemCount();
break;
@@ -86,9 +86,8 @@ void ImplAccelManager::EndSequence()
if ( !mpSequenceList )
return;
- for ( size_t i = 0, n = mpSequenceList->size(); i < n; ++i )
+ for (Accelerator* pTempAccel : *mpSequenceList)
{
- Accelerator* pTempAccel = (*mpSequenceList)[ i ];
pTempAccel->mbIsCancel = false;
pTempAccel->mpDel = nullptr;
}
@@ -183,9 +182,9 @@ bool ImplAccelManager::IsAccelKey( const vcl::KeyCode& rKeyCode, sal_uInt16 nRep
}
// step through the list of accelerators
- for ( size_t i = 0, n = mpAccelList->size(); i < n; ++i )
+ for (Accelerator* i : *mpAccelList)
{
- pAccel = (*mpAccelList)[ i ];
+ pAccel = i;
// is the entry contained ?
ImplAccelEntry* pEntry = pAccel->ImplGetAccelData( rKeyCode );
diff --git a/vcl/source/window/debugevent.cxx b/vcl/source/window/debugevent.cxx
index 3acf9d6e7daf..cff4d023dfdd 100644
--- a/vcl/source/window/debugevent.cxx
+++ b/vcl/source/window/debugevent.cxx
@@ -222,13 +222,13 @@ void DebugEventInjector::InjectKeyNavEdit()
double d = 0.0, nRand = getRandom();
sal_uInt16 nKey = KEY_SPACE;
- for ( size_t i = 0; i < SAL_N_ELEMENTS( nWeights ); ++i )
+ for (auto & rWeight : nWeights)
{
- d += nWeights[i].mnProb;
+ d += rWeight.mnProb;
assert (d < 1.01);
if ( nRand < d )
{
- nKey = nWeights[i].mnKey;
+ nKey = rWeight.mnKey;
break;
}
}
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 2c6cabff51e7..a3761389b208 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -2043,8 +2043,8 @@ MessageDialog::MessageDialog(vcl::Window* pParent, const OString& rID, const OUS
void MessageDialog::dispose()
{
- for (size_t i = 0; i < m_aOwnedButtons.size(); ++i)
- m_aOwnedButtons[i].disposeAndClear();
+ for (VclPtr<PushButton> & pOwnedButton : m_aOwnedButtons)
+ pOwnedButton.disposeAndClear();
m_aOwnedButtons.clear();
m_pPrimaryMessage.disposeAndClear();
diff --git a/vcl/source/window/menuitemlist.cxx b/vcl/source/window/menuitemlist.cxx
index 5f73bc5b9615..07a264502ccd 100644
--- a/vcl/source/window/menuitemlist.cxx
+++ b/vcl/source/window/menuitemlist.cxx
@@ -46,8 +46,8 @@ MenuItemData::~MenuItemData()
MenuItemList::~MenuItemList()
{
- for( size_t i = 0, n = maItemList.size(); i < n; ++i )
- delete maItemList[ i ];
+ for(MenuItemData* i : maItemList)
+ delete i;
}
MenuItemData* MenuItemList::Insert(
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index 273e2cc6017f..86441cdca764 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -159,8 +159,8 @@ StatusBar::~StatusBar()
void StatusBar::dispose()
{
// delete all items
- for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
- delete (*mpItemList)[ i ];
+ for (ImplStatusItem* i : *mpItemList) {
+ delete i;
}
delete mpItemList;
@@ -235,8 +235,8 @@ void StatusBar::ImplFormat()
// sum up widths
mnItemsWidth = STATUSBAR_OFFSET_X;
long nOffset = 0;
- for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
- pItem = (*mpItemList)[ i ];
+ for (ImplStatusItem* i : *mpItemList) {
+ pItem = i;
if ( pItem->mbVisible )
{
if ( pItem->mnBits & StatusBarItemBits::AutoSize ) {
@@ -277,8 +277,8 @@ void StatusBar::ImplFormat()
nX += ImplGetSVData()->maNWFData.mnStatusBarLowerRightOffset;
}
- for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
- pItem = (*mpItemList)[ i ];
+ for (ImplStatusItem* i : *mpItemList) {
+ pItem = i;
if ( pItem->mbVisible ) {
if ( pItem->mnBits & StatusBarItemBits::AutoSize ) {
pItem->mnExtraWidth = nExtraWidth;
@@ -865,9 +865,8 @@ void StatusBar::DataChanged( const DataChangedEvent& rDCEvt )
mbFormat = true;
ImplInitSettings();
long nFudge = GetTextHeight() / 4;
- for ( size_t i = 0, n = mpItemList->size(); i < n; ++i )
+ for (ImplStatusItem* pItem : *mpItemList)
{
- ImplStatusItem* pItem = (*mpItemList)[ i ];
long nWidth = GetTextWidth( pItem->maText ) + nFudge;
if( nWidth > pItem->mnWidth + STATUSBAR_OFFSET )
pItem->mnWidth = nWidth + STATUSBAR_OFFSET;
@@ -1008,8 +1007,8 @@ bool StatusBar::IsItemVisible( sal_uInt16 nItemId ) const
void StatusBar::Clear()
{
// delete all items
- for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
- delete (*mpItemList)[ i ];
+ for (ImplStatusItem* i : *mpItemList) {
+ delete i;
}
mpItemList->clear();
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 4fa7ecaefff0..8cb37f236f34 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -1132,9 +1132,9 @@ ImplTBDragMgr::~ImplTBDragMgr()
ToolBox* ImplTBDragMgr::FindToolBox( const Rectangle& rRect )
{
- for ( size_t i = 0, n = mpBoxList->size(); i < n; ++i )
+ for (VclPtr<ToolBox> & i : *mpBoxList)
{
- ToolBox* pBox = (*mpBoxList)[ i ];
+ ToolBox* pBox = i;
/*
* FIXME: since we can have multiple frames now we cannot
* find the drag target by its position alone.
@@ -4190,9 +4190,9 @@ void ToolBox::Resize()
{
//Get how big the optimal size is
Rectangle aBounds;
- for (size_t i = 0; i < mpData->m_aItems.size(); ++i)
+ for (const ImplToolItem & rItem : mpData->m_aItems)
{
- aBounds.Union( mpData->m_aItems[i].maRect );
+ aBounds.Union( rItem.maRect );
}
long nOptimalWidth = aBounds.GetWidth();
@@ -4201,9 +4201,8 @@ void ToolBox::Resize()
//share out the diff from optimal to real across
//expandable entries
- for (size_t i = 0; i < aExpandables.size(); ++i)
+ for (size_t nIndex : aExpandables)
{
- size_t nIndex = aExpandables[i];
vcl::Window *pWindow = mpData->m_aItems[nIndex].mpWindow;
Size aWinSize(pWindow->GetSizePixel());
Size aPrefSize(pWindow->get_preferred_size());
@@ -4809,11 +4808,11 @@ Size ToolBox::GetOptimalSize() const
// If we have any expandable entries, then force them to their
// optimal sizes, then reset them afterwards
std::map<vcl::Window*, Size> aExpandables;
- for (size_t i = 0; i < mpData->m_aItems.size(); ++i)
+ for (ImplToolItem & rItem : mpData->m_aItems)
{
- if (mpData->m_aItems[i].mbExpand)
+ if (rItem.mbExpand)
{
- vcl::Window *pWindow = mpData->m_aItems[i].mpWindow;
+ vcl::Window *pWindow = rItem.mpWindow;
SAL_INFO_IF(!pWindow, "vcl.layout", "only tabitems with window supported at the moment");
if (!pWindow)
continue;
diff --git a/vcl/unx/generic/app/keysymnames.cxx b/vcl/unx/generic/app/keysymnames.cxx
index 746eaadf8d09..e39af7c63547 100644
--- a/vcl/unx/generic/app/keysymnames.cxx
+++ b/vcl/unx/generic/app/keysymnames.cxx
@@ -475,12 +475,12 @@ namespace vcl_sal {
// translate keycodes, used within the displayed menu shortcuts
OUString getKeysymReplacementName( const OUString& pLang, KeySym nSymbol )
{
- for( unsigned int n = 0; n < SAL_N_ELEMENTS(aKeyboards); n++ )
+ for(const auto & rKeyboard : aKeyboards)
{
- if( pLang.equalsAscii( aKeyboards[n].pLangName ) )
+ if( pLang.equalsAscii( rKeyboard.pLangName ) )
{
- const struct KeysymNameReplacement* pRepl = aKeyboards[n].pReplacements;
- for( int m = aKeyboards[n].nReplacements ; m ; )
+ const struct KeysymNameReplacement* pRepl = rKeyboard.pReplacements;
+ for( int m = rKeyboard.nReplacements ; m ; )
{
if( nSymbol == pRepl[--m].aSymbol )
return OUString( pRepl[m].pName, strlen(pRepl[m].pName), RTL_TEXTENCODING_UTF8 );
diff --git a/vcl/unx/generic/app/randrwrapper.cxx b/vcl/unx/generic/app/randrwrapper.cxx
index 51eccc111c19..4913625b4cd8 100644
--- a/vcl/unx/generic/app/randrwrapper.cxx
+++ b/vcl/unx/generic/app/randrwrapper.cxx
@@ -146,9 +146,9 @@ void SalDisplay::processRandREvent( XEvent* pEvent )
{
// update screens
bool bNotify = false;
- for( size_t i = 0; i < m_aScreens.size(); i++ )
+ for(ScreenData & rScreen : m_aScreens)
{
- if( m_aScreens[i].m_bInit )
+ if( rScreen.m_bInit )
{
XRRScreenConfiguration *pConfig = nullptr;
XRRScreenSize *pSizes = nullptr;
@@ -156,16 +156,16 @@ void SalDisplay::processRandREvent( XEvent* pEvent )
Rotation nRot = 0;
SizeID nId = 0;
- pConfig = pWrapper->XRRGetScreenInfo( GetDisplay(), m_aScreens[i].m_aRoot );
+ pConfig = pWrapper->XRRGetScreenInfo( GetDisplay(), rScreen.m_aRoot );
nId = pWrapper->XRRConfigCurrentConfiguration( pConfig, &nRot );
pSizes = pWrapper->XRRConfigSizes( pConfig, &nSizes );
XRRScreenSize *pTargetSize = pSizes + nId;
bNotify = bNotify ||
- m_aScreens[i].m_aSize.Width() != pTargetSize->width ||
- m_aScreens[i].m_aSize.Height() != pTargetSize->height;
+ rScreen.m_aSize.Width() != pTargetSize->width ||
+ rScreen.m_aSize.Height() != pTargetSize->height;
- m_aScreens[i].m_aSize = Size( pTargetSize->width, pTargetSize->height );
+ rScreen.m_aSize = Size( pTargetSize->width, pTargetSize->height );
pWrapper->XRRFreeScreenConfigInfo( pConfig );
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 460c318534d9..dd5ce040d610 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -1959,9 +1959,9 @@ bool SalX11Display::Dispatch( XEvent *pEvent )
case PropertyNotify:
if( pEvent->xproperty.atom == getWMAdaptor()->getAtom( WMAdaptor::VCL_SYSTEM_SETTINGS ) )
{
- for( size_t i = 0; i < m_aScreens.size(); i++ )
+ for(ScreenData & rScreen : m_aScreens)
{
- if( pEvent->xproperty.window == m_aScreens[i].m_aRefWindow )
+ if( pEvent->xproperty.window == rScreen.m_aRefWindow )
{
std::list< SalFrame* >::const_iterator it;
for( it = m_aFrames.begin(); it != m_aFrames.end(); ++it )
diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx
index 09e1492f2250..813465503308 100644
--- a/vcl/unx/generic/app/wmadaptor.cxx
+++ b/vcl/unx/generic/app/wmadaptor.cxx
@@ -941,8 +941,8 @@ bool GnomeWMAdaptor::isValid() const
void WMAdaptor::initAtoms()
{
// get basic atoms
- for( unsigned int i = 0; i < SAL_N_ELEMENTS( aAtomTab ); i++ )
- m_aWMAtoms[ aAtomTab[i].nProtocol ] = XInternAtom( m_pDisplay, aAtomTab[i].pProtocol, False );
+ for(const WMAdaptorProtocol & i : aAtomTab)
+ m_aWMAtoms[ i.nProtocol ] = XInternAtom( m_pDisplay, i.pProtocol, False );
m_aWMAtoms[ NET_SUPPORTING_WM_CHECK ] = XInternAtom( m_pDisplay, "_NET_SUPPORTING_WM_CHECK", True );
m_aWMAtoms[ NET_WM_NAME ] = XInternAtom( m_pDisplay, "_NET_WM_NAME", True );
}
@@ -1490,11 +1490,11 @@ void WMAdaptor::maximizeFrame( X11SalFrame* pFrame, bool bHorizontal, bool bVert
{
Point aMed( aTL.X() + rGeom.nWidth/2, aTL.Y() + rGeom.nHeight/2 );
const std::vector< Rectangle >& rScreens = m_pSalDisplay->GetXineramaScreens();
- for( size_t i = 0; i < rScreens.size(); i++ )
- if( rScreens[i].IsInside( aMed ) )
+ for(const auto & rScreen : rScreens)
+ if( rScreen.IsInside( aMed ) )
{
- aTL += rScreens[i].TopLeft();
- aScreenSize = rScreens[i].GetSize();
+ aTL += rScreen.TopLeft();
+ aScreenSize = rScreen.GetSize();
break;
}
}
@@ -2090,14 +2090,14 @@ void NetWMAdaptor::showFullScreen( X11SalFrame* pFrame, bool bFullScreen ) const
&root_x, &root_y, &lx, &ly, &mask );
const std::vector< Rectangle >& rScreens = m_pSalDisplay->GetXineramaScreens();
Point aMousePoint( root_x, root_y );
- for( size_t i = 0; i < rScreens.size(); i++ )
+ for(const auto & rScreen : rScreens)
{
- if( rScreens[i].IsInside( aMousePoint ) )
+ if( rScreen.IsInside( aMousePoint ) )
{
- pFrame->maGeometry.nX = rScreens[i].Left();
- pFrame->maGeometry.nY = rScreens[i].Top();
- pFrame->maGeometry.nWidth = rScreens[i].GetWidth();
- pFrame->maGeometry.nHeight = rScreens[i].GetHeight();
+ pFrame->maGeometry.nX = rScreen.Left();
+ pFrame->maGeometry.nY = rScreen.Top();
+ pFrame->maGeometry.nWidth = rScreen.GetWidth();
+ pFrame->maGeometry.nHeight = rScreen.GetHeight();
break;
}
}
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx
index 5cc202c4f2c7..895cbfd91dcb 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -663,14 +663,14 @@ PrintFontManager::PrintFontManager()
, m_nNextDirAtom( 1 )
, m_pFontCache( nullptr )
{
- for( unsigned int i = 0; i < SAL_N_ELEMENTS( aAdobeCodes ); i++ )
+ for(const AdobeEncEntry& rEntry : aAdobeCodes)
{
- m_aUnicodeToAdobename.insert( std::unordered_multimap< sal_Unicode, OString >::value_type( aAdobeCodes[i].aUnicode, aAdobeCodes[i].pAdobename ) );
- m_aAdobenameToUnicode.insert( std::unordered_multimap< OString, sal_Unicode, OStringHash >::value_type( aAdobeCodes[i].pAdobename, aAdobeCodes[i].aUnicode ) );
- if( aAdobeCodes[i].aAdobeStandardCode )
+ m_aUnicodeToAdobename.insert( std::unordered_multimap< sal_Unicode, OString >::value_type( rEntry.aUnicode, rEntry.pAdobename ) );
+ m_aAdobenameToUnicode.insert( std::unordered_multimap< OString, sal_Unicode, OStringHash >::value_type( rEntry.pAdobename, rEntry.aUnicode ) );
+ if( rEntry.aAdobeStandardCode )
{
- m_aUnicodeToAdobecode.insert( std::unordered_multimap< sal_Unicode, sal_uInt8 >::value_type( aAdobeCodes[i].aUnicode, aAdobeCodes[i].aAdobeStandardCode ) );
- m_aAdobecodeToUnicode.insert( std::unordered_multimap< sal_uInt8, sal_Unicode >::value_type( aAdobeCodes[i].aAdobeStandardCode, aAdobeCodes[i].aUnicode ) );
+ m_aUnicodeToAdobecode.insert( std::unordered_multimap< sal_Unicode, sal_uInt8 >::value_type( rEntry.aUnicode, rEntry.aAdobeStandardCode ) );
+ m_aAdobecodeToUnicode.insert( std::unordered_multimap< sal_uInt8, sal_Unicode >::value_type( rEntry.aAdobeStandardCode, rEntry.aUnicode ) );
}
}
@@ -789,11 +789,11 @@ bool PrintFontManager::analyzeFontFile( int nDirID, const OString& rFontFile, ::
// first look for an adjacent file
static const char* pSuffix[] = { ".afm", ".AFM" };
- for( unsigned int i = 0; i < SAL_N_ELEMENTS(pSuffix); i++ )
+ for(const char* i : pSuffix)
{
OString aName = OStringBuffer(
rFontFile.copy(0, rFontFile.getLength() - 4)).
- append(pSuffix[i]).makeStringAndClear();
+ append(i).makeStringAndClear();
OStringBuffer aFilePath(aDir);
aFilePath.append('/').append(aName);
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index f8873d9f2aa4..62aeca15524d 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -46,8 +46,8 @@
CairoTextRender::CairoTextRender()
: mnTextColor(MAKE_SALCOLOR(0x00, 0x00, 0x00)) //black
{
- for( int i = 0; i < MAX_FALLBACK; ++i )
- mpServerFont[i] = nullptr;
+ for(ServerFont* & rp : mpServerFont)
+ rp = nullptr;
#if ENABLE_GRAPHITE
// check if graphite fonts have been disabled
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index 5821a38fcaa6..c5803f0781f5 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -254,11 +254,11 @@ bool X11SalGraphics::GetDitherPixmap( SalColor nSalColor )
sal_uInt8 nSalColorGreen = SALCOLOR_GREEN ( nSalColor );
sal_uInt8 nSalColorBlue = SALCOLOR_BLUE ( nSalColor );
- for( int nY = 0; nY < 8; nY++ )
+ for(auto & nY : nOrdDither8Bit)
{
for( int nX = 0; nX < 8; nX++ )
{
- short nMagic = nOrdDither8Bit[nY][nX];
+ short nMagic = nY[nX];
sal_uInt8 nR = P_DELTA * DMAP( nSalColorRed, nMagic );
sal_uInt8 nG = P_DELTA * DMAP( nSalColorGreen, nMagic );
sal_uInt8 nB = P_DELTA * DMAP( nSalColorBlue, nMagic );
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index d9799f279bf0..3e2a17f2e75f 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -1263,10 +1263,10 @@ bool PspSalPrinter::StartJob( const OUString* i_pFileName, const OUString& i_rJo
// clean up the temporary PDF files
if( ! i_pFileName || bAborted )
{
- for( size_t i = 0; i < aPDFFiles.size(); i++ )
+ for(PDFPrintFile & rPDFFile : aPDFFiles)
{
- osl_removeFile( aPDFFiles[i].maTmpURL.pData );
- OSL_TRACE( "removed print PDF file %s", OUStringToOString( aPDFFiles[i].maTmpURL, RTL_TEXTENCODING_UTF8 ).getStr() );
+ osl_removeFile( rPDFFile.maTmpURL.pData );
+ OSL_TRACE( "removed print PDF file %s", OUStringToOString( rPDFFile.maTmpURL, RTL_TEXTENCODING_UTF8 ).getStr() );
}
}
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index 141c14154ee0..41cf16ee8409 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -262,8 +262,8 @@ GenPspGraphics::GenPspGraphics()
m_bFontVertical( false ),
m_pInfoPrinter( nullptr )
{
- for( int i = 0; i < MAX_FALLBACK; i++ )
- m_pServerFont[i] = nullptr;
+ for(ServerFont* & rp : m_pServerFont)
+ rp = nullptr;
}
void GenPspGraphics::Init(psp::JobData* pJob, psp::PrinterGfx* pGfx,
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index 75df5943bb5d..3024b1ed6fa0 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -398,8 +398,6 @@ void PPDParser::scanPPDDir( const OUString& rDir )
} const pSuffixes[] =
{ { ".PS", 3 }, { ".PPD", 4 }, { ".PS.GZ", 6 }, { ".PPD.GZ", 7 } };
- const int nSuffixes = SAL_N_ELEMENTS(pSuffixes);
-
PPDCache &rPPDCache = thePPDCache::get();
osl::Directory aDir( rDir );
@@ -425,13 +423,13 @@ void PPDParser::scanPPDDir( const OUString& rDir )
aPPDFile.Append( aFileName );
// match extension
- for( int nSuffix = 0; nSuffix < nSuffixes; nSuffix++ )
+ for(const suffix_t & rSuffix : pSuffixes)
{
- if( aFileName.getLength() > pSuffixes[nSuffix].nSuffixLen )
+ if( aFileName.getLength() > rSuffix.nSuffixLen )
{
- if( aFileName.endsWithIgnoreAsciiCaseAsciiL( pSuffixes[nSuffix].pSuffix, pSuffixes[nSuffix].nSuffixLen ) )
+ if( aFileName.endsWithIgnoreAsciiCaseAsciiL( rSuffix.pSuffix, rSuffix.nSuffixLen ) )
{
- (*rPPDCache.pAllPPDFiles)[ aFileName.copy( 0, aFileName.getLength() - pSuffixes[nSuffix].nSuffixLen ) ] = aPPDFile.PathToFileName();
+ (*rPPDCache.pAllPPDFiles)[ aFileName.copy( 0, aFileName.getLength() - rSuffix.nSuffixLen ) ] = aPPDFile.PathToFileName();
break;
}
}
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx
index 993c898d068a..f28e8b077bc4 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -1150,11 +1150,11 @@ void SystemQueueInfo::run()
std::list< OString > aLines;
/* Discover which command we can use to get a list of all printer queues */
- for( unsigned int i = 0; i < SAL_N_ELEMENTS(aParms); i++ )
+ for(const auto & rParm : aParms)
{
aLines.clear();
OStringBuffer aCmdLine( 128 );
- aCmdLine.append( aParms[i].pQueueCommand );
+ aCmdLine.append( rParm.pQueueCommand );
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "trying print queue command \"%s\" ... ", aParms[i].pQueueCommand );
#endif
@@ -1167,11 +1167,11 @@ void SystemQueueInfo::run()
if( ! pclose( pPipe ) )
{
std::list< PrinterInfoManager::SystemPrintQueue > aSysPrintQueues;
- aParms[i].pHandler( aLines, aSysPrintQueues, &(aParms[i]) );
+ rParm.pHandler( aLines, aSysPrintQueues, &rParm );
MutexGuard aGuard( m_aMutex );
m_bChanged = true;
m_aQueues = aSysPrintQueues;
- m_aCommand = OUString::createFromAscii( aParms[i].pPrintCommand );
+ m_aCommand = OUString::createFromAscii( rParm.pPrintCommand );
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr, "success\n" );
#endif
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 0b10f17560bb..2197e3824e78 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -200,9 +200,8 @@ static void CreateNetWmAppIcon( sal_uInt16 nIcon, NetWmIconData& netwm_icon )
const int sizes[ 3 ] = { 48, 32, 16 };
netwm_icon.resize( 48 * 48 + 32 * 32 + 16 * 16 + 3 * 2 );
int pos = 0;
- for( int i = 0; i < 3; ++i )
+ for(int size : sizes)
{
- int size = sizes[ i ];
sal_uInt16 nIconSizeOffset;
if( size >= 48 )
nIconSizeOffset = SV_ICON_SIZE48_START;
@@ -507,11 +506,11 @@ void X11SalFrame::Init( SalFrameStyleFlags nSalFrameStyle, SalX11Screen nXScreen
&aRoot, &aChild,
&root_x, &root_y, &lx, &ly, &mask );
const std::vector< Rectangle >& rScreens = GetDisplay()->GetXineramaScreens();
- for( size_t i = 0; i < rScreens.size(); i++ )
- if( rScreens[i].IsInside( Point( root_x, root_y ) ) )
+ for(const auto & rScreen : rScreens)
+ if( rScreen.IsInside( Point( root_x, root_y ) ) )
{
- x = rScreens[i].Left();
- y = rScreens[i].Top();
+ x = rScreen.Left();
+ y = rScreen.Top();
break;
}
}
@@ -1453,13 +1452,13 @@ void X11SalFrame::Center( )
&x, &y,
&mask );
const std::vector< Rectangle >& rScreens = GetDisplay()->GetXineramaScreens();
- for( size_t i = 0; i < rScreens.size(); i++ )
- if( rScreens[i].IsInside( Point( root_x, root_y ) ) )
+ for(const auto & rScreen : rScreens)
+ if( rScreen.IsInside( Point( root_x, root_y ) ) )
{
- nScreenX = rScreens[i].Left();
- nScreenY = rScreens[i].Top();
- nRealScreenWidth = rScreens[i].GetWidth();
- nRealScreenHeight = rScreens[i].GetHeight();
+ nScreenX = rScreen.Left();
+ nScreenY = rScreen.Top();
+ nRealScreenWidth = rScreen.GetWidth();
+ nRealScreenHeight = rScreen.GetHeight();
break;
}
}
diff --git a/vcl/unx/gtk/a11y/atktextattributes.cxx b/vcl/unx/gtk/a11y/atktextattributes.cxx
index 6da4d349cac3..b7857d079b66 100644
--- a/vcl/unx/gtk/a11y/atktextattributes.cxx
+++ b/vcl/unx/gtk/a11y/atktextattributes.cxx
@@ -1071,8 +1071,8 @@ attribute_set_new_from_property_values(
sal_Int32 aIndexList[TEXT_ATTRIBUTE_LAST] = { -1 };
// Initialize index array with -1
- for( sal_Int32 attr = 0; attr < TEXT_ATTRIBUTE_LAST; ++attr )
- aIndexList[attr] = -1;
+ for(sal_Int32 & rn : aIndexList)
+ rn = -1;
find_exported_attributes(aIndexList, rAttributeList);
diff --git a/vcl/unx/gtk/fpicker/resourceprovider.cxx b/vcl/unx/gtk/fpicker/resourceprovider.cxx
index 9727a9cf9654..c6b09452df91 100644
--- a/vcl/unx/gtk/fpicker/resourceprovider.cxx
+++ b/vcl/unx/gtk/fpicker/resourceprovider.cxx
@@ -60,10 +60,10 @@ static const struct
static sal_Int16 CtrlIdToResId( sal_Int32 aControlId )
{
- for ( size_t i = 0; i < SAL_N_ELEMENTS( CtrlIdToResIdTable ); i++ )
+ for (auto & i : CtrlIdToResIdTable)
{
- if ( CtrlIdToResIdTable[i].ctrlId == aControlId )
- return CtrlIdToResIdTable[i].resId;
+ if ( i.ctrlId == aControlId )
+ return i.resId;
}
return -1;
}
diff --git a/vcl/unx/gtk/gtksalmenu.cxx b/vcl/unx/gtk/gtksalmenu.cxx
index a79713ab631f..78d337a14fe2 100644
--- a/vcl/unx/gtk/gtksalmenu.cxx
+++ b/vcl/unx/gtk/gtksalmenu.cxx
@@ -993,9 +993,8 @@ void GtkSalMenu::ActivateAllSubmenus(Menu* pMenuBar)
{
pMenuBar->HandleMenuActivateEvent(mpVCLMenu);
pMenuBar->HandleMenuDeActivateEvent(mpVCLMenu);
- for ( size_t nPos = 0; nPos < maItems.size(); nPos++ )
+ for (GtkSalMenuItem* pSalItem : maItems)
{
- GtkSalMenuItem *pSalItem = maItems[ nPos ];
if ( pSalItem->mpSubMenu != nullptr )
{
pSalItem->mpSubMenu->ActivateAllSubmenus(pMenuBar);