Code enhancement: Fix comparison of different signs integers
This commit is contained in:
parent
785453147b
commit
94154b0f0e
|
@ -258,7 +258,7 @@ intptr_t CALLBACK RegExtDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPa
|
|||
{
|
||||
const size_t itemNameLen = 32;
|
||||
TCHAR itemName[itemNameLen + 1] = { '\0' };
|
||||
auto lbTextLen = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), LB_GETTEXTLEN, i, 0);
|
||||
size_t lbTextLen = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), LB_GETTEXTLEN, i, 0);
|
||||
if (lbTextLen > itemNameLen)
|
||||
return TRUE;
|
||||
|
||||
|
|
|
@ -3601,7 +3601,7 @@ size_t Notepad_plus::getSelectedCharNumber(UniMode u)
|
|||
for (size_t j = line1; j <= line2; ++j)
|
||||
{
|
||||
size_t stpos = _pEditView->execute(SCI_GETLINESELSTARTPOSITION, j);
|
||||
if (stpos != INVALID_POSITION)
|
||||
if (static_cast<intptr_t>(stpos) != INVALID_POSITION)
|
||||
{
|
||||
size_t endpos = _pEditView->execute(SCI_GETLINESELENDPOSITION, j);
|
||||
for (size_t pos = stpos; pos < endpos; ++pos)
|
||||
|
@ -5803,30 +5803,30 @@ bool Notepad_plus::dumpFiles(const TCHAR * outdir, const TCHAR * fileprefix)
|
|||
void Notepad_plus::drawTabbarColoursFromStylerArray()
|
||||
{
|
||||
Style *stActText = getStyleFromName(TABBAR_ACTIVETEXT);
|
||||
if (stActText && stActText->_fgColor != -1)
|
||||
if (stActText && static_cast<long>(stActText->_fgColor) != -1)
|
||||
TabBarPlus::setColour(stActText->_fgColor, TabBarPlus::activeText);
|
||||
|
||||
Style *stActfocusTop = getStyleFromName(TABBAR_ACTIVEFOCUSEDINDCATOR);
|
||||
if (stActfocusTop && stActfocusTop->_fgColor != -1)
|
||||
if (stActfocusTop && static_cast<long>(stActfocusTop->_fgColor) != -1)
|
||||
TabBarPlus::setColour(stActfocusTop->_fgColor, TabBarPlus::activeFocusedTop);
|
||||
|
||||
Style *stActunfocusTop = getStyleFromName(TABBAR_ACTIVEUNFOCUSEDINDCATOR);
|
||||
if (stActunfocusTop && stActunfocusTop->_fgColor != -1)
|
||||
if (stActunfocusTop && static_cast<long>(stActunfocusTop->_fgColor) != -1)
|
||||
TabBarPlus::setColour(stActunfocusTop->_fgColor, TabBarPlus::activeUnfocusedTop);
|
||||
|
||||
Style *stInact = getStyleFromName(TABBAR_INACTIVETEXT);
|
||||
if (stInact && stInact->_fgColor != -1)
|
||||
if (stInact && static_cast<long>(stInact->_fgColor) != -1)
|
||||
TabBarPlus::setColour(stInact->_fgColor, TabBarPlus::inactiveText);
|
||||
if (stInact && stInact->_bgColor != -1)
|
||||
if (stInact && static_cast<long>(stInact->_bgColor) != -1)
|
||||
TabBarPlus::setColour(stInact->_bgColor, TabBarPlus::inactiveBg);
|
||||
}
|
||||
|
||||
void Notepad_plus::drawDocumentMapColoursFromStylerArray()
|
||||
{
|
||||
Style* docMap = getStyleFromName(VIEWZONE_DOCUMENTMAP);
|
||||
if (docMap && docMap->_fgColor != -1)
|
||||
if (docMap && static_cast<long>(docMap->_fgColor) != -1)
|
||||
ViewZoneDlg::setColour(docMap->_fgColor, ViewZoneDlg::ViewZoneColorIndex::focus);
|
||||
if (docMap && docMap->_bgColor != -1)
|
||||
if (docMap && static_cast<long>(docMap->_bgColor) != -1)
|
||||
ViewZoneDlg::setColour(docMap->_bgColor, ViewZoneDlg::ViewZoneColorIndex::frost);
|
||||
}
|
||||
|
||||
|
|
|
@ -630,7 +630,7 @@ int base64ToAscii(char *dest, const char *base64Str)
|
|||
uc2 = (UCHAR)base64IndexArray[base64Str[j+2]];
|
||||
uc3 = (UCHAR)base64IndexArray[base64Str[j+3]];
|
||||
|
||||
if ((uc0 == -1) || (uc1 == -1) || (uc2 == -1) || (uc3 == -1))
|
||||
if ((static_cast<char>(uc0) == -1) || (static_cast<char>(uc1) == -1) || (static_cast<char>(uc2) == -1) || (static_cast<char>(uc3) == -1))
|
||||
return -1;
|
||||
|
||||
if (base64Str[j+2] == '=') // && (uc3 == '=')
|
||||
|
|
|
@ -499,7 +499,7 @@ bool Finder::notify(SCNotification *notification)
|
|||
::SendMessage(_scintView.getHSelf(), WM_LBUTTONUP, 0, 0);
|
||||
|
||||
size_t pos = notification->position;
|
||||
if (pos == INVALID_POSITION)
|
||||
if (static_cast<intptr_t>(pos) == INVALID_POSITION)
|
||||
pos = _scintView.execute(SCI_GETLINEENDPOSITION, notification->line);
|
||||
_scintView.execute(SCI_SETSEL, pos, pos);
|
||||
|
||||
|
@ -3494,7 +3494,7 @@ void FindReplaceDlg::enableProjectCheckmarks()
|
|||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
UINT s = GetMenuState (hMenu, idm [i], MF_BYCOMMAND);
|
||||
if (s != -1)
|
||||
if (static_cast<int>(s) != -1)
|
||||
{
|
||||
if (s & MF_CHECKED)
|
||||
{
|
||||
|
|
|
@ -418,7 +418,7 @@ LRESULT ScintillaEditView::scintillaNew_Proc(HWND hwnd, UINT Message, WPARAM wPa
|
|||
if (selectSize == 0)
|
||||
return 0;
|
||||
|
||||
if (selectSize + 1 > sizeof(smallTextBuffer))
|
||||
if (static_cast<size_t>(selectSize + 1) > sizeof(smallTextBuffer))
|
||||
selectedStr = new char[selectSize + 1];
|
||||
getText(selectedStr, range.cpMin, range.cpMax);
|
||||
|
||||
|
@ -1940,14 +1940,14 @@ void ScintillaEditView::getCurrentFoldStates(std::vector<size_t> & lineStateVect
|
|||
|
||||
do {
|
||||
contractedFoldHeaderLine = execute(SCI_CONTRACTEDFOLDNEXT, contractedFoldHeaderLine);
|
||||
if (contractedFoldHeaderLine != -1)
|
||||
if (static_cast<intptr_t>(contractedFoldHeaderLine) != -1)
|
||||
{
|
||||
//-- Store contracted line
|
||||
lineStateVector.push_back(contractedFoldHeaderLine);
|
||||
//-- Start next search with next line
|
||||
++contractedFoldHeaderLine;
|
||||
}
|
||||
} while (contractedFoldHeaderLine != -1);
|
||||
} while (static_cast<intptr_t>(contractedFoldHeaderLine) != -1);
|
||||
}
|
||||
|
||||
void ScintillaEditView::syncFoldStateWith(const std::vector<size_t> & lineStateVectorNew)
|
||||
|
|
|
@ -37,7 +37,7 @@ GlobalMappers & globalMappper()
|
|||
return gm;
|
||||
}
|
||||
|
||||
void convertTo(TCHAR *dest, int destLen, const TCHAR *toConvert, TCHAR *prefix)
|
||||
void convertTo(TCHAR *dest, int destLen, const TCHAR *toConvert, const TCHAR *prefix)
|
||||
{
|
||||
bool inGroup = false;
|
||||
int index = lstrlen(dest);
|
||||
|
@ -526,7 +526,6 @@ void CommentStyleDialog::setKeywords2List(int id)
|
|||
newList[0] = '\0';
|
||||
TCHAR* buffer = new TCHAR[max_char];
|
||||
buffer[0] = '\0';
|
||||
TCHAR intBuffer[10] = {'0', 0};
|
||||
|
||||
const int list[] = {
|
||||
IDC_COMMENTLINE_OPEN_EDIT,
|
||||
|
@ -536,11 +535,11 @@ void CommentStyleDialog::setKeywords2List(int id)
|
|||
IDC_COMMENT_CLOSE_EDIT
|
||||
};
|
||||
|
||||
for (auto i = 0; i < sizeof(list)/sizeof(int); ++i)
|
||||
for (size_t i = 0; i < sizeof(list)/sizeof(int); ++i)
|
||||
{
|
||||
generic_itoa(i, intBuffer+1, 10);
|
||||
wstring intStr = std::to_wstring(i);
|
||||
::GetDlgItemText(_hSelf, list[i], buffer, max_char);
|
||||
convertTo(newList, max_char, buffer, intBuffer);
|
||||
convertTo(newList, max_char, buffer, intStr.c_str());
|
||||
}
|
||||
|
||||
wcscpy_s(_pUserLang->_keywordLists[index], newList);
|
||||
|
@ -549,7 +548,7 @@ void CommentStyleDialog::setKeywords2List(int id)
|
|||
}
|
||||
}
|
||||
|
||||
void CommentStyleDialog::retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *prefix) const
|
||||
void CommentStyleDialog::retrieve(TCHAR *dest, const TCHAR *toRetrieve, const TCHAR *prefix) const
|
||||
{
|
||||
int j = 0;
|
||||
bool begin2Copy = false;
|
||||
|
@ -589,7 +588,6 @@ void CommentStyleDialog::updateDlg()
|
|||
{
|
||||
TCHAR* buffer = new TCHAR[max_char];
|
||||
buffer[0] = '\0';
|
||||
TCHAR intBuffer[10] = {'0', 0};
|
||||
|
||||
const int list[] = {
|
||||
IDC_COMMENTLINE_OPEN_EDIT,
|
||||
|
@ -599,10 +597,10 @@ void CommentStyleDialog::updateDlg()
|
|||
IDC_COMMENT_CLOSE_EDIT
|
||||
};
|
||||
|
||||
for (int i=0; i<sizeof(list)/sizeof(int); ++i)
|
||||
for (size_t i=0; i<sizeof(list)/sizeof(int); ++i)
|
||||
{
|
||||
generic_itoa(i, intBuffer+1, 10);
|
||||
retrieve(buffer, _pUserLang->_keywordLists[SCE_USER_KWLIST_COMMENTS], intBuffer);
|
||||
wstring intStr = std::to_wstring(i);
|
||||
retrieve(buffer, _pUserLang->_keywordLists[SCE_USER_KWLIST_COMMENTS], intStr.c_str());
|
||||
::SendDlgItemMessage(_hSelf, list[i], WM_SETTEXT, 0, reinterpret_cast<LPARAM>(buffer));
|
||||
}
|
||||
|
||||
|
@ -659,7 +657,7 @@ void SymbolsStyleDialog::updateDlg()
|
|||
};
|
||||
TCHAR intBuffer[10] = {'0', 0};
|
||||
|
||||
for (int i = 0; i < sizeof(list)/sizeof(int); ++i)
|
||||
for (int i = 0; static_cast<size_t>(i) < sizeof(list)/sizeof(int); ++i)
|
||||
{
|
||||
if (i < 10)
|
||||
generic_itoa(i, intBuffer + 1, 10);
|
||||
|
@ -853,7 +851,7 @@ void SymbolsStyleDialog::setKeywords2List(int id)
|
|||
IDC_DELIMITER8_BOUNDARYCLOSE_EDIT
|
||||
};
|
||||
|
||||
for (int i = 0; i < sizeof(list)/sizeof(int); ++i)
|
||||
for (int i = 0; static_cast<size_t>(i) < sizeof(list)/sizeof(int); ++i)
|
||||
{
|
||||
if (i < 10)
|
||||
generic_itoa(i, intBuffer+1, 10);
|
||||
|
@ -1223,7 +1221,7 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
|
|||
const size_t langNameLen = 256;
|
||||
TCHAR langName[langNameLen + 1];
|
||||
auto cbTextLen = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXTLEN, i, 0);
|
||||
if (cbTextLen > langNameLen)
|
||||
if (static_cast<size_t>(cbTextLen) > langNameLen)
|
||||
return TRUE;
|
||||
|
||||
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXT, i, reinterpret_cast<LPARAM>(langName));
|
||||
|
@ -1252,7 +1250,7 @@ intptr_t CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPA
|
|||
const size_t langNameLen = 256;
|
||||
TCHAR langName[langNameLen + 1];
|
||||
auto cbTextLen = ::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXTLEN, i, 0);
|
||||
if (cbTextLen > langNameLen)
|
||||
if (static_cast<size_t>(cbTextLen) > langNameLen)
|
||||
return TRUE;
|
||||
|
||||
::SendDlgItemMessage(_hSelf, IDC_LANGNAME_COMBO, CB_GETLBTEXT, i, reinterpret_cast<LPARAM>(langName));
|
||||
|
@ -1755,7 +1753,7 @@ intptr_t CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPA
|
|||
|
||||
// for the font size combo
|
||||
HWND hFontSizeCombo = ::GetDlgItem(hwnd, IDC_STYLER_COMBO_FONT_SIZE);
|
||||
for (int j = 0 ; j < int(sizeof(fontSizeStrs))/(3*sizeof(TCHAR)) ; ++j)
|
||||
for (size_t j = 0 ; j < int(sizeof(fontSizeStrs))/(3*sizeof(TCHAR)) ; ++j)
|
||||
::SendMessage(hFontSizeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontSizeStrs[j]));
|
||||
|
||||
TCHAR size[10];
|
||||
|
@ -1879,7 +1877,7 @@ intptr_t CALLBACK StylerDlg::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPA
|
|||
const size_t intStrLen = 3;
|
||||
TCHAR intStr[intStrLen];
|
||||
auto lbTextLen = ::SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETLBTEXTLEN, i, 0);
|
||||
if (lbTextLen > intStrLen - 1)
|
||||
if (static_cast<size_t>(lbTextLen) > intStrLen - 1)
|
||||
return TRUE;
|
||||
|
||||
::SendDlgItemMessage(hwnd, LOWORD(wParam), CB_GETLBTEXT, i, reinterpret_cast<LPARAM>(intStr));
|
||||
|
|
|
@ -284,7 +284,7 @@ protected :
|
|||
intptr_t CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
|
||||
void setKeywords2List(int id);
|
||||
private :
|
||||
void retrieve(TCHAR *dest, const TCHAR *toRetrieve, TCHAR *prefix) const;
|
||||
void retrieve(TCHAR *dest, const TCHAR *toRetrieve, const TCHAR *prefix) const;
|
||||
};
|
||||
|
||||
class SymbolsStyleDialog : public SharedParametersDialog
|
||||
|
|
|
@ -120,7 +120,7 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
|
|||
}
|
||||
::SendMessage(_hSwitch2ThemeCombo, CB_SETCURSEL, _currentThemeIndex, 0);
|
||||
|
||||
for (int i = 0 ; i < sizeof(fontSizeStrs)/(3*sizeof(TCHAR)) ; ++i)
|
||||
for (size_t i = 0 ; i < sizeof(fontSizeStrs)/(3*sizeof(TCHAR)) ; ++i)
|
||||
::SendMessage(_hFontSizeCombo, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(fontSizeStrs[i]));
|
||||
|
||||
const std::vector<generic_string> & fontlist = (NppParameters::getInstance()).getFontList();
|
||||
|
@ -572,7 +572,7 @@ int WordStyleDlg::whichTabColourIndex()
|
|||
const size_t styleNameLen = 128;
|
||||
TCHAR styleName[styleNameLen + 1] = { '\0' };
|
||||
auto lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXTLEN, i, 0);
|
||||
if (lbTextLen > styleNameLen)
|
||||
if (static_cast<size_t>(lbTextLen) > styleNameLen)
|
||||
return -1;
|
||||
|
||||
::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, reinterpret_cast<LPARAM>(styleName));
|
||||
|
@ -601,7 +601,7 @@ bool WordStyleDlg::isDocumentMapStyle()
|
|||
constexpr size_t styleNameLen = 128;
|
||||
TCHAR styleName[styleNameLen + 1] = { '\0' };
|
||||
const auto lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXTLEN, i, 0);
|
||||
if (lbTextLen > styleNameLen)
|
||||
if (static_cast<size_t>(lbTextLen) > styleNameLen)
|
||||
return false;
|
||||
|
||||
::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, reinterpret_cast<LPARAM>(styleName));
|
||||
|
@ -641,7 +641,7 @@ void WordStyleDlg::updateFontSize()
|
|||
TCHAR intStr[intStrLen];
|
||||
|
||||
auto lbTextLen = ::SendMessage(_hFontSizeCombo, CB_GETLBTEXTLEN, iFontSizeSel, 0);
|
||||
if (lbTextLen >= intStrLen)
|
||||
if (static_cast<size_t>(lbTextLen) >= intStrLen)
|
||||
return;
|
||||
|
||||
::SendMessage(_hFontSizeCombo, CB_GETLBTEXT, iFontSizeSel, reinterpret_cast<LPARAM>(intStr));
|
||||
|
@ -844,7 +844,7 @@ void WordStyleDlg::setVisualFromStyleList()
|
|||
if (i == LB_ERR)
|
||||
return;
|
||||
auto lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_GETTEXTLEN, i, 0);
|
||||
if (lbTextLen > strLen)
|
||||
if (static_cast<size_t>(lbTextLen) > strLen)
|
||||
return;
|
||||
|
||||
::SendDlgItemMessage(_hSelf, IDC_LANGUAGES_LIST, LB_GETTEXT, i, reinterpret_cast<LPARAM>(str));
|
||||
|
@ -855,7 +855,7 @@ void WordStyleDlg::setVisualFromStyleList()
|
|||
const size_t styleNameLen = 64;
|
||||
TCHAR styleName[styleNameLen + 1] = { '\0' };
|
||||
lbTextLen = ::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXTLEN, i, 0);
|
||||
if (lbTextLen > styleNameLen)
|
||||
if (static_cast<size_t>(lbTextLen) > styleNameLen)
|
||||
return;
|
||||
::SendDlgItemMessage(_hSelf, IDC_STYLES_LIST, LB_GETTEXT, i, reinterpret_cast<LPARAM>(styleName));
|
||||
wcscat_s(str, TEXT(" : "));
|
||||
|
|
|
@ -104,7 +104,7 @@ void ContextMenu::create(HWND hParent, const std::vector<MenuItemUnit> & menuIte
|
|||
if (mainMenuHandle)
|
||||
{
|
||||
UINT s = ::GetMenuState(mainMenuHandle, item._cmdID, MF_BYCOMMAND);
|
||||
if (s != -1)
|
||||
if (static_cast<int>(s) != -1)
|
||||
{
|
||||
bool isEnabled = (s & (MF_DISABLED | MF_GRAYED)) == 0;
|
||||
bool isChecked = (s & (MF_CHECKED)) != 0;
|
||||
|
|
|
@ -1559,7 +1559,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
//it was found, get the text, modify text delete it from list, add modified to list
|
||||
auto lbTextLen = ::SendMessage(BGHS[SelfIndex].hlist1, LB_GETTEXTLEN, FindResult, 0);
|
||||
if (lbTextLen > bufferLen)
|
||||
if (static_cast<size_t>(lbTextLen) > bufferLen)
|
||||
return TRUE;
|
||||
|
||||
SendMessage(BGHS[SelfIndex].hlist1, LB_GETTEXT, FindResult, reinterpret_cast<LPARAM>(buffer));
|
||||
|
@ -1687,7 +1687,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
if(j>0)
|
||||
{
|
||||
auto lbTextLen = ::SendMessage(BGHS[SelfIndex].hlist1, LB_GETTEXTLEN, j-1, 0);
|
||||
if (lbTextLen > bufferLen)
|
||||
if (static_cast<size_t>(lbTextLen) > bufferLen)
|
||||
return TRUE;
|
||||
SendMessage(BGHS[SelfIndex].hlist1, LB_GETTEXT, j - 1, reinterpret_cast<LPARAM>(buffer));
|
||||
buffer[5]=0x00;
|
||||
|
@ -1790,7 +1790,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
//it was found, get it
|
||||
auto lbTextLen = ::SendMessage(BGHS[SelfIndex].hlist1, LB_GETTEXTLEN, FindResult, 0);
|
||||
if (lbTextLen > bufferLen)
|
||||
if (static_cast<size_t>(lbTextLen) > bufferLen)
|
||||
return TRUE;
|
||||
SendMessage(BGHS[SelfIndex].hlist1, LB_GETTEXT, FindResult, reinterpret_cast<LPARAM>(buffer));
|
||||
switch (buffer[10]) // no need to call BGM_GETPROTECTION separately for this
|
||||
|
@ -1949,7 +1949,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
//it was found, get it
|
||||
auto lbTextLen = ::SendMessage(BGHS[SelfIndex].hlist1, LB_GETTEXTLEN, FindResult, 0);
|
||||
if (lbTextLen > bufferLen)
|
||||
if (static_cast<size_t>(lbTextLen) > bufferLen)
|
||||
return TRUE;
|
||||
SendMessage(BGHS[SelfIndex].hlist1, LB_GETTEXT, FindResult, reinterpret_cast<LPARAM>(buffer));
|
||||
switch (buffer[11])
|
||||
|
@ -1981,7 +1981,7 @@ LRESULT CALLBACK GridProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
//it was found, get it
|
||||
auto lbTextLen = ::SendMessage(BGHS[SelfIndex].hlist1, LB_GETTEXTLEN, FindResult, 0);
|
||||
if (lbTextLen > bufferLen)
|
||||
if (static_cast<size_t>(lbTextLen) > bufferLen)
|
||||
return TRUE;
|
||||
SendMessage(BGHS[SelfIndex].hlist1, LB_GETTEXT, FindResult, reinterpret_cast<LPARAM>(buffer));
|
||||
switch (buffer[10])
|
||||
|
@ -3197,7 +3197,7 @@ int BinarySearchListBox(HWND lbhWnd,TCHAR* searchtext)
|
|||
|
||||
//is it the head?
|
||||
auto lbTextLen = ::SendMessage(lbhWnd, LB_GETTEXTLEN, head, 0);
|
||||
if (lbTextLen > bufLen)
|
||||
if (static_cast<size_t>(lbTextLen) > bufLen)
|
||||
return 0;
|
||||
|
||||
SendMessage(lbhWnd, LB_GETTEXT, head, reinterpret_cast<LPARAM>(headtext));
|
||||
|
@ -3221,7 +3221,7 @@ int BinarySearchListBox(HWND lbhWnd,TCHAR* searchtext)
|
|||
|
||||
//is it the tail?
|
||||
lbTextLen = ::SendMessage(lbhWnd, LB_GETTEXTLEN, tail, 0);
|
||||
if (lbTextLen > bufLen)
|
||||
if (static_cast<size_t>(lbTextLen) > bufLen)
|
||||
return 0;
|
||||
SendMessage(lbhWnd, LB_GETTEXT, tail, reinterpret_cast<LPARAM>(tailtext));
|
||||
tailtext[9] = 0x00;
|
||||
|
@ -3248,7 +3248,7 @@ int BinarySearchListBox(HWND lbhWnd,TCHAR* searchtext)
|
|||
{
|
||||
finger = head + ((tail - head) / 2);
|
||||
lbTextLen = ::SendMessage(lbhWnd, LB_GETTEXTLEN, finger, 0);
|
||||
if (lbTextLen > bufLen)
|
||||
if (static_cast<size_t>(lbTextLen) > bufLen)
|
||||
return 0;
|
||||
SendMessage(lbhWnd, LB_GETTEXT, finger, reinterpret_cast<LPARAM>(tbuffer));
|
||||
tbuffer[9] = 0x00;
|
||||
|
|
|
@ -323,7 +323,7 @@ bool PreferenceDlg::setListSelection(size_t currentSel) const
|
|||
TCHAR selStr[selStrLenMax + 1];
|
||||
auto lbTextLen = ::SendMessage(_hSelf, LB_GETTEXTLEN, currentSel, 0);
|
||||
|
||||
if (lbTextLen > selStrLenMax)
|
||||
if (static_cast<size_t>(lbTextLen) > selStrLenMax)
|
||||
return false;
|
||||
|
||||
::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_GETTEXT, currentSel, reinterpret_cast<LPARAM>(selStr));
|
||||
|
@ -2580,13 +2580,13 @@ intptr_t CALLBACK LanguageSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
|
|||
pDestLst = &_langList;
|
||||
}
|
||||
size_t iRemove = ::SendDlgItemMessage(_hSelf, list2Remove, LB_GETCURSEL, 0, 0);
|
||||
if (iRemove == -1)
|
||||
if (static_cast<intptr_t>(iRemove) == -1)
|
||||
return TRUE;
|
||||
|
||||
const size_t sL = 31;
|
||||
TCHAR s[sL + 1];
|
||||
auto lbTextLen = ::SendDlgItemMessage(_hSelf, list2Remove, LB_GETTEXTLEN, iRemove, 0);
|
||||
if (lbTextLen > sL)
|
||||
if (static_cast<size_t>(lbTextLen) > sL)
|
||||
return TRUE;
|
||||
|
||||
::SendDlgItemMessage(_hSelf, list2Remove, LB_GETTEXT, iRemove, reinterpret_cast<LPARAM>(s));
|
||||
|
@ -3207,7 +3207,7 @@ intptr_t CALLBACK PrintSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM)
|
|||
TCHAR intStr[intStrLen];
|
||||
|
||||
auto lbTextLen = ::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETLBTEXTLEN, iSel, 0);
|
||||
if (lbTextLen >= intStrLen)
|
||||
if (static_cast<size_t>(lbTextLen) >= intStrLen)
|
||||
return TRUE;
|
||||
|
||||
::SendDlgItemMessage(_hSelf, LOWORD(wParam), CB_GETLBTEXT, iSel, reinterpret_cast<LPARAM>(intStr));
|
||||
|
|
|
@ -160,7 +160,7 @@ void TabBar::activateAt(int index) const
|
|||
|
||||
void TabBar::deletItemAt(size_t index)
|
||||
{
|
||||
if ((index == _nbItem-1))
|
||||
if (index == _nbItem - 1)
|
||||
{
|
||||
//prevent invisible tabs. If last visible tab is removed, other tabs are put in view but not redrawn
|
||||
//Therefore, scroll one tab to the left if only one tab visible
|
||||
|
@ -912,7 +912,7 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
|
|||
int nSelTab = TabCtrl_GetCurSel(hwnd);
|
||||
for (int i = 0; i < nTabs; ++i)
|
||||
{
|
||||
DRAWITEMSTRUCT dis = { ODT_TAB, id, (UINT)i, ODA_DRAWENTIRE, ODS_DEFAULT, hwnd, hdc };
|
||||
DRAWITEMSTRUCT dis = { ODT_TAB, id, (UINT)i, ODA_DRAWENTIRE, ODS_DEFAULT, hwnd, hdc, {}, 0 };
|
||||
TabCtrl_GetItemRect(hwnd, i, &dis.rcItem);
|
||||
|
||||
if (i == nFocusTab)
|
||||
|
|
|
@ -396,12 +396,12 @@ void VerticalFileSwitcher::updateHeaderArrow()
|
|||
|
||||
if (_lastSortingDirection == SORT_DIRECTION_UP)
|
||||
{
|
||||
lvc.fmt = lvc.fmt | HDF_SORTUP & ~HDF_SORTDOWN;
|
||||
lvc.fmt = (lvc.fmt | HDF_SORTUP) & ~HDF_SORTDOWN;
|
||||
SendMessage(hListView, LVM_SETCOLUMN, _lastSortingColumn, reinterpret_cast<LPARAM>(&lvc));
|
||||
}
|
||||
else if (_lastSortingDirection == SORT_DIRECTION_DOWN)
|
||||
{
|
||||
lvc.fmt = lvc.fmt & ~HDF_SORTUP | HDF_SORTDOWN;
|
||||
lvc.fmt = (lvc.fmt & ~HDF_SORTUP) | HDF_SORTDOWN;
|
||||
SendMessage(hListView, LVM_SETCOLUMN, _lastSortingColumn, reinterpret_cast<LPARAM>(&lvc));
|
||||
}
|
||||
else if (_lastSortingDirection == SORT_DIRECTION_NONE)
|
||||
|
|
|
@ -44,7 +44,7 @@ using namespace std;
|
|||
|
||||
static const TCHAR *readonlyString = TEXT(" [Read Only]");
|
||||
const UINT WDN_NOTIFY = RegisterWindowMessage(TEXT("WDN_NOTIFY"));
|
||||
|
||||
/*
|
||||
inline static DWORD GetStyle(HWND hWnd) {
|
||||
return (DWORD)GetWindowLongPtr(hWnd, GWL_STYLE);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ inline static BOOL ModifyStyleEx(HWND hWnd, DWORD dwRemove, DWORD dwAdd) {
|
|||
::SetWindowLongPtr(hWnd, GWL_EXSTYLE, dwNewStyle);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
struct NumericStringEquivalence
|
||||
{
|
||||
|
@ -133,10 +133,10 @@ struct NumericStringEquivalence
|
|||
struct BufferEquivalent
|
||||
{
|
||||
NumericStringEquivalence _strequiv;
|
||||
DocTabView *_pTab;
|
||||
DocTabView* _pTab;
|
||||
int _iColumn;
|
||||
bool _reverse;
|
||||
BufferEquivalent(DocTabView *pTab, int iColumn, bool reverse)
|
||||
BufferEquivalent(DocTabView* pTab, int iColumn, bool reverse)
|
||||
: _pTab(pTab), _iColumn(iColumn), _reverse(reverse)
|
||||
{}
|
||||
|
||||
|
@ -807,6 +807,8 @@ void WindowsDlg::fitColumnsToSize()
|
|||
|
||||
void WindowsDlg::resetSelection()
|
||||
{
|
||||
assert(_pTab != nullptr);
|
||||
|
||||
auto curSel = _pTab->getCurrentTabIndex();
|
||||
int pos = 0;
|
||||
for (vector<int>::iterator itr = _idxMap.begin(), end = _idxMap.end(); itr != end; ++itr, ++pos)
|
||||
|
@ -897,7 +899,7 @@ void WindowsDlg::doClose()
|
|||
vector<int>::iterator kitr = key.begin();
|
||||
for (UINT i=0; i<n; ++i, ++kitr)
|
||||
{
|
||||
if (nmdlg.Items[i] == -1)
|
||||
if (static_cast<int>(nmdlg.Items[i]) == -1)
|
||||
{
|
||||
int oldVal = _idxMap[*kitr];
|
||||
_idxMap[*kitr] = -1;
|
||||
|
@ -1113,7 +1115,7 @@ void WindowsMenu::initPopupMenu(HMENU hMenu, DocTabView *pTab)
|
|||
mii.wID = id;
|
||||
|
||||
UINT state = GetMenuState(hMenu, id, MF_BYCOMMAND);
|
||||
if (state == -1)
|
||||
if (static_cast<int>(state) == -1)
|
||||
InsertMenuItem(hMenu, IDM_WINDOW_WINDOWS, FALSE, &mii);
|
||||
else
|
||||
SetMenuItemInfo(hMenu, id, FALSE, &mii);
|
||||
|
|
|
@ -85,7 +85,7 @@ protected :
|
|||
static RECT _lastKnownLocation;
|
||||
SIZE _szMinButton = {};
|
||||
SIZE _szMinListCtrl = {};
|
||||
DocTabView *_pTab = nullptr;
|
||||
DocTabView* _pTab = nullptr;
|
||||
std::vector<int> _idxMap;
|
||||
int _currentColumn = -1;
|
||||
int _lastSort = -1;
|
||||
|
|
|
@ -27,11 +27,9 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
const int KEY_STR_LEN = 16;
|
||||
|
||||
struct KeyIDNAME {
|
||||
const TCHAR * name;
|
||||
UCHAR id;
|
||||
const TCHAR * name = nullptr;
|
||||
UCHAR id = 0;
|
||||
};
|
||||
|
||||
KeyIDNAME namedKeyArray[] = {
|
||||
|
@ -161,8 +159,8 @@ void Shortcut::setName(const TCHAR * menuName, const TCHAR * shortcutName)
|
|||
{
|
||||
lstrcpyn(_menuName, menuName, nameLenMax);
|
||||
TCHAR const * name = shortcutName ? shortcutName : menuName;
|
||||
int i = 0, j = 0;
|
||||
while (name[j] != 0 && i < (nameLenMax-1))
|
||||
size_t i = 0, j = 0;
|
||||
while (name[j] != 0 && i < (nameLenMax - 1))
|
||||
{
|
||||
if (name[j] != '&')
|
||||
{
|
||||
|
@ -274,7 +272,7 @@ void getKeyStrFromVal(UCHAR keyVal, generic_string & str)
|
|||
{
|
||||
str = TEXT("");
|
||||
bool found = false;
|
||||
int i;
|
||||
size_t i;
|
||||
for (i = 0; i < nbKeys; ++i)
|
||||
{
|
||||
if (keyVal == namedKeyArray[i].id)
|
||||
|
|
|
@ -38,7 +38,7 @@ void LastRecentFileList::initMenu(HMENU hMenu, int idBase, int posBase, Accelera
|
|||
_pAccelerator = pAccelerator;
|
||||
_nativeLangEncoding = NPP_CP_WIN_1252;
|
||||
|
||||
for (int i = 0 ; i < sizeof(_idFreeArray) ; ++i)
|
||||
for (size_t i = 0 ; i < sizeof(_idFreeArray) ; ++i)
|
||||
_idFreeArray[i] = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue