pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

wip/xplanet: import from pkgsrc.



Module Name:	pkgsrc-wip
Committed By:	ng0 <ng0%NetBSD.org@localhost>
Pushed By:	ng0
Date:		Fri Aug 30 13:17:44 2019 +0000
Changeset:	735dd5384d3a50d1b6b129961772e939c2af5f14

Added Files:
	xplanet/DESCR
	xplanet/Makefile
	xplanet/PLIST
	xplanet/TODO
	xplanet/distinfo
	xplanet/options.mk
	xplanet/patches/patch-src_libannotate_addArcs.cpp
	xplanet/patches/patch-src_libannotate_addMarkers.cpp
	xplanet/patches/patch-src_libannotate_addSatellites.cpp
	xplanet/patches/patch-src_libdisplay_DisplayOutput.cpp
	xplanet/patches/patch-src_libimage_gif.c
	xplanet/patches/patch-src_libmultiple_RayleighScattering.cpp
	xplanet/patches/patch-src_libmultiple_drawStars.cpp
	xplanet/patches/patch-src_readConfig-fixclang.cpp
	xplanet/patches/patch-src_readConfig.cpp
	xplanet/patches/patch-src_xpUtil-Add2017LeapSecond.cpp

Log Message:
wip/xplanet: import from pkgsrc.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=735dd5384d3a50d1b6b129961772e939c2af5f14

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 xplanet/DESCR                                      |  9 +++
 xplanet/Makefile                                   | 26 +++++++
 xplanet/PLIST                                      | 49 ++++++++++++
 xplanet/TODO                                       |  2 +
 xplanet/distinfo                                   | 16 ++++
 xplanet/options.mk                                 | 21 +++++
 xplanet/patches/patch-src_libannotate_addArcs.cpp  | 40 ++++++++++
 .../patches/patch-src_libannotate_addMarkers.cpp   | 47 +++++++++++
 .../patch-src_libannotate_addSatellites.cpp        | 50 ++++++++++++
 .../patches/patch-src_libdisplay_DisplayOutput.cpp | 16 ++++
 xplanet/patches/patch-src_libimage_gif.c           | 56 +++++++++++++
 .../patch-src_libmultiple_RayleighScattering.cpp   | 46 +++++++++++
 .../patches/patch-src_libmultiple_drawStars.cpp    | 18 +++++
 xplanet/patches/patch-src_readConfig-fixclang.cpp  | 91 ++++++++++++++++++++++
 xplanet/patches/patch-src_readConfig.cpp           | 20 +++++
 .../patches/patch-src_xpUtil-Add2017LeapSecond.cpp | 15 ++++
 16 files changed, 522 insertions(+)

