[ioquake3] 18/33: [qcommon] Use unsigned types where wrapping arithmetic is intended
Simon McVittie
smcv at debian.org
Mon Oct 30 14:00:27 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository ioquake3.
commit b3223dcfcb83d7054eb232af3bd4ea50827558ad
Author: Thomas Köppe <tkoeppe at google.com>
Date: Tue Oct 3 01:46:37 2017 +0100
[qcommon] Use unsigned types where wrapping arithmetic is intended
The use of signed types in these expressions lead to overflow, hence undefined behaviour. The "sum" aggregator in Com_TouchMemory isn't even used (and presumbably just exists to inhibit optimizations from removing the memory access).
---
code/qcommon/common.c | 2 +-
code/qcommon/q_math.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/code/qcommon/common.c b/code/qcommon/common.c
index fd9f9b1..40fbde0 100644
--- a/code/qcommon/common.c
+++ b/code/qcommon/common.c
@@ -1376,7 +1376,7 @@ Touch all known used data to make sure it is paged in
void Com_TouchMemory( void ) {
int start, end;
int i, j;
- int sum;
+ unsigned sum;
memblock_t *block;
Z_CheckHeap();
diff --git a/code/qcommon/q_math.c b/code/qcommon/q_math.c
index ce47317..3938225 100644
--- a/code/qcommon/q_math.c
+++ b/code/qcommon/q_math.c
@@ -148,7 +148,7 @@ vec3_t bytedirs[NUMVERTEXNORMALS] =
//==============================================================
int Q_rand( int *seed ) {
- *seed = (69069 * *seed + 1);
+ *seed = (69069U * *seed + 1U);
return *seed;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git
More information about the Pkg-games-commits
mailing list