void-packages/srcpkgs/ufoai/patches/fix-gcc6.patch

40 lines
1.5 KiB
Diff

With gcc6 this logic error needs to be fixed. I think
the intention here was to continue, if FS_CheckFile() fails.
--- src/client/battlescape/events/e_main.cpp 2014-06-05 06:18:39.000000000 +0200
+++ src/client/battlescape/events/e_main.cpp 2017-01-25 16:18:47.764221448 +0100
@@ -221,7 +221,7 @@
return sound;
for (int i = 1; i <= 99; i++) {
- if (!FS_CheckFile("sounds/%s%02i", sound, i) == -1)
+ if (!FS_CheckFile("sounds/%s%02i", sound, i))
continue;
sound[length] = '\0';
Q_strcat(sound, size, "%02i", rand() % i + 1);
With gcc6 the checks for narrowing integer types are very strict.
Explicitly cast the flag combinations to int.
--- src/client/battlescape/cl_particle.cpp 2014-06-05 06:18:39.000000000 +0200
+++ src/client/battlescape/cl_particle.cpp 2017-01-25 16:23:44.737146135 +0100
@@ -144,12 +144,17 @@
V_UNTYPED, V_UNTYPED, V_UNTYPED,
V_VECS, V_VECS,
V_VECS, V_VECS,
- PTL_ONLY_ONE_TYPE | V_FLOAT, PTL_ONLY_ONE_TYPE | V_FLOAT, PTL_ONLY_ONE_TYPE | V_FLOAT,
+ static_cast<int>(PTL_ONLY_ONE_TYPE | V_FLOAT),
+ static_cast<int>(PTL_ONLY_ONE_TYPE | V_FLOAT),
+ static_cast<int>(PTL_ONLY_ONE_TYPE | V_FLOAT),
V_VECS, V_VECS,
0, 0, 0,
0,
- PTL_ONLY_ONE_TYPE | V_STRING, PTL_ONLY_ONE_TYPE | V_STRING, PTL_ONLY_ONE_TYPE | V_STRING, PTL_ONLY_ONE_TYPE | V_STRING
+ static_cast<int>(PTL_ONLY_ONE_TYPE | V_STRING),
+ static_cast<int>(PTL_ONLY_ONE_TYPE | V_STRING),
+ static_cast<int>(PTL_ONLY_ONE_TYPE | V_STRING),
+ static_cast<int>(PTL_ONLY_ONE_TYPE | V_STRING)
};
CASSERT(lengthof(pc_types) == PC_NUM_PTLCMDS);