diffs:
diff --git a/xplanet/DESCR b/xplanet/DESCR
new file mode 100644
index 0000000000..5ba742b2fd
--- /dev/null
+++ b/xplanet/DESCR
@@ -0,0 +1,9 @@
+From the home page:
+
+Xplanet is similar to Xearth, where an image of the earth is rendered
+into an X window.  Xplanet can display several different map
+projections, including Azimuthal, Mercator, Mollweide, orthographic,
+or rectangular, as well as a window with a globe the user can rotate
+interactively.  The other planets and some satellites may also be
+displayed.  The latest version can always be found at
+http://xplanet.sourceforge.net.
diff --git a/xplanet/Makefile b/xplanet/Makefile
new file mode 100644
index 0000000000..6f6c2dfd9b
--- /dev/null
+++ b/xplanet/Makefile
@@ -0,0 +1,26 @@
+# $NetBSD: Makefile,v 1.90 2019/08/11 15:38:22 ng0 Exp $
+
+DISTNAME=	xplanet-1.3.1
+CATEGORIES=	x11
+MASTER_SITES=	${MASTER_SITE_SOURCEFORGE:=xplanet/}
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=	http://xplanet.sourceforge.net/
+COMMENT=	Rotating rendered map of the Earth in X11 root window
+LICENSE=	gnu-gpl-v2
+
+USE_LANGUAGES=		c c++11
+GNU_CONFIGURE=		yes
+USE_TOOLS+=		perl
+MAKE_ENV+=		PERL5=${PERL5:Q}
+
+.include "options.mk"
+
+.include "../../mk/jpeg.buildlink3.mk"
+.include "../../graphics/freetype2/buildlink3.mk"
+.include "../../graphics/giflib/buildlink3.mk"
+.include "../../graphics/netpbm/buildlink3.mk"
+.include "../../graphics/png/buildlink3.mk"
+.include "../../graphics/tiff/buildlink3.mk"
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/xplanet/PLIST b/xplanet/PLIST
new file mode 100644
index 0000000000..c12cd3b211
--- /dev/null
+++ b/xplanet/PLIST
@@ -0,0 +1,49 @@
+@comment $NetBSD: PLIST,v 1.10 2018/02/13 12:45:02 ryoon Exp $
+bin/xplanet
+man/man1/xplanet.1
+share/xplanet/arcs/README
+share/xplanet/arcs/constellations
+share/xplanet/config/README
+share/xplanet/config/default
+share/xplanet/config/earth_markers
+share/xplanet/config/moon_orbit
+share/xplanet/config/overlay_clouds
+share/xplanet/ephemeris/README
+share/xplanet/fonts/FreeMonoBold.ttf
+share/xplanet/fonts/README
+share/xplanet/images/README
+share/xplanet/images/earth.jpg
+share/xplanet/images/hubble.png
+share/xplanet/images/iss.png
+share/xplanet/images/mgs.png
+share/xplanet/images/night.jpg
+share/xplanet/images/odyssey.png
+share/xplanet/images/shuttle.png
+share/xplanet/images/smile.png
+share/xplanet/images/sublunar.png
+share/xplanet/images/subsolar.png
+share/xplanet/images/sun.jpg
+share/xplanet/markers/README
+share/xplanet/markers/brightStars
+share/xplanet/markers/earth
+share/xplanet/markers/mars
+share/xplanet/markers/moon
+share/xplanet/origin/README
+share/xplanet/origin/cassini
+share/xplanet/origin/galileo
+share/xplanet/rgb.txt
+share/xplanet/satellites/README
+share/xplanet/satellites/iss
+share/xplanet/satellites/iss.tle
+share/xplanet/scattering/README
+share/xplanet/scattering/earthRayleigh
+share/xplanet/spice/README
+share/xplanet/spice/asteroids
+share/xplanet/spice/asteroids.krn
+share/xplanet/spice/cassini
+share/xplanet/spice/cassini.krn
+share/xplanet/spice/mgs
+share/xplanet/spice/mgs.krn
+share/xplanet/spice/voyager
+share/xplanet/spice/voyager.krn
+share/xplanet/stars/BSC
diff --git a/xplanet/TODO b/xplanet/TODO
new file mode 100644
index 0000000000..e5139f7fdd
--- /dev/null
+++ b/xplanet/TODO
@@ -0,0 +1,2 @@
+configure: WARNING: *** Native PNM support will not be included ***
+configure: WARNING: *** Xplanet will be built without SPICE support ***
diff --git a/xplanet/distinfo b/xplanet/distinfo
new file mode 100644
index 0000000000..8351eff5e4
--- /dev/null
+++ b/xplanet/distinfo
@@ -0,0 +1,16 @@
+$NetBSD: distinfo,v 1.22 2019/08/11 15:38:22 ng0 Exp $
+
+SHA1 (xplanet-1.3.1.tar.gz) = e711dc5a561f83d5bafcc4e47094addfd1806af7
+RMD160 (xplanet-1.3.1.tar.gz) = 7fb853538392fd871aeae44703d4f18af25ba682
+SHA512 (xplanet-1.3.1.tar.gz) = 06ce3187fbd364f4ccee768fceca559690c905c870e2fb25ca32453ce09c564ba3455ec539f1e3da177de23a0611f767b375efe2e10b601d09313c0d068e35e0
+Size (xplanet-1.3.1.tar.gz) = 1236035 bytes
+SHA1 (patch-src_libannotate_addArcs.cpp) = 5d2ba7c0df6989e0b0b838fccbc73fe7a17ba91c
+SHA1 (patch-src_libannotate_addMarkers.cpp) = eea1329b61961c47ff9e039961cc6c55db9bd507
+SHA1 (patch-src_libannotate_addSatellites.cpp) = 7c8976a3e88ebac7e4d9b59a38f98f87b9d04f57
+SHA1 (patch-src_libdisplay_DisplayOutput.cpp) = aa893648e1bcb22ff0ef19a141aff1f4910c89c4
+SHA1 (patch-src_libimage_gif.c) = 09910473fb33483b04f81f909df3499963cafe43
+SHA1 (patch-src_libmultiple_RayleighScattering.cpp) = 3a64033dc0c6915c9cd2eed2e506dd4c802138c9
+SHA1 (patch-src_libmultiple_drawStars.cpp) = b6a3f3995f4f1ac77660fdad64524ef6a48c4d50
+SHA1 (patch-src_readConfig-fixclang.cpp) = d24cfc6f832e9445f8c968a75e4eb0a7688b0c84
+SHA1 (patch-src_readConfig.cpp) = c1a46209dfcbb6a37b6c7ff90f633a6450fbd5d9
+SHA1 (patch-src_xpUtil-Add2017LeapSecond.cpp) = 4dc7d99c10ec55d39be5065a384d3a6faeb0cfa3
diff --git a/xplanet/options.mk b/xplanet/options.mk
new file mode 100644
index 0000000000..2cd5a0e5eb
--- /dev/null
+++ b/xplanet/options.mk
@@ -0,0 +1,21 @@
+# $NetBSD: options.mk,v 1.1 2009/07/22 13:37:06 wiz Exp $
+
+PKG_OPTIONS_VAR=	PKG_OPTIONS.xplanet
+PKG_SUPPORTED_OPTIONS=	x11
+PKG_SUGGESTED_OPTIONS=	x11
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Mx11)
+# for pango pkg-config is required
+USE_TOOLS+=	pkg-config
+
+.include "../../devel/pango/buildlink3.mk"
+.include "../../x11/libX11/buildlink3.mk"
+BUILDLINK_DEPMETHOD.libXt?=	build
+.include "../../x11/libXt/buildlink3.mk"
+.else
+CONFIGURE_ARGS+=	--disable-pango
+CONFIGURE_ARGS+=	--without-x
+CONFIGURE_ARGS+=	--without-xscreensaver
+.endif
diff --git a/xplanet/patches/patch-src_libannotate_addArcs.cpp b/xplanet/patches/patch-src_libannotate_addArcs.cpp
new file mode 100644
index 0000000000..00c5e3134e
--- /dev/null
+++ b/xplanet/patches/patch-src_libannotate_addArcs.cpp
@@ -0,0 +1,40 @@
+$NetBSD: patch-src_libannotate_addArcs.cpp,v 1.1 2018/02/13 12:45:02 ryoon Exp $
+
+--- src/libannotate/addArcs.cpp.orig	2008-11-13 23:43:42.000000000 +0000
++++ src/libannotate/addArcs.cpp
+@@ -258,10 +258,14 @@ addArcs(PlanetProperties *planetProperti
+         {
+             ifstream inFile(arcFile.c_str());
+             char *line = new char[MAX_LINE_LENGTH];
+-            while (inFile.getline (line, MAX_LINE_LENGTH, '\n') != NULL)
+-                readArcFile(line, planet, view, projection,
+-                            planetProperties, annotationMap);
+-            
++	    while (1)
++	    {
++		inFile.getline (line, MAX_LINE_LENGTH, '\n');
++ 		if (inFile.eof() || inFile.fail())
++		    break;
++		readArcFile(line, planet, view, projection,
++			    planetProperties, annotationMap);
++	    }            
+             inFile.close();
+             delete [] line;
+         }
+@@ -292,9 +296,13 @@ addArcs(View *view, multimap<double, Ann
+         {
+             ifstream inFile(arcFile.c_str());
+             char *line = new char[256];
+-            while (inFile.getline (line, 256, '\n') != NULL)
+-                readArcFile(line, NULL, view, NULL, NULL, annotationMap);
+-
++	    while (1)
++	    {
++		inFile.getline (line, 256, '\n');
++ 		if (inFile.eof() || inFile.fail())
++		    break;
++		readArcFile(line, NULL, view, NULL, NULL, annotationMap);
++	    }            
+             inFile.close();
+             delete [] line;
+         }
diff --git a/xplanet/patches/patch-src_libannotate_addMarkers.cpp b/xplanet/patches/patch-src_libannotate_addMarkers.cpp
new file mode 100644
index 0000000000..b53ccc600b
--- /dev/null
+++ b/xplanet/patches/patch-src_libannotate_addMarkers.cpp
@@ -0,0 +1,47 @@
+$NetBSD: patch-src_libannotate_addMarkers.cpp,v 1.1 2018/02/13 12:45:02 ryoon Exp $
+
+Multiple inFile.getline() calls within xplanet test the return
+against NULL in a read loop, but g++ 6 doesn't like this. Replace
+with checks for inFile.eof() and inFile.fail() instead.
+
+--- src/libannotate/addMarkers.cpp.orig	2011-11-15 01:44:24.000000000 +0000
++++ src/libannotate/addMarkers.cpp
+@@ -429,12 +429,16 @@ addMarkers(PlanetProperties *planetProperties, Planet *planet,
+         {
+             ifstream inFile(markerFile.c_str());
+             char *line = new char[MAX_LINE_LENGTH];
+-            while (inFile.getline (line, MAX_LINE_LENGTH, '\n') != NULL)
++            while (1)
+             {
+                 unsigned char color[3];
+                 memcpy(color, planetProperties->MarkerColor(), 3);
+                 string font(planetProperties->MarkerFont());
+                 int fontSize(planetProperties->MarkerFontSize());
++
++                inFile.getline (line, MAX_LINE_LENGTH, '\n');
++                if (inFile.eof() || inFile.fail())
++                    break;
+                 
+                 readMarkerFile(line, planet, pixel_radius, 
+                                view, projection, width, height, 
+@@ -475,13 +479,18 @@ addMarkers(View *view, const int width, const int height,
+         {
+             ifstream inFile(markerFile.c_str());
+             char *line = new char[MAX_LINE_LENGTH];
+-            while (inFile.getline (line, MAX_LINE_LENGTH, '\n') != NULL)
++            while (1)
+             {
++                inFile.getline (line, MAX_LINE_LENGTH, '\n');
++
+                 unsigned char color[3];
+                 memcpy(color, options->Color(), 3);
+                 string font(options->Font());
+                 int fontSize(options->FontSize());
+-                
++
++                if (inFile.eof() || inFile.fail())
++                    break;
++
+                 readMarkerFile(line, NULL, 0, 
+                                view, NULL, width, height, 
+                                color, font, fontSize, 1.0, 
diff --git a/xplanet/patches/patch-src_libannotate_addSatellites.cpp b/xplanet/patches/patch-src_libannotate_addSatellites.cpp
new file mode 100644
index 0000000000..0daaa07323
--- /dev/null
+++ b/xplanet/patches/patch-src_libannotate_addSatellites.cpp
@@ -0,0 +1,50 @@
+$NetBSD: patch-src_libannotate_addSatellites.cpp,v 1.1 2018/02/13 12:45:02 ryoon Exp $
+
+--- src/libannotate/addSatellites.cpp.orig	2010-07-30 21:49:06.000000000 +0000
++++ src/libannotate/addSatellites.cpp
+@@ -488,11 +488,23 @@ loadSatelliteVector(PlanetProperties *pl
+         {
+             ifstream inFile(tleFile.c_str());
+             char lines[3][80];
+-            while (inFile.getline(lines[0], 80) != NULL)
+-            {
+-                if ((inFile.getline(lines[1], 80) == NULL) 
+-                    || (inFile.getline(lines[2], 80) == NULL))
+-                {
++	    bool malformed_file = false;
++	    while (1)
++	    {
++                inFile.getline(lines[0], 80);
++ 		if (inFile.eof() || inFile.fail())
++		    break;
++		inFile.getline(lines[1], 80);
++ 		if (inFile.eof() || inFile.fail())
++		    malformed_file = true;
++		else
++		{
++                    inFile.getline(lines[2], 80);
++		    if (inFile.eof() || inFile.fail())
++		        malformed_file = true;
++                }
++		if (malformed_file)
++		{
+                     ostringstream errStr;
+                     errStr << "Malformed TLE file (" << tleFile << ")?\n";
+                     xpWarn(errStr.str(), __FILE__, __LINE__);
+@@ -542,10 +554,14 @@ addSatellites(PlanetProperties *planetPr
+         {
+             ifstream inFile(satFile.c_str());
+             char *line = new char[MAX_LINE_LENGTH];
+-            while (inFile.getline (line, MAX_LINE_LENGTH, '\n') != NULL)
++	    while (1)
++	    {
++		inFile.getline (line, MAX_LINE_LENGTH, '\n');
++ 		if (inFile.eof() || inFile.fail())
++		    break;
+                 readSatelliteFile(line, planet, view, projection,
+                                   planetProperties, annotationMap);
+-            
++            }
+             inFile.close();
+             delete [] line;
+         }
diff --git a/xplanet/patches/patch-src_libdisplay_DisplayOutput.cpp b/xplanet/patches/patch-src_libdisplay_DisplayOutput.cpp
new file mode 100644
index 0000000000..d17d9d3527
--- /dev/null
+++ b/xplanet/patches/patch-src_libdisplay_DisplayOutput.cpp
@@ -0,0 +1,16 @@
+$NetBSD$
+
+pick from https://sourceforge.net/p/xplanet/code/208/
+fix output bug when num_times is 2
+
+--- src/libdisplay/DisplayOutput.cpp~
++++ src/libdisplay/DisplayOutput.cpp
+@@ -51,7 +51,7 @@
+     string outputFilename = options->OutputBase();
+     int startIndex = options->OutputStartIndex();
+     int stopIndex = options->NumTimes() + startIndex - 1;
+-    if (stopIndex > 1)
++    if (stopIndex > 0)
+     {
+         const int digits = (int) (log10((double) stopIndex) + 1);
+         char buffer[64];
diff --git a/xplanet/patches/patch-src_libimage_gif.c b/xplanet/patches/patch-src_libimage_gif.c
new file mode 100644
index 0000000000..c16eeca233
--- /dev/null
+++ b/xplanet/patches/patch-src_libimage_gif.c
@@ -0,0 +1,56 @@
+$NetBSD: patch-src_libimage_gif.c,v 1.3 2014/05/25 09:18:06 obache Exp $
+
+* Fix build with giflib 5.1.
+
+--- src/libimage/gif.c.orig	2006-03-25 22:50:51.000000000 +0000
++++ src/libimage/gif.c
+@@ -21,7 +21,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-
++#include <stdbool.h>
+ #include <gif_lib.h>
+ 
+ /*
+@@ -178,8 +178,12 @@ read_gif(const char *filename, int *width, int *height, unsigned char **rgb)
+ 	    *BufferP++ = ColorMapEntry->Blue;
+ 	}
+     }
+-    
++
++#if GIFLIB_MAJOR >= 5
++    if (DGifCloseFile(GifFile, NULL) == GIF_ERROR) {
++#else
+     if (DGifCloseFile(GifFile) == GIF_ERROR) {
++#endif
+ 	return(0);
+     }
+ 
+@@ -493,7 +497,11 @@ SortCmpRtn(const void *Entry1,
+ static void QuitGifError(GifFileType *GifFile)
+ {
+     fprintf(stderr, "Error writing GIF file\n");
++#if GIFLIB_MAJOR >= 5
++    if (GifFile != NULL) EGifCloseFile(GifFile, NULL);
++#else
+     if (GifFile != NULL) EGifCloseFile(GifFile);
++#endif
+ }
+ 
+ int 
+@@ -589,7 +597,11 @@ write_gif(const char *filename, int width, int height, char *rgb)
+ 	Ptr += width;
+     }
+ 
++#if GIFLIB_MAJOR >= 5
++    if (EGifCloseFile(GifFile, NULL) == GIF_ERROR)
++#else
+     if (EGifCloseFile(GifFile) == GIF_ERROR)
++#endif
+ 
+     {
+ 	QuitGifError(GifFile);
+-- 
+2.23.0
+
diff --git a/xplanet/patches/patch-src_libmultiple_RayleighScattering.cpp b/xplanet/patches/patch-src_libmultiple_RayleighScattering.cpp
new file mode 100644
index 0000000000..fd62737f30
--- /dev/null
+++ b/xplanet/patches/patch-src_libmultiple_RayleighScattering.cpp
@@ -0,0 +1,46 @@
+$NetBSD: patch-src_libmultiple_RayleighScattering.cpp,v 1.1 2018/02/13 12:45:02 ryoon Exp $
+
+--- src/libmultiple/RayleighScattering.cpp.orig	2012-02-25 16:32:59.000000000 +0000
++++ src/libmultiple/RayleighScattering.cpp
+@@ -369,8 +369,12 @@ RayleighScattering::readConfigFile(strin
+ 
+     diskTemplate_.clear();
+     limbTemplate_.clear();
+-    while (inFile.getline(line, MAX_LINE_LENGTH, '\n') != NULL)
++    while (1)
+     {
++        inFile.getline(line, MAX_LINE_LENGTH, '\n');
++	if (inFile.eof() || inFile.fail())
++	    break;
++
+         int i = 0;
+         while (isDelimiter(line[i]))
+         {
+@@ -439,8 +443,12 @@ RayleighScattering::readBlock(ifstream &
+     values.clear();
+ 
+     char line[MAX_LINE_LENGTH];
+-    while (inFile.getline(line, MAX_LINE_LENGTH, '\n') != NULL)
++    while (1)
+     {
++        inFile.getline(line, MAX_LINE_LENGTH, '\n');
++	if (inFile.eof() || inFile.fail())
++	    break;
++
+         int i = 0;
+         while (isDelimiter(line[i]))
+         {
+@@ -470,8 +478,12 @@ RayleighScattering::readValue(ifstream &
+                               double &value)
+ {
+     char line[MAX_LINE_LENGTH];
+-    while (inFile.getline(line, MAX_LINE_LENGTH, '\n') != NULL)
++    while (1)
+     {
++        inFile.getline(line, MAX_LINE_LENGTH, '\n');
++	if (inFile.eof() || inFile.fail())
++	    break;
++
+         int i = 0;
+         while (isDelimiter(line[i]))
+         {
diff --git a/xplanet/patches/patch-src_libmultiple_drawStars.cpp b/xplanet/patches/patch-src_libmultiple_drawStars.cpp
new file mode 100644
index 0000000000..41f5427535
--- /dev/null
+++ b/xplanet/patches/patch-src_libmultiple_drawStars.cpp
@@ -0,0 +1,18 @@
+$NetBSD: patch-src_libmultiple_drawStars.cpp,v 1.1 2018/02/13 12:45:02 ryoon Exp $
+
+--- src/libmultiple/drawStars.cpp.orig	2006-03-26 04:55:59.000000000 +0000
++++ src/libmultiple/drawStars.cpp
+@@ -41,8 +41,12 @@ drawStars(DisplayBase *display, View *vi
+     ifstream inFile(starMap.c_str());
+ 
+     char line[MAX_LINE_LENGTH];
+-    while (inFile.getline(line, MAX_LINE_LENGTH, '\n') != NULL)
++    while (1)
+     {
++	inFile.getline(line, MAX_LINE_LENGTH, '\n');
++	if (inFile.eof() || inFile.fail())
++	    break;
++
+         if (line[0] == '#') continue;
+ 
+         double Vmag, RA, Dec;
diff --git a/xplanet/patches/patch-src_readConfig-fixclang.cpp b/xplanet/patches/patch-src_readConfig-fixclang.cpp
new file mode 100644
index 0000000000..739b4d703f
--- /dev/null
+++ b/xplanet/patches/patch-src_readConfig-fixclang.cpp
@@ -0,0 +1,91 @@
+$NetBSD: patch-src_readConfig-fixclang.cpp,v 1.1 2019/08/11 15:38:22 ng0 Exp $
+
+This patch has been imported from FreeBSD ports, written by adridg.
+
+The later chunks (using i2b) are compile fixes on aarch64 (presumably with
+clang6 as well). Typical error message reads
+
+    readConfig.cpp:407:54: error: non-constant-expression cannot be narrowed 
+    from type 'int' to 'unsigned char' in initializer list [-Wc++11-narrowing]
+        unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
+                                   ^~~~~~~~
+    readConfig.cpp:407:54: note: insert an explicit cast to silence this issue
+        unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
+                                   ^~~~~~~~
+                                   static_cast<unsigned char>( )
+
+Since it happens in a half-dozen places, introduce a trivial helper function.
+
+--- src/readConfig.cpp.orig	2018-01-21 16:58:09 UTC
++++ src/readConfig.cpp
+@@ -4,6 +4,7 @@
+ #include <fstream>
+ #include <sstream>
+ #include <string>
++#include <clocale>
+ using namespace std;
+ 
+ #include "body.h"
+@@ -20,6 +21,8 @@ using namespace std;
+ static PlanetProperties *defaultProperties;
+ static PlanetProperties *currentProperties;
+ 
++static inline unsigned char i2b( int x ) { return static_cast<unsigned int>(x) & 0xffU; }
++
+ static void
+ readConfig(const char *line, PlanetProperties *planetProperties[])
+ {
+@@ -49,7 +52,7 @@ readConfig(const char *line, PlanetPrope
+             int r, g, b;
+             if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
+             {
+-                unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
++                unsigned char color[3] = { i2b(r), i2b(g), i2b(b) };
+                 currentProperties->ArcColor(color);
+             }
+             else
+@@ -179,7 +182,7 @@ readConfig(const char *line, PlanetPrope
+             int r, g, b;
+             if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
+             {
+-                unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
++                unsigned char color[3] = { i2b(r), i2b(g), i2b(b) };
+                 currentProperties->Color(color);
+             }
+             else
+@@ -244,7 +247,7 @@ readConfig(const char *line, PlanetPrope
+             int r, g, b;
+             if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
+             {
+-                unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
++                unsigned char color[3] = { i2b(r), i2b(g), i2b(b) };
+                 currentProperties->GridColor(color);
+             }
+             else
+@@ -296,7 +299,7 @@ readConfig(const char *line, PlanetPrope
+             int r, g, b;
+             if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
+             {
+-                unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
++                unsigned char color[3] = { i2b(r), i2b(g), i2b(b) };
+                 currentProperties->MarkerColor(color);
+             }
+             else
+@@ -403,7 +406,7 @@ readConfig(const char *line, PlanetPrope
+             int r, g, b;
+             if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
+             {
+-                unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
++                unsigned char color[3] = { i2b(r), i2b(g), i2b(b) };
+                 currentProperties->OrbitColor(color);
+             }
+             else
+@@ -473,7 +476,7 @@ readConfig(const char *line, PlanetPrope
+             int r, g, b;
+             if (sscanf(returnString, "%d,%d,%d", &r, &g, &b) == 3)
+             {
+-                unsigned char color[3] = { r & 0xff, g & 0xff, b & 0xff };
++                unsigned char color[3] = { i2b(r), i2b(g), i2b(b) };
+                 currentProperties->TextColor(color);
+             }
+             else
diff --git a/xplanet/patches/patch-src_readConfig.cpp b/xplanet/patches/patch-src_readConfig.cpp
new file mode 100644
index 0000000000..d6c8b11f20
--- /dev/null
+++ b/xplanet/patches/patch-src_readConfig.cpp
@@ -0,0 +1,20 @@
+$NetBSD: patch-src_readConfig.cpp,v 1.1 2018/02/13 12:45:02 ryoon Exp $
+
+--- src/readConfig.cpp.orig	2012-03-03 03:20:05.000000000 +0000
++++ src/readConfig.cpp
+@@ -550,9 +550,13 @@ readConfigFile(string configFile, Planet
+ 
+         ifstream inFile(configFile.c_str());
+         char *line = new char[256];
+-        while (inFile.getline(line, 256, '\n') != NULL)
++	while (1)
++	{
++	    inFile.getline(line, 256, '\n');
++	    if (inFile.eof() || inFile.fail())
++	        break;
+             readConfig(line, planetProperties);
+-        
++        }
+         // This condition will only be true if [default] is the only
+         // section in the config file.  In this case, set all planet
+         // properties to the default values.
diff --git a/xplanet/patches/patch-src_xpUtil-Add2017LeapSecond.cpp b/xplanet/patches/patch-src_xpUtil-Add2017LeapSecond.cpp
new file mode 100644
index 0000000000..03ec5c98d8
--- /dev/null
+++ b/xplanet/patches/patch-src_xpUtil-Add2017LeapSecond.cpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+pick from https://sourceforge.net/p/xplanet/code/209/
+Add 2017 leap second
+
+--- src/xpUtil.cpp~
++++ src/xpUtil.cpp
+@@ -434,6 +434,7 @@ deltaETpost1972(const double jd)
+     if (jd >= toJulian(2009, 1, 1, 0, 0, 0)) delta_at++; // 34
+     if (jd >= toJulian(2012, 7, 1, 0, 0, 0)) delta_at++; // 35
+     if (jd >= toJulian(2015, 7, 1, 0, 0, 0)) delta_at++; // 36
++    if (jd >= toJulian(2017, 1, 1, 0, 0, 0)) delta_at++; // 37
+ 
+     const double J2000 = toJulian(2000, 1, 1, 12, 0, 0);
+     const double m = m0 + m1 * (jd - J2000) * 86400;


Home | Main Index | Thread Index | Old Index