[ENHANCEMENT] Code optimization.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1073 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2013-07-08 00:12:50 +00:00
parent f80a49148e
commit 6264ef03d0
68 changed files with 576 additions and 557 deletions

View File

@ -91,7 +91,7 @@ bool isInListA(const char *token, const char *list) {
char word[64]; char word[64];
size_t i = 0; size_t i = 0;
size_t j = 0; size_t j = 0;
for (size_t len = strlen(list); i <= len; i++) for (size_t len = strlen(list); i <= len; ++i)
{ {
if ((list[i] == ' ')||(list[i] == '\0')) if ((list[i] == ' ')||(list[i] == '\0'))
{ {
@ -107,7 +107,7 @@ bool isInListA(const char *token, const char *list) {
else else
{ {
word[j] = list[i]; word[j] = list[i];
j++; ++j;
} }
} }
return false; return false;
@ -126,7 +126,7 @@ int EncodingMapper::getIndexFromEncoding(int encoding) const
bool found = false; bool found = false;
size_t nbItem = sizeof(encodings)/sizeof(EncodingUnit); size_t nbItem = sizeof(encodings)/sizeof(EncodingUnit);
size_t i = 0; size_t i = 0;
for ( ; i < nbItem ; i++) for ( ; i < nbItem ; ++i)
{ {
if (encodings[i]._codePage == encoding) if (encodings[i]._codePage == encoding)
{ {
@ -144,7 +144,7 @@ int EncodingMapper::getEncodingFromString(const char *encodingAlias) const
size_t nbItem = sizeof(encodings)/sizeof(EncodingUnit); size_t nbItem = sizeof(encodings)/sizeof(EncodingUnit);
int enc = -1; int enc = -1;
for (size_t i = 0 ; i < nbItem ; i++) for (size_t i = 0 ; i < nbItem ; ++i)
{ {
if (isInListA(encodingAlias, encodings[i]._aliasList)) if (isInListA(encodingAlias, encodings[i]._aliasList))
{ {

View File

@ -220,7 +220,7 @@ bool isInList(const TCHAR *token, const TCHAR *list) {
TCHAR word[64]; TCHAR word[64];
size_t i = 0; size_t i = 0;
size_t j = 0; size_t j = 0;
for (size_t len = lstrlen(list); i <= len; i++) for (size_t len = lstrlen(list); i <= len; ++i)
{ {
if ((list[i] == ' ')||(list[i] == '\0')) if ((list[i] == ' ')||(list[i] == '\0'))
{ {
@ -236,7 +236,7 @@ bool isInList(const TCHAR *token, const TCHAR *list) {
else else
{ {
word[j] = list[i]; word[j] = list[i];
j++; ++j;
} }
} }
return false; return false;
@ -248,7 +248,7 @@ generic_string purgeMenuItemString(const TCHAR * menuItemStr, bool keepAmpersand
TCHAR cleanedName[64] = TEXT(""); TCHAR cleanedName[64] = TEXT("");
size_t j = 0; size_t j = 0;
size_t menuNameLen = lstrlen(menuItemStr); size_t menuNameLen = lstrlen(menuItemStr);
for(size_t k = 0 ; k < menuNameLen ; k++) for(size_t k = 0 ; k < menuNameLen ; ++k)
{ {
if (menuItemStr[k] == '\t') if (menuItemStr[k] == '\t')
{ {

View File

@ -136,7 +136,7 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath, vector<generic_strin
#ifdef UNICODE #ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
#endif #endif
for (int x = 0; x < numLexers; x++) for (int x = 0; x < numLexers; ++x)
{ {
GetLexerName(x, lexName, MAX_EXTERNAL_LEXER_NAME_LEN); GetLexerName(x, lexName, MAX_EXTERNAL_LEXER_NAME_LEN);
GetLexerStatusText(x, lexDesc, MAX_EXTERNAL_LEXER_DESC_LEN); GetLexerStatusText(x, lexDesc, MAX_EXTERNAL_LEXER_DESC_LEN);
@ -182,7 +182,7 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath, vector<generic_strin
throw generic_string(generic_string(xmlPath) + TEXT(" failed to load.")); throw generic_string(generic_string(xmlPath) + TEXT(" failed to load."));
} }
for (int x = 0; x < numLexers; x++) // postpone adding in case the xml is missing/corrupt for (int x = 0; x < numLexers; ++x) // postpone adding in case the xml is missing/corrupt
if (containers[x] != NULL) if (containers[x] != NULL)
nppParams->addExternalLangToEnd(containers[x]); nppParams->addExternalLangToEnd(containers[x]);
@ -264,14 +264,14 @@ bool PluginsManager::loadPlugins(const TCHAR *dir)
::FindClose(hFindFile); ::FindClose(hFindFile);
for (size_t i = 0, len = dllNames.size(); i < len ; i++) for (size_t i = 0, len = dllNames.size(); i < len ; ++i)
{ {
loadPlugin(dllNames[i].c_str(), dll2Remove); loadPlugin(dllNames[i].c_str(), dll2Remove);
} }
} }
for (size_t j = 0, len = dll2Remove.size() ; j < len ; j++) for (size_t j = 0, len = dll2Remove.size() ; j < len ; ++j)
::DeleteFile(dll2Remove[j].c_str()); ::DeleteFile(dll2Remove[j].c_str());
return true; return true;
@ -286,7 +286,7 @@ bool PluginsManager::getShortcutByCmdID(int cmdID, ShortcutKey *sk)
const vector<PluginCmdShortcut> & pluginCmdSCList = (NppParameters::getInstance())->getPluginCommandList(); const vector<PluginCmdShortcut> & pluginCmdSCList = (NppParameters::getInstance())->getPluginCommandList();
for (size_t i = 0, len = pluginCmdSCList.size(); i < len ; i++) for (size_t i = 0, len = pluginCmdSCList.size(); i < len ; ++i)
{ {
if (pluginCmdSCList[i].getID() == (unsigned long)cmdID) if (pluginCmdSCList[i].getID() == (unsigned long)cmdID)
{ {
@ -311,7 +311,7 @@ void PluginsManager::addInMenuFromPMIndex(int i)
::InsertMenu(_hPluginsMenu, i, MF_BYPOSITION | MF_POPUP, (UINT_PTR)_pluginInfos[i]->_pluginMenu, _pluginInfos[i]->_pFuncGetName()); ::InsertMenu(_hPluginsMenu, i, MF_BYPOSITION | MF_POPUP, (UINT_PTR)_pluginInfos[i]->_pluginMenu, _pluginInfos[i]->_pFuncGetName());
unsigned short j = 0; unsigned short j = 0;
for ( ; j < _pluginInfos[i]->_nbFuncItem ; j++) for ( ; j < _pluginInfos[i]->_nbFuncItem ; ++j)
{ {
if (_pluginInfos[i]->_funcItems[j]._pFunc == NULL) if (_pluginInfos[i]->_funcItems[j]._pFunc == NULL)
{ {
@ -362,7 +362,7 @@ HMENU PluginsManager::setMenu(HMENU hMenu, const TCHAR *menuName)
::InsertMenu(hMenu, MENUINDEX_PLUGINS, MF_BYPOSITION | MF_POPUP, (UINT_PTR)_hPluginsMenu, nom_menu); ::InsertMenu(hMenu, MENUINDEX_PLUGINS, MF_BYPOSITION | MF_POPUP, (UINT_PTR)_hPluginsMenu, nom_menu);
} }
for (size_t i = 0, len = _pluginInfos.size() ; i < len ; i++) for (size_t i = 0, len = _pluginInfos.size() ; i < len ; ++i)
{ {
addInMenuFromPMIndex(i); addInMenuFromPMIndex(i);
} }
@ -394,7 +394,7 @@ void PluginsManager::runPluginCommand(size_t i)
void PluginsManager::runPluginCommand(const TCHAR *pluginName, int commandID) void PluginsManager::runPluginCommand(const TCHAR *pluginName, int commandID)
{ {
for (size_t i = 0, len = _pluginsCommands.size() ; i < len ; i++) for (size_t i = 0, len = _pluginsCommands.size() ; i < len ; ++i)
{ {
if (!generic_stricmp(_pluginsCommands[i]._pluginName.c_str(), pluginName)) if (!generic_stricmp(_pluginsCommands[i]._pluginName.c_str(), pluginName))
{ {
@ -416,7 +416,7 @@ void PluginsManager::runPluginCommand(const TCHAR *pluginName, int commandID)
void PluginsManager::notify(SCNotification *notification) void PluginsManager::notify(SCNotification *notification)
{ {
for (size_t i = 0, len = _pluginInfos.size() ; i < len ; i++) for (size_t i = 0, len = _pluginInfos.size() ; i < len ; ++i)
{ {
if (_pluginInfos[i]->_hLib) if (_pluginInfos[i]->_hLib)
{ {
@ -439,7 +439,7 @@ void PluginsManager::notify(SCNotification *notification)
void PluginsManager::relayNppMessages(UINT Message, WPARAM wParam, LPARAM lParam) void PluginsManager::relayNppMessages(UINT Message, WPARAM wParam, LPARAM lParam)
{ {
for (size_t i = 0, len = _pluginInfos.size(); i < len ; i++) for (size_t i = 0, len = _pluginInfos.size(); i < len ; ++i)
{ {
if (_pluginInfos[i]->_hLib) if (_pluginInfos[i]->_hLib)
{ {
@ -462,7 +462,7 @@ bool PluginsManager::relayPluginMessages(UINT Message, WPARAM wParam, LPARAM lPa
if (!moduleName || !moduleName[0] || !lParam) if (!moduleName || !moduleName[0] || !lParam)
return false; return false;
for (size_t i = 0, len = _pluginInfos.size() ; i < len ; i++) for (size_t i = 0, len = _pluginInfos.size() ; i < len ; ++i)
{ {
if (_pluginInfos[i]->_moduleName == moduleName) if (_pluginInfos[i]->_moduleName == moduleName)
{ {

View File

@ -87,7 +87,7 @@ public:
_markerAlloc(MARKER_PLUGINS, MARKER_PLUGINS_LIMIT) {}; _markerAlloc(MARKER_PLUGINS, MARKER_PLUGINS_LIMIT) {};
~PluginsManager() { ~PluginsManager() {
for (size_t i = 0, len = _pluginInfos.size(); i < len; i++) for (size_t i = 0, len = _pluginInfos.size(); i < len; ++i)
delete _pluginInfos[i]; delete _pluginInfos[i];
if (_hPluginsMenu) if (_hPluginsMenu)
@ -142,7 +142,7 @@ private:
::MessageBox(NULL, msg.c_str(), TEXT(" just crash in\r"), MB_OK|MB_ICONSTOP); ::MessageBox(NULL, msg.c_str(), TEXT(" just crash in\r"), MB_OK|MB_ICONSTOP);
}; };
bool isInLoadedDlls(const TCHAR *fn) const { bool isInLoadedDlls(const TCHAR *fn) const {
for (size_t i = 0; i < _loadedDlls.size(); i++) for (size_t i = 0; i < _loadedDlls.size(); ++i)
if (generic_stricmp(fn, _loadedDlls[i].c_str()) == 0) if (generic_stricmp(fn, _loadedDlls[i].c_str()) == 0)
return true; return true;
return false; return false;

View File

@ -130,7 +130,7 @@ BOOL CALLBACK RegExtDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
if (langIndex != LB_ERR) if (langIndex != LB_ERR)
{ {
for (int i = 1 ; i < nbExtMax ; i++) for (int i = 1 ; i < nbExtMax ; ++i)
{ {
if (!generic_stricmp(ext2Sup, defExtArray[langIndex][i])) if (!generic_stricmp(ext2Sup, defExtArray[langIndex][i]))
{ {
@ -193,7 +193,7 @@ BOOL CALLBACK RegExtDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
for (count -= 1 ; count >= 0 ; count--) for (count -= 1 ; count >= 0 ; count--)
::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANGEXT_LIST, LB_DELETESTRING, count, 0); ::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANGEXT_LIST, LB_DELETESTRING, count, 0);
for (int j = 1 ; j < nbExtMax ; j++) for (int j = 1 ; j < nbExtMax ; ++j)
if (lstrcmp(TEXT(""), defExtArray[i][j])) if (lstrcmp(TEXT(""), defExtArray[i][j]))
{ {
int index = ::SendDlgItemMessage(_hSelf, IDC_REGEXT_REGISTEREDEXTS_LIST, LB_FINDSTRINGEXACT, 0, (LPARAM)defExtArray[i][j]); int index = ::SendDlgItemMessage(_hSelf, IDC_REGEXT_REGISTEREDEXTS_LIST, LB_FINDSTRINGEXACT, 0, (LPARAM)defExtArray[i][j]);
@ -229,7 +229,7 @@ BOOL CALLBACK RegExtDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam)
void RegExtDlg::getRegisteredExts() void RegExtDlg::getRegisteredExts()
{ {
int nbRegisteredKey = getNbSubKey(HKEY_CLASSES_ROOT); int nbRegisteredKey = getNbSubKey(HKEY_CLASSES_ROOT);
for (int i = 0 ; i < nbRegisteredKey ; i++) for (int i = 0 ; i < nbRegisteredKey ; ++i)
{ {
TCHAR extName[extNameLen]; TCHAR extName[extNameLen];
//FILETIME fileTime; //FILETIME fileTime;
@ -255,7 +255,7 @@ void RegExtDlg::getRegisteredExts()
void RegExtDlg::getDefSupportedExts() void RegExtDlg::getDefSupportedExts()
{ {
for (int i = 0 ; i < nbSupportedLang ; i++) for (int i = 0 ; i < nbSupportedLang ; ++i)
::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANG_LIST, LB_ADDSTRING, 0, (LPARAM)defExtArray[i][0]); ::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANG_LIST, LB_ADDSTRING, 0, (LPARAM)defExtArray[i][0]);
} }

View File

@ -396,7 +396,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
if (nbMacro >= 1) if (nbMacro >= 1)
::InsertMenu(hMacroMenu, posBase - 1, MF_BYPOSITION, (unsigned int)-1, 0); ::InsertMenu(hMacroMenu, posBase - 1, MF_BYPOSITION, (unsigned int)-1, 0);
for (size_t i = 0 ; i < nbMacro ; i++) for (size_t i = 0 ; i < nbMacro ; ++i)
{ {
::InsertMenu(hMacroMenu, posBase + i, MF_BYPOSITION, ID_MACRO + i, macros[i].toMenuItemString().c_str()); ::InsertMenu(hMacroMenu, posBase + i, MF_BYPOSITION, ID_MACRO + i, macros[i].toMenuItemString().c_str());
} }
@ -413,7 +413,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
size_t nbUserCommand = userCommands.size(); size_t nbUserCommand = userCommands.size();
if (nbUserCommand >= 1) if (nbUserCommand >= 1)
::InsertMenu(hRunMenu, runPosBase - 1, MF_BYPOSITION, (unsigned int)-1, 0); ::InsertMenu(hRunMenu, runPosBase - 1, MF_BYPOSITION, (unsigned int)-1, 0);
for (size_t i = 0 ; i < nbUserCommand ; i++) for (size_t i = 0 ; i < nbUserCommand ; ++i)
{ {
::InsertMenu(hRunMenu, runPosBase + i, MF_BYPOSITION, ID_USER_CMD + i, userCommands[i].toMenuItemString().c_str()); ::InsertMenu(hRunMenu, runPosBase + i, MF_BYPOSITION, ID_USER_CMD + i, userCommands[i].toMenuItemString().c_str());
} }
@ -440,7 +440,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
HMENU hLangMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_LANGUAGE); HMENU hLangMenu = ::GetSubMenu(_mainMenuHandle, MENUINDEX_LANGUAGE);
// Add external languages to menu // Add external languages to menu
for (int i = 0 ; i < pNppParam->getNbExternalLang() ; i++) for (int i = 0 ; i < pNppParam->getNbExternalLang() ; ++i)
{ {
ExternalLangContainer & externalLangContainer = pNppParam->getELCFromIndex(i); ExternalLangContainer & externalLangContainer = pNppParam->getELCFromIndex(i);
@ -449,7 +449,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
TCHAR buffer[bufferSize]; TCHAR buffer[bufferSize];
int x; int x;
for(x = 0; (x == 0 || lstrcmp(externalLangContainer._name, buffer) > 0) && x < numLangs; x++) for(x = 0; (x == 0 || lstrcmp(externalLangContainer._name, buffer) > 0) && x < numLangs; ++x)
{ {
::GetMenuString(hLangMenu, x, buffer, bufferSize, MF_BYPOSITION); ::GetMenuString(hLangMenu, x, buffer, bufferSize, MF_BYPOSITION);
} }
@ -459,7 +459,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
if (nppGUI._excludedLangList.size() > 0) if (nppGUI._excludedLangList.size() > 0)
{ {
for (size_t i = 0, len = nppGUI._excludedLangList.size(); i < len ; i++) for (size_t i = 0, len = nppGUI._excludedLangList.size(); i < len ; ++i)
{ {
int cmdID = pNppParam->langTypeToCommandID(nppGUI._excludedLangList[i]._langType); int cmdID = pNppParam->langTypeToCommandID(nppGUI._excludedLangList[i]._langType);
const int itemSize = 256; const int itemSize = 256;
@ -475,7 +475,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
// Add User Define Languages Entry // Add User Define Languages Entry
int udlpos = ::GetMenuItemCount(hLangMenu) - 1; int udlpos = ::GetMenuItemCount(hLangMenu) - 1;
for (int i = 0, len = pNppParam->getNbUserLang(); i < len ; i++) for (int i = 0, len = pNppParam->getNbUserLang(); i < len ; ++i)
{ {
UserLangContainer & userLangContainer = pNppParam->getULCFromIndex(i); UserLangContainer & userLangContainer = pNppParam->getULCFromIndex(i);
::InsertMenu(hLangMenu, udlpos + i, MF_BYPOSITION, IDM_LANG_USER + i + 1, userLangContainer.getName()); ::InsertMenu(hLangMenu, udlpos + i, MF_BYPOSITION, IDM_LANG_USER + i + 1, userLangContainer.getName());
@ -488,7 +488,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
_lastRecentFileList.initMenu(hFileMenu, IDM_FILEMENU_LASTONE + 1, pos, pNppParam->putRecentFileInSubMenu()); _lastRecentFileList.initMenu(hFileMenu, IDM_FILEMENU_LASTONE + 1, pos, pNppParam->putRecentFileInSubMenu());
_lastRecentFileList.setLangEncoding(_nativeLangSpeaker.getLangEncoding()); _lastRecentFileList.setLangEncoding(_nativeLangSpeaker.getLangEncoding());
for (int i = 0 ; i < nbLRFile ; i++) for (int i = 0 ; i < nbLRFile ; ++i)
{ {
generic_string * stdStr = pNppParam->getLRFile(i); generic_string * stdStr = pNppParam->getLRFile(i);
if (!nppGUI._checkHistoryFiles || PathFileExists(stdStr->c_str())) if (!nppGUI._checkHistoryFiles || PathFileExists(stdStr->c_str()))
@ -525,7 +525,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
vector<MenuItemUnit> & tmp = pNppParam->getContextMenuItems(); vector<MenuItemUnit> & tmp = pNppParam->getContextMenuItems();
size_t len = tmp.size(); size_t len = tmp.size();
TCHAR menuName[64]; TCHAR menuName[64];
for (size_t i = 0 ; i < len ; i++) for (size_t i = 0 ; i < len ; ++i)
{ {
if (tmp[i]._itemName == TEXT("")) if (tmp[i]._itemName == TEXT(""))
{ {
@ -539,7 +539,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
vector<CommandShortcut> & shortcuts = pNppParam->getUserShortcuts(); vector<CommandShortcut> & shortcuts = pNppParam->getUserShortcuts();
len = shortcuts.size(); len = shortcuts.size();
for(size_t i = 0; i < len; i++) for(size_t i = 0; i < len; ++i)
{ {
CommandShortcut & csc = shortcuts[i]; CommandShortcut & csc = shortcuts[i];
if (!csc.getName()[0]) if (!csc.getName()[0])
@ -639,7 +639,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
_dockingManager.setDockedContSize(CONT_TOP , nppGUI._dockingData._topHeight); _dockingManager.setDockedContSize(CONT_TOP , nppGUI._dockingData._topHeight);
_dockingManager.setDockedContSize(CONT_BOTTOM, nppGUI._dockingData._bottomHight); _dockingManager.setDockedContSize(CONT_BOTTOM, nppGUI._dockingData._bottomHight);
for (size_t i = 0, len = dmd._pluginDockInfo.size(); i < len ; i++) for (size_t i = 0, len = dmd._pluginDockInfo.size(); i < len ; ++i)
{ {
PluginDlgDockingInfo & pdi = dmd._pluginDockInfo[i]; PluginDlgDockingInfo & pdi = dmd._pluginDockInfo[i];
if (pdi._isVisible) if (pdi._isVisible)
@ -655,7 +655,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
} }
} }
for (size_t i = 0, len = dmd._containerTabInfo.size(); i < len; i++) for (size_t i = 0, len = dmd._containerTabInfo.size(); i < len; ++i)
{ {
ContainerTabInfo & cti = dmd._containerTabInfo[i]; ContainerTabInfo & cti = dmd._containerTabInfo[i];
_dockingManager.setActiveTab(cti._cont, cti._activeTab); _dockingManager.setActiveTab(cti._cont, cti._activeTab);
@ -776,12 +776,12 @@ void Notepad_plus::saveDockingParams()
// save every container // save every container
vector<DockingCont*> vCont = _dockingManager.getContainerInfo(); vector<DockingCont*> vCont = _dockingManager.getContainerInfo();
for (size_t i = 0, len = vCont.size(); i < len ; i++) for (size_t i = 0, len = vCont.size(); i < len ; ++i)
{ {
// save at first the visible Tb's // save at first the visible Tb's
vector<tTbData *> vDataVis = vCont[i]->getDataOfVisTb(); vector<tTbData *> vDataVis = vCont[i]->getDataOfVisTb();
for (size_t j = 0, len2 = vDataVis.size(); j < len2 ; j++) for (size_t j = 0, len2 = vDataVis.size(); j < len2 ; ++j)
{ {
if (vDataVis[j]->pszName && vDataVis[j]->pszName[0]) if (vDataVis[j]->pszName && vDataVis[j]->pszName[0])
{ {
@ -793,7 +793,7 @@ void Notepad_plus::saveDockingParams()
// save the hidden Tb's // save the hidden Tb's
vector<tTbData *> vDataAll = vCont[i]->getDataOfAllTb(); vector<tTbData *> vDataAll = vCont[i]->getDataOfAllTb();
for (size_t j = 0, len3 = vDataAll.size(); j < len3 ; 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]))) if ((vDataAll[j]->pszName && vDataAll[j]->pszName[0]) && (!vCont[i]->isTbVis(vDataAll[j])))
{ {
@ -820,10 +820,10 @@ void Notepad_plus::saveDockingParams()
UCHAR floatContArray[50]; UCHAR floatContArray[50];
memset(floatContArray, 0, 50); memset(floatContArray, 0, 50);
for (size_t i = 0, len4 = nppGUI._dockingData._pluginDockInfo.size(); i < len4 ; i++) for (size_t i = 0, len4 = nppGUI._dockingData._pluginDockInfo.size(); i < len4 ; ++i)
{ {
BOOL isStored = FALSE; BOOL isStored = FALSE;
for (size_t j = 0, len5 = vPluginDockInfo.size(); j < len5; j++) for (size_t j = 0, len5 = vPluginDockInfo.size(); j < len5; ++j)
{ {
if (nppGUI._dockingData._pluginDockInfo[i] == vPluginDockInfo[j]) if (nppGUI._dockingData._pluginDockInfo[i] == vPluginDockInfo[j])
{ {
@ -983,7 +983,7 @@ bool Notepad_plus::replaceInOpenedFiles() {
if (_mainWindowStatus & WindowMainActive) if (_mainWindowStatus & WindowMainActive)
{ {
for (int i = 0, len = _mainDocTab.nbItem(); i < len ; i++) for (int i = 0, len = _mainDocTab.nbItem(); i < len ; ++i)
{ {
pBuf = MainFileManager->getBufferByID(_mainDocTab.getBufferByIndex(i)); pBuf = MainFileManager->getBufferByID(_mainDocTab.getBufferByIndex(i));
if (pBuf->isReadOnly()) if (pBuf->isReadOnly())
@ -1000,7 +1000,7 @@ bool Notepad_plus::replaceInOpenedFiles() {
if (_mainWindowStatus & WindowSubActive) if (_mainWindowStatus & WindowSubActive)
{ {
for (int i = 0, len = _subDocTab.nbItem(); i < len; i++) for (int i = 0, len = _subDocTab.nbItem(); i < len; ++i)
{ {
pBuf = MainFileManager->getBufferByID(_subDocTab.getBufferByIndex(i)); pBuf = MainFileManager->getBufferByID(_subDocTab.getBufferByIndex(i));
if (pBuf->isReadOnly()) if (pBuf->isReadOnly())
@ -1035,7 +1035,7 @@ bool Notepad_plus::replaceInOpenedFiles() {
bool Notepad_plus::matchInList(const TCHAR *fileName, const vector<generic_string> & patterns) bool Notepad_plus::matchInList(const TCHAR *fileName, const vector<generic_string> & patterns)
{ {
for (size_t i = 0, len = patterns.size() ; i < len ; i++) for (size_t i = 0, len = patterns.size() ; i < len ; ++i)
{ {
if (PathMatchSpec(fileName, patterns[i].c_str())) if (PathMatchSpec(fileName, patterns[i].c_str()))
return true; return true;
@ -1418,7 +1418,7 @@ bool Notepad_plus::replaceInFiles()
CancelThreadHandle = ::CreateThread(NULL, 0, AsyncCancelFindInFiles, _pPublicInterface->getHSelf(), 0, NULL); CancelThreadHandle = ::CreateThread(NULL, 0, AsyncCancelFindInFiles, _pPublicInterface->getHSelf(), 0, NULL);
bool dontClose = false; bool dontClose = false;
for (size_t i = 0, len = fileNames.size(); i < len ; i++) for (size_t i = 0, len = fileNames.size(); i < len ; ++i)
{ {
MSG msg; MSG msg;
if (PeekMessage(&msg, _pPublicInterface->getHSelf(), NPPM_INTERNAL_CANCEL_FIND_IN_FILES, NPPM_INTERNAL_CANCEL_FIND_IN_FILES, PM_REMOVE)) break; if (PeekMessage(&msg, _pPublicInterface->getHSelf(), NPPM_INTERNAL_CANCEL_FIND_IN_FILES, NPPM_INTERNAL_CANCEL_FIND_IN_FILES, PM_REMOVE)) break;
@ -1501,7 +1501,7 @@ bool Notepad_plus::findInFiles()
_findReplaceDlg.beginNewFilesSearch(); _findReplaceDlg.beginNewFilesSearch();
bool dontClose = false; bool dontClose = false;
for (size_t i = 0, len = fileNames.size(); i < len; i++) for (size_t i = 0, len = fileNames.size(); i < len; ++i)
{ {
MSG msg; MSG msg;
if (PeekMessage(&msg, _pPublicInterface->getHSelf(), NPPM_INTERNAL_CANCEL_FIND_IN_FILES, NPPM_INTERNAL_CANCEL_FIND_IN_FILES, PM_REMOVE)) break; if (PeekMessage(&msg, _pPublicInterface->getHSelf(), NPPM_INTERNAL_CANCEL_FIND_IN_FILES, NPPM_INTERNAL_CANCEL_FIND_IN_FILES, PM_REMOVE)) break;
@ -1562,7 +1562,7 @@ bool Notepad_plus::findInOpenedFiles()
if (_mainWindowStatus & WindowMainActive) if (_mainWindowStatus & WindowMainActive)
{ {
for (int i = 0, len = _mainDocTab.nbItem(); i < len ; i++) for (int i = 0, len = _mainDocTab.nbItem(); i < len ; ++i)
{ {
pBuf = MainFileManager->getBufferByID(_mainDocTab.getBufferByIndex(i)); pBuf = MainFileManager->getBufferByID(_mainDocTab.getBufferByIndex(i));
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument());
@ -1574,7 +1574,7 @@ bool Notepad_plus::findInOpenedFiles()
if (_mainWindowStatus & WindowSubActive) if (_mainWindowStatus & WindowSubActive)
{ {
for (int i = 0, len2 = _subDocTab.nbItem(); i < len2 ; i++) for (int i = 0, len2 = _subDocTab.nbItem(); i < len2 ; ++i)
{ {
pBuf = MainFileManager->getBufferByID(_subDocTab.getBufferByIndex(i)); pBuf = MainFileManager->getBufferByID(_subDocTab.getBufferByIndex(i));
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument());
@ -1718,7 +1718,7 @@ void Notepad_plus::checkDocState()
bool isFileExisting = PathFileExists(curBuf->getFullPathName()) != FALSE; bool isFileExisting = PathFileExists(curBuf->getFullPathName()) != FALSE;
if (!isCurrentDirty) if (!isCurrentDirty)
{ {
for(int i = 0; i < MainFileManager->getNrBuffers(); i++) for(int i = 0; i < MainFileManager->getNrBuffers(); ++i)
{ {
if (MainFileManager->getBufferByIndex(i)->isDirty()) if (MainFileManager->getBufferByIndex(i)->isDirty())
{ {
@ -1805,7 +1805,7 @@ void Notepad_plus::checkLangsMenu(int id) const
const int nbChar = 16; const int nbChar = 16;
TCHAR menuLangName[nbChar]; TCHAR menuLangName[nbChar];
for (int i = IDM_LANG_USER + 1 ; i <= IDM_LANG_USER_LIMIT ; i++) for (int i = IDM_LANG_USER + 1 ; i <= IDM_LANG_USER_LIMIT ; ++i)
{ {
if (::GetMenuString(_mainMenuHandle, i, menuLangName, nbChar-1, MF_BYCOMMAND)) if (::GetMenuString(_mainMenuHandle, i, menuLangName, nbChar-1, MF_BYCOMMAND))
if (!lstrcmp(userLangName, menuLangName)) if (!lstrcmp(userLangName, menuLangName))
@ -1948,7 +1948,7 @@ void Notepad_plus::deleteMarkedline(int ln)
void Notepad_plus::inverseMarks() void Notepad_plus::inverseMarks()
{ {
int lastLine = _pEditView->lastZeroBasedLineNumber(); int lastLine = _pEditView->lastZeroBasedLineNumber();
for (int i = 0 ; i <= lastLine ; i++) for (int i = 0 ; i <= lastLine ; ++i)
{ {
if (bookmarkPresent(i)) if (bookmarkPresent(i))
{ {
@ -2156,7 +2156,7 @@ void Notepad_plus::addHotSpot()
// Search the style // Search the style
int fs = -1; int fs = -1;
for (size_t i = 0, len = hotspotPairs.size(); i < len ; 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 // make sure to ignore "hotspot bit" when comparing document style with archived hotspot style
if ((hotspotPairs[i] & ~mask) == (idStyle & ~mask)) if ((hotspotPairs[i] & ~mask) == (idStyle & ~mask))
@ -2579,22 +2579,22 @@ size_t Notepad_plus::getSelectedCharNumber(UniMode u)
int numSel = _pEditView->execute(SCI_GETSELECTIONS); int numSel = _pEditView->execute(SCI_GETSELECTIONS);
if (u == uniUTF8 || u == uniCookie) if (u == uniUTF8 || u == uniCookie)
{ {
for (int i=0; i < numSel; i++) for (int i=0; i < numSel; ++i)
{ {
size_t line1 = _pEditView->execute(SCI_LINEFROMPOSITION, _pEditView->execute(SCI_GETSELECTIONNSTART, i)); size_t line1 = _pEditView->execute(SCI_LINEFROMPOSITION, _pEditView->execute(SCI_GETSELECTIONNSTART, i));
size_t line2 = _pEditView->execute(SCI_LINEFROMPOSITION, _pEditView->execute(SCI_GETSELECTIONNEND, i)); size_t line2 = _pEditView->execute(SCI_LINEFROMPOSITION, _pEditView->execute(SCI_GETSELECTIONNEND, i));
for (size_t j = line1; j <= line2; j++) for (size_t j = line1; j <= line2; ++j)
{ {
size_t stpos = _pEditView->execute(SCI_GETLINESELSTARTPOSITION, j); size_t stpos = _pEditView->execute(SCI_GETLINESELSTARTPOSITION, j);
if (stpos != INVALID_POSITION) if (stpos != INVALID_POSITION)
{ {
size_t endpos = _pEditView->execute(SCI_GETLINESELENDPOSITION, j); size_t endpos = _pEditView->execute(SCI_GETLINESELENDPOSITION, j);
for (size_t pos = stpos; pos < endpos; pos++) for (size_t pos = stpos; pos < endpos; ++pos)
{ {
unsigned char c = 0xf0 & (unsigned char)_pEditView->execute(SCI_GETCHARAT, pos); unsigned char c = 0xf0 & (unsigned char)_pEditView->execute(SCI_GETCHARAT, pos);
if (c >= 0xc0) if (c >= 0xc0)
pos += utflen[(c & 0x30) >> 4]; pos += utflen[(c & 0x30) >> 4];
result++; ++result;
} }
} }
} }
@ -2602,7 +2602,7 @@ size_t Notepad_plus::getSelectedCharNumber(UniMode u)
} }
else else
{ {
for (int i=0; i < numSel; i++) for (int i=0; i < numSel; ++i)
{ {
size_t stpos = _pEditView->execute(SCI_GETSELECTIONNSTART, i); size_t stpos = _pEditView->execute(SCI_GETSELECTIONNSTART, i);
size_t endpos = _pEditView->execute(SCI_GETSELECTIONNEND, i); size_t endpos = _pEditView->execute(SCI_GETSELECTIONNEND, i);
@ -2631,7 +2631,7 @@ static inline size_t countUtf8Characters(unsigned char *buf, int pos, int endpos
if ((c&0xc0) == 0x80 // do not count unexpected continuation bytes (this handles the case where an UTF-8 character is split in the middle) if ((c&0xc0) == 0x80 // do not count unexpected continuation bytes (this handles the case where an UTF-8 character is split in the middle)
|| c == '\n' || c == '\r') continue; // do not count end of lines || c == '\n' || c == '\r') continue; // do not count end of lines
if (c >= 0xc0) pos += utflen[(c & 0x30) >> 4]; if (c >= 0xc0) pos += utflen[(c & 0x30) >> 4];
result++; ++result;
} }
return result; return result;
} }
@ -2713,7 +2713,7 @@ size_t Notepad_plus::getSelectedBytes()
{ {
int numSel = _pEditView->execute(SCI_GETSELECTIONS); int numSel = _pEditView->execute(SCI_GETSELECTIONS);
size_t result = 0; size_t result = 0;
for (int i = 0; i < numSel; i++) for (int i = 0; i < numSel; ++i)
result += (_pEditView->execute(SCI_GETSELECTIONNEND, i) - _pEditView->execute(SCI_GETSELECTIONNSTART, i)); result += (_pEditView->execute(SCI_GETSELECTIONNEND, i) - _pEditView->execute(SCI_GETSELECTIONNSTART, i));
return result; return result;
} }
@ -3369,7 +3369,7 @@ static generic_string extractSymbol(TCHAR firstChar, TCHAR secondChar, const TCH
bool found = false; bool found = false;
TCHAR extracted[128] = TEXT(""); TCHAR extracted[128] = TEXT("");
for (size_t i = 0, j = 0, len = lstrlen(str2extract) ; i < len ; i++) for (size_t i = 0, j = 0, len = lstrlen(str2extract) ; i < len ; ++i)
{ {
if (found) if (found)
{ {
@ -3473,7 +3473,7 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode)
int nUncomments = 0; int nUncomments = 0;
_pEditView->execute(SCI_BEGINUNDOACTION); _pEditView->execute(SCI_BEGINUNDOACTION);
for (int i = selStartLine; i <= selEndLine; i++) for (int i = selStartLine; i <= selEndLine; ++i)
{ {
int lineStart = _pEditView->execute(SCI_POSITIONFROMLINE, i); int lineStart = _pEditView->execute(SCI_POSITIONFROMLINE, i);
int lineIndent = lineStart; int lineIndent = lineStart;
@ -3507,7 +3507,7 @@ bool Notepad_plus::doBlockComment(comment_mode currCommentMode)
if (i == selStartLine) // is this the first selected line? if (i == selStartLine) // is this the first selected line?
selectionStart -= len; selectionStart -= len;
selectionEnd -= len; // every iteration selectionEnd -= len; // every iteration
nUncomments++; ++nUncomments;
continue; continue;
} }
} }
@ -3725,14 +3725,14 @@ void Notepad_plus::getTaskListInfo(TaskListInfo *tli)
if (!viewVisible(otherView())) if (!viewVisible(otherView()))
nonCurrentNbDoc = 0; nonCurrentNbDoc = 0;
for (size_t i = 0 ; i < currentNbDoc ; i++) for (size_t i = 0 ; i < currentNbDoc ; ++i)
{ {
BufferID bufID = _pDocTab->getBufferByIndex(i); BufferID bufID = _pDocTab->getBufferByIndex(i);
Buffer * b = MainFileManager->getBufferByID(bufID); Buffer * b = MainFileManager->getBufferByID(bufID);
int status = b->isReadOnly()?tb_ro:(b->isDirty()?tb_unsaved:tb_saved); int status = b->isReadOnly()?tb_ro:(b->isDirty()?tb_unsaved:tb_saved);
tli->_tlfsLst.push_back(TaskLstFnStatus(currentView(), i, b->getFullPathName(), status, (void *)bufID)); tli->_tlfsLst.push_back(TaskLstFnStatus(currentView(), i, b->getFullPathName(), status, (void *)bufID));
} }
for (size_t i = 0 ; i < nonCurrentNbDoc ; i++) for (size_t i = 0 ; i < nonCurrentNbDoc ; ++i)
{ {
BufferID bufID = _pNonDocTab->getBufferByIndex(i); BufferID bufID = _pNonDocTab->getBufferByIndex(i);
Buffer * b = MainFileManager->getBufferByID(bufID); Buffer * b = MainFileManager->getBufferByID(bufID);
@ -4173,7 +4173,7 @@ bool Notepad_plus::getIntegralDockingData(tTbData & dockData, int & iCont, bool
{ {
DockingManagerData & dockingData = (DockingManagerData &)(NppParameters::getInstance())->getNppGUI()._dockingData; DockingManagerData & dockingData = (DockingManagerData &)(NppParameters::getInstance())->getNppGUI()._dockingData;
for (size_t i = 0, len = dockingData._pluginDockInfo.size(); i < len ; i++) for (size_t i = 0, len = dockingData._pluginDockInfo.size(); i < len ; ++i)
{ {
const PluginDlgDockingInfo & pddi = dockingData._pluginDockInfo[i]; const PluginDlgDockingInfo & pddi = dockingData._pluginDockInfo[i];
@ -4209,7 +4209,7 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session)
//Buffer * mainBuf = _mainEditView.getCurrentBuffer(); //Buffer * mainBuf = _mainEditView.getCurrentBuffer();
//Buffer * subBuf = _subEditView.getCurrentBuffer(); //Buffer * subBuf = _subEditView.getCurrentBuffer();
Document oldDoc = _invisibleEditView.execute(SCI_GETDOCPOINTER); Document oldDoc = _invisibleEditView.execute(SCI_GETDOCPOINTER);
for (int i = 0, len = _mainDocTab.nbItem(); i < len ; i++) for (int i = 0, len = _mainDocTab.nbItem(); i < len ; ++i)
{ {
BufferID bufID = _mainDocTab.getBufferByIndex(i); BufferID bufID = _mainDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(bufID); Buffer * buf = MainFileManager->getBufferByID(bufID);
@ -4237,7 +4237,7 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session)
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument()); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument());
int maxLine = _invisibleEditView.execute(SCI_GETLINECOUNT); int maxLine = _invisibleEditView.execute(SCI_GETLINECOUNT);
for (int j = 0 ; j < maxLine ; j++) for (int j = 0 ; j < maxLine ; ++j)
{ {
if ((_invisibleEditView.execute(SCI_MARKERGET, j)&(1 << MARK_BOOKMARK)) != 0) if ((_invisibleEditView.execute(SCI_MARKERGET, j)&(1 << MARK_BOOKMARK)) != 0)
{ {
@ -4266,7 +4266,7 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session)
} }
} }
for (int i = 0, len = _subDocTab.nbItem(); i < len ; i++) for (int i = 0, len = _subDocTab.nbItem(); i < len ; ++i)
{ {
BufferID bufID = _subDocTab.getBufferByIndex(i); BufferID bufID = _subDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(bufID); Buffer * buf = MainFileManager->getBufferByID(bufID);
@ -4279,7 +4279,7 @@ void Notepad_plus::getCurrentOpenedFiles(Session & session)
_invisibleEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument()); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument());
int maxLine = _invisibleEditView.execute(SCI_GETLINECOUNT); int maxLine = _invisibleEditView.execute(SCI_GETLINECOUNT);
for (int j = 0 ; j < maxLine ; j++) for (int j = 0 ; j < maxLine ; ++j)
{ {
if ((_invisibleEditView.execute(SCI_MARKERGET, j)&(1 << MARK_BOOKMARK)) != 0) if ((_invisibleEditView.execute(SCI_MARKERGET, j)&(1 << MARK_BOOKMARK)) != 0)
{ {
@ -4352,7 +4352,7 @@ bool Notepad_plus::dumpFiles(const TCHAR * outdir, const TCHAR * fileprefix) {
TCHAR savePath[MAX_PATH] = {0}; TCHAR savePath[MAX_PATH] = {0};
//rescue primary //rescue primary
for(int i = 0; i < MainFileManager->getNrBuffers(); i++) { for(int i = 0; i < MainFileManager->getNrBuffers(); ++i) {
Buffer * docbuf = MainFileManager->getBufferByIndex(i); Buffer * docbuf = MainFileManager->getBufferByIndex(i);
if (!docbuf->isDirty()) //skip saved documents if (!docbuf->isDirty()) //skip saved documents
continue; continue;
@ -4625,7 +4625,7 @@ void Notepad_plus::loadCommandlineParams(const TCHAR * commandLine, CmdLineParam
bool readOnly = pCmdParams->_isReadOnly; bool readOnly = pCmdParams->_isReadOnly;
BufferID lastOpened = BUFFER_INVALID; BufferID lastOpened = BUFFER_INVALID;
for (int i = 0, len = fnss.size(); i < len ; i++) for (int i = 0, len = fnss.size(); i < len ; ++i)
{ {
pFn = fnss.getFileName(i); pFn = fnss.getFileName(i);
BufferID bufID = doOpen(pFn, readOnly); BufferID bufID = doOpen(pFn, readOnly);
@ -4698,7 +4698,7 @@ void Notepad_plus::setFindReplaceFolderFilter(const TCHAR *dir, const TCHAR *fil
fltr = TEXT(""); fltr = TEXT("");
vector<generic_string> vStr; vector<generic_string> vStr;
cutString(ext, vStr); cutString(ext, vStr);
for (size_t i = 0 ,len = vStr.size(); i < len; i++) for (size_t i = 0 ,len = vStr.size(); i < len; ++i)
{ {
fltr += TEXT("*."); fltr += TEXT("*.");
fltr += vStr[i] + TEXT(" "); fltr += vStr[i] + TEXT(" ");
@ -4734,7 +4734,7 @@ vector<generic_string> Notepad_plus::addNppComponents(const TCHAR *destDir, cons
destDirName += TEXT("\\"); destDirName += TEXT("\\");
size_t sz = pfns->size(); size_t sz = pfns->size();
for (size_t i = 0 ; i < sz ; i++) for (size_t i = 0 ; i < sz ; ++i)
{ {
if (::PathFileExists(pfns->at(i).c_str())) if (::PathFileExists(pfns->at(i).c_str()))
{ {
@ -4770,7 +4770,7 @@ int Notepad_plus::getLangFromMenuName(const TCHAR * langName)
const int menuSize = 64; const int menuSize = 64;
TCHAR menuLangName[menuSize]; TCHAR menuLangName[menuSize];
for ( int i = IDM_LANG_C; i <= IDM_LANG_USER; i++ ) for ( int i = IDM_LANG_C; i <= IDM_LANG_USER; ++i )
if ( ::GetMenuString( _mainMenuHandle, i, menuLangName, menuSize, MF_BYCOMMAND ) ) if ( ::GetMenuString( _mainMenuHandle, i, menuLangName, menuSize, MF_BYCOMMAND ) )
if ( !lstrcmp( langName, menuLangName ) ) if ( !lstrcmp( langName, menuLangName ) )
{ {
@ -4780,7 +4780,7 @@ int Notepad_plus::getLangFromMenuName(const TCHAR * langName)
if ( id == 0 ) if ( id == 0 )
{ {
for ( int i = IDM_LANG_USER + 1; i <= IDM_LANG_USER_LIMIT; i++ ) for ( int i = IDM_LANG_USER + 1; i <= IDM_LANG_USER_LIMIT; ++i )
if ( ::GetMenuString( _mainMenuHandle, i, menuLangName, menuSize, MF_BYCOMMAND ) ) if ( ::GetMenuString( _mainMenuHandle, i, menuLangName, menuSize, MF_BYCOMMAND ) )
if ( !lstrcmp( langName, menuLangName ) ) if ( !lstrcmp( langName, menuLangName ) )
{ {
@ -4881,7 +4881,7 @@ bool Notepad_plus::reloadLang()
vector<MenuItemUnit> & tmp = pNppParam->getContextMenuItems(); vector<MenuItemUnit> & tmp = pNppParam->getContextMenuItems();
size_t len = tmp.size(); size_t len = tmp.size();
TCHAR menuName[64]; TCHAR menuName[64];
for (size_t i = 0 ; i < len ; i++) for (size_t i = 0 ; i < len ; ++i)
{ {
if (tmp[i]._itemName == TEXT("")) if (tmp[i]._itemName == TEXT(""))
{ {
@ -4893,7 +4893,7 @@ bool Notepad_plus::reloadLang()
vector<CommandShortcut> & shortcuts = pNppParam->getUserShortcuts(); vector<CommandShortcut> & shortcuts = pNppParam->getUserShortcuts();
len = shortcuts.size(); len = shortcuts.size();
for(size_t i = 0; i < len; i++) for(size_t i = 0; i < len; ++i)
{ {
CommandShortcut & csc = shortcuts[i]; CommandShortcut & csc = shortcuts[i];
::GetMenuString(_mainMenuHandle, csc.getID(), menuName, 64, MF_BYCOMMAND); ::GetMenuString(_mainMenuHandle, csc.getID(), menuName, 64, MF_BYCOMMAND);
@ -5169,7 +5169,7 @@ struct Quote{
const char *_quote; const char *_quote;
}; };
const int nbQuote = 135; const int nbQuote = 138;
Quote quotes[nbQuote] = { Quote quotes[nbQuote] = {
{"Notepad++", "Good programmers use Notepad++ to code.\nExtreme programmers use MS Word to code, in Comic Sans, center aligned."}, {"Notepad++", "Good programmers use Notepad++ to code.\nExtreme programmers use MS Word to code, in Comic Sans, center aligned."},
{"Martin Golding", "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."}, {"Martin Golding", "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."},
@ -5297,6 +5297,9 @@ Quote quotes[nbQuote] = {
{"Anonymous #94", "Hey, I just met you\nAnd this is crazy\nHere's my number 127.0.0.1\nPing me maybe?"}, {"Anonymous #94", "Hey, I just met you\nAnd this is crazy\nHere's my number 127.0.0.1\nPing me maybe?"},
{"Anonymous #95", "YES!\nI'm a programmer, and\nNO!\nIt doesn't mean that I have to fix you PC!"}, {"Anonymous #95", "YES!\nI'm a programmer, and\nNO!\nIt doesn't mean that I have to fix you PC!"},
{"Anonymous #96", "Code for 6 minutes, debug for 6 hours."}, {"Anonymous #96", "Code for 6 minutes, debug for 6 hours."},
{"Anonymous #97", "Real Programmers don't comment their code.\nIf it was hard to write, it should be hard to read."},
{"Anonymous #98", "My neighbours listen to good music.\nWhether they like it or not."},
{"Anonymous #99", "Mondays are not so bad.\nIt's your job that sucks."},
{"Gandhi", "Earth provides enough to satisfy every man's need, but not every man's greed."}, {"Gandhi", "Earth provides enough to satisfy every man's need, but not every man's greed."},
{"R. D. Laing", "Life is a sexually transmitted disease and the mortality rate is one hundred percent."}, {"R. D. Laing", "Life is a sexually transmitted disease and the mortality rate is one hundred percent."},
{"Apple fan boy", "I'll buy a second iPhone 5 and buy a lot of iOS applications so that Apple will be able to buy Samsung (this shitty company) to shut it down and all the Apple haters will be forced to have an iPhone. Muhahaha..."}, {"Apple fan boy", "I'll buy a second iPhone 5 and buy a lot of iOS applications so that Apple will be able to buy Samsung (this shitty company) to shut it down and all the Apple haters will be forced to have an iPhone. Muhahaha..."},
@ -5338,7 +5341,7 @@ int Notepad_plus::getRandomAction(int ranNum)
bool isInList(int elem, vector<int> elemList) bool isInList(int elem, vector<int> elemList)
{ {
for (size_t i = 0, len = elemList.size(); i < len; i++) for (size_t i = 0, len = elemList.size(); i < len; ++i)
{ {
if (elem == elemList[i]) if (elem == elemList[i])
return true; return true;
@ -5372,7 +5375,7 @@ DWORD WINAPI Notepad_plus::threadTextPlayer(void *params)
int nbTrolling = 0; int nbTrolling = 0;
vector<int> generatedRans; vector<int> generatedRans;
char previousChar = '\0'; char previousChar = '\0';
for (size_t i = 0, len = strlen(text2display); i < len ; i++) for (size_t i = 0, len = strlen(text2display); i < len ; ++i)
{ {
int ranNum = getRandomNumber(maxRange); int ranNum = getRandomNumber(maxRange);
@ -5393,7 +5396,7 @@ DWORD WINAPI Notepad_plus::threadTextPlayer(void *params)
{ {
//writeLog(TEXT("c:\\tmp\\log.txt"), "trolling begin"); //writeLog(TEXT("c:\\tmp\\log.txt"), "trolling begin");
generatedRans.push_back(wtfIndex); generatedRans.push_back(wtfIndex);
nbTrolling++; ++nbTrolling;
trollerParams._text2display = wtf[wtfIndex]; trollerParams._text2display = wtf[wtfIndex];
ReleaseMutex(mutex); ReleaseMutex(mutex);
@ -5437,7 +5440,7 @@ DWORD WINAPI Notepad_plus::threadTextPlayer(void *params)
::SendMessage(curScintilla, SCI_GOTOPOS, ::SendMessage(curScintilla, SCI_GETLENGTH, 0, 0), 0); ::SendMessage(curScintilla, SCI_GOTOPOS, ::SendMessage(curScintilla, SCI_GETLENGTH, 0, 0), 0);
// Display quoter // Display quoter
for (size_t i = 0, len = strlen(quoter); i < len; i++) for (size_t i = 0, len = strlen(quoter); i < len; ++i)
{ {
int ranNum = getRandomNumber(maxRange); int ranNum = getRandomNumber(maxRange);
@ -5471,7 +5474,7 @@ DWORD WINAPI Notepad_plus::threadTextTroller(void *params)
BufferID targetBufID = ((TextTrollerParams *)params)->_targetBufID; BufferID targetBufID = ((TextTrollerParams *)params)->_targetBufID;
//HANDLE mutex = ((TextTrollerParams *)params)->_mutex; //HANDLE mutex = ((TextTrollerParams *)params)->_mutex;
for (size_t i = 0, len = strlen(text2display); i < len; i++) for (size_t i = 0, len = strlen(text2display); i < len; ++i)
{ {
char charToShow[2] = {text2display[i], '\0'}; char charToShow[2] = {text2display[i], '\0'};
int ranNum = getRandomNumber(maxRange); int ranNum = getRandomNumber(maxRange);
@ -5495,7 +5498,7 @@ DWORD WINAPI Notepad_plus::threadTextTroller(void *params)
if (delMethod == 0) if (delMethod == 0)
{ {
size_t len = strlen(text2display); size_t len = strlen(text2display);
for (size_t j = 0; j < len; j++) for (size_t j = 0; j < len; ++j)
{ {
if (!deleteBack(pCurrentView, targetBufID)) if (!deleteBack(pCurrentView, targetBufID))
break; break;
@ -5505,7 +5508,7 @@ DWORD WINAPI Notepad_plus::threadTextTroller(void *params)
{ {
size_t len = strlen(text2display); size_t len = strlen(text2display);
::SendMessage(curScintilla, SCI_GOTOPOS, ::SendMessage(curScintilla, SCI_GETLENGTH, 0, 0) - len, 0); ::SendMessage(curScintilla, SCI_GOTOPOS, ::SendMessage(curScintilla, SCI_GETLENGTH, 0, 0) - len, 0);
for (size_t j = 0; j < len; j++) for (size_t j = 0; j < len; ++j)
{ {
if (!deleteForward(pCurrentView, targetBufID)) if (!deleteForward(pCurrentView, targetBufID))
break; break;
@ -5513,7 +5516,7 @@ DWORD WINAPI Notepad_plus::threadTextTroller(void *params)
} }
else if (delMethod == 2) else if (delMethod == 2)
{ {
for (size_t j = 0, len = strlen(text2display); j < len; j++) for (size_t j = 0, len = strlen(text2display); j < len; ++j)
{ {
if (!selectBack(pCurrentView, targetBufID)) if (!selectBack(pCurrentView, targetBufID))
break; break;
@ -5590,7 +5593,7 @@ int Notepad_plus::getQuoteIndexFrom(const char *quoter) const
return getRandomNumber(nbQuote); return getRandomNumber(nbQuote);
} }
for (int i = 0; i < nbQuote; i++) for (int i = 0; i < nbQuote; ++i)
{ {
if (stricmp(quotes[i]._quoter, quoter) == 0) if (stricmp(quotes[i]._quoter, quoter) == 0)
return i; return i;

View File

@ -164,7 +164,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
PathAppend(localizationDir, TEXT("localization\\")); PathAppend(localizationDir, TEXT("localization\\"));
_notepad_plus_plus_core.getMatchedFileNames(localizationDir.c_str(), patterns, fileNames, false, false); _notepad_plus_plus_core.getMatchedFileNames(localizationDir.c_str(), patterns, fileNames, false, false);
for (size_t i = 0, len = fileNames.size(); i < len ; i++) for (size_t i = 0, len = fileNames.size(); i < len ; ++i)
{ {
localizationSwitcher.addLanguageFromXml(fileNames[i].c_str()); localizationSwitcher.addLanguageFromXml(fileNames[i].c_str());
} }
@ -182,7 +182,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
themeDir = pNppParams->getAppDataNppDir(); themeDir = pNppParams->getAppDataNppDir();
PathAppend(themeDir, TEXT("themes\\")); PathAppend(themeDir, TEXT("themes\\"));
_notepad_plus_plus_core.getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false); _notepad_plus_plus_core.getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false);
for (size_t i = 0, len = fileNames.size() ; i < len ; i++) for (size_t i = 0, len = fileNames.size() ; i < len ; ++i)
{ {
themeSwitcher.addThemeFromXml(fileNames[i].c_str()); themeSwitcher.addThemeFromXml(fileNames[i].c_str());
} }
@ -192,7 +192,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 themeDir = nppDir.c_str(); // <- should use the pointer to avoid the constructor of copy
PathAppend(themeDir, TEXT("themes\\")); PathAppend(themeDir, TEXT("themes\\"));
_notepad_plus_plus_core.getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false); _notepad_plus_plus_core.getMatchedFileNames(themeDir.c_str(), patterns, fileNames, false, false);
for (size_t i = 0, len = fileNames.size(); i < len ; i++) for (size_t i = 0, len = fileNames.size(); i < len ; ++i)
{ {
generic_string themeName( themeSwitcher.getThemeFromXmlFileName(fileNames[i].c_str()) ); generic_string themeName( themeSwitcher.getThemeFromXmlFileName(fileNames[i].c_str()) );
if (! themeSwitcher.themeNameExists(themeName.c_str()) ) if (! themeSwitcher.themeNameExists(themeName.c_str()) )
@ -201,7 +201,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
} }
} }
for (size_t i = 0, len = _notepad_plus_plus_core._internalFuncIDs.size() ; i < len ; 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); ::SendMessage(_hSelf, WM_COMMAND, _notepad_plus_plus_core._internalFuncIDs[i], 0);
// Notify plugins that Notepad++ is ready // Notify plugins that Notepad++ is ready
@ -224,7 +224,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
bool Notepad_plus_Window::isDlgsMsg(MSG *msg, bool unicodeSupported) const bool Notepad_plus_Window::isDlgsMsg(MSG *msg, bool unicodeSupported) const
{ {
for (size_t i = 0, len = _notepad_plus_plus_core._hModelessDlgs.size(); i < len; 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))) if (unicodeSupported?(::IsDialogMessageW(_notepad_plus_plus_core._hModelessDlgs[i], msg)):(::IsDialogMessageA(_notepad_plus_plus_core._hModelessDlgs[i], msg)))
return true; return true;

View File

@ -143,7 +143,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
//loop through buffers and reset the language (L_USER, TEXT("")) if (L_USER, name) //loop through buffers and reset the language (L_USER, TEXT("")) if (L_USER, name)
Buffer * buf; Buffer * buf;
for(int i = 0; i < MainFileManager->getNrBuffers(); i++) for(int i = 0; i < MainFileManager->getNrBuffers(); ++i)
{ {
buf = MainFileManager->getBufferByIndex(i); buf = MainFileManager->getBufferByIndex(i);
if (buf->getLangType() == L_USER && name == buf->getUserDefineLangName()) if (buf->getLangType() == L_USER && name == buf->getUserDefineLangName())
@ -162,7 +162,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
//loop through buffers and reset the language (L_USER, newName) if (L_USER, oldName) //loop through buffers and reset the language (L_USER, newName) if (L_USER, oldName)
Buffer * buf; Buffer * buf;
for(int i = 0; i < MainFileManager->getNrBuffers(); i++) for(int i = 0; i < MainFileManager->getNrBuffers(); ++i)
{ {
buf = MainFileManager->getBufferByIndex(i); buf = MainFileManager->getBufferByIndex(i);
if (buf->getLangType() == L_USER && oldName == buf->getUserDefineLangName()) if (buf->getLangType() == L_USER && oldName == buf->getUserDefineLangName())
@ -710,7 +710,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
int j = 0; int j = 0;
if (Message != NPPM_GETOPENFILENAMESSECOND) { if (Message != NPPM_GETOPENFILENAMESSECOND) {
for (int i = 0 ; i < _mainDocTab.nbItem() && j < nbFileNames ; i++) for (int i = 0 ; i < _mainDocTab.nbItem() && j < nbFileNames ; ++i)
{ {
BufferID id = _mainDocTab.getBufferByIndex(i); BufferID id = _mainDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(id); Buffer * buf = MainFileManager->getBufferByID(id);
@ -718,7 +718,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
} }
} }
if (Message != NPPM_GETOPENFILENAMESPRIMARY) { if (Message != NPPM_GETOPENFILENAMESPRIMARY) {
for (int i = 0 ; i < _subDocTab.nbItem() && j < nbFileNames ; i++) for (int i = 0 ; i < _subDocTab.nbItem() && j < nbFileNames ; ++i)
{ {
BufferID id = _subDocTab.getBufferByIndex(i); BufferID id = _subDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(id); Buffer * buf = MainFileManager->getBufferByID(id);
@ -814,7 +814,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
lstrcpy(sessionFileArray[i++], pFn); lstrcpy(sessionFileArray[i++], pFn);
} }
for (size_t j = 0, len = session2Load.nbSubFiles(); j < len ; j++) for (size_t j = 0, len = session2Load.nbSubFiles(); j < len ; ++j)
{ {
const TCHAR *pFn = session2Load._subViewFiles[j]._fileName.c_str(); const TCHAR *pFn = session2Load._subViewFiles[j]._fileName.c_str();
lstrcpy(sessionFileArray[i++], pFn); lstrcpy(sessionFileArray[i++], pFn);
@ -941,7 +941,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
bool isDot = false; bool isDot = false;
int j =0; int j =0;
int k = 0; int k = 0;
for (int i = 0 ; verStr[i] ; i++) for (int i = 0 ; verStr[i] ; ++i)
{ {
if (verStr[i] == '.') if (verStr[i] == '.')
isDot = true; isDot = true;
@ -1015,7 +1015,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
for(;;) for(;;)
{ {
macroPlayback(m); macroPlayback(m);
counter++; ++counter;
if ( times >= 0 ) if ( times >= 0 )
{ {
if ( counter >= times ) break; if ( counter >= times ) break;
@ -1213,7 +1213,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
{ {
if (wParam == MODELESSDIALOGADD) if (wParam == MODELESSDIALOGADD)
{ {
for (size_t i = 0, len = _hModelessDlgs.size() ; i < len ; i++) for (size_t i = 0, len = _hModelessDlgs.size() ; i < len ; ++i)
if (_hModelessDlgs[i] == (HWND)lParam) if (_hModelessDlgs[i] == (HWND)lParam)
return NULL; return NULL;
_hModelessDlgs.push_back((HWND)lParam); _hModelessDlgs.push_back((HWND)lParam);
@ -1221,7 +1221,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
} }
else if (wParam == MODELESSDIALOGREMOVE) else if (wParam == MODELESSDIALOGREMOVE)
{ {
for (size_t i = 0, len = _hModelessDlgs.size(); i < len ; i++) for (size_t i = 0, len = _hModelessDlgs.size(); i < len ; ++i)
if (_hModelessDlgs[i] == (HWND)lParam) if (_hModelessDlgs[i] == (HWND)lParam)
{ {
vector<HWND>::iterator hDlg = _hModelessDlgs.begin() + i; vector<HWND>::iterator hDlg = _hModelessDlgs.begin() + i;
@ -1253,12 +1253,12 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
ContextMenu scintillaContextmenu; ContextMenu scintillaContextmenu;
vector<MenuItemUnit> & tmp = pNppParam->getContextMenuItems(); vector<MenuItemUnit> & tmp = pNppParam->getContextMenuItems();
vector<bool> isEnable; vector<bool> isEnable;
for (size_t i = 0, len = tmp.size(); i < len ; 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); isEnable.push_back((::GetMenuState(_mainMenuHandle, tmp[i]._cmdID, MF_BYCOMMAND)&MF_DISABLED) == 0);
} }
scintillaContextmenu.create(_pPublicInterface->getHSelf(), tmp); scintillaContextmenu.create(_pPublicInterface->getHSelf(), tmp);
for (size_t i = 0, len = isEnable.size(); i < len ; i++) for (size_t i = 0, len = isEnable.size(); i < len ; ++i)
scintillaContextmenu.enableItem(tmp[i]._cmdID, isEnable[i]); scintillaContextmenu.enableItem(tmp[i]._cmdID, isEnable[i]);
scintillaContextmenu.display(p); scintillaContextmenu.display(p);
@ -1599,10 +1599,10 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
TCHAR *moduleName = (TCHAR *)lParam; TCHAR *moduleName = (TCHAR *)lParam;
TCHAR *windowName = (TCHAR *)wParam; TCHAR *windowName = (TCHAR *)wParam;
vector<DockingCont *> dockContainer = _dockingManager.getContainerInfo(); vector<DockingCont *> dockContainer = _dockingManager.getContainerInfo();
for (size_t i = 0, len = dockContainer.size(); i < len ; i++) for (size_t i = 0, len = dockContainer.size(); i < len ; ++i)
{ {
vector<tTbData *> tbData = dockContainer[i]->getDataOfAllTb(); vector<tTbData *> tbData = dockContainer[i]->getDataOfAllTb();
for (size_t j = 0, len2 = tbData.size() ; j < len2 ; j++) for (size_t j = 0, len2 = tbData.size() ; j < len2 ; ++j)
{ {
if (generic_stricmp(moduleName, tbData[j]->pszModuleName) == 0) if (generic_stricmp(moduleName, tbData[j]->pszModuleName) == 0)
{ {
@ -1976,7 +1976,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
case WDT_SAVE: case WDT_SAVE:
{ {
//loop through nmdlg->nItems, get index and save it //loop through nmdlg->nItems, get index and save it
for (int i = 0; i < (int)nmdlg->nItems; i++) { for (int i = 0; i < (int)nmdlg->nItems; ++i)
{
fileSave(_pDocTab->getBufferByIndex(i)); fileSave(_pDocTab->getBufferByIndex(i));
} }
nmdlg->processed = TRUE; nmdlg->processed = TRUE;
@ -1987,7 +1988,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
bool closed; bool closed;
//loop through nmdlg->nItems, get index and close it //loop through nmdlg->nItems, get index and close it
for (int i = 0; i < (int)nmdlg->nItems; i++) for (int i = 0; i < (int)nmdlg->nItems; ++i)
{ {
closed = fileClose(_pDocTab->getBufferByIndex(nmdlg->Items[i]), currentView()); closed = fileClose(_pDocTab->getBufferByIndex(nmdlg->Items[i]), currentView());
UINT pos = nmdlg->Items[i]; UINT pos = nmdlg->Items[i];
@ -1997,7 +1998,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
nmdlg->Items[i] = 0xFFFFFFFF; // indicate file was closed nmdlg->Items[i] = 0xFFFFFFFF; // indicate file was closed
// Shift the remaining items downward to fill the gap // Shift the remaining items downward to fill the gap
for (int j = i + 1; j < (int)nmdlg->nItems; j++) for (int j = i + 1; j < (int)nmdlg->nItems; ++j)
{ {
if (nmdlg->Items[j] > pos) if (nmdlg->Items[j] > pos)
{ {
@ -2014,11 +2015,13 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
break; break;
//Collect all buffers //Collect all buffers
std::vector<BufferID> tempBufs; std::vector<BufferID> tempBufs;
for(int i = 0; i < (int)nmdlg->nItems; i++) { for(int i = 0; i < (int)nmdlg->nItems; ++i)
{
tempBufs.push_back(_pDocTab->getBufferByIndex(i)); tempBufs.push_back(_pDocTab->getBufferByIndex(i));
} }
//Reset buffers //Reset buffers
for(int i = 0; i < (int)nmdlg->nItems; i++) { for(int i = 0; i < (int)nmdlg->nItems; ++i)
{
_pDocTab->setBuffer(i, tempBufs[nmdlg->Items[i]]); _pDocTab->setBuffer(i, tempBufs[nmdlg->Items[i]]);
} }
activateBuffer(_pDocTab->getBufferByIndex(_pDocTab->getCurrentTabIndex()), currentView()); activateBuffer(_pDocTab->getBufferByIndex(_pDocTab->getCurrentTabIndex()), currentView());

View File

@ -76,7 +76,7 @@ void Notepad_plus::command(int id)
if (_pFileSwitcherPanel) if (_pFileSwitcherPanel)
{ {
vector<SwitcherFileInfo> files = _pFileSwitcherPanel->getSelectedFiles(id == IDM_FILESWITCHER_FILESCLOSEOTHERS); vector<SwitcherFileInfo> files = _pFileSwitcherPanel->getSelectedFiles(id == IDM_FILESWITCHER_FILESCLOSEOTHERS);
for (size_t i = 0, len = files.size(); i < len; i++) for (size_t i = 0, len = files.size(); i < len; ++i)
{ {
fileClose((BufferID)files[i]._bufID, files[i]._iView); fileClose((BufferID)files[i]._bufID, files[i]._iView);
} }
@ -1921,7 +1921,7 @@ void Notepad_plus::command(int id)
// load plugin // load plugin
vector<generic_string> dll2Remove; vector<generic_string> dll2Remove;
for (size_t i = 0, len = copiedFiles.size() ; i < len ; i++) for (size_t i = 0, len = copiedFiles.size() ; i < len ; ++i)
{ {
int index = _pluginsManager.loadPlugin(copiedFiles[i].c_str(), dll2Remove); int index = _pluginsManager.loadPlugin(copiedFiles[i].c_str(), dll2Remove);
if (_pluginsManager.getMenuHandle()) if (_pluginsManager.getMenuHandle())
@ -1945,7 +1945,7 @@ void Notepad_plus::command(int id)
ThemeSwitcher & themeSwitcher = pNppParams->getThemeSwitcher(); ThemeSwitcher & themeSwitcher = pNppParams->getThemeSwitcher();
vector<generic_string> copiedFiles = addNppComponents(destDir, extFilterName, extFilter); vector<generic_string> copiedFiles = addNppComponents(destDir, extFilterName, extFilter);
for (size_t i = 0, len = copiedFiles.size(); i < len ; i++) for (size_t i = 0, len = copiedFiles.size(); i < len ; ++i)
{ {
generic_string themeName(themeSwitcher.getThemeFromXmlFileName(copiedFiles[i].c_str())); generic_string themeName(themeSwitcher.getThemeFromXmlFileName(copiedFiles[i].c_str()));
if (!themeSwitcher.themeNameExists(themeName.c_str())) if (!themeSwitcher.themeNameExists(themeName.c_str()))

View File

@ -206,7 +206,7 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi
if (ok2Open) if (ok2Open)
{ {
for (size_t i = 0 ; i < nbFiles2Open ; i++) for (size_t i = 0 ; i < nbFiles2Open ; ++i)
{ {
doOpen(fileNames[i].c_str()); doOpen(fileNames[i].c_str());
} }
@ -401,7 +401,7 @@ generic_string Notepad_plus::exts2Filters(generic_string exts) const
int j = 0; int j = 0;
bool stop = false; bool stop = false;
for (size_t i = 0, len = exts.length(); i < len ; i++) for (size_t i = 0, len = exts.length(); i < len ; ++i)
{ {
if (extStr[i] == ' ') if (extStr[i] == ' ')
{ {
@ -423,7 +423,7 @@ generic_string Notepad_plus::exts2Filters(generic_string exts) const
{ {
aExt[j] = extStr[i]; aExt[j] = extStr[i];
stop = false; stop = false;
j++; ++j;
} }
} }
@ -459,7 +459,7 @@ int Notepad_plus::setFileOpenSaveDlgFilters(FileDialog & fDlg, int langType)
bool inExcludedList = false; bool inExcludedList = false;
for (size_t j = 0, len = nppGUI._excludedLangList.size() ; j < len ; j++) for (size_t j = 0, len = nppGUI._excludedLangList.size() ; j < len ; ++j)
{ {
if (lid == nppGUI._excludedLangList[j]._langType) if (lid == nppGUI._excludedLangList[j]._langType)
{ {
@ -505,7 +505,7 @@ int Notepad_plus::setFileOpenSaveDlgFilters(FileDialog & fDlg, int langType)
if (langType != -1 && !ltFound) if (langType != -1 && !ltFound)
{ {
ltIndex++; ++ltIndex;
} }
} }
} }
@ -567,7 +567,7 @@ bool Notepad_plus::fileCloseAll()
//closes all documents, makes the current view the only one visible //closes all documents, makes the current view the only one visible
//first check if we need to save any file //first check if we need to save any file
for(int i = 0; i < _mainDocTab.nbItem(); i++) for(int i = 0; i < _mainDocTab.nbItem(); ++i)
{ {
BufferID id = _mainDocTab.getBufferByIndex(i); BufferID id = _mainDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(id); Buffer * buf = MainFileManager->getBufferByID(id);
@ -593,7 +593,7 @@ bool Notepad_plus::fileCloseAll()
} }
} }
} }
for(int i = 0; i < _subDocTab.nbItem(); i++) for(int i = 0; i < _subDocTab.nbItem(); ++i)
{ {
BufferID id = _subDocTab.getBufferByIndex(i); BufferID id = _subDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(id); Buffer * buf = MainFileManager->getBufferByID(id);
@ -645,7 +645,7 @@ bool Notepad_plus::fileCloseAllButCurrent()
//closes all documents, makes the current view the only one visible //closes all documents, makes the current view the only one visible
//first check if we need to save any file //first check if we need to save any file
for(int i = 0; i < _mainDocTab.nbItem(); i++) { for(int i = 0; i < _mainDocTab.nbItem(); ++i) {
BufferID id = _mainDocTab.getBufferByIndex(i); BufferID id = _mainDocTab.getBufferByIndex(i);
if (id == current) if (id == current)
continue; continue;
@ -672,7 +672,7 @@ bool Notepad_plus::fileCloseAllButCurrent()
} }
} }
} }
for(int i = 0; i < _subDocTab.nbItem(); i++) for(int i = 0; i < _subDocTab.nbItem(); ++i)
{ {
BufferID id = _subDocTab.getBufferByIndex(i); BufferID id = _subDocTab.getBufferByIndex(i);
Buffer * buf = MainFileManager->getBufferByID(id); Buffer * buf = MainFileManager->getBufferByID(id);
@ -811,14 +811,14 @@ bool Notepad_plus::fileSave(BufferID id)
bool Notepad_plus::fileSaveAll() { bool Notepad_plus::fileSaveAll() {
if (viewVisible(MAIN_VIEW)) { if (viewVisible(MAIN_VIEW)) {
for(int i = 0; i < _mainDocTab.nbItem(); i++) { for(int i = 0; i < _mainDocTab.nbItem(); ++i) {
BufferID idToSave = _mainDocTab.getBufferByIndex(i); BufferID idToSave = _mainDocTab.getBufferByIndex(i);
fileSave(idToSave); fileSave(idToSave);
} }
} }
if (viewVisible(SUB_VIEW)) { if (viewVisible(SUB_VIEW)) {
for(int i = 0; i < _subDocTab.nbItem(); i++) { for(int i = 0; i < _subDocTab.nbItem(); ++i) {
BufferID idToSave = _subDocTab.getBufferByIndex(i); BufferID idToSave = _subDocTab.getBufferByIndex(i);
fileSave(idToSave); fileSave(idToSave);
} }
@ -949,7 +949,7 @@ void Notepad_plus::fileOpen()
if (stringVector *pfns = fDlg.doOpenMultiFilesDlg()) if (stringVector *pfns = fDlg.doOpenMultiFilesDlg())
{ {
size_t sz = pfns->size(); size_t sz = pfns->size();
for (size_t i = 0 ; i < sz ; i++) { for (size_t i = 0 ; i < sz ; ++i) {
BufferID test = doOpen(pfns->at(i).c_str(), fDlg.isReadOnly()); BufferID test = doOpen(pfns->at(i).c_str(), fDlg.isReadOnly());
if (test != BUFFER_INVALID) if (test != BUFFER_INVALID)
lastOpened = test; lastOpened = test;
@ -1067,12 +1067,12 @@ bool Notepad_plus::loadSession(Session & session)
//Dont use default methods because of performance //Dont use default methods because of performance
Document prevDoc = _mainEditView.execute(SCI_GETDOCPOINTER); Document prevDoc = _mainEditView.execute(SCI_GETDOCPOINTER);
_mainEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument()); _mainEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument());
for (size_t j = 0, len = session._mainViewFiles[i].marks.size(); j < len ; 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); _mainEditView.execute(SCI_MARKERADD, session._mainViewFiles[i].marks[j], MARK_BOOKMARK);
} }
_mainEditView.execute(SCI_SETDOCPOINTER, 0, prevDoc); _mainEditView.execute(SCI_SETDOCPOINTER, 0, prevDoc);
i++; ++i;
} }
else else
{ {
@ -1163,13 +1163,13 @@ bool Notepad_plus::loadSession(Session & session)
//Dont use default methods because of performance //Dont use default methods because of performance
Document prevDoc = _subEditView.execute(SCI_GETDOCPOINTER); Document prevDoc = _subEditView.execute(SCI_GETDOCPOINTER);
_subEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument()); _subEditView.execute(SCI_SETDOCPOINTER, 0, buf->getDocument());
for (size_t j = 0, len = session._subViewFiles[k].marks.size(); j < len ; 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); _subEditView.execute(SCI_MARKERADD, session._subViewFiles[k].marks[j], MARK_BOOKMARK);
} }
_subEditView.execute(SCI_SETDOCPOINTER, 0, prevDoc); _subEditView.execute(SCI_SETDOCPOINTER, 0, prevDoc);
k++; ++k;
} }
else else
{ {
@ -1251,7 +1251,7 @@ const TCHAR * Notepad_plus::fileSaveSession(size_t nbFile, TCHAR ** fileNames, c
Session currentSession; Session currentSession;
if ((nbFile) && (fileNames)) if ((nbFile) && (fileNames))
{ {
for (size_t i = 0 ; i < nbFile ; i++) for (size_t i = 0 ; i < nbFile ; ++i)
{ {
if (PathFileExists(fileNames[i])) if (PathFileExists(fileNames[i]))
currentSession._mainViewFiles.push_back(generic_string(fileNames[i])); currentSession._mainViewFiles.push_back(generic_string(fileNames[i]));

View File

@ -765,7 +765,8 @@ BOOL Notepad_plus::notify(SCNotification *notification)
int end = notifyView->execute(SCI_LINEFROMPOSITION, notification->position + notification->length); int end = notifyView->execute(SCI_LINEFROMPOSITION, notification->position + notification->length);
int firstLine = begin < end ? begin : end; int firstLine = begin < end ? begin : end;
int lastLine = begin > end ? begin : end; int lastLine = begin > end ? begin : end;
for (int line = firstLine; line <= lastLine; line++) { for (int line = firstLine; line <= lastLine; ++line)
{
notifyView->execute(SCI_ENSUREVISIBLE, line, 0); notifyView->execute(SCI_ENSUREVISIBLE, line, 0);
} }
break; break;

View File

@ -473,7 +473,7 @@ static int getKwClassFromName(const TCHAR *str) {
wstring LocalizationSwitcher::getLangFromXmlFileName(const wchar_t *fn) const wstring LocalizationSwitcher::getLangFromXmlFileName(const wchar_t *fn) const
{ {
size_t nbItem = sizeof(localizationDefs)/sizeof(LocalizationSwitcher::LocalizationDefinition); size_t nbItem = sizeof(localizationDefs)/sizeof(LocalizationSwitcher::LocalizationDefinition);
for (size_t i = 0 ; i < nbItem ; i++) for (size_t i = 0 ; i < nbItem ; ++i)
{ {
if (wcsicmp(fn, localizationDefs[i]._xmlFileName) == 0) if (wcsicmp(fn, localizationDefs[i]._xmlFileName) == 0)
return localizationDefs[i]._langName; return localizationDefs[i]._langName;
@ -483,7 +483,7 @@ wstring LocalizationSwitcher::getLangFromXmlFileName(const wchar_t *fn) const
wstring LocalizationSwitcher::getXmlFilePathFromLangName(const wchar_t *langName) const wstring LocalizationSwitcher::getXmlFilePathFromLangName(const wchar_t *langName) const
{ {
for (size_t i = 0, len = _localizationList.size(); i < len ; i++) for (size_t i = 0, len = _localizationList.size(); i < len ; ++i)
{ {
if (wcsicmp(langName, _localizationList[i].first.c_str()) == 0) if (wcsicmp(langName, _localizationList[i].first.c_str()) == 0)
return _localizationList[i].second; return _localizationList[i].second;
@ -634,7 +634,7 @@ NppParameters::NppParameters() : _pXmlDoc(NULL),_pXmlUserDoc(NULL), _pXmlUserSty
{ {
// init import UDL array // init import UDL array
_nbImportedULD = 0; _nbImportedULD = 0;
for (int i = 0 ; i < NB_MAX_IMPORTED_UDL ; i++) for (int i = 0 ; i < NB_MAX_IMPORTED_UDL ; ++i)
{ {
_importedULD[i] = NULL; _importedULD[i] = NULL;
} }
@ -667,11 +667,11 @@ NppParameters::NppParameters() : _pXmlDoc(NULL),_pXmlUserDoc(NULL), _pXmlUserSty
NppParameters::~NppParameters() NppParameters::~NppParameters()
{ {
for (int i = 0 ; i < _nbLang ; i++) for (int i = 0 ; i < _nbLang ; ++i)
delete _langList[i]; delete _langList[i];
for (int i = 0 ; i < _nbRecentFile ; i++) for (int i = 0 ; i < _nbRecentFile ; ++i)
delete _LRFileList[i]; delete _LRFileList[i];
for (int i = 0 ; i < _nbUserLang ; i++) for (int i = 0 ; i < _nbUserLang ; ++i)
delete _userLangArray[i]; delete _userLangArray[i];
if (_hUser32) if (_hUser32)
FreeLibrary(_hUser32); FreeLibrary(_hUser32);
@ -692,7 +692,7 @@ void cutString(const TCHAR *str2cut, vector<generic_string> & patternVect)
size_t len = lstrlen(str2scan); size_t len = lstrlen(str2scan);
bool isProcessing = false; bool isProcessing = false;
TCHAR *pBegin = NULL; TCHAR *pBegin = NULL;
for (size_t i = 0 ; i <= len ; i++) for (size_t i = 0 ; i <= len ; ++i)
{ {
switch(str2scan[i]) switch(str2scan[i])
{ {
@ -738,7 +738,7 @@ bool NppParameters::reloadStylers(TCHAR *stylePath)
getUserStylersFromXmlTree(); getUserStylersFromXmlTree();
// Reload plugin styles. // Reload plugin styles.
for( size_t i = 0; i < getExternalLexerDoc()->size(); i++) for( size_t i = 0; i < getExternalLexerDoc()->size(); ++i)
{ {
getExternalLexerFromXmlTree( getExternalLexerDoc()->at(i) ); getExternalLexerFromXmlTree( getExternalLexerDoc()->at(i) );
} }
@ -783,7 +783,7 @@ bool NppParameters::load()
{ {
L_END = L_EXTERNAL; L_END = L_EXTERNAL;
bool isAllLaoded = true; bool isAllLaoded = true;
for (int i = 0 ; i < NB_LANG ; _langList[i] = NULL, i++); for (int i = 0 ; i < NB_LANG ; _langList[i] = NULL, ++i);
// Make localConf.xml path // Make localConf.xml path
generic_string localConfPath(_nppPath); generic_string localConfPath(_nppPath);
@ -1100,7 +1100,7 @@ bool NppParameters::load()
getSessionFromXmlTree(); getSessionFromXmlTree();
delete _pXmlSessionDoc; delete _pXmlSessionDoc;
for (size_t i = 0, len = _pXmlExternalLexerDoc.size() ; i < len ; i++) for (size_t i = 0, len = _pXmlExternalLexerDoc.size() ; i < len ; ++i)
if (_pXmlExternalLexerDoc[i]) if (_pXmlExternalLexerDoc[i])
delete _pXmlExternalLexerDoc[i]; delete _pXmlExternalLexerDoc[i];
@ -1144,7 +1144,7 @@ void NppParameters::destroyInstance()
delete _pXmlUserLangDoc; delete _pXmlUserLangDoc;
} }
for (int i = 0 ; i < _nbImportedULD ; i++) for (int i = 0 ; i < _nbImportedULD ; ++i)
{ {
delete _importedULD[i]; delete _importedULD[i];
_importedULD[i] = NULL; _importedULD[i] = NULL;
@ -1212,8 +1212,8 @@ void NppParameters::getExternalLexerFromXmlTree(TiXmlDocument *doc)
int NppParameters::addExternalLangToEnd(ExternalLangContainer * externalLang) int NppParameters::addExternalLangToEnd(ExternalLangContainer * externalLang)
{ {
_externalLangArray[_nbExternalLang] = externalLang; _externalLangArray[_nbExternalLang] = externalLang;
_nbExternalLang++; ++_nbExternalLang;
L_END++; ++L_END;
return _nbExternalLang-1; return _nbExternalLang-1;
} }
@ -1352,7 +1352,7 @@ void NppParameters::initMenuKeys()
{ {
int nrCommands = sizeof(winKeyDefs)/sizeof(WinMenuKeyDefinition); int nrCommands = sizeof(winKeyDefs)/sizeof(WinMenuKeyDefinition);
WinMenuKeyDefinition wkd; WinMenuKeyDefinition wkd;
for(int i = 0; i < nrCommands; i++) for(int i = 0; i < nrCommands; ++i)
{ {
wkd = winKeyDefs[i]; wkd = winKeyDefs[i];
Shortcut sc((wkd.specialName?wkd.specialName:TEXT("")), wkd.isCtrl, wkd.isAlt, wkd.isShift, (unsigned char)wkd.vKey); Shortcut sc((wkd.specialName?wkd.specialName:TEXT("")), wkd.isCtrl, wkd.isAlt, wkd.isShift, (unsigned char)wkd.vKey);
@ -1368,7 +1368,7 @@ void NppParameters::initScintillaKeys() {
ScintillaKeyDefinition skd; ScintillaKeyDefinition skd;
int prevIndex = -1; int prevIndex = -1;
int prevID = -1; int prevID = -1;
for(int i = 0; i < nrCommands; i++) for(int i = 0; i < nrCommands; ++i)
{ {
skd = scintKeyDefs[i]; skd = scintKeyDefs[i];
if (skd.functionId == prevID) if (skd.functionId == prevID)
@ -1383,7 +1383,7 @@ void NppParameters::initScintillaKeys() {
else else
{ {
_scintillaKeyCommands.push_back(ScintillaKeyMap(Shortcut(skd.name, skd.isCtrl, skd.isAlt, skd.isShift, (unsigned char)skd.vKey), skd.functionId, skd.redirFunctionId)); _scintillaKeyCommands.push_back(ScintillaKeyMap(Shortcut(skd.name, skd.isCtrl, skd.isAlt, skd.isShift, (unsigned char)skd.vKey), skd.functionId, skd.redirFunctionId));
prevIndex++; ++prevIndex;
} }
prevID = skd.functionId; prevID = skd.functionId;
} }
@ -1448,7 +1448,7 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
if (menuEntryName != TEXT("") && menuItemName != TEXT("")) if (menuEntryName != TEXT("") && menuItemName != TEXT(""))
{ {
int nbMenuEntry = ::GetMenuItemCount(mainMenuHadle); int nbMenuEntry = ::GetMenuItemCount(mainMenuHadle);
for (int i = 0 ; i < nbMenuEntry ; i++) for (int i = 0 ; i < nbMenuEntry ; ++i)
{ {
TCHAR menuEntryString[64]; TCHAR menuEntryString[64];
::GetMenuString(mainMenuHadle, i, menuEntryString, 64, MF_BYPOSITION); ::GetMenuString(mainMenuHadle, i, menuEntryString, 64, MF_BYPOSITION);
@ -1493,7 +1493,7 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
notFound = true; notFound = true;
} }
else { else {
currMenuPos++; ++currMenuPos;
} }
} }
} while (! notFound ); } while (! notFound );
@ -1519,7 +1519,7 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
if (pluginsMenu && pluginName != TEXT("") && pluginCmdName != TEXT("")) if (pluginsMenu && pluginName != TEXT("") && pluginCmdName != TEXT(""))
{ {
int nbPlugins = ::GetMenuItemCount(pluginsMenu); int nbPlugins = ::GetMenuItemCount(pluginsMenu);
for (int i = 0 ; i < nbPlugins ; i++) for (int i = 0 ; i < nbPlugins ; ++i)
{ {
TCHAR menuItemString[256]; TCHAR menuItemString[256];
::GetMenuString(pluginsMenu, i, menuItemString, 256, MF_BYPOSITION); ::GetMenuString(pluginsMenu, i, menuItemString, 256, MF_BYPOSITION);
@ -1527,7 +1527,7 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins
{ {
HMENU pluginMenu = ::GetSubMenu(pluginsMenu, i); HMENU pluginMenu = ::GetSubMenu(pluginsMenu, i);
int nbPluginCmd = ::GetMenuItemCount(pluginMenu); int nbPluginCmd = ::GetMenuItemCount(pluginMenu);
for (int j = 0 ; j < nbPluginCmd ; j++) for (int j = 0 ; j < nbPluginCmd ; ++j)
{ {
TCHAR pluginCmdStr[256]; TCHAR pluginCmdStr[256];
::GetMenuString(pluginMenu, j, pluginCmdStr, 256, MF_BYPOSITION); ::GetMenuString(pluginMenu, j, pluginCmdStr, 256, MF_BYPOSITION);
@ -1766,7 +1766,7 @@ void NppParameters::feedFileListParameters(TiXmlNode *node)
if (filePath) if (filePath)
{ {
_LRFileList[_nbRecentFile] = new generic_string(filePath); _LRFileList[_nbRecentFile] = new generic_string(filePath);
_nbRecentFile++; ++_nbRecentFile;
} }
} }
} }
@ -1927,7 +1927,7 @@ void NppParameters::feedShortcut(TiXmlNode *node)
{ {
//find the commandid that matches this Shortcut sc and alter it, push back its index in the modified list, if not present //find the commandid that matches this Shortcut sc and alter it, push back its index in the modified list, if not present
int len = (int)_shortcuts.size(); int len = (int)_shortcuts.size();
for(int i = 0; i < len; i++) for(int i = 0; i < len; ++i)
{ {
if (_shortcuts[i].getID() == (unsigned long)id) if (_shortcuts[i].getID() == (unsigned long)id)
{ //found our match { //found our match
@ -2041,7 +2041,7 @@ void NppParameters::feedPluginCustomizedCmds(TiXmlNode *node)
//Find the corresponding plugincommand and alter it, put the index in the list //Find the corresponding plugincommand and alter it, put the index in the list
int len = (int)_pluginCommands.size(); int len = (int)_pluginCommands.size();
for(int i = 0; i < len; i++) for(int i = 0; i < len; ++i)
{ {
PluginCmdShortcut & pscOrig = _pluginCommands[i]; PluginCmdShortcut & pscOrig = _pluginCommands[i];
if (!generic_strnicmp(pscOrig.getModuleName(), moduleName, lstrlen(moduleName)) && pscOrig.getInternalID() == internalID) if (!generic_strnicmp(pscOrig.getModuleName(), moduleName, lstrlen(moduleName)) && pscOrig.getInternalID() == internalID)
@ -2076,7 +2076,7 @@ void NppParameters::feedScintKeys(TiXmlNode *node)
//Find the corresponding scintillacommand and alter it, put the index in the list //Find the corresponding scintillacommand and alter it, put the index in the list
size_t len = _scintillaKeyCommands.size(); size_t len = _scintillaKeyCommands.size();
for(size_t i = 0; i < len; i++) for(size_t i = 0; i < len; ++i)
{ {
ScintillaKeyMap & skmOrig = _scintillaKeyCommands[i]; ScintillaKeyMap & skmOrig = _scintillaKeyCommands[i];
if (skmOrig.getScintillaKeyID() == (unsigned long)scintKey && skmOrig.getMenuCmdID() == menuID) if (skmOrig.getScintillaKeyID() == (unsigned long)scintKey && skmOrig.getMenuCmdID() == menuID)
@ -2191,7 +2191,7 @@ bool NppParameters::feedUserLang(TiXmlNode *node)
_userLangArray[_nbUserLang] = new UserLangContainer(name, ext, TEXT("")); _userLangArray[_nbUserLang] = new UserLangContainer(name, ext, TEXT(""));
else else
_userLangArray[_nbUserLang] = new UserLangContainer(name, ext, udlVersion); _userLangArray[_nbUserLang] = new UserLangContainer(name, ext, udlVersion);
_nbUserLang++; ++_nbUserLang;
TiXmlNode *settingsRoot = childNode->FirstChildElement(TEXT("Settings")); TiXmlNode *settingsRoot = childNode->FirstChildElement(TEXT("Settings"));
if (!settingsRoot) if (!settingsRoot)
@ -2314,7 +2314,7 @@ void NppParameters::writeUserDefinedLang()
root = _pXmlUserLangDoc->FirstChild(TEXT("NotepadPlus")); root = _pXmlUserLangDoc->FirstChild(TEXT("NotepadPlus"));
for (int i = 0 ; i < _nbUserLang ; i++) for (int i = 0 ; i < _nbUserLang ; ++i)
{ {
insertUserLang2Tree(root, _userLangArray[i]); insertUserLang2Tree(root, _userLangArray[i]);
} }
@ -2343,7 +2343,7 @@ void NppParameters::insertMacro(TiXmlNode *macrosRoot, const MacroShortcut & mac
macroRoot->ToElement()->SetAttribute(TEXT("Alt"), key._isAlt?TEXT("yes"):TEXT("no")); 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("Shift"), key._isShift?TEXT("yes"):TEXT("no"));
macroRoot->ToElement()->SetAttribute(TEXT("Key"), key._key); macroRoot->ToElement()->SetAttribute(TEXT("Key"), key._key);
for (size_t i = 0, len = macro._macro.size(); i < len ; i++) for (size_t i = 0, len = macro._macro.size(); i < len ; ++i)
{ {
TiXmlNode *actionNode = macroRoot->InsertEndChild(TiXmlElement(TEXT("Action"))); TiXmlNode *actionNode = macroRoot->InsertEndChild(TiXmlElement(TEXT("Action")));
const recordedMacroStep & action = macro._macro[i]; const recordedMacroStep & action = macro._macro[i];
@ -2396,7 +2396,7 @@ void NppParameters::insertScintKey(TiXmlNode *scintKeyRoot, const ScintillaKeyMa
size_t size = scintKeyMap.getSize(); size_t size = scintKeyMap.getSize();
if (size > 1) { if (size > 1) {
TiXmlNode * keyNext; TiXmlNode * keyNext;
for(size_t i = 1; i < size; i++) { for(size_t i = 1; i < size; ++i) {
keyNext = keyRoot->InsertEndChild(TiXmlElement(TEXT("NextKey"))); keyNext = keyRoot->InsertEndChild(TiXmlElement(TEXT("NextKey")));
key = scintKeyMap.getKeyComboByIndex(i); key = scintKeyMap.getKeyComboByIndex(i);
keyNext->ToElement()->SetAttribute(TEXT("Ctrl"), key._isCtrl?TEXT("yes"):TEXT("no")); keyNext->ToElement()->SetAttribute(TEXT("Ctrl"), key._isCtrl?TEXT("yes"):TEXT("no"));
@ -2421,7 +2421,7 @@ void NppParameters::writeSession(const Session & session, const TCHAR *fileName)
TiXmlNode *mainViewNode = sessionNode->InsertEndChild(TiXmlElement(TEXT("mainView"))); TiXmlNode *mainViewNode = sessionNode->InsertEndChild(TiXmlElement(TEXT("mainView")));
(mainViewNode->ToElement())->SetAttribute(TEXT("activeIndex"), (int)session._activeMainIndex); (mainViewNode->ToElement())->SetAttribute(TEXT("activeIndex"), (int)session._activeMainIndex);
for (size_t i = 0, len = session._mainViewFiles.size(); i < len ; i++) for (size_t i = 0, len = session._mainViewFiles.size(); i < len ; ++i)
{ {
TiXmlNode *fileNameNode = mainViewNode->InsertEndChild(TiXmlElement(TEXT("File"))); TiXmlNode *fileNameNode = mainViewNode->InsertEndChild(TiXmlElement(TEXT("File")));
@ -2435,14 +2435,14 @@ void NppParameters::writeSession(const Session & session, const TCHAR *fileName)
(fileNameNode->ToElement())->SetAttribute(TEXT("encoding"), session._mainViewFiles[i]._encoding); (fileNameNode->ToElement())->SetAttribute(TEXT("encoding"), session._mainViewFiles[i]._encoding);
(fileNameNode->ToElement())->SetAttribute(TEXT("filename"), session._mainViewFiles[i]._fileName.c_str()); (fileNameNode->ToElement())->SetAttribute(TEXT("filename"), session._mainViewFiles[i]._fileName.c_str());
for (size_t j = 0, len = session._mainViewFiles[i].marks.size() ; j < len ; j++) for (size_t j = 0, len = session._mainViewFiles[i].marks.size() ; j < len ; ++j)
{ {
size_t markLine = session._mainViewFiles[i].marks[j]; size_t markLine = session._mainViewFiles[i].marks[j];
TiXmlNode *markNode = fileNameNode->InsertEndChild(TiXmlElement(TEXT("Mark"))); TiXmlNode *markNode = fileNameNode->InsertEndChild(TiXmlElement(TEXT("Mark")));
markNode->ToElement()->SetAttribute(TEXT("line"), markLine); markNode->ToElement()->SetAttribute(TEXT("line"), markLine);
} }
for (size_t j = 0, len = session._mainViewFiles[i]._foldStates.size() ; j < len ; j++) for (size_t j = 0, len = session._mainViewFiles[i]._foldStates.size() ; j < len ; ++j)
{ {
size_t foldLine = session._mainViewFiles[i]._foldStates[j]; size_t foldLine = session._mainViewFiles[i]._foldStates[j];
TiXmlNode *foldNode = fileNameNode->InsertEndChild(TiXmlElement(TEXT("Fold"))); TiXmlNode *foldNode = fileNameNode->InsertEndChild(TiXmlElement(TEXT("Fold")));
@ -2452,7 +2452,7 @@ void NppParameters::writeSession(const Session & session, const TCHAR *fileName)
TiXmlNode *subViewNode = sessionNode->InsertEndChild(TiXmlElement(TEXT("subView"))); TiXmlNode *subViewNode = sessionNode->InsertEndChild(TiXmlElement(TEXT("subView")));
(subViewNode->ToElement())->SetAttribute(TEXT("activeIndex"), (int)session._activeSubIndex); (subViewNode->ToElement())->SetAttribute(TEXT("activeIndex"), (int)session._activeSubIndex);
for (size_t i = 0, len = session._subViewFiles.size(); i < len ; i++) for (size_t i = 0, len = session._subViewFiles.size(); i < len ; ++i)
{ {
TiXmlNode *fileNameNode = subViewNode->InsertEndChild(TiXmlElement(TEXT("File"))); TiXmlNode *fileNameNode = subViewNode->InsertEndChild(TiXmlElement(TEXT("File")));
@ -2466,14 +2466,14 @@ void NppParameters::writeSession(const Session & session, const TCHAR *fileName)
(fileNameNode->ToElement())->SetAttribute(TEXT("encoding"), session._subViewFiles[i]._encoding); (fileNameNode->ToElement())->SetAttribute(TEXT("encoding"), session._subViewFiles[i]._encoding);
(fileNameNode->ToElement())->SetAttribute(TEXT("filename"), session._subViewFiles[i]._fileName.c_str()); (fileNameNode->ToElement())->SetAttribute(TEXT("filename"), session._subViewFiles[i]._fileName.c_str());
for (size_t j = 0, len = session._subViewFiles[i].marks.size(); j < len; j++) for (size_t j = 0, len = session._subViewFiles[i].marks.size(); j < len; ++j)
{ {
size_t markLine = session._subViewFiles[i].marks[j]; size_t markLine = session._subViewFiles[i].marks[j];
TiXmlNode *markNode = fileNameNode->InsertEndChild(TiXmlElement(TEXT("Mark"))); TiXmlNode *markNode = fileNameNode->InsertEndChild(TiXmlElement(TEXT("Mark")));
markNode->ToElement()->SetAttribute(TEXT("line"), markLine); markNode->ToElement()->SetAttribute(TEXT("line"), markLine);
} }
for (size_t j = 0, len = session._subViewFiles[i]._foldStates.size() ; j < len ; j++) for (size_t j = 0, len = session._subViewFiles[i]._foldStates.size() ; j < len ; ++j)
{ {
size_t foldLine = session._subViewFiles[i]._foldStates[j]; size_t foldLine = session._subViewFiles[i]._foldStates[j];
TiXmlNode *foldNode = fileNameNode->InsertEndChild(TiXmlElement(TEXT("Fold"))); TiXmlNode *foldNode = fileNameNode->InsertEndChild(TiXmlElement(TEXT("Fold")));
@ -2504,7 +2504,7 @@ void NppParameters::writeShortcuts()
root->RemoveChild(cmdRoot); root->RemoveChild(cmdRoot);
cmdRoot = root->InsertEndChild(TiXmlElement(TEXT("InternalCommands"))); cmdRoot = root->InsertEndChild(TiXmlElement(TEXT("InternalCommands")));
for (size_t i = 0, len = _customizedShortcuts.size(); i < len ; i++) for (size_t i = 0, len = _customizedShortcuts.size(); i < len ; ++i)
{ {
int index = _customizedShortcuts[i]; int index = _customizedShortcuts[i];
CommandShortcut csc = _shortcuts[index]; CommandShortcut csc = _shortcuts[index];
@ -2517,7 +2517,7 @@ void NppParameters::writeShortcuts()
macrosRoot = root->InsertEndChild(TiXmlElement(TEXT("Macros"))); macrosRoot = root->InsertEndChild(TiXmlElement(TEXT("Macros")));
for (size_t i = 0, len = _macros.size(); i < len ; i++) for (size_t i = 0, len = _macros.size(); i < len ; ++i)
{ {
insertMacro(macrosRoot, _macros[i]); insertMacro(macrosRoot, _macros[i]);
} }
@ -2528,7 +2528,7 @@ void NppParameters::writeShortcuts()
userCmdRoot = root->InsertEndChild(TiXmlElement(TEXT("UserDefinedCommands"))); userCmdRoot = root->InsertEndChild(TiXmlElement(TEXT("UserDefinedCommands")));
for (size_t i = 0, len = _userCommands.size(); i < len ; i++) for (size_t i = 0, len = _userCommands.size(); i < len ; ++i)
{ {
insertUserCmd(userCmdRoot, _userCommands[i]); insertUserCmd(userCmdRoot, _userCommands[i]);
} }
@ -2538,7 +2538,7 @@ void NppParameters::writeShortcuts()
root->RemoveChild(pluginCmdRoot); root->RemoveChild(pluginCmdRoot);
pluginCmdRoot = root->InsertEndChild(TiXmlElement(TEXT("PluginCommands"))); pluginCmdRoot = root->InsertEndChild(TiXmlElement(TEXT("PluginCommands")));
for (size_t i = 0, len = _pluginCustomizedCmds.size(); i < len ; i++) for (size_t i = 0, len = _pluginCustomizedCmds.size(); i < len ; ++i)
{ {
insertPluginCmd(pluginCmdRoot, _pluginCommands[_pluginCustomizedCmds[i]]); insertPluginCmd(pluginCmdRoot, _pluginCommands[_pluginCustomizedCmds[i]]);
} }
@ -2548,7 +2548,7 @@ void NppParameters::writeShortcuts()
root->RemoveChild(scitillaKeyRoot); root->RemoveChild(scitillaKeyRoot);
scitillaKeyRoot = root->InsertEndChild(TiXmlElement(TEXT("ScintillaKeys"))); scitillaKeyRoot = root->InsertEndChild(TiXmlElement(TEXT("ScintillaKeys")));
for (size_t i = 0, len = _scintillaModifiedKeyIndices.size(); i < len ; i++) for (size_t i = 0, len = _scintillaModifiedKeyIndices.size(); i < len ; ++i)
{ {
insertScintKey(scitillaKeyRoot, _scintillaKeyCommands[_scintillaModifiedKeyIndices[i]]); insertScintKey(scitillaKeyRoot, _scintillaKeyCommands[_scintillaModifiedKeyIndices[i]]);
} }
@ -2562,7 +2562,7 @@ int NppParameters::addUserLangToEnd(const UserLangContainer & userLang, const TC
_userLangArray[_nbUserLang] = new UserLangContainer(); _userLangArray[_nbUserLang] = new UserLangContainer();
*(_userLangArray[_nbUserLang]) = userLang; *(_userLangArray[_nbUserLang]) = userLang;
_userLangArray[_nbUserLang]->_name = newName; _userLangArray[_nbUserLang]->_name = newName;
_nbUserLang++; ++_nbUserLang;
return _nbUserLang-1; return _nbUserLang-1;
} }
@ -2571,7 +2571,7 @@ void NppParameters::removeUserLang(int index)
if (index >= _nbUserLang ) if (index >= _nbUserLang )
return; return;
delete _userLangArray[index]; delete _userLangArray[index];
for (int i = index ; i < (_nbUserLang - 1) ; i++) for (int i = index ; i < (_nbUserLang - 1) ; ++i)
_userLangArray[i] = _userLangArray[i+1]; _userLangArray[i] = _userLangArray[i+1];
_nbUserLang--; _nbUserLang--;
} }
@ -2604,7 +2604,7 @@ void NppParameters::feedUserSettings(TiXmlNode *settingsRoot)
const TCHAR *udlVersion = _userLangArray[_nbUserLang - 1]->_udlVersion.c_str(); const TCHAR *udlVersion = _userLangArray[_nbUserLang - 1]->_udlVersion.c_str();
if (!lstrcmp(udlVersion, TEXT("2.1")) || !lstrcmp(udlVersion, TEXT("2.0"))) if (!lstrcmp(udlVersion, TEXT("2.1")) || !lstrcmp(udlVersion, TEXT("2.0")))
{ {
for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; i++) for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; ++i)
{ {
boolStr = (prefixNode->ToElement())->Attribute(globalMappper().keywordNameMapper[i+SCE_USER_KWLIST_KEYWORDS1]); boolStr = (prefixNode->ToElement())->Attribute(globalMappper().keywordNameMapper[i+SCE_USER_KWLIST_KEYWORDS1]);
if (boolStr) if (boolStr)
@ -2614,7 +2614,7 @@ void NppParameters::feedUserSettings(TiXmlNode *settingsRoot)
else // support for old style (pre 2.0) else // support for old style (pre 2.0)
{ {
TCHAR names[SCE_USER_TOTAL_KEYWORD_GROUPS][7] = {TEXT("words1"), TEXT("words2"), TEXT("words3"), TEXT("words4")}; TCHAR names[SCE_USER_TOTAL_KEYWORD_GROUPS][7] = {TEXT("words1"), TEXT("words2"), TEXT("words3"), TEXT("words4")};
for (int i = 0 ; i < 4 ; i++) for (int i = 0 ; i < 4 ; ++i)
{ {
boolStr = (prefixNode->ToElement())->Attribute(names[i]); boolStr = (prefixNode->ToElement())->Attribute(names[i]);
if (boolStr) if (boolStr)
@ -2809,7 +2809,7 @@ void LexerStylerArray::addLexerStyler(const TCHAR *lexerName, const TCHAR *lexer
void LexerStylerArray::eraseAll() void LexerStylerArray::eraseAll()
{ {
for (int i = 0 ; i < _nbLexerStyler ; i++) for (int i = 0 ; i < _nbLexerStyler ; ++i)
{ {
_lexerStylerArray[i].setNbStyler( 0 ); _lexerStylerArray[i].setNbStyler( 0 );
} }
@ -2902,7 +2902,7 @@ void StyleArray::addStyler(int styleID, TiXmlNode *styleNode)
_styleArray[index]._keywords = new generic_string(v->Value()); _styleArray[index]._keywords = new generic_string(v->Value());
} }
} }
_nbStyler++; ++_nbStyler;
} }
bool NppParameters::writeRecentFileHistorySettings(int nbMaxFile) const bool NppParameters::writeRecentFileHistorySettings(int nbMaxFile) const
@ -2939,7 +2939,7 @@ bool NppParameters::writeProjectPanelsSettings() const
projPanelRootNode = new TiXmlElement(TEXT("ProjectPanels")); projPanelRootNode = new TiXmlElement(TEXT("ProjectPanels"));
// Add 3 Project Panel parameters // Add 3 Project Panel parameters
for (int i = 0 ; i < 3 ; i++) for (int i = 0 ; i < 3 ; ++i)
{ {
TiXmlElement projPanelNode(TEXT("ProjectPanel")); TiXmlElement projPanelNode(TEXT("ProjectPanel"));
(projPanelNode.ToElement())->SetAttribute(TEXT("id"), i); (projPanelNode.ToElement())->SetAttribute(TEXT("id"), i);
@ -2990,7 +2990,7 @@ TiXmlNode * NppParameters::getChildElementByAttribut(TiXmlNode *pere, const TCHA
LangType NppParameters::getLangIDFromStr(const TCHAR *langName) LangType NppParameters::getLangIDFromStr(const TCHAR *langName)
{ {
int lang = (int)L_TEXT; int lang = (int)L_TEXT;
for(; lang < L_EXTERNAL; lang++) { for(; lang < L_EXTERNAL; ++lang) {
const TCHAR * name = ScintillaEditView::langNames[lang].lexerName; const TCHAR * name = ScintillaEditView::langNames[lang].lexerName;
if (!lstrcmp(name, langName)) { //found lang? if (!lstrcmp(name, langName)) { //found lang?
return (LangType)lang; return (LangType)lang;
@ -3048,7 +3048,7 @@ void NppParameters::feedKeyWordsParameters(TiXmlNode *node)
if (i >= 0 && i <= KEYWORDSET_MAX) if (i >= 0 && i <= KEYWORDSET_MAX)
_langList[_nbLang]->setWords(keyWords, i); _langList[_nbLang]->setWords(keyWords, i);
} }
_nbLang++; ++_nbLang;
} }
} }
} }
@ -3586,10 +3586,10 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
g7 = i; g7 = i;
bool langArray[nbMax]; bool langArray[nbMax];
for (int i = 0 ; i < nbMax ; i++) langArray[i] = false; for (int i = 0 ; i < nbMax ; ++i) langArray[i] = false;
UCHAR mask = 1; UCHAR mask = 1;
for (int i = 0 ; i < 8 ; i++) for (int i = 0 ; i < 8 ; ++i)
{ {
if (mask & g0) if (mask & g0)
_nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i));
@ -3597,7 +3597,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
} }
mask = 1; mask = 1;
for (int i = 8 ; i < 16 ; i++) for (int i = 8 ; i < 16 ; ++i)
{ {
if (mask & g1) if (mask & g1)
_nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i));
@ -3605,7 +3605,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
} }
mask = 1; mask = 1;
for (int i = 16 ; i < 24 ; i++) for (int i = 16 ; i < 24 ; ++i)
{ {
if (mask & g2) if (mask & g2)
_nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i));
@ -3613,7 +3613,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
} }
mask = 1; mask = 1;
for (int i = 24 ; i < 32 ; i++) for (int i = 24 ; i < 32 ; ++i)
{ {
if (mask & g3) if (mask & g3)
_nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i));
@ -3621,7 +3621,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
} }
mask = 1; mask = 1;
for (int i = 32 ; i < 40 ; i++) for (int i = 32 ; i < 40 ; ++i)
{ {
if (mask & g4) if (mask & g4)
_nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i));
@ -3629,7 +3629,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
} }
mask = 1; mask = 1;
for (int i = 40 ; i < 48 ; i++) for (int i = 40 ; i < 48 ; ++i)
{ {
if (mask & g5) if (mask & g5)
_nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i));
@ -3637,7 +3637,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
} }
mask = 1; mask = 1;
for (int i = 48 ; i < 56 ; i++) for (int i = 48 ; i < 56 ; ++i)
{ {
if (mask & g6) if (mask & g6)
_nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i));
@ -3645,7 +3645,7 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
} }
mask = 1; mask = 1;
for (int i = 56 ; i < 64 ; i++) for (int i = 56 ; i < 64 ; ++i)
{ {
if (mask & g7) if (mask & g7)
_nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i));
@ -4861,28 +4861,28 @@ bool NppParameters::writeFindHistory()
TiXmlElement hist_element(TEXT("")); TiXmlElement hist_element(TEXT(""));
hist_element.SetValue(TEXT("Path")); hist_element.SetValue(TEXT("Path"));
for (size_t i = 0, len = _findHistory._findHistoryPaths.size(); i < len; i++) for (size_t i = 0, len = _findHistory._findHistoryPaths.size(); i < len; ++i)
{ {
(hist_element.ToElement())->SetAttribute(TEXT("name"), _findHistory._findHistoryPaths[i].c_str()); (hist_element.ToElement())->SetAttribute(TEXT("name"), _findHistory._findHistoryPaths[i].c_str());
findHistoryRoot->InsertEndChild(hist_element); findHistoryRoot->InsertEndChild(hist_element);
} }
hist_element.SetValue(TEXT("Filter")); hist_element.SetValue(TEXT("Filter"));
for (size_t i = 0, len = _findHistory._findHistoryFilters.size(); i < len; i++) for (size_t i = 0, len = _findHistory._findHistoryFilters.size(); i < len; ++i)
{ {
(hist_element.ToElement())->SetAttribute(TEXT("name"), _findHistory._findHistoryFilters[i].c_str()); (hist_element.ToElement())->SetAttribute(TEXT("name"), _findHistory._findHistoryFilters[i].c_str());
findHistoryRoot->InsertEndChild(hist_element); findHistoryRoot->InsertEndChild(hist_element);
} }
hist_element.SetValue(TEXT("Find")); hist_element.SetValue(TEXT("Find"));
for (size_t i = 0, len = _findHistory._findHistoryFinds.size(); i < len; i++) for (size_t i = 0, len = _findHistory._findHistoryFinds.size(); i < len; ++i)
{ {
(hist_element.ToElement())->SetAttribute(TEXT("name"), _findHistory._findHistoryFinds[i].c_str()); (hist_element.ToElement())->SetAttribute(TEXT("name"), _findHistory._findHistoryFinds[i].c_str());
findHistoryRoot->InsertEndChild(hist_element); findHistoryRoot->InsertEndChild(hist_element);
} }
hist_element.SetValue(TEXT("Replace")); hist_element.SetValue(TEXT("Replace"));
for (size_t i = 0, len = _findHistory._findHistoryReplaces.size(); i < len; i++) for (size_t i = 0, len = _findHistory._findHistoryReplaces.size(); i < len; ++i)
{ {
(hist_element.ToElement())->SetAttribute(TEXT("name"), _findHistory._findHistoryReplaces[i].c_str()); (hist_element.ToElement())->SetAttribute(TEXT("name"), _findHistory._findHistoryReplaces[i].c_str());
findHistoryRoot->InsertEndChild(hist_element); findHistoryRoot->InsertEndChild(hist_element);
@ -4900,7 +4900,7 @@ void NppParameters::insertDockingParamNode(TiXmlNode *GUIRoot)
DMNode.SetAttribute(TEXT("topHeight"), _nppGUI._dockingData._topHeight); DMNode.SetAttribute(TEXT("topHeight"), _nppGUI._dockingData._topHeight);
DMNode.SetAttribute(TEXT("bottomHeight"), _nppGUI._dockingData._bottomHight); DMNode.SetAttribute(TEXT("bottomHeight"), _nppGUI._dockingData._bottomHight);
for (size_t i = 0, len = _nppGUI._dockingData._flaotingWindowInfo.size(); i < len ; i++) for (size_t i = 0, len = _nppGUI._dockingData._flaotingWindowInfo.size(); i < len ; ++i)
{ {
FloatingWindowInfo & fwi = _nppGUI._dockingData._flaotingWindowInfo[i]; FloatingWindowInfo & fwi = _nppGUI._dockingData._flaotingWindowInfo[i];
TiXmlElement FWNode(TEXT("FloatingWindow")); TiXmlElement FWNode(TEXT("FloatingWindow"));
@ -4913,7 +4913,7 @@ void NppParameters::insertDockingParamNode(TiXmlNode *GUIRoot)
DMNode.InsertEndChild(FWNode); DMNode.InsertEndChild(FWNode);
} }
for (size_t i = 0, len = _nppGUI._dockingData._pluginDockInfo.size() ; i < len ; i++) for (size_t i = 0, len = _nppGUI._dockingData._pluginDockInfo.size() ; i < len ; ++i)
{ {
PluginDlgDockingInfo & pdi = _nppGUI._dockingData._pluginDockInfo[i]; PluginDlgDockingInfo & pdi = _nppGUI._dockingData._pluginDockInfo[i];
TiXmlElement PDNode(TEXT("PluginDlg")); TiXmlElement PDNode(TEXT("PluginDlg"));
@ -4926,7 +4926,7 @@ void NppParameters::insertDockingParamNode(TiXmlNode *GUIRoot)
DMNode.InsertEndChild(PDNode); DMNode.InsertEndChild(PDNode);
} }
for (size_t i = 0, len = _nppGUI._dockingData._containerTabInfo.size(); i < len ; i++) for (size_t i = 0, len = _nppGUI._dockingData._containerTabInfo.size(); i < len ; ++i)
{ {
ContainerTabInfo & cti = _nppGUI._dockingData._containerTabInfo[i]; ContainerTabInfo & cti = _nppGUI._dockingData._containerTabInfo[i];
TiXmlElement CTNode(TEXT("ActiveTabs")); TiXmlElement CTNode(TEXT("ActiveTabs"));
@ -4976,7 +4976,7 @@ void NppParameters::writeExcludedLangList(TiXmlElement *element)
int g6 = 0; // up to 56 int g6 = 0; // up to 56
int g7 = 0; // up to 64 int g7 = 0; // up to 64
for (size_t i = 0, len = _nppGUI._excludedLangList.size(); i < len ; i++) for (size_t i = 0, len = _nppGUI._excludedLangList.size(); i < len ; ++i)
{ {
LangType langType = _nppGUI._excludedLangList[i]._langType; LangType langType = _nppGUI._excludedLangList[i]._langType;
if (langType >= L_EXTERNAL && langType < L_END) if (langType >= L_EXTERNAL && langType < L_END)
@ -5215,7 +5215,7 @@ void NppParameters::writeStyles(LexerStylerArray & lexersStylers, StyleArray & g
} }
} }
for(size_t x = 0; x < _pXmlExternalLexerDoc.size(); x++) for(size_t x = 0; x < _pXmlExternalLexerDoc.size(); ++x)
{ {
TiXmlNode *lexersRoot = ( _pXmlExternalLexerDoc[x]->FirstChild(TEXT("NotepadPlus")))->FirstChildElement(TEXT("LexerStyles")); TiXmlNode *lexersRoot = ( _pXmlExternalLexerDoc[x]->FirstChild(TEXT("NotepadPlus")))->FirstChildElement(TEXT("LexerStyles"));
for (TiXmlNode *childNode = lexersRoot->FirstChildElement(TEXT("LexerType")); for (TiXmlNode *childNode = lexersRoot->FirstChildElement(TEXT("LexerType"));
@ -5379,13 +5379,13 @@ void NppParameters::insertUserLang2Tree(TiXmlNode *node, UserLangContainer *user
globalElement->SetAttribute(TEXT("decimalSeparator"), userLang->_decimalSeparator); globalElement->SetAttribute(TEXT("decimalSeparator"), userLang->_decimalSeparator);
TiXmlElement *prefixElement = (settingsElement->InsertEndChild(TiXmlElement(TEXT("Prefix"))))->ToElement(); TiXmlElement *prefixElement = (settingsElement->InsertEndChild(TiXmlElement(TEXT("Prefix"))))->ToElement();
for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; i++) for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; ++i)
prefixElement->SetAttribute(globalMappper().keywordNameMapper[i+SCE_USER_KWLIST_KEYWORDS1], userLang->_isPrefix[i]?TEXT("yes"):TEXT("no")); prefixElement->SetAttribute(globalMappper().keywordNameMapper[i+SCE_USER_KWLIST_KEYWORDS1], userLang->_isPrefix[i]?TEXT("yes"):TEXT("no"));
} }
TiXmlElement *kwlElement = (rootElement->InsertEndChild(TiXmlElement(TEXT("KeywordLists"))))->ToElement(); TiXmlElement *kwlElement = (rootElement->InsertEndChild(TiXmlElement(TEXT("KeywordLists"))))->ToElement();
for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; i++) for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; ++i)
{ {
TiXmlElement *kwElement = (kwlElement->InsertEndChild(TiXmlElement(TEXT("Keywords"))))->ToElement(); TiXmlElement *kwElement = (kwlElement->InsertEndChild(TiXmlElement(TEXT("Keywords"))))->ToElement();
kwElement->SetAttribute(TEXT("name"), globalMappper().keywordNameMapper[i]); kwElement->SetAttribute(TEXT("name"), globalMappper().keywordNameMapper[i]);
@ -5394,7 +5394,7 @@ void NppParameters::insertUserLang2Tree(TiXmlNode *node, UserLangContainer *user
TiXmlElement *styleRootElement = (rootElement->InsertEndChild(TiXmlElement(TEXT("Styles"))))->ToElement(); TiXmlElement *styleRootElement = (rootElement->InsertEndChild(TiXmlElement(TEXT("Styles"))))->ToElement();
for (int i = 0 ; i < SCE_USER_STYLE_TOTAL_STYLES ; i++) for (int i = 0 ; i < SCE_USER_STYLE_TOTAL_STYLES ; ++i)
{ {
TiXmlElement *styleElement = (styleRootElement->InsertEndChild(TiXmlElement(TEXT("WordsStyle"))))->ToElement(); TiXmlElement *styleElement = (styleRootElement->InsertEndChild(TiXmlElement(TEXT("WordsStyle"))))->ToElement();
Style style2Write = userLang->_styleArray.getStyler(i); Style style2Write = userLang->_styleArray.getStyler(i);
@ -5453,9 +5453,9 @@ void NppParameters::insertUserLang2Tree(TiXmlNode *node, UserLangContainer *user
void NppParameters::stylerStrOp(bool op) void NppParameters::stylerStrOp(bool op)
{ {
for (int i = 0 ; i < _nbUserLang ; i++) for (int i = 0 ; i < _nbUserLang ; ++i)
{ {
for (int j = 0 ; j < SCE_USER_STYLE_TOTAL_STYLES ; j++) for (int j = 0 ; j < SCE_USER_STYLE_TOTAL_STYLES ; ++j)
{ {
Style & style = _userLangArray[i]->_styleArray.getStyler(j); Style & style = _userLangArray[i]->_styleArray.getStyler(j);
@ -5488,7 +5488,7 @@ void NppParameters::addUserModifiedIndex(int index)
{ {
size_t len = _customizedShortcuts.size(); size_t len = _customizedShortcuts.size();
bool found = false; bool found = false;
for(size_t i = 0; i < len; i++) for(size_t i = 0; i < len; ++i)
{ {
if (_customizedShortcuts[i] == index) if (_customizedShortcuts[i] == index)
{ {
@ -5506,7 +5506,7 @@ void NppParameters::addPluginModifiedIndex(int index)
{ {
size_t len = _pluginCustomizedCmds.size(); size_t len = _pluginCustomizedCmds.size();
bool found = false; bool found = false;
for(size_t i = 0; i < len; i++) for(size_t i = 0; i < len; ++i)
{ {
if (_pluginCustomizedCmds[i] == index) if (_pluginCustomizedCmds[i] == index)
{ {
@ -5524,7 +5524,7 @@ void NppParameters::addScintillaModifiedIndex(int index)
{ {
size_t len = _scintillaModifiedKeyIndices.size(); size_t len = _scintillaModifiedKeyIndices.size();
bool found = false; bool found = false;
for(size_t i = 0; i < len; i++) for(size_t i = 0; i < len; ++i)
{ {
if (_scintillaModifiedKeyIndices[i] == index) if (_scintillaModifiedKeyIndices[i] == index)
{ {

View File

@ -240,7 +240,7 @@ struct DockingManagerData {
vector<ContainerTabInfo> _containerTabInfo; vector<ContainerTabInfo> _containerTabInfo;
bool getFloatingRCFrom(int floatCont, RECT & rc) { bool getFloatingRCFrom(int floatCont, RECT & rc) {
for (size_t i = 0, fwiLen = _flaotingWindowInfo.size(); i < fwiLen; i++) for (size_t i = 0, fwiLen = _flaotingWindowInfo.size(); i < fwiLen; ++i)
{ {
if (_flaotingWindowInfo[i]._cont == floatCont) if (_flaotingWindowInfo[i]._cont == floatCont)
{ {
@ -366,7 +366,7 @@ public:
if (this != &sa) if (this != &sa)
{ {
this->_nbStyler = sa._nbStyler; this->_nbStyler = sa._nbStyler;
for (int i = 0 ; i < _nbStyler ; i++) for (int i = 0 ; i < _nbStyler ; ++i)
{ {
this->_styleArray[i] = sa._styleArray[i]; this->_styleArray[i] = sa._styleArray[i];
} }
@ -391,11 +391,11 @@ public:
_styleArray[styleID]._styleDesc = styleName; _styleArray[styleID]._styleDesc = styleName;
_styleArray[styleID]._fgColor = black; _styleArray[styleID]._fgColor = black;
_styleArray[styleID]._bgColor = white; _styleArray[styleID]._bgColor = white;
_nbStyler++; ++_nbStyler;
}; };
int getStylerIndexByID(int id) { int getStylerIndexByID(int id) {
for (int i = 0 ; i < _nbStyler ; i++) for (int i = 0 ; i < _nbStyler ; ++i)
if (_styleArray[i]._styleID == id) if (_styleArray[i]._styleID == id)
return i; return i;
return -1; return -1;
@ -404,7 +404,7 @@ public:
int getStylerIndexByName(const TCHAR *name) const { int getStylerIndexByName(const TCHAR *name) const {
if (!name) if (!name)
return -1; return -1;
for (int i = 0 ; i < _nbStyler ; i++) for (int i = 0 ; i < _nbStyler ; ++i)
if (!lstrcmp(_styleArray[i]._styleDesc, name)) if (!lstrcmp(_styleArray[i]._styleDesc, name))
return i; return i;
return -1; return -1;
@ -466,7 +466,7 @@ public :
if (this != &lsa) if (this != &lsa)
{ {
this->_nbLexerStyler = lsa._nbLexerStyler; this->_nbLexerStyler = lsa._nbLexerStyler;
for (int i = 0 ; i < this->_nbLexerStyler ; i++) for (int i = 0 ; i < this->_nbLexerStyler ; ++i)
this->_lexerStylerArray[i] = lsa._lexerStylerArray[i]; this->_lexerStylerArray[i] = lsa._lexerStylerArray[i];
} }
return *this; return *this;
@ -484,7 +484,7 @@ public :
LexerStyler * getLexerStylerByName(const TCHAR *lexerName) { LexerStyler * getLexerStylerByName(const TCHAR *lexerName) {
if (!lexerName) return NULL; if (!lexerName) return NULL;
for (int i = 0 ; i < _nbLexerStyler ; i++) for (int i = 0 ; i < _nbLexerStyler ; ++i)
{ {
if (!lstrcmp(_lexerStylerArray[i].getLexerName(), lexerName)) if (!lstrcmp(_lexerStylerArray[i].getLexerName(), lexerName))
return &(_lexerStylerArray[i]); return &(_lexerStylerArray[i]);
@ -835,12 +835,12 @@ struct Lang
Lang(): _langID(L_TEXT), _langName(TEXT("")), _defaultExtList(NULL), _pCommentLineSymbol(NULL), _pCommentStart(NULL), Lang(): _langID(L_TEXT), _langName(TEXT("")), _defaultExtList(NULL), _pCommentLineSymbol(NULL), _pCommentStart(NULL),
_pCommentEnd(NULL), _isTabReplacedBySpace(false), _tabSize(-1) { _pCommentEnd(NULL), _isTabReplacedBySpace(false), _tabSize(-1) {
for (int i = 0 ; i < NB_LIST ; _langKeyWordList[i] = NULL ,i++); for (int i = 0 ; i < NB_LIST ; _langKeyWordList[i] = NULL, ++i);
}; };
Lang(LangType langID, const TCHAR *name) : _langID(langID), _langName(name?name:TEXT("")),\ Lang(LangType langID, const TCHAR *name) : _langID(langID), _langName(name?name:TEXT("")),\
_defaultExtList(NULL), _pCommentLineSymbol(NULL), _pCommentStart(NULL),\ _defaultExtList(NULL), _pCommentLineSymbol(NULL), _pCommentStart(NULL),\
_pCommentEnd(NULL), _isTabReplacedBySpace(false), _tabSize(-1) { _pCommentEnd(NULL), _isTabReplacedBySpace(false), _tabSize(-1) {
for (int i = 0 ; i < NB_LIST ; _langKeyWordList[i] = NULL ,i++); for (int i = 0 ; i < NB_LIST ; _langKeyWordList[i] = NULL, ++i);
}; };
~Lang() {}; ~Lang() {};
void setDefaultExtList(const TCHAR *extLst){ void setDefaultExtList(const TCHAR *extLst){
@ -913,10 +913,10 @@ public :
_foldCompact = false; _foldCompact = false;
_isCaseIgnored = false; _isCaseIgnored = false;
for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; i++) for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; ++i)
*_keywordLists[i] = '\0'; *_keywordLists[i] = '\0';
for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; i++) for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; ++i)
_isPrefix[i] = false; _isPrefix[i] = false;
}; };
UserLangContainer(const TCHAR *name, const TCHAR *ext, const TCHAR *udlVer) : _name(name), _ext(ext), _udlVersion(udlVer) { UserLangContainer(const TCHAR *name, const TCHAR *ext, const TCHAR *udlVer) : _name(name), _ext(ext), _udlVersion(udlVer) {
@ -925,10 +925,10 @@ public :
_decimalSeparator = DECSEP_DOT; _decimalSeparator = DECSEP_DOT;
_foldCompact = false; _foldCompact = false;
for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; i++) for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; ++i)
*_keywordLists[i] = '\0'; *_keywordLists[i] = '\0';
for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; i++) for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; ++i)
_isPrefix[i] = false; _isPrefix[i] = false;
}; };
@ -945,7 +945,7 @@ public :
this->_decimalSeparator = ulc._decimalSeparator; this->_decimalSeparator = ulc._decimalSeparator;
this->_foldCompact = ulc._foldCompact; this->_foldCompact = ulc._foldCompact;
int nbStyler = this->_styleArray.getNbStyler(); int nbStyler = this->_styleArray.getNbStyler();
for (int i = 0 ; i < nbStyler ; i++) for (int i = 0 ; i < nbStyler ; ++i)
{ {
Style & st = this->_styleArray.getStyler(i); Style & st = this->_styleArray.getStyler(i);
if (st._bgColor == COLORREF(-1)) if (st._bgColor == COLORREF(-1))
@ -953,10 +953,10 @@ public :
if (st._fgColor == COLORREF(-1)) if (st._fgColor == COLORREF(-1))
st._fgColor = black; st._fgColor = black;
} }
for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; i++) for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; ++i)
lstrcpy(this->_keywordLists[i], ulc._keywordLists[i]); lstrcpy(this->_keywordLists[i], ulc._keywordLists[i]);
for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; i++) for (int i = 0 ; i < SCE_USER_TOTAL_KEYWORD_GROUPS ; ++i)
_isPrefix[i] = ulc._isPrefix[i]; _isPrefix[i] = ulc._isPrefix[i];
} }
return *this; return *this;
@ -1108,7 +1108,7 @@ public :
}; };
bool themeNameExists(const TCHAR *themeName) { bool themeNameExists(const TCHAR *themeName) {
for (size_t i = 0; i < _themeList.size(); i++ ) for (size_t i = 0; i < _themeList.size(); ++i )
{ {
if (! (getElementFromIndex(i)).first.compare(themeName) ) return true; if (! (getElementFromIndex(i)).first.compare(themeName) ) return true;
} }
@ -1172,7 +1172,7 @@ public:
}; };
Lang * getLangFromID(LangType langID) const { Lang * getLangFromID(LangType langID) const {
for (int i = 0 ; i < _nbLang ; i++) for (int i = 0 ; i < _nbLang ; ++i)
{ {
if ((_langList[i]->_langID == langID) || (!_langList[i])) if ((_langList[i]->_langID == langID) || (!_langList[i]))
return _langList[i]; return _langList[i];
@ -1190,7 +1190,7 @@ public:
LangType getLangFromExt(const TCHAR *ext); LangType getLangFromExt(const TCHAR *ext);
const TCHAR * getLangExtFromName(const TCHAR *langName) const { const TCHAR * getLangExtFromName(const TCHAR *langName) const {
for (int i = 0 ; i < _nbLang ; i++) for (int i = 0 ; i < _nbLang ; ++i)
{ {
if (_langList[i]->_langName == langName) if (_langList[i]->_langName == langName)
return _langList[i]->_defaultExtList; return _langList[i]->_defaultExtList;
@ -1199,7 +1199,7 @@ public:
}; };
const TCHAR * getLangExtFromLangType(LangType langType) const { const TCHAR * getLangExtFromLangType(LangType langType) const {
for (int i = 0 ; i < _nbLang ; i++) for (int i = 0 ; i < _nbLang ; ++i)
{ {
if (_langList[i]->_langID == langType) if (_langList[i]->_langID == langType)
return _langList[i]->_defaultExtList; return _langList[i]->_defaultExtList;
@ -1276,7 +1276,7 @@ public:
int getNbUserLang() const {return _nbUserLang;}; int getNbUserLang() const {return _nbUserLang;};
UserLangContainer & getULCFromIndex(int i) {return *_userLangArray[i];}; UserLangContainer & getULCFromIndex(int i) {return *_userLangArray[i];};
UserLangContainer * getULCFromName(const TCHAR *userLangName) { UserLangContainer * getULCFromName(const TCHAR *userLangName) {
for (int i = 0 ; i < _nbUserLang ; i++) for (int i = 0 ; i < _nbUserLang ; ++i)
if (!lstrcmp(userLangName, _userLangArray[i]->_name.c_str())) if (!lstrcmp(userLangName, _userLangArray[i]->_name.c_str()))
return _userLangArray[i]; return _userLangArray[i];
//qui doit etre jamais passer //qui doit etre jamais passer
@ -1285,7 +1285,7 @@ public:
int getNbExternalLang() const {return _nbExternalLang;}; int getNbExternalLang() const {return _nbExternalLang;};
int getExternalLangIndexFromName(const TCHAR *externalLangName) const { int getExternalLangIndexFromName(const TCHAR *externalLangName) const {
for (int i = 0 ; i < _nbExternalLang ; i++) for (int i = 0 ; i < _nbExternalLang ; ++i)
{ {
if (!lstrcmp(externalLangName, _externalLangArray[i]->_name)) if (!lstrcmp(externalLangName, _externalLangArray[i]->_name))
return i; return i;
@ -1308,7 +1308,7 @@ public:
if ((!newName) || (!newName[0])) if ((!newName) || (!newName[0]))
return true; return true;
for (int i = 0 ; i < _nbUserLang ; i++) for (int i = 0 ; i < _nbUserLang ; ++i)
{ {
if (!lstrcmp(_userLangArray[i]->_name.c_str(), newName)) if (!lstrcmp(_userLangArray[i]->_name.c_str(), newName))
return true; return true;
@ -1320,11 +1320,11 @@ public:
if ((!ext) || (!ext[0])) if ((!ext) || (!ext[0]))
return NULL; return NULL;
for (int i = 0 ; i < _nbUserLang ; i++) for (int i = 0 ; i < _nbUserLang ; ++i)
{ {
vector<generic_string> extVect; vector<generic_string> extVect;
cutString(_userLangArray[i]->_ext.c_str(), extVect); cutString(_userLangArray[i]->_ext.c_str(), extVect);
for (size_t j = 0, len = extVect.size(); j < len; 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))) if (!generic_stricmp(extVect[j].c_str(), ext) || (_tcschr(fullName, '.') && !generic_stricmp(extVect[j].c_str(), fullName)))
return _userLangArray[i]->_name.c_str(); return _userLangArray[i]->_name.c_str();
} }
@ -1338,7 +1338,7 @@ public:
if ((!newName) || (!newName[0])) if ((!newName) || (!newName[0]))
return true; return true;
for (int i = 0 ; i < _nbExternalLang ; i++) for (int i = 0 ; i < _nbExternalLang ; ++i)
{ {
if (!lstrcmp(_externalLangArray[i]->_name, newName)) if (!lstrcmp(_externalLangArray[i]->_name, newName))
return true; return true;
@ -1461,7 +1461,7 @@ public:
vector<generic_string> & getBlackList() {return _blacklist;}; vector<generic_string> & getBlackList() {return _blacklist;};
bool isInBlackList(TCHAR *fn) { bool isInBlackList(TCHAR *fn) {
for (size_t i = 0, len = _blacklist.size(); i < len ; i++) for (size_t i = 0, len = _blacklist.size(); i < len ; ++i)
if (_blacklist[i] == fn) if (_blacklist[i] == fn)
return true; return true;
return false; return false;

View File

@ -33,7 +33,7 @@
static bool isInList(generic_string word, const vector<generic_string> & wordArray) static bool isInList(generic_string word, const vector<generic_string> & wordArray)
{ {
for (size_t i = 0, len = wordArray.size(); i < len; i++) for (size_t i = 0, len = wordArray.size(); i < len; ++i)
if (wordArray[i] == word) if (wordArray[i] == word)
return true; return true;
return false; return false;
@ -59,11 +59,11 @@ bool AutoCompletion::showAutoComplete() {
{ {
c = lineBuffer[offset]; c = lineBuffer[offset];
if (isalnum(c) || c == '_') { if (isalnum(c) || c == '_') {
nrChars++; ++nrChars;
} else { } else {
break; break;
} }
offset--; --offset;
} }
startWordPos = curPos-nrChars; startWordPos = curPos-nrChars;
@ -135,7 +135,7 @@ bool AutoCompletion::showWordComplete(bool autoInsert)
sort(wordArray.begin(), wordArray.end()); sort(wordArray.begin(), wordArray.end());
generic_string words(TEXT("")); generic_string words(TEXT(""));
for (size_t i = 0, len = wordArray.size(); i < len; i++) for (size_t i = 0, len = wordArray.size(); i < len; ++i)
{ {
words += wordArray[i]; words += wordArray[i];
if (i != wordArray.size()-1) if (i != wordArray.size()-1)

View File

@ -282,7 +282,7 @@ void Buffer::setHeaderLineState(const std::vector<size_t> & folds, ScintillaEdit
std::vector<size_t> & local = _foldStates[index]; std::vector<size_t> & local = _foldStates[index];
local.clear(); local.clear();
size_t size = folds.size(); size_t size = folds.size();
for(size_t i = 0; i < size; i++) { for(size_t i = 0; i < size; ++i) {
local.push_back(folds[i]); local.push_back(folds[i]);
} }
} }
@ -295,20 +295,20 @@ const std::vector<size_t> & Buffer::getHeaderLineState(const ScintillaEditView *
Lang * Buffer::getCurrentLang() const { Lang * Buffer::getCurrentLang() const {
NppParameters *pNppParam = NppParameters::getInstance(); NppParameters *pNppParam = NppParameters::getInstance();
int i = 0; int i = 0;
Lang *l = pNppParam->getLangFromIndex(i++); Lang *l = pNppParam->getLangFromIndex(++i);
while (l) while (l)
{ {
if (l->_langID == _lang) if (l->_langID == _lang)
return l; return l;
l = pNppParam->getLangFromIndex(i++); l = pNppParam->getLangFromIndex(++i);
} }
return NULL; return NULL;
}; };
int Buffer::indexOfReference(const ScintillaEditView * identifier) const { int Buffer::indexOfReference(const ScintillaEditView * identifier) const {
int size = (int)_referees.size(); int size = (int)_referees.size();
for(int i = 0; i < size; i++) { for(int i = 0; i < size; ++i) {
if (_referees[i] == identifier) if (_referees[i] == identifier)
return i; return i;
} }
@ -321,7 +321,7 @@ int Buffer::addReference(ScintillaEditView * identifier) {
_referees.push_back(identifier); _referees.push_back(identifier);
_positions.push_back(Position()); _positions.push_back(Position());
_foldStates.push_back(std::vector<size_t>()); _foldStates.push_back(std::vector<size_t>());
_references++; ++_references;
return _references; return _references;
} }
@ -338,13 +338,13 @@ int Buffer::removeReference(ScintillaEditView * identifier) {
void Buffer::setHideLineChanged(bool isHide, int location) { void Buffer::setHideLineChanged(bool isHide, int location) {
//First run through all docs without removing markers //First run through all docs without removing markers
for(int i = 0; i < _references; i++) { for(int i = 0; i < _references; ++i) {
_referees.at(i)->notifyMarkers(this, isHide, location, false);//(i == _references-1)); _referees.at(i)->notifyMarkers(this, isHide, location, false);//(i == _references-1));
} }
if (!isHide) { //no deleting if hiding lines if (!isHide) { //no deleting if hiding lines
//Then all docs to remove markers. //Then all docs to remove markers.
for(int i = 0; i < _references; i++) { for(int i = 0; i < _references; ++i) {
_referees.at(i)->notifyMarkers(this, isHide, location, true); _referees.at(i)->notifyMarkers(this, isHide, location, true);
} }
} }
@ -419,7 +419,7 @@ void FileManager::checkFilesystemChanges() {
} }
int FileManager::getBufferIndexByID(BufferID id) { int FileManager::getBufferIndexByID(BufferID id) {
for(size_t i = 0; i < _nrBufs; i++) { for(size_t i = 0; i < _nrBufs; ++i) {
if (_buffers[i]->_id == id) if (_buffers[i]->_id == id)
return (int)i; return (int)i;
} }
@ -475,7 +475,7 @@ BufferID FileManager::loadFile(const TCHAR * filename, Document doc, int encodin
BufferID id = (BufferID) newBuf; BufferID id = (BufferID) newBuf;
newBuf->_id = id; newBuf->_id = id;
_buffers.push_back(newBuf); _buffers.push_back(newBuf);
_nrBufs++; ++_nrBufs;
Buffer * buf = _buffers.at(_nrBufs - 1); Buffer * buf = _buffers.at(_nrBufs - 1);
// restore the encoding (ANSI based) while opening the existing file // restore the encoding (ANSI based) while opening the existing file
@ -520,7 +520,7 @@ BufferID FileManager::loadFile(const TCHAR * filename, Document doc, int encodin
buf->setFormat(format); buf->setFormat(format);
} }
//determine buffer properties //determine buffer properties
_nextBufferID++; ++_nextBufferID;
return id; return id;
} }
else //failed loading, release document else //failed loading, release document
@ -719,7 +719,7 @@ BufferID FileManager::newEmptyDocument()
generic_string newTitle = UNTITLED_STR; generic_string newTitle = UNTITLED_STR;
TCHAR nb[10]; TCHAR nb[10];
wsprintf(nb, TEXT(" %d"), _nextNewNumber); wsprintf(nb, TEXT(" %d"), _nextNewNumber);
_nextNewNumber++; ++_nextNewNumber;
newTitle += nb; newTitle += nb;
Document doc = (Document)_pscratchTilla->execute(SCI_CREATEDOCUMENT); //this already sets a reference for filemanager Document doc = (Document)_pscratchTilla->execute(SCI_CREATEDOCUMENT); //this already sets a reference for filemanager
@ -727,8 +727,8 @@ BufferID FileManager::newEmptyDocument()
BufferID id = (BufferID)newBuf; BufferID id = (BufferID)newBuf;
newBuf->_id = id; newBuf->_id = id;
_buffers.push_back(newBuf); _buffers.push_back(newBuf);
_nrBufs++; ++_nrBufs;
_nextBufferID++; ++_nextBufferID;
return id; return id;
} }
@ -745,10 +745,10 @@ BufferID FileManager::bufferFromDocument(Document doc, bool dontIncrease, bool d
BufferID id = (BufferID)newBuf; BufferID id = (BufferID)newBuf;
newBuf->_id = id; newBuf->_id = id;
_buffers.push_back(newBuf); _buffers.push_back(newBuf);
_nrBufs++; ++_nrBufs;
if (!dontIncrease) if (!dontIncrease)
_nextBufferID++; ++_nextBufferID;
return id; return id;
} }
@ -899,7 +899,7 @@ BufferID FileManager::getBufferFromName(const TCHAR * name)
TCHAR fullpath[MAX_PATH]; TCHAR fullpath[MAX_PATH];
::GetFullPathName(name, MAX_PATH, fullpath, NULL); ::GetFullPathName(name, MAX_PATH, fullpath, NULL);
::GetLongPathName(fullpath, fullpath, MAX_PATH); ::GetLongPathName(fullpath, fullpath, MAX_PATH);
for(size_t i = 0; i < _buffers.size(); i++) for(size_t i = 0; i < _buffers.size(); ++i)
{ {
if (!lstrcmpi(name, _buffers.at(i)->getFullPathName())) if (!lstrcmpi(name, _buffers.at(i)->getFullPathName()))
return _buffers.at(i)->getID(); return _buffers.at(i)->getID();
@ -928,7 +928,7 @@ BufferID FileManager::getBufferFromName(const TCHAR * name)
::CloseHandle(givenFile); ::CloseHandle(givenFile);
const unsigned int bufferSize = _buffers.size(); const unsigned int bufferSize = _buffers.size();
for(size_t i = 0; i < bufferSize; i++) for(size_t i = 0; i < bufferSize; ++i)
{ {
HANDLE currentFile = ::CreateFile(_buffers.at(i)->getFullPathName(), HANDLE currentFile = ::CreateFile(_buffers.at(i)->getFullPathName(),
GENERIC_READ, GENERIC_READ,
@ -958,7 +958,7 @@ BufferID FileManager::getBufferFromName(const TCHAR * name)
} }
BufferID FileManager::getBufferFromDocument(Document doc) { BufferID FileManager::getBufferFromDocument(Document doc) {
for(size_t i = 0; i < _nrBufs; i++) { for(size_t i = 0; i < _nrBufs; ++i) {
if (_buffers[i]->_doc == doc) if (_buffers[i]->_doc == doc)
return _buffers[i]->_id; return _buffers[i]->_id;
} }

View File

@ -82,11 +82,13 @@ BufferID DocTabView::findBufferByName(const TCHAR * fullfilename) { //-1 if not
TCITEM tie; TCITEM tie;
tie.lParam = -1; tie.lParam = -1;
tie.mask = TCIF_PARAM; tie.mask = TCIF_PARAM;
for(size_t i = 0; i < _nbItem; i++) { for(size_t i = 0; i < _nbItem; ++i)
{
::SendMessage(_hSelf, TCM_GETITEM, i, reinterpret_cast<LPARAM>(&tie)); ::SendMessage(_hSelf, TCM_GETITEM, i, reinterpret_cast<LPARAM>(&tie));
BufferID id = (BufferID)tie.lParam; BufferID id = (BufferID)tie.lParam;
Buffer * buf = MainFileManager->getBufferByID(id); Buffer * buf = MainFileManager->getBufferByID(id);
if (!lstrcmp(fullfilename, buf->getFullPathName())) { if (!lstrcmp(fullfilename, buf->getFullPathName()))
{
return id; return id;
} }
} }
@ -97,7 +99,8 @@ int DocTabView::getIndexByBuffer(BufferID id) {
TCITEM tie; TCITEM tie;
tie.lParam = -1; tie.lParam = -1;
tie.mask = TCIF_PARAM; tie.mask = TCIF_PARAM;
for(int i = 0; i < (int)_nbItem; i++) { for(int i = 0; i < (int)_nbItem; ++i)
{
::SendMessage(_hSelf, TCM_GETITEM, i, reinterpret_cast<LPARAM>(&tie)); ::SendMessage(_hSelf, TCM_GETITEM, i, reinterpret_cast<LPARAM>(&tie));
if ((BufferID)tie.lParam == id) if ((BufferID)tie.lParam == id)
return i; return i;

View File

@ -46,10 +46,10 @@ int Searching::convertExtendedToString(const TCHAR * query, TCHAR * result, int
TCHAR current; TCHAR current;
while(i < length) { //because the backslash escape quences always reduce the size of the generic_string, no overflow checks have to be made for target, assuming parameters are correct while(i < length) { //because the backslash escape quences always reduce the size of the generic_string, no overflow checks have to be made for target, assuming parameters are correct
current = query[i]; current = query[i];
charLeft--; --charLeft;
if (current == '\\' && charLeft) { //possible escape sequence if (current == '\\' && charLeft) { //possible escape sequence
i++; ++i;
charLeft--; --charLeft;
current = query[i]; current = query[i];
switch(current) { switch(current) {
case 'r': case 'r':
@ -96,7 +96,7 @@ int Searching::convertExtendedToString(const TCHAR * query, TCHAR * result, int
} }
default: { //unknown sequence, treat as regular text default: { //unknown sequence, treat as regular text
result[j] = '\\'; result[j] = '\\';
j++; ++j;
result[j] = current; result[j] = current;
isGood = false; isGood = false;
break; break;
@ -105,8 +105,8 @@ int Searching::convertExtendedToString(const TCHAR * query, TCHAR * result, int
} else { } else {
result[j] = query[i]; result[j] = query[i];
} }
i++; ++i;
j++; ++j;
} }
result[j] = 0; result[j] = 0;
return j; return j;
@ -133,7 +133,7 @@ bool Searching::readBase(const TCHAR * str, int * value, int base, int size) {
} else { } else {
return false; return false;
} }
i++; ++i;
} }
*value = temp; *value = temp;
return true; return true;
@ -362,7 +362,7 @@ int FindReplaceDlg::saveComboHistory(int id, int maxcount, vector<generic_string
if (count) if (count)
strings.clear(); strings.clear();
for (int i = 0 ; i < count ; i++) for (int i = 0 ; i < count ; ++i)
{ {
::SendMessage(hCombo, CB_GETLBTEXT, i, (LPARAM) text); ::SendMessage(hCombo, CB_GETLBTEXT, i, (LPARAM) text);
strings.push_back(generic_string(text)); strings.push_back(generic_string(text));
@ -1709,7 +1709,7 @@ int FindReplaceDlg::processRange(ProcessOperation op, const TCHAR *txt2find, con
} }
} }
nbProcessed++; ++nbProcessed;
// After the processing of the last string occurence the search loop should be stopped // After the processing of the last string occurence the search loop should be stopped
// This helps to avoid the endless replacement during the EOL ("$") searching // This helps to avoid the endless replacement during the EOL ("$") searching
@ -2279,17 +2279,17 @@ void FindReplaceDlg::combo2ExtendedMode(int comboID)
// Count the number of character '\n' and '\r' // Count the number of character '\n' and '\r'
size_t nbEOL = 0; size_t nbEOL = 0;
size_t str2transformLen = lstrlen(str2transform.c_str()); size_t str2transformLen = lstrlen(str2transform.c_str());
for (size_t i = 0 ; i < str2transformLen ; i++) for (size_t i = 0 ; i < str2transformLen ; ++i)
{ {
if (str2transform[i] == '\r' || str2transform[i] == '\n') if (str2transform[i] == '\r' || str2transform[i] == '\n')
nbEOL++; ++nbEOL;
} }
if (nbEOL) if (nbEOL)
{ {
TCHAR * newBuffer = new TCHAR[str2transformLen + nbEOL*2 + 1]; TCHAR * newBuffer = new TCHAR[str2transformLen + nbEOL*2 + 1];
int j = 0; int j = 0;
for (size_t i = 0 ; i < str2transformLen ; i++) for (size_t i = 0 ; i < str2transformLen ; ++i)
{ {
if (str2transform[i] == '\r') if (str2transform[i] == '\r')
{ {
@ -2393,7 +2393,7 @@ void Finder::addFileHitCount(int count)
setFinderReadOnly(false); setFinderReadOnly(false);
_scintView.insertGenericTextFrom(_lastFileHeaderPos, text); _scintView.insertGenericTextFrom(_lastFileHeaderPos, text);
setFinderReadOnly(true); setFinderReadOnly(true);
nFoundFiles++; ++nFoundFiles;
} }
void Finder::addSearchHitCount(int count) void Finder::addSearchHitCount(int count)
@ -2451,7 +2451,7 @@ void Finder::openAll()
{ {
size_t sz = _pMainFoundInfos->size(); size_t sz = _pMainFoundInfos->size();
for (size_t i = 0; i < sz; i++) for (size_t i = 0; i < sz; ++i)
{ {
::SendMessage(::GetParent(_hParent), WM_DOOPEN, 0, (LPARAM)_pMainFoundInfos->at(i)._fullPath.c_str()); ::SendMessage(::GetParent(_hParent), WM_DOOPEN, 0, (LPARAM)_pMainFoundInfos->at(i)._fullPath.c_str());
} }

View File

@ -69,7 +69,7 @@ int testNameNoCase(const TCHAR * name1, const TCHAR * name2, int len = -1) {
if (name1[i] == 0 || i == len) { if (name1[i] == 0 || i == len) {
return 0; //equal return 0; //equal
} }
i++; ++i;
} }
int subs1 = lower(name1[i])?32:0; int subs1 = lower(name1[i])?32:0;
@ -156,7 +156,7 @@ bool FunctionCallTip::getCursorFunction()
std::vector< Token > tokenVector; std::vector< Token > tokenVector;
int tokenLen = 0; int tokenLen = 0;
TCHAR ch; TCHAR ch;
for (int i = 0; i < offset; i++) //we dont care about stuff after the offset for (int i = 0; i < offset; ++i) //we dont care about stuff after the offset
{ {
//tokenVector.push_back(pair(lineData+i, len)); //tokenVector.push_back(pair(lineData+i, len));
ch = lineData[i]; ch = lineData[i];
@ -165,8 +165,8 @@ bool FunctionCallTip::getCursorFunction()
tokenLen = 0; tokenLen = 0;
TCHAR * begin = lineData+i; TCHAR * begin = lineData+i;
while ((isBasicWordChar(ch) || isAdditionalWordChar(ch)) && i < offset) { while ((isBasicWordChar(ch) || isAdditionalWordChar(ch)) && i < offset) {
tokenLen++; ++tokenLen;
i++; ++i;
ch = lineData[i]; ch = lineData[i];
} }
tokenVector.push_back(Token(begin, tokenLen, true)); tokenVector.push_back(Token(begin, tokenLen, true));
@ -193,13 +193,15 @@ bool FunctionCallTip::getCursorFunction()
FunctionValues curValue, newValue; FunctionValues curValue, newValue;
int scopeLevel = 0; int scopeLevel = 0;
for (size_t i = 0; i < vsize; i++) { for (size_t i = 0; i < vsize; ++i)
{
Token & curToken = tokenVector.at(i); Token & curToken = tokenVector.at(i);
if (curToken.isIdentifier) { if (curToken.isIdentifier) {
curValue.lastIdentifier = i; curValue.lastIdentifier = i;
} else { } else {
if (curToken.token[0] == _start) { if (curToken.token[0] == _start)
scopeLevel++; {
++scopeLevel;
newValue = curValue; newValue = curValue;
valueVec.push_back(newValue); //store the current settings, so when this new function doesnt happen to be the 'real' one, we can restore everything valueVec.push_back(newValue); //store the current settings, so when this new function doesnt happen to be the 'real' one, we can restore everything
@ -211,7 +213,7 @@ bool FunctionCallTip::getCursorFunction()
curValue.lastFunctionIdentifier = -1; curValue.lastFunctionIdentifier = -1;
} }
} else if (curToken.token[0] == _param && curValue.lastFunctionIdentifier > -1) { } else if (curToken.token[0] == _param && curValue.lastFunctionIdentifier > -1) {
curValue.param++; ++curValue.param;
} else if (curToken.token[0] == _stop) { } else if (curToken.token[0] == _stop) {
if (scopeLevel) //scope cannot go below -1 if (scopeLevel) //scope cannot go below -1
scopeLevel--; scopeLevel--;
@ -333,7 +335,7 @@ bool FunctionCallTip::loadFunction() {
_overloads.push_back(paramVec); _overloads.push_back(paramVec);
paramVec.clear(); paramVec.clear();
_currentNrOverloads++; ++_currentNrOverloads;
} }
_currentNrOverloads = (int)_overloads.size(); _currentNrOverloads = (int)_overloads.size();
@ -357,7 +359,7 @@ void FunctionCallTip::showCalltip()
size_t psize = params.size()+1, osize; size_t psize = params.size()+1, osize;
if ((size_t)_currentParam >= psize) { if ((size_t)_currentParam >= psize) {
osize = _overloads.size(); osize = _overloads.size();
for(size_t i = 0; i < osize; i++) { for(size_t i = 0; i < osize; ++i) {
psize = _overloads.at(i).size()+1; psize = _overloads.at(i).size()+1;
if ((size_t)_currentParam < psize) { if ((size_t)_currentParam < psize) {
_currentOverload = i; _currentOverload = i;
@ -376,7 +378,7 @@ void FunctionCallTip::showCalltip()
bytesNeeded += lstrlen(curDescriptionText); bytesNeeded += lstrlen(curDescriptionText);
size_t nrParams = params.size(); size_t nrParams = params.size();
for(size_t i = 0; i < nrParams; i++) { for(size_t i = 0; i < nrParams; ++i) {
bytesNeeded += lstrlen(params.at(i)) + 2; //'param, ' bytesNeeded += lstrlen(params.at(i)) + 2; //'param, '
} }
@ -402,7 +404,7 @@ void FunctionCallTip::showCalltip()
int highlightstart = 0; int highlightstart = 0;
int highlightend = 0; int highlightend = 0;
for(size_t i = 0; i < nrParams; i++) for(size_t i = 0; i < nrParams; ++i)
{ {
if (int(i) == _currentParam) if (int(i) == _currentParam)
{ {

View File

@ -87,7 +87,7 @@ private:
bool isAdditionalWordChar(TCHAR ch) const { bool isAdditionalWordChar(TCHAR ch) const {
const TCHAR *addChars = _additionalWordChar.c_str(); const TCHAR *addChars = _additionalWordChar.c_str();
size_t len = _additionalWordChar.length(); size_t len = _additionalWordChar.length();
for (size_t i = 0 ; i < len ; i++) for (size_t i = 0 ; i < len ; ++i)
if (ch == addChars[i]) if (ch == addChars[i])
return true; return true;
return false; return false;

View File

@ -491,7 +491,7 @@ size_t Printer::doPrint(bool justDoIt)
::EndPage(_pdlg.hDC); ::EndPage(_pdlg.hDC);
} }
pageNum++; ++pageNum;
if ((_pdlg.Flags & PD_PAGENUMS) && (pageNum > _pdlg.nToPage)) if ((_pdlg.Flags & PD_PAGENUMS) && (pageNum > _pdlg.nToPage))
break; break;

View File

@ -41,7 +41,7 @@ HWND ScintillaCtrls::createSintilla(HWND hParent)
int ScintillaCtrls::getIndexFrom(HWND handle2Find) int ScintillaCtrls::getIndexFrom(HWND handle2Find)
{ {
for (size_t i = 0, len = _scintVector.size(); i < len ; i++) for (size_t i = 0, len = _scintVector.size(); i < len ; ++i)
{ {
if (_scintVector[i]->getHSelf() == handle2Find) if (_scintVector[i]->getHSelf() == handle2Find)
{ {
@ -75,7 +75,7 @@ bool ScintillaCtrls::destroyScintilla(HWND handle2Destroy)
void ScintillaCtrls::destroy() void ScintillaCtrls::destroy()
{ {
for (size_t i = 0, len = _scintVector.size(); i < len ; i++) for (size_t i = 0, len = _scintVector.size(); i < len ; ++i)
{ {
_scintVector[i]->destroy(); _scintVector[i]->destroy();
delete _scintVector[i]; delete _scintVector[i];

View File

@ -151,7 +151,7 @@ int getNbDigits(int aNum, int base)
else else
{ {
diviseur *= base; diviseur *= base;
nbChiffre++; ++nbChiffre;
} }
} }
if ((base == 16) && (nbChiffre % 2 != 0)) if ((base == 16) && (nbChiffre % 2 != 0))
@ -524,7 +524,7 @@ void ScintillaEditView::setXmlLexer(LangType type)
if (type == L_XML) if (type == L_XML)
{ {
execute(SCI_SETLEXER, SCLEX_XML); execute(SCI_SETLEXER, SCLEX_XML);
for (int i = 0 ; i < 4 ; i++) for (int i = 0 ; i < 4 ; ++i)
execute(SCI_SETKEYWORDS, i, reinterpret_cast<LPARAM>(TEXT(""))); execute(SCI_SETKEYWORDS, i, reinterpret_cast<LPARAM>(TEXT("")));
makeStyle(type); makeStyle(type);
@ -649,13 +649,13 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName)
execute(SCI_SETPROPERTY, (WPARAM)"userDefine.foldCompact", (LPARAM)(userLangContainer->_foldCompact ? "1":"0")); execute(SCI_SETPROPERTY, (WPARAM)"userDefine.foldCompact", (LPARAM)(userLangContainer->_foldCompact ? "1":"0"));
char name[] = "userDefine.prefixKeywords0"; char name[] = "userDefine.prefixKeywords0";
for (int i=0 ; i<SCE_USER_TOTAL_KEYWORD_GROUPS ; i++) for (int i=0 ; i<SCE_USER_TOTAL_KEYWORD_GROUPS ; ++i)
{ {
itoa(i+1, (name+25), 10); itoa(i+1, (name+25), 10);
execute(SCI_SETPROPERTY, (WPARAM)name, (LPARAM)(userLangContainer->_isPrefix[i]?"1":"0")); execute(SCI_SETPROPERTY, (WPARAM)name, (LPARAM)(userLangContainer->_isPrefix[i]?"1":"0"));
} }
for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; i++) for (int i = 0 ; i < SCE_USER_KWLIST_TOTAL ; ++i)
{ {
#ifndef UNICODE #ifndef UNICODE
const char * keyWords_char = userLangContainer->_keywordLists[i]; const char * keyWords_char = userLangContainer->_keywordLists[i];
@ -737,7 +737,7 @@ void ScintillaEditView::setUserLexer(const TCHAR *userLangName)
itoa((int)_currentBufferID, intBuffer, 10); // use numeric value of BufferID pointer itoa((int)_currentBufferID, intBuffer, 10); // use numeric value of BufferID pointer
execute(SCI_SETPROPERTY, (WPARAM)"userDefine.currentBufferID", reinterpret_cast<LPARAM>(intBuffer)); execute(SCI_SETPROPERTY, (WPARAM)"userDefine.currentBufferID", reinterpret_cast<LPARAM>(intBuffer));
for (int i = 0 ; i < SCE_USER_STYLE_TOTAL_STYLES ; i++) for (int i = 0 ; i < SCE_USER_STYLE_TOTAL_STYLES ; ++i)
{ {
Style & style = userLangContainer->_styleArray.getStyler(i); Style & style = userLangContainer->_styleArray.getStyler(i);
@ -768,7 +768,7 @@ void ScintillaEditView::setExternalLexer(LangType typeDoc)
LexerStyler *pStyler = (_pParameter->getLStylerArray()).getLexerStylerByName(name); LexerStyler *pStyler = (_pParameter->getLStylerArray()).getLexerStylerByName(name);
if (pStyler) if (pStyler)
{ {
for (int i = 0 ; i < pStyler->getNbStyler() ; i++) for (int i = 0 ; i < pStyler->getNbStyler() ; ++i)
{ {
Style & style = pStyler->getStyler(i); Style & style = pStyler->getStyler(i);
@ -820,7 +820,7 @@ void ScintillaEditView::setCppLexer(LangType langType)
LexerStyler *pStyler = (_pParameter->getLStylerArray()).getLexerStylerByName(lexerName); LexerStyler *pStyler = (_pParameter->getLStylerArray()).getLexerStylerByName(lexerName);
if (pStyler) if (pStyler)
{ {
for (int i = 0, nb = pStyler->getNbStyler() ; i < nb ; i++) for (int i = 0, nb = pStyler->getNbStyler() ; i < nb ; ++i)
{ {
Style style = pStyler->getStyler(i); //not by reference, but copy Style style = pStyler->getStyler(i); //not by reference, but copy
int cppID = style._styleID; int cppID = style._styleID;
@ -1104,7 +1104,7 @@ void ScintillaEditView::makeStyle(LangType language, const TCHAR **keywordArray)
LexerStyler *pStyler = (_pParameter->getLStylerArray()).getLexerStylerByName(lexerName); LexerStyler *pStyler = (_pParameter->getLStylerArray()).getLexerStylerByName(lexerName);
if (pStyler) if (pStyler)
{ {
for (int i = 0, nb = pStyler->getNbStyler(); i < nb ; i++) for (int i = 0, nb = pStyler->getNbStyler(); i < nb ; ++i)
{ {
Style & style = pStyler->getStyler(i); Style & style = pStyler->getStyler(i);
setStyle(style); setStyle(style);
@ -1609,7 +1609,7 @@ void ScintillaEditView::getCurrentFoldStates(std::vector<size_t> & lineStateVect
//-- Store contracted line //-- Store contracted line
lineStateVector.push_back(contractedFoldHeaderLine); lineStateVector.push_back(contractedFoldHeaderLine);
//-- Start next search with next line //-- Start next search with next line
contractedFoldHeaderLine++; ++contractedFoldHeaderLine;
} }
} while (contractedFoldHeaderLine != -1); } while (contractedFoldHeaderLine != -1);
} }
@ -1617,7 +1617,7 @@ void ScintillaEditView::getCurrentFoldStates(std::vector<size_t> & lineStateVect
void ScintillaEditView::syncFoldStateWith(const std::vector<size_t> & lineStateVectorNew) void ScintillaEditView::syncFoldStateWith(const std::vector<size_t> & lineStateVectorNew)
{ {
int nbLineState = lineStateVectorNew.size(); int nbLineState = lineStateVectorNew.size();
for (int i = 0 ; i < nbLineState ; i++) for (int i = 0 ; i < nbLineState ; ++i)
{ {
int line = lineStateVectorNew.at(i); int line = lineStateVectorNew.at(i);
fold(line, false); fold(line, false);
@ -1680,7 +1680,7 @@ void ScintillaEditView::collapse(int level2Collapse, bool mode)
int maxLine = execute(SCI_GETLINECOUNT); int maxLine = execute(SCI_GETLINECOUNT);
for (int line = 0; line < maxLine; line++) for (int line = 0; line < maxLine; ++line)
{ {
int level = execute(SCI_GETFOLDLEVEL, line); int level = execute(SCI_GETFOLDLEVEL, line);
if (level & SC_FOLDLEVELHEADERFLAG) if (level & SC_FOLDLEVELHEADERFLAG)
@ -1742,7 +1742,7 @@ void ScintillaEditView::foldAll(bool mode)
{ {
int maxLine = execute(SCI_GETLINECOUNT); int maxLine = execute(SCI_GETLINECOUNT);
for (int line = 0; line < maxLine; line++) for (int line = 0; line < maxLine; ++line)
{ {
int level = execute(SCI_GETFOLDLEVEL, line); int level = execute(SCI_GETFOLDLEVEL, line);
if (level & SC_FOLDLEVELHEADERFLAG) if (level & SC_FOLDLEVELHEADERFLAG)
@ -2097,7 +2097,7 @@ void ScintillaEditView::marginClick(int position, int modifiers)
void ScintillaEditView::expand(int &line, bool doExpand, bool force, int visLevels, int level) void ScintillaEditView::expand(int &line, bool doExpand, bool force, int visLevels, int level)
{ {
int lineMaxSubord = int(execute(SCI_GETLASTCHILD, line, level & SC_FOLDLEVELNUMBERMASK)); int lineMaxSubord = int(execute(SCI_GETLASTCHILD, line, level & SC_FOLDLEVELNUMBERMASK));
line++; ++line;
while (line <= lineMaxSubord) while (line <= lineMaxSubord)
{ {
if (force) if (force)
@ -2142,7 +2142,7 @@ void ScintillaEditView::expand(int &line, bool doExpand, bool force, int visLeve
} }
else else
{ {
line++; ++line;
} }
} }
@ -2220,7 +2220,7 @@ void ScintillaEditView::performGlobalStyles()
ScintillaViewParams & svp = (ScintillaViewParams &)_pParameter->getSVP(); ScintillaViewParams & svp = (ScintillaViewParams &)_pParameter->getSVP();
for (int j = 0 ; j < NB_FOLDER_STATE ; j++) for (int j = 0 ; j < NB_FOLDER_STATE ; ++j)
defineMarker(_markersArray[FOLDER_TYPE][j], _markersArray[svp._folderStyle][j], foldfgColor, foldbgColor, activeFoldFgColor); defineMarker(_markersArray[FOLDER_TYPE][j], _markersArray[svp._folderStyle][j], foldfgColor, foldbgColor, activeFoldFgColor);
execute(SCI_MARKERENABLEHIGHLIGHT, true); execute(SCI_MARKERENABLEHIGHLIGHT, true);
@ -2287,7 +2287,7 @@ const char * ScintillaEditView::getCompleteKeywordList(std::basic_string<char> &
void ScintillaEditView::setMultiSelections(const ColumnModeInfos & cmi) void ScintillaEditView::setMultiSelections(const ColumnModeInfos & cmi)
{ {
for (size_t i = 0, len = cmi.size(); i < len ; i++) for (size_t i = 0, len = cmi.size(); i < len ; ++i)
{ {
if (cmi[i].isValid()) if (cmi[i].isValid())
{ {
@ -2325,7 +2325,7 @@ void ScintillaEditView::currentLineDown() const
if (currentLine != (execute(SCI_GETLINECOUNT) - 1)) if (currentLine != (execute(SCI_GETLINECOUNT) - 1))
{ {
execute(SCI_BEGINUNDOACTION); execute(SCI_BEGINUNDOACTION);
currentLine++; ++currentLine;
execute(SCI_GOTOLINE, currentLine); execute(SCI_GOTOLINE, currentLine);
execute(SCI_LINETRANSPOSE); execute(SCI_LINETRANSPOSE);
execute(SCI_ENDUNDOACTION); execute(SCI_ENDUNDOACTION);
@ -2370,7 +2370,7 @@ void ScintillaEditView::currentLinesUp() const
execute(SCI_BEGINUNDOACTION); execute(SCI_BEGINUNDOACTION);
execute(SCI_GOTOLINE, line2swap); execute(SCI_GOTOLINE, line2swap);
for (int i = 0 ; i < nbSelLines ; i++) for (int i = 0 ; i < nbSelLines ; ++i)
{ {
currentLineDown(); currentLineDown();
} }
@ -2402,7 +2402,7 @@ void ScintillaEditView::currentLinesDown() const
execute(SCI_BEGINUNDOACTION); execute(SCI_BEGINUNDOACTION);
execute(SCI_GOTOLINE, line2swap); execute(SCI_GOTOLINE, line2swap);
for (int i = 0 ; i < nbSelLines ; i++) for (int i = 0 ; i < nbSelLines ; ++i)
{ {
currentLineUp(); currentLineUp();
} }
@ -2426,7 +2426,7 @@ void ScintillaEditView::convertSelectedTextTo(bool Case)
ColumnModeInfos cmi = getColumnModeSelectInfo(); ColumnModeInfos cmi = getColumnModeSelectInfo();
for (size_t i = 0, cmiLen = cmi.size(); i < cmiLen ; i++) for (size_t i = 0, cmiLen = cmi.size(); i < cmiLen ; ++i)
{ {
const int len = cmi[i]._selRpos - cmi[i]._selLpos; const int len = cmi[i]._selRpos - cmi[i]._selLpos;
char *srcStr = new char[len+1]; char *srcStr = new char[len+1];
@ -2438,7 +2438,7 @@ void ScintillaEditView::convertSelectedTextTo(bool Case)
int nbChar = ::MultiByteToWideChar(codepage, 0, srcStr, len, destStr, len); int nbChar = ::MultiByteToWideChar(codepage, 0, srcStr, len, destStr, len);
for (int j = 0 ; j < nbChar ; j++) for (int j = 0 ; j < nbChar ; ++j)
{ {
if (Case == UPPERCASE) if (Case == UPPERCASE)
destStr[j] = (wchar_t)::CharUpperW((LPWSTR)destStr[j]); destStr[j] = (wchar_t)::CharUpperW((LPWSTR)destStr[j]);
@ -2478,7 +2478,7 @@ void ScintillaEditView::convertSelectedTextTo(bool Case)
int nbChar = ::MultiByteToWideChar(codepage, 0, selectedStr, strSize, selectedStrW, strWSize); int nbChar = ::MultiByteToWideChar(codepage, 0, selectedStr, strSize, selectedStrW, strWSize);
for (int i = 0 ; i < nbChar ; i++) for (int i = 0 ; i < nbChar ; ++i)
{ {
if (Case == UPPERCASE) if (Case == UPPERCASE)
selectedStrW[i] = (WCHAR)::CharUpperW((LPWSTR)selectedStrW[i]); selectedStrW[i] = (WCHAR)::CharUpperW((LPWSTR)selectedStrW[i]);
@ -2533,7 +2533,7 @@ TCHAR * int2str(TCHAR *str, int strLen, int number, int base, int nbChiffre, boo
int nbBit2Shift = (nbChiffre >= nbBits)?nbBits:(nbBits - nbChiffre); int nbBit2Shift = (nbChiffre >= nbBits)?nbBits:(nbBits - nbChiffre);
unsigned long mask = MASK_ULONG_BITFORT >> nbBit2Shift; unsigned long mask = MASK_ULONG_BITFORT >> nbBit2Shift;
int i = 0; int i = 0;
for (; mask > 0 ; i++) for (; mask > 0 ; ++i)
{ {
str[i] = (mask & number)?'1':'0'; str[i] = (mask & number)?'1':'0';
mask >>= 1; mask >>= 1;
@ -2546,7 +2546,7 @@ TCHAR * int2str(TCHAR *str, int strLen, int number, int base, int nbChiffre, boo
if (base == 2) if (base == 2)
{ {
TCHAR *j = str; TCHAR *j = str;
for ( ; *j != '\0' ; j++) for ( ; *j != '\0' ; ++j)
if (*j == '1') if (*j == '1')
break; break;
lstrcpy(str, j); lstrcpy(str, j);
@ -2559,7 +2559,7 @@ TCHAR * int2str(TCHAR *str, int strLen, int number, int base, int nbChiffre, boo
generic_sprintf(str, f, number); generic_sprintf(str, f, number);
} }
int i = lstrlen(str); int i = lstrlen(str);
for ( ; i < nbChiffre ; i++) for ( ; i < nbChiffre ; ++i)
str[i] = ' '; str[i] = ' ';
str[i] = '\0'; str[i] = '\0';
} }
@ -2584,7 +2584,7 @@ ColumnModeInfos ScintillaEditView::getColumnModeSelectInfo()
{ {
int nbSel = execute(SCI_GETSELECTIONS); int nbSel = execute(SCI_GETSELECTIONS);
for (int i = 0 ; i < nbSel ; i++) for (int i = 0 ; i < nbSel ; ++i)
{ {
int absPosSelStartPerLine = execute(SCI_GETSELECTIONNANCHOR, i); int absPosSelStartPerLine = execute(SCI_GETSELECTIONNANCHOR, i);
int absPosSelEndPerLine = execute(SCI_GETSELECTIONNCARET, i); int absPosSelEndPerLine = execute(SCI_GETSELECTIONNCARET, i);
@ -2608,7 +2608,7 @@ ColumnModeInfos ScintillaEditView::getColumnModeSelectInfo()
void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, const TCHAR *str) void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, const TCHAR *str)
{ {
int totalDiff = 0; int totalDiff = 0;
for (size_t i = 0, len = cmi.size(); i < len ; i++) for (size_t i = 0, len = cmi.size(); i < len ; ++i)
{ {
if (cmi[i].isValid()) if (cmi[i].isValid())
{ {
@ -2621,7 +2621,7 @@ void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, const TCHAR *str)
if (hasVirtualSpc) // if virtual space is present, then insert space if (hasVirtualSpc) // if virtual space is present, then insert space
{ {
for (int j = 0, k = cmi[i]._selLpos; j < cmi[i]._nbVirtualCaretSpc ; j++, k++) for (int j = 0, k = cmi[i]._selLpos; j < cmi[i]._nbVirtualCaretSpc ; ++j, ++k)
{ {
execute(SCI_INSERTTEXT, k, (LPARAM)" "); execute(SCI_INSERTTEXT, k, (LPARAM)" ");
} }
@ -2691,7 +2691,7 @@ void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, int initial, int in
TCHAR str[stringSize]; TCHAR str[stringSize];
int totalDiff = 0; int totalDiff = 0;
for (size_t i = 0, len = cmi.size() ; i < len ; i++) for (size_t i = 0, len = cmi.size() ; i < len ; ++i)
{ {
if (cmi[i].isValid()) if (cmi[i].isValid())
{ {
@ -2706,7 +2706,7 @@ void ScintillaEditView::columnReplace(ColumnModeInfos & cmi, int initial, int in
bool hasVirtualSpc = cmi[i]._nbVirtualAnchorSpc > 0; bool hasVirtualSpc = cmi[i]._nbVirtualAnchorSpc > 0;
if (hasVirtualSpc) // if virtual space is present, then insert space if (hasVirtualSpc) // if virtual space is present, then insert space
{ {
for (int j = 0, k = cmi[i]._selLpos; j < cmi[i]._nbVirtualCaretSpc ; j++, k++) for (int j = 0, k = cmi[i]._selLpos; j < cmi[i]._nbVirtualCaretSpc ; ++j, ++k)
{ {
execute(SCI_INSERTTEXT, k, (LPARAM)" "); execute(SCI_INSERTTEXT, k, (LPARAM)" ");
} }
@ -2805,9 +2805,9 @@ void ScintillaEditView::hideLines() {
if (nrLines < 3) if (nrLines < 3)
return; //cannot possibly hide anything return; //cannot possibly hide anything
if (!startLine) if (!startLine)
startLine++; ++startLine;
if (endLine == (nrLines-1)) if (endLine == (nrLines-1))
endLine--; --endLine;
if (startLine > endLine) if (startLine > endLine)
return; //tried to hide line at edge return; //tried to hide line at edge
@ -2820,7 +2820,7 @@ void ScintillaEditView::hideLines() {
//remove any markers in between //remove any markers in between
int scope = 0; int scope = 0;
for(int i = startLine; i <= endLine; i++) { for(int i = startLine; i <= endLine; ++i) {
int state = execute(SCI_MARKERGET, i); int state = execute(SCI_MARKERGET, i);
bool closePresent = ((state & (1 << MARK_HIDELINESEND)) != 0); //check close first, then open, since close closes scope bool closePresent = ((state & (1 << MARK_HIDELINESEND)) != 0); //check close first, then open, since close closes scope
bool openPresent = ((state & (1 << MARK_HIDELINESBEGIN)) != 0); bool openPresent = ((state & (1 << MARK_HIDELINESBEGIN)) != 0);
@ -2830,7 +2830,7 @@ void ScintillaEditView::hideLines() {
} }
if (openPresent) { if (openPresent) {
execute(SCI_MARKERDELETE, i, MARK_HIDELINESBEGIN); execute(SCI_MARKERDELETE, i, MARK_HIDELINESBEGIN);
scope++; ++scope;
} }
} }
if (scope != 0) { //something went wrong if (scope != 0) { //something went wrong
@ -2917,7 +2917,7 @@ void ScintillaEditView::runMarkers(bool doHide, int searchStart, bool endOfDoc,
if (doHide) { if (doHide) {
int startHiding = searchStart; int startHiding = searchStart;
bool isInSection = false; bool isInSection = false;
for(int i = searchStart; i < maxLines; i++) { for(int i = searchStart; i < maxLines; ++i) {
int state = execute(SCI_MARKERGET, i); int state = execute(SCI_MARKERGET, i);
if ( ((state & (1 << MARK_HIDELINESEND)) != 0) ) { if ( ((state & (1 << MARK_HIDELINESEND)) != 0) ) {
if (isInSection) { if (isInSection) {
@ -2937,7 +2937,7 @@ void ScintillaEditView::runMarkers(bool doHide, int searchStart, bool endOfDoc,
} else { } else {
int startShowing = searchStart; int startShowing = searchStart;
bool isInSection = false; bool isInSection = false;
for(int i = searchStart; i < maxLines; i++) { for(int i = searchStart; i < maxLines; ++i) {
int state = execute(SCI_MARKERGET, i); int state = execute(SCI_MARKERGET, i);
if ( ((state & (1 << MARK_HIDELINESEND)) != 0) ) { if ( ((state & (1 << MARK_HIDELINESEND)) != 0) ) {
if (doDelete) if (doDelete)

View File

@ -349,7 +349,7 @@ public:
{ {
display = true; display = true;
} }
for (int i = 0 ; i < NB_FOLDER_STATE ; i++) for (int i = 0 ; i < NB_FOLDER_STATE ; ++i)
defineMarker(_markersArray[FOLDER_TYPE][i], _markersArray[style][i], white, grey, white); defineMarker(_markersArray[FOLDER_TYPE][i], _markersArray[style][i], white, grey, white);
showMargin(ScintillaEditView::_SC_MARGE_FOLDER, display); showMargin(ScintillaEditView::_SC_MARGE_FOLDER, display);
}; };
@ -501,7 +501,7 @@ public:
while (lastVisibleLineVis) while (lastVisibleLineVis)
{ {
lastVisibleLineVis /= 10; lastVisibleLineVis /= 10;
i++; ++i;
} }
i = max(i, 3); i = max(i, 3);
{ {
@ -756,7 +756,7 @@ protected:
}; };
void setTeXLexer() { void setTeXLexer() {
for (int i = 0 ; i < 4 ; i++) for (int i = 0 ; i < 4 ; ++i)
execute(SCI_SETKEYWORDS, i, reinterpret_cast<LPARAM>(TEXT(""))); execute(SCI_SETKEYWORDS, i, reinterpret_cast<LPARAM>(TEXT("")));
setLexer(SCLEX_TEX, L_TEX, 0); setLexer(SCLEX_TEX, L_TEX, 0);
}; };

View File

@ -113,7 +113,8 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView)
searchText = text2Find; searchText = text2Find;
#endif #endif
for(; currentLine < lastLine; currentLine++) { for(; currentLine < lastLine; ++currentLine)
{
int docLine = (int)pHighlightView->execute(SCI_DOCLINEFROMVISIBLE, currentLine); int docLine = (int)pHighlightView->execute(SCI_DOCLINEFROMVISIBLE, currentLine);
if (docLine == prevDocLineChecked) if (docLine == prevDocLineChecked)
continue; //still on same line (wordwrap) continue; //still on same line (wordwrap)
@ -136,7 +137,7 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView)
bool SmartHighlighter::isQualifiedWord(const char *str) const bool SmartHighlighter::isQualifiedWord(const char *str) const
{ {
for (size_t i = 0, len = strlen(str) ; i < len ; i++) for (size_t i = 0, len = strlen(str) ; i < len ; ++i)
{ {
if (!isWordChar(str[i])) if (!isWordChar(str[i]))
return false; return false;

View File

@ -184,7 +184,7 @@ void FolderStyleDialog::convertTo(TCHAR *dest, const TCHAR *toConvert, TCHAR *pr
dest[index++] = prefix[0]; dest[index++] = prefix[0];
dest[index++] = prefix[1]; dest[index++] = prefix[1];
for (size_t i = 0, len = lstrlen(toConvert); i < len ; i++) for (size_t i = 0, len = lstrlen(toConvert); i < len ; ++i)
{ {
if (i == 0 && toConvert[i] == '(' && toConvert[i+1] == '(') 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; int j = 0;
bool begin2Copy = false; bool begin2Copy = false;
for (size_t i = 0, len = lstrlen(toRetrieve); i < len ; 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])) 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[0];
dest[index++] = prefix[1]; dest[index++] = prefix[1];
for (size_t i = 0, len = lstrlen(toConvert); i < len ; i++) for (size_t i = 0, len = lstrlen(toConvert); i < len ; ++i)
{ {
if (i == 0 && toConvert[i] == '(' && toConvert[i+1] == '(') 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 begin2Copy = false;
bool inGroup = false; bool inGroup = false;
for (size_t i = 0, len = lstrlen(toRetrieve); i < len ; 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])) 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[0];
dest[index++] = prefix[1]; dest[index++] = prefix[1];
for (size_t i = 0, len = lstrlen(toConvert); i < len ; i++) for (size_t i = 0, len = lstrlen(toConvert); i < len ; ++i)
{ {
if (i == 0 && toConvert[i] == '(' && toConvert[i+1] == '(') 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 begin2Copy = false;
bool inGroup = false; bool inGroup = false;
for (size_t i = 0, len = lstrlen(toRetrieve); i < len ; 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])) 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(); NppParameters *pNppParam = NppParameters::getInstance();
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_RESETCONTENT, 0, 0); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_RESETCONTENT, 0, 0);
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("User Define Language")); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("User Define Language"));
for (int i = 0, nb = pNppParam->getNbUserLang(); i < nb ; i++) for (int i = 0, nb = pNppParam->getNbUserLang(); i < nb ; ++i)
{ {
UserLangContainer & userLangContainer = pNppParam->getULCFromIndex(i); UserLangContainer & userLangContainer = pNppParam->getULCFromIndex(i);
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, (LPARAM)userLangContainer.getName()); ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_ADDSTRING, 0, (LPARAM)userLangContainer.getName());
@ -1575,7 +1575,7 @@ BOOL CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
// for the font size combo // for the font size combo
HWND hFontSizeCombo = ::GetDlgItem(hwnd, IDC_STYLER_COMBO_FONT_SIZE); HWND hFontSizeCombo = ::GetDlgItem(hwnd, IDC_STYLER_COMBO_FONT_SIZE);
for(int j = 0 ; j < int(sizeof(fontSizeStrs))/(3*sizeof(TCHAR)) ; j++) for(int j = 0 ; j < int(sizeof(fontSizeStrs))/(3*sizeof(TCHAR)) ; ++j)
::SendMessage(hFontSizeCombo, CB_ADDSTRING, 0, (LPARAM)fontSizeStrs[j]); ::SendMessage(hFontSizeCombo, CB_ADDSTRING, 0, (LPARAM)fontSizeStrs[j]);
TCHAR size[10]; TCHAR size[10];
@ -1591,7 +1591,7 @@ BOOL CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
// for the font name combo // for the font name combo
HWND hFontNameCombo = ::GetDlgItem(hwnd, IDC_STYLER_COMBO_FONT_NAME); HWND hFontNameCombo = ::GetDlgItem(hwnd, IDC_STYLER_COMBO_FONT_NAME);
const std::vector<generic_string> & fontlist = pNppParam->getFontList(); const std::vector<generic_string> & fontlist = pNppParam->getFontList();
for (size_t j = 0, len = fontlist.size() ; j < len ; j++) for (size_t j = 0, len = fontlist.size() ; j < len ; ++j)
{ {
int k = ::SendMessage(hFontNameCombo, CB_ADDSTRING, 0, (LPARAM)fontlist[j].c_str()); int k = ::SendMessage(hFontNameCombo, CB_ADDSTRING, 0, (LPARAM)fontlist[j].c_str());
::SendMessage(hFontNameCombo, CB_SETITEMDATA, k, (LPARAM)fontlist[j].c_str()); ::SendMessage(hFontNameCombo, CB_SETITEMDATA, k, (LPARAM)fontlist[j].c_str());

View File

@ -99,7 +99,7 @@ BOOL CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
int lineAllocatedLen = 1024; int lineAllocatedLen = 1024;
TCHAR *line = new TCHAR[lineAllocatedLen]; TCHAR *line = new TCHAR[lineAllocatedLen];
for (int i = cursorLine ; i <= endLine ; i++) for (int i = cursorLine ; i <= endLine ; ++i)
{ {
int lineBegin = (*_ppEditView)->execute(SCI_POSITIONFROMLINE, i); int lineBegin = (*_ppEditView)->execute(SCI_POSITIONFROMLINE, i);
int lineEnd = (*_ppEditView)->execute(SCI_GETLINEENDPOSITION, i); int lineEnd = (*_ppEditView)->execute(SCI_GETLINEENDPOSITION, i);
@ -177,7 +177,7 @@ BOOL CALLBACK ColumnEditorDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
int nb = max(nbInit, nbEnd); int nb = max(nbInit, nbEnd);
for (int i = cursorLine ; i <= endLine ; i++) for (int i = cursorLine ; i <= endLine ; ++i)
{ {
int lineBegin = (*_ppEditView)->execute(SCI_POSITIONFROMLINE, i); int lineBegin = (*_ppEditView)->execute(SCI_POSITIONFROMLINE, i);
int lineEnd = (*_ppEditView)->execute(SCI_GETLINEENDPOSITION, i); int lineEnd = (*_ppEditView)->execute(SCI_GETLINEENDPOSITION, i);

View File

@ -58,7 +58,7 @@ vector< pair<int, int> > XmlMatchedTagsHighlighter::getAttributesPos(int start,
int startPos = -1; int startPos = -1;
int oneMoreChar = 1; int oneMoreChar = 1;
int i = 0; int i = 0;
for (; i < bufLen ; i++) for (; i < bufLen ; ++i)
{ {
switch (buf[i]) switch (buf[i])
{ {
@ -624,7 +624,7 @@ void XmlMatchedTagsHighlighter::tagMatch(bool doHiliteAttr)
{ {
vector< pair<int, int> > attributes = getAttributesPos(xmlTags.tagNameEnd, xmlTags.tagOpenEnd - openTagTailLen); vector< pair<int, int> > attributes = getAttributesPos(xmlTags.tagNameEnd, xmlTags.tagOpenEnd - openTagTailLen);
_pEditView->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_TAGATTR); _pEditView->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_TAGATTR);
for (size_t i = 0, len = attributes.size(); i < len ; 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); _pEditView->execute(SCI_INDICATORFILLRANGE, attributes[i].first, attributes[i].second - attributes[i].first);
} }

View File

@ -10,10 +10,10 @@
unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen) { unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen) {
unsigned int len = 0; unsigned int len = 0;
for (unsigned int i = 0; i < tlen && uptr[i]; i++) { for (unsigned int i = 0; i < tlen && uptr[i]; ++i) {
unsigned int uch = uptr[i]; unsigned int uch = uptr[i];
if (uch < 0x80) if (uch < 0x80)
len++; ++len;
else if (uch < 0x800) else if (uch < 0x800)
len += 2; len += 2;
else else
@ -24,7 +24,7 @@ unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen) {
void UTF8FromUCS2(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len) { void UTF8FromUCS2(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len) {
int k = 0; int k = 0;
for (unsigned int i = 0; i < tlen && uptr[i]; i++) { for (unsigned int i = 0; i < tlen && uptr[i]; ++i) {
unsigned int uch = uptr[i]; unsigned int uch = uptr[i];
if (uch < 0x80) { if (uch < 0x80) {
putf[k++] = static_cast<char>(uch); putf[k++] = static_cast<char>(uch);
@ -42,10 +42,10 @@ void UTF8FromUCS2(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned i
unsigned int UCS2Length(const char *s, unsigned int len) { unsigned int UCS2Length(const char *s, unsigned int len) {
unsigned int ulen = 0; unsigned int ulen = 0;
for (unsigned int i=0;i<len;i++) { for (unsigned int i=0; i<len; ++i) {
UCHAR ch = static_cast<UCHAR>(s[i]); UCHAR ch = static_cast<UCHAR>(s[i]);
if ((ch < 0x80) || (ch > (0x80 + 0x40))) if ((ch < 0x80) || (ch > (0x80 + 0x40)))
ulen++; ++ulen;
} }
return ulen; return ulen;
} }

View File

@ -66,7 +66,7 @@ u78 Utf8_16_Read::utf8_7bits_8bits()
} }
else if (*sx < 0x80) else if (*sx < 0x80)
{ // 0nnnnnnn If the byte's first hex code begins with 0-7, it is an ASCII character. { // 0nnnnnnn If the byte's first hex code begins with 0-7, it is an ASCII character.
sx++; ++sx;
} }
else if (*sx < (0x80 + 0x40)) else if (*sx < (0x80 + 0x40))
{ // 10nnnnnn 8 through B cannot be first hex codes { // 10nnnnnn 8 through B cannot be first hex codes

View File

@ -187,7 +187,7 @@ void ListView::setValues(int codepage)
{ {
_codepage = codepage; _codepage = codepage;
for (int i = 0 ; i < 256 ; i++) for (int i = 0 ; i < 256 ; ++i)
{ {
LVITEM item; LVITEM item;
item.mask = LVIF_TEXT; item.mask = LVIF_TEXT;

View File

@ -63,7 +63,7 @@ ClipboardData ClipboardHistoryPanel::getClipboadData()
unsigned long *lpLen = (unsigned long *)GlobalLock(hglbLen); unsigned long *lpLen = (unsigned long *)GlobalLock(hglbLen);
if (lpLen != NULL) if (lpLen != NULL)
{ {
for (size_t i = 0 ; i < (*lpLen) ; i++) for (size_t i = 0 ; i < (*lpLen) ; ++i)
{ {
clipboardData.push_back((unsigned char)lpchar[i]); clipboardData.push_back((unsigned char)lpchar[i]);
} }
@ -74,7 +74,7 @@ ClipboardData ClipboardHistoryPanel::getClipboadData()
else else
{ {
int nbBytes = (lstrlenW(lpWchar) + 1) * sizeof(wchar_t); int nbBytes = (lstrlenW(lpWchar) + 1) * sizeof(wchar_t);
for (int i = 0 ; i < nbBytes ; i++) for (int i = 0 ; i < nbBytes ; ++i)
{ {
clipboardData.push_back((unsigned char)lpchar[i]); clipboardData.push_back((unsigned char)lpchar[i]);
} }
@ -95,7 +95,7 @@ ByteArray::ByteArray(ClipboardData cd)
return; return;
} }
_pBytes = new unsigned char[_length]; _pBytes = new unsigned char[_length];
for (size_t i = 0 ; i < _length ; i++) for (size_t i = 0 ; i < _length ; ++i)
{ {
_pBytes[i] = cd[i]; _pBytes[i] = cd[i];
} }
@ -115,7 +115,7 @@ StringArray::StringArray(ClipboardData cd, size_t maxLen)
_pBytes = new unsigned char[_length+(isCompleted?0:2)]; _pBytes = new unsigned char[_length+(isCompleted?0:2)];
size_t i = 0; size_t i = 0;
for ( ; i < _length ; i++) for ( ; i < _length ; ++i)
{ {
if (!isCompleted && (i == _length-5 || i == _length-3 || i == _length-1)) if (!isCompleted && (i == _length-5 || i == _length-3 || i == _length-1))
_pBytes[i] = 0; _pBytes[i] = 0;
@ -138,11 +138,11 @@ int ClipboardHistoryPanel::getClipboardDataIndex(ClipboardData cbd)
{ {
int iFound = -1; int iFound = -1;
bool found = false; bool found = false;
for (size_t i = 0, len = _clipboardDataVector.size() ; i < len ; i++) for (size_t i = 0, len = _clipboardDataVector.size() ; i < len ; ++i)
{ {
if (cbd.size() == _clipboardDataVector[i].size()) if (cbd.size() == _clipboardDataVector[i].size())
{ {
for (size_t j = 0, len2 = cbd.size(); j < len2 ; j++) for (size_t j = 0, len2 = cbd.size(); j < len2 ; ++j)
{ {
if (cbd[j] == _clipboardDataVector[i][j]) if (cbd[j] == _clipboardDataVector[i][j])
found = true; found = true;

View File

@ -93,7 +93,7 @@ BOOL CALLBACK ColourPopup::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPara
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
int nColor; int nColor;
for (nColor = 0 ; nColor < int(sizeof(colourItems)/sizeof(DWORD)) ; nColor++) for (nColor = 0 ; nColor < int(sizeof(colourItems)/sizeof(DWORD)) ; ++nColor)
{ {
::SendDlgItemMessage(_hSelf, IDC_COLOUR_LIST, LB_ADDSTRING, nColor, (LPARAM) ""); ::SendDlgItemMessage(_hSelf, IDC_COLOUR_LIST, LB_ADDSTRING, nColor, (LPARAM) "");
::SendDlgItemMessage(_hSelf, IDC_COLOUR_LIST, LB_SETITEMDATA , nColor, (LPARAM) colourItems[nColor]); ::SendDlgItemMessage(_hSelf, IDC_COLOUR_LIST, LB_SETITEMDATA , nColor, (LPARAM) colourItems[nColor]);

View File

@ -102,7 +102,7 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
_currentThemeIndex = -1; _currentThemeIndex = -1;
int defaultThemeIndex = 0; int defaultThemeIndex = 0;
ThemeSwitcher & themeSwitcher = nppParamInst->getThemeSwitcher(); ThemeSwitcher & themeSwitcher = nppParamInst->getThemeSwitcher();
for(size_t i = 0 ; i < themeSwitcher.size() ; i++) for(size_t i = 0 ; i < themeSwitcher.size() ; ++i)
{ {
pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(i); pair<generic_string, generic_string> & themeInfo = themeSwitcher.getElementFromIndex(i);
int j = ::SendMessage(_hSwitch2ThemeCombo, CB_ADDSTRING, 0, (LPARAM)themeInfo.first.c_str()); int j = ::SendMessage(_hSwitch2ThemeCombo, CB_ADDSTRING, 0, (LPARAM)themeInfo.first.c_str());
@ -122,11 +122,11 @@ BOOL CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
} }
::SendMessage(_hSwitch2ThemeCombo, CB_SETCURSEL, _currentThemeIndex, 0); ::SendMessage(_hSwitch2ThemeCombo, CB_SETCURSEL, _currentThemeIndex, 0);
for(int i = 0 ; i < sizeof(fontSizeStrs)/(3*sizeof(TCHAR)) ; i++) for(int i = 0 ; i < sizeof(fontSizeStrs)/(3*sizeof(TCHAR)) ; ++i)
::SendMessage(_hFontSizeCombo, CB_ADDSTRING, 0, (LPARAM)fontSizeStrs[i]); ::SendMessage(_hFontSizeCombo, CB_ADDSTRING, 0, (LPARAM)fontSizeStrs[i]);
const std::vector<generic_string> & fontlist = (NppParameters::getInstance())->getFontList(); const std::vector<generic_string> & fontlist = (NppParameters::getInstance())->getFontList();
for (size_t i = 0, len = fontlist.size() ; i < len ; i++) for (size_t i = 0, len = fontlist.size() ; i < len ; ++i)
{ {
int j = ::SendMessage(_hFontNameCombo, CB_ADDSTRING, 0, (LPARAM)fontlist[i].c_str()); int j = ::SendMessage(_hFontNameCombo, CB_ADDSTRING, 0, (LPARAM)fontlist[i].c_str());
::SendMessage(_hFontNameCombo, CB_SETITEMDATA, j, (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")); ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, (LPARAM)TEXT("Global Styles"));
// All the lexers // All the lexers
for (int i = 0, nb = _lsArray.getNbLexer() ; i < nb ; i++) for (int i = 0, nb = _lsArray.getNbLexer() ; i < nb ; ++i)
{ {
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_ADDSTRING, 0, (LPARAM)_lsArray.getLexerDescFromIndex(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; StyleArray & lexerStyler = index?_lsArray.getLexerFromIndex(index-1):_globalStyles;
for (int i = 0, nb = lexerStyler.getNbStyler(); i < nb ; i++) for (int i = 0, nb = lexerStyler.getNbStyler(); i < nb ; ++i)
{ {
Style & style = lexerStyler.getStyler(i); Style & style = lexerStyler.getStyler(i);
::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_ADDSTRING, 0, (LPARAM)style._styleDesc); ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_ADDSTRING, 0, (LPARAM)style._styleDesc);

View File

@ -46,7 +46,7 @@ ContextMenu::~ContextMenu()
{ {
if (isCreated()) if (isCreated())
{ {
for (size_t i = 0, len = _subMenus.size(); i < len; i++) for (size_t i = 0, len = _subMenus.size(); i < len; ++i)
::DestroyMenu(_subMenus[i]); ::DestroyMenu(_subMenus[i]);
::DestroyMenu(_hMenu); ::DestroyMenu(_hMenu);
} }
@ -61,7 +61,7 @@ void ContextMenu::create(HWND hParent, const vector<MenuItemUnit> & menuItemArra
generic_string currentParentFolderStr = TEXT(""); generic_string currentParentFolderStr = TEXT("");
int j = 0; int j = 0;
for (size_t i = 0, len = menuItemArray.size(); i < len; i++) for (size_t i = 0, len = menuItemArray.size(); i < len; ++i)
{ {
const MenuItemUnit & item = menuItemArray[i]; const MenuItemUnit & item = menuItemArray[i];
if (item._parentFolderName == TEXT("")) if (item._parentFolderName == TEXT(""))

View File

@ -155,7 +155,7 @@ void DockingCont::removeToolbar(tTbData TbData)
{ {
// remove from list // remove from list
// items in _vTbData are removed in the loop so _vTbData.size() should be checked in every iteration // items in _vTbData are removed in the loop so _vTbData.size() should be checked in every iteration
for (size_t iTb = 0 ; iTb < _vTbData.size(); iTb++) for (size_t iTb = 0 ; iTb < _vTbData.size(); ++iTb)
{ {
if (_vTbData[iTb]->hClient == TbData.hClient) if (_vTbData[iTb]->hClient == TbData.hClient)
{ {
@ -176,7 +176,7 @@ tTbData* DockingCont::findToolbarByWnd(HWND hClient)
tTbData* pTbData = NULL; tTbData* pTbData = NULL;
// find entry by handle // find entry by handle
for (size_t iTb = 0, len = _vTbData.size(); iTb < len; iTb++) for (size_t iTb = 0, len = _vTbData.size(); iTb < len; ++iTb)
{ {
if (hClient == _vTbData[iTb]->hClient) if (hClient == _vTbData[iTb]->hClient)
{ {
@ -191,7 +191,7 @@ tTbData* DockingCont::findToolbarByName(TCHAR* pszName)
tTbData* pTbData = NULL; tTbData* pTbData = NULL;
// find entry by handle // find entry by handle
for (size_t iTb = 0, len = _vTbData.size(); iTb < len; iTb++) for (size_t iTb = 0, len = _vTbData.size(); iTb < len; ++iTb)
{ {
if (lstrcmp(pszName, _vTbData[iTb]->pszName) == 0) if (lstrcmp(pszName, _vTbData[iTb]->pszName) == 0)
{ {
@ -246,7 +246,7 @@ vector<tTbData*> DockingCont::getDataOfVisTb()
tcItem.mask = TCIF_PARAM; tcItem.mask = TCIF_PARAM;
for(int iItem = 0; iItem < iItemCnt; iItem++) for(int iItem = 0; iItem < iItemCnt; ++iItem)
{ {
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem); ::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
vTbData.push_back((tTbData*)tcItem.lParam); vTbData.push_back((tTbData*)tcItem.lParam);
@ -261,7 +261,7 @@ bool DockingCont::isTbVis(tTbData* data)
tcItem.mask = TCIF_PARAM; tcItem.mask = TCIF_PARAM;
for(int iItem = 0; iItem < iItemCnt; iItem++) for(int iItem = 0; iItem < iItemCnt; ++iItem)
{ {
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem); ::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
if (!tcItem.lParam) if (!tcItem.lParam)
@ -1068,7 +1068,7 @@ void DockingCont::onSize()
// update floating size // update floating size
if (_isFloating == true) if (_isFloating == true)
{ {
for (size_t iTb = 0, len = _vTbData.size(); iTb < len; iTb++) for (size_t iTb = 0, len = _vTbData.size(); iTb < len; ++iTb)
{ {
getWindowRect(_vTbData[iTb]->rcFloat); getWindowRect(_vTbData[iTb]->rcFloat);
} }
@ -1101,7 +1101,7 @@ void DockingCont::onSize()
UINT iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0); UINT iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
// resize visible plugin windows // resize visible plugin windows
for (UINT iItem = 0; iItem < iItemCnt; iItem++) for (UINT iItem = 0; iItem < iItemCnt; ++iItem)
{ {
tcItem.mask = TCIF_PARAM; tcItem.mask = TCIF_PARAM;
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem); ::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
@ -1128,7 +1128,7 @@ void DockingCont::doClose()
int iItemOff = 0; int iItemOff = 0;
int iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0); int iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);
for (int iItem = 0; iItem < iItemCnt; iItem++) for (int iItem = 0; iItem < iItemCnt; ++iItem)
{ {
TCITEM tcItem = {0}; TCITEM tcItem = {0};
@ -1147,7 +1147,7 @@ void DockingCont::doClose()
} }
else else
{ {
iItemOff++; ++iItemOff;
} }
} }
@ -1278,7 +1278,7 @@ int DockingCont::SearchPosInTab(tTbData* pTbData)
tcItem.mask = TCIF_PARAM; tcItem.mask = TCIF_PARAM;
for (int iItem = 0; iItem < iItemCnt; iItem++) for (int iItem = 0; iItem < iItemCnt; ++iItem)
{ {
::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem); ::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
if (!tcItem.lParam) if (!tcItem.lParam)
@ -1340,7 +1340,7 @@ void DockingCont::SelectTab(int iTab)
HDC hDc = ::GetDC(_hContTab); HDC hDc = ::GetDC(_hContTab);
SelectObject(hDc, _hFont); SelectObject(hDc, _hFont);
for (int iItem = 0; iItem < iItemCnt; iItem++) for (int iItem = 0; iItem < iItemCnt; ++iItem)
{ {
const TCHAR *pszTabTxt = NULL; const TCHAR *pszTabTxt = NULL;
@ -1362,7 +1362,7 @@ void DockingCont::SelectTab(int iTab)
tcItem.mask = TCIF_TEXT; tcItem.mask = TCIF_TEXT;
for (int iItem = 0; iItem < iItemCnt; iItem++) for (int iItem = 0; iItem < iItemCnt; ++iItem)
{ {
generic_string szText(TEXT("")); generic_string szText(TEXT(""));
if (iItem == iTab && pszMaxTxt) if (iItem == iTab && pszMaxTxt)

View File

@ -89,7 +89,7 @@ public:
void showToolbar(tTbData *pTbData, BOOL state); void showToolbar(tTbData *pTbData, BOOL state);
BOOL updateInfo(HWND hClient) { BOOL updateInfo(HWND hClient) {
for (size_t iTb = 0; iTb < _vTbData.size(); iTb++) for (size_t iTb = 0; iTb < _vTbData.size(); ++iTb)
{ {
if (_vTbData[iTb]->hClient == hClient) if (_vTbData[iTb]->hClient == hClient)
{ {

View File

@ -49,12 +49,12 @@ LRESULT CALLBACK FocusWndProc(int nCode, WPARAM wParam, LPARAM lParam) {
vector<DockingCont*> & vcontainer = pDockingManager->getContainerInfo(); vector<DockingCont*> & vcontainer = pDockingManager->getContainerInfo();
CWPSTRUCT * pCwp = (CWPSTRUCT*)lParam; CWPSTRUCT * pCwp = (CWPSTRUCT*)lParam;
if (pCwp->message == WM_KILLFOCUS) { if (pCwp->message == WM_KILLFOCUS) {
for (int i = 0; i < DOCKCONT_MAX; i++) for (int i = 0; i < DOCKCONT_MAX; ++i)
{ {
vcontainer[i]->SetActive(FALSE); //deactivate all containers vcontainer[i]->SetActive(FALSE); //deactivate all containers
} }
} else if (pCwp->message == WM_SETFOCUS) { } else if (pCwp->message == WM_SETFOCUS) {
for (int i = 0; i < DOCKCONT_MAX; i++) for (int i = 0; i < DOCKCONT_MAX; ++i)
{ {
vcontainer[i]->SetActive(IsChild(vcontainer[i]->getHSelf(), pCwp->hwnd)); //activate the container that contains the window with focus, this can be none vcontainer[i]->SetActive(IsChild(vcontainer[i]->getHSelf(), pCwp->hwnd)); //activate the container that contains the window with focus, this can be none
} }
@ -76,7 +76,7 @@ DockingManager::DockingManager()
_iContMap[3] = CONT_BOTTOM; _iContMap[3] = CONT_BOTTOM;
// create four containers with splitters // create four containers with splitters
for (int i = 0; i < DOCKCONT_MAX; i++) for (int i = 0; i < DOCKCONT_MAX; ++i)
{ {
DockingCont *_pDockCont = new DockingCont; DockingCont *_pDockCont = new DockingCont;
_vContainer.push_back(_pDockCont); _vContainer.push_back(_pDockCont);
@ -89,7 +89,7 @@ DockingManager::DockingManager()
DockingManager::~DockingManager() DockingManager::~DockingManager()
{ {
// delete 4 splitters // delete 4 splitters
for (int i = 0; i < DOCKCONT_MAX; i++) for (int i = 0; i < DOCKCONT_MAX; ++i)
{ {
delete _vSplitter[i]; delete _vSplitter[i];
} }
@ -141,7 +141,7 @@ void DockingManager::init(HINSTANCE hInst, HWND hWnd, Window ** ppWin)
setClientWnd(ppWin); setClientWnd(ppWin);
// create docking container // create docking container
for (int iCont = 0; iCont < DOCKCONT_MAX; iCont++) for (int iCont = 0; iCont < DOCKCONT_MAX; ++iCont)
{ {
_vContainer[iCont]->init(_hInst, _hSelf); _vContainer[iCont]->init(_hInst, _hSelf);
_vContainer[iCont]->doDialog(false); _vContainer[iCont]->doDialog(false);
@ -195,7 +195,7 @@ LRESULT CALLBACK DockingManager::staticWinProc(HWND hwnd, UINT message, WPARAM w
void DockingManager::updateContainerInfo(HWND hClient) void DockingManager::updateContainerInfo(HWND hClient)
{ {
for (size_t iCont = 0, len = _vContainer.size(); iCont < len; iCont++) for (size_t iCont = 0, len = _vContainer.size(); iCont < len; ++iCont)
{ {
if (_vContainer[iCont]->updateInfo(hClient) == TRUE) if (_vContainer[iCont]->updateInfo(hClient) == TRUE)
{ {
@ -206,7 +206,7 @@ void DockingManager::updateContainerInfo(HWND hClient)
void DockingManager::showContainer(HWND hCont, BOOL view) void DockingManager::showContainer(HWND hCont, BOOL view)
{ {
for (size_t iCont = 0, len = _vContainer.size(); iCont < len; iCont++) for (size_t iCont = 0, len = _vContainer.size(); iCont < len; ++iCont)
{ {
if (_vContainer[iCont]->getHSelf() == hCont) if (_vContainer[iCont]->getHSelf() == hCont)
showContainer(iCont, view); showContainer(iCont, view);
@ -220,7 +220,7 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
case WM_NCACTIVATE: case WM_NCACTIVATE:
{ {
// activate/deactivate titlebar of toolbars // activate/deactivate titlebar of toolbars
for (size_t iCont = DOCKCONT_MAX, len = _vContainer.size(); iCont < len; iCont++) for (size_t iCont = DOCKCONT_MAX, len = _vContainer.size(); iCont < len; ++iCont)
{ {
::SendMessage(_vContainer[iCont]->getHSelf(), WM_NCACTIVATE, wParam, (LPARAM)-1); ::SendMessage(_vContainer[iCont]->getHSelf(), WM_NCACTIVATE, wParam, (LPARAM)-1);
} }
@ -267,7 +267,7 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
break; break;
// set respective activate state // set respective activate state
for (int i = 0; i < DOCKCONT_MAX; i++) for (int i = 0; i < DOCKCONT_MAX; ++i)
{ {
_vContainer[i]->SetActive(IsChild(_vContainer[i]->getHSelf(), ::GetFocus())); _vContainer[i]->SetActive(IsChild(_vContainer[i]->getHSelf(), ::GetFocus()));
} }
@ -286,7 +286,7 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
{ {
int offset = wParam; int offset = wParam;
for (int iCont = 0; iCont < DOCKCONT_MAX; iCont++) for (int iCont = 0; iCont < DOCKCONT_MAX; ++iCont)
{ {
if (_vSplitter[iCont]->getHSelf() == (HWND)lParam) if (_vSplitter[iCont]->getHSelf() == (HWND)lParam)
{ {
@ -370,7 +370,7 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
} }
case DMM_GETICONPOS: case DMM_GETICONPOS:
{ {
for (UINT uImageCnt = 0, len = _vImageList.size(); uImageCnt < len; uImageCnt++) for (UINT uImageCnt = 0, len = _vImageList.size(); uImageCnt < len; ++uImageCnt)
{ {
if ((HWND)lParam == _vImageList[uImageCnt]) if ((HWND)lParam == _vImageList[uImageCnt])
{ {
@ -674,7 +674,7 @@ void DockingManager::setActiveTab(int iCont, int iItem)
void DockingManager::showDockableDlg(HWND hDlg, BOOL view) void DockingManager::showDockableDlg(HWND hDlg, BOOL view)
{ {
tTbData *pTbData = NULL; tTbData *pTbData = NULL;
for (size_t i = 0, len = _vContainer.size(); i < len; i++) for (size_t i = 0, len = _vContainer.size(); i < len; ++i)
{ {
pTbData = _vContainer[i]->findToolbarByWnd(hDlg); pTbData = _vContainer[i]->findToolbarByWnd(hDlg);
if (pTbData != NULL) if (pTbData != NULL)
@ -688,7 +688,7 @@ void DockingManager::showDockableDlg(HWND hDlg, BOOL view)
void DockingManager::showDockableDlg(TCHAR* pszName, BOOL view) void DockingManager::showDockableDlg(TCHAR* pszName, BOOL view)
{ {
tTbData *pTbData = NULL; tTbData *pTbData = NULL;
for (size_t i = 0, len = _vContainer.size(); i < len; i++) for (size_t i = 0, len = _vContainer.size(); i < len; ++i)
{ {
pTbData = _vContainer[i]->findToolbarByName(pszName); pTbData = _vContainer[i]->findToolbarByName(pszName);
if (pTbData != NULL) if (pTbData != NULL)
@ -808,7 +808,7 @@ DockingCont* DockingManager::toggleVisTb(DockingCont* pContSrc, UINT message, LP
pContSrc->doDialog(false); pContSrc->doDialog(false);
onSize(); onSize();
for (size_t iTb = 0, len = vTbData.size(); iTb < len; iTb++) for (size_t iTb = 0, len = vTbData.size(); iTb < len; ++iTb)
{ {
// get data one by another // get data one by another
tTbData TbData = *vTbData[iTb]; tTbData TbData = *vTbData[iTb];
@ -869,7 +869,7 @@ void DockingManager::toggleVisTb(DockingCont* pContSrc, DockingCont* pContTgt)
pContSrc->doDialog(false); pContSrc->doDialog(false);
onSize(); onSize();
for (size_t iTb = 0, len = vTbData.size(); iTb < len; iTb++) for (size_t iTb = 0, len = vTbData.size(); iTb < len; ++iTb)
{ {
// get data one by another // get data one by another
tTbData TbData = *vTbData[iTb]; tTbData TbData = *vTbData[iTb];
@ -919,7 +919,7 @@ BOOL DockingManager::ContExists(size_t iCont)
int DockingManager::GetContainer(DockingCont* pCont) int DockingManager::GetContainer(DockingCont* pCont)
{ {
int iRet = -1; int iRet = -1;
for (size_t iCont = 0, len = _vContainer.size(); iCont < len; iCont++) for (size_t iCont = 0, len = _vContainer.size(); iCont < len; ++iCont)
{ {
if (_vContainer[iCont] == pCont) if (_vContainer[iCont] == pCont)
{ {
@ -938,24 +938,24 @@ int DockingManager::FindEmptyContainer()
BOOL* pArrayPos = &pPrevDockList[1]; BOOL* pArrayPos = &pPrevDockList[1];
// delete all entries // delete all entries
for (size_t iCont = 0, len = _vContainer.size()+1; iCont < len; iCont++) for (size_t iCont = 0, len = _vContainer.size()+1; iCont < len; ++iCont)
{ {
pPrevDockList[iCont] = FALSE; pPrevDockList[iCont] = FALSE;
} }
// search for used floated containers // search for used floated containers
for (size_t iCont = 0; iCont < DOCKCONT_MAX; iCont++) for (size_t iCont = 0; iCont < DOCKCONT_MAX; ++iCont)
{ {
vector<tTbData*> vTbData = _vContainer[iCont]->getDataOfAllTb(); vector<tTbData*> vTbData = _vContainer[iCont]->getDataOfAllTb();
for (size_t iTb = 0, len = vTbData.size(); iTb < len; iTb++) for (size_t iTb = 0, len = vTbData.size(); iTb < len; ++iTb)
{ {
pArrayPos[vTbData[iTb]->iPrevCont] = TRUE; pArrayPos[vTbData[iTb]->iPrevCont] = TRUE;
} }
} }
// find free container // find free container
for (size_t iCont = DOCKCONT_MAX, len = _vContainer.size(); iCont < len; iCont++) for (size_t iCont = DOCKCONT_MAX, len = _vContainer.size(); iCont < len; ++iCont)
{ {
if (pArrayPos[iCont] == FALSE) if (pArrayPos[iCont] == FALSE)
{ {

View File

@ -98,7 +98,7 @@ public :
}; };
void setTabStyle(BOOL orangeLine) { void setTabStyle(BOOL orangeLine) {
for (size_t i = 0; i < _vContainer.size(); i++) for (size_t i = 0; i < _vContainer.size(); ++i)
_vContainer[i]->setTabStyle(orangeLine); _vContainer[i]->setTabStyle(orangeLine);
}; };

View File

@ -416,7 +416,7 @@ void Gripper::doTabReordering(POINT pt)
int iItemOld = _iItem; int iItemOld = _iItem;
/* search for every tab entry */ /* search for every tab entry */
for (size_t iCont = 0, len = vCont.size(); iCont < len; iCont++) for (size_t iCont = 0, len = vCont.size(); iCont < len; ++iCont)
{ {
hTab = vCont[iCont]->getTabWnd(); hTab = vCont[iCont]->getTabWnd();
@ -729,7 +729,7 @@ DockingCont* Gripper::contHitTest(POINT pt)
vector<DockingCont*> vCont = _pDockMgr->getContainerInfo(); vector<DockingCont*> vCont = _pDockMgr->getContainerInfo();
HWND hWnd = ::WindowFromPoint(pt); HWND hWnd = ::WindowFromPoint(pt);
for (UINT iCont = 0, len = vCont.size(); iCont < len; iCont++) for (UINT iCont = 0, len = vCont.size(); iCont < len; ++iCont)
{ {
/* test if within caption */ /* test if within caption */
if (hWnd == vCont[iCont]->getCaptionWnd()) if (hWnd == vCont[iCont]->getCaptionWnd())
@ -783,7 +783,7 @@ DockingCont* Gripper::workHitTest(POINT pt, RECT *rc)
vector<DockingCont*> vCont = _pDockMgr->getContainerInfo(); vector<DockingCont*> vCont = _pDockMgr->getContainerInfo();
/* at first test if cursor points into a visible container */ /* at first test if cursor points into a visible container */
for (size_t iCont = 0, len = vCont.size(); iCont < len; iCont++) for (size_t iCont = 0, len = vCont.size(); iCont < len; ++iCont)
{ {
if (vCont[iCont]->isVisible()) if (vCont[iCont]->isVisible())
{ {
@ -798,7 +798,7 @@ DockingCont* Gripper::workHitTest(POINT pt, RECT *rc)
} }
/* now search if cusor hits a possible docking area */ /* now search if cusor hits a possible docking area */
for (int iWork = 0; iWork < DOCKCONT_MAX; iWork++) for (int iWork = 0; iWork < DOCKCONT_MAX; ++iWork)
{ {
if (!vCont[iWork]->isVisible()) if (!vCont[iWork]->isVisible())
{ {

View File

@ -166,7 +166,7 @@ int DocumentMap::getEditorTextZoneWidth()
(*_ppEditView)->getClientRect(editorRect); (*_ppEditView)->getClientRect(editorRect);
int marginWidths = 0; int marginWidths = 0;
for (int m = 0; m < 4; m++) for (int m = 0; m < 4; ++m)
{ {
marginWidths += (*_ppEditView)->execute(SCI_GETMARGINWIDTHN, m); marginWidths += (*_ppEditView)->execute(SCI_GETMARGINWIDTHN, m);
} }

View File

@ -94,7 +94,7 @@ bool FindCharsInRangeDlg::findCharInRange(unsigned char beginRange, unsigned cha
for (int i = startPos-(direction == dirUp?1:0); for (int i = startPos-(direction == dirUp?1:0);
(direction == dirDown)?i < totalSize:i >= 0 ; (direction == dirDown)?i < totalSize:i >= 0 ;
(direction == dirDown)?(i++):(i--)) (direction == dirDown)?(++i):(--i))
{ {
if ((unsigned char)content[i] >= beginRange && (unsigned char)content[i] <= endRange) if ((unsigned char)content[i] >= beginRange && (unsigned char)content[i] <= endRange)
{ {
@ -109,7 +109,7 @@ bool FindCharsInRangeDlg::findCharInRange(unsigned char beginRange, unsigned cha
{ {
for (int i = (direction == dirUp?totalSize-1:0); for (int i = (direction == dirUp?totalSize-1:0);
(direction == dirDown)?i < totalSize:i >= 0 ; (direction == dirDown)?i < totalSize:i >= 0 ;
(direction == dirDown)?(i++):(i--)) (direction == dirDown)?(++i):(--i))
{ {
if ((unsigned char)content[i] >= beginRange && (unsigned char)content[i] <= endRange) if ((unsigned char)content[i] >= beginRange && (unsigned char)content[i] <= endRange)
{ {

View File

@ -96,11 +96,11 @@ size_t FunctionListPanel::getBodyClosePos(size_t begin, const TCHAR *bodyOpenSym
int tmpStart = (*_ppEditView)->searchInTarget(bodyOpenSymbol, lstrlen(bodyOpenSymbol), targetStart, targetEnd); int tmpStart = (*_ppEditView)->searchInTarget(bodyOpenSymbol, lstrlen(bodyOpenSymbol), targetStart, targetEnd);
if (tmpStart != -1 && tmpStart != -2) // open symbol found if (tmpStart != -1 && tmpStart != -2) // open symbol found
{ {
cntOpen++; ++cntOpen;
} }
else // if it's not open symbol, then it must be the close one else // if it's not open symbol, then it must be the close one
{ {
cntOpen--; --cntOpen;
} }
} }
else // nothing found else // nothing found
@ -159,7 +159,7 @@ generic_string FunctionListPanel::parseSubLevel(size_t begin, size_t end, std::v
void FunctionListPanel::addInTreeStateArray(TreeStateNode tree2Update) void FunctionListPanel::addInTreeStateArray(TreeStateNode tree2Update)
{ {
bool found = false; bool found = false;
for (size_t i = 0, len = _treeStates.size(); i < len; i++) for (size_t i = 0, len = _treeStates.size(); i < len; ++i)
{ {
if (_treeStates[i]._extraData == tree2Update._extraData) if (_treeStates[i]._extraData == tree2Update._extraData)
{ {
@ -174,7 +174,7 @@ void FunctionListPanel::addInTreeStateArray(TreeStateNode tree2Update)
TreeStateNode* FunctionListPanel::getFromTreeStateArray(generic_string fullFilePath) TreeStateNode* FunctionListPanel::getFromTreeStateArray(generic_string fullFilePath)
{ {
for (size_t i = 0, len = _treeStates.size(); i < len; i++) for (size_t i = 0, len = _treeStates.size(); i < len; ++i)
{ {
if (_treeStates[i]._extraData == fullFilePath) if (_treeStates[i]._extraData == fullFilePath)
return &_treeStates[i]; return &_treeStates[i];
@ -201,7 +201,7 @@ void FunctionListPanel::reload()
_treeView.addItem(fn, NULL, INDEX_ROOT, TEXT("-1")); _treeView.addItem(fn, NULL, INDEX_ROOT, TEXT("-1"));
} }
for (size_t i = 0, len = fi.size(); i < len; i++) for (size_t i = 0, len = fi.size(); i < len; ++i)
{ {
// no 2 level // no 2 level
bool b = false; bool b = false;

View File

@ -32,7 +32,7 @@
FunctionParsersManager::~FunctionParsersManager() FunctionParsersManager::~FunctionParsersManager()
{ {
for (size_t i = 0, len = _parsers.size(); i < len; i++) for (size_t i = 0, len = _parsers.size(); i < len; ++i)
{ {
delete _parsers[i]; delete _parsers[i];
} }
@ -231,7 +231,7 @@ bool FunctionParsersManager::getFuncListFromXmlTree()
const TCHAR *id = (childNode->ToElement())->Attribute(TEXT("id")); const TCHAR *id = (childNode->ToElement())->Attribute(TEXT("id"));
if ((langIDStr || (exts && exts[0])) && (id && id[0])) if ((langIDStr || (exts && exts[0])) && (id && id[0]))
{ {
for (size_t i = 0, len = _parsers.size(); i < len; i++) for (size_t i = 0, len = _parsers.size(); i < len; ++i)
{ {
if (_parsers[i]->_id == id) if (_parsers[i]->_id == id)
{ {
@ -248,7 +248,7 @@ bool FunctionParsersManager::getFuncListFromXmlTree()
FunctionParser * FunctionParsersManager::getParser(int langID) FunctionParser * FunctionParsersManager::getParser(int langID)
{ {
for (size_t i = 0, len = _associationMap.size(); i < len; i++) for (size_t i = 0, len = _associationMap.size(); i < len; ++i)
{ {
if (langID == _associationMap[i]._langID) if (langID == _associationMap[i]._langID)
return _parsers[_associationMap[i]._id]; return _parsers[_associationMap[i]._id];
@ -261,7 +261,7 @@ FunctionParser * FunctionParsersManager::getParser(generic_string ext)
if (ext == TEXT("")) if (ext == TEXT(""))
return NULL; return NULL;
for (size_t i = 0, len = _associationMap.size(); i < len; i++) for (size_t i = 0, len = _associationMap.size(); i < len; ++i)
{ {
if (ext == _associationMap[i]._ext) if (ext == _associationMap[i]._ext)
return _parsers[_associationMap[i]._id]; return _parsers[_associationMap[i]._id];
@ -454,11 +454,11 @@ size_t FunctionZoneParser::getBodyClosePos(size_t begin, const TCHAR *bodyOpenSy
int tmpStart = (*ppEditView)->searchInTarget(bodyOpenSymbol, lstrlen(bodyOpenSymbol), targetStart, targetEnd); int tmpStart = (*ppEditView)->searchInTarget(bodyOpenSymbol, lstrlen(bodyOpenSymbol), targetStart, targetEnd);
if (tmpStart != -1 && tmpStart != -2) // open symbol found if (tmpStart != -1 && tmpStart != -2) // open symbol found
{ {
cntOpen++; ++cntOpen;
} }
else // if it's not open symbol, then it must be the close one else // if it's not open symbol, then it must be the close one
{ {
cntOpen--; --cntOpen;
} }
} }
else // nothing found else // nothing found
@ -557,7 +557,7 @@ void FunctionParser::getCommentZones(vector< pair<int, int> > & commentZone, siz
bool FunctionParser::isInZones(int pos2Test, const std::vector< std::pair<int, int> > & zones) bool FunctionParser::isInZones(int pos2Test, const std::vector< std::pair<int, int> > & zones)
{ {
for (size_t i = 0, len = zones.size(); i < len; i++) for (size_t i = 0, len = zones.size(); i < len; ++i)
{ {
if (pos2Test >= zones[i].first && pos2Test < zones[i].second) if (pos2Test >= zones[i].first && pos2Test < zones[i].second)
{ {
@ -582,7 +582,7 @@ void FunctionParser::getInvertZones(vector< pair<int, int> > & destZones, vecto
} }
size_t i = 0; size_t i = 0;
for (size_t len = sourceZones.size() - 1; i < len; i++) for (size_t len = sourceZones.size() - 1; i < len; ++i)
{ {
int newBegin = sourceZones[i].second + 1; int newBegin = sourceZones[i].second + 1;
int newEnd = sourceZones[i+1].first - 1; int newEnd = sourceZones[i+1].first - 1;
@ -600,7 +600,7 @@ void FunctionZoneParser::parse(std::vector<foundInfo> & foundInfos, size_t begin
vector< pair<int, int> > classZones, commentZones, nonCommentZones; vector< pair<int, int> > classZones, commentZones, nonCommentZones;
getCommentZones(commentZones, begin, end, ppEditView); getCommentZones(commentZones, begin, end, ppEditView);
getInvertZones(nonCommentZones, commentZones, begin, end); getInvertZones(nonCommentZones, commentZones, begin, end);
for (size_t i = 0, len = nonCommentZones.size(); i < len; i++) for (size_t i = 0, len = nonCommentZones.size(); i < len; ++i)
{ {
classParse(foundInfos, classZones, commentZones, nonCommentZones[i].first, nonCommentZones[i].second, ppEditView, classStructName); classParse(foundInfos, classZones, commentZones, nonCommentZones[i].first, nonCommentZones[i].second, ppEditView, classStructName);
} }
@ -611,7 +611,7 @@ void FunctionUnitParser::parse(std::vector<foundInfo> & foundInfos, size_t begin
vector< pair<int, int> > commentZones, nonCommentZones; vector< pair<int, int> > commentZones, nonCommentZones;
getCommentZones(commentZones, begin, end, ppEditView); getCommentZones(commentZones, begin, end, ppEditView);
getInvertZones(nonCommentZones, commentZones, begin, end); getInvertZones(nonCommentZones, commentZones, begin, end);
for (size_t i = 0, len = nonCommentZones.size(); i < len; i++) for (size_t i = 0, len = nonCommentZones.size(); i < len; ++i)
{ {
funcParse(foundInfos, nonCommentZones[i].first, nonCommentZones[i].second, ppEditView, classStructName); funcParse(foundInfos, nonCommentZones[i].first, nonCommentZones[i].second, ppEditView, classStructName);
} }
@ -634,7 +634,7 @@ void FunctionMixParser::parse(std::vector<foundInfo> & foundInfos, size_t begin,
classParse(foundInfos, scannedZones, commentZones, begin, end, ppEditView, classStructName); classParse(foundInfos, scannedZones, commentZones, begin, end, ppEditView, classStructName);
// the second level // the second level
for (size_t i = 0, len = scannedZones.size(); i < len; i++) for (size_t i = 0, len = scannedZones.size(); i < len; ++i)
{ {
vector< pair<int, int> > temp; vector< pair<int, int> > temp;
classParse(foundInfos, temp, commentZones, scannedZones[i].first, scannedZones[i].second, ppEditView, classStructName); classParse(foundInfos, temp, commentZones, scannedZones[i].first, scannedZones[i].second, ppEditView, classStructName);
@ -645,7 +645,7 @@ void FunctionMixParser::parse(std::vector<foundInfo> & foundInfos, size_t begin,
// for each nonScannedZones, search functions // for each nonScannedZones, search functions
if (_funcUnitPaser) if (_funcUnitPaser)
{ {
for (size_t i = 0, len = nonScannedZones.size(); i < len; i++) for (size_t i = 0, len = nonScannedZones.size(); i < len; ++i)
{ {
_funcUnitPaser->funcParse(foundInfos, nonScannedZones[i].first, nonScannedZones[i].second, ppEditView, classStructName); _funcUnitPaser->funcParse(foundInfos, nonScannedZones[i].first, nonScannedZones[i].second, ppEditView, classStructName);
} }

View File

@ -128,11 +128,11 @@ int HomeColumnNthVisible(int SI)
int j,hc,count; int j,hc,count;
count=0; count=0;
hc=BGHS[SI].homecol; hc=BGHS[SI].homecol;
for(j=1;j<=hc;j++) for(j=1;j<=hc;++j)
{ {
if(BGHS[SI].columnwidths[j]>0) if(BGHS[SI].columnwidths[j]>0)
{ {
count++; ++count;
} }
} }
return count; return count;

View File

@ -104,7 +104,8 @@ void ShortcutMapper::fillOutBabyGrid()
switch(_currentState) { switch(_currentState) {
case STATE_MENU: { case STATE_MENU: {
vector<CommandShortcut> & cshortcuts = nppParam->getUserShortcuts(); vector<CommandShortcut> & cshortcuts = nppParam->getUserShortcuts();
for(size_t i = 0; i < nrItems; i++) { for(size_t i = 0; i < nrItems; ++i)
{
_babygrid.setText(i+1, 1, cshortcuts[i].getName()); _babygrid.setText(i+1, 1, cshortcuts[i].getName());
_babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str()); _babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str());
} }
@ -113,7 +114,8 @@ void ShortcutMapper::fillOutBabyGrid()
break; } break; }
case STATE_MACRO: { case STATE_MACRO: {
vector<MacroShortcut> & cshortcuts = nppParam->getMacroList(); vector<MacroShortcut> & cshortcuts = nppParam->getMacroList();
for(size_t i = 0; i < nrItems; i++) { for(size_t i = 0; i < nrItems; ++i)
{
_babygrid.setText(i+1, 1, cshortcuts[i].getName()); _babygrid.setText(i+1, 1, cshortcuts[i].getName());
_babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str()); _babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str());
} }
@ -123,7 +125,8 @@ void ShortcutMapper::fillOutBabyGrid()
break; } break; }
case STATE_USER: { case STATE_USER: {
vector<UserCommand> & cshortcuts = nppParam->getUserCommandList(); vector<UserCommand> & cshortcuts = nppParam->getUserCommandList();
for(size_t i = 0; i < nrItems; i++) { for(size_t i = 0; i < nrItems; ++i)
{
_babygrid.setText(i+1, 1, cshortcuts[i].getName()); _babygrid.setText(i+1, 1, cshortcuts[i].getName());
_babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str()); _babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str());
} }
@ -133,7 +136,8 @@ void ShortcutMapper::fillOutBabyGrid()
break; } break; }
case STATE_PLUGIN: { case STATE_PLUGIN: {
vector<PluginCmdShortcut> & cshortcuts = nppParam->getPluginCommandList(); vector<PluginCmdShortcut> & cshortcuts = nppParam->getPluginCommandList();
for(size_t i = 0; i < nrItems; i++) { for(size_t i = 0; i < nrItems; ++i)
{
_babygrid.setText(i+1, 1, cshortcuts[i].getName()); _babygrid.setText(i+1, 1, cshortcuts[i].getName());
_babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str()); _babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str());
} }
@ -143,7 +147,8 @@ void ShortcutMapper::fillOutBabyGrid()
break; } break; }
case STATE_SCINTILLA: { case STATE_SCINTILLA: {
vector<ScintillaKeyMap> & cshortcuts = nppParam->getScintillaKeyList(); vector<ScintillaKeyMap> & cshortcuts = nppParam->getScintillaKeyList();
for(size_t i = 0; i < nrItems; i++) { for(size_t i = 0; i < nrItems; ++i)
{
_babygrid.setText(i+1, 1, cshortcuts[i].getName()); _babygrid.setText(i+1, 1, cshortcuts[i].getName());
_babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str()); _babygrid.setText(i+1, 2, cshortcuts[i].toString().c_str());
} }
@ -338,7 +343,7 @@ BOOL CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
nbElem = theMacros.size(); nbElem = theMacros.size();
hMenu = ::GetSubMenu((HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_MACRO); hMenu = ::GetSubMenu((HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_MACRO);
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_MACRO; modifCmd = IDM_SETTING_SHORTCUT_MAPPER_MACRO;
for (size_t i = shortcutIndex ; i < nbElem ; i++) //lower the IDs of the remaining items so there are no gaps for (size_t i = shortcutIndex ; i < nbElem ; ++i) //lower the IDs of the remaining items so there are no gaps
{ {
MacroShortcut ms = theMacros[i]; MacroShortcut ms = theMacros[i];
ms.setID(ms.getID() - 1); //shift all IDs ms.setID(ms.getID() - 1); //shift all IDs
@ -359,7 +364,7 @@ BOOL CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
nbElem = theUserCmds.size(); nbElem = theUserCmds.size();
hMenu = ::GetSubMenu((HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_RUN); hMenu = ::GetSubMenu((HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_RUN);
modifCmd = IDM_SETTING_SHORTCUT_MAPPER_RUN; modifCmd = IDM_SETTING_SHORTCUT_MAPPER_RUN;
for (size_t i = shortcutIndex ; i < nbElem ; i++) //lower the IDs of the remaining items so there are no gaps for (size_t i = shortcutIndex ; i < nbElem ; ++i) //lower the IDs of the remaining items so there are no gaps
{ {
UserCommand uc = theUserCmds[i]; UserCommand uc = theUserCmds[i];
uc.setID(uc.getID() - 1); //shift all IDs uc.setID(uc.getID() - 1); //shift all IDs

View File

@ -45,7 +45,7 @@ void IconList::create(int iconSize, HINSTANCE hInst, int *iconIDArray, int iconI
_pIconIDArray = iconIDArray; _pIconIDArray = iconIDArray;
_iconIDArraySize = iconIDArraySize; _iconIDArraySize = iconIDArraySize;
for (int i = 0 ; i < iconIDArraySize ; i++) for (int i = 0 ; i < iconIDArraySize ; ++i)
addIcon(iconIDArray[i]); addIcon(iconIDArray[i]);
}; };
@ -73,13 +73,13 @@ bool IconList::changeIcon(int index, const TCHAR *iconLocation) const
void IconList::setIconSize(int size) const void IconList::setIconSize(int size) const
{ {
ImageList_SetIconSize(_hImglst, size, size); ImageList_SetIconSize(_hImglst, size, size);
for (int i = 0 ; i < _iconIDArraySize ; i++) for (int i = 0 ; i < _iconIDArraySize ; ++i)
addIcon(_pIconIDArray[i]); addIcon(_pIconIDArray[i]);
} }
void ToolBarIcons::init(ToolBarButtonUnit *buttonUnitArray, int arraySize) void ToolBarIcons::init(ToolBarButtonUnit *buttonUnitArray, int arraySize)
{ {
for (int i = 0 ; i < arraySize ; i++) for (int i = 0 ; i < arraySize ; ++i)
_tbiis.push_back(buttonUnitArray[i]); _tbiis.push_back(buttonUnitArray[i]);
_nbCmd = arraySize; _nbCmd = arraySize;
} }
@ -90,7 +90,7 @@ void ToolBarIcons::reInit(int size)
ImageList_SetIconSize(getHotLst(), size, size); ImageList_SetIconSize(getHotLst(), size, size);
ImageList_SetIconSize(getDisableLst(), size, size); ImageList_SetIconSize(getDisableLst(), size, size);
for (size_t i = 0, len = _tbiis.size(); i < len; i++) for (size_t i = 0, len = _tbiis.size(); i < len; ++i)
{ {
if (_tbiis[i]._defaultIcon != -1) if (_tbiis[i]._defaultIcon != -1)
{ {

View File

@ -228,7 +228,7 @@ BOOL CALLBACK PreferenceDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
void PreferenceDlg::makeCategoryList() void PreferenceDlg::makeCategoryList()
{ {
for (size_t i = 0, len = _wVector.size(); i < len; i++) for (size_t i = 0, len = _wVector.size(); i < len; ++i)
{ {
::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_ADDSTRING, 0, (LPARAM)_wVector[i]._name.c_str()); ::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_ADDSTRING, 0, (LPARAM)_wVector[i]._name.c_str());
} }
@ -240,7 +240,7 @@ bool PreferenceDlg::renameDialogTitle(const TCHAR *internalName, const TCHAR *ne
{ {
bool foundIt = false; bool foundIt = false;
size_t i = 0; size_t i = 0;
for (size_t len = _wVector.size(); i < len; i++) for (size_t len = _wVector.size(); i < len; ++i)
{ {
if (_wVector[i]._internalName == internalName) if (_wVector[i]._internalName == internalName)
{ {
@ -272,7 +272,7 @@ bool PreferenceDlg::renameDialogTitle(const TCHAR *internalName, const TCHAR *ne
void PreferenceDlg::showDialogByIndex(int index) void PreferenceDlg::showDialogByIndex(int index)
{ {
size_t len = _wVector.size(); size_t len = _wVector.size();
for (size_t i = 0; i < len; i++) for (size_t i = 0; i < len; ++i)
{ {
_wVector[i]._dlg->display(false); _wVector[i]._dlg->display(false);
} }
@ -334,7 +334,7 @@ BOOL CALLBACK BarsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
#else #else
LocalizationSwitcher & localizationSwitcher = pNppParam->getLocalizationSwitcher(); LocalizationSwitcher & localizationSwitcher = pNppParam->getLocalizationSwitcher();
for (size_t i = 0, len = localizationSwitcher.size(); i < len ; i++) for (size_t i = 0, len = localizationSwitcher.size(); i < len ; ++i)
{ {
pair<wstring, wstring> localizationInfo = localizationSwitcher.getElementFromIndex(i); pair<wstring, wstring> localizationInfo = localizationSwitcher.getElementFromIndex(i);
::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_ADDSTRING, 0, (LPARAM)localizationInfo.first.c_str()); ::SendDlgItemMessage(_hSelf, IDC_COMBO_LOCALIZATION, CB_ADDSTRING, 0, (LPARAM)localizationInfo.first.c_str());
@ -1091,7 +1091,7 @@ BOOL CALLBACK DefaultNewDocDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
int selIndex = -1; int selIndex = -1;
generic_string str; generic_string str;
EncodingMapper *em = EncodingMapper::getInstance(); EncodingMapper *em = EncodingMapper::getInstance();
for (int i = 0 ; i < sizeof(encodings)/sizeof(int) ; i++) for (int i = 0 ; i < sizeof(encodings)/sizeof(int) ; ++i)
{ {
int cmdID = em->getIndexFromEncoding(encodings[i]); int cmdID = em->getIndexFromEncoding(encodings[i]);
if (cmdID != -1) if (cmdID != -1)
@ -1119,7 +1119,7 @@ BOOL CALLBACK DefaultNewDocDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_OPENANSIASUTF8), ID2Check == IDC_RADIO_UTF8SANSBOM); ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_OPENANSIASUTF8), ID2Check == IDC_RADIO_UTF8SANSBOM);
int index = 0; int index = 0;
for (int i = L_TEXT ; i < pNppParam->L_END ; i++) for (int i = L_TEXT ; i < pNppParam->L_END ; ++i)
{ {
generic_string str; generic_string str;
if ((LangType)i != L_USER) if ((LangType)i != L_USER)
@ -1472,7 +1472,7 @@ BOOL CALLBACK LangMenuDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
*/ */
int nbLang = pNppParam->getNbLang(); int nbLang = pNppParam->getNbLang();
//::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, (LPARAM)TEXT("[Default]")); //::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, (LPARAM)TEXT("[Default]"));
for (int i = 0 ; i < nbLang ; i++) for (int i = 0 ; i < nbLang ; ++i)
{ {
::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, (LPARAM)pNppParam->getLangFromIndex(i)->_langName.c_str()); ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, (LPARAM)pNppParam->getLangFromIndex(i)->_langName.c_str());
} }
@ -1484,7 +1484,7 @@ BOOL CALLBACK LangMenuDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), FALSE);
::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), SW_HIDE); ::ShowWindow(::GetDlgItem(_hSelf, IDC_TABSIZEVAL_DISABLE_STATIC), SW_HIDE);
*/ */
for (int i = L_TEXT ; i < pNppParam->L_END ; i++) for (int i = L_TEXT ; i < pNppParam->L_END ; ++i)
{ {
generic_string str; generic_string str;
if ((LangType)i != L_USER) if ((LangType)i != L_USER)
@ -1502,7 +1502,7 @@ BOOL CALLBACK LangMenuDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
} }
} }
for (size_t i = 0, len = nppGUI._excludedLangList.size(); i < len ; 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()); ::SendDlgItemMessage(_hSelf, IDC_LIST_DISABLEDLANG, LB_ADDSTRING, 0, (LPARAM)nppGUI._excludedLangList[i]._langName.c_str());
} }
@ -1755,7 +1755,7 @@ BOOL CALLBACK LangMenuDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
if ((lmi._langType >= L_EXTERNAL) && (lmi._langType < pNppParam->L_END)) if ((lmi._langType >= L_EXTERNAL) && (lmi._langType < pNppParam->L_END))
{ {
bool found(false); bool found(false);
for(size_t x = 0; x < pNppParam->getExternalLexerDoc()->size() && !found; x++) for(size_t x = 0; x < pNppParam->getExternalLexerDoc()->size() && !found; ++x)
{ {
TiXmlNode *lexersRoot = pNppParam->getExternalLexerDoc()->at(x)->FirstChild(TEXT("NotepadPlus"))->FirstChildElement(TEXT("LexerStyles")); TiXmlNode *lexersRoot = pNppParam->getExternalLexerDoc()->at(x)->FirstChild(TEXT("NotepadPlus"))->FirstChildElement(TEXT("LexerStyles"));
for (TiXmlNode *childNode = lexersRoot->FirstChildElement(TEXT("LexerType")); for (TiXmlNode *childNode = lexersRoot->FirstChildElement(TEXT("LexerType"));
@ -1811,7 +1811,7 @@ BOOL CALLBACK TabSettings::run_dlgProc(UINT Message, WPARAM wParam, LPARAM/* lPa
int nbLang = pNppParam->getNbLang(); int nbLang = pNppParam->getNbLang();
::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, (LPARAM)TEXT("[Default]")); ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, (LPARAM)TEXT("[Default]"));
for (int i = 0 ; i < nbLang ; i++) for (int i = 0 ; i < nbLang ; ++i)
{ {
::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, (LPARAM)pNppParam->getLangFromIndex(i)->_langName.c_str()); ::SendDlgItemMessage(_hSelf, IDC_LIST_TABSETTNG, LB_ADDSTRING, 0, (LPARAM)pNppParam->getLangFromIndex(i)->_langName.c_str());
} }
@ -2030,14 +2030,14 @@ BOOL CALLBACK PrintSettingsDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
::SetDlgItemText(_hSelf, IDC_EDIT_FRIGHT, nppGUI._printSettings._footerRight.c_str()); ::SetDlgItemText(_hSelf, IDC_EDIT_FRIGHT, nppGUI._printSettings._footerRight.c_str());
TCHAR intStr[5]; TCHAR intStr[5];
for(size_t i = 6 ; i < 15 ; i++) for(size_t i = 6 ; i < 15 ; ++i)
{ {
wsprintf(intStr, TEXT("%d"), i); wsprintf(intStr, TEXT("%d"), i);
::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTSIZE, CB_ADDSTRING, 0, (LPARAM)intStr); ::SendDlgItemMessage(_hSelf, IDC_COMBO_HFONTSIZE, CB_ADDSTRING, 0, (LPARAM)intStr);
::SendDlgItemMessage(_hSelf, IDC_COMBO_FFONTSIZE, CB_ADDSTRING, 0, (LPARAM)intStr); ::SendDlgItemMessage(_hSelf, IDC_COMBO_FFONTSIZE, CB_ADDSTRING, 0, (LPARAM)intStr);
} }
const std::vector<generic_string> & fontlist = pNppParam->getFontList(); const std::vector<generic_string> & fontlist = pNppParam->getFontList();
for (size_t i = 0, len = fontlist.size() ; i < len ; 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()); 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()); ::SendDlgItemMessage(_hSelf, IDC_COMBO_FFONTNAME, CB_ADDSTRING, 0, (LPARAM)fontlist[i].c_str());
@ -2073,7 +2073,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("Long date format"), TEXT("$(LONG_DATE)")));
varList.push_back(strCouple(TEXT("Time"), TEXT("$(TIME)"))); varList.push_back(strCouple(TEXT("Time"), TEXT("$(TIME)")));
for (size_t i = 0, len = varList.size() ; i < len ; 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()); 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()); ::SendDlgItemMessage(_hSelf, IDC_COMBO_VARLIST, CB_SETITEMDATA, j, (LPARAM)varList[i]._var.c_str());

View File

@ -462,7 +462,7 @@ generic_string ProjectPanel::getRelativePath(const generic_string & filePath, co
return filePath; return filePath;
const TCHAR *relativeFile = filePath.c_str() + lstrlen(wsfn); const TCHAR *relativeFile = filePath.c_str() + lstrlen(wsfn);
if (relativeFile[0] == '\\') if (relativeFile[0] == '\\')
relativeFile++; ++relativeFile;
return relativeFile; return relativeFile;
} }
@ -1075,7 +1075,7 @@ void ProjectPanel::addFiles(HTREEITEM hTreeItem)
if (stringVector *pfns = fDlg.doOpenMultiFilesDlg()) if (stringVector *pfns = fDlg.doOpenMultiFilesDlg())
{ {
size_t sz = pfns->size(); size_t sz = pfns->size();
for (size_t i = 0 ; i < sz ; i++) for (size_t i = 0 ; i < sz ; ++i)
{ {
TCHAR *strValueLabel = ::PathFindFileName(pfns->at(i).c_str()); TCHAR *strValueLabel = ::PathFindFileName(pfns->at(i).c_str());
_treeView.addItem(strValueLabel, hTreeItem, INDEX_LEAF, pfns->at(i).c_str()); _treeView.addItem(strValueLabel, hTreeItem, INDEX_LEAF, pfns->at(i).c_str());
@ -1129,7 +1129,7 @@ void ProjectPanel::recursiveAddFilesFrom(const TCHAR *folderPath, HTREEITEM hTre
} }
} while (::FindNextFile(hFile, &foundData)); } while (::FindNextFile(hFile, &foundData));
for (size_t i = 0, len = files.size() ; i < len ; i++) for (size_t i = 0, len = files.size() ; i < len ; ++i)
{ {
generic_string pathFile(folderPath); generic_string pathFile(folderPath);
if (folderPath[lstrlen(folderPath)-1] != '\\') if (folderPath[lstrlen(folderPath)-1] != '\\')

View File

@ -463,7 +463,7 @@ bool TreeView::canDropIn(HTREEITEM targetItem)
tvItem.hItem = targetItem; tvItem.hItem = targetItem;
SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvItem); SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvItem);
for (size_t i = 0, len = _canNotDropInList.size(); i < len; i++) for (size_t i = 0, len = _canNotDropInList.size(); i < len; ++i)
{ {
if (tvItem.iImage == _canNotDropInList[i]) if (tvItem.iImage == _canNotDropInList[i])
return false; return false;
@ -479,7 +479,7 @@ bool TreeView::canDragOut(HTREEITEM targetItem)
tvItem.hItem = targetItem; tvItem.hItem = targetItem;
SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvItem); SendMessage(_hSelf, TVM_GETITEM, 0,(LPARAM)&tvItem);
for (size_t i = 0, len = _canNotDragOutList.size(); i < len; i++) for (size_t i = 0, len = _canNotDragOutList.size(); i < len; ++i)
{ {
if (tvItem.iImage == _canNotDragOutList[i]) if (tvItem.iImage == _canNotDragOutList[i])
return false; return false;
@ -514,7 +514,7 @@ bool TreeView::retrieveFoldingStateTo(TreeStateNode & treeState2Construct, HTREE
{ {
treeState2Construct._children.push_back(TreeStateNode()); treeState2Construct._children.push_back(TreeStateNode());
retrieveFoldingStateTo(treeState2Construct._children.at(i), hItem); retrieveFoldingStateTo(treeState2Construct._children.at(i), hItem);
i++; ++i;
} }
return true; return true;
} }
@ -556,7 +556,7 @@ bool TreeView::restoreFoldingStateFrom(const TreeStateNode & treeState2Compare,
isOk = restoreFoldingStateFrom(treeState2Compare._children.at(i), hItem); isOk = restoreFoldingStateFrom(treeState2Compare._children.at(i), hItem);
if (!isOk) if (!isOk)
break; break;
i++; ++i;
} }
return isOk; return isOk;
} }

View File

@ -616,7 +616,7 @@ void Splitter::paintArrow(HDC hdc, const RECT &rect, Arrow arrowDir)
int y = rc.top; int y = rc.top;
//::MoveToEx(hdc, x, y, NULL); //::MoveToEx(hdc, x, y, NULL);
for (; (x < rc.right) && (y != rc.bottom) ; x++) for (; (x < rc.right) && (y != rc.bottom) ; ++x)
{ {
::MoveToEx(hdc, x, y++, NULL); ::MoveToEx(hdc, x, y++, NULL);
::LineTo(hdc, x, rc.bottom--); ::LineTo(hdc, x, rc.bottom--);
@ -640,7 +640,7 @@ void Splitter::paintArrow(HDC hdc, const RECT &rect, Arrow arrowDir)
int y = rc.top; int y = rc.top;
//::MoveToEx(hdc, x, y, NULL); //::MoveToEx(hdc, x, y, NULL);
for (; (y < rc.bottom) && (x != rc.right) ; y++) for (; (y < rc.bottom) && (x != rc.right) ; ++y)
{ {
::MoveToEx(hdc, x++, y, NULL); ::MoveToEx(hdc, x++, y, NULL);
::LineTo(hdc, rc.right--, y); ::LineTo(hdc, rc.right--, y);

View File

@ -28,7 +28,7 @@ void Command::extractArgs(TCHAR *cmd2Exec, TCHAR *args, const TCHAR *cmdEntier)
{ {
size_t i = 0; size_t i = 0;
bool quoted = false; bool quoted = false;
for (size_t len = lstrlen(cmdEntier); i < len ; i++) for (size_t len = lstrlen(cmdEntier); i < len ; ++i)
{ {
if ((cmdEntier[i] == ' ') && (!quoted)) if ((cmdEntier[i] == ' ') && (!quoted))
break; break;
@ -41,10 +41,10 @@ void Command::extractArgs(TCHAR *cmd2Exec, TCHAR *args, const TCHAR *cmdEntier)
if (i < size_t(lstrlen(cmdEntier))) if (i < size_t(lstrlen(cmdEntier)))
{ {
for (size_t len = size_t(lstrlen(cmdEntier)); (i < len) && (cmdEntier[i] == ' ') ; i++); for (size_t len = size_t(lstrlen(cmdEntier)); (i < len) && (cmdEntier[i] == ' ') ; ++i);
if (i < size_t(lstrlen(cmdEntier))) if (i < size_t(lstrlen(cmdEntier)))
{ {
for (size_t k = 0, len2 = size_t(lstrlen(cmdEntier)); i <= len2; i++, k++) for (size_t k = 0, len2 = size_t(lstrlen(cmdEntier)); i <= len2; ++i, ++k)
{ {
args[k] = cmdEntier[i]; args[k] = cmdEntier[i];
} }
@ -91,14 +91,14 @@ int whichVar(TCHAR *str)
void expandNppEnvironmentStrs(const TCHAR *strSrc, TCHAR *stringDest, size_t strDestLen, HWND hWnd) void expandNppEnvironmentStrs(const TCHAR *strSrc, TCHAR *stringDest, size_t strDestLen, HWND hWnd)
{ {
size_t j = 0; size_t j = 0;
for (size_t i = 0, len = size_t(lstrlen(strSrc)); i < len; i++) for (size_t i = 0, len = size_t(lstrlen(strSrc)); i < len; ++i)
{ {
int iBegin = -1; int iBegin = -1;
int iEnd = -1; int iEnd = -1;
if ((strSrc[i] == '$') && (strSrc[i+1] == '(')) if ((strSrc[i] == '$') && (strSrc[i+1] == '('))
{ {
iBegin = i += 2; iBegin = i += 2;
for (size_t len2 = size_t(lstrlen(strSrc)); i < len2 ; i++) for (size_t len2 = size_t(lstrlen(strSrc)); i < len2 ; ++i)
{ {
if (strSrc[i] == ')') if (strSrc[i] == ')')
{ {
@ -113,7 +113,7 @@ void expandNppEnvironmentStrs(const TCHAR *strSrc, TCHAR *stringDest, size_t str
{ {
TCHAR str[MAX_PATH]; TCHAR str[MAX_PATH];
int m = 0; int m = 0;
for (int k = iBegin ; k <= iEnd ; k++) for (int k = iBegin ; k <= iEnd ; ++k)
str[m++] = strSrc[k]; str[m++] = strSrc[k];
str[m] = '\0'; str[m] = '\0';
@ -137,7 +137,7 @@ void expandNppEnvironmentStrs(const TCHAR *strSrc, TCHAR *stringDest, size_t str
else else
::SendMessage(hWnd, RUNCOMMAND_USER + internalVar, CURRENTWORD_MAXLENGTH, (LPARAM)expandedStr); ::SendMessage(hWnd, RUNCOMMAND_USER + internalVar, CURRENTWORD_MAXLENGTH, (LPARAM)expandedStr);
for (size_t p = 0, len3 = size_t(lstrlen(expandedStr)); p < len3; p++) for (size_t p = 0, len3 = size_t(lstrlen(expandedStr)); p < len3; ++p)
{ {
if (j < (strDestLen-1)) if (j < (strDestLen-1))
stringDest[j++] = expandedStr[p]; stringDest[j++] = expandedStr[p];

View File

@ -59,7 +59,7 @@ void StatusBar::init(HINSTANCE hInst, HWND hPere, int nbParts)
_partWidthArray = new int[_nbParts]; _partWidthArray = new int[_nbParts];
// Set the default width // Set the default width
for (int i = 0 ; i < _nbParts ; i++) for (int i = 0 ; i < _nbParts ; ++i)
_partWidthArray[i] = defaultPartWidth; _partWidthArray[i] = defaultPartWidth;
// Allocate an array for holding the right edge coordinates. // Allocate an array for holding the right edge coordinates.

View File

@ -33,7 +33,7 @@ void ControlsTab::createTabs(WindowVector & winVector)
{ {
_pWinVector = &winVector; _pWinVector = &winVector;
for (size_t i = 0, len = winVector.size(); i < len; i++) for (size_t i = 0, len = winVector.size(); i < len; ++i)
TabBar::insertAtEnd(winVector[i]._name.c_str()); TabBar::insertAtEnd(winVector[i]._name.c_str());
TabBar::activateAt(0); TabBar::activateAt(0);
@ -78,7 +78,7 @@ bool ControlsTab::renameTab(const TCHAR *internalName, const TCHAR *newName)
{ {
bool foundIt = false; bool foundIt = false;
size_t i = 0; size_t i = 0;
for (size_t len = _pWinVector->size(); i < len; i++) for (size_t len = _pWinVector->size(); i < len; ++i)
{ {
if ((*_pWinVector)[i]._internalName == internalName) if ((*_pWinVector)[i]._internalName == internalName)
{ {

View File

@ -272,7 +272,7 @@ void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTrad
{ {
int i = 0; int i = 0;
bool found = false; bool found = false;
for ( ; i < nbCtrlMax && !found ; i++) for ( ; i < nbCtrlMax && !found ; ++i)
if (!_hwndArray[i]) if (!_hwndArray[i])
found = true; found = true;
if (!found) if (!found)
@ -284,7 +284,7 @@ void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTrad
_hwndArray[i] = _hSelf; _hwndArray[i] = _hSelf;
_ctrlID = i; _ctrlID = i;
} }
_nbCtrl++; ++_nbCtrl;
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this); ::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this);
_tabBarDefaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, (LONG_PTR)TabBarPlus_Proc)); _tabBarDefaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, (LONG_PTR)TabBarPlus_Proc));
@ -314,7 +314,7 @@ void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTrad
void TabBarPlus::doOwnerDrawTab() void TabBarPlus::doOwnerDrawTab()
{ {
::SendMessage(_hwndArray[0], TCM_SETPADDING, 0, MAKELPARAM(6, 0)); ::SendMessage(_hwndArray[0], TCM_SETPADDING, 0, MAKELPARAM(6, 0));
for (int i = 0 ; i < _nbCtrl ; i++) for (int i = 0 ; i < _nbCtrl ; ++i)
{ {
if (_hwndArray[i]) if (_hwndArray[i])
{ {
@ -360,7 +360,7 @@ void TabBarPlus::setColour(COLORREF colour2Set, tabColourIndex i)
void TabBarPlus::doVertical() void TabBarPlus::doVertical()
{ {
for (int i = 0 ; i < _nbCtrl ; i++) for (int i = 0 ; i < _nbCtrl ; ++i)
{ {
if (_hwndArray[i]) if (_hwndArray[i])
SendMessage(_hwndArray[i], WM_TABSETSTYLE, isVertical(), TCS_VERTICAL); SendMessage(_hwndArray[i], WM_TABSETSTYLE, isVertical(), TCS_VERTICAL);
@ -369,7 +369,7 @@ void TabBarPlus::doVertical()
void TabBarPlus::doMultiLine() void TabBarPlus::doMultiLine()
{ {
for (int i = 0 ; i < _nbCtrl ; i++) for (int i = 0 ; i < _nbCtrl ; ++i)
{ {
if (_hwndArray[i]) if (_hwndArray[i])
SendMessage(_hwndArray[i], WM_TABSETSTYLE, isMultiLine(), TCS_MULTILINE); SendMessage(_hwndArray[i], WM_TABSETSTYLE, isMultiLine(), TCS_MULTILINE);
@ -906,7 +906,7 @@ void TabBarPlus::exchangeItemData(POINT point)
} }
else else
{ {
for (int i = _nTabDragged ; i < nTab ; i++) for (int i = _nTabDragged ; i < nTab ; ++i)
{ {
::SendMessage(_hSelf, TCM_GETITEM, i+1, reinterpret_cast<LPARAM>(&itemData_shift)); ::SendMessage(_hSelf, TCM_GETITEM, i+1, reinterpret_cast<LPARAM>(&itemData_shift));
::SendMessage(_hSelf, TCM_SETITEM, i, reinterpret_cast<LPARAM>(&itemData_shift)); ::SendMessage(_hSelf, TCM_SETITEM, i, reinterpret_cast<LPARAM>(&itemData_shift));

View File

@ -117,7 +117,7 @@ RECT TaskList::adjustSize()
_rc.left = 0; _rc.left = 0;
_rc.top = 0; _rc.top = 0;
_rc.bottom = 0; _rc.bottom = 0;
for (int i = 0 ; i < _nbItem ; i++) for (int i = 0 ; i < _nbItem ; ++i)
{ {
TCHAR buf[MAX_PATH]; TCHAR buf[MAX_PATH];
ListView_GetItemText(_hSelf, i, 0, buf, MAX_PATH); ListView_GetItemText(_hSelf, i, 0, buf, MAX_PATH);
@ -161,7 +161,7 @@ void TaskList::setFont(TCHAR *fontName, size_t fontSize)
int TaskList::updateCurrentIndex() int TaskList::updateCurrentIndex()
{ {
for (int i = 0 ; i < _nbItem ; i++) for (int i = 0 ; i < _nbItem ; ++i)
{ {
int isSelected = ListView_GetItemState(_hSelf, i, LVIS_SELECTED); int isSelected = ListView_GetItemState(_hSelf, i, LVIS_SELECTED);
if (isSelected == LVIS_SELECTED) if (isSelected == LVIS_SELECTED)

View File

@ -127,12 +127,12 @@ bool ToolBar::init( HINSTANCE hInst, HWND hPere, toolBarStatusType type,
int cmd = 0; int cmd = 0;
int bmpIndex = -1, style; int bmpIndex = -1, style;
size_t i = 0; size_t i = 0;
for (; i < _nrButtons ; i++) for (; i < _nrButtons ; ++i)
{ {
cmd = buttonUnitArray[i]._cmdID; cmd = buttonUnitArray[i]._cmdID;
if (cmd != 0) if (cmd != 0)
{ {
bmpIndex++; ++bmpIndex;
style = BTNS_BUTTON; style = BTNS_BUTTON;
} }
else else
@ -156,12 +156,12 @@ bool ToolBar::init( HINSTANCE hInst, HWND hPere, toolBarStatusType type,
_pTBB[i].fsStyle = BTNS_SEP; _pTBB[i].fsStyle = BTNS_SEP;
_pTBB[i].dwData = 0; _pTBB[i].dwData = 0;
_pTBB[i].iString = 0; _pTBB[i].iString = 0;
i++; ++i;
//add plugin buttons //add plugin buttons
for (size_t j = 0; j < _nrDynButtons ; j++, i++) for (size_t j = 0; j < _nrDynButtons ; ++j, ++i)
{ {
cmd = _vDynBtnReg[j].message; cmd = _vDynBtnReg[j].message;
bmpIndex++; ++bmpIndex;
_pTBB[i].iBitmap = bmpIndex; _pTBB[i].iBitmap = bmpIndex;
_pTBB[i].idCommand = cmd; _pTBB[i].idCommand = cmd;
@ -191,7 +191,7 @@ void ToolBar::destroy() {
int ToolBar::getWidth() const { int ToolBar::getWidth() const {
RECT btnRect; RECT btnRect;
int totalWidth = 0; int totalWidth = 0;
for(size_t i = 0; i < _nrCurrentButtons; i++) { for(size_t i = 0; i < _nrCurrentButtons; ++i) {
::SendMessage(_hSelf, TB_GETITEMRECT, i, (LPARAM)&btnRect); ::SendMessage(_hSelf, TB_GETITEMRECT, i, (LPARAM)&btnRect);
totalWidth += btnRect.right - btnRect.left; totalWidth += btnRect.right - btnRect.left;
} }
@ -212,7 +212,7 @@ void ToolBar::reset(bool create)
if(create && _hSelf) { if(create && _hSelf) {
//Store current button state information //Store current button state information
TBBUTTON tempBtn; TBBUTTON tempBtn;
for(size_t i = 0; i < _nrCurrentButtons; i++) { for(size_t i = 0; i < _nrCurrentButtons; ++i) {
::SendMessage(_hSelf, TB_GETBUTTON, (WPARAM)i, (LPARAM)&tempBtn); ::SendMessage(_hSelf, TB_GETBUTTON, (WPARAM)i, (LPARAM)&tempBtn);
_pTBB[i].fsState = tempBtn.fsState; _pTBB[i].fsState = tempBtn.fsState;
} }
@ -255,13 +255,13 @@ void ToolBar::reset(bool create)
//Else set the internal imagelist with standard bitmaps //Else set the internal imagelist with standard bitmaps
TBADDBITMAP addbmp = {_hInst, 0}; TBADDBITMAP addbmp = {_hInst, 0};
TBADDBITMAP addbmpdyn = {0, 0}; TBADDBITMAP addbmpdyn = {0, 0};
for (size_t i = 0 ; i < _nrButtons ; i++) for (size_t i = 0 ; i < _nrButtons ; ++i)
{ {
addbmp.nID = _toolBarIcons.getStdIconAt(i); addbmp.nID = _toolBarIcons.getStdIconAt(i);
::SendMessage(_hSelf, TB_ADDBITMAP, 1, (LPARAM)&addbmp); ::SendMessage(_hSelf, TB_ADDBITMAP, 1, (LPARAM)&addbmp);
} }
if (_nrDynButtons > 0) { if (_nrDynButtons > 0) {
for (size_t j = 0; j < _nrDynButtons; j++) for (size_t j = 0; j < _nrDynButtons; ++j)
{ {
addbmpdyn.nID = (UINT_PTR)_vDynBtnReg.at(j).hBmp; addbmpdyn.nID = (UINT_PTR)_vDynBtnReg.at(j).hBmp;
::SendMessage(_hSelf, TB_ADDBITMAP, 1, (LPARAM)&addbmpdyn); ::SendMessage(_hSelf, TB_ADDBITMAP, 1, (LPARAM)&addbmpdyn);
@ -312,7 +312,7 @@ void ToolBar::doPopop(POINT chevPoint) {
::SendMessage(_hSelf, TB_GETITEMRECT, start, (LPARAM)&btnRect); ::SendMessage(_hSelf, TB_GETITEMRECT, start, (LPARAM)&btnRect);
if(btnRect.right > width) if(btnRect.right > width)
break; break;
start++; ++start;
} }
if (start < _nrCurrentButtons) { //some buttons are hidden if (start < _nrCurrentButtons) { //some buttons are hidden
@ -329,7 +329,7 @@ void ToolBar::doPopop(POINT chevPoint) {
AppendMenu(menu, MF_DISABLED|MF_GRAYED, cmd, text.c_str()); AppendMenu(menu, MF_DISABLED|MF_GRAYED, cmd, text.c_str());
} else } else
AppendMenu(menu, MF_SEPARATOR, 0, TEXT("")); AppendMenu(menu, MF_SEPARATOR, 0, TEXT(""));
start++; ++start;
} }
TrackPopupMenu(menu, 0, chevPoint.x, chevPoint.y, 0, _hSelf, NULL); TrackPopupMenu(menu, 0, chevPoint.x, chevPoint.y, 0, _hSelf, NULL);
} }
@ -464,7 +464,7 @@ int ReBar::getNewID()
int idToUse = REBAR_BAR_EXTERNAL; int idToUse = REBAR_BAR_EXTERNAL;
int curVal = 0; int curVal = 0;
size_t size = usedIDs.size(); size_t size = usedIDs.size();
for(size_t i = 0; i < size; i++) for(size_t i = 0; i < size; ++i)
{ {
curVal = usedIDs.at(i); curVal = usedIDs.at(i);
if (curVal < idToUse) if (curVal < idToUse)
@ -473,7 +473,7 @@ int ReBar::getNewID()
} }
else if (curVal == idToUse) else if (curVal == idToUse)
{ {
idToUse++; ++idToUse;
} }
else else
{ {
@ -488,7 +488,7 @@ int ReBar::getNewID()
void ReBar::releaseID(int id) void ReBar::releaseID(int id)
{ {
size_t size = usedIDs.size(); size_t size = usedIDs.size();
for(size_t i = 0; i < size; i++) for(size_t i = 0; i < size; ++i)
{ {
if (usedIDs.at(i) == id) if (usedIDs.at(i) == id)
{ {
@ -501,7 +501,7 @@ void ReBar::releaseID(int id)
bool ReBar::isIDTaken(int id) bool ReBar::isIDTaken(int id)
{ {
size_t size = usedIDs.size(); size_t size = usedIDs.size();
for(size_t i = 0; i < size; i++) for(size_t i = 0; i < size; ++i)
{ {
if (usedIDs.at(i) == id) if (usedIDs.at(i) == id)
{ {

View File

@ -129,7 +129,7 @@ public :
bool changeIcons() { bool changeIcons() {
if (!_toolIcons) if (!_toolIcons)
return false; return false;
for (size_t i = 0, len = _customIconVect.size(); i < len; i++) for (size_t i = 0, len = _customIconVect.size(); i < len; ++i)
changeIcons(_customIconVect[i].listIndex, _customIconVect[i].iconIndex, (_customIconVect[i].iconLocation).c_str()); changeIcons(_customIconVect[i].listIndex, _customIconVect[i].iconIndex, (_customIconVect[i].iconLocation).c_str());
return true; return true;
}; };

View File

@ -250,7 +250,7 @@ int VerticalFileSwitcher::setHeaderOrder(LPNMLISTVIEW pnm_list_view)
// so first we need to iterate through all columns and send LVM_SETCOLUMN to them with fmt set to NOT include these HDFs // so first we need to iterate through all columns and send LVM_SETCOLUMN to them with fmt set to NOT include these HDFs
colHeader = (HWND)SendMessage(hListView,LVM_GETHEADER,0,0); colHeader = (HWND)SendMessage(hListView,LVM_GETHEADER,0,0);
cols = SendMessage(colHeader,HDM_GETITEMCOUNT,0,0); cols = SendMessage(colHeader,HDM_GETITEMCOUNT,0,0);
for(q=0; q<cols; q++) for(q=0; q<cols; ++q)
{ {
//Get current fmt //Get current fmt
SendMessage(hListView,LVM_GETCOLUMN,(WPARAM) q, (LPARAM) &lvc); SendMessage(hListView,LVM_GETCOLUMN,(WPARAM) q, (LPARAM) &lvc);

View File

@ -75,7 +75,7 @@ void VerticalFileSwitcherListView::destroy()
LVITEM item; LVITEM item;
item.mask = LVIF_PARAM; item.mask = LVIF_PARAM;
int nbItem = ListView_GetItemCount(_hSelf); int nbItem = ListView_GetItemCount(_hSelf);
for (int i = 0 ; i < nbItem ; i++) for (int i = 0 ; i < nbItem ; ++i)
{ {
item.iItem = i; item.iItem = i;
ListView_GetItem(_hSelf, &item); ListView_GetItem(_hSelf, &item);
@ -95,7 +95,7 @@ void VerticalFileSwitcherListView::initList()
{ {
TaskListInfo taskListInfo; TaskListInfo taskListInfo;
::SendMessage(::GetParent(_hParent), WM_GETTASKLISTINFO, (WPARAM)&taskListInfo, TRUE); ::SendMessage(::GetParent(_hParent), WM_GETTASKLISTINFO, (WPARAM)&taskListInfo, TRUE);
for (size_t i = 0, len = taskListInfo._tlfsLst.size(); i < len ; i++) for (size_t i = 0, len = taskListInfo._tlfsLst.size(); i < len ; ++i)
{ {
TaskLstFnStatus & fileNameStatus = taskListInfo._tlfsLst[i]; TaskLstFnStatus & fileNameStatus = taskListInfo._tlfsLst[i];
@ -159,7 +159,7 @@ void VerticalFileSwitcherListView::setItemIconStatus(int bufferID)
int nbItem = ListView_GetItemCount(_hSelf); int nbItem = ListView_GetItemCount(_hSelf);
for (int i = 0 ; i < nbItem ; i++) for (int i = 0 ; i < nbItem ; ++i)
{ {
item.mask = LVIF_PARAM; item.mask = LVIF_PARAM;
item.iItem = i; item.iItem = i;
@ -201,7 +201,7 @@ void VerticalFileSwitcherListView::activateItem(int bufferID, int iView)
{ {
// Clean all selection // Clean all selection
int nbItem = ListView_GetItemCount(_hSelf); int nbItem = ListView_GetItemCount(_hSelf);
for (int i = 0; i < nbItem; i++) for (int i = 0; i < nbItem; ++i)
ListView_SetItemState(_hSelf, i, 0, LVIS_FOCUSED|LVIS_SELECTED); ListView_SetItemState(_hSelf, i, 0, LVIS_FOCUSED|LVIS_SELECTED);
int i = find(bufferID, iView); int i = find(bufferID, iView);
@ -258,7 +258,7 @@ int VerticalFileSwitcherListView::find(int bufferID, int iView) const
bool found = false; bool found = false;
int nbItem = ListView_GetItemCount(_hSelf); int nbItem = ListView_GetItemCount(_hSelf);
int i = 0; int i = 0;
for (; i < nbItem ; i++) for (; i < nbItem ; ++i)
{ {
item.mask = LVIF_PARAM; item.mask = LVIF_PARAM;
item.iItem = i; item.iItem = i;
@ -289,7 +289,7 @@ std::vector<SwitcherFileInfo> VerticalFileSwitcherListView::getSelectedFiles(boo
LVITEM item; LVITEM item;
int nbItem = ListView_GetItemCount(_hSelf); int nbItem = ListView_GetItemCount(_hSelf);
int i = 0; int i = 0;
for (; i < nbItem ; i++) for (; i < nbItem ; ++i)
{ {
int isSelected = ListView_GetItemState(_hSelf, i, LVIS_SELECTED); int isSelected = ListView_GetItemState(_hSelf, i, LVIS_SELECTED);
bool isChosen = reverse?isSelected != LVIS_SELECTED:isSelected == LVIS_SELECTED; bool isChosen = reverse?isSelected != LVIS_SELECTED:isSelected == LVIS_SELECTED;

View File

@ -40,7 +40,7 @@ void CWinMgr::InitToFitSizeFromCurrent(HWND hWnd)
assert(hWnd); assert(hWnd);
assert(m_map); assert(m_map);
GetWindowPositions(hWnd); GetWindowPositions(hWnd);
for (WINRECT* w = m_map; !w->IsEnd(); w++) { for (WINRECT* w = m_map; !w->IsEnd(); ++w) {
if (w->Type()==WRCT_TOFIT && !w->IsGroup()) { if (w->Type()==WRCT_TOFIT && !w->IsGroup()) {
w->SetToFitSize(RectToSize(w->GetRect())); w->SetToFitSize(RectToSize(w->GetRect()));
} }
@ -54,7 +54,7 @@ void CWinMgr::GetWindowPositions(HWND hWnd)
{ {
assert(m_map); assert(m_map);
assert(hWnd); assert(hWnd);
for (WINRECT* wrc=m_map; !wrc->IsEnd(); wrc++) { for (WINRECT* wrc=m_map; !wrc->IsEnd(); ++wrc) {
if (wrc->IsWindow()) { if (wrc->IsWindow()) {
HWND HChild = GetDlgItem(hWnd, wrc->GetID()); HWND HChild = GetDlgItem(hWnd, wrc->GetID());
if (HChild) { if (HChild) {
@ -76,7 +76,7 @@ CWinMgr::SetWindowPositions(HWND hWnd)
if (m_map && hWnd && nWindows>0) { if (m_map && hWnd && nWindows>0) {
HDWP hdwp = ::BeginDeferWindowPos(nWindows); HDWP hdwp = ::BeginDeferWindowPos(nWindows);
int count=0; int count=0;
for (WINRECT* wrc=m_map; !wrc->IsEnd(); wrc++) { for (WINRECT* wrc=m_map; !wrc->IsEnd(); ++wrc) {
if (wrc->IsWindow()) { if (wrc->IsWindow()) {
assert(count < nWindows); assert(count < nWindows);
HWND hwndChild = ::GetDlgItem(hWnd, wrc->GetID()); HWND hwndChild = ::GetDlgItem(hWnd, wrc->GetID());
@ -88,7 +88,7 @@ CWinMgr::SetWindowPositions(HWND hWnd)
rc.left,rc.top,RectWidth(rc),RectHeight(rc), rc.left,rc.top,RectWidth(rc),RectHeight(rc),
SWP_NOZORDER); SWP_NOZORDER);
InvalidateRect(hwndChild,NULL,TRUE); // repaint InvalidateRect(hwndChild,NULL,TRUE); // repaint
count++; ++count;
} }
} else { } else {
// not a window: still need to repaint background // not a window: still need to repaint background
@ -107,9 +107,9 @@ int CWinMgr::CountWindows()
{ {
assert(m_map); assert(m_map);
int nWin = 0; int nWin = 0;
for (WINRECT* w=m_map; !w->IsEnd(); w++) { for (WINRECT* w=m_map; !w->IsEnd(); ++w) {
if (w->IsWindow()) if (w->IsWindow())
nWin++; ++nWin;
} }
return nWin; return nWin;
} }
@ -120,7 +120,7 @@ int CWinMgr::CountWindows()
WINRECT* CWinMgr::FindRect(int nID) WINRECT* CWinMgr::FindRect(int nID)
{ {
assert(m_map); assert(m_map);
for (WINRECT* w=m_map; !w->IsEnd(); w++) { for (WINRECT* w=m_map; !w->IsEnd(); ++w) {
if (w->GetID()==(UINT)nID) if (w->GetID()==(UINT)nID)
return w; return w;
} }

View File

@ -73,7 +73,7 @@ WINRECT* WINRECT::InitMap(WINRECT* pWinMap, WINRECT* parent)
pwrc = InitMap(pwrc+1,pwrc); // recurse! Returns end-of-grp pwrc = InitMap(pwrc+1,pwrc); // recurse! Returns end-of-grp
assert(pwrc->IsEndGroup()); assert(pwrc->IsEndGroup());
} }
pwrc++; ++pwrc;
} }
// safety checks // safety checks
assert(pwrc->IsEndGroup()); assert(pwrc->IsEndGroup());

View File

@ -77,7 +77,7 @@ struct NumericStringEquivalence
{ {
const TCHAR *p = *str; const TCHAR *p = *str;
int value = 0; int value = 0;
for (*length = 0; isdigit(*p); (*length)++) for (*length = 0; isdigit(*p); ++(*length))
value = value * 10 + *p++ - '0'; value = value * 10 + *p++ - '0';
*str = p; *str = p;
return (value); return (value);

View File

@ -44,7 +44,7 @@ void RunMacroDlg::initMacroList()
if (::SendMessage(_hParent, WM_GETCURRENTMACROSTATUS, 0, 0) == MACRO_RECORDING_HAS_STOPPED) if (::SendMessage(_hParent, WM_GETCURRENTMACROSTATUS, 0, 0) == MACRO_RECORDING_HAS_STOPPED)
::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("Current recorded macro")); ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_ADDSTRING, 0, (LPARAM)TEXT("Current recorded macro"));
for (size_t i = 0, len = macroList.size(); i < len ; 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_ADDSTRING, 0, (LPARAM)macroList[i].getName());
::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_SETCURSEL, 0, 0); ::SendDlgItemMessage(_hSelf, IDC_MACRO_COMBO, CB_SETCURSEL, 0, 0);

View File

@ -195,15 +195,15 @@ void Shortcut::setName(const TCHAR * name) {
while(name[j] != 0 && i < nameLenMax) { while(name[j] != 0 && i < nameLenMax) {
if (name[j] != '&') { if (name[j] != '&') {
_name[i] = name[j]; _name[i] = name[j];
i++; ++i;
} else { //check if this ampersand is being escaped } else { //check if this ampersand is being escaped
if (name[j+1] == '&') { //escaped ampersand if (name[j+1] == '&') { //escaped ampersand
_name[i] = name[j]; _name[i] = name[j];
i++; ++i;
j++; //skip escaped ampersand ++j; //skip escaped ampersand
} }
} }
j++; ++j;
} }
_name[i] = 0; _name[i] = 0;
} }
@ -256,13 +256,13 @@ int ScintillaKeyMap::addKeyCombo(KeyCombo combo) { //returns index where key is
_keyCombos[0] = combo; _keyCombos[0] = combo;
return 0; return 0;
} }
for(size_t i = 0; i < size; i++) { //if already in the list do not add it for(size_t i = 0; i < size; ++i) { //if already in the list do not add it
KeyCombo & kc = _keyCombos[i]; KeyCombo & kc = _keyCombos[i];
if (combo._key == kc._key && combo._isCtrl == kc._isCtrl && combo._isAlt == kc._isAlt && combo._isShift == kc._isShift) if (combo._key == kc._key && combo._isCtrl == kc._isCtrl && combo._isAlt == kc._isAlt && combo._isShift == kc._isShift)
return i; //already in the list return i; //already in the list
} }
_keyCombos.push_back(combo); _keyCombos.push_back(combo);
size++; ++size;
return (size - 1); return (size - 1);
} }
@ -279,7 +279,7 @@ void getKeyStrFromVal(UCHAR keyVal, generic_string & str)
str = TEXT(""); str = TEXT("");
bool found = false; bool found = false;
int i; int i;
for (i = 0; i < nrKeys; i++) { for (i = 0; i < nrKeys; ++i) {
if (keyVal == namedKeyArray[i].id) { if (keyVal == namedKeyArray[i].id) {
found = true; found = true;
break; break;
@ -309,7 +309,7 @@ void getNameStrFromCmd(DWORD cmd, generic_string & str)
{ {
vector<PluginCmdShortcut> & pluginCmds = (NppParameters::getInstance())->getPluginCommandList(); vector<PluginCmdShortcut> & pluginCmds = (NppParameters::getInstance())->getPluginCommandList();
int i = 0; int i = 0;
for (size_t j = 0, len = pluginCmds.size(); j < len ; j++) for (size_t j = 0, len = pluginCmds.size(); j < len ; ++j)
{ {
if (pluginCmds[j].getID() == cmd) if (pluginCmds[j].getID() == cmd)
{ {
@ -330,7 +330,7 @@ void getNameStrFromCmd(DWORD cmd, generic_string & str)
bool fin = false; bool fin = false;
int j = 0; int j = 0;
size_t len = lstrlen(cmdName); size_t len = lstrlen(cmdName);
for (size_t i = 0 ; i < len; i++) for (size_t i = 0 ; i < len; ++i)
{ {
switch(cmdName[i]) switch(cmdName[i])
{ {
@ -370,7 +370,7 @@ BOOL CALLBACK Shortcut::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
::SendDlgItemMessage(_hSelf, IDC_SHIFT_CHECK, BM_SETCHECK, _keyCombo._isShift?BST_CHECKED:BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_SHIFT_CHECK, BM_SETCHECK, _keyCombo._isShift?BST_CHECKED:BST_UNCHECKED, 0);
::EnableWindow(::GetDlgItem(_hSelf, IDOK), isValid() && (textlen > 0 || !_canModifyName)); ::EnableWindow(::GetDlgItem(_hSelf, IDOK), isValid() && (textlen > 0 || !_canModifyName));
int iFound = -1; int iFound = -1;
for (size_t i = 0 ; i < nrKeys ; i++) for (size_t i = 0 ; i < nrKeys ; ++i)
{ {
::SendDlgItemMessage(_hSelf, IDC_KEY_COMBO, CB_ADDSTRING, 0, (LPARAM)namedKeyArray[i].name); ::SendDlgItemMessage(_hSelf, IDC_KEY_COMBO, CB_ADDSTRING, 0, (LPARAM)namedKeyArray[i].name);
@ -471,39 +471,39 @@ void Accelerator::updateShortcuts()
int offset = 0; int offset = 0;
size_t i = 0; size_t i = 0;
//no validation performed, it might be that invalid shortcuts are being used by default. Allows user to 'hack', might be a good thing //no validation performed, it might be that invalid shortcuts are being used by default. Allows user to 'hack', might be a good thing
for(i = 0; i < nbMenu; i++) { for(i = 0; i < nbMenu; ++i) {
if (shortcuts[i].isEnabled()) {// && shortcuts[i].isValid()) { if (shortcuts[i].isEnabled()) {// && shortcuts[i].isValid()) {
_pAccelArray[offset].cmd = (WORD)(shortcuts[i].getID()); _pAccelArray[offset].cmd = (WORD)(shortcuts[i].getID());
_pAccelArray[offset].fVirt = shortcuts[i].getAcceleratorModifiers(); _pAccelArray[offset].fVirt = shortcuts[i].getAcceleratorModifiers();
_pAccelArray[offset].key = shortcuts[i].getKeyCombo()._key; _pAccelArray[offset].key = shortcuts[i].getKeyCombo()._key;
offset++; ++offset;
} }
} }
for(i = 0; i < nbMacro; i++) { for(i = 0; i < nbMacro; ++i) {
if (macros[i].isEnabled()) {// && macros[i].isValid()) { if (macros[i].isEnabled()) {// && macros[i].isValid()) {
_pAccelArray[offset].cmd = (WORD)(macros[i].getID()); _pAccelArray[offset].cmd = (WORD)(macros[i].getID());
_pAccelArray[offset].fVirt = macros[i].getAcceleratorModifiers(); _pAccelArray[offset].fVirt = macros[i].getAcceleratorModifiers();
_pAccelArray[offset].key = macros[i].getKeyCombo()._key; _pAccelArray[offset].key = macros[i].getKeyCombo()._key;
offset++; ++offset;
} }
} }
for(i = 0; i < nbUserCmd; i++) { for(i = 0; i < nbUserCmd; ++i) {
if (userCommands[i].isEnabled()) {// && userCommands[i].isValid()) { if (userCommands[i].isEnabled()) {// && userCommands[i].isValid()) {
_pAccelArray[offset].cmd = (WORD)(userCommands[i].getID()); _pAccelArray[offset].cmd = (WORD)(userCommands[i].getID());
_pAccelArray[offset].fVirt = userCommands[i].getAcceleratorModifiers(); _pAccelArray[offset].fVirt = userCommands[i].getAcceleratorModifiers();
_pAccelArray[offset].key = userCommands[i].getKeyCombo()._key; _pAccelArray[offset].key = userCommands[i].getKeyCombo()._key;
offset++; ++offset;
} }
} }
for(i = 0; i < nbPluginCmd; i++) { for(i = 0; i < nbPluginCmd; ++i) {
if (pluginCommands[i].isEnabled()) {// && pluginCommands[i].isValid()) { if (pluginCommands[i].isEnabled()) {// && pluginCommands[i].isValid()) {
_pAccelArray[offset].cmd = (WORD)(pluginCommands[i].getID()); _pAccelArray[offset].cmd = (WORD)(pluginCommands[i].getID());
_pAccelArray[offset].fVirt = pluginCommands[i].getAcceleratorModifiers(); _pAccelArray[offset].fVirt = pluginCommands[i].getAcceleratorModifiers();
_pAccelArray[offset].key = pluginCommands[i].getKeyCombo()._key; _pAccelArray[offset].key = pluginCommands[i].getKeyCombo()._key;
offset++; ++offset;
} }
} }
@ -517,22 +517,22 @@ void Accelerator::updateShortcuts()
void Accelerator::updateFullMenu() { void Accelerator::updateFullMenu() {
NppParameters * pNppParam = NppParameters::getInstance(); NppParameters * pNppParam = NppParameters::getInstance();
vector<CommandShortcut> commands = pNppParam->getUserShortcuts(); vector<CommandShortcut> commands = pNppParam->getUserShortcuts();
for(size_t i = 0; i < commands.size(); i++) { for(size_t i = 0; i < commands.size(); ++i) {
updateMenuItemByCommand(commands[i]); updateMenuItemByCommand(commands[i]);
} }
vector<MacroShortcut> mcommands = pNppParam->getMacroList(); vector<MacroShortcut> mcommands = pNppParam->getMacroList();
for(size_t i = 0; i < mcommands.size(); i++) { for(size_t i = 0; i < mcommands.size(); ++i) {
updateMenuItemByCommand(mcommands[i]); updateMenuItemByCommand(mcommands[i]);
} }
vector<UserCommand> ucommands = pNppParam->getUserCommandList(); vector<UserCommand> ucommands = pNppParam->getUserCommandList();
for(size_t i = 0; i < ucommands.size(); i++) { for(size_t i = 0; i < ucommands.size(); ++i) {
updateMenuItemByCommand(ucommands[i]); updateMenuItemByCommand(ucommands[i]);
} }
vector<PluginCmdShortcut> pcommands = pNppParam->getPluginCommandList(); vector<PluginCmdShortcut> pcommands = pNppParam->getPluginCommandList();
for(size_t i = 0; i < pcommands.size(); i++) { for(size_t i = 0; i < pcommands.size(); ++i) {
updateMenuItemByCommand(pcommands[i]); updateMenuItemByCommand(pcommands[i]);
} }
@ -641,7 +641,7 @@ void ScintillaAccelerator::init(vector<HWND> * vScintillas, HMENU hMenu, HWND me
_hAccelMenu = hMenu; _hAccelMenu = hMenu;
_hMenuParent = menuParent; _hMenuParent = menuParent;
size_t nr = vScintillas->size(); size_t nr = vScintillas->size();
for(size_t i = 0; i < nr; i++) { for(size_t i = 0; i < nr; ++i) {
_vScintillas.push_back(vScintillas->at(i)); _vScintillas.push_back(vScintillas->at(i));
} }
_nrScintillas = (int)nr; _nrScintillas = (int)nr;
@ -654,7 +654,7 @@ void ScintillaAccelerator::updateKeys()
size_t mapSize = map.size(); size_t mapSize = map.size();
size_t index; size_t index;
for(int i = 0; i < _nrScintillas; i++) for(int i = 0; i < _nrScintillas; ++i)
{ {
::SendMessage(_vScintillas[i], SCI_CLEARALLCMDKEYS, 0, 0); ::SendMessage(_vScintillas[i], SCI_CLEARALLCMDKEYS, 0, 0);
for(size_t j = mapSize - 1; j >= 0; j--) //reverse order, top of the list has highest priority for(size_t j = mapSize - 1; j >= 0; j--) //reverse order, top of the list has highest priority
@ -663,7 +663,7 @@ void ScintillaAccelerator::updateKeys()
if (skm.isEnabled()) if (skm.isEnabled())
{ //no validating, scintilla accepts more keys { //no validating, scintilla accepts more keys
size_t size = skm.getSize(); size_t size = skm.getSize();
for(index = 0; index < size; index++) for(index = 0; index < size; ++index)
::SendMessage(_vScintillas[i], SCI_ASSIGNCMDKEY, skm.toKeyDef(index), skm.getScintillaKeyID()); ::SendMessage(_vScintillas[i], SCI_ASSIGNCMDKEY, skm.toKeyDef(index), skm.getScintillaKeyID());
} }
if (skm.getMenuCmdID() != 0) if (skm.getMenuCmdID() != 0)
@ -689,7 +689,7 @@ void ScintillaAccelerator::updateMenuItemByID(ScintillaKeyMap skm, int id)
cmdName[i] = 0; cmdName[i] = 0;
break; break;
} }
i++; ++i;
} }
generic_string menuItem = cmdName; generic_string menuItem = cmdName;
if (skm.isEnabled()) if (skm.isEnabled())
@ -730,7 +730,7 @@ void ScintillaKeyMap::showCurrentSettings() {
::SendDlgItemMessage(_hSelf, IDC_CTRL_CHECK, BM_SETCHECK, _keyCombo._isCtrl?BST_CHECKED:BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_CTRL_CHECK, BM_SETCHECK, _keyCombo._isCtrl?BST_CHECKED:BST_UNCHECKED, 0);
::SendDlgItemMessage(_hSelf, IDC_ALT_CHECK, BM_SETCHECK, _keyCombo._isAlt?BST_CHECKED:BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_ALT_CHECK, BM_SETCHECK, _keyCombo._isAlt?BST_CHECKED:BST_UNCHECKED, 0);
::SendDlgItemMessage(_hSelf, IDC_SHIFT_CHECK, BM_SETCHECK, _keyCombo._isShift?BST_CHECKED:BST_UNCHECKED, 0); ::SendDlgItemMessage(_hSelf, IDC_SHIFT_CHECK, BM_SETCHECK, _keyCombo._isShift?BST_CHECKED:BST_UNCHECKED, 0);
for (size_t i = 0 ; i < nrKeys ; i++) for (size_t i = 0 ; i < nrKeys ; ++i)
{ {
if (_keyCombo._key == namedKeyArray[i].id) if (_keyCombo._key == namedKeyArray[i].id)
{ {
@ -755,12 +755,12 @@ BOOL CALLBACK ScintillaKeyMap::run_dlgProc(UINT Message, WPARAM wParam, LPARAM)
::SetDlgItemText(_hSelf, IDC_NAME_EDIT, _name); ::SetDlgItemText(_hSelf, IDC_NAME_EDIT, _name);
_keyCombo = _keyCombos[0]; _keyCombo = _keyCombos[0];
for (size_t i = 0 ; i < nrKeys ; i++) for (size_t i = 0 ; i < nrKeys ; ++i)
{ {
::SendDlgItemMessage(_hSelf, IDC_KEY_COMBO, CB_ADDSTRING, 0, (LPARAM)namedKeyArray[i].name); ::SendDlgItemMessage(_hSelf, IDC_KEY_COMBO, CB_ADDSTRING, 0, (LPARAM)namedKeyArray[i].name);
} }
for(size_t i = 0; i < size; i++) { for(size_t i = 0; i < size; ++i) {
::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_ADDSTRING, 0, (LPARAM)toString(i).c_str()); ::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_ADDSTRING, 0, (LPARAM)toString(i).c_str());
} }
::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_SETCURSEL, 0, 0); ::SendDlgItemMessage(_hSelf, IDC_LIST_KEYS, LB_SETCURSEL, 0, 0);

View File

@ -245,7 +245,7 @@ public:
(a._keyCombos[i]._isAlt == b._keyCombos[i]._isAlt) && (a._keyCombos[i]._isAlt == b._keyCombos[i]._isAlt) &&
(a._keyCombos[i]._isShift == b._keyCombos[i]._isShift) && (a._keyCombos[i]._isShift == b._keyCombos[i]._isShift) &&
(a._keyCombos[i]._key == b._keyCombos[i]._key); (a._keyCombos[i]._key == b._keyCombos[i]._key);
i++; ++i;
} }
return equal; return equal;
}; };

View File

@ -48,7 +48,7 @@ void LastRecentFileList::initMenu(HMENU hMenu, int idBase, int posBase, bool doS
_posBase = posBase; _posBase = posBase;
_nativeLangEncoding = NPP_CP_WIN_1252; _nativeLangEncoding = NPP_CP_WIN_1252;
for (int i = 0 ; i < sizeof(_idFreeArray) ; i++) for (int i = 0 ; i < sizeof(_idFreeArray) ; ++i)
_idFreeArray[i] = true; _idFreeArray[i] = true;
} }
@ -59,7 +59,7 @@ void LastRecentFileList::switchMode()
::RemoveMenu(_hMenu, IDM_OPEN_ALL_RECENT_FILE, MF_BYCOMMAND); ::RemoveMenu(_hMenu, IDM_OPEN_ALL_RECENT_FILE, MF_BYCOMMAND);
::RemoveMenu(_hMenu, IDM_CLEAN_RECENT_FILE_LIST, MF_BYCOMMAND); ::RemoveMenu(_hMenu, IDM_CLEAN_RECENT_FILE_LIST, MF_BYCOMMAND);
for(int i = 0; i < _size; i++) for(int i = 0; i < _size; ++i)
{ {
::RemoveMenu(_hMenu, _lrfl.at(i)._id, MF_BYCOMMAND); ::RemoveMenu(_hMenu, _lrfl.at(i)._id, MF_BYCOMMAND);
} }
@ -144,12 +144,12 @@ void LastRecentFileList::updateMenu()
} }
//Remove all menu items //Remove all menu items
for(int i = 0; i < _size; i++) for(int i = 0; i < _size; ++i)
{ {
::RemoveMenu(_hMenu, _lrfl.at(i)._id, MF_BYCOMMAND); ::RemoveMenu(_hMenu, _lrfl.at(i)._id, MF_BYCOMMAND);
} }
//Then readd them, so everything stays in sync //Then readd them, so everything stays in sync
for(int j = 0; j < _size; j++) for(int j = 0; j < _size; ++j)
{ {
generic_string strBuffer(BuildMenuFileName(pNppParam->getRecentFileCustomLength(), j, _lrfl.at(j)._name)); generic_string strBuffer(BuildMenuFileName(pNppParam->getRecentFileCustomLength(), j, _lrfl.at(j)._name));
::InsertMenu(_hMenu, _posBase + j, MF_BYPOSITION, _lrfl.at(j)._id, strBuffer.c_str()); ::InsertMenu(_hMenu, _posBase + j, MF_BYPOSITION, _lrfl.at(j)._id, strBuffer.c_str());
@ -174,7 +174,7 @@ void LastRecentFileList::add(const TCHAR *fn)
_lrfl.pop_back(); //remove oldest _lrfl.pop_back(); //remove oldest
} else { } else {
itemToAdd._id = popFirstAvailableID(); itemToAdd._id = popFirstAvailableID();
_size++; ++_size;
} }
_lrfl.push_front(itemToAdd); _lrfl.push_front(itemToAdd);
updateMenu(); updateMenu();
@ -221,7 +221,7 @@ void LastRecentFileList::clear()
generic_string & LastRecentFileList::getItem(int id) generic_string & LastRecentFileList::getItem(int id)
{ {
int i = 0; int i = 0;
for(; i < _size; i++) for(; i < _size; ++i)
{ {
if (_lrfl.at(i)._id == id) if (_lrfl.at(i)._id == id)
break; break;
@ -273,7 +273,7 @@ void LastRecentFileList::saveLRFL()
int LastRecentFileList::find(const TCHAR *fn) int LastRecentFileList::find(const TCHAR *fn)
{ {
for(int i = 0; i < _size; i++) for(int i = 0; i < _size; ++i)
{ {
if (!lstrcmpi(_lrfl.at(i)._name.c_str(), fn)) if (!lstrcmpi(_lrfl.at(i)._name.c_str(), fn))
{ {
@ -285,7 +285,7 @@ int LastRecentFileList::find(const TCHAR *fn)
int LastRecentFileList::popFirstAvailableID() int LastRecentFileList::popFirstAvailableID()
{ {
for (int i = 0 ; i < NB_MAX_LRF_FILE ; i++) for (int i = 0 ; i < NB_MAX_LRF_FILE ; ++i)
{ {
if (_idFreeArray[i]) if (_idFreeArray[i])
{ {

View File

@ -224,7 +224,7 @@ MenuPosition & getMenuPosition(const char *id) {
int nbSubMenuPos = sizeof(menuPos)/sizeof(MenuPosition); int nbSubMenuPos = sizeof(menuPos)/sizeof(MenuPosition);
for(int i = 0; i < nbSubMenuPos; i++) for(int i = 0; i < nbSubMenuPos; ++i)
{ {
if (strcmp(menuPos[i]._id, id) == 0) if (strcmp(menuPos[i]._id, id) == 0)
return menuPos[i]; return menuPos[i];
@ -563,7 +563,7 @@ void NativeLangSpeaker::changeStyleCtrlsLang(HWND hDlg, int *idArray, const char
const int iUnderline = 8; const int iUnderline = 8;
HWND hItem; HWND hItem;
for (int i = iColorStyle ; i < (iUnderline + 1) ; i++) for (int i = iColorStyle ; i < (iUnderline + 1) ; ++i)
{ {
if (translatedText[i] && translatedText[i][0]) if (translatedText[i] && translatedText[i][0])
{ {
@ -654,7 +654,7 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg)
// for each control // for each control
const int nbControl = 9; const int nbControl = 9;
const char *translatedText[nbControl]; const char *translatedText[nbControl];
for (int i = 0 ; i < nbControl ; i++) for (int i = 0 ; i < nbControl ; ++i)
translatedText[i] = NULL; translatedText[i] = NULL;
for (TiXmlNodeA *childNode = userDefineDlgNode->FirstChildElement("Item"); for (TiXmlNodeA *childNode = userDefineDlgNode->FirstChildElement("Item");
@ -733,7 +733,7 @@ void NativeLangSpeaker::changeUserDefineLang(UserDefineDialog *userDefineDlg)
*/ */
const char nodeNameArray[nbDlg][16] = {"Folder", "Keywords", "Comment", "Operator"}; const char nodeNameArray[nbDlg][16] = {"Folder", "Keywords", "Comment", "Operator"};
for (int i = 0 ; i < nbDlg ; i++) for (int i = 0 ; i < nbDlg ; ++i)
{ {
/* /*
for (int j = 0 ; j < nbGpArray[i] ; j++) for (int j = 0 ; j < nbGpArray[i] ; j++)

View File

@ -64,12 +64,12 @@ void parseCommandLine(TCHAR * commandLine, ParamVector & paramVector) {
TCHAR stopChar = TEXT(' '); TCHAR stopChar = TEXT(' ');
if (commandLine[0] == TEXT('\"')) { if (commandLine[0] == TEXT('\"')) {
stopChar = TEXT('\"'); stopChar = TEXT('\"');
commandLine++; ++commandLine;
} }
//while this is not really DBCS compliant, space and quote are in the lower 127 ASCII range //while this is not really DBCS compliant, space and quote are in the lower 127 ASCII range
while(commandLine[0] && commandLine[0] != stopChar) while(commandLine[0] && commandLine[0] != stopChar)
{ {
commandLine++; ++commandLine;
} }
// For unknown reason, the following command : // For unknown reason, the following command :
@ -77,11 +77,11 @@ void parseCommandLine(TCHAR * commandLine, ParamVector & paramVector) {
// (without quote) will give string "notepad++\0notepad++\0" // (without quote) will give string "notepad++\0notepad++\0"
// To avoid the unexpected behaviour we check the end of string before increasing the pointer // To avoid the unexpected behaviour we check the end of string before increasing the pointer
if (commandLine[0] != '\0') if (commandLine[0] != '\0')
commandLine++; //advance past stopChar ++commandLine; //advance past stopChar
//kill remaining spaces //kill remaining spaces
while(commandLine[0] == TEXT(' ')) while(commandLine[0] == TEXT(' '))
commandLine++; ++commandLine;
bool isFile = checkSingleFile(commandLine); //if the commandline specifies only a file, open it as such bool isFile = checkSingleFile(commandLine); //if the commandline specifies only a file, open it as such
if (isFile) { if (isFile) {
@ -92,7 +92,8 @@ void parseCommandLine(TCHAR * commandLine, ParamVector & paramVector) {
bool isInWhiteSpace = true; bool isInWhiteSpace = true;
paramVector.clear(); paramVector.clear();
size_t commandLength = lstrlen(commandLine); size_t commandLength = lstrlen(commandLine);
for(size_t i = 0; i < commandLength; i++) { for (size_t i = 0; i < commandLength; ++i)
{
switch(commandLine[i]) { switch(commandLine[i]) {
case '\"': { //quoted filename, ignore any following whitespace case '\"': { //quoted filename, ignore any following whitespace
if (!isInFile) { //" will always be treated as start or end of param, in case the user forgot to add an space if (!isInFile) { //" will always be treated as start or end of param, in case the user forgot to add an space
@ -123,7 +124,7 @@ void parseCommandLine(TCHAR * commandLine, ParamVector & paramVector) {
bool isInList(const TCHAR *token2Find, ParamVector & params) { bool isInList(const TCHAR *token2Find, ParamVector & params) {
int nrItems = params.size(); int nrItems = params.size();
for (int i = 0; i < nrItems; i++) for (int i = 0; i < nrItems; ++i)
{ {
if (!lstrcmp(token2Find, params.at(i))) { if (!lstrcmp(token2Find, params.at(i))) {
params.erase(params.begin() + i); params.erase(params.begin() + i);
@ -137,7 +138,7 @@ bool getParamVal(TCHAR c, ParamVector & params, generic_string & value) {
value = TEXT(""); value = TEXT("");
int nrItems = params.size(); int nrItems = params.size();
for (int i = 0; i < nrItems; i++) for (int i = 0; i < nrItems; ++i)
{ {
const TCHAR * token = params.at(i); const TCHAR * token = params.at(i);
if (token[0] == '-' && lstrlen(token) >= 2 && token[1] == c) { //dash, and enough chars if (token[0] == '-' && lstrlen(token) >= 2 && token[1] == c) { //dash, and enough chars
@ -253,7 +254,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
const TCHAR * currentFile; const TCHAR * currentFile;
TCHAR fullFileName[MAX_PATH]; TCHAR fullFileName[MAX_PATH];
for(size_t i = 0; i < nrFilesToOpen; i++) for(size_t i = 0; i < nrFilesToOpen; ++i)
{ {
currentFile = params.at(i); currentFile = params.at(i);
if (currentFile[0]) if (currentFile[0])
@ -285,7 +286,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
if ((!isMultiInst) && (!TheFirstOne)) if ((!isMultiInst) && (!TheFirstOne))
{ {
HWND hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL); HWND hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL);
for (int i = 0 ;!hNotepad_plus && i < 5 ; i++) for (int i = 0 ;!hNotepad_plus && i < 5 ; ++i)
{ {
Sleep(100); Sleep(100);
hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL); hNotepad_plus = ::FindWindow(Notepad_plus_Window::getClassName(), NULL);