From afbfe42e63cdba1a18c292d7eb4875009b0f19c0 Mon Sep 17 00:00:00 2001 From: Tamás Zolnai Date: Sat, 10 Nov 2018 17:34:31 +0100 Subject: clang-tidy: (WIP) bugprone-too-small-loop-variable findings 2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I1ddf3fe0e5fad265ae14712a23469b684253079d Reviewed-on: https://gerrit.libreoffice.org/63241 Tested-by: Jenkins Reviewed-by: Tamás Zolnai --- basic/qa/cppunit/test_vba.cxx | 2 +- chart2/source/controller/dialogs/res_DataLabel.cxx | 2 +- connectivity/source/drivers/jdbc/DatabaseMetaData.cxx | 2 +- cppuhelper/qa/unourl/cppu_unourl.cxx | 18 +++++++++--------- cui/source/options/optcolor.cxx | 2 +- cui/source/options/treeopt.cxx | 16 ++++++++-------- cui/source/tabpages/border.cxx | 2 +- cui/source/tabpages/page.cxx | 2 +- cui/source/tabpages/swpossizetabpage.cxx | 9 ++++----- dbaccess/source/ui/control/FieldDescControl.cxx | 4 ++-- formula/source/ui/dlg/parawin.cxx | 8 ++++---- framework/source/uielement/controlmenucontroller.cxx | 4 ++-- hwpfilter/source/hcode.cxx | 4 +--- i18npool/source/textconversion/textconversion_ko.cxx | 2 +- .../qa/gtktiledviewer/gtv-signal-handlers.cxx | 4 ++-- reportdesign/source/ui/dlg/GroupsSorting.cxx | 2 +- sal/qa/rtl/strings/test_oustring_convert.cxx | 2 +- sax/qa/cppunit/xmlimport.cxx | 6 +++--- sc/qa/extras/macros-test.cxx | 2 +- sc/qa/unit/ucalc.cxx | 2 +- sc/source/core/tool/editutil.cxx | 2 +- sd/qa/unit/import-tests.cxx | 2 +- sd/source/ui/view/viewoverlaymanager.cxx | 2 +- svx/source/fmcomp/fmgridif.cxx | 2 +- svx/source/form/dataaccessdescriptor.cxx | 2 +- sw/qa/core/macros-test.cxx | 2 +- sw/qa/extras/odfexport/odfexport.cxx | 4 ++-- sw/source/core/unocore/unofield.cxx | 2 +- sw/source/uibase/ribbar/workctrl.cxx | 5 ++--- sw/source/uibase/sidebar/PageStylesPanel.cxx | 2 +- sw/source/uibase/utlui/unotools.cxx | 2 +- vcl/qa/cppunit/canvasbitmaptest.cxx | 2 +- vcl/source/fontsubset/ttcr.cxx | 8 ++------ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 4 ++-- writerfilter/source/dmapper/StyleSheetTable.cxx | 2 +- 35 files changed, 65 insertions(+), 73 deletions(-) diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx index 9fea8e0dc064..820464ee22bd 100644 --- a/basic/qa/cppunit/test_vba.cxx +++ b/basic/qa/cppunit/test_vba.cxx @@ -148,7 +148,7 @@ void VBATest::testMiscVBAFunctions() SvtSysLocaleOptions aLocalOptions; aLocalOptions.SetLocaleConfigString( aLocale.getBcp47() ); - for ( sal_uInt32 i=0; i(pPoolItem)->GetValue()) m_xLB_Separator->set_active( i ); diff --git a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx index 7cd26be1daba..ee991d4c1338 100644 --- a/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx +++ b/connectivity/source/drivers/jdbc/DatabaseMetaData.cxx @@ -446,7 +446,7 @@ Reference< XResultSet > SAL_CALL java_sql_DatabaseMetaData::getTablePrivileges( for (sal_Int32 i = 1 ; i <= nCount ; ++i) { sColumnName = xMeta->getColumnName(i); - for (sal_uInt32 j = 0 ; j < SAL_N_ELEMENTS(sPrivs); ++j) + for (size_t j = 0 ; j < SAL_N_ELEMENTS(sPrivs); ++j) { if ( sPrivs[j] == sColumnName ) { diff --git a/cppuhelper/qa/unourl/cppu_unourl.cxx b/cppuhelper/qa/unourl/cppu_unourl.cxx index 90f193620d87..0be49fc427cd 100644 --- a/cppuhelper/qa/unourl/cppu_unourl.cxx +++ b/cppuhelper/qa/unourl/cppu_unourl.cxx @@ -70,7 +70,7 @@ namespace cppu_unourl { "abc,def=%22", true }, { "abc,def=\"", true }, { "abc,def=%ed%a0%80", true } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aTests); ++i) { bool bValid = false; try @@ -120,7 +120,7 @@ namespace cppu_unourl { "abc,def=%22", "abc,def=%22" }, { "abc,def=\"", "abc,def=\"" }, { "abc,def=%ed%a0%80", "abc,def=%ed%a0%80" } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aTests); ++i) { bool bValid = false; OUString aDescriptor; @@ -168,7 +168,7 @@ namespace cppu_unourl { "abc,def=%22", "abc" }, { "abc,def=\"", "abc" }, { "abc,def=%ed%a0%80", "abc" } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aTests); ++i) { bool bValid = false; OUString aName; @@ -213,7 +213,7 @@ namespace cppu_unourl { "abc,def=xxx,ghi=xxx", "def", true }, { "abc,def=xxx,ghi=xxx", "ghi", true }, { "abc,def=xxx,ghi=xxx", "jkl", false } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aTests); ++i) { bool bValid = false; bool bPresent = false; @@ -283,7 +283,7 @@ namespace cppu_unourl { "abc,abc=,def=Abc", "def", "Abc" }, { "abc,abc=,def=aBC", "def", "aBC" }, { "abc,abc=,def=ABC", "def", "ABC" } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aTests); ++i) { bool bValid = false; OUString aValue; @@ -326,7 +326,7 @@ namespace cppu_unourl { "uno:abc;def;1", true }, { "uno:abc;def;$&+,/:=?@", true }, { "uno:abc;def;%24&+,/:=?@", false } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aTests); ++i) { bool bValid = false; try @@ -364,7 +364,7 @@ namespace cppu_unourl { "uno:ABC;def;ghi", "ABC" }, { "uno:abc,def=xxx,ghi=xxx;def,ghi=xxx,jkl=xxx;ghi", "abc,def=xxx,ghi=xxx" } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aTests); ++i) { bool bValid = false; OUString aConnection; @@ -398,7 +398,7 @@ namespace cppu_unourl { "uno:abc;DEF;ghi", "DEF" }, { "uno:abc,def=xxx,ghi=xxx;def,ghi=xxx,jkl=xxx;ghi", "def,ghi=xxx,jkl=xxx" } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aTests); ++i) { bool bValid = false; OUString aProtocol; @@ -435,7 +435,7 @@ namespace cppu_unourl { "uno:abc;def;A", "A" }, { "uno:abc;def;1", "1" }, { "uno:abc;def;$&+,/:=?@", "$&+,/:=?@" } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aTests); ++i) { bool bValid = false; OUString aObjectName; diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx index 48b7874f850e..f33c83cf78b0 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -516,7 +516,7 @@ void ColorConfigWindow_Impl::CreateEntries() // creating entries vEntries.reserve(ColorConfigEntryCount); - for (unsigned i = 0; i < SAL_N_ELEMENTS(vEntryInfo); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(vEntryInfo); ++i) { vEntries.push_back(std::make_shared(*this, i, nCheckBoxLabelOffset, aModulesInstalled[vEntryInfo[i].eGroup])); diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index b74830726911..a33079c99989 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -1486,7 +1486,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) { setGroupName( "LoadSave", CuiResId(SID_FILTER_DLG_RES[0].first) ); nGroup = AddGroup( CuiResId(SID_FILTER_DLG_RES[0].first), nullptr, nullptr, SID_FILTER_DLG ); - for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_FILTER_DLG_RES); ++i ) + for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_FILTER_DLG_RES); ++i ) { nPageId = static_cast(SID_FILTER_DLG_RES[i].second); if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) @@ -1500,7 +1500,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) { setGroupName("LanguageSettings", CuiResId(SID_LANGUAGE_OPTIONS_RES[0].first)); nGroup = AddGroup(CuiResId(SID_LANGUAGE_OPTIONS_RES[0].first), nullptr, nullptr, SID_LANGUAGE_OPTIONS ); - for (sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_LANGUAGE_OPTIONS_RES); ++i) + for (size_t i = 1; i < SAL_N_ELEMENTS(SID_LANGUAGE_OPTIONS_RES); ++i) { nPageId = static_cast(SID_LANGUAGE_OPTIONS_RES[i].second); if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) @@ -1532,7 +1532,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) else setGroupName( "Writer", CuiResId(SID_SW_EDITOPTIONS_RES[0].first) ); nGroup = AddGroup(CuiResId(SID_SW_EDITOPTIONS_RES[0].first), pSwMod, pSwMod, SID_SW_EDITOPTIONS ); - for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_SW_EDITOPTIONS_RES); ++i ) + for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_SW_EDITOPTIONS_RES); ++i ) { nPageId = static_cast(SID_SW_EDITOPTIONS_RES[i].second); if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) @@ -1551,7 +1551,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) if ( !lcl_isOptionHidden( SID_SW_ONLINEOPTIONS, aOptionsDlgOpt ) ) { nGroup = AddGroup(CuiResId(SID_SW_ONLINEOPTIONS_RES[0].first), pSwMod, pSwMod, SID_SW_ONLINEOPTIONS ); - for( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_SW_ONLINEOPTIONS_RES); ++i ) + for( size_t i = 1; i < SAL_N_ELEMENTS(SID_SW_ONLINEOPTIONS_RES); ++i ) { nPageId = static_cast(SID_SW_ONLINEOPTIONS_RES[i].second); if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) @@ -1642,7 +1642,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) SfxModule* pSmMod = SfxApplication::GetModule(SfxToolsModule::Math); setGroupName( "Math", CuiResId(SID_SM_EDITOPTIONS_RES[0].first) ); nGroup = AddGroup(CuiResId(SID_SM_EDITOPTIONS_RES[0].first), pSmMod, pSmMod, SID_SM_EDITOPTIONS ); - for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_SM_EDITOPTIONS_RES); ++i ) + for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_SM_EDITOPTIONS_RES); ++i ) { nPageId = static_cast(SID_SM_EDITOPTIONS_RES[i].second); if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) @@ -1661,7 +1661,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) { setGroupName( "Base", CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first) ); nGroup = AddGroup( CuiResId(SID_SB_STARBASEOPTIONS_RES[0].first), nullptr, nullptr, SID_SB_STARBASEOPTIONS ); - for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_SB_STARBASEOPTIONS_RES); ++i ) + for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_SB_STARBASEOPTIONS_RES); ++i ) { nPageId = static_cast(SID_SB_STARBASEOPTIONS_RES[i].second); if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) @@ -1674,7 +1674,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) { setGroupName( "Charts", CuiResId(SID_SCH_EDITOPTIONS_RES[0].first) ); nGroup = AddGroup( CuiResId(SID_SCH_EDITOPTIONS_RES[0].first), nullptr, nullptr, SID_SCH_EDITOPTIONS ); - for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_SCH_EDITOPTIONS_RES); ++i ) + for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_SCH_EDITOPTIONS_RES); ++i ) { nPageId = static_cast(SID_SCH_EDITOPTIONS_RES[i].second); if ( !lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) @@ -1688,7 +1688,7 @@ void OfaTreeOptionsDialog::Initialize( const Reference< XFrame >& _xFrame ) setGroupName("Internet", CuiResId(SID_INET_DLG_RES[0].first)); nGroup = AddGroup(CuiResId(SID_INET_DLG_RES[0].first), nullptr, nullptr, SID_INET_DLG ); - for ( sal_uInt32 i = 1; i < SAL_N_ELEMENTS(SID_INET_DLG_RES); ++i ) + for ( size_t i = 1; i < SAL_N_ELEMENTS(SID_INET_DLG_RES); ++i ) { nPageId = static_cast(SID_INET_DLG_RES[i].second); if ( lcl_isOptionHidden( nPageId, aOptionsDlgOpt ) ) diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index a9cf96dc1734..ed2c7b4e6991 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -1464,7 +1464,7 @@ void SvxBorderTabPage::UpdateRemoveAdjCellBorderCB( sal_uInt16 nPreset ) // Check if current selection involves deletion of at least one border bool bBorderDeletionReq = false; - for ( sal_uInt32 i=0; i < SAL_N_ELEMENTS( eTypes1 ); ++i ) + for ( size_t i=0; i < SAL_N_ELEMENTS( eTypes1 ); ++i ) { if( pOldBoxItem->GetLine( eTypes2[i] ) || !( pOldBoxInfoItem->IsValid( eTypes1[i].second ) ) ) { diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index d45cc342531b..c9cc5f5dfd64 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -84,7 +84,7 @@ const SvxPageUsage aArr[] = static sal_uInt16 PageUsageToPos_Impl( SvxPageUsage nUsage ) { - for ( sal_uInt16 i = 0; i < SAL_N_ELEMENTS(aArr); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS(aArr); ++i ) if ( aArr[i] == nUsage ) return i; return 3; diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx index c67b3f8eddc4..d5c536d4bdc7 100644 --- a/cui/source/tabpages/swpossizetabpage.cxx +++ b/cui/source/tabpages/swpossizetabpage.cxx @@ -451,8 +451,7 @@ static SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL( {SwFPos::REL_FRM_TOP, SwFPos::REL_FRM_LEFT }, {SwFPos::REL_FRM_BOTTOM, SwFPos::REL_FRM_RIGHT } }; - sal_uInt16 nIndex; - for(nIndex = 0; nIndex < SAL_N_ELEMENTS(aHoriIds); ++nIndex) + for(size_t nIndex = 0; nIndex < SAL_N_ELEMENTS(aHoriIds); ++nIndex) { if(aHoriIds[nIndex].eHori == eStringId) { @@ -460,7 +459,7 @@ static SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL( return eStringId; } } - for(nIndex = 0; nIndex < SAL_N_ELEMENTS(aVertIds); ++nIndex) + for(size_t nIndex = 0; nIndex < SAL_N_ELEMENTS(aVertIds); ++nIndex) { if(aVertIds[nIndex].eHori == eStringId) { @@ -1651,7 +1650,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, sal_uInt16 nMapPos, sal_ if (pMap[_nMapPos].eStrId == eStrId) { nLBRelations = pMap[_nMapPos].nLBRelations; - for (sal_uInt16 nRelPos = 0; nRelPos < SAL_N_ELEMENTS(aAsCharRelationMap); nRelPos++) + for (size_t nRelPos = 0; nRelPos < SAL_N_ELEMENTS(aAsCharRelationMap); nRelPos++) { if (nLBRelations & aAsCharRelationMap[nRelPos].nLBRelation) { @@ -1707,7 +1706,7 @@ void SvxSwPosSizeTabPage::FillRelLB(FrmMap const *pMap, sal_uInt16 nMapPos, sal_ { if (nLBRelations & static_cast(nBit)) { - for (sal_uInt16 nRelPos = 0; nRelPos < SAL_N_ELEMENTS(aRelationMap); nRelPos++) + for (size_t nRelPos = 0; nRelPos < SAL_N_ELEMENTS(aRelationMap); nRelPos++) { if (aRelationMap[nRelPos].nLBRelation == static_cast(nBit)) { diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx index 1324dd0656de..d8c44c71b5b5 100644 --- a/dbaccess/source/ui/control/FieldDescControl.cxx +++ b/dbaccess/source/ui/control/FieldDescControl.cxx @@ -387,7 +387,7 @@ void OFieldDescControl::ScrollAllAggregates() , m_pTypeText, m_pAutoIncrementValueText}; OSL_ENSURE(SAL_N_ELEMENTS(ppAggregates) == SAL_N_ELEMENTS(ppAggregatesText),"Lists are not identical!"); - for (sal_uInt16 i=0; iEnable( !bReadOnly ); diff --git a/formula/source/ui/dlg/parawin.cxx b/formula/source/ui/dlg/parawin.cxx index 6ffd0c6e7684..d96a2a84e7fc 100644 --- a/formula/source/ui/dlg/parawin.cxx +++ b/formula/source/ui/dlg/parawin.cxx @@ -526,7 +526,7 @@ IMPL_LINK( ParaWin, GetFxHdl, ArgInput&, rPtr, void ) { sal_uInt16 nOffset = GetSliderPos(); nEdFocus=NOT_FOUND; - for (sal_uInt16 nPos=0; nPos < SAL_N_ELEMENTS(aArgInput); ++nPos) + for (size_t nPos=0; nPos < SAL_N_ELEMENTS(aArgInput); ++nPos) { if(&rPtr == &aArgInput[nPos]) { @@ -547,7 +547,7 @@ IMPL_LINK( ParaWin, GetFxFocusHdl, ArgInput&, rPtr, void ) { sal_uInt16 nOffset = GetSliderPos(); nEdFocus=NOT_FOUND; - for (sal_uInt16 nPos=0; nPos < SAL_N_ELEMENTS(aArgInput); ++nPos) + for (size_t nPos=0; nPos < SAL_N_ELEMENTS(aArgInput); ++nPos) { if(&rPtr == &aArgInput[nPos]) { @@ -569,7 +569,7 @@ IMPL_LINK( ParaWin, GetEdFocusHdl, ArgInput&, rPtr, void ) { sal_uInt16 nOffset = GetSliderPos(); nEdFocus=NOT_FOUND; - for (sal_uInt16 nPos=0; nPos < SAL_N_ELEMENTS(aArgInput); ++nPos) + for (size_t nPos=0; nPos < SAL_N_ELEMENTS(aArgInput); ++nPos) { if(&rPtr == &aArgInput[nPos]) { @@ -598,7 +598,7 @@ IMPL_LINK( ParaWin, ModifyHdl, ArgInput&, rPtr, void ) { sal_uInt16 nOffset = GetSliderPos(); nEdFocus=NOT_FOUND; - for (sal_uInt16 nPos=0; nPos < SAL_N_ELEMENTS(aArgInput); ++nPos) + for (size_t nPos=0; nPos < SAL_N_ELEMENTS(aArgInput); ++nPos) { if(&rPtr == &aArgInput[nPos]) { diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx index a2e6ff54edaa..9685ac385a95 100644 --- a/framework/source/uielement/controlmenucontroller.cxx +++ b/framework/source/uielement/controlmenucontroller.cxx @@ -176,7 +176,7 @@ ControlMenuController::ControlMenuController(const css::uno::Reference< css::uno // private function void ControlMenuController::updateImagesPopupMenu( PopupMenu* pPopupMenu ) { - for (sal_uInt32 i=0; i < SAL_N_ELEMENTS(aCommands); ++i) + for (size_t i=0; i < SAL_N_ELEMENTS(aCommands); ++i) { //ident is .uno:Command without .uno: OString sIdent = OString(aCommands[i]).copy(5); @@ -226,7 +226,7 @@ void SAL_CALL ControlMenuController::statusChanged( const FeatureStateEvent& Eve osl::ResettableMutexGuard aLock( m_aMutex ); OString sIdent; - for (sal_uInt32 i=0; i < SAL_N_ELEMENTS(aCommands); ++i) + for (size_t i=0; i < SAL_N_ELEMENTS(aCommands); ++i) { if ( Event.FeatureURL.Complete.equalsAscii( aCommands[i] )) { diff --git a/hwpfilter/source/hcode.cxx b/hwpfilter/source/hcode.cxx index 836a39ab0d18..ed654cc097d2 100644 --- a/hwpfilter/source/hcode.cxx +++ b/hwpfilter/source/hcode.cxx @@ -565,9 +565,7 @@ static int is_jaso(hchar hh) static hchar jaso2ks(hchar hh) { - unsigned int i; - - for (i = 0; i < SAL_N_ELEMENTS(jaso_hh_code); i++) + for (size_t i = 0; i < SAL_N_ELEMENTS(jaso_hh_code); i++) if (hh == jaso_hh_code[i]) { return sal::static_int_cast(0xa4a1 + i); diff --git a/i18npool/source/textconversion/textconversion_ko.cxx b/i18npool/source/textconversion/textconversion_ko.cxx index 0e0a9bdcd6fa..15fe63f2f05b 100644 --- a/i18npool/source/textconversion/textconversion_ko.cxx +++ b/i18npool/source/textconversion/textconversion_ko.cxx @@ -99,7 +99,7 @@ static sal_Int16 checkScriptType(sal_Unicode c) }; UBlockCode block=ublock_getCode(static_cast(c)); - sal_uInt16 i; + size_t i; for ( i = 0; i < SAL_N_ELEMENTS(scriptList); i++) { if (block <= scriptList[i].to) break; } diff --git a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx index 29fb6c59de2b..708d4d440453 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-signal-handlers.cxx @@ -330,7 +330,7 @@ void changeZoom( GtkWidget* pButton, gpointer /* pItem */ ) if ( strcmp(sName, "zoom-in-symbolic") == 0) { - for ( unsigned int i = 0; i < SAL_N_ELEMENTS( fZooms ); i++ ) + for ( size_t i = 0; i < SAL_N_ELEMENTS( fZooms ); i++ ) { if ( fCurrentZoom < fZooms[i] ) { @@ -345,7 +345,7 @@ void changeZoom( GtkWidget* pButton, gpointer /* pItem */ ) } else if ( strcmp(sName, "zoom-out-symbolic") == 0) { - for ( unsigned int i = 0; i < SAL_N_ELEMENTS( fZooms ); i++ ) + for ( size_t i = 0; i < SAL_N_ELEMENTS( fZooms ); i++ ) { if ( fCurrentZoom > fZooms[i] ) { diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index cbaa45f0361c..a47ae0ea4640 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -1116,7 +1116,7 @@ void OGroupsSortingDialog::displayGroup(const uno::Reference& _x case sdbc::DataType::TIMESTAMP: { const char* aIds[] = { STR_RPT_YEAR, STR_RPT_QUARTER,STR_RPT_MONTH,STR_RPT_WEEK,STR_RPT_DAY,STR_RPT_HOUR,STR_RPT_MINUTE }; - for (sal_uInt16 i = 0; i < SAL_N_ELEMENTS(aIds); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aIds); ++i) { m_pGroupOnLst->InsertEntry(RptResId(aIds[i])); m_pGroupOnLst->SetEntryData(i+1,reinterpret_cast(i+2)); diff --git a/sal/qa/rtl/strings/test_oustring_convert.cxx b/sal/qa/rtl/strings/test_oustring_convert.cxx index cbf32ec13d52..20d3a9221c79 100644 --- a/sal/qa/rtl/strings/test_oustring_convert.cxx +++ b/sal/qa/rtl/strings/test_oustring_convert.cxx @@ -170,7 +170,7 @@ void test::oustring::Convert::convertToString() OUSTRING_TO_OSTRING_CVTFLAGS, "A?B", "A?B" } }; - for (unsigned int i = 0; i < SAL_N_ELEMENTS(aTests); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aTests); ++i) testConvertToString(aTests[i]); } diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx index 38944154deba..dfcd778b6924 100644 --- a/sax/qa/cppunit/xmlimport.cxx +++ b/sax/qa/cppunit/xmlimport.cxx @@ -295,7 +295,7 @@ Sequence< sal_Int8 > DummyTokenHandler::getUTF8Identifier( sal_Int32 nToken ) } else //element or attribute { - sal_uInt32 nElementToken = nToken & 0xffff; + size_t nElementToken = nToken & 0xffff; if ( nElementToken < SAL_N_ELEMENTS(tokens) ) aUtf8Token = tokens[ nElementToken ]; } @@ -313,7 +313,7 @@ sal_Int32 DummyTokenHandler::getTokenFromUTF8( const uno::Sequence< sal_Int8 >& sal_Int32 DummyTokenHandler::getTokenDirect( const char* pToken, sal_Int32 nLength ) const { OString sToken( pToken, nLength ); - for( sal_uInt16 i = 0; i < SAL_N_ELEMENTS(tokens); i++ ) + for( size_t i = 0; i < SAL_N_ELEMENTS(tokens); i++ ) { if ( tokens[i] == sToken ) return static_cast(i); @@ -384,7 +384,7 @@ void XMLImportTest::parse() "multiplens.xml", "multiplepfx.xml", "nstoattributes.xml", "nestedns.xml", "testthreading.xml"}; - for (sal_uInt16 i = 0; i < SAL_N_ELEMENTS( fileNames ); i++) + for (size_t i = 0; i < SAL_N_ELEMENTS( fileNames ); i++) { InputSource source; source.sSystemId = "internal"; diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index 05afe4db3865..de4f00ca8f95 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -298,7 +298,7 @@ void ScMacrosTest::testVba() sTempDir += OUStringLiteral1(SAL_PATHDELIMITER); OUString sTestFileName("My Test WorkBook.xls"); Sequence< uno::Any > aParams; - for ( sal_uInt32 i=0; i xComponent diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx index e17f3f820421..0174c2ba27c1 100644 --- a/sd/source/ui/view/viewoverlaymanager.cxx +++ b/sd/source/ui/view/viewoverlaymanager.cxx @@ -94,7 +94,7 @@ static BitmapEx* getButtonImage( int index, bool large ) if( !gSmallButtonImages[0].get() ) { - for (sal_uInt16 i = 0; i < SAL_N_ELEMENTS(aSmallPlaceHolders); i++ ) + for (size_t i = 0; i < SAL_N_ELEMENTS(aSmallPlaceHolders); i++ ) { gSmallButtonImages[i].set(o3tl::make_unique(aSmallPlaceHolders[i])); gLargeButtonImages[i].set(o3tl::make_unique(aBigPlaceHolders[i])); diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 6fcd0d790665..21e7f4a515e8 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -1596,7 +1596,7 @@ void FmXGridPeer::addColumnListeners(const Reference< XPropertySet >& xCol) // as not all properties have to be supported by all columns we have to check this // before adding a listener Reference< XPropertySetInfo > xInfo = xCol->getPropertySetInfo(); - for (unsigned i=0; ihasPropertyByName( aPropsListenedTo[i] ) ) { diff --git a/svx/source/form/dataaccessdescriptor.cxx b/svx/source/form/dataaccessdescriptor.cxx index f2b6a1b5711a..a5dc96a34e58 100644 --- a/svx/source/form/dataaccessdescriptor.cxx +++ b/svx/source/form/dataaccessdescriptor.cxx @@ -195,7 +195,7 @@ namespace svx { OUString("Selection"), DataAccessDescriptorProperty::Selection, } }; - for (unsigned i=0; inextElement(); uno::Reference xServiceInfo(aField, uno::UNO_QUERY); @@ -2030,7 +2030,7 @@ DECLARE_ODFEXPORT_TEST(testSpellOutNumberingTypes, "spellout-numberingtypes.odt" uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); uno::Reference xFields(xFieldsAccess->createEnumeration()); - for (sal_uInt32 i = 0; i < SAL_N_ELEMENTS(aFieldTexts); i++) + for (size_t i = 0; i < SAL_N_ELEMENTS(aFieldTexts); i++) { uno::Any aField = xFields->nextElement(); uno::Reference xServiceInfo(aField, uno::UNO_QUERY); diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 857b577e621e..1f249f4059c0 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -193,7 +193,7 @@ static const ServiceIdResId aServiceToRes[] = static SwFieldIds lcl_ServiceIdToResId(SwServiceType nServiceId) { - for (unsigned i=0; i 0 diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index 36eea8a94e11..4dd4d8d03c5a 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -312,7 +312,7 @@ SwScrollNaviPopup::SwScrollNaviPopup(sal_uInt16 nId, const Reference< XFrame >& m_pToolBox = VclPtr::Create(get("box"), this, 0); get(m_pInfoField, "label"); - sal_uInt16 i; + size_t i; m_pToolBox->SetHelpId(HID_NAVI_VS); m_pToolBox->SetLineCount( 2 ); @@ -773,8 +773,7 @@ void NavElementBox_Impl::Select() void NavElementBox_Impl::Update() { sal_uInt16 nMoveType = SwView::GetMoveType(); - sal_uInt16 i; - for ( i = 0; i < SAL_N_ELEMENTS( aNavigationInsertIds ); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS( aNavigationInsertIds ); ++i ) { if ( nMoveType == aNavigationInsertIds[i] ) { diff --git a/sw/source/uibase/sidebar/PageStylesPanel.cxx b/sw/source/uibase/sidebar/PageStylesPanel.cxx index 971ba20ae919..ae9a692dbe4e 100644 --- a/sw/source/uibase/sidebar/PageStylesPanel.cxx +++ b/sw/source/uibase/sidebar/PageStylesPanel.cxx @@ -60,7 +60,7 @@ const SvxPageUsage aArr[] = static sal_uInt16 PageUsageToPos_Impl( SvxPageUsage nUsage ) { - for ( sal_uInt16 i = 0; i < SAL_N_ELEMENTS(aArr); ++i ) + for ( size_t i = 0; i < SAL_N_ELEMENTS(aArr); ++i ) if ( aArr[i] == nUsage ) return i; return 3; diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx index 4d91348c8e28..29f698df0a0d 100644 --- a/sw/source/uibase/utlui/unotools.cxx +++ b/sw/source/uibase/utlui/unotools.cxx @@ -464,7 +464,7 @@ void SwOneExampleFrame::CreatePopup(const Point& rPt) aZoom >>= nZoom; VclPtrInstance aSubPop1; - for (sal_uInt16 i = 0; i < SAL_N_ELEMENTS(nZoomValues); ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(nZoomValues); ++i) { OUString sTemp = unicode::formatPercent(nZoomValues[i], Application::GetSettings().GetUILanguageTag()); diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx index e013c5d602a9..070b8b6217a4 100644 --- a/vcl/qa/cppunit/canvasbitmaptest.cxx +++ b/vcl/qa/cppunit/canvasbitmaptest.cxx @@ -637,7 +637,7 @@ void CanvasBitmapTest::runTest() // Testing VclCanvasBitmap wrapper - for( unsigned int i=0; irawdata = nullptr; } - for(i=0; i < SAL_N_ELEMENTS(vtable2); i++) { + for(size_t i=0; i < SAL_N_ELEMENTS(vtable2); i++) { if (_this->tag == vtable2[i].tag) { return vtable2[i].f(_this, ptr, len, tag); } @@ -1443,13 +1441,11 @@ extern "C" { vcl::TrueTypeTable *_this = static_cast(arg); /* XXX do a binary search */ - unsigned int i; - assert(_this != nullptr); if (_this->rawdata) free(_this->rawdata); - for(i=0; i < SAL_N_ELEMENTS(vcl::vtable1); i++) { + for(size_t i=0; i < SAL_N_ELEMENTS(vcl::vtable1); i++) { if (_this->tag == vcl::vtable1[i].tag) { vcl::vtable1[i].f(_this); return; diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index a8a3d80bdade..ae045d57e200 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -869,7 +869,7 @@ static void lcl_MoveBorderPropertiesToFrame(std::vector& r PROP_BOTTOM_BORDER_DISTANCE }; - for( sal_uInt32 nProperty = 0; nProperty < SAL_N_ELEMENTS( aBorderProperties ); ++nProperty) + for( size_t nProperty = 0; nProperty < SAL_N_ELEMENTS( aBorderProperties ); ++nProperty) { OUString sPropertyName = getPropertyName(aBorderProperties[nProperty]); beans::PropertyValue aValue; @@ -3563,7 +3563,7 @@ void DomainMapper_Impl::handleAuthor uno::Reference xPropertySetInfo = xUserDefinedProps->getPropertySetInfo(); //search for a field mapping OUString sFieldServiceName; - sal_uInt16 nMap = 0; + size_t nMap = 0; for( ; nMap < SAL_N_ELEMENTS(aDocProperties); ++nMap ) { if ((rFirstParam.equalsAscii(aDocProperties[nMap].pDocPropertyName)) && (!xPropertySetInfo->hasPropertyByName(rFirstParam))) diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 7a803e321bc5..957cdbedf356 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -1411,7 +1411,7 @@ OUString StyleSheetTable::ConvertStyleName( const OUString& rWWName, bool bExten // create a map only once if(m_pImpl->m_aStyleNameMap.empty()) { - for( sal_uInt32 nPair = 0; nPair < SAL_N_ELEMENTS(aStyleNamePairs)/2; ++nPair) + for( size_t nPair = 0; nPair < SAL_N_ELEMENTS(aStyleNamePairs)/2; ++nPair) { OUString aFrom = OUString::createFromAscii(aStyleNamePairs[2 * nPair]); OUString aTo = OUString::createFromAscii(aStyleNamePairs[2 * nPair + 1]); -- cgit