From owner-svn-ports-head@freebsd.org Sun Jan 15 11:31:26 2017 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0A62ECB03C7; Sun, 15 Jan 2017 11:31:26 +0000 (UTC) (envelope-from jbeich@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B82DA1DD4; Sun, 15 Jan 2017 11:31:25 +0000 (UTC) (envelope-from jbeich@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0FBVO8F020404; Sun, 15 Jan 2017 11:31:24 GMT (envelope-from jbeich@FreeBSD.org) Received: (from jbeich@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0FBVOvI020400; Sun, 15 Jan 2017 11:31:24 GMT (envelope-from jbeich@FreeBSD.org) Message-Id: <201701151131.v0FBVOvI020400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jbeich set sender to jbeich@FreeBSD.org using -f From: Jan Beich Date: Sun, 15 Jan 2017 11:31:24 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r431547 - in head/games/openbor: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jan 2017 11:31:26 -0000 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 ))