diff --git a/PowerEditor/src/EncodingMapper.cpp b/PowerEditor/src/EncodingMapper.cpp index 09e95c09..d3645fa2 100644 --- a/PowerEditor/src/EncodingMapper.cpp +++ b/PowerEditor/src/EncodingMapper.cpp @@ -89,9 +89,9 @@ bool isInListA(const char *token, const char *list) { if ((!token) || (!list)) return false; char word[64]; - int i = 0; - int j = 0; - for (; i <= int(strlen(list)) ; i++) + size_t i = 0; + size_t j = 0; + for (size_t len = strlen(list); i <= len; i++) { if ((list[i] == ' ')||(list[i] == '\0')) { diff --git a/PowerEditor/src/MISC/Common/Common.cpp b/PowerEditor/src/MISC/Common/Common.cpp index f9d7cf3b..6cc5913c 100644 --- a/PowerEditor/src/MISC/Common/Common.cpp +++ b/PowerEditor/src/MISC/Common/Common.cpp @@ -218,9 +218,9 @@ bool isInList(const TCHAR *token, const TCHAR *list) { if ((!token) || (!list)) return false; TCHAR word[64]; - int i = 0; - int j = 0; - for (; i <= int(lstrlen(list)) ; i++) + size_t i = 0; + size_t j = 0; + for (size_t len = lstrlen(list); i <= len; i++) { if ((list[i] == ' ')||(list[i] == '\0')) { diff --git a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp index 58e9f7c1..8282f0a9 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp +++ b/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp @@ -263,16 +263,15 @@ bool PluginsManager::loadPlugins(const TCHAR *dir) } ::FindClose(hFindFile); - size_t i = 0; - for ( ; i < dllNames.size() ; i++) + for (size_t i = 0, len = dllNames.size(); i < len ; i++) { loadPlugin(dllNames[i].c_str(), dll2Remove); } } - for (size_t j = 0 ; j < dll2Remove.size() ; j++) + for (size_t j = 0, len = dll2Remove.size() ; j < len ; j++) ::DeleteFile(dll2Remove[j].c_str()); return true; @@ -287,7 +286,7 @@ bool PluginsManager::getShortcutByCmdID(int cmdID, ShortcutKey *sk) const vector & pluginCmdSCList = (NppParameters::getInstance())->getPluginCommandList(); - for (size_t i = 0 ; i < pluginCmdSCList.size() ; i++) + for (size_t i = 0, len = pluginCmdSCList.size(); i < len ; i++) { if (pluginCmdSCList[i].getID() == (unsigned long)cmdID) { @@ -363,8 +362,7 @@ HMENU PluginsManager::setMenu(HMENU hMenu, const TCHAR *menuName) ::InsertMenu(hMenu, MENUINDEX_PLUGINS, MF_BYPOSITION | MF_POPUP, (UINT_PTR)_hPluginsMenu, nom_menu); } - size_t i = 0; - for ( ; i < _pluginInfos.size() ; i++) + for (size_t i = 0, len = _pluginInfos.size() ; i < len ; i++) { addInMenuFromPMIndex(i); } @@ -396,7 +394,7 @@ void PluginsManager::runPluginCommand(size_t i) void PluginsManager::runPluginCommand(const TCHAR *pluginName, int commandID) { - for (size_t i = 0 ; i < _pluginsCommands.size() ; i++) + for (size_t i = 0, len = _pluginsCommands.size() ; i < len ; i++) { if (!generic_stricmp(_pluginsCommands[i]._pluginName.c_str(), pluginName)) { @@ -418,7 +416,7 @@ void PluginsManager::runPluginCommand(const TCHAR *pluginName, int commandID) void PluginsManager::notify(SCNotification *notification) { - for (size_t i = 0 ; i < _pluginInfos.size() ; i++) + for (size_t i = 0, len = _pluginInfos.size() ; i < len ; i++) { if (_pluginInfos[i]->_hLib) { @@ -441,7 +439,7 @@ void PluginsManager::notify(SCNotification *notification) void PluginsManager::relayNppMessages(UINT Message, WPARAM wParam, LPARAM lParam) { - for (size_t i = 0 ; i < _pluginInfos.size() ; i++) + for (size_t i = 0, len = _pluginInfos.size(); i < len ; i++) { if (_pluginInfos[i]->_hLib) { @@ -464,7 +462,7 @@ bool PluginsManager::relayPluginMessages(UINT Message, WPARAM wParam, LPARAM lPa if (!moduleName || !moduleName[0] || !lParam) return false; - for (size_t i = 0 ; i < _pluginInfos.size() ; i++) + for (size_t i = 0, len = _pluginInfos.size() ; i < len ; i++) { if (_pluginInfos[i]->_moduleName == moduleName) { diff --git a/PowerEditor/src/MISC/PluginsManager/PluginsManager.h b/PowerEditor/src/MISC/PluginsManager/PluginsManager.h index a3ffcb81..a27781b7 100644 --- a/PowerEditor/src/MISC/PluginsManager/PluginsManager.h +++ b/PowerEditor/src/MISC/PluginsManager/PluginsManager.h @@ -87,7 +87,7 @@ public: _markerAlloc(MARKER_PLUGINS, MARKER_PLUGINS_LIMIT) {}; ~PluginsManager() { - for (size_t i = 0 ; i < _pluginInfos.size() ; i++) + for (size_t i = 0, len = _pluginInfos.size(); i < len; i++) delete _pluginInfos[i]; if (_hPluginsMenu) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 7a890336..f6150f78 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -458,7 +458,7 @@ LRESULT Notepad_plus::init(HWND hwnd) if (nppGUI._excludedLangList.size() > 0) { - for (size_t i = 0 ; i < nppGUI._excludedLangList.size() ; i++) + for (size_t i = 0, len = nppGUI._excludedLangList.size(); i < len ; i++) { int cmdID = pNppParam->langTypeToCommandID(nppGUI._excludedLangList[i]._langType); const int itemSize = 256; @@ -474,7 +474,7 @@ LRESULT Notepad_plus::init(HWND hwnd) // Add User Define Languages Entry int udlpos = ::GetMenuItemCount(hLangMenu) - 1; - for (int i = 0 ; i < pNppParam->getNbUserLang() ; i++) + for (int i = 0, len = pNppParam->getNbUserLang(); i < len ; i++) { UserLangContainer & userLangContainer = pNppParam->getULCFromIndex(i); ::InsertMenu(hLangMenu, udlpos + i, MF_BYPOSITION, IDM_LANG_USER + i + 1, userLangContainer.getName()); @@ -638,7 +638,7 @@ LRESULT Notepad_plus::init(HWND hwnd) _dockingManager.setDockedContSize(CONT_TOP , nppGUI._dockingData._topHeight); _dockingManager.setDockedContSize(CONT_BOTTOM, nppGUI._dockingData._bottomHight); - for (size_t i = 0 ; i < dmd._pluginDockInfo.size() ; i++) + for (size_t i = 0, len = dmd._pluginDockInfo.size(); i < len ; i++) { PluginDlgDockingInfo & pdi = dmd._pluginDockInfo[i]; if (pdi._isVisible) @@ -654,7 +654,7 @@ LRESULT Notepad_plus::init(HWND hwnd) } } - for (size_t i = 0 ; i < dmd._containerTabInfo.size() ; i++) + for (size_t i = 0, len = dmd._containerTabInfo.size(); i < len; i++) { ContainerTabInfo & cti = dmd._containerTabInfo[i]; _dockingManager.setActiveTab(cti._cont, cti._activeTab); @@ -792,12 +792,12 @@ void Notepad_plus::saveDockingParams() // save every container vector vCont = _dockingManager.getContainerInfo(); - for (size_t i = 0 ; i < vCont.size() ; i++) + for (size_t i = 0, len = vCont.size(); i < len ; i++) { // save at first the visible Tb's vector vDataVis = vCont[i]->getDataOfVisTb(); - for (size_t j = 0 ; j < vDataVis.size() ; j++) + for (size_t j = 0, len2 = vDataVis.size(); j < len2 ; j++) { if (vDataVis[j]->pszName && vDataVis[j]->pszName[0]) { @@ -809,7 +809,7 @@ void Notepad_plus::saveDockingParams() // save the hidden Tb's vector vDataAll = vCont[i]->getDataOfAllTb(); - for (size_t j = 0 ; j < vDataAll.size() ; j++) + for (size_t j = 0, len3 = vDataAll.size(); j < len3 ; j++) { if ((vDataAll[j]->pszName && vDataAll[j]->pszName[0]) && (!vCont[i]->isTbVis(vDataAll[j]))) { @@ -836,10 +836,10 @@ void Notepad_plus::saveDockingParams() UCHAR floatContArray[50]; memset(floatContArray, 0, 50); - for (size_t i = 0 ; i < nppGUI._dockingData._pluginDockInfo.size() ; i++) + for (size_t i = 0, len4 = nppGUI._dockingData._pluginDockInfo.size(); i < len4 ; i++) { BOOL isStored = FALSE; - for (size_t j = 0; j < vPluginDockInfo.size(); j++) + for (size_t j = 0, len5 = vPluginDockInfo.size(); j < len5; j++) { if (nppGUI._dockingData._pluginDockInfo[i] == vPluginDockInfo[j]) { @@ -999,7 +999,7 @@ bool Notepad_plus::replaceInOpenedFiles() { if (_mainWindowStatus & WindowMainActive) { - for (int i = 0 ; i < _mainDocTab.nbItem() ; i++) + for (int i = 0, len = _mainDocTab.nbItem(); i < len ; i++) { pBuf = MainFileManager->getBufferByID(_mainDocTab.getBufferByIndex(i)); if (pBuf->isReadOnly()) @@ -1016,7 +1016,7 @@ bool Notepad_plus::replaceInOpenedFiles() { if (_mainWindowStatus & WindowSubActive) { - for (int i = 0 ; i < _subDocTab.nbItem() ; i++) + for (int i = 0, len = _subDocTab.nbItem(); i < len; i++) { pBuf = MainFileManager->getBufferByID(_subDocTab.getBufferByIndex(i)); if (pBuf->isReadOnly()) @@ -1051,7 +1051,7 @@ bool Notepad_plus::replaceInOpenedFiles() { bool Notepad_plus::matchInList(const TCHAR *fileName, const vector & patterns) { - for (size_t i = 0 ; i < patterns.size() ; i++) + for (size_t i = 0, len = patterns.size() ; i < len ; i++) { if (PathMatchSpec(fileName, patterns[i].c_str())) return true; @@ -1391,7 +1391,7 @@ bool Notepad_plus::replaceInFiles() CancelThreadHandle = ::CreateThread(NULL, 0, AsyncCancelFindInFiles, _pPublicInterface->getHSelf(), 0, NULL); bool dontClose = false; - for (size_t i = 0 ; i < fileNames.size() ; i++) + for (size_t i = 0, len = fileNames.size(); i < len ; i++) { MSG msg; if (PeekMessage(&msg, _pPublicInterface->getHSelf(), NPPM_INTERNAL_CANCEL_FIND_IN_FILES, NPPM_INTERNAL_CANCEL_FIND_IN_FILES, PM_REMOVE)) break; @@ -1474,7 +1474,7 @@ bool Notepad_plus::findInFiles() _findReplaceDlg.beginNewFilesSearch(); bool dontClose = false; - for (size_t i = 0 ; i < fileNames.size() ; i++) + for (size_t i = 0, len = fileNames.size(); i < len; i++) { MSG msg; if (PeekMessage(&msg, _pPublicInterface->getHSelf(), NPPM_INTERNAL_CANCEL_FIND_IN_FILES, NPPM_INTERNAL_CANCEL_FIND_IN_FILES, PM_REMOVE)) break; @@ -1535,7 +1535,7 @@ bool Notepad_plus::findInOpenedFiles() if (_mainWindowStatus & WindowMainActive) { - for (int i = 0 ; i < _mainDocTab.nbItem() ; i++) + for (int i = 0, len = _mainDocTab.nbItem(); i < len ; i++) { pBuf = MainFileManager->getBufferByID(_mainDocTab.getBufferByIndex(i)); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); @@ -1547,7 +1547,7 @@ bool Notepad_plus::findInOpenedFiles() if (_mainWindowStatus & WindowSubActive) { - for (int i = 0 ; i < _subDocTab.nbItem() ; i++) + for (int i = 0, len2 = _subDocTab.nbItem(); i < len2 ; i++) { pBuf = MainFileManager->getBufferByID(_subDocTab.getBufferByIndex(i)); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); @@ -2129,7 +2129,7 @@ void Notepad_plus::addHotSpot() // Search the style int fs = -1; - for (size_t i = 0 ; i < hotspotPairs.size() ; i++) + for (size_t i = 0, len = hotspotPairs.size(); i < len ; i++) { // make sure to ignore "hotspot bit" when comparing document style with archived hotspot style if ((hotspotPairs[i] & ~mask) == (idStyle & ~mask)) @@ -3342,7 +3342,7 @@ static generic_string extractSymbol(TCHAR firstChar, TCHAR secondChar, const TCH bool found = false; TCHAR extracted[128] = TEXT(""); - for (int i = 0, j = 0 ; i < lstrlen(str2extract) ; i++) + for (size_t i = 0, j = 0, len = lstrlen(str2extract) ; i < len ; i++) { if (found) { @@ -4145,7 +4145,7 @@ bool Notepad_plus::getIntegralDockingData(tTbData & dockData, int & iCont, bool { DockingManagerData & dockingData = (DockingManagerData &)(NppParameters::getInstance())->getNppGUI()._dockingData; - for (size_t i = 0 ; i < dockingData._pluginDockInfo.size() ; i++) + for (size_t i = 0, len = dockingData._pluginDockInfo.size(); i < len ; i++) { const PluginDlgDockingInfo & pddi = dockingData._pluginDockInfo[i]; @@ -4181,7 +4181,7 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session) //Buffer * mainBuf = _mainEditView.getCurrentBuffer(); //Buffer * subBuf = _subEditView.getCurrentBuffer(); Document oldDoc = _invisibleEditView.execute(SCI_GETDOCPOINTER); - for (int i = 0 ; i < _mainDocTab.nbItem() ; i++) + for (int i = 0, len = _mainDocTab.nbItem(); i < len ; i++) { BufferID bufID = _mainDocTab.getBufferByIndex(i); Buffer * buf = MainFileManager->getBufferByID(bufID); @@ -4238,7 +4238,7 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session) } } - for (int i = 0 ; i < _subDocTab.nbItem() ; i++) + for (int i = 0, len = _subDocTab.nbItem(); i < len ; i++) { BufferID bufID = _subDocTab.getBufferByIndex(i); Buffer * buf = MainFileManager->getBufferByID(bufID); @@ -4597,7 +4597,7 @@ void Notepad_plus::loadCommandlineParams(const TCHAR * commandLine, CmdLineParam bool readOnly = pCmdParams->_isReadOnly; BufferID lastOpened = BUFFER_INVALID; - for (int i = 0 ; i < fnss.size() ; i++) + for (int i = 0, len = fnss.size(); i < len ; i++) { pFn = fnss.getFileName(i); BufferID bufID = doOpen(pFn, readOnly); @@ -4670,7 +4670,7 @@ void Notepad_plus::setFindReplaceFolderFilter(const TCHAR *dir, const TCHAR *fil fltr = TEXT(""); vector vStr; cutString(ext, vStr); - for (size_t i = 0; i < vStr.size(); i++) + for (size_t i = 0 ,len = vStr.size(); i < len; i++) { fltr += TEXT("*."); fltr += vStr[i] + TEXT(" "); @@ -5303,7 +5303,7 @@ int Notepad_plus::getRandomAction(int ranNum) bool isInList(int elem, vector elemList) { - for (size_t i = 0; i < elemList.size(); i++) + for (size_t i = 0, len = elemList.size(); i < len; i++) { if (elem == elemList[i]) return true; @@ -5337,7 +5337,7 @@ DWORD WINAPI Notepad_plus::threadTextPlayer(void *params) int nbTrolling = 0; vector generatedRans; char previousChar = '\0'; - for (size_t i = 0 ; i < strlen(text2display) ; i++) + for (size_t i = 0, len = strlen(text2display); i < len ; i++) { int ranNum = getRandomNumber(maxRange); @@ -5402,7 +5402,7 @@ DWORD WINAPI Notepad_plus::threadTextPlayer(void *params) ::SendMessage(curScintilla, SCI_GOTOPOS, ::SendMessage(curScintilla, SCI_GETLENGTH, 0, 0), 0); // Display quoter - for (size_t i = 0 ; i < strlen(quoter) ; i++) + for (size_t i = 0, len = strlen(quoter); i < len; i++) { int ranNum = getRandomNumber(maxRange); @@ -5436,7 +5436,7 @@ DWORD WINAPI Notepad_plus::threadTextTroller(void *params) BufferID targetBufID = ((TextTrollerParams *)params)->_targetBufID; //HANDLE mutex = ((TextTrollerParams *)params)->_mutex; - for (size_t i = 0 ; i < strlen(text2display) ; i++) + for (size_t i = 0, len = strlen(text2display); i < len; i++) { char charToShow[2] = {text2display[i], '\0'}; int ranNum = getRandomNumber(maxRange); @@ -5478,7 +5478,7 @@ DWORD WINAPI Notepad_plus::threadTextTroller(void *params) } else if (delMethod == 2) { - for (size_t j = 0; j < strlen(text2display); j++) + for (size_t j = 0, len = strlen(text2display); j < len; j++) { if (!selectBack(pCurrentView, targetBufID)) break; diff --git a/PowerEditor/src/Notepad_plus_Window.cpp b/PowerEditor/src/Notepad_plus_Window.cpp index 982b2c6c..14a5ed0e 100644 --- a/PowerEditor/src/Notepad_plus_Window.cpp +++ b/PowerEditor/src/Notepad_plus_Window.cpp @@ -167,7 +167,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin PathAppend(localizationDir, TEXT("localization\\")); _notepad_plus_plus_core.getMatchedFileNames(localizationDir.c_str(), patterns, fileNames, false, false); - for (size_t i = 0 ; i < fileNames.size() ; i++) + for (size_t i = 0, len = fileNames.size(); i < len ; i++) { localizationSwitcher.addLanguageFromXml(fileNames[i].c_str()); } @@ -185,7 +185,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin themeDir = pNppParams->getAppDataNppDir(); PathAppend(themeDir, TEXT("themes\\")); _notepad_plus_plus_core.getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false); - for (size_t i = 0 ; i < fileNames.size() ; i++) + for (size_t i = 0, len = fileNames.size() ; i < len ; i++) { themeSwitcher.addThemeFromXml(fileNames[i].c_str()); } @@ -195,7 +195,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin themeDir = nppDir.c_str(); // <- should use the pointer to avoid the constructor of copy PathAppend(themeDir, TEXT("themes\\")); _notepad_plus_plus_core.getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false); - for (size_t i = 0 ; i < fileNames.size() ; i++) + for (size_t i = 0, len = fileNames.size(); i < len ; i++) { generic_string themeName( themeSwitcher.getThemeFromXmlFileName(fileNames[i].c_str()) ); if (! themeSwitcher.themeNameExists(themeName.c_str()) ) @@ -204,7 +204,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin } } - for (size_t i = 0 ; i < _notepad_plus_plus_core._internalFuncIDs.size() ; i++) + for (size_t i = 0, len = _notepad_plus_plus_core._internalFuncIDs.size() ; i < len ; i++) ::SendMessage(_hSelf, WM_COMMAND, _notepad_plus_plus_core._internalFuncIDs[i], 0); // Notify plugins that Notepad++ is ready @@ -227,7 +227,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin bool Notepad_plus_Window::isDlgsMsg(MSG *msg, bool unicodeSupported) const { - for (size_t i = 0; i < _notepad_plus_plus_core._hModelessDlgs.size(); i++) + for (size_t i = 0, len = _notepad_plus_plus_core._hModelessDlgs.size(); i < len; i++) { if (unicodeSupported?(::IsDialogMessageW(_notepad_plus_plus_core._hModelessDlgs[i], msg)):(::IsDialogMessageA(_notepad_plus_plus_core._hModelessDlgs[i], msg))) return true; diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 7c3fb68f..03e7add0 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -814,7 +814,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa lstrcpy(sessionFileArray[i++], pFn); } - for (size_t j = 0 ; j < session2Load.nbSubFiles() ; j++) + for (size_t j = 0, len = session2Load.nbSubFiles(); j < len ; j++) { const TCHAR *pFn = session2Load._subViewFiles[j]._fileName.c_str(); lstrcpy(sessionFileArray[i++], pFn); @@ -1215,7 +1215,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa { if (wParam == MODELESSDIALOGADD) { - for (size_t i = 0 ; i < _hModelessDlgs.size() ; i++) + for (size_t i = 0, len = _hModelessDlgs.size() ; i < len ; i++) if (_hModelessDlgs[i] == (HWND)lParam) return NULL; _hModelessDlgs.push_back((HWND)lParam); @@ -1223,7 +1223,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa } else if (wParam == MODELESSDIALOGREMOVE) { - for (size_t i = 0 ; i < _hModelessDlgs.size() ; i++) + for (size_t i = 0, len = _hModelessDlgs.size(); i < len ; i++) if (_hModelessDlgs[i] == (HWND)lParam) { vector::iterator hDlg = _hModelessDlgs.begin() + i; @@ -1255,12 +1255,12 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa ContextMenu scintillaContextmenu; vector & tmp = pNppParam->getContextMenuItems(); vector isEnable; - for (size_t i = 0 ; i < tmp.size() ; i++) + for (size_t i = 0, len = tmp.size(); i < len ; i++) { isEnable.push_back((::GetMenuState(_mainMenuHandle, tmp[i]._cmdID, MF_BYCOMMAND)&MF_DISABLED) == 0); } scintillaContextmenu.create(_pPublicInterface->getHSelf(), tmp); - for (size_t i = 0 ; i < isEnable.size() ; i++) + for (size_t i = 0, len = isEnable.size(); i < len ; i++) scintillaContextmenu.enableItem(tmp[i]._cmdID, isEnable[i]); scintillaContextmenu.display(p); @@ -1601,10 +1601,10 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa TCHAR *moduleName = (TCHAR *)lParam; TCHAR *windowName = (TCHAR *)wParam; vector dockContainer = _dockingManager.getContainerInfo(); - for (size_t i = 0 ; i < dockContainer.size() ; i++) + for (size_t i = 0, len = dockContainer.size(); i < len ; i++) { vector tbData = dockContainer[i]->getDataOfAllTb(); - for (size_t j = 0 ; j < tbData.size() ; j++) + for (size_t j = 0, len2 = tbData.size() ; j < len2 ; j++) { if (generic_stricmp(moduleName, tbData[j]->pszModuleName) == 0) { diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index fc299091..943a90d8 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -75,7 +75,7 @@ void Notepad_plus::command(int id) if (_pFileSwitcherPanel) { vector files = _pFileSwitcherPanel->getSelectedFiles(id == IDM_FILESWITCHER_FILESCLOSEOTHERS); - for (size_t i = 0; i < files.size(); i++) + for (size_t i = 0, len = files.size(); i < len; i++) { fileClose((BufferID)files[i]._bufID, files[i]._iView); } @@ -1896,7 +1896,7 @@ void Notepad_plus::command(int id) // load plugin vector dll2Remove; - for (size_t i = 0 ; i < copiedFiles.size() ; i++) + for (size_t i = 0, len = copiedFiles.size() ; i < len ; i++) { int index = _pluginsManager.loadPlugin(copiedFiles[i].c_str(), dll2Remove); if (_pluginsManager.getMenuHandle()) @@ -1920,7 +1920,7 @@ void Notepad_plus::command(int id) ThemeSwitcher & themeSwitcher = pNppParams->getThemeSwitcher(); vector copiedFiles = addNppComponents(destDir, extFilterName, extFilter); - for (size_t i = 0 ; i < copiedFiles.size() ; i++) + for (size_t i = 0, len = copiedFiles.size(); i < len ; i++) { generic_string themeName(themeSwitcher.getThemeFromXmlFileName(copiedFiles[i].c_str())); if (!themeSwitcher.themeNameExists(themeName.c_str())) diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index 89780cb0..fabf6433 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -401,7 +401,7 @@ generic_string Notepad_plus::exts2Filters(generic_string exts) const int j = 0; bool stop = false; - for (size_t i = 0 ; i < exts.length() ; i++) + for (size_t i = 0, len = exts.length(); i < len ; i++) { if (extStr[i] == ' ') { @@ -459,7 +459,7 @@ int Notepad_plus::setFileOpenSaveDlgFilters(FileDialog & fDlg, int langType) bool inExcludedList = false; - for (size_t j = 0 ; j < nppGUI._excludedLangList.size() ; j++) + for (size_t j = 0, len = nppGUI._excludedLangList.size() ; j < len ; j++) { if (lid == nppGUI._excludedLangList[j]._langType) { @@ -1067,7 +1067,7 @@ bool Notepad_plus::loadSession(Session & session) //Dont use default methods because of performance Document prevDoc = _mainEditView.execute(SCI_GETDOCPOINTER); _mainEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument()); - for (size_t j = 0 ; j < session._mainViewFiles[i].marks.size() ; j++) + for (size_t j = 0, len = session._mainViewFiles[i].marks.size(); j < len ; j++) { _mainEditView.execute(SCI_MARKERADD, session._mainViewFiles[i].marks[j], MARK_BOOKMARK); } @@ -1163,7 +1163,7 @@ bool Notepad_plus::loadSession(Session & session) //Dont use default methods because of performance Document prevDoc = _subEditView.execute(SCI_GETDOCPOINTER); _subEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument()); - for (size_t j = 0 ; j < session._subViewFiles[k].marks.size() ; j++) + for (size_t j = 0, len = session._subViewFiles[k].marks.size(); j < len ; j++) { _subEditView.execute(SCI_MARKERADD, session._subViewFiles[k].marks[j], MARK_BOOKMARK); } diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index b86a978e..9718f496 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -482,7 +482,7 @@ wstring LocalizationSwitcher::getLangFromXmlFileName(const wchar_t *fn) const wstring LocalizationSwitcher::getXmlFilePathFromLangName(const wchar_t *langName) const { - for (size_t i = 0 ; i < _localizationList.size() ; i++) + for (size_t i = 0, len = _localizationList.size(); i < len ; i++) { if (wcsicmp(langName, _localizationList[i].first.c_str()) == 0) return _localizationList[i].second; @@ -1099,7 +1099,7 @@ bool NppParameters::load() getSessionFromXmlTree(); delete _pXmlSessionDoc; - for (size_t i = 0 ; i < _pXmlExternalLexerDoc.size() ; i++) + for (size_t i = 0, len = _pXmlExternalLexerDoc.size() ; i < len ; i++) if (_pXmlExternalLexerDoc[i]) delete _pXmlExternalLexerDoc[i]; @@ -2342,7 +2342,7 @@ void NppParameters::insertMacro(TiXmlNode *macrosRoot, const MacroShortcut & mac macroRoot->ToElement()->SetAttribute(TEXT("Alt"), key._isAlt?TEXT("yes"):TEXT("no")); macroRoot->ToElement()->SetAttribute(TEXT("Shift"), key._isShift?TEXT("yes"):TEXT("no")); macroRoot->ToElement()->SetAttribute(TEXT("Key"), key._key); - for (size_t i = 0 ; i < macro._macro.size() ; i++) + for (size_t i = 0, len = macro._macro.size(); i < len ; i++) { TiXmlNode *actionNode = macroRoot->InsertEndChild(TiXmlElement(TEXT("Action"))); const recordedMacroStep & action = macro._macro[i]; @@ -2420,7 +2420,7 @@ void NppParameters::writeSession(const Session & session, const TCHAR *fileName) TiXmlNode *mainViewNode = sessionNode->InsertEndChild(TiXmlElement(TEXT("mainView"))); (mainViewNode->ToElement())->SetAttribute(TEXT("activeIndex"), (int)session._activeMainIndex); - for (size_t i = 0 ; i < session._mainViewFiles.size() ; i++) + for (size_t i = 0, len = session._mainViewFiles.size(); i < len ; i++) { TiXmlNode *fileNameNode = mainViewNode->InsertEndChild(TiXmlElement(TEXT("File"))); @@ -2434,14 +2434,14 @@ void NppParameters::writeSession(const Session & session, const TCHAR *fileName) (fileNameNode->ToElement())->SetAttribute(TEXT("encoding"), session._mainViewFiles[i]._encoding); (fileNameNode->ToElement())->SetAttribute(TEXT("filename"), session._mainViewFiles[i]._fileName.c_str()); - for (size_t j = 0 ; j < session._mainViewFiles[i].marks.size() ; j++) + for (size_t j = 0, len = session._mainViewFiles[i].marks.size() ; j < len ; j++) { size_t markLine = session._mainViewFiles[i].marks[j]; TiXmlNode *markNode = fileNameNode->InsertEndChild(TiXmlElement(TEXT("Mark"))); markNode->ToElement()->SetAttribute(TEXT("line"), markLine); } - for (size_t j = 0 ; j < session._mainViewFiles[i]._foldStates.size() ; j++) + for (size_t j = 0, len = session._mainViewFiles[i]._foldStates.size() ; j < len ; j++) { size_t foldLine = session._mainViewFiles[i]._foldStates[j]; TiXmlNode *foldNode = fileNameNode->InsertEndChild(TiXmlElement(TEXT("Fold"))); @@ -2451,7 +2451,7 @@ void NppParameters::writeSession(const Session & session, const TCHAR *fileName) TiXmlNode *subViewNode = sessionNode->InsertEndChild(TiXmlElement(TEXT("subView"))); (subViewNode->ToElement())->SetAttribute(TEXT("activeIndex"), (int)session._activeSubIndex); - for (size_t i = 0 ; i < session._subViewFiles.size() ; i++) + for (size_t i = 0, len = session._subViewFiles.size(); i < len ; i++) { TiXmlNode *fileNameNode = subViewNode->InsertEndChild(TiXmlElement(TEXT("File"))); @@ -2465,14 +2465,14 @@ void NppParameters::writeSession(const Session & session, const TCHAR *fileName) (fileNameNode->ToElement())->SetAttribute(TEXT("encoding"), session._subViewFiles[i]._encoding); (fileNameNode->ToElement())->SetAttribute(TEXT("filename"), session._subViewFiles[i]._fileName.c_str()); - for (size_t j = 0 ; j < session._subViewFiles[i].marks.size() ; j++) + for (size_t j = 0, len = session._subViewFiles[i].marks.size(); j < len; j++) { size_t markLine = session._subViewFiles[i].marks[j]; TiXmlNode *markNode = fileNameNode->InsertEndChild(TiXmlElement(TEXT("Mark"))); markNode->ToElement()->SetAttribute(TEXT("line"), markLine); } - for (size_t j = 0 ; j < session._subViewFiles[i]._foldStates.size() ; j++) + for (size_t j = 0, len = session._subViewFiles[i]._foldStates.size() ; j < len ; j++) { size_t foldLine = session._subViewFiles[i]._foldStates[j]; TiXmlNode *foldNode = fileNameNode->InsertEndChild(TiXmlElement(TEXT("Fold"))); @@ -2503,7 +2503,7 @@ void NppParameters::writeShortcuts() root->RemoveChild(cmdRoot); cmdRoot = root->InsertEndChild(TiXmlElement(TEXT("InternalCommands"))); - for (size_t i = 0 ; i < _customizedShortcuts.size() ; i++) + for (size_t i = 0, len = _customizedShortcuts.size(); i < len ; i++) { int index = _customizedShortcuts[i]; CommandShortcut csc = _shortcuts[index]; @@ -2516,7 +2516,7 @@ void NppParameters::writeShortcuts() macrosRoot = root->InsertEndChild(TiXmlElement(TEXT("Macros"))); - for (size_t i = 0 ; i < _macros.size() ; i++) + for (size_t i = 0, len = _macros.size(); i < len ; i++) { insertMacro(macrosRoot, _macros[i]); } @@ -2527,7 +2527,7 @@ void NppParameters::writeShortcuts() userCmdRoot = root->InsertEndChild(TiXmlElement(TEXT("UserDefinedCommands"))); - for (size_t i = 0 ; i < _userCommands.size() ; i++) + for (size_t i = 0, len = _userCommands.size(); i < len ; i++) { insertUserCmd(userCmdRoot, _userCommands[i]); } @@ -2537,7 +2537,7 @@ void NppParameters::writeShortcuts() root->RemoveChild(pluginCmdRoot); pluginCmdRoot = root->InsertEndChild(TiXmlElement(TEXT("PluginCommands"))); - for (size_t i = 0 ; i < _pluginCustomizedCmds.size() ; i++) + for (size_t i = 0, len = _pluginCustomizedCmds.size(); i < len ; i++) { insertPluginCmd(pluginCmdRoot, _pluginCommands[_pluginCustomizedCmds[i]]); } @@ -2547,7 +2547,7 @@ void NppParameters::writeShortcuts() root->RemoveChild(scitillaKeyRoot); scitillaKeyRoot = root->InsertEndChild(TiXmlElement(TEXT("ScintillaKeys"))); - for (size_t i = 0 ; i < _scintillaModifiedKeyIndices.size() ; i++) + for (size_t i = 0, len = _scintillaModifiedKeyIndices.size(); i < len ; i++) { insertScintKey(scitillaKeyRoot, _scintillaKeyCommands[_scintillaModifiedKeyIndices[i]]); } @@ -4823,28 +4823,28 @@ bool NppParameters::writeFindHistory() TiXmlElement hist_element(TEXT("")); hist_element.SetValue(TEXT("Path")); - for (size_t i = 0; i < _findHistory._findHistoryPaths.size(); i++) + for (size_t i = 0, len = _findHistory._findHistoryPaths.size(); i < len; i++) { (hist_element.ToElement())->SetAttribute(TEXT("name"), _findHistory._findHistoryPaths[i].c_str()); findHistoryRoot->InsertEndChild(hist_element); } hist_element.SetValue(TEXT("Filter")); - for (size_t i = 0; i < _findHistory._findHistoryFilters.size(); i++) + for (size_t i = 0, len = _findHistory._findHistoryFilters.size(); i < len; i++) { (hist_element.ToElement())->SetAttribute(TEXT("name"), _findHistory._findHistoryFilters[i].c_str()); findHistoryRoot->InsertEndChild(hist_element); } hist_element.SetValue(TEXT("Find")); - for (size_t i = 0; i < _findHistory._findHistoryFinds.size(); i++) + for (size_t i = 0, len = _findHistory._findHistoryFinds.size(); i < len; i++) { (hist_element.ToElement())->SetAttribute(TEXT("name"), _findHistory._findHistoryFinds[i].c_str()); findHistoryRoot->InsertEndChild(hist_element); } hist_element.SetValue(TEXT("Replace")); - for (size_t i = 0; i < _findHistory._findHistoryReplaces.size(); i++) + for (size_t i = 0, len = _findHistory._findHistoryReplaces.size(); i < len; i++) { (hist_element.ToElement())->SetAttribute(TEXT("name"), _findHistory._findHistoryReplaces[i].c_str()); findHistoryRoot->InsertEndChild(hist_element); @@ -4862,7 +4862,7 @@ void NppParameters::insertDockingParamNode(TiXmlNode *GUIRoot) DMNode.SetAttribute(TEXT("topHeight"), _nppGUI._dockingData._topHeight); DMNode.SetAttribute(TEXT("bottomHeight"), _nppGUI._dockingData._bottomHight); - for (size_t i = 0 ; i < _nppGUI._dockingData._flaotingWindowInfo.size() ; i++) + for (size_t i = 0, len = _nppGUI._dockingData._flaotingWindowInfo.size(); i < len ; i++) { FloatingWindowInfo & fwi = _nppGUI._dockingData._flaotingWindowInfo[i]; TiXmlElement FWNode(TEXT("FloatingWindow")); @@ -4875,7 +4875,7 @@ void NppParameters::insertDockingParamNode(TiXmlNode *GUIRoot) DMNode.InsertEndChild(FWNode); } - for (size_t i = 0 ; i < _nppGUI._dockingData._pluginDockInfo.size() ; i++) + for (size_t i = 0, len = _nppGUI._dockingData._pluginDockInfo.size() ; i < len ; i++) { PluginDlgDockingInfo & pdi = _nppGUI._dockingData._pluginDockInfo[i]; TiXmlElement PDNode(TEXT("PluginDlg")); @@ -4888,7 +4888,7 @@ void NppParameters::insertDockingParamNode(TiXmlNode *GUIRoot) DMNode.InsertEndChild(PDNode); } - for (size_t i = 0 ; i < _nppGUI._dockingData._containerTabInfo.size() ; i++) + for (size_t i = 0, len = _nppGUI._dockingData._containerTabInfo.size(); i < len ; i++) { ContainerTabInfo & cti = _nppGUI._dockingData._containerTabInfo[i]; TiXmlElement CTNode(TEXT("ActiveTabs")); @@ -4938,7 +4938,7 @@ void NppParameters::writeExcludedLangList(TiXmlElement *element) int g6 = 0; // up to 56 int g7 = 0; // up to 64 - for (size_t i = 0 ; i < _nppGUI._excludedLangList.size() ; i++) + for (size_t i = 0, len = _nppGUI._excludedLangList.size(); i < len ; i++) { LangType langType = _nppGUI._excludedLangList[i]._langType; if (langType >= L_EXTERNAL && langType < L_END) diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 4fb6f81e..40a4ace2 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -240,7 +240,7 @@ struct DockingManagerData { vector _containerTabInfo; bool getFloatingRCFrom(int floatCont, RECT & rc) { - for (size_t i = 0 ; i < _flaotingWindowInfo.size() ; i++) + for (size_t i = 0, fwiLen = _flaotingWindowInfo.size(); i < fwiLen; i++) { if (_flaotingWindowInfo[i]._cont == floatCont) { @@ -1321,7 +1321,7 @@ public: { vector extVect; cutString(_userLangArray[i]->_ext.c_str(), extVect); - for (size_t j = 0 ; j < extVect.size() ; j++) + for (size_t j = 0, len = extVect.size(); j < len; j++) if (!generic_stricmp(extVect[j].c_str(), ext) || (_tcschr(fullName, '.') && !generic_stricmp(extVect[j].c_str(), fullName))) return _userLangArray[i]->_name.c_str(); } @@ -1458,7 +1458,7 @@ public: vector & getBlackList() {return _blacklist;}; bool isInBlackList(TCHAR *fn) { - for (size_t i = 0 ; i < _blacklist.size() ; i++) + for (size_t i = 0, len = _blacklist.size(); i < len ; i++) if (_blacklist[i] == fn) return true; return false; diff --git a/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp b/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp index 93f1529d..819668b5 100644 --- a/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp +++ b/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp @@ -33,7 +33,7 @@ static bool isInList(generic_string word, const vector & wordArray) { - for (size_t i = 0 ; i < wordArray.size() ; i++) + for (size_t i = 0, len = wordArray.size(); i < len; i++) if (wordArray[i] == word) return true; return false; @@ -135,7 +135,7 @@ bool AutoCompletion::showWordComplete(bool autoInsert) sort(wordArray.begin(), wordArray.end()); generic_string words(TEXT("")); - for (size_t i = 0 ; i < wordArray.size() ; i++) + for (size_t i = 0, len = wordArray.size(); i < len; i++) { words += wordArray[i]; if (i != wordArray.size()-1) diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index 86a0bc20..951313ee 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -362,7 +362,7 @@ int FindReplaceDlg::saveComboHistory(int id, int maxcount, vectorgetHSelf() == handle2Find) { @@ -75,7 +75,7 @@ bool ScintillaCtrls::destroyScintilla(HWND handle2Destroy) void ScintillaCtrls::destroy() { - for (size_t i = 0 ; i < _scintVector.size() ; i++) + for (size_t i = 0, len = _scintVector.size(); i < len ; i++) { _scintVector[i]->destroy(); delete _scintVector[i]; diff --git a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp index 6daa8990..1a3fa83a 100644 --- a/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp @@ -674,7 +674,7 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName) bool inSingleQuote = false; bool nonWSFound = false; int index = 0; - for (unsigned int j=0; jgetLStylerArray()).getLexerStylerByName(lexerName); if (pStyler) { - for (int i = 0 ; i < pStyler->getNbStyler() ; i++) + for (int i = 0, nb = pStyler->getNbStyler() ; i < nb ; i++) { Style style = pStyler->getStyler(i); //not by reference, but copy int cppID = style._styleID; @@ -1104,7 +1104,7 @@ void ScintillaEditView::makeStyle(LangType language, const TCHAR **keywordArray) LexerStyler *pStyler = (_pParameter->getLStylerArray()).getLexerStylerByName(lexerName); if (pStyler) { - for (int i = 0 ; i < pStyler->getNbStyler() ; i++) + for (int i = 0, nb = pStyler->getNbStyler(); i < nb ; i++) { Style & style = pStyler->getStyler(i); setStyle(style); @@ -2272,7 +2272,7 @@ const char * ScintillaEditView::getCompleteKeywordList(std::basic_string & void ScintillaEditView::setMultiSelections(const ColumnModeInfos & cmi) { - for (size_t i = 0 ; i < cmi.size() ; i++) + for (size_t i = 0, len = cmi.size(); i < len ; i++) { if (cmi[i].isValid()) { @@ -2411,7 +2411,7 @@ void ScintillaEditView::convertSelectedTextTo(bool Case) ColumnModeInfos cmi = getColumnModeSelectInfo(); - for (size_t i = 0 ; i < cmi.size() ; i++) + for (size_t i = 0, cmiLen = cmi.size(); i < cmiLen ; i++) { const int len = cmi[i]._selRpos - cmi[i]._selLpos; char *srcStr = new char[len+1]; @@ -2593,7 +2593,7 @@ ColumnModeInfos ScintillaEditView::getColumnModeSelectInfo() void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, const TCHAR *str) { int totalDiff = 0; - for (size_t i = 0 ; i < cmi.size() ; i++) + for (size_t i = 0, len = cmi.size(); i < len ; i++) { if (cmi[i].isValid()) { @@ -2676,7 +2676,7 @@ void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, int initial, int in TCHAR str[stringSize]; int totalDiff = 0; - for (size_t i = 0 ; i < cmi.size() ; i++) + for (size_t i = 0, len = cmi.size() ; i < len ; i++) { if (cmi[i].isValid()) { diff --git a/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp b/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp index f34b16c9..a572c757 100644 --- a/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp +++ b/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp @@ -136,7 +136,7 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView) bool SmartHighlighter::isQualifiedWord(const char *str) const { - for (size_t i = 0 ; i < strlen(str) ; i++) + for (size_t i = 0, len = strlen(str) ; i < len ; i++) { if (!isWordChar(str[i])) return false; diff --git a/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp b/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp index d41a0c0f..83c5fccf 100644 --- a/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp +++ b/PowerEditor/src/ScitillaComponent/UserDefineDialog.cpp @@ -184,7 +184,7 @@ void FolderStyleDialog::convertTo(TCHAR *dest, const TCHAR *toConvert, TCHAR *pr dest[index++] = prefix[0]; dest[index++] = prefix[1]; - for (int i = 0 ; i < int(lstrlen(toConvert)) ; i++) + for (size_t i = 0, len = lstrlen(toConvert); i < len ; i++) { if (i == 0 && toConvert[i] == '(' && toConvert[i+1] == '(') { @@ -228,7 +228,7 @@ void FolderStyleDialog::retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *pr int j = 0; bool begin2Copy = false; - for (int i = 0 ; i < int(lstrlen(toRetrieve)) ; i++) + for (size_t i = 0, len = lstrlen(toRetrieve); i < len ; i++) { if ((i == 0 || (toRetrieve[i-1] == ' ')) && (toRetrieve[i] == prefix[0] && toRetrieve[i+1] == prefix[1])) { @@ -536,7 +536,7 @@ void CommentStyleDialog::convertTo(TCHAR *dest, const TCHAR *toConvert, TCHAR *p dest[index++] = prefix[0]; dest[index++] = prefix[1]; - for (int i = 0 ; i < int(lstrlen(toConvert)) ; i++) + for (size_t i = 0, len = lstrlen(toConvert); i < len ; i++) { if (i == 0 && toConvert[i] == '(' && toConvert[i+1] == '(') { @@ -581,7 +581,7 @@ void CommentStyleDialog::retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *p bool begin2Copy = false; bool inGroup = false; - for (int i = 0 ; i < int(lstrlen(toRetrieve)) ; i++) + for (size_t i = 0, len = lstrlen(toRetrieve); i < len ; i++) { if ((i == 0 || (toRetrieve[i-1] == ' ')) && (toRetrieve[i] == prefix[0] && toRetrieve[i+1] == prefix[1])) { @@ -776,7 +776,7 @@ void SymbolsStyleDialog::convertTo(TCHAR *dest, const TCHAR *toConvert, TCHAR *p dest[index++] = prefix[0]; dest[index++] = prefix[1]; - for (int i = 0 ; i < int(lstrlen(toConvert)) ; i++) + for (size_t i = 0, len = lstrlen(toConvert); i < len ; i++) { if (i == 0 && toConvert[i] == '(' && toConvert[i+1] == '(') { @@ -821,7 +821,7 @@ void SymbolsStyleDialog::retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *p bool begin2Copy = false; bool inGroup = false; - for (int i = 0 ; i < int(lstrlen(toRetrieve)) ; i++) + for (size_t i = 0, len = lstrlen(toRetrieve); i < len ; i++) { if ((i == 0 || (toRetrieve[i-1] == ' ')) && (toRetrieve[i] == prefix[0] && toRetrieve[i+1] == prefix[1])) { @@ -978,7 +978,7 @@ void UserDefineDialog::reloadLangCombo() NppParameters *pNppParam = NppParameters::getInstance(); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_RESETCONTENT, 0, 0); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("User Define Language")); - for (int i = 0 ; i < pNppParam->getNbUserLang() ; i++) + for (int i = 0, nb = pNppParam->getNbUserLang(); i < nb ; i++) { UserLangContainer & userLangContainer = pNppParam->getULCFromIndex(i); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, (LPARAM)userLangContainer.getName()); @@ -1591,7 +1591,7 @@ BOOL CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM // for the font name combo HWND hFontNameCombo = ::GetDlgItem(hwnd, IDC_STYLER_COMBO_FONT_NAME); const std::vector & fontlist = pNppParam->getFontList(); - for (int j = 0 ; j < int(fontlist.size()) ; j++) + for (size_t j = 0, len = fontlist.size() ; j < len ; j++) { int k = ::SendMessage(hFontNameCombo, CB_ADDSTRING, 0, (LPARAM)fontlist[j].c_str()); ::SendMessage(hFontNameCombo, CB_SETITEMDATA, k, (LPARAM)fontlist[j].c_str()); diff --git a/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp b/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp index 2848dd78..d2919250 100644 --- a/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp +++ b/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp @@ -624,7 +624,7 @@ void XmlMatchedTagsHighlighter::tagMatch(bool doHiliteAttr) { vector< pair > attributes = getAttributesPos(xmlTags.tagNameEnd, xmlTags.tagOpenEnd - openTagTailLen); _pEditView->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_TAGATTR); - for (size_t i = 0 ; i < attributes.size() ; i++) + for (size_t i = 0, len = attributes.size(); i < len ; i++) { _pEditView->execute(SCI_INDICATORFILLRANGE, attributes[i].first, attributes[i].second - attributes[i].first); } diff --git a/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlparserA.cpp b/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlparserA.cpp index 833c7775..935f8fc4 100644 --- a/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlparserA.cpp +++ b/PowerEditor/src/TinyXml/tinyXmlA/tinyxmlparserA.cpp @@ -1153,7 +1153,7 @@ const char* TiXmlDeclarationA::Parse( const char* p, TiXmlParsingDataA* data ) bool TiXmlTextA::Blank() const { - for ( unsigned i=0; i & fontlist = (NppParameters::getInstance())->getFontList(); - for (size_t i = 0 ; i < fontlist.size() ; i++) + for (size_t i = 0, len = fontlist.size() ; i < len ; i++) { int j = ::SendMessage(_hFontNameCombo, CB_ADDSTRING, 0, (LPARAM)fontlist[i].c_str()); ::SendMessage(_hFontNameCombo, CB_SETITEMDATA, j, (LPARAM)fontlist[i].c_str()); @@ -475,7 +475,7 @@ void WordStyleDlg::loadLangListFromNppParam() ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, (LPARAM)TEXT("Global Styles")); // All the lexers - for (int i = 0 ; i < _lsArray.getNbLexer() ; i++) + for (int i = 0, nb = _lsArray.getNbLexer() ; i < nb ; i++) { ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, (LPARAM)_lsArray.getLexerDescFromIndex(i)); } @@ -687,7 +687,7 @@ void WordStyleDlg::setStyleListFromLexer(int index) StyleArray & lexerStyler = index?_lsArray.getLexerFromIndex(index-1):_globalStyles; - for (int i = 0 ; i < lexerStyler.getNbStyler() ; i++) + for (int i = 0, nb = lexerStyler.getNbStyler(); i < nb ; i++) { Style & style = lexerStyler.getStyler(i); ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_ADDSTRING, 0, (LPARAM)style._styleDesc); diff --git a/PowerEditor/src/WinControls/ContextMenu/ContextMenu.cpp b/PowerEditor/src/WinControls/ContextMenu/ContextMenu.cpp index 86ece4ec..f79a460c 100644 --- a/PowerEditor/src/WinControls/ContextMenu/ContextMenu.cpp +++ b/PowerEditor/src/WinControls/ContextMenu/ContextMenu.cpp @@ -46,7 +46,7 @@ ContextMenu::~ContextMenu() { if (isCreated()) { - for (size_t i = 0 ; i < _subMenus.size() ; i++) + for (size_t i = 0, len = _subMenus.size(); i < len; i++) ::DestroyMenu(_subMenus[i]); ::DestroyMenu(_hMenu); } @@ -61,7 +61,7 @@ void ContextMenu::create(HWND hParent, const vector & menuItemArra generic_string currentParentFolderStr = TEXT(""); int j = 0; - for (size_t i = 0 ; i < menuItemArray.size() ; i++) + for (size_t i = 0, len = menuItemArray.size(); i < len; i++) { const MenuItemUnit & item = menuItemArray[i]; if (item._parentFolderName == TEXT("")) diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp index 7eb779d9..cb15ac63 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp @@ -154,7 +154,7 @@ tTbData* DockingCont::createToolbar(tTbData data) void DockingCont::removeToolbar(tTbData TbData) { // remove from list - for (size_t iTb = 0; iTb < _vTbData.size(); iTb++) + for (size_t iTb = 0, len = _vTbData.size(); iTb < len; iTb++) { if (_vTbData[iTb]->hClient == TbData.hClient) { @@ -175,7 +175,7 @@ tTbData* DockingCont::findToolbarByWnd(HWND hClient) tTbData* pTbData = NULL; // find entry by handle - for (size_t iTb = 0; iTb < _vTbData.size(); iTb++) + for (size_t iTb = 0, len = _vTbData.size(); iTb < len; iTb++) { if (hClient == _vTbData[iTb]->hClient) { @@ -190,7 +190,7 @@ tTbData* DockingCont::findToolbarByName(TCHAR* pszName) tTbData* pTbData = NULL; // find entry by handle - for (size_t iTb = 0; iTb < _vTbData.size(); iTb++) + for (size_t iTb = 0, len = _vTbData.size(); iTb < len; iTb++) { if (lstrcmp(pszName, _vTbData[iTb]->pszName) == 0) { @@ -1067,7 +1067,7 @@ void DockingCont::onSize() // update floating size if (_isFloating == true) { - for (size_t iTb = 0; iTb < _vTbData.size(); iTb++) + for (size_t iTb = 0, len = _vTbData.size(); iTb < len; iTb++) { getWindowRect(_vTbData[iTb]->rcFloat); } diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp index d53bca72..4447029e 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingManager.cpp @@ -195,7 +195,7 @@ LRESULT CALLBACK DockingManager::staticWinProc(HWND hwnd, UINT message, WPARAM w void DockingManager::updateContainerInfo(HWND hClient) { - for (size_t iCont = 0; iCont < _vContainer.size(); iCont++) + for (size_t iCont = 0, len = _vContainer.size(); iCont < len; iCont++) { if (_vContainer[iCont]->updateInfo(hClient) == TRUE) { @@ -206,7 +206,7 @@ void DockingManager::updateContainerInfo(HWND hClient) void DockingManager::showContainer(HWND hCont, BOOL view) { - for (size_t iCont = 0; iCont < _vContainer.size(); iCont++) + for (size_t iCont = 0, len = _vContainer.size(); iCont < len; iCont++) { if (_vContainer[iCont]->getHSelf() == hCont) showContainer(iCont, view); @@ -220,7 +220,7 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l case WM_NCACTIVATE: { // activate/deactivate titlebar of toolbars - for (size_t iCont = DOCKCONT_MAX; iCont < _vContainer.size(); iCont++) + for (size_t iCont = DOCKCONT_MAX, len = _vContainer.size(); iCont < len; iCont++) { ::SendMessage(_vContainer[iCont]->getHSelf(), WM_NCACTIVATE, wParam, (LPARAM)-1); } @@ -370,7 +370,7 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l } case DMM_GETICONPOS: { - for (UINT uImageCnt = 0; uImageCnt < _vImageList.size(); uImageCnt++) + for (UINT uImageCnt = 0, len = _vImageList.size(); uImageCnt < len; uImageCnt++) { if ((HWND)lParam == _vImageList[uImageCnt]) { @@ -674,7 +674,7 @@ void DockingManager::setActiveTab(int iCont, int iItem) void DockingManager::showDockableDlg(HWND hDlg, BOOL view) { tTbData *pTbData = NULL; - for (size_t i = 0; i < _vContainer.size(); i++) + for (size_t i = 0, len = _vContainer.size(); i < len; i++) { pTbData = _vContainer[i]->findToolbarByWnd(hDlg); if (pTbData != NULL) @@ -688,7 +688,7 @@ void DockingManager::showDockableDlg(HWND hDlg, BOOL view) void DockingManager::showDockableDlg(TCHAR* pszName, BOOL view) { tTbData *pTbData = NULL; - for (size_t i = 0; i < _vContainer.size(); i++) + for (size_t i = 0, len = _vContainer.size(); i < len; i++) { pTbData = _vContainer[i]->findToolbarByName(pszName); if (pTbData != NULL) @@ -808,7 +808,7 @@ DockingCont* DockingManager::toggleVisTb(DockingCont* pContSrc, UINT message, LP pContSrc->doDialog(false); onSize(); - for (size_t iTb = 0; iTb < vTbData.size(); iTb++) + for (size_t iTb = 0, len = vTbData.size(); iTb < len; iTb++) { // get data one by another tTbData TbData = *vTbData[iTb]; @@ -869,7 +869,7 @@ void DockingManager::toggleVisTb(DockingCont* pContSrc, DockingCont* pContTgt) pContSrc->doDialog(false); onSize(); - for (size_t iTb = 0; iTb < vTbData.size(); iTb++) + for (size_t iTb = 0, len = vTbData.size(); iTb < len; iTb++) { // get data one by another tTbData TbData = *vTbData[iTb]; @@ -918,9 +918,8 @@ BOOL DockingManager::ContExists(size_t iCont) int DockingManager::GetContainer(DockingCont* pCont) { - int iRet = -1; - - for (size_t iCont = 0; iCont < _vContainer.size(); iCont++) + int iRet = -1; + for (size_t iCont = 0, len = _vContainer.size(); iCont < len; iCont++) { if (_vContainer[iCont] == pCont) { @@ -939,7 +938,7 @@ int DockingManager::FindEmptyContainer() BOOL* pArrayPos = &pPrevDockList[1]; // delete all entries - for (size_t iCont = 0; iCont < _vContainer.size()+1; iCont++) + for (size_t iCont = 0, len = _vContainer.size()+1; iCont < len; iCont++) { pPrevDockList[iCont] = FALSE; } @@ -949,14 +948,14 @@ int DockingManager::FindEmptyContainer() { vector vTbData = _vContainer[iCont]->getDataOfAllTb(); - for (size_t iTb = 0; iTb < vTbData.size(); iTb++) + for (size_t iTb = 0, len = vTbData.size(); iTb < len; iTb++) { pArrayPos[vTbData[iTb]->iPrevCont] = TRUE; } } // find free container - for (size_t iCont = DOCKCONT_MAX; iCont < _vContainer.size(); iCont++) + for (size_t iCont = DOCKCONT_MAX, len = _vContainer.size(); iCont < len; iCont++) { if (pArrayPos[iCont] == FALSE) { diff --git a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp index 39009ce7..5044886a 100644 --- a/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/Gripper.cpp @@ -416,7 +416,7 @@ void Gripper::doTabReordering(POINT pt) int iItemOld = _iItem; /* search for every tab entry */ - for (size_t iCont = 0; iCont < vCont.size(); iCont++) + for (size_t iCont = 0, len = vCont.size(); iCont < len; iCont++) { hTab = vCont[iCont]->getTabWnd(); @@ -729,7 +729,7 @@ DockingCont* Gripper::contHitTest(POINT pt) vector vCont = _pDockMgr->getContainerInfo(); HWND hWnd = ::WindowFromPoint(pt); - for (UINT iCont = 0; iCont < vCont.size(); iCont++) + for (UINT iCont = 0, len = vCont.size(); iCont < len; iCont++) { /* test if within caption */ if (hWnd == vCont[iCont]->getCaptionWnd()) @@ -783,7 +783,7 @@ DockingCont* Gripper::workHitTest(POINT pt, RECT *rc) vector vCont = _pDockMgr->getContainerInfo(); /* at first test if cursor points into a visible container */ - for (size_t iCont = 0; iCont < vCont.size(); iCont++) + for (size_t iCont = 0, len = vCont.size(); iCont < len; iCont++) { if (vCont[iCont]->isVisible()) { diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp index 5bcee53c..62e5d20c 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp @@ -159,7 +159,7 @@ generic_string FunctionListPanel::parseSubLevel(size_t begin, size_t end, std::v void FunctionListPanel::addInTreeStateArray(TreeStateNode tree2Update) { bool found = false; - for (size_t i = 0; i < _treeStates.size(); i++) + for (size_t i = 0, len = _treeStates.size(); i < len; i++) { if (_treeStates[i]._extraData == tree2Update._extraData) { @@ -174,7 +174,7 @@ void FunctionListPanel::addInTreeStateArray(TreeStateNode tree2Update) TreeStateNode* FunctionListPanel::getFromTreeStateArray(generic_string fullFilePath) { - for (size_t i = 0; i < _treeStates.size(); i++) + for (size_t i = 0, len = _treeStates.size(); i < len; i++) { if (_treeStates[i]._extraData == fullFilePath) return &_treeStates[i]; @@ -201,7 +201,7 @@ void FunctionListPanel::reload() _treeView.addItem(fn, NULL, INDEX_ROOT, TEXT("-1")); } - for (size_t i = 0; i < fi.size(); i++) + for (size_t i = 0, len = fi.size(); i < len; i++) { // no 2 level bool b = false; diff --git a/PowerEditor/src/WinControls/FunctionList/functionParser.cpp b/PowerEditor/src/WinControls/FunctionList/functionParser.cpp index 20304f26..448ab6ef 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionParser.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionParser.cpp @@ -32,7 +32,7 @@ FunctionParsersManager::~FunctionParsersManager() { - for (size_t i = 0; i < _parsers.size(); i++) + for (size_t i = 0, len = _parsers.size(); i < len; i++) { delete _parsers[i]; } @@ -243,7 +243,7 @@ bool FunctionParsersManager::getFuncListFromXmlTree() const TCHAR *id = (childNode->ToElement())->Attribute(TEXT("id")); if ((langIDStr || (exts && exts[0])) && (id && id[0])) { - for (size_t i = 0; i < _parsers.size(); i++) + for (size_t i = 0, len = _parsers.size(); i < len; i++) { if (_parsers[i]->_id == id) { @@ -260,7 +260,7 @@ bool FunctionParsersManager::getFuncListFromXmlTree() FunctionParser * FunctionParsersManager::getParser(int langID) { - for (size_t i = 0; i < _associationMap.size(); i++) + for (size_t i = 0, len = _associationMap.size(); i < len; i++) { if (langID == _associationMap[i]._langID) return _parsers[_associationMap[i]._id]; @@ -273,7 +273,7 @@ FunctionParser * FunctionParsersManager::getParser(generic_string ext) if (ext == TEXT("")) return NULL; - for (size_t i = 0; i < _associationMap.size(); i++) + for (size_t i = 0, len = _associationMap.size(); i < len; i++) { if (ext == _associationMap[i]._ext) return _parsers[_associationMap[i]._id]; @@ -561,7 +561,7 @@ void FunctionParser::getCommentZones(vector< pair > & commentZone, siz bool FunctionParser::isInZones(int pos2Test, const std::vector< std::pair > & zones) { - for (size_t i = 0; i < zones.size(); i++) + for (size_t i = 0, len = zones.size(); i < len; i++) { if (pos2Test >= zones[i].first && pos2Test < zones[i].second) { @@ -586,7 +586,7 @@ void FunctionParser::getInvertZones(vector< pair > & destZones, vecto } size_t i = 0; - for (; i < sourceZones.size() - 1; i++) + for (size_t len = sourceZones.size() - 1; i < len; i++) { int newBegin = sourceZones[i].second + 1; int newEnd = sourceZones[i+1].first - 1; @@ -604,7 +604,7 @@ void FunctionZoneParser::parse(std::vector & foundInfos, size_t begin vector< pair > classZones, commentZones, nonCommentZones; getCommentZones(commentZones, begin, end, ppEditView); getInvertZones(nonCommentZones, commentZones, begin, end); - for (size_t i = 0; i < nonCommentZones.size(); i++) + for (size_t i = 0, len = nonCommentZones.size(); i < len; i++) { classParse(foundInfos, classZones, commentZones, nonCommentZones[i].first, nonCommentZones[i].second, ppEditView, classStructName); } @@ -615,7 +615,7 @@ void FunctionUnitParser::parse(std::vector & foundInfos, size_t begin vector< pair > commentZones, nonCommentZones; getCommentZones(commentZones, begin, end, ppEditView); getInvertZones(nonCommentZones, commentZones, begin, end); - for (size_t i = 0; i < nonCommentZones.size(); i++) + for (size_t i = 0, len = nonCommentZones.size(); i < len; i++) { funcParse(foundInfos, nonCommentZones[i].first, nonCommentZones[i].second, ppEditView, classStructName); } @@ -638,7 +638,7 @@ void FunctionMixParser::parse(std::vector & foundInfos, size_t begin, classParse(foundInfos, scannedZones, commentZones, begin, end, ppEditView, classStructName); // the second level - for (size_t i = 0; i < scannedZones.size(); i++) + for (size_t i = 0, len = scannedZones.size(); i < len; i++) { vector< pair > temp; classParse(foundInfos, temp, commentZones, scannedZones[i].first, scannedZones[i].second, ppEditView, classStructName); @@ -649,7 +649,7 @@ void FunctionMixParser::parse(std::vector & foundInfos, size_t begin, // for each nonScannedZones, search functions if (_funcUnitPaser) { - for (size_t i = 0; i < nonScannedZones.size(); i++) + for (size_t i = 0, len = nonScannedZones.size(); i < len; i++) { _funcUnitPaser->funcParse(foundInfos, nonScannedZones[i].first, nonScannedZones[i].second, ppEditView, classStructName); } diff --git a/PowerEditor/src/WinControls/Grid/BabyGrid.cpp b/PowerEditor/src/WinControls/Grid/BabyGrid.cpp index c3b19806..8f2dc38f 100644 --- a/PowerEditor/src/WinControls/Grid/BabyGrid.cpp +++ b/PowerEditor/src/WinControls/Grid/BabyGrid.cpp @@ -1279,18 +1279,20 @@ void SizeGrid(HWND hWnd,int SI) } int FindLongestLine(HDC hdc,TCHAR* text,SIZE* size) - {int longest,lines,j; +{ + int longest, lines; TCHAR temptext[1000]; TCHAR *p; longest=0; lines=1; - for(j=0;j<(int)lstrlen(text);j++) - { - if(text[j]=='\n') - { - lines++; - } - } + + for(size_t j=0, len=lstrlen(text); jgetLocalizationSwitcher(); - for (size_t i = 0 ; i < localizationSwitcher.size() ; i++) + for (size_t i = 0, len = localizationSwitcher.size(); i < len ; i++) { pair localizationInfo = localizationSwitcher.getElementFromIndex(i); ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_ADDSTRING, 0, (LPARAM)localizationInfo.first.c_str()); @@ -1364,7 +1364,7 @@ BOOL CALLBACK LangMenuDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara } } - for (size_t i = 0 ; i < nppGUI._excludedLangList.size() ; i++) + for (size_t i = 0, len = nppGUI._excludedLangList.size(); i < len ; i++) { ::SendDlgItemMessage(_hSelf, IDC_LIST_DISABLEDLANG, LB_ADDSTRING, 0, (LPARAM)nppGUI._excludedLangList[i]._langName.c_str()); } @@ -1715,7 +1715,7 @@ BOOL CALLBACK PrintSettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) ::SendDlgItemMessage(_hSelf, IDC_COMBO_FFONTSIZE, CB_ADDSTRING, 0, (LPARAM)intStr); } const std::vector & fontlist = pNppParam->getFontList(); - for (size_t i = 0 ; i < fontlist.size() ; i++) + for (size_t i = 0, len = fontlist.size() ; i < len ; i++) { int j = ::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTNAME, CB_ADDSTRING, 0, (LPARAM)fontlist[i].c_str()); ::SendDlgItemMessage(_hSelf, IDC_COMBO_FFONTNAME, CB_ADDSTRING, 0, (LPARAM)fontlist[i].c_str()); @@ -1751,7 +1751,7 @@ BOOL CALLBACK PrintSettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM) varList.push_back(strCouple(TEXT("Long date format"), TEXT("$(LONG_DATE)"))); varList.push_back(strCouple(TEXT("Time"), TEXT("$(TIME)"))); - for (size_t i = 0 ; i < varList.size() ; i++) + for (size_t i = 0, len = varList.size() ; i < len ; i++) { int j = ::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_ADDSTRING, 0, (LPARAM)varList[i]._varDesc.c_str()); ::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_SETITEMDATA, j, (LPARAM)varList[i]._var.c_str()); diff --git a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp index 08d9232f..8bc9ae62 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp +++ b/PowerEditor/src/WinControls/ProjectPanel/ProjectPanel.cpp @@ -1129,7 +1129,7 @@ void ProjectPanel::recursiveAddFilesFrom(const TCHAR *folderPath, HTREEITEM hTre } } while (::FindNextFile(hFile, &foundData)); - for (size_t i = 0 ; i < files.size() ; i++) + for (size_t i = 0, len = files.size() ; i < len ; i++) { generic_string pathFile(folderPath); if (folderPath[lstrlen(folderPath)-1] != '\\') diff --git a/PowerEditor/src/WinControls/ProjectPanel/TreeView.cpp b/PowerEditor/src/WinControls/ProjectPanel/TreeView.cpp index 48b404f9..4bf1cac8 100644 --- a/PowerEditor/src/WinControls/ProjectPanel/TreeView.cpp +++ b/PowerEditor/src/WinControls/ProjectPanel/TreeView.cpp @@ -463,7 +463,7 @@ bool TreeView::canDropIn(HTREEITEM targetItem) tvItem.hItem = targetItem; SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvItem); - for (size_t i = 0; i < _canNotDropInList.size(); i++) + for (size_t i = 0, len = _canNotDropInList.size(); i < len; i++) { if (tvItem.iImage == _canNotDropInList[i]) return false; @@ -479,7 +479,7 @@ bool TreeView::canDragOut(HTREEITEM targetItem) tvItem.hItem = targetItem; SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvItem); - for (size_t i = 0; i < _canNotDragOutList.size(); i++) + for (size_t i = 0, len = _canNotDragOutList.size(); i < len; i++) { if (tvItem.iImage == _canNotDragOutList[i]) return false; diff --git a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp index 7a935e4e..e00e01a8 100644 --- a/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp +++ b/PowerEditor/src/WinControls/StaticDialog/RunDlg/RunDlg.cpp @@ -26,9 +26,9 @@ void Command::extractArgs(TCHAR *cmd2Exec, TCHAR *args, const TCHAR *cmdEntier) { - int i = 0; + size_t i = 0; bool quoted = false; - for ( ; i < int(lstrlen(cmdEntier)) ; i++) + for (size_t len = lstrlen(cmdEntier); i < len ; i++) { if ((cmdEntier[i] == ' ') && (!quoted)) break; @@ -39,12 +39,12 @@ void Command::extractArgs(TCHAR *cmd2Exec, TCHAR *args, const TCHAR *cmdEntier) } cmd2Exec[i] = '\0'; - if (i < int(lstrlen(cmdEntier))) + if (i < size_t(lstrlen(cmdEntier))) { - for ( ; (i < int(lstrlen(cmdEntier))) && (cmdEntier[i] == ' ') ; i++); - if (i < int(lstrlen(cmdEntier))) + for (size_t len = size_t(lstrlen(cmdEntier)); (i < len) && (cmdEntier[i] == ' ') ; i++); + if (i < size_t(lstrlen(cmdEntier))) { - for (int k = 0 ; i <= int(lstrlen(cmdEntier)) ; i++, k++) + for (size_t k = 0, len2 = size_t(lstrlen(cmdEntier)); i <= len2; i++, k++) { args[k] = cmdEntier[i]; } @@ -91,14 +91,14 @@ int whichVar(TCHAR *str) void expandNppEnvironmentStrs(const TCHAR *strSrc, TCHAR *stringDest, size_t strDestLen, HWND hWnd) { size_t j = 0; - for (int i = 0 ; i < lstrlen(strSrc) ; i++) + for (size_t i = 0, len = size_t(lstrlen(strSrc)); i < len; i++) { int iBegin = -1; int iEnd = -1; if ((strSrc[i] == '$') && (strSrc[i+1] == '(')) { iBegin = i += 2; - for ( ; i < lstrlen(strSrc) ; i++) + for (size_t len2 = size_t(lstrlen(strSrc)); i < len2 ; i++) { if (strSrc[i] == ')') { @@ -137,7 +137,7 @@ void expandNppEnvironmentStrs(const TCHAR *strSrc, TCHAR *stringDest, size_t str else ::SendMessage(hWnd, RUNCOMMAND_USER + internalVar, CURRENTWORD_MAXLENGTH, (LPARAM)expandedStr); - for (int p = 0 ; p < lstrlen(expandedStr) ; p++) + for (size_t p = 0, len3 = size_t(lstrlen(expandedStr)); p < len3; p++) { if (j < (strDestLen-1)) stringDest[j++] = expandedStr[p]; diff --git a/PowerEditor/src/WinControls/TabBar/ControlsTab.cpp b/PowerEditor/src/WinControls/TabBar/ControlsTab.cpp index 4dcaba38..dfc4bc86 100644 --- a/PowerEditor/src/WinControls/TabBar/ControlsTab.cpp +++ b/PowerEditor/src/WinControls/TabBar/ControlsTab.cpp @@ -33,7 +33,7 @@ void ControlsTab::createTabs(WindowVector & winVector) { _pWinVector = &winVector; - for (int i = 0 ; i < int(winVector.size()) ; i++) + for (size_t i = 0, len = winVector.size(); i < len; i++) TabBar::insertAtEnd(winVector[i]._name.c_str()); TabBar::activateAt(0); @@ -78,7 +78,7 @@ bool ControlsTab::renameTab(const TCHAR *internalName, const TCHAR *newName) { bool foundIt = false; size_t i = 0; - for ( ; i < _pWinVector->size() ; i++) + for (size_t len = _pWinVector->size(); i < len; i++) { if ((*_pWinVector)[i]._internalName == internalName) { diff --git a/PowerEditor/src/WinControls/ToolBar/ToolBar.h b/PowerEditor/src/WinControls/ToolBar/ToolBar.h index b71f1a69..3f4fc303 100644 --- a/PowerEditor/src/WinControls/ToolBar/ToolBar.h +++ b/PowerEditor/src/WinControls/ToolBar/ToolBar.h @@ -129,7 +129,7 @@ public : bool changeIcons() { if (!_toolIcons) return false; - for (int i = 0 ; i < int(_customIconVect.size()) ; i++) + for (size_t i = 0, len = _customIconVect.size(); i < len; i++) changeIcons(_customIconVect[i].listIndex, _customIconVect[i].iconIndex, (_customIconVect[i].iconLocation).c_str()); return true; }; diff --git a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp index 63c4182f..dd7dd8db 100644 --- a/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp +++ b/PowerEditor/src/WinControls/VerticalFileSwitcher/VerticalFileSwitcherListView.cpp @@ -95,7 +95,7 @@ void VerticalFileSwitcherListView::initList() { TaskListInfo taskListInfo; ::SendMessage(::GetParent(_hParent), WM_GETTASKLISTINFO, (WPARAM)&taskListInfo, TRUE); - for (size_t i = 0 ; i < taskListInfo._tlfsLst.size() ; i++) + for (size_t i = 0, len = taskListInfo._tlfsLst.size(); i < len ; i++) { TaskLstFnStatus & fileNameStatus = taskListInfo._tlfsLst[i]; diff --git a/PowerEditor/src/WinControls/shortcut/RunMacroDlg.cpp b/PowerEditor/src/WinControls/shortcut/RunMacroDlg.cpp index 7fbb9ad9..92aca7ec 100644 --- a/PowerEditor/src/WinControls/shortcut/RunMacroDlg.cpp +++ b/PowerEditor/src/WinControls/shortcut/RunMacroDlg.cpp @@ -44,7 +44,7 @@ void RunMacroDlg::initMacroList() if (::SendMessage(_hParent, WM_GETCURRENTMACROSTATUS, 0, 0) == MACRO_RECORDING_HAS_STOPPED) ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("Current recorded macro")); - for (size_t i = 0 ; i < macroList.size() ; i++) + for (size_t i = 0, len = macroList.size(); i < len ; i++) ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_ADDSTRING, 0, (LPARAM)macroList[i].getName()); ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_SETCURSEL, 0, 0); diff --git a/PowerEditor/src/WinControls/shortcut/shortcut.cpp b/PowerEditor/src/WinControls/shortcut/shortcut.cpp index fd703f03..891d2b4f 100644 --- a/PowerEditor/src/WinControls/shortcut/shortcut.cpp +++ b/PowerEditor/src/WinControls/shortcut/shortcut.cpp @@ -309,7 +309,7 @@ void getNameStrFromCmd(DWORD cmd, generic_string & str) { vector & pluginCmds = (NppParameters::getInstance())->getPluginCommandList(); int i = 0; - for (size_t j = 0 ; j < pluginCmds.size() ; j++) + for (size_t j = 0, len = pluginCmds.size(); j < len ; j++) { if (pluginCmds[j].getID() == cmd) {