Fixed crash issue due to unsigned variable

Close #2035
This commit is contained in:
A-R-C-A 2016-06-30 01:42:53 +00:00 committed by Don HO
parent a82ad53e9c
commit 3f09ebc976
8 changed files with 13 additions and 17 deletions

View File

@ -222,7 +222,7 @@ INT_PTR CALLBACK RegExtDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPar
_isCustomize = false;
}
auto count = ::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANGEXT_LIST, LB_GETCOUNT, 0, 0);
LRESULT count = ::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANGEXT_LIST, LB_GETCOUNT, 0, 0);
for (count -= 1 ; count >= 0 ; count--)
::SendDlgItemMessage(_hSelf, IDC_REGEXT_LANGEXT_LIST, LB_DELETESTRING, count, 0);

View File

@ -2533,7 +2533,7 @@ void Notepad_plus::maintainIndentation(TCHAR ch)
auto startPos = _pEditView->execute(SCI_POSITIONFROMLINE, curLine);
auto endPos = _pEditView->execute(SCI_GETCURRENTPOS);
for (auto i = endPos - 2; i > 0 && i > startPos; --i)
for (long long i = endPos - 2; i > 0 && i > startPos; --i)
{
UCHAR aChar = (UCHAR)_pEditView->execute(SCI_GETCHARAT, i);
if (aChar != ' ' && aChar != '\t')

View File

@ -966,14 +966,14 @@ bool Notepad_plus::fileCloseAll(bool doDeleteBackup, bool isSnapshotMode)
//first close all docs in non-current view, which gets closed automatically
//Set active tab to the last one closed.
activateBuffer(_pNonDocTab->getBufferByIndex(0), otherView());
for (size_t i = _pNonDocTab->nbItem() - 1; i >= 0; i--) //close all from right to left
for (int32_t i = static_cast<int32_t>(_pNonDocTab->nbItem()) - 1; i >= 0; i--) //close all from right to left
{
doClose(_pNonDocTab->getBufferByIndex(i), otherView(), doDeleteBackup);
}
}
activateBuffer(_pDocTab->getBufferByIndex(0), currentView());
for (int i = static_cast<int32_t>(_pDocTab->nbItem()) - 1; i >= 0; i--)
for (int32_t i = static_cast<int32_t>(_pDocTab->nbItem()) - 1; i >= 0; i--)
{ //close all from right to left
doClose(_pDocTab->getBufferByIndex(i), currentView(), doDeleteBackup);
}
@ -1123,14 +1123,14 @@ bool Notepad_plus::fileCloseAllButCurrent()
//Set active tab to the last one closed.
activateBuffer(_pNonDocTab->getBufferByIndex(0), otherView());
for (int i = int(_pNonDocTab->nbItem()) - 1; i >= 0; i--) //close all from right to left
for (int32_t i = static_cast<int32_t>(_pNonDocTab->nbItem()) - 1; i >= 0; i--) //close all from right to left
{
doClose(_pNonDocTab->getBufferByIndex(i), otherView(), isSnapshotMode);
}
}
activateBuffer(_pDocTab->getBufferByIndex(0), currentView());
for (int i = int(_pDocTab->nbItem()) - 1; i >= 0; i--) //close all from right to left
for (int32_t i = static_cast<int32_t>(_pDocTab->nbItem()) - 1; i >= 0; i--) //close all from right to left
{
if (i == active) //dont close active index
{

View File

@ -582,7 +582,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
{
// If the delimiters are the same (e.g. they are both a quotation mark), choose the ones
// which are closest to the clicked position.
for (int i = static_cast<int32_t>(position_of_click); i >= 0; --i)
for (int32_t i = static_cast<int32_t>(position_of_click); i >= 0; --i)
{
if (bufstring.at(i) == nppGUI._leftmostDelimiter)
{

View File

@ -262,7 +262,7 @@ LRESULT DockingManager::runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
}
// destroy containers
for (size_t i = _vContainer.size(); i > 0; i--)
for (int32_t i = static_cast<int32_t>(_vContainer.size()); i > 0; i--)
{
_vContainer[i-1]->destroy();
delete _vContainer[i-1];

View File

@ -784,7 +784,7 @@ void WindowsMenu::init(HINSTANCE hInst, HMENU hMainMenu, const TCHAR *translatio
::ModifyMenu(_hMenu, IDM_WINDOW_WINDOWS, MF_BYCOMMAND, IDM_WINDOW_WINDOWS, windowStr.c_str());
}
UINT pos = 0;
int32_t pos = 0;
for(pos = GetMenuItemCount(hMainMenu) - 1; pos > 0; --pos)
{
if ((GetMenuState(hMainMenu, pos, MF_BYPOSITION) & MF_POPUP) != MF_POPUP)

View File

@ -693,7 +693,7 @@ void ScintillaAccelerator::updateKeys()
for(int i = 0; i < _nrScintillas; ++i)
{
::SendMessage(_vScintillas[i], SCI_CLEARALLCMDKEYS, 0, 0);
for(size_t j = mapSize - 1; j >= 0; j--) //reverse order, top of the list has highest priority
for(int32_t j = static_cast<int32_t>(mapSize) - 1; j >= 0; j--) //reverse order, top of the list has highest priority
{
ScintillaKeyMap skm = map[j];
if (skm.isEnabled())

View File

@ -75,17 +75,13 @@ void nsEscCharSetProber::Reset(void)
nsProbingState nsEscCharSetProber::HandleData(const char* aBuf, PRUint32 aLen)
{
nsSMState codingState;
PRInt32 j;
PRUint32 i;
for ( i = 0; i < aLen && mState == eDetecting; i++)
for (PRUint32 i = 0; i < aLen && mState == eDetecting; i++)
{
for (j = mActiveSM-1; j>= 0; j--)
for (PRInt32 j = mActiveSM-1; j>= 0; j--)
{
if (mCodingSM[j])
{
codingState = mCodingSM[j]->NextState(aBuf[i]);
nsSMState codingState = mCodingSM[j]->NextState(aBuf[i]);
if (codingState == eItsMe)
{
mState = eFoundIt;