[EU-FOSSA] Use wcscpy_s instead of lstrcpy to prevent from buffer overflow
This commit is contained in:
parent
b381ea5353
commit
7fe3cda1d0
@ -1219,7 +1219,7 @@ bool deleteFileOrFolder(const generic_string& f2delete)
|
|||||||
{
|
{
|
||||||
auto len = f2delete.length();
|
auto len = f2delete.length();
|
||||||
TCHAR* actionFolder = new TCHAR[len + 2];
|
TCHAR* actionFolder = new TCHAR[len + 2];
|
||||||
lstrcpy(actionFolder, f2delete.c_str());
|
wcscpy_s(actionFolder, len + 2, f2delete.c_str());
|
||||||
actionFolder[len] = 0;
|
actionFolder[len] = 0;
|
||||||
actionFolder[len + 1] = 0;
|
actionFolder[len + 1] = 0;
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TCHAR xmlPath[MAX_PATH];
|
TCHAR xmlPath[MAX_PATH];
|
||||||
lstrcpy(xmlPath, nppParams->getNppPath().c_str());
|
wcscpy_s(xmlPath, nppParams->getNppPath().c_str());
|
||||||
PathAppend(xmlPath, TEXT("plugins\\Config"));
|
PathAppend(xmlPath, TEXT("plugins\\Config"));
|
||||||
PathAppend(xmlPath, pi->_moduleName.c_str());
|
PathAppend(xmlPath, pi->_moduleName.c_str());
|
||||||
PathRemoveExtension(xmlPath);
|
PathRemoveExtension(xmlPath);
|
||||||
@ -220,7 +220,7 @@ int PluginsManager::loadPlugin(const TCHAR *pluginFilePath)
|
|||||||
if (!PathFileExists(xmlPath))
|
if (!PathFileExists(xmlPath))
|
||||||
{
|
{
|
||||||
lstrcpyn(xmlPath, TEXT("\0"), MAX_PATH );
|
lstrcpyn(xmlPath, TEXT("\0"), MAX_PATH );
|
||||||
lstrcpy(xmlPath, nppParams->getAppDataNppDir() );
|
wcscpy_s(xmlPath, nppParams->getAppDataNppDir() );
|
||||||
PathAppend(xmlPath, TEXT("plugins\\Config"));
|
PathAppend(xmlPath, TEXT("plugins\\Config"));
|
||||||
PathAppend(xmlPath, pi->_moduleName.c_str());
|
PathAppend(xmlPath, pi->_moduleName.c_str());
|
||||||
PathRemoveExtension( xmlPath );
|
PathRemoveExtension( xmlPath );
|
||||||
|
@ -2480,11 +2480,12 @@ void Notepad_plus::addHotSpot()
|
|||||||
|
|
||||||
hotspotStyle._styleID = static_cast<int>(style_hotspot);
|
hotspotStyle._styleID = static_cast<int>(style_hotspot);
|
||||||
_pEditView->execute(SCI_STYLEGETFONT, idStyleMSBunset, reinterpret_cast<LPARAM>(fontNameA));
|
_pEditView->execute(SCI_STYLEGETFONT, idStyleMSBunset, reinterpret_cast<LPARAM>(fontNameA));
|
||||||
TCHAR *generic_fontname = new TCHAR[128];
|
const size_t generic_fontnameLen = 128;
|
||||||
|
TCHAR *generic_fontname = new TCHAR[generic_fontnameLen];
|
||||||
|
|
||||||
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
|
||||||
const wchar_t * fontNameW = wmc->char2wchar(fontNameA, _nativeLangSpeaker.getLangEncoding());
|
const wchar_t * fontNameW = wmc->char2wchar(fontNameA, _nativeLangSpeaker.getLangEncoding());
|
||||||
lstrcpy(generic_fontname, fontNameW);
|
wcscpy_s(generic_fontname, generic_fontnameLen, fontNameW);
|
||||||
hotspotStyle._fontName = generic_fontname;
|
hotspotStyle._fontName = generic_fontname;
|
||||||
|
|
||||||
hotspotStyle._fgColor = static_cast<COLORREF>(_pEditView->execute(SCI_STYLEGETFORE, idStyleMSBunset));
|
hotspotStyle._fgColor = static_cast<COLORREF>(_pEditView->execute(SCI_STYLEGETFORE, idStyleMSBunset));
|
||||||
@ -5798,7 +5799,7 @@ void Notepad_plus::launchClipboardHistoryPanel()
|
|||||||
static TCHAR title[32];
|
static TCHAR title[32];
|
||||||
if (title_temp.length() < 32)
|
if (title_temp.length() < 32)
|
||||||
{
|
{
|
||||||
lstrcpy(title, title_temp.c_str());
|
wcscpy_s(title, title_temp.c_str());
|
||||||
data.pszName = title;
|
data.pszName = title;
|
||||||
}
|
}
|
||||||
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
|
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
|
||||||
@ -5841,7 +5842,7 @@ void Notepad_plus::launchFileSwitcherPanel()
|
|||||||
static TCHAR title[32];
|
static TCHAR title[32];
|
||||||
if (title_temp.length() < 32)
|
if (title_temp.length() < 32)
|
||||||
{
|
{
|
||||||
lstrcpy(title, title_temp.c_str());
|
wcscpy_s(title, title_temp.c_str());
|
||||||
data.pszName = title;
|
data.pszName = title;
|
||||||
}
|
}
|
||||||
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
|
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
|
||||||
@ -5882,7 +5883,7 @@ void Notepad_plus::launchAnsiCharPanel()
|
|||||||
static TCHAR title[32];
|
static TCHAR title[32];
|
||||||
if (title_temp.length() < 32)
|
if (title_temp.length() < 32)
|
||||||
{
|
{
|
||||||
lstrcpy(title, title_temp.c_str());
|
wcscpy_s(title, title_temp.c_str());
|
||||||
data.pszName = title;
|
data.pszName = title;
|
||||||
}
|
}
|
||||||
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
|
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
|
||||||
@ -5926,7 +5927,7 @@ void Notepad_plus::launchFileBrowser(const vector<generic_string> & folders)
|
|||||||
static TCHAR title[32];
|
static TCHAR title[32];
|
||||||
if (title_temp.length() < 32)
|
if (title_temp.length() < 32)
|
||||||
{
|
{
|
||||||
lstrcpy(title, title_temp.c_str());
|
wcscpy_s(title, title_temp.c_str());
|
||||||
data.pszName = title;
|
data.pszName = title;
|
||||||
}
|
}
|
||||||
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
|
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
|
||||||
@ -5983,7 +5984,7 @@ void Notepad_plus::launchProjectPanel(int cmdID, ProjectPanel ** pProjPanel, int
|
|||||||
static TCHAR title[32];
|
static TCHAR title[32];
|
||||||
if (title_temp.length() < 32)
|
if (title_temp.length() < 32)
|
||||||
{
|
{
|
||||||
lstrcpy(title, title_temp.c_str());
|
wcscpy_s(title, title_temp.c_str());
|
||||||
data.pszName = title;
|
data.pszName = title;
|
||||||
}
|
}
|
||||||
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
|
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
|
||||||
@ -6035,7 +6036,7 @@ void Notepad_plus::launchDocMap()
|
|||||||
static TCHAR title[32];
|
static TCHAR title[32];
|
||||||
if (title_temp.length() < 32)
|
if (title_temp.length() < 32)
|
||||||
{
|
{
|
||||||
lstrcpy(title, title_temp.c_str());
|
wcscpy_s(title, title_temp.c_str());
|
||||||
data.pszName = title;
|
data.pszName = title;
|
||||||
}
|
}
|
||||||
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
|
::SendMessage(_pPublicInterface->getHSelf(), NPPM_DMMREGASDCKDLG, 0, reinterpret_cast<LPARAM>(&data));
|
||||||
@ -6076,7 +6077,7 @@ void Notepad_plus::launchFunctionList()
|
|||||||
static TCHAR title[32];
|
static TCHAR title[32];
|
||||||
if (title_temp.length() < 32)
|
if (title_temp.length() < 32)
|
||||||
{
|
{
|
||||||
lstrcpy(title, title_temp.c_str());
|
wcscpy_s(title, title_temp.c_str());
|
||||||
data.pszName = title;
|
data.pszName = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,7 +688,8 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
{
|
{
|
||||||
TCHAR str[MAX_PATH];
|
TCHAR str[MAX_PATH];
|
||||||
// par defaut : NPPM_GETCURRENTDIRECTORY
|
// par defaut : NPPM_GETCURRENTDIRECTORY
|
||||||
TCHAR *fileStr = lstrcpy(str, _pEditView->getCurrentBuffer()->getFullPathName());
|
wcscpy_s(str, _pEditView->getCurrentBuffer()->getFullPathName());
|
||||||
|
TCHAR* fileStr = str;
|
||||||
|
|
||||||
if (message == NPPM_GETCURRENTDIRECTORY)
|
if (message == NPPM_GETCURRENTDIRECTORY)
|
||||||
PathRemoveFileSpec(str);
|
PathRemoveFileSpec(str);
|
||||||
|
@ -402,7 +402,7 @@ void Notepad_plus::command(int id)
|
|||||||
TCHAR cmd2Exec[CURRENTWORD_MAXLENGTH];
|
TCHAR cmd2Exec[CURRENTWORD_MAXLENGTH];
|
||||||
if (id == IDM_EDIT_OPENINFOLDER)
|
if (id == IDM_EDIT_OPENINFOLDER)
|
||||||
{
|
{
|
||||||
lstrcpy(cmd2Exec, TEXT("explorer"));
|
wcscpy_s(cmd2Exec, TEXT("explorer"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,7 @@ DWORD WINAPI Notepad_plus::monitorFileOnChange(void * params)
|
|||||||
|
|
||||||
//The folder to watch :
|
//The folder to watch :
|
||||||
WCHAR folderToMonitor[MAX_PATH];
|
WCHAR folderToMonitor[MAX_PATH];
|
||||||
lstrcpy(folderToMonitor, fullFileName);
|
wcscpy_s(folderToMonitor, fullFileName);
|
||||||
|
|
||||||
::PathRemoveFileSpecW(folderToMonitor);
|
::PathRemoveFileSpecW(folderToMonitor);
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
|
|||||||
bool isSnapshotMode = backupFileName != NULL && PathFileExists(backupFileName);
|
bool isSnapshotMode = backupFileName != NULL && PathFileExists(backupFileName);
|
||||||
if (isSnapshotMode && !PathFileExists(longFileName)) // UNTITLED
|
if (isSnapshotMode && !PathFileExists(longFileName)) // UNTITLED
|
||||||
{
|
{
|
||||||
lstrcpy(longFileName, fileName.c_str());
|
wcscpy_s(longFileName, fileName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -882,7 +882,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
if (tipTmp.length() >= 80)
|
if (tipTmp.length() >= 80)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
lstrcpy(lpttt->szText, tipTmp.c_str());
|
wcscpy_s(lpttt->szText, tipTmp.c_str());
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (hWin == _mainDocTab.getHSelf())
|
else if (hWin == _mainDocTab.getHSelf())
|
||||||
@ -893,7 +893,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
|
|
||||||
if (tipTmp.length() >= tipMaxLen)
|
if (tipTmp.length() >= tipMaxLen)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
lstrcpy(docTip, tipTmp.c_str());
|
wcscpy_s(docTip, tipTmp.c_str());
|
||||||
lpttt->lpszText = docTip;
|
lpttt->lpszText = docTip;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -905,7 +905,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
|
|||||||
|
|
||||||
if (tipTmp.length() >= tipMaxLen)
|
if (tipTmp.length() >= tipMaxLen)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
lstrcpy(docTip, tipTmp.c_str());
|
wcscpy_s(docTip, tipTmp.c_str());
|
||||||
lpttt->lpszText = docTip;
|
lpttt->lpszText = docTip;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -999,7 +999,7 @@ bool NppParameters::load()
|
|||||||
{
|
{
|
||||||
generic_string progPath = getSpecialFolderLocation(CSIDL_PROGRAM_FILES);
|
generic_string progPath = getSpecialFolderLocation(CSIDL_PROGRAM_FILES);
|
||||||
TCHAR nppDirLocation[MAX_PATH];
|
TCHAR nppDirLocation[MAX_PATH];
|
||||||
lstrcpy(nppDirLocation, _nppPath.c_str());
|
wcscpy_s(nppDirLocation, _nppPath.c_str());
|
||||||
::PathRemoveFileSpec(nppDirLocation);
|
::PathRemoveFileSpec(nppDirLocation);
|
||||||
|
|
||||||
if (progPath == nppDirLocation)
|
if (progPath == nppDirLocation)
|
||||||
@ -3344,7 +3344,7 @@ void NppParameters::feedUserKeywordList(TiXmlNode *node)
|
|||||||
temp += TEXT(" 08"); if (kwl[5] != '0') temp += kwl[5];
|
temp += TEXT(" 08"); if (kwl[5] != '0') temp += kwl[5];
|
||||||
|
|
||||||
temp += TEXT(" 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23");
|
temp += TEXT(" 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23");
|
||||||
lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_DELIMITERS], temp.c_str());
|
wcscpy_s(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_DELIMITERS], temp.c_str());
|
||||||
}
|
}
|
||||||
else if (!lstrcmp(keywordsName, TEXT("Comment")))
|
else if (!lstrcmp(keywordsName, TEXT("Comment")))
|
||||||
{
|
{
|
||||||
@ -3378,7 +3378,7 @@ void NppParameters::feedUserKeywordList(TiXmlNode *node)
|
|||||||
if (temp[0] == ' ')
|
if (temp[0] == ' ')
|
||||||
temp.erase(0, 1);
|
temp.erase(0, 1);
|
||||||
|
|
||||||
lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_COMMENTS], temp.c_str());
|
wcscpy_s(_userLangArray[_nbUserLang - 1]->_keywordLists[SCE_USER_KWLIST_COMMENTS], temp.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3388,11 +3388,11 @@ void NppParameters::feedUserKeywordList(TiXmlNode *node)
|
|||||||
id = globalMappper().keywordIdMapper[keywordsName];
|
id = globalMappper().keywordIdMapper[keywordsName];
|
||||||
if (_tcslen(kwl) < max_char)
|
if (_tcslen(kwl) < max_char)
|
||||||
{
|
{
|
||||||
lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[id], kwl);
|
wcscpy_s(_userLangArray[_nbUserLang - 1]->_keywordLists[id], kwl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lstrcpy(_userLangArray[_nbUserLang - 1]->_keywordLists[id], TEXT("imported string too long, needs to be < max_char(30720)"));
|
wcscpy_s(_userLangArray[_nbUserLang - 1]->_keywordLists[id], TEXT("imported string too long, needs to be < max_char(30720)"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6627,12 +6627,16 @@ void NppParameters::stylerStrOp(bool op)
|
|||||||
|
|
||||||
if (op == DUP)
|
if (op == DUP)
|
||||||
{
|
{
|
||||||
TCHAR *str = new TCHAR[lstrlen(style._styleDesc) + 1];
|
const size_t strLen = lstrlen(style._styleDesc) + 1;
|
||||||
style._styleDesc = lstrcpy(str, style._styleDesc);
|
TCHAR *str = new TCHAR[strLen];
|
||||||
|
wcscpy_s(str, strLen, style._styleDesc);
|
||||||
|
style._styleDesc = str;
|
||||||
if (style._fontName)
|
if (style._fontName)
|
||||||
{
|
{
|
||||||
str = new TCHAR[lstrlen(style._fontName) + 1];
|
const size_t strLen2 = lstrlen(style._fontName) + 1;
|
||||||
style._fontName = lstrcpy(str, style._fontName);
|
str = new TCHAR[strLen2];
|
||||||
|
wcscpy_s(str, strLen2, style._fontName);
|
||||||
|
style._fontName = str;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1043,7 +1043,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
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]);
|
wcscpy_s(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];
|
||||||
|
@ -594,7 +594,7 @@ BufferID FileManager::loadFile(const TCHAR * filename, Document doc, int encodin
|
|||||||
bool isSnapshotMode = backupFileName != NULL && PathFileExists(backupFileName);
|
bool isSnapshotMode = backupFileName != NULL && PathFileExists(backupFileName);
|
||||||
if (isSnapshotMode && !PathFileExists(fullpath)) // if backup mode and fullpath doesn't exist, we guess is UNTITLED
|
if (isSnapshotMode && !PathFileExists(fullpath)) // if backup mode and fullpath doesn't exist, we guess is UNTITLED
|
||||||
{
|
{
|
||||||
lstrcpy(fullpath, filename); // we restore fullpath with filename, in our case is "new #"
|
wcscpy_s(fullpath, MAX_PATH, filename); // we restore fullpath with filename, in our case is "new #"
|
||||||
}
|
}
|
||||||
|
|
||||||
Utf8_16_Read UnicodeConvertor; //declare here so we can get information after loading is done
|
Utf8_16_Read UnicodeConvertor; //declare here so we can get information after loading is done
|
||||||
@ -1471,8 +1471,10 @@ int FileManager::getFileNameFromBuffer(BufferID id, TCHAR * fn2copy)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
Buffer* buf = getBufferByID(id);
|
Buffer* buf = getBufferByID(id);
|
||||||
|
|
||||||
if (fn2copy)
|
if (fn2copy)
|
||||||
lstrcpy(fn2copy, buf->getFullPathName());
|
lstrcpy(fn2copy, buf->getFullPathName());
|
||||||
|
|
||||||
return lstrlen(buf->getFullPathName());
|
return lstrlen(buf->getFullPathName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1496,7 +1496,7 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op
|
|||||||
|
|
||||||
int stringSizeFind = lstrlen(txt2find);
|
int stringSizeFind = lstrlen(txt2find);
|
||||||
TCHAR *pText = new TCHAR[stringSizeFind + 1];
|
TCHAR *pText = new TCHAR[stringSizeFind + 1];
|
||||||
lstrcpy(pText, txt2find);
|
wcscpy_s(pText, stringSizeFind + 1, txt2find);
|
||||||
|
|
||||||
if (pOptions->_searchType == FindExtended) {
|
if (pOptions->_searchType == FindExtended) {
|
||||||
stringSizeFind = Searching::convertExtendedToString(txt2find, pText, stringSizeFind);
|
stringSizeFind = Searching::convertExtendedToString(txt2find, pText, stringSizeFind);
|
||||||
@ -1871,13 +1871,13 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
|
|||||||
generic_string str2Search = getTextFromCombo(hFindCombo);
|
generic_string str2Search = getTextFromCombo(hFindCombo);
|
||||||
stringSizeFind = str2Search.length();
|
stringSizeFind = str2Search.length();
|
||||||
pTextFind = new TCHAR[stringSizeFind + 1];
|
pTextFind = new TCHAR[stringSizeFind + 1];
|
||||||
lstrcpy(pTextFind, str2Search.c_str());
|
wcscpy_s(pTextFind, stringSizeFind + 1, str2Search.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stringSizeFind = lstrlen(findReplaceInfo._txt2find);
|
stringSizeFind = lstrlen(findReplaceInfo._txt2find);
|
||||||
pTextFind = new TCHAR[stringSizeFind + 1];
|
pTextFind = new TCHAR[stringSizeFind + 1];
|
||||||
lstrcpy(pTextFind, findReplaceInfo._txt2find);
|
wcscpy_s(pTextFind, stringSizeFind + 1, findReplaceInfo._txt2find);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pTextFind[0])
|
if (!pTextFind[0])
|
||||||
@ -1895,13 +1895,13 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
|
|||||||
generic_string str2Replace = getTextFromCombo(hReplaceCombo);
|
generic_string str2Replace = getTextFromCombo(hReplaceCombo);
|
||||||
stringSizeReplace = str2Replace.length();
|
stringSizeReplace = str2Replace.length();
|
||||||
pTextReplace = new TCHAR[stringSizeReplace + 1];
|
pTextReplace = new TCHAR[stringSizeReplace + 1];
|
||||||
lstrcpy(pTextReplace, str2Replace.c_str());
|
wcscpy_s(pTextReplace, stringSizeReplace + 1, str2Replace.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stringSizeReplace = lstrlen(findReplaceInfo._txt2replace);
|
stringSizeReplace = lstrlen(findReplaceInfo._txt2replace);
|
||||||
pTextReplace = new TCHAR[stringSizeReplace + 1];
|
pTextReplace = new TCHAR[stringSizeReplace + 1];
|
||||||
lstrcpy(pTextReplace, findReplaceInfo._txt2replace);
|
wcscpy_s(pTextReplace, stringSizeReplace + 1, findReplaceInfo._txt2replace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ bool FunctionCallTip::getCursorFunction()
|
|||||||
delete [] _funcName;
|
delete [] _funcName;
|
||||||
}
|
}
|
||||||
_funcName = new TCHAR[funcToken.length+1];
|
_funcName = new TCHAR[funcToken.length+1];
|
||||||
lstrcpy(_funcName, funcToken.token);
|
wcscpy_s(_funcName, funcToken.length+1, funcToken.token);
|
||||||
res = loadFunction();
|
res = loadFunction();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2120,7 +2120,7 @@ TCHAR * ScintillaEditView::getGenericWordOnCaretPos(TCHAR * txt, int size)
|
|||||||
getWordOnCaretPos(txtA, size);
|
getWordOnCaretPos(txtA, size);
|
||||||
|
|
||||||
const TCHAR * txtW = wmc->char2wchar(txtA, cp);
|
const TCHAR * txtW = wmc->char2wchar(txtA, cp);
|
||||||
lstrcpy(txt, txtW);
|
wcscpy_s(txt, size, txtW);
|
||||||
delete [] txtA;
|
delete [] txtA;
|
||||||
return txt;
|
return txt;
|
||||||
}
|
}
|
||||||
@ -2151,7 +2151,7 @@ TCHAR * ScintillaEditView::getGenericSelectedText(TCHAR * txt, int size, bool ex
|
|||||||
getSelectedText(txtA, size, expand);
|
getSelectedText(txtA, size, expand);
|
||||||
|
|
||||||
const TCHAR * txtW = wmc->char2wchar(txtA, cp);
|
const TCHAR * txtW = wmc->char2wchar(txtA, cp);
|
||||||
lstrcpy(txt, txtW);
|
wcscpy_s(txt, size, txtW);
|
||||||
delete [] txtA;
|
delete [] txtA;
|
||||||
return txt;
|
return txt;
|
||||||
}
|
}
|
||||||
@ -2824,7 +2824,7 @@ TCHAR * int2str(TCHAR *str, int strLen, int number, int base, int nbChiffre, boo
|
|||||||
for ( ; *j != '\0' ; ++j)
|
for ( ; *j != '\0' ; ++j)
|
||||||
if (*j == '1')
|
if (*j == '1')
|
||||||
break;
|
break;
|
||||||
lstrcpy(str, j);
|
wcscpy_s(str, strLen, j);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -524,7 +524,7 @@ void CommentStyleDialog::setKeywords2List(int id)
|
|||||||
convertTo(newList, max_char, buffer, intBuffer);
|
convertTo(newList, max_char, buffer, intBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
lstrcpy(_pUserLang->_keywordLists[index], newList);
|
wcscpy_s(_pUserLang->_keywordLists[index], newList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -836,7 +836,7 @@ void SymbolsStyleDialog::setKeywords2List(int id)
|
|||||||
convertTo(newList, max_char, buffer, intBuffer);
|
convertTo(newList, max_char, buffer, intBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
lstrcpy(_pUserLang->_keywordLists[SCE_USER_KWLIST_DELIMITERS], newList);
|
wcscpy_s(_pUserLang->_keywordLists[SCE_USER_KWLIST_DELIMITERS], newList);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default :
|
default :
|
||||||
|
@ -105,10 +105,11 @@ void TiXmlBase::PutString( const TIXML_STRING& str, TIXML_STRING* outString )
|
|||||||
// <-- Strange class for a bug fix. Search for STL_STRING_BUG
|
// <-- Strange class for a bug fix. Search for STL_STRING_BUG
|
||||||
TiXmlBase::StringToBuffer::StringToBuffer( const TIXML_STRING& str )
|
TiXmlBase::StringToBuffer::StringToBuffer( const TIXML_STRING& str )
|
||||||
{
|
{
|
||||||
buffer = new TCHAR[ str.length()+1 ];
|
const size_t strLen = str.length() + 1;
|
||||||
if ( buffer )
|
buffer = new TCHAR[strLen];
|
||||||
|
if (buffer)
|
||||||
{
|
{
|
||||||
lstrcpy( buffer, str.c_str() );
|
wcscpy_s(buffer, strLen, str.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,7 +643,7 @@ void WordStyleDlg::switchToTheme()
|
|||||||
if (_isThemeDirty)
|
if (_isThemeDirty)
|
||||||
{
|
{
|
||||||
TCHAR themeFileName[MAX_PATH];
|
TCHAR themeFileName[MAX_PATH];
|
||||||
lstrcpy(themeFileName, prevThemeName.c_str());
|
wcscpy_s(themeFileName, prevThemeName.c_str());
|
||||||
PathStripPath(themeFileName);
|
PathStripPath(themeFileName);
|
||||||
PathRemoveExtension(themeFileName);
|
PathRemoveExtension(themeFileName);
|
||||||
int mb_response =
|
int mb_response =
|
||||||
|
@ -910,7 +910,7 @@ void FileBrowser::addRootFolder(generic_string rootFolderPath)
|
|||||||
|
|
||||||
TCHAR *label = ::PathFindFileName(rootFolderPath.c_str());
|
TCHAR *label = ::PathFindFileName(rootFolderPath.c_str());
|
||||||
TCHAR rootLabel[MAX_PATH];
|
TCHAR rootLabel[MAX_PATH];
|
||||||
lstrcpy(rootLabel, label);
|
wcscpy_s(rootLabel, label);
|
||||||
size_t len = lstrlen(rootLabel);
|
size_t len = lstrlen(rootLabel);
|
||||||
if (rootLabel[len - 1] == '\\')
|
if (rootLabel[len - 1] == '\\')
|
||||||
rootLabel[len - 1] = '\0';
|
rootLabel[len - 1] = '\0';
|
||||||
@ -929,7 +929,7 @@ HTREEITEM FileBrowser::createFolderItemsFromDirStruct(HTREEITEM hParentItem, con
|
|||||||
if (directoryStructure._parent == nullptr && hParentItem == nullptr)
|
if (directoryStructure._parent == nullptr && hParentItem == nullptr)
|
||||||
{
|
{
|
||||||
TCHAR rootPath[MAX_PATH];
|
TCHAR rootPath[MAX_PATH];
|
||||||
lstrcpy(rootPath, directoryStructure._rootPath.c_str());
|
wcscpy_s(rootPath, directoryStructure._rootPath.c_str());
|
||||||
size_t len = lstrlen(rootPath);
|
size_t len = lstrlen(rootPath);
|
||||||
if (rootPath[len - 1] == '\\')
|
if (rootPath[len - 1] == '\\')
|
||||||
rootPath[len - 1] = '\0';
|
rootPath[len - 1] = '\0';
|
||||||
|
@ -513,11 +513,11 @@ void FunctionListPanel::notified(LPNMHDR notification)
|
|||||||
|
|
||||||
if (notification->idFrom == IDC_SORTBUTTON_FUNCLIST)
|
if (notification->idFrom == IDC_SORTBUTTON_FUNCLIST)
|
||||||
{
|
{
|
||||||
lstrcpy(lpttt->szText, _sortTipStr.c_str());
|
wcscpy_s(lpttt->szText, _sortTipStr.c_str());
|
||||||
}
|
}
|
||||||
else if (notification->idFrom == IDC_RELOADBUTTON_FUNCLIST)
|
else if (notification->idFrom == IDC_RELOADBUTTON_FUNCLIST)
|
||||||
{
|
{
|
||||||
lstrcpy(lpttt->szText, _reloadTipStr.c_str());
|
wcscpy_s(lpttt->szText, _reloadTipStr.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (notification->hwndFrom == _treeView.getHSelf() || notification->hwndFrom == this->_treeViewSearchResult.getHSelf())
|
else if (notification->hwndFrom == _treeView.getHSelf() || notification->hwndFrom == this->_treeViewSearchResult.getHSelf())
|
||||||
|
@ -146,11 +146,13 @@ int FileDialog::setExtsFilter(const TCHAR *extText, const TCHAR *exts)
|
|||||||
|
|
||||||
// Append new filter
|
// Append new filter
|
||||||
TCHAR *pFileExt = _fileExt + _nbCharFileExt;
|
TCHAR *pFileExt = _fileExt + _nbCharFileExt;
|
||||||
lstrcpy(pFileExt, extFilter.c_str());
|
int curLen = nbCharNewFileExt - _nbCharFileExt;
|
||||||
|
wcscpy_s(pFileExt, curLen, extFilter.c_str());
|
||||||
_nbCharFileExt += static_cast<int32_t>(extFilter.length()) + 1;
|
_nbCharFileExt += static_cast<int32_t>(extFilter.length()) + 1;
|
||||||
|
|
||||||
pFileExt = _fileExt + _nbCharFileExt;
|
pFileExt = _fileExt + _nbCharFileExt;
|
||||||
lstrcpy(pFileExt, exts);
|
curLen -= _nbCharFileExt;
|
||||||
|
wcscpy_s(pFileExt, curLen, exts);
|
||||||
_nbCharFileExt += lstrlen(exts) + 1;
|
_nbCharFileExt += lstrlen(exts) + 1;
|
||||||
|
|
||||||
// Set file dialog pointer
|
// Set file dialog pointer
|
||||||
@ -240,7 +242,7 @@ stringVector * FileDialog::doOpenMultiFilesDlg()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lstrcpy(fn, _fileName);
|
wcscpy_s(fn, _fileName);
|
||||||
if (fn[lstrlen(fn) - 1] != '\\')
|
if (fn[lstrlen(fn) - 1] != '\\')
|
||||||
lstrcat(fn, TEXT("\\"));
|
lstrcat(fn, TEXT("\\"));
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
void setExtFilter(const TCHAR *, const TCHAR *, ...);
|
void setExtFilter(const TCHAR *, const TCHAR *, ...);
|
||||||
|
|
||||||
int setExtsFilter(const TCHAR *extText, const TCHAR *exts);
|
int setExtsFilter(const TCHAR *extText, const TCHAR *exts);
|
||||||
void setDefFileName(const TCHAR *fn){lstrcpy(_fileName, fn);}
|
void setDefFileName(const TCHAR *fn){ wcscpy_s(_fileName, fn);}
|
||||||
|
|
||||||
TCHAR * doSaveDlg();
|
TCHAR * doSaveDlg();
|
||||||
stringVector * doOpenMultiFilesDlg();
|
stringVector * doOpenMultiFilesDlg();
|
||||||
|
@ -809,7 +809,7 @@ bool PluginsAdminDlg::loadFromPluginInfos()
|
|||||||
|
|
||||||
// user file name (without ext. to find whole info in available list
|
// user file name (without ext. to find whole info in available list
|
||||||
TCHAR fnNoExt[MAX_PATH];
|
TCHAR fnNoExt[MAX_PATH];
|
||||||
lstrcpy(fnNoExt, i._fileName.c_str());
|
wcscpy_s(fnNoExt, i._fileName.c_str());
|
||||||
::PathRemoveExtension(fnNoExt);
|
::PathRemoveExtension(fnNoExt);
|
||||||
|
|
||||||
int listIndex;
|
int listIndex;
|
||||||
|
@ -1367,7 +1367,7 @@ INT_PTR CALLBACK DefaultDirectoryDlg::run_dlgProc(UINT message, WPARAM wParam, L
|
|||||||
{
|
{
|
||||||
TCHAR inputDir[MAX_PATH];
|
TCHAR inputDir[MAX_PATH];
|
||||||
::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir));
|
::SendDlgItemMessage(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(inputDir));
|
||||||
lstrcpy(nppGUI._defaultDir, inputDir);
|
wcscpy_s(nppGUI._defaultDir, inputDir);
|
||||||
::ExpandEnvironmentStrings(nppGUI._defaultDir, nppGUI._defaultDirExp, _countof(nppGUI._defaultDirExp));
|
::ExpandEnvironmentStrings(nppGUI._defaultDir, nppGUI._defaultDirExp, _countof(nppGUI._defaultDirExp));
|
||||||
pNppParam->setWorkingDir(nppGUI._defaultDirExp);
|
pNppParam->setWorkingDir(nppGUI._defaultDirExp);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -474,7 +474,7 @@ void ProjectPanel::buildProjectXml(TiXmlNode *node, HTREEITEM hItem, const TCHAR
|
|||||||
generic_string ProjectPanel::getRelativePath(const generic_string & filePath, const TCHAR *workSpaceFileName)
|
generic_string ProjectPanel::getRelativePath(const generic_string & filePath, const TCHAR *workSpaceFileName)
|
||||||
{
|
{
|
||||||
TCHAR wsfn[MAX_PATH];
|
TCHAR wsfn[MAX_PATH];
|
||||||
lstrcpy(wsfn, workSpaceFileName);
|
wcscpy_s(wsfn, workSpaceFileName);
|
||||||
::PathRemoveFileSpec(wsfn);
|
::PathRemoveFileSpec(wsfn);
|
||||||
|
|
||||||
size_t pos_found = filePath.find(wsfn);
|
size_t pos_found = filePath.find(wsfn);
|
||||||
@ -521,7 +521,7 @@ generic_string ProjectPanel::getAbsoluteFilePath(const TCHAR * relativePath)
|
|||||||
return relativePath;
|
return relativePath;
|
||||||
|
|
||||||
TCHAR absolutePath[MAX_PATH];
|
TCHAR absolutePath[MAX_PATH];
|
||||||
lstrcpy(absolutePath, _workSpaceFilePath.c_str());
|
wcscpy_s(absolutePath, _workSpaceFilePath.c_str());
|
||||||
::PathRemoveFileSpec(absolutePath);
|
::PathRemoveFileSpec(absolutePath);
|
||||||
::PathAppend(absolutePath, relativePath);
|
::PathAppend(absolutePath, relativePath);
|
||||||
return absolutePath;
|
return absolutePath;
|
||||||
@ -1092,7 +1092,7 @@ void ProjectPanel::popupMenuCmd(int cmdID)
|
|||||||
|
|
||||||
*fn = newValue;
|
*fn = newValue;
|
||||||
TCHAR *strValueLabel = ::PathFindFileName(fn->c_str());
|
TCHAR *strValueLabel = ::PathFindFileName(fn->c_str());
|
||||||
lstrcpy(textBuffer, strValueLabel);
|
wcscpy_s(textBuffer, strValueLabel);
|
||||||
int iImage = ::PathFileExists(fn->c_str())?INDEX_LEAF:INDEX_LEAF_INVALID;
|
int iImage = ::PathFileExists(fn->c_str())?INDEX_LEAF:INDEX_LEAF_INVALID;
|
||||||
tvItem.iImage = tvItem.iSelectedImage = iImage;
|
tvItem.iImage = tvItem.iSelectedImage = iImage;
|
||||||
SendMessage(_treeView.getHSelf(), TVM_SETITEM, 0, reinterpret_cast<LPARAM>(&tvItem));
|
SendMessage(_treeView.getHSelf(), TVM_SETITEM, 0, reinterpret_cast<LPARAM>(&tvItem));
|
||||||
@ -1215,7 +1215,7 @@ void ProjectPanel::addFilesFromDirectory(HTREEITEM hTreeItem)
|
|||||||
if (_selDirOfFilesFromDirDlg == TEXT("") && _workSpaceFilePath != TEXT(""))
|
if (_selDirOfFilesFromDirDlg == TEXT("") && _workSpaceFilePath != TEXT(""))
|
||||||
{
|
{
|
||||||
TCHAR dir[MAX_PATH];
|
TCHAR dir[MAX_PATH];
|
||||||
lstrcpy(dir, _workSpaceFilePath.c_str());
|
wcscpy_s(dir, _workSpaceFilePath.c_str());
|
||||||
::PathRemoveFileSpec(dir);
|
::PathRemoveFileSpec(dir);
|
||||||
_selDirOfFilesFromDirDlg = dir;
|
_selDirOfFilesFromDirDlg = dir;
|
||||||
}
|
}
|
||||||
|
@ -181,13 +181,13 @@ HINSTANCE Command::run(HWND hWnd)
|
|||||||
extractArgs(cmdPure, args, _cmdLine.c_str());
|
extractArgs(cmdPure, args, _cmdLine.c_str());
|
||||||
int nbTchar = ::ExpandEnvironmentStrings(cmdPure, cmdIntermediate, MAX_PATH);
|
int nbTchar = ::ExpandEnvironmentStrings(cmdPure, cmdIntermediate, MAX_PATH);
|
||||||
if (!nbTchar)
|
if (!nbTchar)
|
||||||
lstrcpy(cmdIntermediate, cmdPure);
|
wcscpy_s(cmdIntermediate, cmdPure);
|
||||||
else if (nbTchar >= MAX_PATH)
|
else if (nbTchar >= MAX_PATH)
|
||||||
cmdIntermediate[MAX_PATH-1] = '\0';
|
cmdIntermediate[MAX_PATH-1] = '\0';
|
||||||
|
|
||||||
nbTchar = ::ExpandEnvironmentStrings(args, argsIntermediate, argsIntermediateLen);
|
nbTchar = ::ExpandEnvironmentStrings(args, argsIntermediate, argsIntermediateLen);
|
||||||
if (!nbTchar)
|
if (!nbTchar)
|
||||||
lstrcpy(argsIntermediate, args);
|
wcscpy_s(argsIntermediate, args);
|
||||||
else if (nbTchar >= argsIntermediateLen)
|
else if (nbTchar >= argsIntermediateLen)
|
||||||
argsIntermediate[argsIntermediateLen-1] = '\0';
|
argsIntermediate[argsIntermediateLen-1] = '\0';
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ trayIconControler::trayIconControler(HWND hwnd, UINT uID, UINT uCBMsg, HICON hic
|
|||||||
_nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
|
_nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
|
||||||
_nid.uCallbackMessage = uCBMsg;
|
_nid.uCallbackMessage = uCBMsg;
|
||||||
_nid.hIcon = hicon;
|
_nid.hIcon = hicon;
|
||||||
lstrcpy(_nid.szTip, tip);
|
wcscpy_s(_nid.szTip, tip);
|
||||||
|
|
||||||
::RegisterWindowMessage(TEXT("TaskbarCreated"));
|
::RegisterWindowMessage(TEXT("TaskbarCreated"));
|
||||||
_isIconShowed = false;
|
_isIconShowed = false;
|
||||||
|
@ -153,7 +153,7 @@ void VerticalFileSwitcherListView::initList()
|
|||||||
TaskLstFnStatus *tl = new TaskLstFnStatus(fileNameStatus._iView, fileNameStatus._docIndex, fileNameStatus._fn, fileNameStatus._status, (void *)fileNameStatus._bufID);
|
TaskLstFnStatus *tl = new TaskLstFnStatus(fileNameStatus._iView, fileNameStatus._docIndex, fileNameStatus._fn, fileNameStatus._status, (void *)fileNameStatus._bufID);
|
||||||
|
|
||||||
TCHAR fn[MAX_PATH];
|
TCHAR fn[MAX_PATH];
|
||||||
lstrcpy(fn, ::PathFindFileName(fileNameStatus._fn.c_str()));
|
wcscpy_s(fn, ::PathFindFileName(fileNameStatus._fn.c_str()));
|
||||||
|
|
||||||
if (isExtColumn)
|
if (isExtColumn)
|
||||||
{
|
{
|
||||||
@ -213,7 +213,7 @@ void VerticalFileSwitcherListView::setItemIconStatus(BufferID bufferID)
|
|||||||
Buffer *buf = static_cast<Buffer *>(bufferID);
|
Buffer *buf = static_cast<Buffer *>(bufferID);
|
||||||
|
|
||||||
TCHAR fn[MAX_PATH];
|
TCHAR fn[MAX_PATH];
|
||||||
lstrcpy(fn, ::PathFindFileName(buf->getFileName()));
|
wcscpy_s(fn, ::PathFindFileName(buf->getFileName()));
|
||||||
bool isExtColumn = !(NppParameters::getInstance())->getNppGUI()._fileSwitcherWithoutExtColumn;
|
bool isExtColumn = !(NppParameters::getInstance())->getNppGUI()._fileSwitcherWithoutExtColumn;
|
||||||
if (isExtColumn)
|
if (isExtColumn)
|
||||||
{
|
{
|
||||||
@ -290,7 +290,7 @@ int VerticalFileSwitcherListView::add(BufferID bufferID, int iView)
|
|||||||
TaskLstFnStatus *tl = new TaskLstFnStatus(iView, 0, buf->getFullPathName(), 0, (void *)bufferID);
|
TaskLstFnStatus *tl = new TaskLstFnStatus(iView, 0, buf->getFullPathName(), 0, (void *)bufferID);
|
||||||
|
|
||||||
TCHAR fn[MAX_PATH];
|
TCHAR fn[MAX_PATH];
|
||||||
lstrcpy(fn, ::PathFindFileName(fileName));
|
wcscpy_s(fn, ::PathFindFileName(fileName));
|
||||||
bool isExtColumn = !(NppParameters::getInstance())->getNppGUI()._fileSwitcherWithoutExtColumn;
|
bool isExtColumn = !(NppParameters::getInstance())->getNppGUI()._fileSwitcherWithoutExtColumn;
|
||||||
if (isExtColumn)
|
if (isExtColumn)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user