void-packages/srcpkgs/xplanet/patches/fix-gcc6-nullptr.patch
Đoàn Trần Công Danh 3353bf4722 srcpkgs/x*: 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

119 lines
4.9 KiB
Diff

--- a/src/libannotate/addArcs.cpp 2013-02-16 20:37:45.000000000 +0100
+++ b/src/libannotate/addArcs.cpp 2016-09-23 11:12:28.243514027 +0200
@@ -258,7 +258,7 @@
{
ifstream inFile(arcFile.c_str());
char *line = new char[MAX_LINE_LENGTH];
- while (inFile.getline (line, MAX_LINE_LENGTH, '\n') != NULL)
+ while (inFile.getline (line, MAX_LINE_LENGTH, '\n'))
readArcFile(line, planet, view, projection,
planetProperties, annotationMap);
@@ -291,8 +291,8 @@
if (foundFile)
{
ifstream inFile(arcFile.c_str());
- char *line = new char[256];
- while (inFile.getline (line, 256, '\n') != NULL)
+ char *line = new char[MAX_LINE_LENGTH];
+ while (inFile.getline (line, MAX_LINE_LENGTH, '\n'))
readArcFile(line, NULL, view, NULL, NULL, annotationMap);
inFile.close();
--- a/src/libannotate/addMarkers.cpp 2013-02-16 20:37:45.000000000 +0100
+++ b/src/libannotate/addMarkers.cpp 2016-09-23 11:15:29.932640115 +0200
@@ -429,7 +429,7 @@
{
ifstream inFile(markerFile.c_str());
char *line = new char[MAX_LINE_LENGTH];
- while (inFile.getline (line, MAX_LINE_LENGTH, '\n') != NULL)
+ while (inFile.getline (line, MAX_LINE_LENGTH, '\n'))
{
unsigned char color[3];
memcpy(color, planetProperties->MarkerColor(), 3);
@@ -475,7 +475,7 @@
{
ifstream inFile(markerFile.c_str());
char *line = new char[MAX_LINE_LENGTH];
- while (inFile.getline (line, MAX_LINE_LENGTH, '\n') != NULL)
+ while (inFile.getline (line, MAX_LINE_LENGTH, '\n'))
{
unsigned char color[3];
memcpy(color, options->Color(), 3);
--- a/src/libannotate/addSatellites.cpp 2013-02-16 20:37:45.000000000 +0100
+++ b/src/libannotate/addSatellites.cpp 2016-09-23 11:18:06.052752831 +0200
@@ -488,10 +488,9 @@
{
ifstream inFile(tleFile.c_str());
char lines[3][80];
- while (inFile.getline(lines[0], 80) != NULL)
+ while (inFile.getline(lines[0], 80))
{
- if ((inFile.getline(lines[1], 80) == NULL)
- || (inFile.getline(lines[2], 80) == NULL))
+ if (!inFile.getline(lines[1], 80) || !inFile.getline(lines[2], 80))
{
ostringstream errStr;
errStr << "Malformed TLE file (" << tleFile << ")?\n";
@@ -542,7 +541,7 @@
{
ifstream inFile(satFile.c_str());
char *line = new char[MAX_LINE_LENGTH];
- while (inFile.getline (line, MAX_LINE_LENGTH, '\n') != NULL)
+ while (inFile.getline (line, MAX_LINE_LENGTH, '\n'))
readSatelliteFile(line, planet, view, projection,
planetProperties, annotationMap);
--- a/src/libmultiple/drawStars.cpp 2013-02-16 20:37:45.000000000 +0100
+++ b/src/libmultiple/drawStars.cpp 2016-09-23 11:20:16.747849925 +0200
@@ -41,7 +41,7 @@
ifstream inFile(starMap.c_str());
char line[MAX_LINE_LENGTH];
- while (inFile.getline(line, MAX_LINE_LENGTH, '\n') != NULL)
+ while (inFile.getline(line, MAX_LINE_LENGTH, '\n'))
{
if (line[0] == '#') continue;
--- a/src/libmultiple/RayleighScattering.cpp 2013-02-16 20:37:45.000000000 +0100
+++ b/src/libmultiple/RayleighScattering.cpp 2016-09-23 11:22:16.158937255 +0200
@@ -369,7 +369,7 @@
diskTemplate_.clear();
limbTemplate_.clear();
- while (inFile.getline(line, MAX_LINE_LENGTH, '\n') != NULL)
+ while (inFile.getline(line, MAX_LINE_LENGTH, '\n'))
{
int i = 0;
while (isDelimiter(line[i]))
@@ -439,7 +439,7 @@
values.clear();
char line[MAX_LINE_LENGTH];
- while (inFile.getline(line, MAX_LINE_LENGTH, '\n') != NULL)
+ while (inFile.getline(line, MAX_LINE_LENGTH, '\n'))
{
int i = 0;
while (isDelimiter(line[i]))
@@ -470,7 +470,7 @@
double &value)
{
char line[MAX_LINE_LENGTH];
- while (inFile.getline(line, MAX_LINE_LENGTH, '\n') != NULL)
+ while (inFile.getline(line, MAX_LINE_LENGTH, '\n'))
{
int i = 0;
while (isDelimiter(line[i]))
--- a/src/readConfig.cpp 2013-02-16 20:37:47.000000000 +0100
+++ b/src/readConfig.cpp 2016-09-23 11:24:13.950022143 +0200
@@ -549,8 +549,8 @@
currentProperties = defaultProperties;
ifstream inFile(configFile.c_str());
- char *line = new char[256];
- while (inFile.getline(line, 256, '\n') != NULL)
+ char *line = new char[MAX_LINE_LENGTH];
+ while (inFile.getline(line, MAX_LINE_LENGTH, '\n'))
readConfig(line, planetProperties);
// This condition will only be true if [default] is the only