Fix some out of index errors
Closes #1851 [PowerEditor/src/Parameters.cpp:2581]: (warning) Array index -1 is out of bounds. Otherwise there is useless condition at line 2568. [PowerEditor/src/ScitillaComponent/ScintillaEditView.cpp:3079]: (style) Unused variable: newline [PowerEditor/src/WinControls/Grid/BabyGrid.cpp:166]: (style) Array index 'j' is used before limits check. [PowerEditor/src/WinControls/Grid/BabyGrid.cpp:171]: (style) Array index 'j' is used before limits check. [scintilla/lexers/LexUser.cxx:1128]: (error) Array 'maskMapper[15]' accessed at index 15, which is out of bounds.
This commit is contained in:
parent
d6c2d6cc9f
commit
7b596fa488
@ -2565,24 +2565,20 @@ bool NppParameters::importUDLFromFile(generic_string sourceFile)
|
|||||||
|
|
||||||
bool NppParameters::exportUDLToFile(int langIndex2export, generic_string fileName2save)
|
bool NppParameters::exportUDLToFile(int langIndex2export, generic_string fileName2save)
|
||||||
{
|
{
|
||||||
if (langIndex2export != -1 && langIndex2export >= _nbUserLang)
|
if (langIndex2export >= NB_MAX_USER_LANG)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (langIndex2export < 0 && langIndex2export >= _nbUserLang)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TiXmlDocument *pNewXmlUserLangDoc = new TiXmlDocument(fileName2save);
|
TiXmlDocument *pNewXmlUserLangDoc = new TiXmlDocument(fileName2save);
|
||||||
TiXmlNode *newRoot2export = pNewXmlUserLangDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus")));
|
TiXmlNode *newRoot2export = pNewXmlUserLangDoc->InsertEndChild(TiXmlElement(TEXT("NotepadPlus")));
|
||||||
|
|
||||||
bool b = false;
|
|
||||||
|
|
||||||
if ( langIndex2export >= NB_MAX_USER_LANG )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
insertUserLang2Tree(newRoot2export, _userLangArray[langIndex2export]);
|
insertUserLang2Tree(newRoot2export, _userLangArray[langIndex2export]);
|
||||||
b = pNewXmlUserLangDoc->SaveFile();
|
bool result = pNewXmlUserLangDoc->SaveFile();
|
||||||
|
|
||||||
delete pNewXmlUserLangDoc;
|
delete pNewXmlUserLangDoc;
|
||||||
return b;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
LangType NppParameters::getLangFromExt(const TCHAR *ext)
|
LangType NppParameters::getLangFromExt(const TCHAR *ext)
|
||||||
|
@ -3076,7 +3076,6 @@ void ScintillaEditView::changeTextDirection(bool isRTL)
|
|||||||
generic_string ScintillaEditView::getEOLString()
|
generic_string ScintillaEditView::getEOLString()
|
||||||
{
|
{
|
||||||
const int eol_mode = int(execute(SCI_GETEOLMODE));
|
const int eol_mode = int(execute(SCI_GETEOLMODE));
|
||||||
string newline;
|
|
||||||
if (eol_mode == SC_EOL_CRLF)
|
if (eol_mode == SC_EOL_CRLF)
|
||||||
{
|
{
|
||||||
return TEXT("\r\n");
|
return TEXT("\r\n");
|
||||||
|
@ -163,12 +163,12 @@ int GetNextColWithWidth(int SI, int startcol, int direction)
|
|||||||
if(direction == 1){j++;}
|
if(direction == 1){j++;}
|
||||||
if(direction != 1){j--;}
|
if(direction != 1){j--;}
|
||||||
|
|
||||||
while((BGHS[SI].columnwidths[j] == 0)&&(j<=BGHS[SI].cols)&&(j>0))
|
while((j>0)&&(j<=BGHS[SI].cols)&&(BGHS[SI].columnwidths[j] == 0))
|
||||||
{
|
{
|
||||||
if(direction == 1){j++;}
|
if(direction == 1){j++;}
|
||||||
if(direction != 1){j--;}
|
if(direction != 1){j--;}
|
||||||
}
|
}
|
||||||
if((BGHS[SI].columnwidths[j] > 0)&&(j<=BGHS[SI].cols))
|
if((j<=BGHS[SI].cols)&&(BGHS[SI].columnwidths[j] > 0))
|
||||||
{
|
{
|
||||||
ReturnValue = j;
|
ReturnValue = j;
|
||||||
}
|
}
|
||||||
|
@ -1123,7 +1123,7 @@ static void setBackwards(WordList * kwLists[], StyleContext & sc, bool prefixes[
|
|||||||
int folding = FOLD_NONE;
|
int folding = FOLD_NONE;
|
||||||
int moveForward = 0;
|
int moveForward = 0;
|
||||||
|
|
||||||
for (int i=0; i<=MAPPER_TOTAL; ++i)
|
for (int i=0; i<MAPPER_TOTAL; ++i)
|
||||||
{
|
{
|
||||||
if (nestedKey & maskMapper[i])
|
if (nestedKey & maskMapper[i])
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user