summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-03-07 19:43:34 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-03-07 19:44:04 +0100
commitab78f801e0d1f4dc4a9346477cc6979893996aee (patch)
tree1165fc20630b78e5a72d3420f2bc2ab1595d3992 /basctl
parent4575d7cf657ae291c427c2318eb4600cec2f12b7 (diff)
loplugin:loopvartoosmall
Change-Id: Ia8c57fb69873d57c3271a8f6d497fecec3db1899
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/baside2b.cxx6
-rw-r--r--basctl/source/basicide/layout.cxx10
-rw-r--r--basctl/source/dlged/dlgedobj.cxx15
3 files changed, 20 insertions, 11 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index a82d57c5266f..c02bac26d0f2 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -2891,12 +2891,12 @@ UnoTypeCodeCompletetor::UnoTypeCodeCompletetor( const std::vector< OUString >& a
return;
}
- unsigned int j = 1;//start from aVect[1]: aVect[0] is the variable name
+ auto j = aVect.begin() + 1;//start from aVect[1]: aVect[0] is the variable name
OUString sMethName;
- while( j != aVect.size() )
+ while( j != aVect.end() )
{
- sMethName = aVect[j];
+ sMethName = *j;
if( CodeCompleteOptions::IsExtendedTypeDeclaration() )
{
diff --git a/basctl/source/basicide/layout.cxx b/basctl/source/basicide/layout.cxx
index b93e50ae3395..6d87bf687ccb 100644
--- a/basctl/source/basicide/layout.cxx
+++ b/basctl/source/basicide/layout.cxx
@@ -216,7 +216,7 @@ void Layout::SplittedSide::Add (DockingWindow* pWin, Size const& rSize)
void Layout::SplittedSide::Remove (DockingWindow* pWin)
{
// contains?
- unsigned iWin;
+ std::vector<Item>::size_type iWin;
for (iWin = 0; iWin != vItems.size(); ++iWin)
if (vItems[iWin].pWin == pWin)
break;
@@ -251,8 +251,8 @@ bool Layout::SplittedSide::IsDocking (DockingWindow const& rWin)
// IsEmpty() -- are there no windows docked in this strip?
bool Layout::SplittedSide::IsEmpty () const
{
- for (unsigned i = 0; i != vItems.size(); ++i)
- if (IsDocking(*vItems[i].pWin))
+ for (auto const & i: vItems)
+ if (IsDocking(*i.pWin))
return false;
return true;
}
@@ -301,9 +301,9 @@ void Layout::SplittedSide::ArrangeIn (Rectangle const& rRect)
// positioning separator lines and windows
bool bPrevDocking = false; // is the previous window docked?
long nStartPos = 0; // window position in the strip
- unsigned iLastWin = vItems.size(); // index of last docking window in the strip
+ std::vector<Item>::size_type iLastWin = vItems.size(); // index of last docking window in the strip
- for (unsigned i = 0; i != vItems.size(); ++i)
+ for (std::vector<Item>::size_type i = 0; i != vItems.size(); ++i)
{
// window
DockingWindow& rWin = *vItems[i].pWin;
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index d33dd9d06233..be46d588a6c1 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <cassert>
+
#include "dlged.hxx"
#include "dlgeddef.hxx"
#include "dlgedlist.hxx"
@@ -541,11 +545,10 @@ void DlgEdObj::TabIndexChange( const beans::PropertyChangeEvent& evt )
Sequence< OUString > aNames = xNameAcc->getElementNames();
const OUString* pNames = aNames.getConstArray();
sal_Int32 nCtrls = aNames.getLength();
- sal_Int16 i;
// create a map of tab indices and control names, sorted by tab index
IndexToNameMap aIndexToNameMap;
- for ( i = 0; i < nCtrls; ++i )
+ for ( sal_Int32 i = 0; i < nCtrls; ++i )
{
// get control name
OUString aName( pNames[i] );
@@ -588,13 +591,19 @@ void DlgEdObj::TabIndexChange( const beans::PropertyChangeEvent& evt )
aNameList.insert( aNameList.begin() + nNewTabIndex , aCtrlName );
// set new tab indices
- for ( i = 0; i < nCtrls; ++i )
+ for ( sal_Int32 i = 0; i < nCtrls; ++i )
{
Any aCtrl = xNameAcc->getByName( aNameList[i] );
Reference< beans::XPropertySet > xPSet;
aCtrl >>= xPSet;
if ( xPSet.is() )
{
+ assert(i >= SAL_MIN_INT16);
+ if (i > SAL_MAX_INT16)
+ {
+ SAL_WARN("basctl", "tab " << i << " > SAL_MAX_INT16");
+ continue;
+ }
xPSet->setPropertyValue( DLGED_PROP_TABINDEX, Any((sal_Int16) i) );
}
}