[Libreoffice-commits] core.git: vcl/source vcl/unx

Stephan Bergmann sbergman at redhat.com
Wed Mar 8 13:26:54 UTC 2017


 vcl/source/control/field.cxx             |    2 
 vcl/source/edit/vclmedit.cxx             |    2 
 vcl/source/filter/wmf/enhwmf.cxx         |    2 
 vcl/source/filter/wmf/winmtf.cxx         |    2 
 vcl/source/filter/wmf/winwmf.cxx         |    2 
 vcl/source/fontsubset/sft.cxx            |    6 +-
 vcl/source/gdi/graph.cxx                 |    8 +--
 vcl/source/gdi/pngread.cxx               |   12 ++--
 vcl/source/gdi/print.cxx                 |    2 
 vcl/source/window/accel.cxx              |    2 
 vcl/source/window/splitwin.cxx           |   78 +++++++++++++------------------
 vcl/unx/generic/dtrans/X11_selection.cxx |    8 ++-
 vcl/unx/generic/window/FWS.cxx           |    3 -
 vcl/unx/kde4/KDEXLib.cxx                 |    5 -
 14 files changed, 62 insertions(+), 72 deletions(-)

New commits:
commit 8ac16e14f4a77b98716f059c51a4fe5dce6ef440
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Mar 8 14:26:12 2017 +0100

    loplugin:loopvartoosmall
    
    Change-Id: Ie173849c0956edf9fd111120fa4bdfb2930ab69f

diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index d0fc826..394fb8f 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -271,7 +271,7 @@ bool ImplNumericGetValue( const OUString& rStr, sal_Int64& rValue,
     if( nValue == 0 )
     {
         // check if string is equivalent to zero
-        sal_Int16 nIndex = bNegative ? 1 : 0;
+        sal_Int32 nIndex = bNegative ? 1 : 0;
         while (nIndex < aStr.getLength() && aStr[nIndex] == '0')
             ++nIndex;
         if( nIndex < aStr.getLength() )
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index 0a3daac..b1eb9b4 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -582,7 +582,7 @@ void ImpVclMEdit::SetSelection( const Selection& rSelection )
     TextSelection aTextSel;
     sal_uInt32 nPara = 0;
     sal_Int32 nChar = 0;
-    sal_uInt16 x = 0;
+    long x = 0;
     while ( x <= nEnd )
     {
         if ( x == aNewSelection.Min() )
diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index bb6d856..2674df3 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -510,7 +510,7 @@ tools::Polygon EnhWMFReader::ReadPolygon(sal_uInt32 nStartIndex, sal_uInt32 nPoi
         return tools::Polygon();
 
     tools::Polygon aPolygon(nPoints);
-    for (sal_uInt16 i = nStartIndex ; i < nPoints && pWMF->good(); i++ )
+    for (sal_uInt32 i = nStartIndex ; i < nPoints && pWMF->good(); i++ )
     {
         T nX, nY;
         *pWMF >> nX >> nY;
diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx
index 028495d..2122eba 100644
--- a/vcl/source/filter/wmf/winmtf.cxx
+++ b/vcl/source/filter/wmf/winmtf.cxx
@@ -709,7 +709,7 @@ void WinMtfOutput::CreateObject( std::unique_ptr<GDIObj> pObject )
             pLineStyle->aLineInfo.SetWidth(aSize.Width());
         }
     }
-    sal_uInt32 nIndex;
+    std::vector<std::unique_ptr<GDIObj>>::size_type nIndex;
     for ( nIndex = 0; nIndex < vGDIObj.size(); nIndex++ )
     {
         if ( !vGDIObj[ nIndex ] )
diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index 44e8c53..a03781f 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -568,7 +568,7 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
 
                     if ( ( ( nDxAryEntries % nOriginalTextLen ) == 0 ) && ( nNewTextLen <= nOriginalTextLen ) )
                     {
-                        sal_uInt16 i; // needed just outside the for
+                        sal_Int32 i; // needed just outside the for
                         pDXAry.reset(new long[ nNewTextLen ]);
                         if ( nOptions & ETO_PDY )
                         {
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index edc08d2..f18622c 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -2050,7 +2050,7 @@ static GlyphOffsets *GlyphOffsetsNew(sal_uInt8 *sfntP, sal_uInt32 sfntLen)
 {
     GlyphOffsets* res = static_cast<GlyphOffsets*>(smalloc(sizeof(GlyphOffsets)));
     sal_uInt8 *loca = nullptr;
-    sal_uInt16 i, numTables = GetUInt16(sfntP, 4);
+    sal_uInt16 numTables = GetUInt16(sfntP, 4);
     sal_uInt32 locaLen = 0;
     sal_Int16 indexToLocFormat = 0;
 
@@ -2062,7 +2062,7 @@ static GlyphOffsets *GlyphOffsetsNew(sal_uInt8 *sfntP, sal_uInt32 sfntLen)
         numTables = nMaxPossibleTables;
     }
 
-    for (i = 0; i < numTables; i++) {
+    for (sal_uInt16 i = 0; i < numTables; i++) {
         sal_uInt32 nLargestFixedOffsetPos = 12 + 16 * i + 12;
         sal_uInt32 nMinSize = nLargestFixedOffsetPos + sizeof(sal_uInt32);
         if (nMinSize > sfntLen)
@@ -2088,7 +2088,7 @@ static GlyphOffsets *GlyphOffsetsNew(sal_uInt8 *sfntP, sal_uInt32 sfntLen)
     assert(res->nGlyphs != 0);
     res->offs = static_cast<sal_uInt32*>(scalloc(res->nGlyphs, sizeof(sal_uInt32)));
 
-    for (i = 0; i < res->nGlyphs; i++) {
+    for (sal_uInt32 i = 0; i < res->nGlyphs; i++) {
         if (indexToLocFormat == 1) {
             res->offs[i] = GetUInt32(loca, i * 4);
         } else {
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index cd10764..69be7c0 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -119,8 +119,8 @@ void ImplDrawDefault( OutputDevice* pOutDev, const OUString* pText,
 
                 if ( nTextWidth <= nWidth || aSz.Height() <= nThreshold )
                 {
-                    sal_uInt16 nStart = 0;
-                    sal_uInt16 nLen = 0;
+                    sal_Int32 nStart = 0;
+                    sal_Int32 nLen = 0;
 
                     while( nStart < pText->getLength() && (*pText)[nStart] == ' ' )
                         nStart++;
@@ -128,7 +128,7 @@ void ImplDrawDefault( OutputDevice* pOutDev, const OUString* pText,
                         nLen++;
                     while( nStart < pText->getLength() && nLines-- )
                     {
-                        sal_uInt16 nNext = nLen;
+                        sal_Int32 nNext = nLen;
                         do
                         {
                             while ( nStart+nNext < pText->getLength() && (*pText)[nStart+nNext] == ' ' )
@@ -142,7 +142,7 @@ void ImplDrawDefault( OutputDevice* pOutDev, const OUString* pText,
                         }
                         while ( nStart+nNext < pText->getLength() );
 
-                        sal_uInt16 n = nLen;
+                        sal_Int32 n = nLen;
                         nTextWidth = pOutDev->GetTextWidth( *pText, nStart, n );
                         while( nTextWidth > aSize.Width() )
                             nTextWidth = pOutDev->GetTextWidth( *pText, nStart, --n );
diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index 055456a..7b5f82c 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -1153,7 +1153,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd )
             {
                 if ( mbTransparent )
                 {
-                    for ( sal_Int32 nX = nXStart, nShift = 0; nX < maOrigSize.Width(); nX += nXAdd )
+                    for ( long nX = nXStart, nShift = 0; nX < maOrigSize.Width(); nX += nXAdd )
                     {
                         sal_uInt8 nCol;
                         nShift = (nShift - 1) & 7;
@@ -1168,7 +1168,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd )
                 }
                 else
                 {   // ScanlineFormat::N1BitMsbPal
-                    for ( sal_Int32 nX = nXStart, nShift = 0; nX < maOrigSize.Width(); nX += nXAdd )
+                    for ( long nX = nXStart, nShift = 0; nX < maOrigSize.Width(); nX += nXAdd )
                     {
                         nShift = (nShift - 1) & 7;
 
@@ -1191,7 +1191,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd )
                 {
                     if ( mnPngDepth == 4 )  // check if source has a two bit pixel format
                     {
-                        for ( sal_Int32 nX = nXStart, nXIndex = 0; nX < maOrigSize.Width(); nX += nXAdd, ++nXIndex )
+                        for ( long nX = nXStart, nXIndex = 0; nX < maOrigSize.Width(); nX += nXAdd, ++nXIndex )
                         {
                             if( nXIndex & 1 )
                             {
@@ -1206,7 +1206,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd )
                     }
                     else // if ( mnPngDepth == 2 )
                     {
-                        for ( sal_Int32 nX = nXStart, nXIndex = 0; nX < maOrigSize.Width(); nX += nXAdd, nXIndex++ )
+                        for ( long nX = nXStart, nXIndex = 0; nX < maOrigSize.Width(); nX += nXAdd, nXIndex++ )
                         {
                             sal_uInt8 nCol;
                             switch( nXIndex & 3 )
@@ -1240,7 +1240,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd )
                 {
                     if ( mnPngDepth == 4 )  // maybe the source is a two bitmap graphic
                     {   // ScanlineFormat::N4BitLsnPal
-                        for ( sal_Int32 nX = nXStart, nXIndex = 0; nX < maOrigSize.Width(); nX += nXAdd, nXIndex++ )
+                        for ( long nX = nXStart, nXIndex = 0; nX < maOrigSize.Width(); nX += nXAdd, nXIndex++ )
                         {
                             if( nXIndex & 1 )
                                 ImplSetPixel( nY, nX, *pTmp++ & 0x0f );
@@ -1250,7 +1250,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd )
                     }
                     else // if ( mnPngDepth == 2 )
                     {
-                        for ( sal_Int32 nX = nXStart, nXIndex = 0; nX < maOrigSize.Width(); nX += nXAdd, nXIndex++ )
+                        for ( long nX = nXStart, nXIndex = 0; nX < maOrigSize.Width(); nX += nXAdd, nXIndex++ )
                         {
                             switch( nXIndex & 3 )
                             {
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 825f2cd..8bb043a 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1715,7 +1715,7 @@ void Printer::updatePrinters()
         pSVData->mpDefInst->GetPrinterQueueInfo( pNewList );
 
         bool bChanged = pPrnList->m_aQueueInfos.size() != pNewList->m_aQueueInfos.size();
-        for( unsigned int i = 0; ! bChanged && i < pPrnList->m_aQueueInfos.size(); i++ )
+        for( decltype(pPrnList->m_aQueueInfos)::size_type i = 0; ! bChanged && i < pPrnList->m_aQueueInfos.size(); i++ )
         {
             ImplPrnQueueData& rInfo     = pPrnList->m_aQueueInfos[i];
             ImplPrnQueueData& rNewInfo  = pNewList->m_aQueueInfos[i];
diff --git a/vcl/source/window/accel.cxx b/vcl/source/window/accel.cxx
index ddaf40b..78514bf 100644
--- a/vcl/source/window/accel.cxx
+++ b/vcl/source/window/accel.cxx
@@ -89,7 +89,7 @@ sal_uInt16 ImplAccelEntryGetIndex( ImplAccelList* pList, sal_uInt16 nId,
 static void ImplAccelEntryInsert( ImplAccelList* pList, ImplAccelEntry* pEntry )
 {
     sal_uInt16  nInsIndex(0);
-    sal_uInt16  nIndex = ImplAccelEntryGetIndex( pList, pEntry->mnId, &nInsIndex );
+    std::vector<ImplAccelEntry *>::size_type nIndex = ImplAccelEntryGetIndex( pList, pEntry->mnId, &nInsIndex );
 
     if ( nIndex != ACCELENTRY_NOTFOUND )
     {
diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index 821ae3b..eb796b6 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -328,17 +328,16 @@ static ImplSplitSet* ImplFindSet( ImplSplitSet* pSet, sal_uInt16 nId )
     if ( pSet->mnId == nId )
         return pSet;
 
-    sal_uInt16          i;
     size_t              nItems = pSet->mpItems.size();
     std::vector< ImplSplitItem* >&     rItems = pSet->mpItems;
 
-    for ( i = 0; i < nItems; i++ )
+    for ( size_t i = 0; i < nItems; i++ )
     {
         if ( rItems[i]->mnId == nId )
             return rItems[i]->mpSet;
     }
 
-    for ( i = 0; i < nItems; i++ )
+    for ( size_t i = 0; i < nItems; i++ )
     {
         if ( rItems[i]->mpSet )
         {
@@ -353,11 +352,10 @@ static ImplSplitSet* ImplFindSet( ImplSplitSet* pSet, sal_uInt16 nId )
 
 static ImplSplitSet* ImplFindItem( ImplSplitSet* pSet, sal_uInt16 nId, sal_uInt16& rPos )
 {
-    sal_uInt16          i;
     size_t              nItems = pSet->mpItems.size();
     std::vector< ImplSplitItem* >&     rItems = pSet->mpItems;
 
-    for ( i = 0; i < nItems; i++ )
+    for ( size_t i = 0; i < nItems; i++ )
     {
         if ( rItems[i]->mnId == nId )
         {
@@ -366,7 +364,7 @@ static ImplSplitSet* ImplFindItem( ImplSplitSet* pSet, sal_uInt16 nId, sal_uInt1
         }
     }
 
-    for ( i = 0; i < nItems; i++ )
+    for ( size_t i = 0; i < nItems; i++ )
     {
         if ( rItems[i]->mpSet )
         {
@@ -381,11 +379,10 @@ static ImplSplitSet* ImplFindItem( ImplSplitSet* pSet, sal_uInt16 nId, sal_uInt1
 
 static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, vcl::Window* pWindow )
 {
-    sal_uInt16          i;
     size_t              nItems = pSet->mpItems.size();
     std::vector< ImplSplitItem* >&     rItems = pSet->mpItems;
 
-    for ( i = 0; i < nItems; i++ )
+    for ( size_t i = 0; i < nItems; i++ )
     {
         if ( rItems[i]->mpWindow == pWindow )
             return rItems[i]->mnId;
@@ -406,11 +403,10 @@ static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, vcl::Window* pWindow )
 static sal_uInt16 ImplFindItem( ImplSplitSet* pSet, const Point& rPos,
                             bool bRows, bool bDown = true )
 {
-    sal_uInt16          i;
     size_t              nItems = pSet->mpItems.size();
     std::vector< ImplSplitItem* >&     rItems = pSet->mpItems;
 
-    for ( i = 0; i < nItems; i++ )
+    for ( size_t i = 0; i < nItems; i++ )
     {
         if ( rItems[i]->mnWidth && rItems[i]->mnHeight )
         {
@@ -456,8 +452,6 @@ static void ImplCalcSet( ImplSplitSet* pSet,
     if ( pSet->mpItems.empty() )
         return;
 
-    sal_uInt16          i;
-    sal_uInt16          j;
     sal_uInt16          nMins;
     sal_uInt16          nCalcItems;
     size_t              nItems = pSet->mpItems.size();
@@ -471,7 +465,7 @@ static void ImplCalcSet( ImplSplitSet* pSet,
 
     // get number of visible items
     nVisItems = 0;
-    for ( i = 0; i < nItems; i++ )
+    for ( size_t i = 0; i < nItems; i++ )
     {
         if ( !(rItems[i]->mnBits & SplitWindowItemFlags::Invisible) )
             nVisItems++;
@@ -491,7 +485,7 @@ static void ImplCalcSet( ImplSplitSet* pSet,
         long nRelPercent    = 0;
         long nAbsSize       = 0;
         long nCurSize       = 0;
-        for ( i = 0; i < nItems; i++ )
+        for ( size_t i = 0; i < nItems; i++ )
         {
             if ( !(rItems[i]->mnBits & SplitWindowItemFlags::Invisible) )
             {
@@ -524,7 +518,7 @@ static void ImplCalcSet( ImplSplitSet* pSet,
         if ( !nPercent )
             nPercent = 1;
         long nSizeDelta = nCalcSize-nAbsSize;
-        for ( i = 0; i < nItems; i++ )
+        for ( size_t i = 0; i < nItems; i++ )
         {
             if ( rItems[i]->mnBits & SplitWindowItemFlags::Invisible )
                 rItems[i]->mnPixSize = 0;
@@ -558,7 +552,7 @@ static void ImplCalcSet( ImplSplitSet* pSet,
             long nSizeWinSize    = 0;
 
             // first resize absolute items relative
-            for ( i = 0; i < nItems; i++ )
+            for ( size_t i = 0; i < nItems; i++ )
             {
                 if ( !(rItems[i]->mnBits & SplitWindowItemFlags::Invisible) )
                 {
@@ -574,7 +568,7 @@ static void ImplCalcSet( ImplSplitSet* pSet,
             {
                 long nNewSizeWinSize = 0;
 
-                for ( i = 0; i < nItems; i++ )
+                for ( size_t i = 0; i < nItems; i++ )
                 {
                     if ( !(rItems[i]->mnBits & SplitWindowItemFlags::Invisible) )
                     {
@@ -590,7 +584,7 @@ static void ImplCalcSet( ImplSplitSet* pSet,
             }
 
             // compensate rounding errors now
-            j           = 0;
+            sal_uInt16 j = 0;
             nMins       = 0;
             while ( nSizeDelta && (nItems != nMins) )
             {
@@ -598,7 +592,7 @@ static void ImplCalcSet( ImplSplitSet* pSet,
                 nCalcItems = 0;
                 while ( !nCalcItems )
                 {
-                    for ( i = 0; i < nItems; i++ )
+                    for ( size_t i = 0; i < nItems; i++ )
                     {
                         rItems[i]->mbSubSize = false;
 
@@ -632,7 +626,7 @@ static void ImplCalcSet( ImplSplitSet* pSet,
                 long nErrorSum       = nSizeDelta % nCalcItems;
                 long nCurSizeDelta   = nSizeDelta / nCalcItems;
                 nMins           = 0;
-                for ( i = 0; i < nItems; i++ )
+                for ( size_t i = 0; i < nItems; i++ )
                 {
                     if ( rItems[i]->mnBits & SplitWindowItemFlags::Invisible )
                         nMins++;
@@ -697,7 +691,7 @@ static void ImplCalcSet( ImplSplitSet* pSet,
     }
 
     // order windows and adept values
-    for ( i = 0; i < nItems; i++ )
+    for ( size_t i = 0; i < nItems; i++ )
     {
         rItems[i]->mnOldSplitPos    = rItems[i]->mnSplitPos;
         rItems[i]->mnOldSplitSize   = rItems[i]->mnSplitSize;
@@ -775,7 +769,7 @@ static void ImplCalcSet( ImplSplitSet* pSet,
     }
 
     // calculate Sub-Set's
-    for ( i = 0; i < nItems; i++ )
+    for ( size_t i = 0; i < nItems; i++ )
     {
         if ( rItems[i]->mpSet && rItems[i]->mnWidth && rItems[i]->mnHeight )
         {
@@ -787,7 +781,7 @@ static void ImplCalcSet( ImplSplitSet* pSet,
     }
 
     // set fixed
-    for ( i = 0; i < nItems; i++ )
+    for ( size_t i = 0; i < nItems; i++ )
     {
         rItems[i]->mbFixed = false;
         if ( rItems[i]->mnBits & SplitWindowItemFlags::Fixed )
@@ -798,9 +792,9 @@ static void ImplCalcSet( ImplSplitSet* pSet,
             // if a child is fixed
             if ( rItems[i]->mpSet )
             {
-                for ( j = 0; j < rItems[i]->mpSet->mpItems.size(); j++ )
+                for ( auto const j: rItems[i]->mpSet->mpItems )
                 {
-                    if ( rItems[i]->mpSet->mpItems[j]->mbFixed )
+                    if ( j->mbFixed )
                     {
                         rItems[i]->mbFixed = true;
                         break;
@@ -814,13 +808,12 @@ static void ImplCalcSet( ImplSplitSet* pSet,
 void SplitWindow::ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, bool bHide,
                                 bool bRows, bool /*bDown*/ )
 {
-    sal_uInt16          i;
     size_t              nItems = pSet->mpItems.size();
     std::vector< ImplSplitItem* >&     rItems = pSet->mpItems;
 
     if ( pWindow->IsReallyVisible() && pWindow->IsUpdateMode() && pWindow->mbInvalidate )
     {
-        for ( i = 0; i < nItems; i++ )
+        for ( size_t i = 0; i < nItems; i++ )
         {
             if ( rItems[i]->mnSplitSize )
             {
@@ -881,7 +874,7 @@ void SplitWindow::ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, bool b
     }
 
     // position windows
-    for ( i = 0; i < nItems; i++ )
+    for ( size_t i = 0; i < nItems; i++ )
     {
         if ( rItems[i]->mpSet )
         {
@@ -905,7 +898,7 @@ void SplitWindow::ImplCalcSet2( SplitWindow* pWindow, ImplSplitSet* pSet, bool b
     }
 
     // show windows and reset flag
-    for ( i = 0; i < nItems; i++ )
+    for ( size_t i = 0; i < nItems; i++ )
     {
         if ( rItems[i]->mpWindow && rItems[i]->mnWidth && rItems[i]->mnHeight && !bHide )
             rItems[i]->mpWindow->Show();
@@ -979,7 +972,6 @@ void SplitWindow::ImplDrawBack(vcl::RenderContext& rRenderContext, const Rectang
 
 void SplitWindow::ImplDrawBack(vcl::RenderContext& rRenderContext, ImplSplitSet* pSet)
 {
-    sal_uInt16      i;
     size_t          nItems = pSet->mpItems.size();
     std::vector< ImplSplitItem* >& rItems = pSet->mpItems;
 
@@ -996,7 +988,7 @@ void SplitWindow::ImplDrawBack(vcl::RenderContext& rRenderContext, ImplSplitSet*
         }
     }
 
-    for (i = 0; i < nItems; i++)
+    for (size_t i = 0; i < nItems; i++)
     {
         pSet = rItems[i]->mpSet;
         if (pSet)
@@ -1011,7 +1003,7 @@ void SplitWindow::ImplDrawBack(vcl::RenderContext& rRenderContext, ImplSplitSet*
         }
     }
 
-    for (i = 0; i < nItems; i++)
+    for (size_t i = 0; i < nItems; i++)
     {
         if (rItems[i]->mpSet)
             ImplDrawBack(rRenderContext, rItems[i]->mpSet);
@@ -1023,7 +1015,6 @@ static void ImplDrawSplit(vcl::RenderContext& rRenderContext, ImplSplitSet* pSet
     if (pSet->mpItems.empty())
         return;
 
-    sal_uInt16 i;
     size_t     nItems = pSet->mpItems.size();
     long       nPos;
     long       nTop;
@@ -1031,7 +1022,7 @@ static void ImplDrawSplit(vcl::RenderContext& rRenderContext, ImplSplitSet* pSet
     std::vector< ImplSplitItem* >& rItems = pSet->mpItems;
     const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
 
-    for (i = 0; i < nItems-1; i++)
+    for (size_t i = 0; i < nItems-1; i++)
     {
         if (rItems[i]->mnSplitSize)
         {
@@ -1105,7 +1096,7 @@ static void ImplDrawSplit(vcl::RenderContext& rRenderContext, ImplSplitSet* pSet
         }
     }
 
-    for (i = 0; i < nItems; i++)
+    for (size_t i = 0; i < nItems; i++)
     {
         if (rItems[i]->mpSet && rItems[i]->mnWidth && rItems[i]->mnHeight)
         {
@@ -1121,7 +1112,6 @@ sal_uInt16 SplitWindow::ImplTestSplit( ImplSplitSet* pSet, const Point& rPos,
     if ( pSet->mpItems.empty() )
         return 0;
 
-    sal_uInt16      i;
     sal_uInt16      nSplitTest;
     size_t          nItems = pSet->mpItems.size();
     long            nMPos1;
@@ -1142,7 +1132,7 @@ sal_uInt16 SplitWindow::ImplTestSplit( ImplSplitSet* pSet, const Point& rPos,
         nMPos2 = rPos.X();
     }
 
-    for ( i = 0; i < nItems-1; i++ )
+    for ( size_t i = 0; i < nItems-1; i++ )
     {
         if ( rItems[i]->mnSplitSize )
         {
@@ -1177,7 +1167,7 @@ sal_uInt16 SplitWindow::ImplTestSplit( ImplSplitSet* pSet, const Point& rPos,
         }
     }
 
-    for ( i = 0; i < nItems; i++ )
+    for ( size_t i = 0; i < nItems; i++ )
     {
         if ( rItems[i]->mpSet )
         {
@@ -1449,7 +1439,7 @@ Size SplitWindow::CalcLayoutSizePixel( const Size& aNewSize )
     if ( mnWinStyle & WB_SIZEABLE )
     {
         long    nCalcSize = 0;
-        sal_uInt16  i;
+        std::vector< ImplSplitItem* >::size_type i;
 
         for ( i = 0; i < mpMainSet->mpItems.size(); i++ )
         {
@@ -1514,7 +1504,7 @@ void SplitWindow::ImplCalcLayout()
     if ( mnWinStyle & WB_SIZEABLE )
     {
         long    nCalcSize = 0;
-        sal_uInt16  i;
+        std::vector<ImplSplitItem *>::size_type i;
 
         for ( i = 0; i < mpMainSet->mpItems.size(); i++ )
         {
@@ -1845,7 +1835,6 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt )
     {
         ImplSplitItem*  pSplitItem;
         long            nCurMaxSize;
-        sal_uInt16      nTemp;
         bool            bPropSmaller;
 
         mnMouseModifier = rMEvt.GetModifier();
@@ -1897,7 +1886,7 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt )
 
             if ( mnSplitPos )
             {
-                nTemp = mnSplitPos;
+                long nTemp = mnSplitPos;
                 while ( nTemp )
                 {
                     pSplitItem = mpSplitSet->mpItems[nTemp-1];
@@ -1943,7 +1932,7 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt )
             }
             else
             {
-                nTemp = mnSplitPos+1;
+                std::vector<ImplSplitItem *>::size_type nTemp = mnSplitPos+1;
                 while ( nTemp < mpSplitSet->mpItems.size() )
                 {
                     pSplitItem = mpSplitSet->mpItems[nTemp];
@@ -2811,10 +2800,9 @@ long SplitWindow::GetItemSize( sal_uInt16 nId, SplitWindowItemFlags nBits ) cons
             long                nPerSize = 0;
             size_t              nItems;
             SplitWindowItemFlags nTempBits;
-            sal_uInt16              i;
             nItems = pSet->mpItems.size();
             std::vector< ImplSplitItem* >& rItems = pSet->mpItems;
-            for ( i = 0; i < nItems; i++ )
+            for ( size_t i = 0; i < nItems; i++ )
             {
                 if ( i == nPos )
                     nTempBits = nBits;
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx
index af2cd43..afbd0b6 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -1184,9 +1184,13 @@ bool SelectionManager::getPasteData( Atom selection, const OUString& rType, Sequ
         Atom nSelectedType = None;
         for( type_it = aTypes.begin(); type_it != aTypes.end() && nSelectedType == None; ++type_it )
         {
-            for( unsigned int i = 0; i < rNativeTypes.size() && nSelectedType == None; i++ )
-                if( rNativeTypes[i] == *type_it )
+            for( auto const & i: rNativeTypes )
+                if( i == *type_it )
+                {
                     nSelectedType = *type_it;
+                    if (nSelectedType != None)
+                        break;
+                }
         }
         if( nSelectedType != None )
             bSuccess = getPasteData( selection, nSelectedType, rData );
diff --git a/vcl/unx/generic/window/FWS.cxx b/vcl/unx/generic/window/FWS.cxx
index 5d4ffd5..5a470ba 100644
--- a/vcl/unx/generic/window/FWS.cxx
+++ b/vcl/unx/generic/window/FWS.cxx
@@ -57,7 +57,6 @@ static Window fwsCommWindow;
 Bool
 WMSupportsFWS (Display *display, int screen)
 {
-    unsigned int    i;
     Atom            protocol;
     Atom            propType;
     int             propFormat;
@@ -127,7 +126,7 @@ WMSupportsFWS (Display *display, int screen)
         return False;
     }
 
-    for (i = 0; i < propItems; ++i)
+    for (unsigned long i = 0; i < propItems; ++i)
     {
         protocol = reinterpret_cast<Atom *>(propData)[i];
         if (protocol == FWS_STACK_UNDER)
diff --git a/vcl/unx/kde4/KDEXLib.cxx b/vcl/unx/kde4/KDEXLib.cxx
index 8d59315..1041373 100644
--- a/vcl/unx/kde4/KDEXLib.cxx
+++ b/vcl/unx/kde4/KDEXLib.cxx
@@ -120,13 +120,12 @@ void KDEXLib::Init()
             "bischoff at kde.org" );
 
     m_nFakeCmdLineArgs = 2;
-    sal_uInt16 nIdx;
 
-    int nParams = osl_getCommandArgCount();
+    sal_uInt32 nParams = osl_getCommandArgCount();
     OString aDisplay;
     OUString aParam, aBin;
 
-    for ( nIdx = 0; nIdx < nParams; ++nIdx )
+    for ( sal_uInt32 nIdx = 0; nIdx < nParams; ++nIdx )
     {
         osl_getCommandArg( nIdx, &aParam.pData );
         if ( !m_pFreeCmdLineArgs && aParam == "-display" && nIdx + 1 < nParams )


More information about the Libreoffice-commits mailing list