svn commit: r431547 - in head/games/openbor: . files
Jan Beich
jbeich at FreeBSD.org
Sun Jan 15 11:31:26 UTC 2017
Author: jbeich
Date: Sun Jan 15 11:31:24 2017
New Revision: 431547
URL: https://svnweb.freebsd.org/changeset/ports/431547
Log:
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)
^~~
Added:
head/games/openbor/files/patch-source_gamelib_packfile.c (contents, props changed)
head/games/openbor/files/patch-source_scriptlib_Parser.c (contents, props changed)
Modified:
head/games/openbor/Makefile (contents, props changed)
head/games/openbor/files/patch-openbor.c (contents, props changed)
Modified: head/games/openbor/Makefile
==============================================================================
--- head/games/openbor/Makefile Sun Jan 15 11:29:26 2017 (r431546)
+++ head/games/openbor/Makefile Sun Jan 15 11:31:24 2017 (r431547)
@@ -2,6 +2,7 @@
PORTNAME= openbor
PORTVERSION= 3.0.r4426
+PORTREVISION= 1
CATEGORIES= games
MASTER_SITES= LOCAL/jbeich \
https://svn.code.sf.net/p/${PORTNAME}/engine/engine/:svn
@@ -24,7 +25,7 @@ MAKE_ENV= BUILD_LINUX=1 SDKPATH="${LOCAL
GCC_TARGET="${CONFIGURE_TARGET:S/amd64/x86_64/}"
MAKE_ARGS= CC="${CC}" LIBRARIES="${LOCALBASE}/lib" \
TARGET_ARCH=${ARCH:S/i386/x86/} ARCHFLAGS="" \
- TARGET_FINAL='${TARGET}' BUILD_MMX=""
+ TARGET_FINAL='${TARGET}' BUILD_MMX="" ECHO="${ECHO}"
CFLAGS+= -fgnu89-inline ${CFLAGS_${OPSYS}}
CFLAGS_DragonFly= -D_GCC_MAX_ALIGN_T # system stddef.h
LDFLAGS+= -Wl,--as-needed # ogg, pthread, zlib
@@ -91,9 +92,9 @@ post-patch:
@${REINPLACE_CMD} -e 's/ -O[0-9]//; s/ -g//; s/ -Werror//' \
-e 's/ -fomit-frame-pointer//' \
-e 's/ -freorder-blocks//' \
- -e 's/ -Wno-unused-result//' \
-e 's/ -Wl,-rpath,$$(LIBRARIES)//' \
-e '/echo/!s/ @/ /' \
+ -e 's/@echo/@$$(ECHO)/' \
-e 's/$$(LIBS)/$$(LDFLAGS) &/' \
${WRKSRC}/Makefile
@${GREP} -Flr 'malloc.h' ${WRKSRC} | ${XARGS} ${REINPLACE_CMD} \
Modified: head/games/openbor/files/patch-openbor.c
==============================================================================
--- head/games/openbor/files/patch-openbor.c Sun Jan 15 11:29:26 2017 (r431546)
+++ head/games/openbor/files/patch-openbor.c Sun Jan 15 11:31:24 2017 (r431547)
@@ -1,4 +1,6 @@
Fix potential crashes found by ASan/Clang/GCC
+Fix an infinite loop in lcmScriptDeleteMain()
+Avoid accidental rounding from abs()
--- openbor.c.orig 2016-12-22 13:02:02 UTC
+++ openbor.c
@@ -20,6 +22,16 @@ Fix potential crashes found by ASan/Clan
// Allocate memory and get pointer.
result = malloc(alloc_size);
+@@ -8204,7 +8204,8 @@ size_t lcmScriptCopyBuffer(ArgList *argl
+
+ size_t lcmScriptDeleteMain(char **buf)
+ {
+- size_t len = 0, i = 0;
++ size_t len = 0;
++ int i = 0;
+ ptrdiff_t pos = 0;
+ char *newbuf = NULL;
+
@@ -13933,7 +13933,7 @@ void generate_basemap(int map_index, flo
void load_level(char *filename)
@@ -50,6 +62,26 @@ Fix potential crashes found by ASan/Clan
{
iDot_time = self->dot_time[iIndex]; //Get expire time.
iDot_cnt = self->dot_cnt[iIndex]; //Get next tick time.
+@@ -21710,8 +21716,8 @@ int reset_backpain(entity *ent)
+ if (ent->normaldamageflipdir == DIRECTION_RIGHT) ent->direction = DIRECTION_RIGHT;
+ else ent->direction = DIRECTION_LEFT;
+
+- if(ent->direction == DIRECTION_RIGHT) ent->velocity.x = -1*abs(ent->velocity.x);
+- else ent->velocity.x = abs(ent->velocity.x);
++ if(ent->direction == DIRECTION_RIGHT) ent->velocity.x = -1*ABS(ent->velocity.x);
++ else ent->velocity.x = ABS(ent->velocity.x);
+
+ return 1;
+ }
+@@ -25831,7 +25837,7 @@ int common_try_wander(entity *target, in
+ mod = -mod;
+ }
+ //if ((self->sortid / 100) % 2)
+- if (abs(rand32()) % 2)
++ if (rand32() % 2)
+ {
+ mod = 3 - mod;
+ }
@@ -34607,7 +34612,7 @@ void keyboard_setup(int player)
strncpy(buttonnames[SDID_SPECIAL], "Special", 16);
strncpy(buttonnames[SDID_START], "Start", 16);
Added: head/games/openbor/files/patch-source_gamelib_packfile.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/games/openbor/files/patch-source_gamelib_packfile.c Sun Jan 15 11:31:24 2017 (r431547)
@@ -0,0 +1,13 @@
+Reset seek position for BGM with more than 64 tracks
+
+--- source/gamelib/packfile.c.orig 2015-04-18 21:22:03 UTC
++++ source/gamelib/packfile.c
+@@ -1399,7 +1399,7 @@ void packfile_music_read(fileliststruct
+ getBasePath(packfile, filelist[i].filename, 1);
+ if(stristr(packfile, ".pak"))
+ {
+- memset(filelist[i].bgmTracks, 0, 256);
++ memset(filelist[i].bgmTracks, 0, sizeof(filelist[i].bgmTracks));
+ filelist[i].nTracks = 0;
+ fd = fopen(packfile, "rb");
+ if(fd == NULL)
Added: head/games/openbor/files/patch-source_scriptlib_Parser.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/games/openbor/files/patch-source_scriptlib_Parser.c Sun Jan 15 11:31:24 2017 (r431547)
@@ -0,0 +1,13 @@
+Make room for terminating NUL added by sprintf()
+
+--- source/scriptlib/Parser.c.orig 2016-12-15 02:16:03 UTC
++++ source/scriptlib/Parser.c
+@@ -1828,7 +1828,7 @@ void Parser_Mult_expr2(Parser *pparser )
+
+ void Parser_Unary_expr(Parser *pparser )
+ {
+- static CHAR buf[MAX_TOKEN_LENGTH + 1];
++ static CHAR buf[MAX_TOKEN_LENGTH + 2];
+ Instruction *pInstruction = NULL;
+
+ if (ParserSet_First(&(pparser->theParserSet), postfix_expr, pparser->theNextToken.theType ))
More information about the svn-ports-all
mailing list