mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2025-01-10 03:51:18 +00:00
fix warning: array subscript is above array bounds
Simplify and flatten the code while we're at it.
This commit is contained in:
parent
3311b00ae6
commit
cd725d680a
1 changed files with 15 additions and 29 deletions
|
@ -426,42 +426,28 @@ void Input( char*& pBuffer ){
|
||||||
const char *fields[5] = { "", "", "", "", "" };
|
const char *fields[5] = { "", "", "", "", "" };
|
||||||
float values[5];
|
float values[5];
|
||||||
|
|
||||||
for ( int n = 0; n < g_nVariableCount; n++ )
|
for ( int n = 0; n < 5 && n < g_nVariableCount; n++ )
|
||||||
{
|
{
|
||||||
if ( g_Variables[n].m_strInput.GetLength() > 0 ) {
|
if ( g_Variables[n].m_strInput.GetLength() > 0 ) {
|
||||||
bGo = true;
|
bGo = true;
|
||||||
if ( n < 5 ) {
|
fields[n] = g_Variables[n].m_strInput.GetBuffer();
|
||||||
switch ( n )
|
|
||||||
{
|
|
||||||
case 0: fields[1] = g_Variables[n].m_strInput.GetBuffer(); break;
|
|
||||||
case 1: fields[2] = g_Variables[n].m_strInput.GetBuffer(); break;
|
|
||||||
case 2: fields[3] = g_Variables[n].m_strInput.GetBuffer(); break;
|
|
||||||
case 3: fields[4] = g_Variables[n].m_strInput.GetBuffer(); break;
|
|
||||||
case 4: fields[5] = g_Variables[n].m_strInput.GetBuffer(); break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( bGo ) {
|
if ( !bGo ) {
|
||||||
if ( DoBSInputDlg( fields, values ) == IDOK ) {
|
return;
|
||||||
for ( int n = 0; n < g_nVariableCount; n++ )
|
}
|
||||||
{
|
|
||||||
if ( g_Variables[n].m_strInput.GetLength() > 0 ) {
|
if ( DoBSInputDlg( fields, values ) != IDOK ) {
|
||||||
if ( n < 5 ) {
|
g_bKeepGoing = false;
|
||||||
switch ( n )
|
return;
|
||||||
{
|
}
|
||||||
case 0: g_Variables[n].m_fValue = values[1]; break;
|
|
||||||
case 1: g_Variables[n].m_fValue = values[2]; break;
|
for ( int n = 0; n < 5 && n < g_nVariableCount; n++ )
|
||||||
case 2: g_Variables[n].m_fValue = values[3]; break;
|
{
|
||||||
case 3: g_Variables[n].m_fValue = values[4]; break;
|
if ( g_Variables[n].m_strInput.GetLength() > 0 ) {
|
||||||
case 4: g_Variables[n].m_fValue = values[5]; break;
|
g_Variables[n].m_fValue = values[n];
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else{ g_bKeepGoing = false; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue