Skip to content

Go through warnings and clean them up #1

@InFerYes

Description

@InFerYes
[src\g_arty.c:288]: (style) Redundant condition: If 'EXPR == 4', the comparison 'EXPR' is always true.
[src\g_arty.c:360] -> [src\g_arty.c:367]: (style) Variable 'check->obj_owner' is reassigned a value before the old one has been used.
[src\g_arty.c:609] -> [src\g_arty.c:617]: (style) Variable 'ent->nextthink' is reassigned a value before the old one has been used.
[src\g_arty.c:1070] -> [src\g_arty.c:1076]: (style) Variable 'ent->nextthink' is reassigned a value before the old one has been used.
[src\g_combat.c:306]: (style) Assignment of function parameter has no effect outside the function.
[src\g_combat.c:793]: (style) Redundant condition: If 'EXPR == 58', the comparison 'EXPR' is always true.
[src\g_combat.c:1650] -> [src\g_combat.c:1652]: (style) Variable 'speed' is reassigned a value before the old one has been used.
[src\g_cmds.c:343]: (style) Redundant condition: If '!EXPR', the comparison 'EXPR != 120' is always true.
[src\g_cmds.c:1354]: (style) Redundant condition: it. '!it || (it && !it->use)' is equivalent to '!it || !it->use'
[src\g_cmds.c:3015]: (style) Redundant condition: If 'EXPR == 5', the comparison 'EXPR' is always true.
[src\g_cmds.c:1354] -> [src\g_cmds.c:1356]: (warning) Either the condition '!it' is redundant or there is possible null pointer dereference: it.
[src\g_cmds.c:3259]: (style) Same expression on both sides of '||'.
[src\g_cmds.c:3056]: (error) Uninitialized variable: ammo_amount
[src\g_ents.c:426]: (style) Obsolete function 'strdup' called. It is recommended to use '_strdup' instead.
[src\g_ents.c:441]: (style) Obsolete function 'strdup' called. It is recommended to use '_strdup' instead.
[src\g_ents.c:456]: (style) Obsolete function 'strdup' called. It is recommended to use '_strdup' instead.
[src\g_ents.c:472]: (style) Obsolete function 'strdup' called. It is recommended to use '_strdup' instead.
[src\g_ents.c:524]: (warning) Found calculation inside sizeof().
[src\g_items.c:794]: (style) Redundant condition: If 'EXPR == 1', the comparison 'EXPR' is always true.
[src\g_func.c:423] -> [src\g_func.c:421]: (warning) Either the condition 'if(other)' is redundant or there is possible null pointer dereference: other.
[src\g_func.c:1146] -> [src\g_func.c:1144]: (warning) Either the condition 'if(other)' is redundant or there is possible null pointer dereference: other.
[src\g_func.c:1547] -> [src\g_func.c:1545]: (warning) Either the condition 'if(other)' is redundant or there is possible null pointer dereference: other.
[src\g_func.c:2067] -> [src\g_func.c:2065]: (warning) Either the condition 'if(other)' is redundant or there is possible null pointer dereference: other.
[src\g_func.c:476] -> [src\g_func.c:482]: (style) Variable 'tmin[2]' is reassigned a value before the old one has been used.
[src\g_maps.c:118]: (warning) fscanf() without field width limits can crash with huge input data.
[src\g_maps.c:135]: (warning) fscanf() without field width limits can crash with huge input data.
[src\g_main.c:398]: (style) Obsolete function 'strdup' called. It is recommended to use '_strdup' instead.
[src\g_main.c:435]: (style) Obsolete function 'strdup' called. It is recommended to use '_strdup' instead.
[src\g_main.c:666]: (style) Obsolete function 'strdup' called. It is recommended to use '_strdup' instead.
[src\g_main.c:702]: (style) Obsolete function 'strdup' called. It is recommended to use '_strdup' instead.
[src\g_main.c:804]: (style) Obsolete function 'strdup' called. It is recommended to use '_strdup' instead.
[src\g_main.c:712] -> [src\g_main.c:711] -> [src\g_main.c:735] -> [src\g_main.c:737] -> [src\g_main.c:340]: (warning) Either the condition 't==((void*)0)' is redundant or there is possible null pointer dereference: map.
[src\g_main.c:712] -> [src\g_main.c:711] -> [src\g_main.c:735] -> [src\g_main.c:737] -> [src\g_main.c:350]: (warning) Either the condition 't==((void*)0)' is redundant or there is possible null pointer dereference: map.
[src\g_main.c:712] -> [src\g_main.c:711] -> [src\g_main.c:735] -> [src\g_main.c:737] -> [src\g_main.c:359]: (warning) Either the condition 't==((void*)0)' is redundant or there is possible null pointer dereference: map.
[src\g_main.c:712] -> [src\g_main.c:735] -> [src\g_main.c:736]: (warning) Either the condition 't==((void*)0)' is redundant or there is possible null pointer dereference: check.
[src\g_main.c:736]: (error) Null pointer dereference
[src\g_local.h:1033] -> [src\g_main.c:942]: (style) Local variable 'range' shadows outer function
[src\g_main.c:804]: (style) Variable 'sb' is allocated memory that is never used.
[src\g_misc.c:256] -> [src\g_misc.c:264]: (style) Variable 'gib->solid' is reassigned a value before the old one has been used.
[src\g_misc.c:1798]: (warning) Redundant assignment of 'ent->s.frame' to itself.
[src\g_misc.c:1822]: (warning) Redundant assignment of 'ent->s.frame' to itself.
[src\g_misc.c:1885]: (warning) Redundant assignment of 'ent->s.frame' to itself.
[src\g_save.c:868] -> [src\g_save.c:876]: (error) Resource handle 'f' freed twice.
[src\g_spawn.c:482]: (style) Array index 'i' is used before limits check.
[src\g_spawn.c:926]: (style) Obsolete function 'strdup' called. It is recommended to use '_strdup' instead.
[src\g_spawn.c:531]: (portability) Casting between unsigned char * and float * which have an incompatible binary data representation.
[src\g_spawn.c:532]: (portability) Casting between unsigned char * and float * which have an incompatible binary data representation.
[src\g_spawn.c:533]: (portability) Casting between unsigned char * and float * which have an incompatible binary data representation.
[src\g_spawn.c:539]: (portability) Casting between unsigned char * and float * which have an incompatible binary data representation.
[src\g_spawn.c:543]: (portability) Casting between unsigned char * and float * which have an incompatible binary data representation.
[src\g_spawn.c:544]: (portability) Casting between unsigned char * and float * which have an incompatible binary data representation.
[src\g_spawn.c:545]: (portability) Casting between unsigned char * and float * which have an incompatible binary data representation.
[src\g_svcmds.c:444]: (style) Obsolete function 'strdup' called. It is recommended to use '_strdup' instead.
[src\g_svcmds.c:78] -> [src\g_svcmds.c:80]: (style) Variable 'ent->client->resp.mos' is reassigned a value before the old one has been used.
[src\g_turret.c:922]: (style) Redundant condition: If 'EXPR == 1', the comparison 'EXPR' is always true.
[src\g_turret.c:187]: (warning) Comparison of modulo result is predetermined, because it is always less than 2.
[src\g_turret.c:106] -> [src\g_turret.c:103]: (warning) Either the condition 'if(other)' is redundant or there is possible null pointer dereference: other.
[src\g_turret.c:936] -> [src\g_turret.c:956]: (style) Variable 'self->movetype' is reassigned a value before the old one has been used.
[src\g_turret.c:282]: (warning) Redundant assignment of 'shell->nextthink' to itself.
[src\g_turretx.c:859]: (style) Redundant condition: If 'EXPR == 1', the comparison 'EXPR' is always true.
[src\g_turretx.c:106] -> [src\g_turretx.c:103]: (warning) Either the condition 'if(other)' is redundant or there is possible null pointer dereference: other.
[src\g_turretx.c:263]: (warning) Redundant assignment of 'shell->nextthink' to itself.
[src\m_civilian.c:166] -> [src\m_civilian.c:183]: (style) Variable 'tr' is reassigned a value before the old one has been used.
[src\m_civilian.c:334] -> [src\m_civilian.c:381]: (style) Local variable 'e' shadows outer variable
[src\m_civilian.c:334] -> [src\m_civilian.c:381]: (style) Local variable 'nearest' shadows outer variable
[src\m_civilian.c:335] -> [src\m_civilian.c:382]: (style) Local variable 'temp_distance' shadows outer variable
[src\m_civilian.c:335] -> [src\m_civilian.c:382]: (style) Local variable 'nearest_distance' shadows outer variable
[src\g_weapon.c:586]: (style) Boolean result is used in bitwise operation. Clarify expression with parentheses.
[src\g_weapon.c:2035]: (style) Redundant condition: ent->owner. '!ent->owner || (ent->owner && !ent->owner->inuse)' is equivalent to '!ent->owner || !ent->owner->inuse'
[src\g_weapon.c:4310]: (style) Redundant condition: ent->owner->client->resp.team_on. '!A || (A && B)' is equivalent to '!A || B'
[src\g_weapon.c:1038] -> [src\g_weapon.c:1039]: (style) Variable 'underwater_bullet->think' is reassigned a value before the old one has been used.
[src\g_weapon.c:2157] -> [src\g_weapon.c:2165]: (style) Variable 'rocket->think' is reassigned a value before the old one has been used.
[src\g_weapon.c:2217] -> [src\g_weapon.c:2225]: (style) Variable 'rocket->think' is reassigned a value before the old one has been used.
[src\g_weapon.c:5021] -> [src\g_weapon.c:5027]: (style) Variable 'ent->client->kick_angles[0]' is reassigned a value before the old one has been used.
[src\g_weapon.c:5208] -> [src\g_weapon.c:5214]: (style) Variable 'ent->client->kick_angles[0]' is reassigned a value before the old one has been used.
[src\g_weapon.c:6170] -> [src\g_weapon.c:6176]: (style) Variable 'ent->client->kick_angles[0]' is reassigned a value before the old one has been used.
[src\g_weapon.c:2081]: (warning) Redundant assignment of 'rocket->nextthink' to itself.
[src\g_weapon.c:2171]: (warning) Redundant assignment of 'rocket->nextthink' to itself.
[src\g_weapon.c:2231]: (warning) Redundant assignment of 'rocket->nextthink' to itself.
[src\g_local.h:1033] -> [src\g_weapon.c:102]: (style) Local variable 'range' shadows outer function
[src\g_weapon.c:1349] -> [src\g_weapon.c:1410]: (style) Local variable 'i' shadows outer variable
[src\g_weapon.c:1349] -> [src\g_weapon.c:1465]: (style) Local variable 'i' shadows outer variable
[src\p_classes.c:171] -> [src\p_classes.c:168] -> [src\p_classes.c:42]: (warning) Either the condition '!item' is redundant or there is possible null pointer dereference: item.
[src\p_client.c:2964]: (style) Obsolete function 'strdup' called. It is recommended to use '_strdup' instead.
[src\p_client.c:3388]: (style) Obsolete function 'strdup' called. It is recommended to use '_strdup' instead.
[src\p_client.c:4648]: (style) Obsolete function 'strdup' called. It is recommended to use '_strdup' instead.
[src\p_client.c:4891]: (style) Obsolete function 'strdup' called. It is recommended to use '_strdup' instead.
[src\p_client.c:1990] -> [src\p_client.c:1999]: (style) Condition '!spot' is always true
[src\p_client.c:2039] -> [src\p_client.c:2059]: (style) Condition '!spot' is always true
[src\p_client.c:4850]: (error) Memory leak: f
[src\p_client.c:742] -> [src\p_client.c:733]: (warning) Either the condition 'self->client&&!self->ai&&attacker' is redundant or there is possible null pointer dereference: attacker.
[src\p_client.c:742] -> [src\p_client.c:734]: (warning) Either the condition 'self->client&&!self->ai&&attacker' is redundant or there is possible null pointer dereference: attacker.
[src\p_client.c:742] -> [src\p_client.c:736]: (warning) Either the condition 'self->client&&!self->ai&&attacker' is redundant or there is possible null pointer dereference: attacker.
[src\p_client.c:742] -> [src\p_client.c:737]: (warning) Either the condition 'self->client&&!self->ai&&attacker' is redundant or there is possible null pointer dereference: attacker.
[src\p_client.c:2822] -> [src\p_client.c:2815]: (warning) Either the condition 'if(ent)' is redundant or there is possible null pointer dereference: ent.
[src\p_client.c:2822] -> [src\p_client.c:2921]: (warning) Either the condition 'ent' is redundant or there is possible null pointer dereference: ent.
[src\p_client.c:2163] -> [src\p_client.c:2167]: (style) Variable 'body->svflags' is reassigned a value before the old one has been used.
[src\p_client.c:4248] -> [src\p_client.c:4250]: (style) Variable 'temp_damage' is reassigned a value before the old one has been used.
[src\p_client.c:1226] -> [src\p_client.c:1343]: (style) Local variable 'i' shadows outer variable
[src\g_local.h:1033] -> [src\p_client.c:1625]: (style) Local variable 'range' shadows outer function
[src\p_hud.c:793]: (error) Buffer is accessed out of bounds: pingstring
[src\p_hud.c:795]: (error) Buffer is accessed out of bounds: pingstring
[src\p_hud.c:801]: (error) Buffer is accessed out of bounds: pingstring
[src\p_hud.c:841]: (error) Buffer is accessed out of bounds: pingstring
[src\p_hud.c:843]: (error) Buffer is accessed out of bounds: pingstring
[src\p_hud.c:849]: (error) Buffer is accessed out of bounds: pingstring
[src\p_hud.c:180]: (style) Boolean result is used in bitwise operation. Clarify expression with parentheses.
[src\p_hud.c:1419]: (error) Undefined behavior: Variable 'string' is used as parameter and destination in sprintf().
[src\p_hud.c:1422]: (error) Undefined behavior: Variable 'string' is used as parameter and destination in sprintf().
[src\p_hud.c:1426]: (error) Undefined behavior: Variable 'string' is used as parameter and destination in sprintf().
[src\p_hud.c:1429]: (error) Undefined behavior: Variable 'string' is used as parameter and destination in sprintf().
[src\p_hud.c:1431]: (error) Undefined behavior: Variable 'string' is used as parameter and destination in sprintf().
[src\p_hud.c:1440]: (error) Undefined behavior: Variable 'string' is used as parameter and destination in sprintf().
[src\p_hud.c:1444]: (error) Undefined behavior: Variable 'string' is used as parameter and destination in sprintf().
[src\p_hud.c:1471]: (error) Undefined behavior: Variable 'string' is used as parameter and destination in sprintf().
[src\p_observer.c:267] -> [src\p_observer.c:277]: (style) Variable 'tr' is reassigned a value before the old one has been used.
[src\p_observer.c:876] -> [src\p_observer.c:887]: (style) Variable 'i' is reassigned a value before the old one has been used.
[src\p_observer.c:987] -> [src\p_observer.c:989]: (style) Variable 'ent->client->resp.mos' is reassigned a value before the old one has been used.
[src\p_weapon.c:2390]: (error) Array 'fire_frames[2]' accessed at index 2, which is out of bounds.
[src\p_weapon.c:1361]: (style) Boolean result is used in bitwise operation. Clarify expression with parentheses.
[src\p_weapon.c:1216] -> [src\p_weapon.c:1222]: (style) The if condition is the same as the previous if condition
[src\p_weapon.c:1502] -> [src\p_weapon.c:1556]: (warning) Either the condition 'surf' is redundant or there is possible null pointer dereference: surf.
[src\p_weapon.c:2053] -> [src\p_weapon.c:2048]: (warning) Either the condition 'if(ent)' is redundant or there is possible null pointer dereference: ent.
[src\p_weapon.c:922] -> [src\p_weapon.c:925]: (style) Variable 'speed' is reassigned a value before the old one has been used.
[src\p_weapon.c:2684] -> [src\p_weapon.c:2686]: (style) Variable 'ent->client->ps.gunframe' is reassigned a value before the old one has been used.
[src\p_view.c:854]: (style) Redundant condition: If 'EXPR == 8', the comparison 'EXPR' is always true.
[src\p_view.c:880] -> [src\p_view.c:884]: (style) The if condition is the same as the previous if condition
[src\p_view.c:2227] -> [src\p_view.c:2231]: (style) Variable 'client->anim_end' is reassigned a value before the old one has been used.
[src\p_view.c:2425] -> [src\p_view.c:2432]: (style) Variable 'ent->viewheight' is reassigned a value before the old one has been used.
[src\p_view.c:2869] -> [src\p_view.c:2870]: (style) Variable 'dist' is reassigned a value before the old one has been used.
[src\p_view.c:50] -> [src\p_view.c:1235]: (style) Local variable 'forward' shadows outer variable
[src\p_view.c:1625] -> [src\p_view.c:1638]: (style) Local variable 'end' shadows outer variable
[src\p_view.c:1626] -> [src\p_view.c:1639]: (style) Local variable 'tr' shadows outer variable
[src\p_view.c:50] -> [src\p_view.c:2354]: (style) Local variable 'up' shadows outer variable
[src\p_view.c:50] -> [src\p_view.c:2357]: (style) Local variable 'right' shadows outer variable
[src\p_view.c:50] -> [src\p_view.c:2688]: (style) Local variable 'forward' shadows outer variable
[src\p_view.c:2355] -> [src\p_view.c:2828]: (style) Local variable 'tr' shadows outer variable
[src\p_view.c:2353] -> [src\p_view.c:2829]: (style) Local variable 'end' shadows outer variable
[src\p_view.c:2352] -> [src\p_view.c:2829]: (style) Local variable 'start' shadows outer variable
[src\p_view.c:2354] -> [src\p_view.c:2830]: (style) Local variable 'up' shadows outer variable
[src\p_view.c:50] -> [src\p_view.c:2831]: (style) Local variable 'forward' shadows outer variable
[src\q_shared.c:1286] -> [src\q_shared.c:1288]: (warning) Opposite inner 'if' condition leads to a dead code block.
[src\q_shared.c:1332] -> [src\q_shared.c:1334]: (warning) Opposite inner 'if' condition leads to a dead code block.
[src\q_shared.c:1400] -> [src\q_shared.c:1376]: (warning) Either the condition '!value' is redundant or there is possible null pointer dereference: value.
[src\q_shared.c:1400] -> [src\q_shared.c:1388]: (warning) Either the condition '!value' is redundant or there is possible null pointer dereference: value.
[src\q_shared.c:1400] -> [src\q_shared.c:1394]: (warning) Either the condition '!value' is redundant or there is possible null pointer dereference: value.
[src\q_shared.c:266]: (portability) Casting from float * to signed int * is not portable due to different binary data representations on different platforms.
[src\q_shared.c:268]: (portability) Casting between signed int * and float * which have an incompatible binary data representation.
[src\q_shared.h:197] -> [src\q_shared.c:291]: (warning) Function 'LerpAngle' argument order different: declaration 'a1, a2, frac' definition 'a2, a1, frac'
[src\q_shared.c:313] -> [src\q_shared.c:47]: (style) Local variable 'i' shadows outer variable
[src\q_shared.c:313] -> [src\q_shared.c:163]: (style) Local variable 'i' shadows outer variable
[src\q_shared.c:313] -> [src\q_shared.c:320]: (style) Local variable 'i' shadows outer variable
[src\q_shared.c:314] -> [src\q_shared.c:323]: (style) Local variable 'corners' shadows outer variable
[src\q_shared.c:313] -> [src\q_shared.c:666]: (style) Local variable 'i' shadows outer variable
[src\q_shared.c:313] -> [src\q_shared.c:772]: (style) Local variable 'i' shadows outer variable
[src\q_shared.c:313] -> [src\q_shared.c:849]: (style) Local variable 'i' shadows outer variable
[src\q_shared.c:313] -> [src\q_shared.c:1171]: (style) Local variable 'i' shadows outer variable
[src\x_fire.c:1182] -> [src\x_fire.c:1184]: (style) Variable 'fireball->s.effects' is reassigned a value before the old one has been used.
[src\ai\ai_class_dmbot.c:1126] -> [src\ai\ai_class_dmbot.c:1264]: (warning) Either the condition 'weapon!=9' is redundant or the array 'AIWeapons[9]' is accessed at index 9, which is out of bounds.
[src\ai\ai_class_dmbot.c:1126] -> [src\ai\ai_class_dmbot.c:1270]: (warning) Either the condition 'weapon!=9' is redundant or the array 'AIWeapons[9]' is accessed at index 9, which is out of bounds.
[src\ai\ai_class_dmbot.c:1126] -> [src\ai\ai_class_dmbot.c:1275]: (warning) Either the condition 'weapon!=9' is redundant or the array 'AIWeapons[9]' is accessed at index 9, which is out of bounds.
[src\ai\ai_class_dmbot.c:438]: (style) Redundant condition: If 'EXPR == 8', the comparison 'EXPR' is always true.
[src\ai\ai_class_dmbot.c:451]: (style) Redundant condition: If 'EXPR == 8', the comparison 'EXPR' is always true.
[src\ai\ai_class_dmbot.c:984]: (style) Redundant condition: If 'EXPR == 8', the comparison 'EXPR' is always true.
[src\ai\ai_class_dmbot.c:1905] -> [src\ai\ai_class_dmbot.c:1906]: (style) Variable 'self->client->ping' is reassigned a value before the old one has been used.
[src\ai\ai_dropnodes.c:353] -> [src\ai\ai_dropnodes.c:357]: (style) Expression is always true because 'else if' condition is opposite to previous condition at line 353.
[src\ai\ai_links.c:178] -> [src\ai\ai_links.c:184]: (warning) Either the condition 'pLinks[n1].numLinks>16' is redundant or the array 'pLinks[n1].nodes[16]' is accessed at index 16, which is out of bounds.
[src\ai\ai_links.c:875] -> [src\ai\ai_links.c:914]: (style) Local variable 'link' shadows outer variable
[src\ai\ai_main.c:1027] -> [src\ai\ai_main.c:1593]: (style) Local variable 'soundfile' shadows outer variable
[src\ai\ai_main.c:1038] -> [src\ai\ai_main.c:1750]: (style) Local variable 'dist' shadows outer variable
[src\ai\ai_navigation.c:333]: (error) Array 'check[3]' accessed at index 3, which is out of bounds.
[src\ai\ai_navigation.c:336] -> [src\ai\ai_navigation.c:363]: (warning) Either the condition 'c<4' is redundant or the array 'check[3]' is accessed at index 3, which is out of bounds.
[src\g_local.h:1033] -> [src\ai\ai_navigation.c:274]: (style) Local variable 'range' shadows outer function
[src\ai\ai_weapons.c:127]: (error) Array 'AIWeapons[9]' accessed at index 9, which is out of bounds.
[src\ai\ai_weapons.c:128]: (error) Array 'AIWeapons[9]' accessed at index 9, which is out of bounds.
[src\ai\ai_weapons.c:129]: (error) Array 'AIWeapons[9]' accessed at index 9, which is out of bounds.
[src\ai\ai_weapons.c:130]: (error) Array 'AIWeapons[9]' accessed at index 9, which is out of bounds.
[src\ai\ai_weapons.c:131]: (error) Array 'AIWeapons[9]' accessed at index 9, which is out of bounds.
[src\ai\ai_weapons.c:132]: (error) Array 'AIWeapons[9]' accessed at index 9, which is out of bounds.
[src\ai\ai_weapons.c:133]: (error) Array 'AIWeapons[9]' accessed at index 9, which is out of bounds.
[src\ai\bot_spawn.c:527] -> [src\ai\bot_spawn.c:527]: (warning) Either the condition '!bot->client' is redundant or there is possible null pointer dereference: bot->client.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions