Fix some of the things clang --analyze flagged
This commit is contained in:
parent
352cd151e0
commit
98360bcd57
34 changed files with 58 additions and 112 deletions
|
@ -3237,8 +3237,10 @@ aas_lreachability_t *AAS_FindFaceReachabilities(vec3_t *facepoints, int numpoint
|
|||
//
|
||||
if (towardsface) VectorCopy(bestend, testpoint);
|
||||
else VectorCopy(beststart, testpoint);
|
||||
testpoint[2] = 0;
|
||||
testpoint[2] = (bestfaceplane->dist - DotProduct(bestfaceplane->normal, testpoint)) / bestfaceplane->normal[2];
|
||||
if (bestfaceplane != NULL)
|
||||
testpoint[2] = (bestfaceplane->dist - DotProduct(bestfaceplane->normal, testpoint)) / bestfaceplane->normal[2];
|
||||
else
|
||||
testpoint[2] = 0;
|
||||
//
|
||||
if (!AAS_PointInsideFace(bestfacenum, testpoint, 0.1f))
|
||||
{
|
||||
|
@ -3786,7 +3788,7 @@ int AAS_Reachability_Grapple(int area1num, int area2num)
|
|||
aas_face_t *face2;
|
||||
aas_area_t *area1, *area2;
|
||||
aas_lreachability_t *lreach;
|
||||
vec3_t areastart, facecenter, start, end, dir, down = {0, 0, -1};
|
||||
vec3_t areastart = {0, 0, 0}, facecenter, start, end, dir, down = {0, 0, -1};
|
||||
vec_t *v;
|
||||
|
||||
//only grapple when on the ground or swimming
|
||||
|
|
|
@ -168,12 +168,11 @@ void AAS_InitTravelFlagFromType(void)
|
|||
//===========================================================================
|
||||
static ID_INLINE int AAS_TravelFlagForType_inline(int traveltype)
|
||||
{
|
||||
int tfl;
|
||||
int tfl = 0;
|
||||
|
||||
tfl = 0;
|
||||
if (tfl & TRAVELFLAG_NOTTEAM1)
|
||||
if (traveltype & TRAVELFLAG_NOTTEAM1)
|
||||
tfl |= TFL_NOTTEAM1;
|
||||
if (tfl & TRAVELFLAG_NOTTEAM2)
|
||||
if (traveltype & TRAVELFLAG_NOTTEAM2)
|
||||
tfl |= TFL_NOTTEAM2;
|
||||
traveltype &= TRAVELTYPE_MASK;
|
||||
if (traveltype < 0 || traveltype >= MAX_TRAVELTYPES)
|
||||
|
|
|
@ -673,7 +673,7 @@ bot_synonymlist_t *BotLoadSynonyms(char *filename)
|
|||
else if (!strcmp(token.string, "["))
|
||||
{
|
||||
size += sizeof(bot_synonymlist_t);
|
||||
if (pass)
|
||||
if (pass && ptr)
|
||||
{
|
||||
syn = (bot_synonymlist_t *) ptr;
|
||||
ptr += sizeof(bot_synonymlist_t);
|
||||
|
@ -705,7 +705,7 @@ bot_synonymlist_t *BotLoadSynonyms(char *filename)
|
|||
len = strlen(token.string) + 1;
|
||||
len = PAD(len, sizeof(long));
|
||||
size += sizeof(bot_synonym_t) + len;
|
||||
if (pass)
|
||||
if (pass && ptr)
|
||||
{
|
||||
synonym = (bot_synonym_t *) ptr;
|
||||
ptr += sizeof(bot_synonym_t);
|
||||
|
@ -725,7 +725,7 @@ bot_synonymlist_t *BotLoadSynonyms(char *filename)
|
|||
FreeSource(source);
|
||||
return NULL;
|
||||
} //end if
|
||||
if (pass)
|
||||
if (pass && ptr)
|
||||
{
|
||||
synonym->weight = token.floatvalue;
|
||||
syn->totalweight += synonym->weight;
|
||||
|
@ -1003,7 +1003,7 @@ bot_randomlist_t *BotLoadRandomStrings(char *filename)
|
|||
len = strlen(token.string) + 1;
|
||||
len = PAD(len, sizeof(long));
|
||||
size += sizeof(bot_randomlist_t) + len;
|
||||
if (pass)
|
||||
if (pass && ptr)
|
||||
{
|
||||
random = (bot_randomlist_t *) ptr;
|
||||
ptr += sizeof(bot_randomlist_t);
|
||||
|
@ -1034,7 +1034,7 @@ bot_randomlist_t *BotLoadRandomStrings(char *filename)
|
|||
len = strlen(chatmessagestring) + 1;
|
||||
len = PAD(len, sizeof(long));
|
||||
size += sizeof(bot_randomstring_t) + len;
|
||||
if (pass)
|
||||
if (pass && ptr)
|
||||
{
|
||||
randomstring = (bot_randomstring_t *) ptr;
|
||||
ptr += sizeof(bot_randomstring_t);
|
||||
|
@ -2113,7 +2113,7 @@ bot_chat_t *BotLoadInitialChat(char *chatfile, char *chatname)
|
|||
return NULL;
|
||||
} //end if
|
||||
StripDoubleQuotes(token.string);
|
||||
if (pass)
|
||||
if (pass && ptr)
|
||||
{
|
||||
chattype = (bot_chattype_t *) ptr;
|
||||
strncpy(chattype->name, token.string, MAX_CHATTYPE_NAME);
|
||||
|
@ -2136,7 +2136,7 @@ bot_chat_t *BotLoadInitialChat(char *chatfile, char *chatname)
|
|||
} //end if
|
||||
len = strlen(chatmessagestring) + 1;
|
||||
len = PAD(len, sizeof(long));
|
||||
if (pass)
|
||||
if (pass && ptr)
|
||||
{
|
||||
chatmessage = (bot_chatmessage_t *) ptr;
|
||||
chatmessage->time = -2*CHATMESSAGE_RECENTTIME;
|
||||
|
@ -2583,7 +2583,6 @@ void BotInitialChat(int chatstate, char *type, int mcontext, char *var0, char *v
|
|||
strcat(match.string, var7);
|
||||
match.variables[7].offset = index;
|
||||
match.variables[7].length = strlen(var7);
|
||||
index += strlen(var7);
|
||||
}
|
||||
//
|
||||
BotConstructChatMessage(cs, message, mcontext, &match, 0, qfalse);
|
||||
|
@ -2766,7 +2765,6 @@ int BotReplyChat(int chatstate, char *message, int mcontext, int vcontext, char
|
|||
strcat(bestmatch.string, var7);
|
||||
bestmatch.variables[7].offset = index;
|
||||
bestmatch.variables[7].length = strlen(var7);
|
||||
index += strlen(var7);
|
||||
}
|
||||
if (LibVarGetValue("bot_testrchat"))
|
||||
{
|
||||
|
|
|
@ -446,12 +446,6 @@ void BotResetWeaponState(int weaponstate)
|
|||
|
||||
ws = BotWeaponStateFromHandle(weaponstate);
|
||||
if (!ws) return;
|
||||
weaponweightconfig = ws->weaponweightconfig;
|
||||
weaponweightindex = ws->weaponweightindex;
|
||||
|
||||
//Com_Memset(ws, 0, sizeof(bot_weaponstate_t));
|
||||
ws->weaponweightconfig = weaponweightconfig;
|
||||
ws->weaponweightindex = weaponweightindex;
|
||||
} //end of the function BotResetWeaponState
|
||||
//========================================================================
|
||||
//
|
||||
|
|
|
@ -272,7 +272,6 @@ fuzzyseperator_t *ReadFuzzySeperators_r(source_t *source)
|
|||
fs->child = NULL;
|
||||
if (lastfs) lastfs->next = fs;
|
||||
else firstfs = fs;
|
||||
lastfs = fs;
|
||||
} //end if
|
||||
//
|
||||
return firstfs;
|
||||
|
|
|
@ -414,7 +414,6 @@ int PC_ReadDefineParms(source_t *source, define_t *define, token_t **parms, int
|
|||
if (indent <= 0)
|
||||
{
|
||||
if (lastcomma) SourceWarning(source, "too many comma's");
|
||||
lastcomma = 1;
|
||||
break;
|
||||
} //end if
|
||||
} //end if
|
||||
|
@ -783,7 +782,7 @@ int PC_ExpandBuiltinDefine(source_t *source, token_t *deftoken, define_t *define
|
|||
int PC_ExpandDefine(source_t *source, token_t *deftoken, define_t *define,
|
||||
token_t **firsttoken, token_t **lasttoken)
|
||||
{
|
||||
token_t *parms[MAX_DEFINEPARMS], *dt, *pt, *t;
|
||||
token_t *parms[MAX_DEFINEPARMS] = { NULL }, *dt, *pt, *t;
|
||||
token_t *t1, *t2, *first, *last, *nextpt, token;
|
||||
int parmnum, i;
|
||||
|
||||
|
@ -1209,12 +1208,6 @@ int PC_Directive_define(source_t *source)
|
|||
//unread the define name before executing the #undef directive
|
||||
PC_UnreadSourceToken(source, &token);
|
||||
if (!PC_Directive_undef(source)) return qfalse;
|
||||
//if the define was not removed (define->flags & DEFINE_FIXED)
|
||||
#if DEFINEHASHING
|
||||
define = PC_FindHashedDefine(source->definehash, token.string);
|
||||
#else
|
||||
define = PC_FindDefine(source->defines, token.string);
|
||||
#endif //DEFINEHASHING
|
||||
} //end if
|
||||
//allocate define
|
||||
define = (define_t *) GetMemory(sizeof(define_t));
|
||||
|
@ -2096,7 +2089,6 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval
|
|||
if (v->prev) v->prev->next = v->next;
|
||||
else firstvalue = v->next;
|
||||
if (v->next) v->next->prev = v->prev;
|
||||
else lastvalue = v->prev;
|
||||
//FreeMemory(v);
|
||||
FreeValue(v);
|
||||
} //end if
|
||||
|
@ -2104,7 +2096,6 @@ int PC_EvaluateTokens(source_t *source, token_t *tokens, signed long int *intval
|
|||
if (o->prev) o->prev->next = o->next;
|
||||
else firstoperator = o->next;
|
||||
if (o->next) o->next->prev = o->prev;
|
||||
else lastoperator = o->prev;
|
||||
//FreeMemory(o);
|
||||
FreeOperator(o);
|
||||
} //end while
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue