void-packages/srcpkgs/ufoai/patches/fix-gcc6.patch
Đoàn Trần Công Danh 5769f150de srcpkgs/u*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

39 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.
--- a/src/client/battlescape/events/e_main.cpp 2014-06-05 06:18:39.000000000 +0200
+++ b/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.
--- a/src/client/battlescape/cl_particle.cpp 2014-06-05 06:18:39.000000000 +0200
+++ b/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);