Code enhancement: remove some MSVS analysis warning (Part 2)

This commit is contained in:
Don Ho 2023-03-07 05:03:16 +01:00
parent 61d96cd971
commit f85435d962
5 changed files with 8 additions and 5 deletions

View File

@ -4497,7 +4497,7 @@ void Notepad_plus::docOpenInNewInstance(FileTransferMode mode, int x, int y)
if (x) if (x)
{ {
TCHAR pX[10]; TCHAR pX[10]{};
_itow(x, pX, 10); _itow(x, pX, 10);
command += TEXT(" -x"); command += TEXT(" -x");
command += pX; command += pX;
@ -4505,7 +4505,7 @@ void Notepad_plus::docOpenInNewInstance(FileTransferMode mode, int x, int y)
if (y) if (y)
{ {
TCHAR pY[10]; TCHAR pY[10]{};
_itow(y, pY, 10); _itow(y, pY, 10);
command += TEXT(" -y"); command += TEXT(" -y");
command += pY; command += pY;

View File

@ -672,6 +672,9 @@ void FileManager::closeBuffer(BufferID id, ScintillaEditView * identifier)
// backupFileName is sentinel of backup mode: if it's not NULL, then we use it (load it). Otherwise we use filename // backupFileName is sentinel of backup mode: if it's not NULL, then we use it (load it). Otherwise we use filename
BufferID FileManager::loadFile(const TCHAR* filename, Document doc, int encoding, const TCHAR* backupFileName, FILETIME fileNameTimestamp) BufferID FileManager::loadFile(const TCHAR* filename, Document doc, int encoding, const TCHAR* backupFileName, FILETIME fileNameTimestamp)
{ {
if (!filename)
return BUFFER_INVALID;
//Get file size //Get file size
int64_t fileSize = -1; int64_t fileSize = -1;
const TCHAR* pPath = filename; const TCHAR* pPath = filename;

View File

@ -154,7 +154,7 @@ private:
enum CurrentPosInLineStatus { pos_infront, pos_between, pos_inside, pos_behind }; enum CurrentPosInLineStatus { pos_infront, pos_between, pos_inside, pos_behind };
struct CurrentPosInLineInfo { struct CurrentPosInLineInfo {
CurrentPosInLineStatus _status; CurrentPosInLineStatus _status = pos_infront;
intptr_t auxiliaryInfo = -1; // according the status intptr_t auxiliaryInfo = -1; // according the status
}; };

View File

@ -177,7 +177,7 @@ void AnsiCharPanel::insertChar(unsigned char char2insert) const
void AnsiCharPanel::insertString(LPWSTR string2insert) const void AnsiCharPanel::insertString(LPWSTR string2insert) const
{ {
char multiByteStr[10]; char multiByteStr[10]{};
int codepage = (*_ppEditView)->getCurrentBuffer()->getEncoding(); int codepage = (*_ppEditView)->getCurrentBuffer()->getEncoding();
if (codepage == -1) if (codepage == -1)
{ {

View File

@ -57,7 +57,7 @@ ClipboardData ClipboardHistoryPanel::getClipboadData()
} }
} }
} }
else else if (lpWchar != nullptr)
{ {
int nbBytes = (lstrlenW(lpWchar) + 1) * sizeof(wchar_t); int nbBytes = (lstrlenW(lpWchar) + 1) * sizeof(wchar_t);
for (int i = 0 ; i < nbBytes ; ++i) for (int i = 0 ; i < nbBytes ; ++i)