From 9b832dbb2c3bcd78e4132fbda7735ddc3b3ff396 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Mon, 17 Jan 2022 18:17:59 +0100 Subject: [PATCH] Remove more conversion from Scintilla --- PowerEditor/src/NppBigSwitch.cpp | 2 +- PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp | 2 +- PowerEditor/src/ScintillaComponent/FunctionCallTip.cpp | 6 +++--- PowerEditor/src/ScintillaComponent/FunctionCallTip.h | 2 +- PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp | 3 +-- PowerEditor/src/ScintillaComponent/ScintillaEditView.h | 8 ++++---- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index e7a22158d..c348a6245 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -1290,7 +1290,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa case WM_FRSAVE_INT: { - _macro.push_back(recordedMacroStep(static_cast(wParam), 0, static_cast(lParam), NULL, recordedMacroStep::mtSavedSnR)); + _macro.push_back(recordedMacroStep(static_cast(wParam), 0, lParam, NULL, recordedMacroStep::mtSavedSnR)); break; } diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index 79cf377c2..c24abcb56 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -500,7 +500,7 @@ bool Finder::notify(SCNotification *notification) size_t pos = notification->position; if (pos == INVALID_POSITION) - pos = static_cast(_scintView.execute(SCI_GETLINEENDPOSITION, notification->line)); + pos = _scintView.execute(SCI_GETLINEENDPOSITION, notification->line); _scintView.execute(SCI_SETSEL, pos, pos); gotoFoundLine(); diff --git a/PowerEditor/src/ScintillaComponent/FunctionCallTip.cpp b/PowerEditor/src/ScintillaComponent/FunctionCallTip.cpp index 9b590dbfd..42daa681d 100644 --- a/PowerEditor/src/ScintillaComponent/FunctionCallTip.cpp +++ b/PowerEditor/src/ScintillaComponent/FunctionCallTip.cpp @@ -380,13 +380,13 @@ void FunctionCallTip::showCalltip() //Check if the current overload still holds. If the current param exceeds amounti n overload, see if another one fits better (enough params) stringVec & params = _overloads.at(_currentOverload); size_t psize = params.size()+1; - if ((size_t)_currentParam >= psize) + if (_currentParam >= psize) { size_t osize = _overloads.size(); for (size_t i = 0; i < osize; ++i) { psize = _overloads.at(i).size()+1; - if ((size_t)_currentParam < psize) + if (_currentParam < psize) { _currentOverload = static_cast(i); break; @@ -408,7 +408,7 @@ void FunctionCallTip::showCalltip() size_t nbParams = params.size(); for (size_t i = 0; i < nbParams; ++i) { - if (int(i) == _currentParam) + if (i == _currentParam) { highlightstart = static_cast(callTipText.str().length()); highlightend = highlightstart + lstrlen(params.at(i)); diff --git a/PowerEditor/src/ScintillaComponent/FunctionCallTip.h b/PowerEditor/src/ScintillaComponent/FunctionCallTip.h index db520b266..7b18c1a48 100644 --- a/PowerEditor/src/ScintillaComponent/FunctionCallTip.h +++ b/PowerEditor/src/ScintillaComponent/FunctionCallTip.h @@ -47,7 +47,7 @@ private: stringVec _descriptions; //vecotr of function descriptions size_t _currentNbOverloads = 0; //current amount of overloads size_t _currentOverload = 0; //current chosen overload - int _currentParam = 0; //current highlighted param + size_t _currentParam = 0; //current highlighted param TCHAR _start = '('; TCHAR _stop = ')'; diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp index be3389334..0bb6267c6 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.cpp @@ -1705,7 +1705,7 @@ void ScintillaEditView::defineDocType(LangType typeDoc) if (typeDoc >= L_EXTERNAL && typeDoc < NppParameters::getInstance().L_END) setExternalLexer(typeDoc); else - execute(SCI_SETLEXER, (_codepage == CP_CHINESE_TRADITIONAL)?SCLEX_MAKEFILE:SCLEX_NULL); + execute(SCI_SETLEXER, (_codepage == CP_CHINESE_TRADITIONAL) ? SCLEX_MAKEFILE : SCLEX_NULL); break; } @@ -3539,7 +3539,6 @@ void ScintillaEditView::runMarkers(bool doHide, size_t searchStart, bool endOfDo if (isInSection && !isFolded(i)) { execute(SCI_SHOWLINES, startShowing, i); - //startShowing = execute(SCI_GETLASTCHILD, i, (levelLine & SC_FOLDLEVELNUMBERMASK)); } } } diff --git a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h index 066fad427..ff0c15455 100644 --- a/PowerEditor/src/ScintillaComponent/ScintillaEditView.h +++ b/PowerEditor/src/ScintillaComponent/ScintillaEditView.h @@ -275,12 +275,12 @@ public: Sci_CharacterRange getSelection() const { Sci_CharacterRange crange; - crange.cpMin = long(execute(SCI_GETSELECTIONSTART)); - crange.cpMax = long(execute(SCI_GETSELECTIONEND)); + crange.cpMin = static_cast(execute(SCI_GETSELECTIONSTART)); + crange.cpMax = static_cast(execute(SCI_GETSELECTIONEND)); return crange; }; - void getWordToCurrentPos(TCHAR * str, int strLen) const { + void getWordToCurrentPos(TCHAR * str, INT_PTR strLen) const { auto caretPos = execute(SCI_GETCURRENTPOS); auto startPos = execute(SCI_WORDSTARTPOSITION, caretPos, true); @@ -426,7 +426,7 @@ public: int getTextZoneWidth() const; - void gotoLine(int line){ + void gotoLine(INT_PTR line){ if (line < execute(SCI_GETLINECOUNT)) execute(SCI_GOTOLINE,line); };