void-packages/srcpkgs/CoinMP/patches/fix-gcc9.1-strncpy.patch
Đoàn Trần Công Danh ec4c2d75fa srcpkgs/[A-Z]*: 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

19 lines
632 B
Diff

--- a/CoinMP/src/CoinProblem.c 2011-11-03 04:43:29.000000000 +0100
+++ b/CoinMP/src/CoinProblem.c 2019-05-20 12:06:36.762510299 +0200
@@ -126,14 +126,8 @@
void coinSetProblemName(PPROBLEM pProblem, const char *ProblemName)
{
- size_t len;
-
- len = strlen(ProblemName);
- if (len >= sizeof(pProblem->ProblemName)) {
- len = sizeof(pProblem->ProblemName) - 1;
- }
- strncpy(pProblem->ProblemName, ProblemName, len);
- pProblem->ProblemName[len] = '\0';
+ snprintf(pProblem->ProblemName, sizeof(pProblem->ProblemName), "%s", ProblemName);
+ pProblem->ProblemName[sizeof(pProblem->ProblemName) - 1] = '\0';
}