Skip to content

Commit

Permalink
Fixed: Erroneous use of sizeof() instead of strlen()
Browse files Browse the repository at this point in the history
Also fixed a few more warnings from clang regarding potentially
dangling else.
  • Loading branch information
skyjake committed Jul 26, 2012
1 parent 7c8fa19 commit d09e4c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doomsday/engine/portable/src/def_main.c
Expand Up @@ -619,7 +619,7 @@ const char* Def_GetFlagTextByPrefixVal(const char* prefix, int val)
int i;

for(i = defs.count.flags.num - 1; i >= 0; i--)
if(strnicmp(defs.flags[i].id, prefix, sizeof(prefix)) == 0 &&
if(strnicmp(defs.flags[i].id, prefix, strlen(prefix)) == 0 &&
defs.flags[i].value == val)
return defs.flags[i].text;

Expand Down
6 changes: 4 additions & 2 deletions doomsday/engine/portable/src/pathdirectory.c
Expand Up @@ -373,7 +373,8 @@ static int iteratePathsInHash(pathdirectory_pathhash_t* ph, int flags, PathDirec
PathDirectoryNode* node, *next;
int result = 0;

if(ph)
if(!ph) return 0;

if(hash != PATHDIRECTORY_NOHASH)
{
if(hash >= PATHDIRECTORY_PATHHASH_SIZE)
Expand Down Expand Up @@ -436,7 +437,8 @@ static int iteratePathsInHash_Const(const pathdirectory_pathhash_t* ph, int flag
PathDirectoryNode* node, *next;
int result = 0;

if(ph)
if(!ph) return 0;

if(hash != PATHDIRECTORY_NOHASH)
{
if(hash >= PATHDIRECTORY_PATHHASH_SIZE)
Expand Down

0 comments on commit d09e4c9

Please sign in to comment.