diff options
author | Noel Grandin <noel@peralex.com> | 2015-05-27 16:33:44 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-05-28 12:49:54 +0200 |
commit | d5129a9dd68978f9eccdd4597b5b6834557c422a (patch) | |
tree | df43250172f784f3048ce42ce1c3410d1d449c1e | |
parent | f3331f7694e74f349375c223ce7ed84838e92d89 (diff) |
new clang plugin: loopvartoosmall
Idea from bubli - look for loops where the index variable is of such
size that it cannot cover the range revealed by examining the length
part of the condition.
So far, I have only run the plugin up till the VCL module.
Also the plugin deliberately excludes anything more complicated than a
straightforward incrementing for loop.
Change-Id: Ifced18b01c03ea537c64168465ce0b8287a42015
50 files changed, 251 insertions, 132 deletions
diff --git a/UnoControls/source/controls/progressbar.cxx b/UnoControls/source/controls/progressbar.cxx index 6ff24bed4704..f5dd914ff2b7 100644 --- a/UnoControls/source/controls/progressbar.cxx +++ b/UnoControls/source/controls/progressbar.cxx @@ -352,7 +352,7 @@ void ProgressBar::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGra // Step to left side of window nBlockStart = nX; - for ( sal_Int16 i=1; i<=nBlockCount; ++i ) + for ( sal_Int32 i=1; i<=nBlockCount; ++i ) { // step free field nBlockStart += PROGRESSBAR_FREESPACE; @@ -370,7 +370,7 @@ void ProgressBar::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGra nBlockStart = nY+impl_getHeight(); nBlockStart -= m_aBlockSize.Height; - for ( sal_Int16 i=1; i<=nBlockCount; ++i ) + for ( sal_Int32 i=1; i<=nBlockCount; ++i ) { // step free field nBlockStart -= PROGRESSBAR_FREESPACE; diff --git a/accessibility/source/extended/accessibletabbar.cxx b/accessibility/source/extended/accessibletabbar.cxx index 5a368d7b4629..74fe20044f2b 100644 --- a/accessibility/source/extended/accessibletabbar.cxx +++ b/accessibility/source/extended/accessibletabbar.cxx @@ -179,7 +179,7 @@ namespace accessibility AccessibleTabBarBase::disposing(); // dispose all children - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) + for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i ) { Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); if ( xComponent.is() ) @@ -399,7 +399,7 @@ namespace accessibility OExternalLockGuard aGuard( this ); Reference< XAccessible > xChild; - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) + for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i ) { Reference< XAccessible > xAcc = getAccessibleChild( i ); if ( xAcc.is() ) diff --git a/accessibility/source/extended/accessibletabbarpagelist.cxx b/accessibility/source/extended/accessibletabbarpagelist.cxx index 8ca51866948c..33b5dd518f97 100644 --- a/accessibility/source/extended/accessibletabbarpagelist.cxx +++ b/accessibility/source/extended/accessibletabbarpagelist.cxx @@ -80,7 +80,7 @@ namespace accessibility void AccessibleTabBarPageList::UpdateShowing( bool bShowing ) { - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) + for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i ) { Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); if ( xChild.is() ) @@ -399,7 +399,7 @@ namespace accessibility AccessibleTabBarBase::disposing(); // dispose all children - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) + for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i ) { Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); if ( xComponent.is() ) @@ -580,7 +580,7 @@ namespace accessibility OExternalLockGuard aGuard( this ); Reference< XAccessible > xChild; - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) + for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i ) { Reference< XAccessible > xAcc = getAccessibleChild( i ); if ( xAcc.is() ) diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index 1a391ce13f04..ca205003f344 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -1416,7 +1416,7 @@ Document::retrieveParagraphBoundaryOfLine( Paragraph const * pParagraph, static_cast< css::uno::XWeak * >( this ) ); ::sal_Int32 nLineStart = 0; ::sal_Int32 nLineEnd = 0; - for ( ::sal_uInt16 nLine = 0; nLine <= nLineNo; ++nLine ) + for ( ::sal_Int32 nLine = 0; nLine <= nLineNo; ++nLine ) { ::sal_Int32 nLineLength = static_cast< ::sal_Int32 >( m_rEngine.GetLineLen( nNumber, nLine ) ); diff --git a/accessibility/source/standard/accessiblemenubasecomponent.cxx b/accessibility/source/standard/accessiblemenubasecomponent.cxx index 9ab7b0c6849d..47312f7fa914 100644 --- a/accessibility/source/standard/accessiblemenubasecomponent.cxx +++ b/accessibility/source/standard/accessiblemenubasecomponent.cxx @@ -248,7 +248,7 @@ void OAccessibleMenuBaseComponent::UpdateFocused( sal_Int32 i, bool bFocused ) void OAccessibleMenuBaseComponent::UpdateVisible() { SetVisible( IsVisible() ); - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) + for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i ) { Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); if ( xChild.is() ) @@ -489,7 +489,7 @@ bool OAccessibleMenuBaseComponent::IsChildHighlighted() { bool bChildHighlighted = false; - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) + for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i ) { Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); if ( xChild.is() ) @@ -669,7 +669,7 @@ void OAccessibleMenuBaseComponent::ProcessMenuEvent( const VclMenuEvent& rVclMen m_pMenu = NULL; // dispose all menu items - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) + for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i ) { Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); if ( xComponent.is() ) @@ -713,7 +713,7 @@ void OAccessibleMenuBaseComponent::disposing() m_pMenu = NULL; // dispose all menu items - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) + for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i ) { Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); if ( xComponent.is() ) diff --git a/accessibility/source/standard/vclxaccessiblestatusbar.cxx b/accessibility/source/standard/vclxaccessiblestatusbar.cxx index 42d1db5eb38e..d450f84e8c82 100644 --- a/accessibility/source/standard/vclxaccessiblestatusbar.cxx +++ b/accessibility/source/standard/vclxaccessiblestatusbar.cxx @@ -207,7 +207,7 @@ void VCLXAccessibleStatusBar::ProcessWindowEvent( const VclWindowEvent& rVclWind case VCLEVENT_STATUSBAR_SHOWALLITEMS: case VCLEVENT_STATUSBAR_HIDEALLITEMS: { - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) + for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i ) UpdateShowing( i, rVclWindowEvent.GetId() == VCLEVENT_STATUSBAR_SHOWALLITEMS ); } break; @@ -238,7 +238,7 @@ void VCLXAccessibleStatusBar::ProcessWindowEvent( const VclWindowEvent& rVclWind m_pStatusBar = NULL; // dispose all children - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) + for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i ) { Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); if ( xComponent.is() ) @@ -268,7 +268,7 @@ void VCLXAccessibleStatusBar::disposing() m_pStatusBar = NULL; // dispose all children - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) + for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i ) { Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); if ( xComponent.is() ) diff --git a/accessibility/source/standard/vclxaccessibletabcontrol.cxx b/accessibility/source/standard/vclxaccessibletabcontrol.cxx index 26ffc8ebd81e..a3425762630c 100644 --- a/accessibility/source/standard/vclxaccessibletabcontrol.cxx +++ b/accessibility/source/standard/vclxaccessibletabcontrol.cxx @@ -59,7 +59,7 @@ VCLXAccessibleTabControl::~VCLXAccessibleTabControl() void VCLXAccessibleTabControl::UpdateFocused() { - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) + for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i ) { Reference< XAccessible > xChild( m_aAccessibleChildren[i] ); if ( xChild.is() ) @@ -243,7 +243,7 @@ void VCLXAccessibleTabControl::ProcessWindowEvent( const VclWindowEvent& rVclWin m_pTabControl = NULL; // dispose all tab pages - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) + for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i ) { Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); if ( xComponent.is() ) @@ -326,7 +326,7 @@ void VCLXAccessibleTabControl::disposing() m_pTabControl = NULL; // dispose all tab pages - for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i ) + for ( size_t i = 0; i < m_aAccessibleChildren.size(); ++i ) { Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY ); if ( xComponent.is() ) diff --git a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx index 3eae85f5c500..5bb23ad2f10a 100644 --- a/basegfx/source/polygon/b2dpolygoncutandtouch.cxx +++ b/basegfx/source/polygon/b2dpolygoncutandtouch.cxx @@ -411,7 +411,7 @@ namespace basegfx } // append remapped tempVector entries for edge to tempPoints for edge - for(sal_uInt32 a(0L); a < aTempPointVectorEdge.size(); a++) + for(size_t a(0L); a < aTempPointVectorEdge.size(); a++) { 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 92b74e7e3e52..a77652d74ac6 100644 --- a/basegfx/source/polygon/b2dpolypolygon.cxx +++ b/basegfx/source/polygon/b2dpolypolygon.cxx @@ -105,7 +105,7 @@ public: void setClosed(bool bNew) { - for(sal_uInt32 a(0L); a < maPolygons.size(); a++) + for(size_t a(0L); a < maPolygons.size(); a++) { maPolygons[a].setClosed(bNew); } @@ -127,7 +127,7 @@ public: void transform(const basegfx::B2DHomMatrix& rMatrix) { - for(sal_uInt32 a(0L); a < maPolygons.size(); a++) + for(size_t a(0L); a < maPolygons.size(); a++) { maPolygons[a].transform(rMatrix); } diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx index 5f1385245fc5..c0d080be18c0 100644 --- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx +++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx @@ -1038,7 +1038,7 @@ namespace basegfx B2DPolyPolygonVector aResult; aResult.reserve(aInput.size()); - for(sal_uInt32 a(0); a < aInput.size(); a++) + for(size_t a(0); a < aInput.size(); a++) { const basegfx::B2DPolyPolygon aCandidate(prepareForPolygonOperation(aInput[a])); @@ -1080,7 +1080,7 @@ namespace basegfx B2DPolyPolygonVector aResult; aResult.reserve((aInput.size() / 2) + 1); - for(sal_uInt32 a(0); a < aInput.size(); a += 2) + for(size_t a(0); a < aInput.size(); a += 2) { if(a + 1 < aInput.size()) { diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx index 935287e3a53a..222bfa3863ac 100644 --- a/basegfx/source/polygon/b2dtrapezoid.cxx +++ b/basegfx/source/polygon/b2dtrapezoid.cxx @@ -423,7 +423,7 @@ 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(sal_uInt32 a = 0; a < rTrDeSimpleEdges.size(); a++) + for(size_t a = 0; a < rTrDeSimpleEdges.size(); a++) { // get horizontal edge as candidate; prepare its range and fixed Y const TrDeSimpleEdge& rHorEdge = rTrDeSimpleEdges[a]; diff --git a/basegfx/source/polygon/b3dpolypolygon.cxx b/basegfx/source/polygon/b3dpolypolygon.cxx index a96d4dac7355..9cfc8f8f9753 100644 --- a/basegfx/source/polygon/b3dpolypolygon.cxx +++ b/basegfx/source/polygon/b3dpolypolygon.cxx @@ -121,7 +121,7 @@ public: void transform(const ::basegfx::B3DHomMatrix& rMatrix) { - for(sal_uInt32 a(0L); a < maPolygons.size(); a++) + for(size_t a(0L); a < maPolygons.size(); a++) { maPolygons[a].transform(rMatrix); } @@ -129,7 +129,7 @@ public: void clearBColors() { - for(sal_uInt32 a(0L); a < maPolygons.size(); a++) + for(size_t a(0L); a < maPolygons.size(); a++) { maPolygons[a].clearBColors(); } @@ -137,7 +137,7 @@ public: void transformNormals(const ::basegfx::B3DHomMatrix& rMatrix) { - for(sal_uInt32 a(0L); a < maPolygons.size(); a++) + for(size_t a(0L); a < maPolygons.size(); a++) { maPolygons[a].transformNormals(rMatrix); } @@ -145,7 +145,7 @@ public: void clearNormals() { - for(sal_uInt32 a(0L); a < maPolygons.size(); a++) + for(size_t a(0L); a < maPolygons.size(); a++) { maPolygons[a].clearNormals(); } @@ -153,7 +153,7 @@ public: void transformTextureCoordiantes(const ::basegfx::B2DHomMatrix& rMatrix) { - for(sal_uInt32 a(0L); a < maPolygons.size(); a++) + for(size_t a(0L); a < maPolygons.size(); a++) { maPolygons[a].transformTextureCoordiantes(rMatrix); } @@ -161,7 +161,7 @@ public: void clearTextureCoordinates() { - for(sal_uInt32 a(0L); a < maPolygons.size(); a++) + for(size_t a(0L); a < maPolygons.size(); a++) { maPolygons[a].clearTextureCoordinates(); } diff --git a/compilerplugins/clang/loopvartoosmall.cxx b/compilerplugins/clang/loopvartoosmall.cxx new file mode 100644 index 000000000000..9cfa9f272444 --- /dev/null +++ b/compilerplugins/clang/loopvartoosmall.cxx @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <string> +#include <iostream> + +#include "plugin.hxx" +#include "compat.hxx" +#include "clang/AST/CXXInheritance.h" + +// Idea from bubli. Check that the index variable in a for loop is able to cover the range +// revealed by the terminating condition. +// If not, we might end up in an endless loop, or just not process certain parts. + +namespace { + +class LoopVarTooSmall: + public RecursiveASTVisitor<LoopVarTooSmall>, public loplugin::Plugin +{ +public: + explicit LoopVarTooSmall(InstantiationData const & data): Plugin(data) {} + + virtual void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); } + + bool VisitForStmt( const ForStmt* stmt ); + +private: + StringRef getFilename(SourceLocation loc); + +}; + +StringRef LoopVarTooSmall::getFilename(SourceLocation loc) +{ + SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(loc); + StringRef name { compiler.getSourceManager().getFilename(spellingLocation) }; + return name; +} + +bool LoopVarTooSmall::VisitForStmt( const ForStmt* stmt ) +{ + if (ignoreLocation( stmt )) + return true; + // ignore SAL for now + StringRef aFileName = getFilename(stmt->getLocStart()); + if (aFileName.startswith(SRCDIR "/sal/")) { + return true; + } + + const Stmt* initStmt = stmt->getInit(); + if (!initStmt || !isa<DeclStmt>(initStmt)) + return true; + const DeclStmt* declStmt = dyn_cast<DeclStmt>(initStmt); + if (!declStmt->getDeclGroup().isSingleDecl()) + return true; + const Decl* decl = declStmt->getSingleDecl(); + if (!decl || !isa<VarDecl>(decl)) + return true; + const VarDecl* varDecl = dyn_cast<VarDecl>(decl); + QualType qt = varDecl->getType(); + if (!qt->isIntegralType(compiler.getASTContext())) + return true; + uint64_t qt1BitWidth = compiler.getASTContext().getTypeSize(qt); + + if (!stmt->getCond() || !isa<BinaryOperator>(stmt->getCond())) + return true; + const BinaryOperator* binOp = dyn_cast<BinaryOperator>(stmt->getCond()); + if (binOp->getOpcode() != BO_LT && binOp->getOpcode() != BO_LE) + return true; + const Expr* binOpRHS = binOp->getRHS(); + // ignore complex expressions for now + if (isa<BinaryOperator>(binOpRHS)) + return true; + if (isa<ImplicitCastExpr>(binOpRHS)) + { + const ImplicitCastExpr* castExpr = dyn_cast<ImplicitCastExpr>(binOpRHS); + binOpRHS = castExpr->getSubExpr(); + } + QualType qt2 = binOpRHS->getType(); + if (!qt2->isIntegralType(compiler.getASTContext())) + return true; + // check for comparison with constants where the compiler just tends to give me the type as "int" + llvm::APSInt aIntResult; + uint64_t qt2BitWidth = compiler.getASTContext().getTypeSize(qt2); + if (binOpRHS->EvaluateAsInt(aIntResult, compiler.getASTContext())) { + if (aIntResult.getSExtValue() > 0 && aIntResult.getSExtValue() < 1<<7) { + qt2BitWidth = 8; + } + else if (aIntResult.getSExtValue() > 0 && aIntResult.getSExtValue() < 1<<15) { + qt2BitWidth = 16; + } + else if (aIntResult.getSExtValue() > 0 && aIntResult.getSExtValue() < 1L<<31) { + qt2BitWidth = 32; + } + } + + if (qt1BitWidth < qt2BitWidth) + { + report( + DiagnosticsEngine::Warning, + "loop index variable is shorter than length type. " + qt.getAsString() + " < " + qt2.getAsString(), + stmt->getLocStart()) + << stmt->getSourceRange(); +// stmt->getCond()->dump(); + } + return true; +} + + +loplugin::Plugin::Registration< LoopVarTooSmall > X("loopvartoosmall", false); + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx index d68327d29e70..5093bd4adfb1 100644 --- a/l10ntools/source/cfgmerge.cxx +++ b/l10ntools/source/cfgmerge.cxx @@ -470,7 +470,7 @@ void CfgMerge::WorkOnResourceEnd() if ( pEntrys ) { OString sCur; - for( unsigned int i = 0; i < aLanguages.size(); ++i ){ + for( size_t i = 0; i < aLanguages.size(); ++i ){ sCur = aLanguages[ i ]; OString sContent; diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx index ced58e3c473a..25b2cdbf31b6 100644 --- a/l10ntools/source/export.cxx +++ b/l10ntools/source/export.cxx @@ -662,7 +662,7 @@ int Export::Execute( int nToken, const char * pToken ) // the current token must be written to dest. without merging if( bDefine && sOrig.getLength() > 2 ){ - for( sal_uInt16 n = 0 ; n < sOrig.getLength() ; n++ ){ + for( sal_Int32 n = 0; n < sOrig.getLength(); n++ ){ if( sOrig[n] == '\n' && sOrig[n-1] != '\\'){ sOrig = sOrig.replaceAt(n++, 0, "\\"); } @@ -1019,7 +1019,7 @@ void Export::ResData2Output( MergeEntrys *pEntry, sal_uInt16 nType, const OStrin bool bFirst = true; OString sCur; - for( unsigned int n = 0; n < aLanguages.size(); n++ ){ + for( size_t n = 0; n < aLanguages.size(); n++ ){ sCur = aLanguages[ n ]; OString sText; @@ -1048,7 +1048,7 @@ void Export::ResData2Output( MergeEntrys *pEntry, sal_uInt16 nType, const OStrin sOutput.append(";\n"); else bAddSemicolon = true; - for ( sal_uInt16 j = 1; j < nLevel; j++ ) + for ( size_t j = 1; j < nLevel; j++ ) sOutput.append("\t"); WriteToMerged( sOutput.makeStringAndClear() , true ); } @@ -1103,7 +1103,7 @@ void Export::MergeRest( ResData *pResData ) sSpace += "\t"; OString sCur; - for( unsigned int n = 0; n < aLanguages.size(); n++ ) + for( size_t n = 0; n < aLanguages.size(); n++ ) { sCur = aLanguages[ n ]; diff --git a/l10ntools/source/propmerge.cxx b/l10ntools/source/propmerge.cxx index a41cd154d4c3..513cb79cb59c 100644 --- a/l10ntools/source/propmerge.cxx +++ b/l10ntools/source/propmerge.cxx @@ -135,7 +135,7 @@ void PropParser::Extract( const OString& rPOFile ) return; } - for( unsigned nIndex = 0; nIndex < m_vLines.size(); ++nIndex ) + for( size_t nIndex = 0; nIndex < m_vLines.size(); ++nIndex ) { const OString sLine = m_vLines[nIndex]; const sal_Int32 nEqualSign = sLine.indexOf('='); @@ -184,7 +184,7 @@ void PropParser::Merge( const OString &rMergeSrc, const OString &rDestinationFil } } - for( unsigned nIndex = 0; nIndex < m_vLines.size(); ++nIndex ) + for( size_t nIndex = 0; nIndex < m_vLines.size(); ++nIndex ) { const OString sLine = m_vLines[nIndex]; const sal_Int32 nEqualSign = sLine.indexOf('='); diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index 421195d54e10..b47c7c38dcdd 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -413,7 +413,7 @@ void XRMResMerge::WorkOnDesc( if ( pEntrys ) { OString sCur; OString sDescFilename = GetAttribute ( rOpenTag, "xlink:href" ); - for( unsigned int n = 0; n < aLanguages.size(); n++ ){ + for( size_t n = 0; n < aLanguages.size(); n++ ){ sCur = aLanguages[ n ]; OString sContent; if ( !sCur.equalsIgnoreAsciiCase("en-US") && @@ -502,7 +502,7 @@ void XRMResMerge::EndOfText( MergeEntrys *pEntrys = pMergeDataFile->GetMergeEntrys( pResData ); if ( pEntrys ) { OString sCur; - for( unsigned int n = 0; n < aLanguages.size(); n++ ){ + for( size_t n = 0; n < aLanguages.size(); n++ ){ sCur = aLanguages[ n ]; OString sContent; if (!sCur.equalsIgnoreAsciiCase("en-US") && diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx index 6af272039128..e20b41d13794 100644 --- a/registry/source/regimpl.cxx +++ b/registry/source/regimpl.cxx @@ -1274,7 +1274,7 @@ RegError ORegistry::mergeModuleValue(OStoreStream& rTargetValue, 0, 0); - for (sal_uInt16 i=0 ; i < reader.getFieldCount(); i++) + for (sal_uInt32 i=0 ; i < reader.getFieldCount(); i++) { writer.setFieldData(index, reader.getFieldName(i), @@ -1285,7 +1285,7 @@ RegError ORegistry::mergeModuleValue(OStoreStream& rTargetValue, reader.getFieldConstValue(i)); index++; } - for (sal_uInt16 i=0 ; i < reader2.getFieldCount(); i++) + for (sal_uInt32 i=0 ; i < reader2.getFieldCount(); i++) { if (nameSet.find(reader2.getFieldName(i)) == nameSet.end()) { diff --git a/shell/source/unix/sysshell/recently_used_file_handler.cxx b/shell/source/unix/sysshell/recently_used_file_handler.cxx index 0ae84e9e4f3f..e66d96d1ed51 100644 --- a/shell/source/unix/sysshell/recently_used_file_handler.cxx +++ b/shell/source/unix/sysshell/recently_used_file_handler.cxx @@ -151,7 +151,7 @@ namespace /* private */ { static OString escape_content(const string_t &text) { OStringBuffer aBuf; - for (sal_uInt32 i = 0; i < text.length(); i++) + for (size_t i = 0; i < text.length(); i++) { switch (text[i]) { diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx index cd99b76f7388..acc0417fefc4 100644 --- a/sot/source/sdstor/stgstrms.cxx +++ b/sot/source/sdstor/stgstrms.cxx @@ -611,7 +611,7 @@ sal_Int32 StgFATStrm::GetPage( short nOff, bool bMake, sal_uInt16 *pnMasterAlloc pMaster = rIo.Copy( nFAT, STG_FREE ); if ( pMaster.is() ) { - for( short k = 0; k < ( nPageSize >> 2 ); k++ ) + for( short k = 0; k < (short)( nPageSize >> 2 ); k++ ) rIo.SetToPage( pMaster, k, STG_FREE ); // Verkettung herstellen if( !pOldPage.is() ) @@ -763,7 +763,7 @@ bool StgFATStrm::SetSize( sal_Int32 nBytes ) rtl::Reference< StgPage > pPg = rIo.Copy( nNewPage, STG_FREE ); if ( !pPg.is() ) return false; - for( short j = 0; j < ( nPageSize >> 2 ); j++ ) + for( short j = 0; j < (short)( nPageSize >> 2 ); j++ ) rIo.SetToPage( pPg, j, STG_FREE ); // store the page number into the master FAT @@ -776,7 +776,7 @@ bool StgFATStrm::SetSize( sal_Int32 nBytes ) sal_uInt32 nMax = rIo.aHdr.GetMasters( ); sal_uInt32 nFAT = rIo.aHdr.GetFATChain(); if( nMasterAlloc ) - for( sal_uInt16 nCount = 0; nCount < nMax; nCount++ ) + for( sal_uInt32 nCount = 0; nCount < nMax; nCount++ ) { if( !Pos2Page( nFAT << 2 ) ) return false; diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx index fd4b822e9643..a1d4f6dc2263 100644 --- a/sot/source/unoolestorage/xolesimplestorage.cxx +++ b/sot/source/unoolestorage/xolesimplestorage.cxx @@ -560,7 +560,7 @@ uno::Sequence< OUString > SAL_CALL OLESimpleStorage::getElementNames() } uno::Sequence< OUString > aSeq( aList.size() ); - for ( sal_uInt32 nInd = 0; nInd < aList.size(); nInd++ ) + for ( size_t nInd = 0; nInd < aList.size(); nInd++ ) aSeq[nInd] = aList[nInd].GetName(); return aSeq; diff --git a/svl/source/items/aeitem.cxx b/svl/source/items/aeitem.cxx index 09356f2041d4..b5896c5af304 100644 --- a/svl/source/items/aeitem.cxx +++ b/svl/source/items/aeitem.cxx @@ -111,7 +111,7 @@ SfxAllEnumItem::SfxAllEnumItem(const SfxAllEnumItem &rCopy): pValues = new SfxAllEnumValueArr; - for ( sal_uInt16 nPos = 0; nPos < rCopy.pValues->size(); ++nPos ) + for ( size_t nPos = 0; nPos < rCopy.pValues->size(); ++nPos ) { SfxAllEnumValue_Impl *pVal = new SfxAllEnumValue_Impl; pVal->nValue = (*rCopy.pValues)[nPos].nValue; diff --git a/svl/source/items/ilstitem.cxx b/svl/source/items/ilstitem.cxx index de869ae63416..140e3b857314 100644 --- a/svl/source/items/ilstitem.cxx +++ b/svl/source/items/ilstitem.cxx @@ -34,7 +34,7 @@ SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, const ::std::vector < : SfxPoolItem( which ) { m_aList.realloc( rList.size() ); - for ( sal_uInt16 n=0; n<rList.size(); ++n ) + for ( size_t n=0; n<rList.size(); ++n ) m_aList[n] = rList[n]; } diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx index 8f4a860af519..019ab6f7f249 100644 --- a/svl/source/items/itempool.cxx +++ b/svl/source/items/itempool.cxx @@ -778,7 +778,7 @@ void SfxPoolItemArray_Impl::ReHash() maFree.clear(); maHash.clear(); - for (sal_uInt32 nIdx = 0; nIdx < size(); ++nIdx) + for (size_t nIdx = 0; nIdx < size(); ++nIdx) { SfxPoolItem *pItem = (*this)[nIdx]; if (!pItem) diff --git a/svl/source/notify/lstner.cxx b/svl/source/notify/lstner.cxx index 4c3dc073f3ab..b7b338767a5e 100644 --- a/svl/source/notify/lstner.cxx +++ b/svl/source/notify/lstner.cxx @@ -45,7 +45,7 @@ SfxListener::SfxListener() : mpImpl(new Impl) SfxListener::SfxListener( const SfxListener &rListener ) : mpImpl(new Impl) { - for ( sal_uInt16 n = 0; n < rListener.mpImpl->maBCs.size(); ++n ) + for ( size_t n = 0; n < rListener.mpImpl->maBCs.size(); ++n ) StartListening( *rListener.mpImpl->maBCs[n] ); } @@ -54,7 +54,7 @@ SfxListener::SfxListener( const SfxListener &rListener ) : mpImpl(new Impl) SfxListener::~SfxListener() { // unregister at all remaining broadcasters - for ( sal_uInt16 nPos = 0; nPos < mpImpl->maBCs.size(); ++nPos ) + for ( size_t nPos = 0; nPos < mpImpl->maBCs.size(); ++nPos ) { SfxBroadcaster *pBC = mpImpl->maBCs[nPos]; pBC->RemoveListener(*this); diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 002d9e5e5fbb..45d276958c71 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -1589,7 +1589,7 @@ static unsigned char implGetCryptMask(const sal_Char* pStr, sal_Int32 nLen, long } else // BugFix #25888# { - for( sal_uInt16 i = 0; i < nLen; i++ ) { + for( sal_Int32 i = 0; i < nLen; i++ ) { nCryptMask ^= pStr[i]; if( nCryptMask & 0x80 ) { nCryptMask <<= 1; diff --git a/unoidl/source/legacyprovider.cxx b/unoidl/source/legacyprovider.cxx index d3f34bb0918e..9c0b21d8ab2e 100644 --- a/unoidl/source/legacyprovider.cxx +++ b/unoidl/source/legacyprovider.cxx @@ -390,7 +390,7 @@ rtl::Reference< Entity > readEntity( } std::vector< PlainStructTypeEntity::Member > mems; n = reader.getFieldCount(); - for (sal_uInt16 j = 0; j != n; ++j) { + for (sal_uInt32 j = 0; j != n; ++j) { mems.push_back( PlainStructTypeEntity::Member( reader.getFieldName(j), @@ -411,13 +411,13 @@ rtl::Reference< Entity > readEntity( " with key " + sub.getName())); } std::vector< OUString > params; - for (sal_uInt16 j = 0; j != n; ++j) { + for (sal_uInt32 j = 0; j != n; ++j) { params.push_back( reader.getReferenceTypeName(j).replace('/', '.')); } std::vector< PolymorphicStructTypeTemplateEntity::Member > mems; n = reader.getFieldCount(); - for (sal_uInt16 j = 0; j != n; ++j) { + for (sal_uInt32 j = 0; j != n; ++j) { mems.push_back( PolymorphicStructTypeTemplateEntity::Member( reader.getFieldName(j), diff --git a/unotools/source/config/searchopt.cxx b/unotools/source/config/searchopt.cxx index 3c442ab4ad53..87dc3e0ab9b4 100644 --- a/unotools/source/config/searchopt.cxx +++ b/unotools/source/config/searchopt.cxx @@ -177,7 +177,7 @@ bool SvtSearchOptions_Impl::Load() bSucc = true; const Any* pValues = aValues.getConstArray(); - for (sal_uInt16 i = 0; i < nProps; ++i) + for (sal_Int32 i = 0; i < nProps; ++i) { const Any &rVal = pValues[i]; DBG_ASSERT( rVal.hasValue(), "property value missing" ); @@ -227,7 +227,7 @@ bool SvtSearchOptions_Impl::Save() "unexpected size of index" ); if (nProps && nProps == MAX_FLAGS_OFFSET + 1) { - for (sal_uInt16 i = 0; i < nProps; ++i) + for (sal_Int32 i = 0; i < nProps; ++i) pValue[i] <<= GetFlag(i); bSucc |= PutProperties( aNames, aValues ); } diff --git a/vcl/generic/print/prtsetup.cxx b/vcl/generic/print/prtsetup.cxx index 738d00de721a..9d74f048ae3a 100644 --- a/vcl/generic/print/prtsetup.cxx +++ b/vcl/generic/print/prtsetup.cxx @@ -341,7 +341,7 @@ RTSDevicePage::RTSDevicePage( RTSDialog* pParent ) m_pLevelBox->SetEntryData(0, m_pLevelBox->GetEntryData(1)); m_pLevelBox->RemoveEntry(1); - for( sal_uInt16 i = 0; i < m_pLevelBox->GetEntryCount(); i++ ) + for( sal_Int32 i = 0; i < m_pLevelBox->GetEntryCount(); i++ ) { if( reinterpret_cast<sal_uLong>(m_pLevelBox->GetEntryData( i )) == nLevelEntryData ) { diff --git a/vcl/source/bitmap/BitmapFilterStackBlur.cxx b/vcl/source/bitmap/BitmapFilterStackBlur.cxx index 975f3ad0fa00..4358f2b90fb7 100644 --- a/vcl/source/bitmap/BitmapFilterStackBlur.cxx +++ b/vcl/source/bitmap/BitmapFilterStackBlur.cxx @@ -492,9 +492,9 @@ void centerExtendBitmap(Bitmap& rBitmap, sal_Int32 nExtendSize, Color aColor) long nWidthBorder = nExtendSize + rSize.Width(); long nHeightBorder = nExtendSize + rSize.Height(); - for (int y = 0; y < aNewSize.Height(); y++) + for (long y = 0; y < aNewSize.Height(); y++) { - for (int x = 0; x < aNewSize.Width(); x++) + for (long x = 0; x < aNewSize.Width(); x++) { if (y < nExtendSize || y >= nHeightBorder || x < nExtendSize || x >= nWidthBorder) diff --git a/vcl/source/bitmap/bitmapscalesuper.cxx b/vcl/source/bitmap/bitmapscalesuper.cxx index 2172aa53c0de..b19930409935 100644 --- a/vcl/source/bitmap/bitmapscalesuper.cxx +++ b/vcl/source/bitmap/bitmapscalesuper.cxx @@ -327,7 +327,7 @@ void scalePallete8bit2(ScaleContext &rCtx, long nStartY, long nEndY) long nSumB = 0; long nTotalWeightY = 0; - for(int i = 0; i<= nLineRange; i++) + for(long i = 0; i<= nLineRange; i++) { Scanline pTmpY = rCtx.mpSrc->GetScanline( nLineStart + i ); long nSumRowR = 0; @@ -335,7 +335,7 @@ void scalePallete8bit2(ScaleContext &rCtx, long nStartY, long nEndY) long nSumRowB = 0; long nTotalWeightX = 0; - for(int j = 0; j <= nRowRange; j++) + for(long j = 0; j <= nRowRange; j++) { const BitmapColor& rCol = rCtx.mpSrc->GetPaletteColor( pTmpY[ nRowStart + j ] ); @@ -451,14 +451,14 @@ void scalePalleteGeneral2(ScaleContext &rCtx, long nStartY, long nEndY) long nSumB = 0; long nTotalWeightY = 0; - for(int i = 0; i<= nLineRange; i++) + for(long i = 0; i<= nLineRange; i++) { long nSumRowR = 0; long nSumRowG = 0; long nSumRowB = 0; long nTotalWeightX = 0; - for(int j = 0; j <= nRowRange; j++) + for(long j = 0; j <= nRowRange; j++) { BitmapColor aCol0 = rCtx.mpSrc->GetPaletteColor ( rCtx.mpSrc->GetPixelIndex( nLineStart + i, nRowStart + j ) ); @@ -580,7 +580,7 @@ void scale24bitBGR2(ScaleContext &rCtx, long nStartY, long nEndY) long nSumB = 0; long nTotalWeightY = 0; - for(int i = 0; i<= nLineRange; i++) + for(long i = 0; i<= nLineRange; i++) { Scanline pTmpY = rCtx.mpSrc->GetScanline( nLineStart + i ); Scanline pTmpX = pTmpY + 3L * nRowStart; @@ -589,7 +589,7 @@ void scale24bitBGR2(ScaleContext &rCtx, long nStartY, long nEndY) long nSumRowB = 0; long nTotalWeightX = 0; - for(int j = 0; j <= nRowRange; j++) + for(long j = 0; j <= nRowRange; j++) { if(nX == nEndX ) { @@ -701,7 +701,7 @@ void scale24bitRGB2(ScaleContext &rCtx, long nStartY, long nEndY) long nSumB = 0; long nTotalWeightY = 0; - for(int i = 0; i<= nLineRange; i++) + for(long i = 0; i<= nLineRange; i++) { Scanline pTmpY = rCtx.mpSrc->GetScanline( nLineStart + i ); Scanline pTmpX = pTmpY + 3L * nRowStart; @@ -710,7 +710,7 @@ void scale24bitRGB2(ScaleContext &rCtx, long nStartY, long nEndY) long nSumRowB = 0; long nTotalWeightX = 0; - for(int j = 0; j <= nRowRange; j++) + for(long j = 0; j <= nRowRange; j++) { if(nX == nEndX ) { @@ -822,14 +822,14 @@ void scaleNonPalleteGeneral2(ScaleContext &rCtx, long nStartY, long nEndY) long nSumB = 0; long nTotalWeightY = 0; - for(int i = 0; i<= nLineRange; i++) + for(long i = 0; i<= nLineRange; i++) { long nSumRowR = 0; long nSumRowG = 0; long nSumRowB = 0; long nTotalWeightX = 0; - for(int j = 0; j <= nRowRange; j++) + for(long j = 0; j <= nRowRange; j++) { BitmapColor aCol0 = rCtx.mpSrc->GetPixel( nLineStart + i, nRowStart + j ); diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 9ff20ba8b47e..05eb6054b62f 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -2361,7 +2361,7 @@ TextFilter::~TextFilter() OUString TextFilter::filter(const OUString &rText) { OUString sTemp(rText); - for (sal_uInt16 i = 0; i < sForbiddenChars.getLength(); ++i) + for (sal_Int32 i = 0; i < sForbiddenChars.getLength(); ++i) { sTemp = comphelper::string::remove(sTemp, sForbiddenChars[i]); } diff --git a/vcl/source/edit/textdata.cxx b/vcl/source/edit/textdata.cxx index 30eb44e05f28..80d1680d14e5 100644 --- a/vcl/source/edit/textdata.cxx +++ b/vcl/source/edit/textdata.cxx @@ -74,7 +74,7 @@ sal_uInt16 TETextPortionList::FindPortion( sal_uInt16 nCharPos, sal_uInt16& nPor { // find left portion at nCharPos at portion border sal_uInt16 nTmpPos = 0; - for ( sal_uInt16 nPortion = 0; nPortion < size(); nPortion++ ) + for ( size_t nPortion = 0; nPortion < size(); nPortion++ ) { TETextPortion* pPortion = operator[]( nPortion ); nTmpPos = nTmpPos + pPortion->GetLen(); @@ -161,7 +161,7 @@ void TEParaPortion::MarkSelectionInvalid( sal_uInt16 nStart, sal_uInt16 /*nEnd*/ sal_uInt16 TEParaPortion::GetLineNumber( sal_uInt16 nChar, bool bInclEnd ) { - for ( sal_uInt16 nLine = 0; nLine < maLines.size(); nLine++ ) + for ( size_t nLine = 0; nLine < maLines.size(); nLine++ ) { TextLine& pLine = maLines[ nLine ]; if ( ( bInclEnd && ( pLine.GetEnd() >= nChar ) ) || diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index bde1b0ffb3d7..acbe1c56ed2d 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -430,7 +430,7 @@ void TextEngine::ImpRemoveText() TextPaM aStartPaM( 0, 0 ); TextSelection aEmptySel( aStartPaM, aStartPaM ); - for ( sal_uInt16 nView = 0; nView < mpViews->size(); nView++ ) + for ( size_t nView = 0; nView < mpViews->size(); nView++ ) { TextView* pView = (*mpViews)[ nView ]; pView->ImpSetSelection( aEmptySel ); @@ -453,7 +453,7 @@ void TextEngine::SetText( const OUString& rText ) if ( !rText.isEmpty() ) aPaM = ImpInsertText( aEmptySel, rText ); - for ( sal_uInt16 nView = 0; nView < mpViews->size(); nView++ ) + for ( size_t nView = 0; nView < mpViews->size(); nView++ ) { TextView* pView = (*mpViews)[ nView ]; pView->ImpSetSelection( aEmptySel ); @@ -898,7 +898,7 @@ Rectangle TextEngine::GetEditCursor( const TextPaM& rPaM, bool bSpecial, bool bP long nY = 0; sal_uInt16 nCurIndex = 0; TextLine* pLine = 0; - for ( sal_uInt16 nLine = 0; nLine < pPortion->GetLines().size(); nLine++ ) + for ( size_t nLine = 0; nLine < pPortion->GetLines().size(); nLine++ ) { TextLine& pTmpLine = pPortion->GetLines()[ nLine ]; if ( ( pTmpLine.GetStart() == rPaM.GetIndex() ) || ( pTmpLine.IsIn( rPaM.GetIndex(), bSpecial ) ) ) @@ -1482,7 +1482,7 @@ void TextEngine::UpdateViews( TextView* pCurView ) DBG_ASSERT( IsFormatted(), "UpdateViews: Doc not formatted!" ); - for ( sal_uInt16 nView = 0; nView < mpViews->size(); nView++ ) + for ( size_t nView = 0; nView < mpViews->size(); nView++ ) { TextView* pView = (*mpViews)[ nView ]; pView->HideCursor(); @@ -1769,7 +1769,7 @@ void TextEngine::CreateTextPortions( sal_uLong nPara, sal_uInt16 nStartPos ) if ( mpIMEInfos && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetPara() == nPara ) ) { sal_uInt16 nLastAttr = 0xFFFF; - for( sal_uInt16 n = 0; n < mpIMEInfos->nLen; n++ ) + for( sal_Int32 n = 0; n < mpIMEInfos->nLen; n++ ) { if ( mpIMEInfos->pAttribs[n] != nLastAttr ) { @@ -2936,7 +2936,7 @@ void TextEngine::ImpInitWritingDirections( sal_uLong nPara ) int32_t nEnd; UBiDiLevel nCurrDir; - for ( sal_uInt16 nIdx = 0; nIdx < nCount; ++nIdx ) + for ( long nIdx = 0; nIdx < nCount; ++nIdx ) { ubidi_getLogicalRun( pBidi, nStart, &nEnd, &nCurrDir ); rInfos.push_back( TEWritingDirectionInfo( nCurrDir, (sal_uInt16)nStart, (sal_uInt16)nEnd ) ); diff --git a/vcl/source/filter/wmf/winmtf.cxx b/vcl/source/filter/wmf/winmtf.cxx index f14f9345ffc7..c77088989a16 100644 --- a/vcl/source/filter/wmf/winmtf.cxx +++ b/vcl/source/filter/wmf/winmtf.cxx @@ -867,7 +867,7 @@ WinMtfOutput::~WinMtfOutput() else mpGDIMetaFile->SetPrefSize( mrclFrame.GetSize() ); - for ( sal_uInt32 i = 0; i < vGDIObj.size(); i++ ) + for ( size_t i = 0; i < vGDIObj.size(); i++ ) delete vGDIObj[ i ]; } diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx index c7d131586c92..028e7fc675d3 100644 --- a/vcl/source/filter/wmf/winwmf.cxx +++ b/vcl/source/filter/wmf/winwmf.cxx @@ -745,9 +745,9 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc ) pBmp = aBmp.AcquireReadAccess(); if ( pBmp ) { - for ( sal_Int32 y = 0; y < pBmp->Height(); y++ ) + for ( long y = 0; y < pBmp->Height(); y++ ) { - for ( sal_Int32 x = 0; x < pBmp->Width(); x++ ) + for ( long x = 0; x < pBmp->Width(); x++ ) { const BitmapColor aColor( pBmp->GetColor( y, x ) ); diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx index 83b98ce7f454..ca3f77f9aa63 100644 --- a/vcl/source/filter/wmf/wmfwr.cxx +++ b/vcl/source/filter/wmf/wmfwr.cxx @@ -570,11 +570,11 @@ void WMFWriter::TrueExtTextOut( const Point& rPoint, const OUString& rString, boost::scoped_array<sal_Int16> pConvertedDXAry(new sal_Int16[ nOriginalTextLen ]); sal_Int32 j = 0; pConvertedDXAry[ j++ ] = (sal_Int16)ScaleWidth( pDXAry[ 0 ] ); - for (sal_uInt16 i = 1; i < ( nOriginalTextLen - 1 ); ++i) + for (sal_Int32 i = 1; i < ( nOriginalTextLen - 1 ); ++i) pConvertedDXAry[ j++ ] = (sal_Int16)ScaleWidth( pDXAry[ i ] - pDXAry[ i - 1 ] ); pConvertedDXAry[ j ] = (sal_Int16)ScaleWidth( pDXAry[ nOriginalTextLen - 2 ] / ( nOriginalTextLen - 1 ) ); - for (sal_uInt16 i = 0; i < nOriginalTextLen; ++i) + for (sal_Int32 i = 0; i < nOriginalTextLen; ++i) { sal_Int16 nDx = pConvertedDXAry[ i ]; pWMF->WriteInt16( nDx ); diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx index 51e5db80924f..db5c1e9ba7d5 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -1435,7 +1435,7 @@ vcl::Region Bitmap::CreateRegion( const Color& rColor, const Rectangle& rRect ) aSubRect.Top() = nYStart; aSubRect.Bottom() = nY ? nY - 1 : 0; - for(sal_uInt32 a(0); a < aLine.size();) + for(size_t a(0); a < aLine.size();) { aSubRect.Left() = aLine[a++]; aSubRect.Right() = aLine[a++]; @@ -1458,7 +1458,7 @@ vcl::Region Bitmap::CreateRegion( const Color& rColor, const Rectangle& rRect ) aSubRect.Top() = nYStart; aSubRect.Bottom() = nY ? nY - 1 : 0; - for(sal_uInt32 a(0); a < aLine.size();) + for(size_t a(0); a < aLine.size();) { aSubRect.Left() = aLine[a++]; aSubRect.Right() = aLine[a++]; diff --git a/vcl/source/gdi/bitmap4.cxx b/vcl/source/gdi/bitmap4.cxx index 42ac92d0b859..24a4b08251e7 100644 --- a/vcl/source/gdi/bitmap4.cxx +++ b/vcl/source/gdi/bitmap4.cxx @@ -1160,9 +1160,9 @@ bool Bitmap::ImplSeparableUnsharpenFilter(const double radius) { BitmapColor aColor, aColorBlur; // For all pixels in original image subtract pixels values from blurred image - for( int x = 0; x < nWidth; x++ ) + for( long x = 0; x < nWidth; x++ ) { - for( int y = 0; y < nHeight; y++ ) + for( long y = 0; y < nHeight; y++ ) { aColorBlur = pReadAccBlur->GetColor( y , x ); aColor = pReadAcc->GetColor( y , x ); @@ -1194,9 +1194,9 @@ bool Bitmap::ImplDuotoneFilter( const sal_uLong nColorOne, const sal_uLong nColo const BitmapColor aColorOne( static_cast< sal_uInt8 >( nColorOne >> 16 ), static_cast< sal_uInt8 >( nColorOne >> 8 ), static_cast< sal_uInt8 >( nColorOne ) ); const BitmapColor aColorTwo( static_cast< sal_uInt8 >( nColorTwo >> 16 ), static_cast< sal_uInt8 >( nColorTwo >> 8 ), static_cast< sal_uInt8 >( nColorTwo ) ); - for( int x = 0; x < nWidth; x++ ) + for( long x = 0; x < nWidth; x++ ) { - for( int y = 0; y < nHeight; y++ ) + for( long y = 0; y < nHeight; y++ ) { BitmapColor aColor = pReadAcc->GetColor( y, x ); sal_uInt8 luminance = aColor.GetLuminance(); diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx index e6fa951a0927..5b0567a0cb38 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -855,9 +855,9 @@ namespace const Size aDestinationSizePixel(aDestination.GetSizePixel()); const BitmapColor aOutside(BitmapColor(0xff, 0xff, 0xff)); - for(sal_Int32 y(0L); y < aDestinationSizePixel.getHeight(); y++) + for(long y(0L); y < aDestinationSizePixel.getHeight(); y++) { - for(sal_Int32 x(0L); x < aDestinationSizePixel.getWidth(); x++) + for(long x(0L); x < aDestinationSizePixel.getWidth(); x++) { const basegfx::B2DPoint aSourceCoor(rTransform * basegfx::B2DPoint(x, y)); diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx index c57c53bb4f9b..aceb2524364e 100644 --- a/vcl/source/gdi/image.cxx +++ b/vcl/source/gdi/image.cxx @@ -341,7 +341,7 @@ ImageList::ImageList( const ::std::vector< OUString >& rNameVector, ImplInit( sal::static_int_cast< sal_uInt16 >( rNameVector.size() ), Size() ); mpImplData->maPrefix = rPrefix; - for( sal_uInt32 i = 0; i < rNameVector.size(); ++i ) + for( size_t i = 0; i < rNameVector.size(); ++i ) { mpImplData->AddImage( rNameVector[ i ], static_cast< sal_uInt16 >( i ) + 1, BitmapEx() ); } @@ -515,7 +515,7 @@ void ImageList::ReplaceImage( const OUString& rImageName, const Image& rImage ) void ImageList::RemoveImage( sal_uInt16 nId ) { - for( sal_uInt32 i = 0; i < mpImplData->maImages.size(); ++i ) + for( size_t i = 0; i < mpImplData->maImages.size(); ++i ) { if( mpImplData->maImages[ i ]->mnId == nId ) { @@ -585,7 +585,7 @@ sal_uInt16 ImageList::GetImagePos( sal_uInt16 nId ) const if( mpImplData && nId ) { - for( sal_uInt32 i = 0; i < mpImplData->maImages.size(); ++i ) + for( size_t i = 0; i < mpImplData->maImages.size(); ++i ) { if (mpImplData->maImages[ i ]->mnId == nId) return static_cast< sal_uInt16 >( i ); @@ -605,7 +605,7 @@ sal_uInt16 ImageList::GetImagePos( const OUString& rImageName ) const if( mpImplData && !rImageName.isEmpty() ) { - for( sal_uInt32 i = 0; i < mpImplData->maImages.size(); i++ ) + for( size_t i = 0; i < mpImplData->maImages.size(); i++ ) { if (mpImplData->maImages[i]->maName == rImageName) return static_cast< sal_uInt16 >( i ); @@ -641,7 +641,7 @@ void ImageList::GetImageNames( ::std::vector< OUString >& rNames ) const if( mpImplData ) { - for( sal_uInt32 i = 0; i < mpImplData->maImages.size(); i++ ) + for( size_t i = 0; i < mpImplData->maImages.size(); i++ ) { const OUString& rName( mpImplData->maImages[ i ]->maName ); if( !rName.isEmpty()) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 37ab711f393d..fe1b8330ffb8 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1359,7 +1359,7 @@ bool PDFWriterImpl::PDFPage::emit(sal_Int32 nParentObject ) unsigned int nStreamObjects = m_aStreamObjects.size(); if( nStreamObjects > 1 ) aLine.append( '[' ); - for( unsigned int i = 0; i < m_aStreamObjects.size(); i++ ) + for( size_t i = 0; i < m_aStreamObjects.size(); i++ ) { aLine.append( ' ' ); aLine.append( m_aStreamObjects[i] ); @@ -5394,7 +5394,7 @@ bool PDFWriterImpl::emitWidgetAnnotations() if( rWidget.m_nFlags & 0x200000 ) // multiselect { aValue.append( "[" ); - for( unsigned int i = 0; i < rWidget.m_aSelectedEntries.size(); i++ ) + for( size_t i = 0; i < rWidget.m_aSelectedEntries.size(); i++ ) { sal_Int32 nEntry = rWidget.m_aSelectedEntries[i]; if( nEntry >= 0 && nEntry < sal_Int32(rWidget.m_aListEntries.size()) ) @@ -5441,7 +5441,7 @@ bool PDFWriterImpl::emitWidgetAnnotations() if( rWidget.m_aKids.size() ) { aLine.append( "/Kids[" ); - for( unsigned int i = 0; i < rWidget.m_aKids.size(); i++ ) + for( size_t i = 0; i < rWidget.m_aKids.size(); i++ ) { aLine.append( rWidget.m_aKids[i] ); aLine.append( " 0 R" ); @@ -8138,7 +8138,7 @@ bool PDFWriterImpl::emitTrailer() if( m_aAdditionalStreams.size() > 0 ) { aLine.append( "/AdditionalStreams [" ); - for( unsigned int i = 0; i < m_aAdditionalStreams.size(); i++ ) + for( size_t i = 0; i < m_aAdditionalStreams.size(); i++ ) { aLine.append( "/" ); appendName( m_aAdditionalStreams[i].m_aMimeType, aLine ); @@ -11028,7 +11028,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit& rObject ) default: for( int y = aSize.Height()-1; y >= 0; y-- ) { - for( int x = 0; x < aSize.Width(); x++ ) + for( long x = 0; x < aSize.Width(); x++ ) { BitmapColor aColor = pAccess->GetColor( y, x ); aCol[0] = aColor.GetRed(); @@ -11454,7 +11454,7 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) { const int nScanLineBytes = 1 + ( pAccess->GetBitCount() * ( pAccess->Width() - 1 ) / 8U ); - for( int i = 0; i < pAccess->Height(); i++ ) + for( long i = 0; i < pAccess->Height(); i++ ) { CHECK_RETURN( writeBuffer( pAccess->GetScanline( i ), nScanLineBytes ) ); } @@ -11463,9 +11463,9 @@ bool PDFWriterImpl::writeBitmapObject( BitmapEmit& rObject, bool bMask ) { const int nScanLineBytes = pAccess->Width()*3; boost::shared_array<sal_uInt8> pCol( new sal_uInt8[ nScanLineBytes ] ); - for( int y = 0; y < pAccess->Height(); y++ ) + for( long y = 0; y < pAccess->Height(); y++ ) { - for( int x = 0; x < pAccess->Width(); x++ ) + for( long x = 0; x < pAccess->Width(); x++ ) { BitmapColor aColor = pAccess->GetColor( y, x ); pCol[3*x+0] = aColor.GetRed(); diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx index d9352a79202c..c33ea387fcd3 100644 --- a/vcl/source/gdi/pngread.cxx +++ b/vcl/source/gdi/pngread.cxx @@ -1268,12 +1268,12 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) { if ( mnPngDepth == 8 ) // maybe the source is a 16 bit grayscale { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 2 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 2 ) ImplSetAlphaPixel( nY, nX, pTmp[ 0 ], pTmp[ 1 ] ); } else { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 4 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 4 ) ImplSetAlphaPixel( nY, nX, pTmp[ 0 ], pTmp[ 2 ] ); } } @@ -1281,12 +1281,12 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) { if ( mnPngDepth == 8 ) // maybe the source is a 16 bit grayscale { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp++ ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp++ ) ImplSetAlphaPixel( nY, nX, *pTmp, mpTransTab[ *pTmp ] ); } else { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 2 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 2 ) ImplSetAlphaPixel( nY, nX, *pTmp, mpTransTab[ *pTmp ] ); } } @@ -1302,13 +1302,13 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) } else { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd ) ImplSetPixel( nY, nX, *pTmp++ ); } } else { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 2 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 2 ) ImplSetPixel( nY, nX, *pTmp ); } } @@ -1365,7 +1365,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) sal_uInt8* pScanline(mpScanline); sal_uInt8* pScanlineAlpha(mpScanlineAlpha); - for (sal_Int32 nX(0); nX < maOrigSize.Width(); nX++, pTmp += 4) + for (long nX(0); nX < maOrigSize.Width(); nX++, pTmp += 4) { // prepare content line as BGR by reordering when copying // do not forget to invert alpha (source is alpha, target is opacity) @@ -1392,7 +1392,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) } else { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 4 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 4 ) { if(bCustomColorTable) { @@ -1422,7 +1422,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) else { // BMP_FORMAT_64BIT_TC_RGBA - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 8 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 8 ) { ImplSetAlphaPixel( nY, @@ -1441,7 +1441,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) // no support currently for DirectScanline, found no real usages in current PNGs, may be added on demand if ( mnPngDepth == 8 ) // maybe the source has 16 bit per sample { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 ) { sal_uInt8 nRed = pTmp[ 0 ]; sal_uInt8 nGreen = pTmp[ 1 ]; @@ -1458,7 +1458,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) else { // BMP_FORMAT_48BIT_TC_RGB - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 6 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 6 ) { sal_uInt8 nRed = pTmp[ 0 ]; sal_uInt8 nGreen = pTmp[ 2 ]; @@ -1498,7 +1498,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) OSL_ENSURE(mnAllocSizeScanline >= maOrigSize.Width() * 3, "Allocated Scanline too small (!)"); sal_uInt8* pScanline(mpScanline); - for (sal_Int32 nX(0); nX < maOrigSize.Width(); nX++, pTmp += 3) + for (long nX(0); nX < maOrigSize.Width(); nX++, pTmp += 3) { // prepare content line as BGR by reordering when copying if(bCustomColorTable) @@ -1521,7 +1521,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) } else { - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 3 ) { if(bCustomColorTable) { @@ -1550,7 +1550,7 @@ void PNGReaderImpl::ImplDrawScanline( sal_uInt32 nXStart, sal_uInt32 nXAdd ) { // BMP_FORMAT_48BIT_TC_RGB // no support currently for DirectScanline, found no real usages in current PNGs, may be added on demand - for ( sal_Int32 nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 6 ) + for ( long nX = nXStart; nX < maOrigSize.Width(); nX += nXAdd, pTmp += 6 ) { ImplSetPixel( nY, diff --git a/vcl/source/gdi/pngwrite.cxx b/vcl/source/gdi/pngwrite.cxx index d3ee25fbeff9..01ff6fe5be9b 100644 --- a/vcl/source/gdi/pngwrite.cxx +++ b/vcl/source/gdi/pngwrite.cxx @@ -334,7 +334,7 @@ void PNGWriterImpl::ImplWritePalette() ImplOpenChunk(PNGCHUNK_PLTE); - for ( sal_uInt16 i = 0; i < nCount; i++ ) + for ( sal_uLong i = 0; i < nCount; i++ ) { const BitmapColor& rColor = mpAccess->GetPaletteColor(i); *pTmp++ = rColor.GetRed(); diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 16d3d9980af7..e5de8298cdf1 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -431,7 +431,7 @@ SalPrinterQueueInfo::~SalPrinterQueueInfo() ImplPrnQueueList::~ImplPrnQueueList() { ImplSVData* pSVData = ImplGetSVData(); - for( unsigned int i = 0; i < m_aQueueInfos.size(); i++ ) + for( size_t i = 0; i < m_aQueueInfos.size(); i++ ) { delete m_aQueueInfos[i].mpQueueInfo; pSVData->mpDefInst->DeletePrinterQueueInfo( m_aQueueInfos[i].mpSalQueueInfo ); @@ -908,7 +908,7 @@ SalPrinterQueueInfo* Printer::ImplGetQueueInfo( const OUString& rPrinterName, return pInfo->mpSalQueueInfo; // then search case insensitive - for( unsigned int i = 0; i < pPrnList->m_aQueueInfos.size(); i++ ) + for( size_t i = 0; i < pPrnList->m_aQueueInfos.size(); i++ ) { if( pPrnList->m_aQueueInfos[i].mpSalQueueInfo->maPrinterName.equalsIgnoreAsciiCase( rPrinterName ) ) return pPrnList->m_aQueueInfos[i].mpSalQueueInfo; @@ -917,7 +917,7 @@ SalPrinterQueueInfo* Printer::ImplGetQueueInfo( const OUString& rPrinterName, // then search for driver name if ( pDriver ) { - for( unsigned int i = 0; i < pPrnList->m_aQueueInfos.size(); i++ ) + for( size_t i = 0; i < pPrnList->m_aQueueInfos.size(); i++ ) { if( pPrnList->m_aQueueInfos[i].mpSalQueueInfo->maDriver == *pDriver ) return pPrnList->m_aQueueInfos[i].mpSalQueueInfo; diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index 086739a62fff..1543d83d6e81 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -1774,7 +1774,7 @@ vcl::Region vcl::Region::GetRegionFromPolyPolygon( const tools::PolyPolygon& rPo int nPolygonRects = 0, nPolygonPolygons = 0; int nPolygons = rPolyPoly.Count(); - for( sal_uInt16 i = 0; i < nPolygons; i++ ) + for( int i = 0; i < nPolygons; i++ ) { const Polygon& rPoly = rPolyPoly[i]; @@ -1796,7 +1796,7 @@ vcl::Region vcl::Region::GetRegionFromPolyPolygon( const tools::PolyPolygon& rPo vcl::Region aResult; Rectangle aRect; - for( sal_uInt16 i = 0; i < nPolygons; i++ ) + for( int i = 0; i < nPolygons; i++ ) { const Polygon& rPoly = rPolyPoly[i]; diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index 3acb0c667a94..33cea5c7189b 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -231,11 +231,11 @@ BitmapEx OpenGLHelper::ConvertBGRABufferToBitmapEx(const sal_uInt8* const pBuffe AlphaMask::ScopedWriteAccess pAlphaWriteAccess( aAlpha ); size_t nCurPos = 0; - for( int y = 0; y < nHeight; ++y) + for( long y = 0; y < nHeight; ++y) { Scanline pScan = pWriteAccess->GetScanline(y); Scanline pAlphaScan = pAlphaWriteAccess->GetScanline(y); - for( int x = 0; x < nWidth; ++x ) + for( long x = 0; x < nWidth; ++x ) { *pScan++ = pBuffer[nCurPos]; *pScan++ = pBuffer[nCurPos+1]; diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 5c1749fefda8..15e59bf6cd83 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -689,7 +689,7 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, } } #ifdef DBG_UTIL - for ( sal_uInt16 nL = 0; nL < rLineInfo.Count(); nL++ ) + for ( sal_Int32 nL = 0; nL < rLineInfo.Count(); nL++ ) { ImplTextLineInfo* pLine = rLineInfo.GetLine( nL ); OUString aLine = rStr.copy( pLine->GetIndex(), pLine->GetLen() ); diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx index ceaa757dda0c..fa18d3d01eb5 100644 --- a/vcl/source/window/splitwin.cxx +++ b/vcl/source/window/splitwin.cxx @@ -2421,7 +2421,7 @@ void SplitWindow::Tracking( const TrackingEvent& rTEvt ) { ImplSplitItems& pItems = mpSplitSet->mpItems; size_t nItems = pItems.size(); - for ( sal_uInt16 i = 0; i < nItems; i++ ) + for ( size_t i = 0; i < nItems; i++ ) { pItems[i]->mnSize = mpLastSizes[i*2]; pItems[i]->mnPixSize = mpLastSizes[i*2+1]; @@ -2807,7 +2807,7 @@ void SplitWindow::SplitItem( sal_uInt16 nId, long nNewSize, // calculate area, which could be affected by splitting sal_uInt16 nMin = 0; sal_uInt16 nMax = nItems; - for (sal_uInt16 i = 0; i < nItems; ++i) + for (size_t i = 0; i < nItems; ++i) { if ( pItems[i]->mbFixed ) { @@ -3140,7 +3140,7 @@ sal_uInt16 SplitWindow::GetItemPos( sal_uInt16 nId, sal_uInt16 nSetId ) const if ( pSet ) { - for ( sal_uInt16 i = 0; i < pSet->mpItems.size(); i++ ) + for ( size_t i = 0; i < pSet->mpItems.size(); i++ ) { if ( pSet->mpItems[i]->mnId == nId ) { diff --git a/vcl/unx/generic/gdi/x11windowprovider.cxx b/vcl/unx/generic/gdi/x11windowprovider.cxx index 03a7adfe18de..ec1cb09a074b 100644 --- a/vcl/unx/generic/gdi/x11windowprovider.cxx +++ b/vcl/unx/generic/gdi/x11windowprovider.cxx @@ -32,7 +32,7 @@ Display *OpenX11Display(OString& rDisplay) sal_uInt32 nParams = osl_getCommandArgCount(); OUString aParam; - for (sal_uInt16 i=0; i<nParams; i++) + for (sal_uInt32 i=0; i<nParams; i++) { osl_getCommandArg(i, &aParam.pData); if ( aParam == "-display" ) |