HomeFreeBSD

games/openbor: warnings

Description

games/openbor: warnings

  • With make -s only compiler warnings are allowed to break silence
  • -Wno-unsued-result is no longer fatal after 9.x EOL

source/gamelib/packfile.c: In function 'packfile_music_read':
source/gamelib/packfile.c:1402:13: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]

memset(filelist[i].bgmTracks, 0, 256);
^~~~~~

source/scriptlib/Parser.c: In function 'Parser_Unary_expr':
source/scriptlib/Parser.c:1879:30: warning: may write a terminating nul past the end of the destination [-Wformat-length=]

sprintf(buf, "-%s", pInstruction->theToken->theSource);
              ~~~^

source/scriptlib/Parser.c:1879:13: note: format output between 2 and 129 bytes into a destination ofsize 128

sprintf(buf, "-%s", pInstruction->theToken->theSource);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

source/scriptlib/Parser.c:1906:30: warning: may write a terminating nul past the end of the destination [-Wformat-length=]

sprintf(buf, "!%s", pInstruction->theToken->theSource);
              ~~~^

source/scriptlib/Parser.c:1906:13: note: format output between 2 and 129 bytes into a destination ofsize 128

sprintf(buf, "!%s", pInstruction->theToken->theSource);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

openbor.c:8224:26: warning: comparison of unsigned expression >= 0 is always true

[-Wtautological-compare]
  for(i = len-1; i >= 0; i--)
                 ~ ^  ~

openbor.c:21719:68: warning: using integer absolute value function 'abs' when argument is of floating

point type [-Wabsolute-value]
  if(ent->direction == DIRECTION_RIGHT) ent->velocity.x = -1*abs(ent->velocity.x);
                                                             ^

openbor.c:21719:68: note: use function 'fabsf' instead

if(ent->direction == DIRECTION_RIGHT) ent->velocity.x = -1*abs(ent->velocity.x);
                                                           ^~~
                                                           fabsf

openbor.c:21720:32: warning: using integer absolute value function 'abs' when argument is of floating

point type [-Wabsolute-value]
  else ent->velocity.x = abs(ent->velocity.x);
                         ^

openbor.c:21720:32: note: use function 'fabsf' instead

else ent->velocity.x = abs(ent->velocity.x);
                       ^~~
                       fabsf

openbor.c:25840:9: warning: taking the absolute value of unsigned type 'unsigned int' has no effect

  [-Wabsolute-value]
if (abs(rand32()) % 2)
    ^

openbor.c:25840:9: note: remove the call to 'abs' since unsigned values cannot be negative

if (abs(rand32()) % 2)
    ^~~

Details

Provenance
jbeichAuthored on
Parents
rP431546: MFH: r431457
Branches
Unknown
Tags
Unknown