- Fixed various instances of unused variables, accessing arrays out of bounds, initialization of non-primitive members in constructor's body, dead code, passing parameters by value instead of reference, usage of uninitialized variables, as reported by cppcheck.

This commit is contained in:
ZzZombo 2015-02-07 23:35:23 +08:00
commit 322742d4b1
28 changed files with 72 additions and 92 deletions

View file

@ -439,7 +439,7 @@ static BYTE HexToByte (const char *hex)
UCVarValue FBaseCVar::FromString (const char *value, ECVarType type)
{
UCVarValue ret;
int i;
int i=0;
switch (type)
{
@ -475,39 +475,29 @@ UCVarValue FBaseCVar::FromString (const char *value, ECVarType type)
// 0 1 2 3
ret.pGUID = NULL;
for (i = 0; i < 38; ++i)
if(value)
for (; i < 38; i++)
{
if (value[i] == 0)
{
break;
}
bool goodv = true;
switch (i)
{
case 0:
if (value[i] != '{')
goodv = false;
break;
break;
case 9:
case 14:
case 19:
case 24:
if (value[i] != '-')
goodv = false;
break;
break;
case 37:
if (value[i] != '}')
goodv = false;
break;
break;
default:
if (value[i] < '0' ||
(value[i] > '9' && value[i] < 'A') ||
(value[i] > 'F' && value[i] < 'a') ||
value[i] > 'f')
{
goodv = false;
}
break;
break;
}
}
if (i == 38 && value[i] == 0)
@ -1673,9 +1663,6 @@ void FBaseCVar::ListVars (const char *filter, bool plain)
if (CheckWildcards (filter, var->GetName()))
{
DWORD flags = var->GetFlags();
UCVarValue val;
val = var->GetGenericRep (CVAR_String);
if (plain)
{ // plain formatting does not include user-defined cvars
if (!(flags & CVAR_UNSETTABLE))