summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2018-04-16 23:48:19 +0200
committerGitHub <noreply@github.com>2018-04-16 23:48:19 +0200
commit88be2413ce0f82859eec83e29ceed000756240f2 (patch)
treebb9014cb64968932c7029da4ba1b701ccc5ee130 /src
parenta72117111e8cf7add8b3af38f53897e12ee89223 (diff)
downloadopenttd-88be2413ce0f82859eec83e29ceed000756240f2.tar.xz
Codechange #6729: mute bogus GCC 7 warning (#6733)
We do a memset of (byte - byte), which strictly seen ranges from -254 .. 255, for which GCC warns. But just before this memset is an if() which says the first byte has to be bigger than the second. So this is a bogus warning.
Diffstat (limited to 'src')
-rw-r--r--src/newgrf.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index d06d1c40a..5b1713709 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -1971,12 +1971,12 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, Byte
if (length == 0 || number == 0) break;
if (length > statspec->lengths) {
+ byte diff_length = length - statspec->lengths;
statspec->platforms = ReallocT(statspec->platforms, length);
- memset(statspec->platforms + statspec->lengths, 0, length - statspec->lengths);
+ memset(statspec->platforms + statspec->lengths, 0, diff_length);
statspec->layouts = ReallocT(statspec->layouts, length);
- memset(statspec->layouts + statspec->lengths, 0,
- (length - statspec->lengths) * sizeof(*statspec->layouts));
+ memset(statspec->layouts + statspec->lengths, 0, diff_length * sizeof(*statspec->layouts));
statspec->lengths = length;
}