diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 01031104b..c5ce33531 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -4237,7 +4237,7 @@ size_t Notepad_plus::getCurrentDocCharCount(UniMode u) size_t result = 0; size_t endpos = _pEditView->execute(SCI_GETLENGTH); - unsigned char* buf = (unsigned char*)_pEditView->execute(SCI_GETCHARACTERPOINTER); // Scintilla doc said the pointer can be invalidated by any other "execute" + const unsigned char* buf = (unsigned char*)_pEditView->execute(SCI_GETCHARACTERPOINTER); // Scintilla doc said the pointer can be invalidated by any other "execute" #ifdef _OPENMP // parallel counting of characters with OpenMP if (endpos > 50000) // starting threads takes time; for small files it is better to simply count in one thread @@ -4825,25 +4825,25 @@ void Notepad_plus::docOpenInNewInstance(FileTransferMode mode, int x, int y) wchar_t nppName[MAX_PATH]; ::GetModuleFileName(NULL, nppName, MAX_PATH); - wstring command = L"\""; - command += nppName; - command += L"\""; - command += L" \"$(FULL_CURRENT_PATH)\" -multiInst -nosession"; + wstring cmdLine = L"\""; + cmdLine += nppName; + cmdLine += L"\""; + cmdLine += L" \"$(FULL_CURRENT_PATH)\" -multiInst -nosession"; if (x) { wchar_t pX[10]{}; _itow(x, pX, 10); - command += L" -x"; - command += pX; + cmdLine += L" -x"; + cmdLine += pX; } if (y) { wchar_t pY[10]{}; _itow(y, pY, 10); - command += L" -y"; - command += pY; + cmdLine += L" -y"; + cmdLine += pY; } LangType lt = buf->getLangType(); @@ -4855,15 +4855,15 @@ void Notepad_plus::docOpenInNewInstance(FileTransferMode mode, int x, int y) // user applies Markdown to a file named "myMarkdown.abc". if (lt != L_USER) { - command += L" -l"; - command += ScintillaEditView::_langNameInfoArray[lt]._langName; + cmdLine += L" -l"; + cmdLine += ScintillaEditView::_langNameInfoArray[lt]._langName; } - command += L" -n"; - command += to_wstring(_pEditView->getCurrentLineNumber() + 1); - command += L" -c"; - command += to_wstring(_pEditView->getCurrentColumnNumber() + 1); + cmdLine += L" -n"; + cmdLine += to_wstring(_pEditView->getCurrentLineNumber() + 1); + cmdLine += L" -c"; + cmdLine += to_wstring(_pEditView->getCurrentColumnNumber() + 1); - Command cmd(command); + Command cmd(cmdLine); cmd.run(_pPublicInterface->getHSelf()); if (mode == TransferMove) { @@ -9121,7 +9121,7 @@ BOOL Notepad_plus::notifyTBShowMenu(LPNMTOOLBARW lpnmtb, const char* menuPosId) return FALSE; } -BOOL Notepad_plus::notifyTBShowMenu(LPNMTOOLBARW lpnmtb, const char* menuPosId, std::vector cmdIDs) +BOOL Notepad_plus::notifyTBShowMenu(LPNMTOOLBARW lpnmtb, const char* menuPosId, const std::vector& cmdIDs) { if (cmdIDs.empty()) return notifyTBShowMenu(lpnmtb, menuPosId); diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index ce03b7cb1..3d20484bd 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -657,5 +657,5 @@ private: HMENU createMenuFromMenu(HMENU hSourceMenu, const std::vector& commandIds); BOOL notifyTBShowMenu(LPNMTOOLBARW lpnmtb, const char* menuPosId); - BOOL notifyTBShowMenu(LPNMTOOLBARW lpnmtb, const char* menuPosId, std::vector cmdIDs); + BOOL notifyTBShowMenu(LPNMTOOLBARW lpnmtb, const char* menuPosId, const std::vector& cmdIDs); }; diff --git a/PowerEditor/src/NppDarkMode.cpp b/PowerEditor/src/NppDarkMode.cpp index 786d7e3a7..28aef3fe3 100644 --- a/PowerEditor/src/NppDarkMode.cpp +++ b/PowerEditor/src/NppDarkMode.cpp @@ -464,7 +464,7 @@ namespace NppDarkMode void initAdvancedOptions() { - NppGUI& nppGui = NppParameters::getInstance().getNppGUI(); + const NppGUI& nppGui = NppParameters::getInstance().getNppGUI(); g_advOptions = nppGui._darkmode._advOptions; } @@ -2324,7 +2324,7 @@ namespace NppDarkMode ::EnableThemeDialogTexture(hwndParent, theme && !NppDarkMode::isEnabled() ? ETDT_ENABLETAB : ETDT_DISABLE); EnumChildWindows(hwndParent, [](HWND hwnd, LPARAM lParam) WINAPI_LAMBDA { - auto& p = *reinterpret_cast(lParam); + const auto& p = *reinterpret_cast(lParam); constexpr size_t classNameLen = 32; wchar_t className[classNameLen]{}; GetClassName(hwnd, className, classNameLen); diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 085325e53..562a6b6be 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -2195,8 +2195,6 @@ int NppParameters::getPluginCmdIdFromMenuEntryItemName(HMENU pluginsMenu, const bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU pluginsMenu, bool isEditCM) { - std::vector& contextMenuItems = isEditCM ? _contextMenuItems : _tabContextMenuItems; - TiXmlDocumentA* pXmlContextMenuDocA = isEditCM ? _pXmlContextMenuDocA : _pXmlTabContextMenuDocA; std::string cmName = isEditCM ? "ScintillaContextMenu" : "TabContextMenu"; @@ -2212,6 +2210,8 @@ bool NppParameters::getContextMenuFromXmlTree(HMENU mainMenuHadle, HMENU plugins TiXmlNodeA *contextMenuRoot = root->FirstChildElement(cmName.c_str()); if (contextMenuRoot) { + std::vector& contextMenuItems = isEditCM ? _contextMenuItems : _tabContextMenuItems; + for (TiXmlNodeA *childNode = contextMenuRoot->FirstChildElement("Item"); childNode ; childNode = childNode->NextSibling("Item") ) @@ -6192,10 +6192,10 @@ void NppParameters::feedGUIParameters(TiXmlNode *node) } else if (!lstrcmp(nm, L"commandLineInterpreter")) { - TiXmlNode *node = childNode->FirstChild(); - if (node) + TiXmlNode *cmdLineInterpreterNode = childNode->FirstChild(); + if (cmdLineInterpreterNode) { - const wchar_t *cli = node->Value(); + const wchar_t *cli = cmdLineInterpreterNode->Value(); if (cli && cli[0]) _nppGUI._commandLineInterpreter.assign(cli); } diff --git a/PowerEditor/src/ScintillaComponent/Buffer.h b/PowerEditor/src/ScintillaComponent/Buffer.h index 27d42efcb..9978ae6e7 100644 --- a/PowerEditor/src/ScintillaComponent/Buffer.h +++ b/PowerEditor/src/ScintillaComponent/Buffer.h @@ -239,21 +239,21 @@ public: const wchar_t * getUserDefineLangName() const { return _userLangExt.c_str(); } const wchar_t * getCommentLineSymbol() const { - Lang *l = getCurrentLang(); + const Lang *l = getCurrentLang(); if (!l) return NULL; return l->_pCommentLineSymbol; } const wchar_t * getCommentStart() const { - Lang *l = getCurrentLang(); + const Lang *l = getCurrentLang(); if (!l) return NULL; return l->_pCommentStart; } const wchar_t * getCommentEnd() const { - Lang *l = getCurrentLang(); + const Lang *l = getCurrentLang(); if (!l) return NULL; return l->_pCommentEnd; diff --git a/PowerEditor/src/ScintillaComponent/DocTabView.cpp b/PowerEditor/src/ScintillaComponent/DocTabView.cpp index a6108d1cf..52826230a 100644 --- a/PowerEditor/src/ScintillaComponent/DocTabView.cpp +++ b/PowerEditor/src/ScintillaComponent/DocTabView.cpp @@ -129,7 +129,7 @@ BufferID DocTabView::findBufferByName(const wchar_t * fullfilename) //-1 if not { ::SendMessage(_hSelf, TCM_GETITEM, i, reinterpret_cast(&tie)); BufferID id = reinterpret_cast(tie.lParam); - Buffer * buf = MainFileManager.getBufferByID(id); + const Buffer* buf = MainFileManager.getBufferByID(id); if (wcsicmp(fullfilename, buf->getFullPathName()) == 0) { return id; diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index 458229db0..d7ca7a695 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -1785,7 +1785,7 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA RECT rcStatusBar{}; ::GetWindowRect(_statusBar.getHSelf(), &rcStatusBar); - const LONG padding = _dpiManager.getSystemMetricsForDpi(SM_CXPADDEDBORDER); + LONG padding = _dpiManager.getSystemMetricsForDpi(SM_CXPADDEDBORDER); _szBorder.cx = ((_dpiManager.getSystemMetricsForDpi(SM_CXFRAME) + padding) * 2); _szBorder.cy = ((_dpiManager.getSystemMetricsForDpi(SM_CYFRAME) + padding) * 2 + _dpiManager.getSystemMetricsForDpi(SM_CYCAPTION) @@ -1793,7 +1793,7 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA if (prevDpi > _dpiManager.getDpi()) { - const auto padding = static_cast(_dpiManager.getSystemMetricsForDpi(SM_CXPADDEDBORDER)); + padding = static_cast(_dpiManager.getSystemMetricsForDpi(SM_CXPADDEDBORDER)); _szBorder.cx += padding; _szBorder.cy += padding; } @@ -3567,7 +3567,7 @@ void FindReplaceDlg::findAllIn(InWhat op) _pFinder->_scintView.execute(SCI_SETUSETABS, true); _pFinder->_scintView.execute(SCI_SETTABWIDTH, 4); - NppGUI& nppGUI = nppParam.getNppGUI(); + const NppGUI& nppGUI = nppParam.getNppGUI(); _pFinder->_longLinesAreWrapped = nppGUI._finderLinesAreCurrentlyWrapped; _pFinder->_scintView.wrap(_pFinder->_longLinesAreWrapped); _pFinder->_scintView.setWrapMode(LINEWRAP_INDENT); @@ -4063,7 +4063,7 @@ void FindReplaceDlg::saveInMacro(size_t cmd, int cmdType) ::SendMessage(_hParent, WM_FRSAVE_INT, IDC_FRCOMMAND_EXEC, cmd); } -void FindReplaceDlg::setStatusbarMessage(const wstring & msg, FindStatus staus, wstring tooltipMsg) +void FindReplaceDlg::setStatusbarMessage(const wstring & msg, FindStatus staus, const wstring& tooltipMsg) { if (_statusbarTooltipWnd) { @@ -5037,7 +5037,7 @@ void FindReplaceDlg::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) } } -bool FindReplaceDlg::replaceInFilesConfirmCheck(wstring directory, wstring fileTypes) +bool FindReplaceDlg::replaceInFilesConfirmCheck(const wstring& directory, const wstring& fileTypes) { bool confirmed = false; @@ -5573,7 +5573,7 @@ void Finder::setFinderStyle() _scintView.execute(SCI_COLOURISE, 0, -1); // finder fold style follows user preference but use box when user selects none - ScintillaViewParams& svp = (ScintillaViewParams&)NppParameters::getInstance().getSVP(); + const ScintillaViewParams& svp = (ScintillaViewParams&)NppParameters::getInstance().getSVP(); _scintView.setMakerStyle(svp._folderStyle == FOLDER_STYLE_NONE ? FOLDER_STYLE_BOX : svp._folderStyle); } @@ -6499,7 +6499,7 @@ LRESULT APIENTRY Progress::wndProc(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM l case WM_GETDPISCALEDSIZE: { - auto pw = reinterpret_cast(static_cast(::GetWindowLongPtr(hwnd, GWLP_USERDATA))); + const auto pw = reinterpret_cast(static_cast(::GetWindowLongPtr(hwnd, GWLP_USERDATA))); const UINT newDpi = static_cast(wparam); RECT rcWindow = pw->getDpiScaledWindowRect(newDpi); diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h index 8f6ec9512..05cef3cae 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h @@ -391,7 +391,7 @@ public : void execSavedCommand(int cmd, uptr_t intValue, const std::wstring& stringValue); void clearMarks(const FindOption& opt); - void setStatusbarMessage(const std::wstring & msg, FindStatus staus, std::wstring tooltipMsg = L""); + void setStatusbarMessage(const std::wstring & msg, FindStatus staus, const std::wstring& tooltipMsg = L""); void setStatusbarMessageWithRegExprErr(ScintillaEditView* pEditView); std::wstring getScopeInfoForStatusBar(FindOption const *pFindOpt) const; Finder * createFinder(); @@ -500,7 +500,7 @@ private: static const int FR_OP_FIP = 16; void saveInMacro(size_t cmd, int cmdType); void drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); - bool replaceInFilesConfirmCheck(std::wstring directory, std::wstring fileTypes); + bool replaceInFilesConfirmCheck(const std::wstring& directory, const std::wstring& fileTypes); bool replaceInProjectsConfirmCheck(); bool replaceInOpenDocsConfirmCheck(void); diff --git a/PowerEditor/src/ScintillaComponent/FunctionCallTip.cpp b/PowerEditor/src/ScintillaComponent/FunctionCallTip.cpp index 419f15677..06d13c9a7 100644 --- a/PowerEditor/src/ScintillaComponent/FunctionCallTip.cpp +++ b/PowerEditor/src/ScintillaComponent/FunctionCallTip.cpp @@ -195,7 +195,7 @@ bool FunctionCallTip::getCursorFunction() int scopeLevel = 0; for (size_t i = 0; i < vsize; ++i) { - Token & curToken = tokenVector.at(i); + const Token & curToken = tokenVector.at(i); if (curToken.isIdentifier) { curValue.lastIdentifier = static_cast(i); diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index c7d4cd08d..ff5202b63 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -368,7 +368,7 @@ LRESULT CALLBACK ScintillaEditView::scintillaStatic_Proc(HWND hwnd, UINT Message if (pScint && (isSynpnatic || makeTouchPadCompetible)) return (pScint->scintillaNew_Proc(hwnd, Message, wParam, lParam)); - ScintillaEditView *pScintillaOnMouse = (ScintillaEditView *)(::GetWindowLongPtr(hwndOnMouse, GWLP_USERDATA)); + const ScintillaEditView* pScintillaOnMouse = reinterpret_cast(::GetWindowLongPtr(hwndOnMouse, GWLP_USERDATA)); if (pScintillaOnMouse != pScint) return ::SendMessage(hwndOnMouse, Message, wParam, lParam); } @@ -1804,12 +1804,12 @@ void ScintillaEditView::defineDocType(LangType typeDoc) if (pStyler) { - const Style * pStyle = pStyler->findByName(L"DEFAULT"); - if (pStyle) + const Style * pDefStyle = pStyler->findByName(L"DEFAULT"); + if (pDefStyle) { - nfoStyle._bgColor = pStyle->_bgColor; - nfoStyle._fgColor = pStyle->_fgColor; - nfoStyle._colorStyle = pStyle->_colorStyle; + nfoStyle._bgColor = pDefStyle->_bgColor; + nfoStyle._fgColor = pDefStyle->_fgColor; + nfoStyle._colorStyle = pDefStyle->_colorStyle; } } setSpecialStyle(nfoStyle); @@ -2113,7 +2113,7 @@ void ScintillaEditView::saveCurrentPos() void ScintillaEditView::restoreCurrentPosPreStep() { Buffer * buf = MainFileManager.getBufferByID(_currentBufferID); - Position & pos = buf->getPosition(this); + const Position & pos = buf->getPosition(this); execute(SCI_SETSELECTIONMODE, pos._selMode); //enable execute(SCI_SETANCHOR, pos._startPos); @@ -2145,7 +2145,7 @@ void ScintillaEditView::restoreCurrentPosPostStep() return; Buffer * buf = MainFileManager.getBufferByID(_currentBufferID); - Position & pos = buf->getPosition(this); + const Position & pos = buf->getPosition(this); ++_restorePositionRetryCount; @@ -3145,7 +3145,7 @@ void ScintillaEditView::performGlobalStyles() void ScintillaEditView::showNpc(bool willBeShowed, bool isSearchResult) { - auto& svp = NppParameters::getInstance().getSVP(); + const auto& svp = NppParameters::getInstance().getSVP(); if (willBeShowed) { @@ -3180,7 +3180,7 @@ void ScintillaEditView::showNpc(bool willBeShowed, bool isSearchResult) void ScintillaEditView::showCcUniEol(bool willBeShowed, bool isSearchResult) { - auto& svp = NppParameters::getInstance().getSVP(); + const auto& svp = NppParameters::getInstance().getSVP(); if (willBeShowed) { @@ -4404,7 +4404,7 @@ pair ScintillaEditView::getSelectedCharsAndLinesCount(long long } sort(v.begin(), v.end()); intptr_t previousSecondLine = -1; - for (auto& lineRange : v) + for (const auto& lineRange : v) { selectedCharsAndLines.second += lineRange.second - lineRange.first; if (lineRange.first != static_cast(previousSecondLine)) @@ -4504,7 +4504,7 @@ void ScintillaEditView::markedTextToClipboard(int indiStyle, bool doAll /*= fals L"\r\n----\r\n" : L"\r\n"; wstring joined; - for (auto& item : styledVect) + for (const auto& item : styledVect) { joined += delim + item.second; } diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h index 92f494cf2..c9ada5ab2 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h @@ -371,7 +371,7 @@ struct ColumnModeInfo { // SortClass for vector // sort in _order : increased order struct SortInSelectOrder { - bool operator() (ColumnModeInfo & l, ColumnModeInfo & r) { + bool operator() (const ColumnModeInfo & l, const ColumnModeInfo & r) { return (l._order < r._order); } }; @@ -380,7 +380,7 @@ struct SortInSelectOrder { // SortClass for vector // sort in _selLpos : increased order struct SortInPositionOrder { - bool operator() (ColumnModeInfo & l, ColumnModeInfo & r) { + bool operator() (const ColumnModeInfo & l, const ColumnModeInfo & r) { return (l._selLpos < r._selLpos); } }; @@ -586,7 +586,7 @@ public: void showNpc(bool willBeShowed = true, bool isSearchResult = false); bool isShownNpc() { - auto& svp = NppParameters::getInstance().getSVP(); + const auto& svp = NppParameters::getInstance().getSVP(); return svp._npcShow; }; @@ -618,7 +618,7 @@ public: void showCcUniEol(bool willBeShowed = true, bool isSearchResult = false); bool isShownCcUniEol() { - auto& svp = NppParameters::getInstance().getSVP(); + const auto& svp = NppParameters::getInstance().getSVP(); return svp._ccUniEolShow; }; diff --git a/PowerEditor/src/ScintillaComponent/SmartHighlighter.cpp b/PowerEditor/src/ScintillaComponent/SmartHighlighter.cpp index a291ab0a3..29e916f51 100644 --- a/PowerEditor/src/ScintillaComponent/SmartHighlighter.cpp +++ b/PowerEditor/src/ScintillaComponent/SmartHighlighter.cpp @@ -52,7 +52,7 @@ void SmartHighlighter::highlightViewWithWord(ScintillaEditView * pHighlightView, { // fetch find dialog's setting NppParameters& nppParams = NppParameters::getInstance(); - FindHistory &findHistory = nppParams.getFindHistory(); + const FindHistory &findHistory = nppParams.getFindHistory(); isWordOnly = findHistory._isMatchWord; isCaseSensentive = findHistory._isMatchCase; } @@ -125,7 +125,7 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView, Scintil { // fetch find dialog's setting NppParameters& nppParams = NppParameters::getInstance(); - FindHistory &findHistory = nppParams.getFindHistory(); + const FindHistory &findHistory = nppParams.getFindHistory(); isWordOnly = findHistory._isMatchWord; } else diff --git a/PowerEditor/src/ScintillaComponent/UserDefineDialog.cpp b/PowerEditor/src/ScintillaComponent/UserDefineDialog.cpp index 8a6f998a7..5e62e0562 100644 --- a/PowerEditor/src/ScintillaComponent/UserDefineDialog.cpp +++ b/PowerEditor/src/ScintillaComponent/UserDefineDialog.cpp @@ -1132,7 +1132,7 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA case WM_NOTIFY: { - NMHDR *nmhdr = (NMHDR *)lParam; + const NMHDR *nmhdr = reinterpret_cast(lParam); if (nmhdr->code == TCN_SELCHANGE) { if (nmhdr->hwndFrom == _ctrlTab.getHSelf()) diff --git a/PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.cpp b/PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.cpp index bd86aef7e..efdffb6cb 100644 --- a/PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.cpp +++ b/PowerEditor/src/WinControls/ClipboardHistory/clipboardHistoryPanel.cpp @@ -49,7 +49,7 @@ ClipboardDataInfo ClipboardHistoryPanel::getClipboadData() unsigned char* pData_bin = static_cast(GlobalLock(hglb_binText)); if (pData_bin != NULL) { - unsigned long* lpLen = (unsigned long*)GlobalLock(hglbLen); + const unsigned long* lpLen = (unsigned long*)GlobalLock(hglbLen); if (lpLen != NULL) // Special copy-paste: Binary data { size_t nbBytes = (*lpLen); diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp index 3353741c1..be29a5bda 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp @@ -1183,10 +1183,10 @@ void WordStyleDlg::setVisualFromStyleList() //-- font size constexpr size_t intStrLen = 3; - wchar_t intStr[intStrLen]{}; LRESULT iFontSize = 0; if (style._fontSize != STYLE_NOT_USED && style._fontSize < 100) // style._fontSize has only 2 digits { + wchar_t intStr[intStrLen]{}; wsprintf(intStr, L"%d", style._fontSize); iFontSize = ::SendMessage(_hFontSizeCombo, CB_FINDSTRING, 1, reinterpret_cast(intStr)); } diff --git a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h index 34b4575d5..5058f6136 100644 --- a/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h +++ b/PowerEditor/src/WinControls/FileBrowser/fileBrowser.h @@ -49,7 +49,7 @@ public: FileInfo() = delete; // constructor by default is forbidden FileInfo(const std::wstring & name, FolderInfo *parent) : _name(name), _parent(parent) {}; std::wstring getName() const { return _name; }; - void setName(std::wstring name) { _name = name; }; + void setName(const std::wstring& name) { _name = name; }; private: std::wstring _name; diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp index 0332ff4e4..ca3148031 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel.cpp @@ -202,7 +202,7 @@ void FunctionListPanel::addInStateArray(TreeStateNode tree2Update, const wchar_t } } -TreeParams* FunctionListPanel::getFromStateArray(wstring fullFilePath) +TreeParams* FunctionListPanel::getFromStateArray(const wstring& fullFilePath) { for (size_t i = 0, len = _treeParams.size(); i < len; ++i) { diff --git a/PowerEditor/src/WinControls/FunctionList/functionListPanel.h b/PowerEditor/src/WinControls/FunctionList/functionListPanel.h index fb7aa29da..98761cbc6 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionListPanel.h +++ b/PowerEditor/src/WinControls/FunctionList/functionListPanel.h @@ -139,7 +139,7 @@ private: size_t getBodyClosePos(size_t begin, const wchar_t *bodyOpenSymbol, const wchar_t *bodyCloseSymbol); void notified(LPNMHDR notification); void addInStateArray(TreeStateNode tree2Update, const wchar_t *searchText, bool isSorted); - TreeParams* getFromStateArray(std::wstring fullFilePath); + TreeParams* getFromStateArray(const std::wstring& fullFilePath); bool openSelection(const TreeView &treeView); bool shouldSort(); void setSort(bool isEnabled); diff --git a/PowerEditor/src/WinControls/FunctionList/functionParser.cpp b/PowerEditor/src/WinControls/FunctionList/functionParser.cpp index 88ab0cac1..be661bfa8 100644 --- a/PowerEditor/src/WinControls/FunctionList/functionParser.cpp +++ b/PowerEditor/src/WinControls/FunctionList/functionParser.cpp @@ -221,9 +221,9 @@ bool FunctionParsersManager::loadFuncListFromXmlTree(const wstring & xmlDirPath, std::vector classNameExprArray2; std::vector functionNameExprArray2; getUnitPaserParameters(functionParser, mainExpr2, functionNameExprArray2, classNameExprArray2); - FunctionUnitParser *funcUnitPaser = new FunctionUnitParser(id, displayName, commentExpr.c_str(), mainExpr2.c_str(), functionNameExprArray2, classNameExprArray2); + FunctionUnitParser *funcUnitPaser = new FunctionUnitParser(id, displayName, commentExpr.c_str(), mainExpr2, functionNameExprArray2, classNameExprArray2); - _parsers[index]->_parser = new FunctionMixParser(id, displayName, commentExpr.c_str(), mainExpr.c_str(), openSymbole.c_str(), closeSymbole.c_str(), classNameExprArray, functionExpr.c_str(), functionNameExprArray, funcUnitPaser); + _parsers[index]->_parser = new FunctionMixParser(id, displayName, commentExpr.c_str(), mainExpr, openSymbole, closeSymbole, classNameExprArray, functionExpr, functionNameExprArray, funcUnitPaser); } else if (classRangeParser) { diff --git a/PowerEditor/src/WinControls/Grid/BabyGrid.cpp b/PowerEditor/src/WinControls/Grid/BabyGrid.cpp index 6c9c15365..70e7dd36d 100644 --- a/PowerEditor/src/WinControls/Grid/BabyGrid.cpp +++ b/PowerEditor/src/WinControls/Grid/BabyGrid.cpp @@ -234,7 +234,7 @@ int GetColOfMouse(int SI, int x) return ReturnValue; } -BOOL OutOfRange(BGCELL* cell) +BOOL OutOfRange(const BGCELL* cell) { if ((cell->row > MAX_ROWS) || (cell->col > MAX_COLS)) { @@ -472,8 +472,8 @@ void DisplayColumn(HWND hWnd, int SI, int c, int offset, HFONT hfont, HFONT hcol rect.bottom = rect.top + BGHS[SI].rowheight; rectsave = rect; - BGCELL BGcell; - SetCell(&BGcell, r, c); + BGCELL BGcell2; + SetCell(&BGcell2, r, c); wcscpy_s(buffer, L""); int iProperty = 0; if ((c == 0) && (BGHS[SI].ROWSNUMBERED)) @@ -485,7 +485,7 @@ void DisplayColumn(HWND hWnd, int SI, int c, int offset, HFONT hfont, HFONT hcol { // iProperty will combine (iDataType << 4) and (iProtection & 0xf), // this will reduce some unnecessary and 'heavy' message calls for getting iDataType and iProtection separately - iProperty = static_cast(SendMessage(hWnd, BGM_GETCELLDATA, reinterpret_cast(&BGcell), reinterpret_cast(buffer))); + iProperty = static_cast(SendMessage(hWnd, BGM_GETCELLDATA, reinterpret_cast(&BGcell2), reinterpret_cast(buffer))); } if (c == 0) diff --git a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp index 0b00904eb..906f13337 100644 --- a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp +++ b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.cpp @@ -501,7 +501,7 @@ std::pair getIntervalVersions(wstring intervalVerStr) // "[4.2,6.6.6][6.4,8.9]" : The 1st interval from version 4.2 to 6.6.6 inclusive, the 2nd interval from version 6.4 to 8.9 // "[8.3,][6.9,6.9]" : The 1st interval any version from 8.3 to the latest version, the 2nd interval present only version 6.9 // "[,8.2.1][4.4,]" : The 1st interval 8.2.1 and any previous version, , the 2nd interval any version from 4.4 to the latest version -std::pair, std::pair> getTwoIntervalVersions(wstring twoIntervalVerStr) +std::pair, std::pair> getTwoIntervalVersions(const wstring& twoIntervalVerStr) { std::pair, std::pair> r; wstring sep = L"]["; @@ -841,7 +841,7 @@ bool PluginsAdminDlg::loadFromPluginInfos() // Search from unloaded incompatible plugins for (size_t j = 0, nb = _incompatibleList.nbItem(); j < nb; j++) { - PluginUpdateInfo* incompatiblePluginInfo = _incompatibleList.getPluginInfoFromUiIndex(j); + const PluginUpdateInfo* incompatiblePluginInfo = _incompatibleList.getPluginInfoFromUiIndex(j); int listIndex; PluginUpdateInfo* foundInfoOfAvailable = _availableList.findPluginInfoFromFolderName(incompatiblePluginInfo->_folderName, listIndex); diff --git a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h index 02e51aa95..c6861d7c3 100644 --- a/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h +++ b/PowerEditor/src/WinControls/PluginsAdmin/pluginsAdmin.h @@ -85,7 +85,7 @@ enum SORT_TYPE { DISPLAY_NAME_ALPHABET_ENCREASE, DISPLAY_NAME_ALPHABET_DECREASE struct SortDisplayNameDecrease final { - bool operator() (PluginUpdateInfo* l, PluginUpdateInfo* r) + bool operator() (const PluginUpdateInfo* l, const PluginUpdateInfo* r) { return (l->_displayName.compare(r->_displayName) <= 0); }