mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-27 15:54:17 +02:00
parent
296a168b3f
commit
f38195a0da
@ -346,9 +346,9 @@ void RegExtDlg::getRegisteredExts()
|
||||
if ((res == ERROR_SUCCESS) && (extName[0] == '.'))
|
||||
{
|
||||
//TCHAR valName[extNameLen];
|
||||
TCHAR valData[extNameLen];
|
||||
TCHAR valData[extNameLen] = { '\0' };
|
||||
DWORD valDataLen = extNameLen * sizeof(TCHAR);
|
||||
DWORD valType;
|
||||
DWORD valType = 0;
|
||||
HKEY hKey2Check;
|
||||
extNameActualLen = extNameLen;
|
||||
::RegOpenKeyEx(HKEY_CLASSES_ROOT, extName, 0, KEY_ALL_ACCESS, &hKey2Check);
|
||||
@ -372,14 +372,14 @@ void RegExtDlg::getDefSupportedExts()
|
||||
void RegExtDlg::addExt(TCHAR *ext)
|
||||
{
|
||||
HKEY hKey;
|
||||
DWORD dwDisp;
|
||||
DWORD dwDisp = 0;
|
||||
long nRet;
|
||||
|
||||
nRet = ::RegCreateKeyEx(HKEY_CLASSES_ROOT, ext, 0, nullptr, 0, KEY_ALL_ACCESS, nullptr, &hKey, &dwDisp);
|
||||
|
||||
if (nRet == ERROR_SUCCESS)
|
||||
{
|
||||
TCHAR valData[MAX_PATH];
|
||||
TCHAR valData[MAX_PATH] = { '\0' };
|
||||
DWORD valDataLen = MAX_PATH * sizeof(TCHAR);
|
||||
|
||||
if (dwDisp == REG_OPENED_EXISTING_KEY)
|
||||
@ -388,7 +388,7 @@ void RegExtDlg::addExt(TCHAR *ext)
|
||||
if (res == ERROR_SUCCESS)
|
||||
::RegSetValueEx(hKey, nppBackup, 0, REG_SZ, reinterpret_cast<LPBYTE>(valData), valDataLen);
|
||||
}
|
||||
::RegSetValueEx(hKey, nullptr, 0, REG_SZ, reinterpret_cast<const BYTE *>(nppName), (lstrlen(nppName) + 1) * sizeof(TCHAR));
|
||||
::RegSetValueEx(hKey, nullptr, 0, REG_SZ, reinterpret_cast<const BYTE *>(nppName), static_cast<DWORD>((lstrlen(nppName) + 1) * sizeof(TCHAR)));
|
||||
|
||||
::RegCloseKey(hKey);
|
||||
}
|
||||
@ -411,9 +411,9 @@ bool RegExtDlg::deleteExts(const TCHAR *ext2Delete)
|
||||
}
|
||||
else
|
||||
{
|
||||
TCHAR valData[extNameLen];
|
||||
TCHAR valData[extNameLen] = { '\0' };
|
||||
DWORD valDataLen = extNameLen*sizeof(TCHAR);
|
||||
DWORD valType;
|
||||
DWORD valType = 0;
|
||||
int res = ::RegQueryValueEx(hKey, nppBackup, nullptr, &valType, (LPBYTE)valData, &valDataLen);
|
||||
|
||||
if (res == ERROR_SUCCESS)
|
||||
@ -432,8 +432,8 @@ bool RegExtDlg::deleteExts(const TCHAR *ext2Delete)
|
||||
void RegExtDlg::writeNppPath()
|
||||
{
|
||||
HKEY hKey, hRootKey;
|
||||
DWORD dwDisp;
|
||||
long nRet;
|
||||
DWORD dwDisp = 0;
|
||||
long nRet = 0;
|
||||
generic_string regStr(nppName);
|
||||
regStr += TEXT("\\shell\\open\\command");
|
||||
|
||||
@ -446,17 +446,17 @@ void RegExtDlg::writeNppPath()
|
||||
{
|
||||
// Write the value for new document
|
||||
::RegOpenKeyEx(HKEY_CLASSES_ROOT, nppName, 0, KEY_ALL_ACCESS, &hRootKey);
|
||||
::RegSetValueEx(hRootKey, nullptr, 0, REG_SZ, (LPBYTE)nppDoc, (lstrlen(nppDoc)+1)*sizeof(TCHAR));
|
||||
::RegSetValueEx(hRootKey, nullptr, 0, REG_SZ, (LPBYTE)nppDoc, static_cast<DWORD>((lstrlen(nppDoc) + 1) * sizeof(TCHAR)));
|
||||
RegCloseKey(hRootKey);
|
||||
|
||||
TCHAR nppPath[MAX_PATH];
|
||||
TCHAR nppPath[MAX_PATH] = { '\0' };
|
||||
::GetModuleFileName(_hInst, nppPath, MAX_PATH);
|
||||
|
||||
TCHAR nppPathParam[MAX_PATH] = TEXT("\"");
|
||||
wcscat_s(nppPathParam, nppPath);
|
||||
wcscat_s(nppPathParam, TEXT("\" \"%1\""));
|
||||
|
||||
::RegSetValueEx(hKey, nullptr, 0, REG_SZ, (LPBYTE)nppPathParam, (lstrlen(nppPathParam)+1)*sizeof(TCHAR));
|
||||
::RegSetValueEx(hKey, nullptr, 0, REG_SZ, (LPBYTE)nppPathParam, static_cast<DWORD>((lstrlen(nppPathParam) + 1) * sizeof(TCHAR)));
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
@ -470,14 +470,14 @@ void RegExtDlg::writeNppPath()
|
||||
{
|
||||
//if (dwDisp == REG_CREATED_NEW_KEY)
|
||||
{
|
||||
TCHAR nppPath[MAX_PATH];
|
||||
TCHAR nppPath[MAX_PATH] = { '\0' };
|
||||
::GetModuleFileName(_hInst, nppPath, MAX_PATH);
|
||||
|
||||
TCHAR nppPathParam[MAX_PATH] = TEXT("\"");
|
||||
wcscat_s(nppPathParam, nppPath);
|
||||
wcscat_s(nppPathParam, TEXT("\",0"));
|
||||
|
||||
::RegSetValueEx(hKey, nullptr, 0, REG_SZ, (LPBYTE)nppPathParam, (lstrlen(nppPathParam)+1)*sizeof(TCHAR));
|
||||
::RegSetValueEx(hKey, nullptr, 0, REG_SZ, (LPBYTE)nppPathParam, static_cast<DWORD>((lstrlen(nppPathParam) + 1) * sizeof(TCHAR)));
|
||||
}
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
@ -4223,7 +4223,7 @@ void Notepad_plus::hideView(int whichOne)
|
||||
return;
|
||||
|
||||
Window * windowToSet = (whichOne == MAIN_VIEW)?&_subDocTab:&_mainDocTab;
|
||||
if (_mainWindowStatus & WindowUserActive)
|
||||
if ((_mainWindowStatus & WindowUserActive) == WindowUserActive)
|
||||
{
|
||||
_pMainSplitter->setWin0(windowToSet);
|
||||
}
|
||||
@ -4250,7 +4250,7 @@ void Notepad_plus::hideView(int whichOne)
|
||||
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
||||
|
||||
switchEditViewTo(otherFromView(whichOne));
|
||||
int viewToDisable = (whichOne == SUB_VIEW?WindowSubActive:WindowMainActive);
|
||||
auto viewToDisable = static_cast<UCHAR>(whichOne == SUB_VIEW ? WindowSubActive : WindowMainActive);
|
||||
_mainWindowStatus &= ~viewToDisable;
|
||||
}
|
||||
|
||||
@ -8430,7 +8430,8 @@ void Notepad_plus::createMonitoringThread(Buffer* pBuf)
|
||||
{
|
||||
MonitorInfo *monitorInfo = new Notepad_plus::MonitorInfo(pBuf, _pPublicInterface->getHSelf());
|
||||
HANDLE hThread = ::CreateThread(NULL, 0, monitorFileOnChange, (void *)monitorInfo, 0, NULL); // will be deallocated while quitting thread
|
||||
::CloseHandle(hThread);
|
||||
if (hThread != nullptr)
|
||||
::CloseHandle(hThread);
|
||||
}
|
||||
|
||||
// Fill names into the shortcut list.
|
||||
|
@ -269,7 +269,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
||||
COPYDATASTRUCT fileNamesData{};
|
||||
fileNamesData.dwData = COPYDATA_FILENAMESW;
|
||||
fileNamesData.lpData = (void *)quotFileName.c_str();
|
||||
fileNamesData.cbData = long(quotFileName.length() + 1)*(sizeof(TCHAR));
|
||||
fileNamesData.cbData = static_cast<DWORD>((quotFileName.length() + 1) * sizeof(TCHAR));
|
||||
|
||||
HWND hWinParent = ::GetParent(hWin);
|
||||
const rsize_t classNameBufferSize = MAX_PATH;
|
||||
|
@ -332,13 +332,13 @@ LRESULT CALLBACK ScintillaEditView::scintillaStatic_Proc(HWND hwnd, UINT Message
|
||||
|
||||
if (Message == WM_MOUSEWHEEL || Message == WM_MOUSEHWHEEL)
|
||||
{
|
||||
POINT pt;
|
||||
POINT pt{};
|
||||
POINTS pts = MAKEPOINTS(lParam);
|
||||
POINTSTOPOINT(pt, pts);
|
||||
HWND hwndOnMouse = WindowFromPoint(pt);
|
||||
|
||||
//Hack for Synaptics TouchPad Driver
|
||||
char synapticsHack[26];
|
||||
char synapticsHack[26]{};
|
||||
GetClassNameA(hwndOnMouse, (LPSTR)&synapticsHack, 26);
|
||||
bool isSynpnatic = std::string(synapticsHack) == "SynTrackCursorWindowClass";
|
||||
bool makeTouchPadCompetible = ((NppParameters::getInstance()).getSVP())._disableAdvancedScrolling;
|
||||
@ -399,9 +399,9 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
|
||||
|
||||
if (wParam == IMR_RECONVERTSTRING)
|
||||
{
|
||||
intptr_t textLength;
|
||||
intptr_t selectSize;
|
||||
char smallTextBuffer[128];
|
||||
intptr_t textLength = 0;
|
||||
intptr_t selectSize = 0;
|
||||
char smallTextBuffer[128] = { '\0' };
|
||||
char * selectedStr = smallTextBuffer;
|
||||
RECONVERTSTRING * reconvert = (RECONVERTSTRING *)lParam;
|
||||
|
||||
@ -451,7 +451,7 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
|
||||
textLength = ::MultiByteToWideChar( codepage, 0,
|
||||
selectedStr, (int)selectSize,
|
||||
(LPWSTR)((LPSTR)reconvert + sizeof(RECONVERTSTRING)),
|
||||
reconvert->dwSize - sizeof(RECONVERTSTRING));
|
||||
static_cast<int>(reconvert->dwSize - sizeof(RECONVERTSTRING)));
|
||||
|
||||
// fill the structure
|
||||
reconvert->dwVersion = 0;
|
||||
@ -1205,7 +1205,7 @@ void ScintillaEditView::setTypeScriptLexer()
|
||||
return basic_string<char>("");
|
||||
};
|
||||
|
||||
auto keywordListInstruction = getKeywordList(LANG_INDEX_INSTR);
|
||||
std::string keywordListInstruction = getKeywordList(LANG_INDEX_INSTR);
|
||||
const char* tsInstructions = getCompleteKeywordList(keywordListInstruction, L_TYPESCRIPT, LANG_INDEX_INSTR);
|
||||
|
||||
string keywordListType = getKeywordList(LANG_INDEX_TYPE);
|
||||
@ -2368,12 +2368,12 @@ void ScintillaEditView::getVisibleStartAndEndPosition(intptr_t* startPos, intptr
|
||||
{
|
||||
assert(startPos != NULL && endPos != NULL);
|
||||
// Get the position of the 1st and last showing chars from the edit view
|
||||
RECT rcEditView;
|
||||
RECT rcEditView{};
|
||||
getClientRect(rcEditView);
|
||||
LRESULT pos = execute(SCI_POSITIONFROMPOINT, 0, 0);
|
||||
LRESULT line = execute(SCI_LINEFROMPOSITION, pos);
|
||||
*startPos = execute(SCI_POSITIONFROMLINE, line);
|
||||
pos = execute(SCI_POSITIONFROMPOINT, rcEditView.right - rcEditView.left, rcEditView.bottom - rcEditView.top);
|
||||
pos = execute(SCI_POSITIONFROMPOINT, static_cast<WPARAM>(rcEditView.right - rcEditView.left), static_cast<LPARAM>(rcEditView.bottom - rcEditView.top));
|
||||
line = execute(SCI_LINEFROMPOSITION, pos);
|
||||
*endPos = execute(SCI_GETLINEENDPOSITION, line);
|
||||
}
|
||||
@ -3991,7 +3991,7 @@ pair<size_t, size_t> ScintillaEditView::getSelectedCharsAndLinesCount(long long
|
||||
}
|
||||
sort(v.begin(), v.end());
|
||||
intptr_t previousSecondLine = -1;
|
||||
for (auto lineRange : v)
|
||||
for (auto& lineRange : v)
|
||||
{
|
||||
selectedCharsAndLines.second += lineRange.second - lineRange.first;
|
||||
if (lineRange.first != static_cast<size_t>(previousSecondLine))
|
||||
@ -4091,7 +4091,7 @@ void ScintillaEditView::markedTextToClipboard(int indiStyle, bool doAll /*= fals
|
||||
TEXT("\r\n----\r\n") : TEXT("\r\n");
|
||||
|
||||
generic_string joined;
|
||||
for (auto item : styledVect)
|
||||
for (auto& item : styledVect)
|
||||
{
|
||||
joined += delim + item.second;
|
||||
}
|
||||
|
@ -240,22 +240,22 @@ const char* TiXmlBaseA::GetEntity( const char* p, char* value )
|
||||
{
|
||||
// Short, one value entity.
|
||||
if ( isalpha( *(p+3) ) )
|
||||
*value += (static_cast<char>(tolower(*(p + 3))) - 'a' + 10);
|
||||
*value += static_cast<char>(static_cast<char>(tolower(*(p + 3))) - 'a' + 10);
|
||||
else
|
||||
*value += (static_cast<char>(*(p + 3)) - '0');
|
||||
*value += static_cast<char>(static_cast<char>(*(p + 3)) - '0');
|
||||
|
||||
return p+5;
|
||||
}
|
||||
else
|
||||
{
|
||||
// two value entity
|
||||
if (isalpha(*(p + 3))) *value += (static_cast<char>(tolower(*(p + 3))) - 'a' + 10) * 16;
|
||||
else *value += (static_cast<char>(*(p + 3)) - '0') * 16;
|
||||
if (isalpha(*(p + 3))) *value += static_cast<char>((static_cast<char>(tolower(*(p + 3))) - 'a' + 10) * 16);
|
||||
else *value += static_cast<char>((static_cast<char>(*(p + 3)) - '0') * 16);
|
||||
|
||||
if ( isalpha( *(p+4) ) )
|
||||
*value += (static_cast<char>(tolower(*(p + 4))) - 'a' + 10);
|
||||
*value += static_cast<char>(static_cast<char>(tolower(*(p + 4))) - 'a' + 10);
|
||||
else
|
||||
*value += (static_cast<char>(*(p + 4)) - '0');
|
||||
*value += static_cast<char>(static_cast<char>(*(p + 4)) - '0');
|
||||
|
||||
return p+6;
|
||||
}
|
||||
|
@ -635,12 +635,12 @@ void Utf16_Iter::operator++()
|
||||
m_eState = eStart;
|
||||
} else if (m_nCur16 < 0x800) {
|
||||
pushout(static_cast<ubyte>(0xC0 | m_nCur16 >> 6));
|
||||
pushout(0x80 | (m_nCur16 & 0x3f));
|
||||
pushout(static_cast<ubyte>(0x80 | (m_nCur16 & 0x3f)));
|
||||
m_eState = eStart;
|
||||
} else {
|
||||
pushout(0xE0 | (m_nCur16 >> 12));
|
||||
pushout(0x80 | ((m_nCur16 >> 6) & 0x3f));
|
||||
pushout(0x80 | (m_nCur16 & 0x3f));
|
||||
pushout(static_cast<ubyte>(0xE0 | (m_nCur16 >> 12)));
|
||||
pushout(static_cast<ubyte>(0x80 | ((m_nCur16 >> 6) & 0x3f)));
|
||||
pushout(static_cast<ubyte>(0x80 | (m_nCur16 & 0x3f)));
|
||||
m_eState = eStart;
|
||||
}
|
||||
break;
|
||||
|
@ -378,7 +378,7 @@ void stripIgnoredParams(ParamVector & params)
|
||||
|
||||
|
||||
|
||||
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int)
|
||||
int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE /*hPrevInstance*/, _In_ PWSTR pCmdLine, _In_ int /*nShowCmd*/)
|
||||
{
|
||||
bool TheFirstOne = true;
|
||||
::SetLastError(NO_ERROR);
|
||||
@ -585,22 +585,22 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int)
|
||||
{
|
||||
CmdLineParamsDTO dto = CmdLineParamsDTO::FromCmdLineParams(cmdLineParams);
|
||||
|
||||
COPYDATASTRUCT paramData;
|
||||
COPYDATASTRUCT paramData{};
|
||||
paramData.dwData = COPYDATA_PARAMS;
|
||||
paramData.lpData = &dto;
|
||||
paramData.cbData = sizeof(dto);
|
||||
::SendMessage(hNotepad_plus, WM_COPYDATA, reinterpret_cast<WPARAM>(hInstance), reinterpret_cast<LPARAM>(¶mData));
|
||||
|
||||
COPYDATASTRUCT cmdLineData;
|
||||
COPYDATASTRUCT cmdLineData{};
|
||||
cmdLineData.dwData = COPYDATA_FULL_CMDLINE;
|
||||
cmdLineData.lpData = (void*)cmdLineString.c_str();
|
||||
cmdLineData.cbData = long(cmdLineString.length() + 1) * (sizeof(TCHAR));
|
||||
cmdLineData.cbData = static_cast<DWORD>((cmdLineString.length() + 1) * sizeof(TCHAR));
|
||||
::SendMessage(hNotepad_plus, WM_COPYDATA, reinterpret_cast<WPARAM>(hInstance), reinterpret_cast<LPARAM>(&cmdLineData));
|
||||
|
||||
COPYDATASTRUCT fileNamesData;
|
||||
COPYDATASTRUCT fileNamesData{};
|
||||
fileNamesData.dwData = COPYDATA_FILENAMESW;
|
||||
fileNamesData.lpData = (void *)quotFileName.c_str();
|
||||
fileNamesData.cbData = long(quotFileName.length() + 1) * (sizeof(TCHAR));
|
||||
fileNamesData.cbData = static_cast<DWORD>((quotFileName.length() + 1) * sizeof(TCHAR));
|
||||
::SendMessage(hNotepad_plus, WM_COPYDATA, reinterpret_cast<WPARAM>(hInstance), reinterpret_cast<LPARAM>(&fileNamesData));
|
||||
}
|
||||
return 0;
|
||||
@ -696,7 +696,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int)
|
||||
}
|
||||
}
|
||||
|
||||
MSG msg;
|
||||
MSG msg{};
|
||||
msg.wParam = 0;
|
||||
Win32Exception::installHandler();
|
||||
MiniDumper mdump; //for debugging purposes.
|
||||
|
@ -18,7 +18,7 @@
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<DisableSpecificWarnings>4091;4456;4457;4459</DisableSpecificWarnings>
|
||||
<DisableSpecificWarnings>4456;4457;4459</DisableSpecificWarnings>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
|
Loading…
x
Reference in New Issue
Block a user