diff --git a/PowerEditor/src/MISC/Exception/MiniDumper.cpp b/PowerEditor/src/MISC/Exception/MiniDumper.cpp index 7ef2cbe6..e63c43b5 100644 --- a/PowerEditor/src/MISC/Exception/MiniDumper.cpp +++ b/PowerEditor/src/MISC/Exception/MiniDumper.cpp @@ -54,7 +54,7 @@ bool MiniDumper::writeDump(EXCEPTION_POINTERS * pExceptionInfo) { ::GetModuleFileName(NULL, szDumpPath, MAX_PATH); ::PathRemoveFileSpec(szDumpPath); - lstrcat(szDumpPath, TEXT("\\NppDump.dmp")); + wcscat_s(szDumpPath, TEXT("\\NppDump.dmp")); // ask the user if they want to save a dump file int msgret = ::MessageBox(NULL, TEXT("Do you want to save a dump file?\r\nDoing so can aid in developing Notepad++."), msgTitle, MB_YESNO); diff --git a/PowerEditor/src/MISC/RegExt/regExtDlg.cpp b/PowerEditor/src/MISC/RegExt/regExtDlg.cpp index 8c2b3dbc..884f3195 100644 --- a/PowerEditor/src/MISC/RegExt/regExtDlg.cpp +++ b/PowerEditor/src/MISC/RegExt/regExtDlg.cpp @@ -365,7 +365,7 @@ bool RegExtDlg::deleteExts(const TCHAR *ext2Delete) if ((nbValue <= 1) && (!nbSubkey)) { TCHAR subKey[32] = TEXT("\\"); - lstrcat(subKey, ext2Delete); + wcscat_s(subKey, ext2Delete); ::RegDeleteKey(HKEY_CLASSES_ROOT, subKey); } else @@ -411,8 +411,9 @@ void RegExtDlg::writeNppPath() TCHAR nppPath[MAX_PATH]; ::GetModuleFileName(_hInst, nppPath, MAX_PATH); - TCHAR nppPathParam[MAX_PATH] = TEXT("\""); - lstrcat(lstrcat(nppPathParam, nppPath), TEXT("\" \"%1\"")); + 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)); } @@ -432,7 +433,8 @@ void RegExtDlg::writeNppPath() ::GetModuleFileName(_hInst, nppPath, MAX_PATH); TCHAR nppPathParam[MAX_PATH] = TEXT("\""); - lstrcat(lstrcat(nppPathParam, nppPath), TEXT("\",0")); + wcscat_s(nppPathParam, nppPath); + wcscat_s(nppPathParam, TEXT("\",0")); ::RegSetValueEx(hKey, nullptr, 0, REG_SZ, (LPBYTE)nppPathParam, (lstrlen(nppPathParam)+1)*sizeof(TCHAR)); } diff --git a/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp b/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp index 7c4c1d78..cdfe3dd8 100644 --- a/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp +++ b/PowerEditor/src/ScitillaComponent/AutoCompletion.cpp @@ -768,9 +768,9 @@ bool AutoCompletion::setLanguage(LangType language) { TCHAR path[MAX_PATH]; ::GetModuleFileName(NULL, path, MAX_PATH); PathRemoveFileSpec(path); - lstrcat(path, TEXT("\\autoCompletion\\")); - lstrcat(path, getApiFileName()); - lstrcat(path, TEXT(".xml")); + wcscat_s(path, TEXT("\\autoCompletion\\")); + wcscat_s(path, getApiFileName()); + wcscat_s(path, TEXT(".xml")); if (_pXmlFile) delete _pXmlFile; diff --git a/PowerEditor/src/TinyXml/tinyXmlA/tinystrA.cpp b/PowerEditor/src/TinyXml/tinyXmlA/tinystrA.cpp index 3640ea72..4b161803 100644 --- a/PowerEditor/src/TinyXml/tinyXmlA/tinystrA.cpp +++ b/PowerEditor/src/TinyXml/tinyXmlA/tinystrA.cpp @@ -210,7 +210,6 @@ void TiXmlStringA::append( const char * suffix ) // strcpy (new_string, cstring); // append the suffix. It does exist, otherwize we wouldn't be expanding - // strcat (new_string, suffix); memcpy (new_string + length (), suffix, strlen (suffix) + 1); @@ -226,7 +225,6 @@ void TiXmlStringA::append( const char * suffix ) else { // we know we can safely append the new string - // strcat (cstring, suffix); memcpy (cstring + length (), suffix, strlen (suffix) + 1); diff --git a/PowerEditor/src/TinyXml/tinystr.cpp b/PowerEditor/src/TinyXml/tinystr.cpp index 45343fda..aa536bfc 100644 --- a/PowerEditor/src/TinyXml/tinystr.cpp +++ b/PowerEditor/src/TinyXml/tinystr.cpp @@ -201,7 +201,6 @@ void TiXmlString::append( const TCHAR * suffix ) memcpy (new_string, cstring, 1 + length ()); // append the suffix. It does exist, otherwize we wouldn't be expanding - // lstrcat (new_string, suffix); memcpy (new_string + length (), suffix, lstrlen (suffix) + 1); @@ -217,7 +216,6 @@ void TiXmlString::append( const TCHAR * suffix ) else { // we know we can safely append the new generic_string - // lstrcat (cstring, suffix); memcpy (cstring + length (), suffix, lstrlen (suffix) + 1); diff --git a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp index 8acc694a..3620b944 100644 --- a/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp +++ b/PowerEditor/src/WinControls/ColourPicker/WordStyleDlg.cpp @@ -744,11 +744,11 @@ void WordStyleDlg::setVisualFromStyleList() if (lbTextLen > styleNameLen) return; ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, reinterpret_cast(styleName)); - - lstrcat(lstrcat(str, TEXT(" : ")), styleName); + wcscat_s(str, TEXT(" : ")); + wcscat_s(str, styleName); // PAD for fix a display glitch - lstrcat(str, TEXT(" ")); + wcscat_s(str, TEXT(" ")); colourHooker.setColour(c); ::SetWindowText(_hStyleInfoStaticText, str); diff --git a/PowerEditor/src/WinControls/Grid/BabyGrid.cpp b/PowerEditor/src/WinControls/Grid/BabyGrid.cpp index c68370f4..ebb0a655 100644 --- a/PowerEditor/src/WinControls/Grid/BabyGrid.cpp +++ b/PowerEditor/src/WinControls/Grid/BabyGrid.cpp @@ -1186,8 +1186,8 @@ void DisplayEditString(HWND hWnd,int SI, const TCHAR* tstring) if(lstrlen(BGHS[SI].editstring)<=300) { - lstrcat(BGHS[SI].editstring,tstring); - lstrcpy(BGHS[SI].editstringdisplay,BGHS[SI].editstring); + wcscat_s(BGHS[SI].editstring,tstring); + wcscat_s(BGHS[SI].editstringdisplay,BGHS[SI].editstring); } else { @@ -1577,16 +1577,16 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { //protecting or unprotecting a cell that isn't in the list //add it as blank; - lstrcat(buffer, TEXT("|")); + wcscat_s(buffer, TEXT("|")); if((BOOL)lParam) { - lstrcat(buffer, TEXT("PA")); + wcscat_s(buffer, TEXT("PA")); } else { - lstrcat(buffer, TEXT("UA")); + wcscat_s(buffer, TEXT("UA")); } - lstrcat(buffer, TEXT("|")); + wcscat_s(buffer, TEXT("|")); SendMessage(BGHS[SelfIndex].hlist1, LB_ADDSTRING, FindResult, reinterpret_cast(buffer)); } @@ -1653,20 +1653,20 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } //now add it - lstrcat(buffer, TEXT("|")); - lstrcat(buffer,BGHS[SelfIndex].protect); + wcscat_s(buffer, TEXT("|")); + wcscat_s(buffer,BGHS[SelfIndex].protect); //determine data type (text,numeric, or boolean)(1,2,3) //iDataType=DetermineDataType((TCHAR*)lParam); iDataType = 1; - if(iDataType==1){lstrcat(buffer, TEXT("A"));} - if(iDataType==2){lstrcat(buffer, TEXT("N"));} - if(iDataType==3){lstrcat(buffer, TEXT("T"));} - if(iDataType==4){lstrcat(buffer, TEXT("F"));} - if(iDataType==5){lstrcat(buffer, TEXT("G"));} + if(iDataType==1){ wcscat_s(buffer, TEXT("A"));} + if(iDataType==2){ wcscat_s(buffer, TEXT("N"));} + if(iDataType==3){ wcscat_s(buffer, TEXT("T"));} + if(iDataType==4){ wcscat_s(buffer, TEXT("F"));} + if(iDataType==5){ wcscat_s(buffer, TEXT("G"));} - lstrcat(buffer, TEXT("|")); - lstrcat(buffer, (TCHAR*)lParam); + wcscat_s(buffer, TEXT("|")); + wcscat_s(buffer, (TCHAR*)lParam); FindResult = static_cast(SendMessage(BGHS[SelfIndex].hlist1, LB_ADDSTRING, 0, reinterpret_cast(buffer))); if(FindResult==LB_ERR) diff --git a/PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.cpp b/PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.cpp index f58bc27b..34a7392b 100644 --- a/PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.cpp +++ b/PowerEditor/src/WinControls/OpenSaveFileDialog/FileDialog.cpp @@ -244,7 +244,7 @@ stringVector * FileDialog::doOpenMultiFilesDlg() { wcscpy_s(fn, _fileName); if (fn[lstrlen(fn) - 1] != '\\') - lstrcat(fn, TEXT("\\")); + wcscat_s(fn, TEXT("\\")); } int term = lstrlen(fn); @@ -252,7 +252,7 @@ stringVector * FileDialog::doOpenMultiFilesDlg() while (*pFn) { fn[term] = '\0'; - lstrcat(fn, pFn); + wcscat_s(fn, pFn); _fileNames.push_back(generic_string(fn)); pFn += lstrlen(pFn) + 1; } diff --git a/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp b/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp index ea4a5a74..956ca558 100644 --- a/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp +++ b/PowerEditor/src/WinControls/WindowsDlg/WindowsDlg.cpp @@ -336,7 +336,7 @@ INT_PTR CALLBACK WindowsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lPa { len += lstrlen(readonlyString); if (len <= pLvdi->item.cchTextMax) - lstrcat(pLvdi->item.pszText, readonlyString); + wcscat_s(pLvdi->item.pszText, pLvdi->item.cchTextMax, readonlyString); } } else if (pLvdi->item.iSubItem == 1) // directory diff --git a/PowerEditor/src/winmain.cpp b/PowerEditor/src/winmain.cpp index 470b09ec..65496927 100644 --- a/PowerEditor/src/winmain.cpp +++ b/PowerEditor/src/winmain.cpp @@ -542,7 +542,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int) TCHAR str[50] = TEXT("God Damned Exception : "); TCHAR code[10]; wsprintf(code, TEXT("%d"), i); - ::MessageBox(Notepad_plus_Window::gNppHWND, lstrcat(str, code), TEXT("Int Exception"), MB_OK); + wcscat_s(str, code); + ::MessageBox(Notepad_plus_Window::gNppHWND, str, TEXT("Int Exception"), MB_OK); doException(notepad_plus_plus); } catch (std::runtime_error & ex)