Dash:
[t2-trunk.git] / package / x11 / xplanet / hotfix-gcc44.patch
blob75b6ab396f34087c7d85d67896f3afa8769fd77b
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../xplanet/gcc44.patch
5 # Copyright (C) 2010 The T2 SDE Project
6 #
7 # More information can be found in the files COPYING and README.
8 #
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 # --- T2-COPYRIGHT-NOTE-END ---
17 http://bugs.gentoo.org/show_bug.cgi?id=277937
19 diff -ur xplanet-1.2.1.orig/src/libimage/bmp.c xplanet-1.2.1/src/libimage/bmp.c
20 --- xplanet-1.2.1.orig/src/libimage/bmp.c 2006-03-26 00:50:51.000000000 +0200
21 +++ xplanet-1.2.1/src/libimage/bmp.c 2009-07-26 21:42:03.000000000 +0300
22 @@ -61,10 +61,10 @@
23 struct BMPHeader bmph;
25 /* The length of each line must be a multiple of 4 bytes */
27 bytesPerLine = (3 * (width + 1) / 4) * 4;
29 - strcpy(bmph.bfType, "BM");
30 + /* copy only "BM" without a terminating null byte */
31 + strncpy(bmph.bfType, "BM", 2);
32 bmph.bfOffBits = 54;
33 bmph.bfSize = bmph.bfOffBits + bytesPerLine * height;
34 bmph.bfReserved = 0;
35 diff -ur xplanet-1.2.1.orig/src/libmultiple/addOrbits.cpp xplanet-1.2.1/src/libmultiple/addOrbits.cpp
36 --- xplanet-1.2.1.orig/src/libmultiple/addOrbits.cpp 2008-11-14 01:46:12.000000000 +0200
37 +++ xplanet-1.2.1/src/libmultiple/addOrbits.cpp 2009-07-26 21:42:06.000000000 +0300
38 @@ -86,9 +86,13 @@
39 const double period = p->Period();
40 if (period == 0) return;
42 + // Units of orbit circumference
43 const double startOrbit = currentProperties->StartOrbit();
44 const double stopOrbit = currentProperties->StopOrbit();
46 + // degrees
47 const double delOrbit = currentProperties->DelOrbit();
49 const unsigned char *color = currentProperties->OrbitColor();
50 const int thickness = currentProperties->ArcThickness();
52 @@ -103,10 +107,11 @@
53 const double startTime = jd0 + startOrbit * period;
54 const double stopTime = jd0 + stopOrbit * period;
56 - const int numTimes = (int) (180/delOrbit + 0.5);
58 + int numTimes = (int) abs(360 * startOrbit / delOrbit + 0.5);
59 addArc(startTime, jd0, numTimes, color, thickness, view, width, height,
60 Prx, Pry, Prz, p, annotationMap);
62 + numTimes = (int) abs(360 * stopOrbit / delOrbit + 0.5);
63 addArc(jd0, stopTime, numTimes, color, thickness, view, width, height,
64 Prx, Pry, Prz, p, annotationMap);
66 diff -ur xplanet-1.2.1.orig/src/Satellite.cpp xplanet-1.2.1/src/Satellite.cpp
67 --- xplanet-1.2.1.orig/src/Satellite.cpp 2006-03-26 02:34:21.000000000 +0200
68 +++ xplanet-1.2.1/src/Satellite.cpp 2009-07-26 21:42:17.000000000 +0300
69 @@ -1,4 +1,5 @@
70 #include <clocale>
71 +#include <cstdio>
72 #include <cstring>
73 #include <iostream>
74 using namespace std;
75 diff -ur xplanet-1.2.1.orig/src/Separation.cpp xplanet-1.2.1/src/Separation.cpp
76 --- xplanet-1.2.1.orig/src/Separation.cpp 2008-11-14 02:19:05.000000000 +0200
77 +++ xplanet-1.2.1/src/Separation.cpp 2009-07-26 21:42:17.000000000 +0300
78 @@ -1,4 +1,5 @@
79 #include <cmath>
80 +#include <cstdio>
81 #include <iostream>
83 #include "Separation.h"
84 diff -ur xplanet-1.2.1.orig/xplanet.1 xplanet-1.2.1/xplanet.1
85 --- xplanet-1.2.1.orig/xplanet.1 2007-12-27 01:48:50.000000000 +0200
86 +++ xplanet-1.2.1/xplanet.1 2009-07-26 21:42:17.000000000 +0300
87 @@ -31,7 +31,7 @@
88 .sp
89 .fi
90 where declination is in degrees and right ascension is in hours. This
91 -option has no effect if -projection is specified.
92 +option has no effect if \-projection is specified.
94 .TP
95 .B \-arc_spacing spacing
96 @@ -48,8 +48,8 @@
97 .TP
98 .B \-background background_file
99 Use background_file as the background image, with the planet to be
100 -superimposed upon it. A color may also be supplied (e.g. -background
101 -"navy blue" or -background 0xff00ff).
102 +superimposed upon it. A color may also be supplied (e.g. \-background
103 +"navy blue" or \-background 0xff00ff).
106 .B \-base_magnitude magnitude
107 @@ -67,20 +67,20 @@
108 pluto, charon, random, and major.
110 The field of view can also be centered on a satellite location using
111 -"naif" or "norad", along with the satellite id. For example, "-body
112 -naif-82" will center the field of view on NAIF ID -82, which is the
113 +"naif" or "norad", along with the satellite id. For example, "\-body
114 +naif-82" will center the field of view on NAIF ID \-82, which is the
115 Cassini orbiter. Xplanet must be compiled with SPICE support and the
116 required kernels must be present. See the README in the spice
117 -subdirectory for more details. Using "-body norad20580" will center
118 +subdirectory for more details. Using "\-body norad20580" will center
119 the field of view on NORAD ID 20580, which is the Hubble Space
120 Telescope. The appropriate TLE files must be present in this case.
121 See the README in the satellites subdirectory for more information.
123 Using "path" will center the field of view on the direction of motion
124 of the origin. This direction is relative to the direction of motion
125 -of the body specified by -path_relative_to.
126 +of the body specified by \-path_relative_to.
128 -Earth is the default body. This option is the same as -target.
129 +Earth is the default body. This option is the same as \-target.
132 .B \-center +x+y
133 @@ -92,13 +92,13 @@
134 .B \-color color
135 Set the color for the label. The default is "red". Any color in the
136 rgb.txt file may be used. Colors may also be specified by RGB hex
137 -values; for example -color 0xff and -color blue mean the same thing,
138 -as do -color 0xff0000 and -color red.
139 +values; for example \-color 0xff and \-color blue mean the same thing,
140 +as do \-color 0xff0000 and \-color red.
143 .B \-config config_file
144 Use the configuration file config_file. The format of config_file is
145 -described in README.config. See the description of -searchdir to see
146 +described in README.config. See the description of \-searchdir to see
147 where xplanet looks in order to find the configuration file.
150 @@ -116,7 +116,7 @@
152 .B \-dynamic_origin file
153 Specify an observer location. The location is relative to the body
154 -specified with -origin (by default, this is the Sun). The last line
155 +specified with \-origin (by default, this is the Sun). The last line
156 of the file must be of the form
159 @@ -126,7 +126,7 @@
160 For example,
163 -19951207.120000 10.328 -3.018 97.709 9.595
164 +19951207.120000 10.328 \-3.018 97.709 9.595
167 The specified time is ignored and the current time is used. The range
168 @@ -134,7 +134,7 @@
169 hours) is optional, but if present, it will be used in place of the
170 longitude. Only the last line of the file is used. This file may be
171 updated between renderings using a script executed with the
172 --prev_command or -post_command options.
173 +\-prev_command or \-post_command options.
176 .B \-ephemeris_file filename
177 @@ -144,13 +144,13 @@
178 little endian binary files. The ephemeris files found at
179 ftp://ssd.jpl.nasa.gov/pub/eph/export/unix are big endian files, but
180 you do not need to do any additional byte-swapping to use them. See
181 -the description of -searchdir to see where xplanet looks in order to
182 +the description of \-searchdir to see where xplanet looks in order to
183 find the ephemeris file.
186 .B \-font fontname
187 Set the font for the label. Only TrueType fonts are supported. If
188 -the -pango option is used, fontname is taken to be the font family
189 +the \-pango option is used, fontname is taken to be the font family
190 name (e.g. "Arial").
193 @@ -168,9 +168,9 @@
196 .B \-fov
197 -Specify the field of view, in degrees. This option and the -radius
198 +Specify the field of view, in degrees. This option and the \-radius
199 option are mutually exclusive. This option has no effect if the
200 --projection option is used.
201 +\-projection option is used.
204 .B \-geometry string
205 @@ -179,7 +179,7 @@
206 (e.g. 256x256-10+10 puts a window 256x256 pixels in size 10 pixels
207 away from the right side and 10 pixels below the top of the root
208 window). The root window outside of the image will be black. This
209 -option may be used with -window or -output.
210 +option may be used with \-window or \-output.
213 .B \-glare radius
214 @@ -188,7 +188,7 @@
217 .B \-gmtlabel
218 -Same as the -label option, but show GMT instead of local time.
219 +Same as the \-label option, but show GMT instead of local time.
222 .B \-grs_longitude lon
223 @@ -213,7 +213,7 @@
226 .B \-interpolate_origin_file
227 -This option is only useful in conjunction with -origin_file. It
228 +This option is only useful in conjunction with \-origin_file. It
229 computes the observer position at the current time by interpolating
230 between values specified in the origin file. This is useful if you
231 have spacecraft positions tabulated in an origin file, but want a real
232 @@ -232,12 +232,12 @@
233 Specify the location of the label using the standard X window geometry
234 syntax. The default position is "-15+15", or 15 pixels to the left
235 and below the top right corner of the display. This option implies
236 --label.
237 +\-label.
240 .B \-label_body body
241 Use the specified body to calculate the sub-observer, sub-solar, and
242 -illumination values in the label. This is useful with the -separation
243 +illumination values in the label. This is useful with the \-separation
244 option.
247 @@ -268,17 +268,17 @@
248 .B \-longitude longitude
249 Place the observer above the specified longitude (in degrees).
250 Longitude is positive going east, negative going west (for the earth
251 -and moon), so for example Los Angeles is at -118 or 242. The default
252 +and moon), so for example Los Angeles is at \-118 or 242. The default
253 value is 0.
256 .B \-make_cloud_maps
257 If there is an entry in the config file for cloud_map, xplanet will
258 output a day and night image with clouds overlaid and then exit. The
259 -images will be created in the directory specified by -tmpdir, or in
260 -the current directory if -tmpdir is not used. The names of the output
261 +images will be created in the directory specified by \-tmpdir, or in
262 +the current directory if \-tmpdir is not used. The names of the output
263 images default to day_clouds.jpg and night_clouds.jpg, but may be
264 -changed by the -output option. If "-output filename.extension" is
265 +changed by the \-output option. If "\-output filename.extension" is
266 specified, the output images will be named "day_filename.extension"
267 and "night_filename.extension". The dimensions of the output images
268 are the same as the day image.
269 @@ -290,11 +290,11 @@
270 declination, right ascension, string, as in the example below:
273 --16.7161 6.7525 "Sirius"
274 +\-16.7161 6.7525 "Sirius"
277 For additional options which may be specified, see the marker_file
278 -entry in README.config. This option has no effect if -projection is
279 +entry in README.config. This option has no effect if \-projection is
280 specified. This option is not meant for city markers; for that use
281 the marker_file option in the configuration file.
283 @@ -321,9 +321,9 @@
284 body: body's north pole
285 galactic: galactic north pole
286 orbit: body's orbital north pole (perpendicular to the orbit plane)
287 -path: origin's velocity vector (also see -path_relative_to option)
288 +path: origin's velocity vector (also see \-path_relative_to option)
289 separation: perpendicular to the line of sight and the
290 - target-separation target line (see -separation option)
291 + target-separation target line (see \-separation option)
294 The default value is "body".
295 @@ -335,7 +335,7 @@
297 .B \-origin body
298 Place the observer at the center of the specified body. Valid values
299 -are the same as for -target. In addition, "above", "below", or
300 +are the same as for \-target. In addition, "above", "below", or
301 "system" may be specified. Using "above" or "below" centers the view
302 on the body's primary and the field of view is large enough to show
303 the body's orbit. Using "system" places the observer at the center of
304 @@ -351,15 +351,15 @@
305 If the body name is preceded by a dash, the observer is placed on the
306 opposite side of the target from the specified body at a distance
307 equal to the distance between the target and body. For example,
308 --target earth -origin sun places the observer at the center of the
309 -sun. If -target earth -origin -sun is used, the observer is placed on
310 +\-target earth \-origin sun places the observer at the center of the
311 +sun. If \-target earth \-origin \-sun is used, the observer is placed on
312 a line connecting the centers of the earth and sun at a distance of 1
313 AU farther from the sun than the earth.
316 .B \-origin_file origin_file
317 Specify a list of observer positions in origin_file. The positions
318 -are relative to the body specified with -origin (by default, this is
319 +are relative to the body specified with \-origin (by default, this is
320 the Sun). Each line should be of the form
323 @@ -369,14 +369,14 @@
324 For example,
327 -19951207.120000 10.328 -3.018 97.709 9.595
328 +19951207.120000 10.328 \-3.018 97.709 9.595
331 Range is in planetary radii, and lat and lon are in degrees. The date
332 is the only required value. If the localtime (in hours) is supplied,
333 it will be used in place of the longitude. For each line in the
334 origin file, the observer is placed at the specified position,
335 -relative to the body specified with -origin. This option is useful
336 +relative to the body specified with \-origin. This option is useful
337 for showing spacecraft flybys or orbiting around a planet. Any line
338 with a # in the first column is ignored.
340 @@ -386,8 +386,8 @@
341 taken from the extension. Currently .gif, .jpg, .ppm, .png, and .tiff
342 images can be created, if xplanet has been compiled with the
343 appropriate libraries. The image size defaults to 512 by 512 pixels
344 -but this may be changed by the -geometry flag. If used with the
345 --num_times option, each output file will be numbered sequentially.
346 +but this may be changed by the \-geometry flag. If used with the
347 +\-num_times option, each output file will be numbered sequentially.
350 .B \-output_start_index index
351 @@ -404,7 +404,7 @@
354 .B \-path_relative_to body
355 -Only used with -north path or -target path. The origin's velocity
356 +Only used with \-north path or \-target path. The origin's velocity
357 vector is calculated relative to the specified body. By default, this
358 is the Sun.
360 @@ -416,7 +416,7 @@
361 On MS Windows, you may need to use unix-style paths. For example:
364 -xplanet.exe -prev_command ./prev.bat
365 +xplanet.exe \-prev_command ./prev.bat
369 @@ -471,8 +471,8 @@
371 .B \-rotate angle
372 Rotate the globe by angle degrees counterclockwise so that north (as
373 -defined by the -north argument) isn't at the top. The default value
374 -is 0. My friends in the Southern Hemisphere can use -rotate 180 to
375 +defined by the \-north argument) isn't at the top. The default value
376 +is 0. My friends in the Southern Hemisphere can use \-rotate 180 to
377 make the earth look like it should! For non-orthographic projections,
378 the globe is rotated and then projected, if that helps you visualize
379 what to expect.
380 @@ -481,7 +481,7 @@
381 .B \-save_desktop_file
382 On Microsoft Windows and Mac OS X, xplanet creates an intermediate
383 image file which is used to set the desktop. This file will be
384 -created in the -tmpdir directory. By default, this image is removed
385 +created in the \-tmpdir directory. By default, this image is removed
386 after the desktop has been set. Specifying this option will leave the
387 file in place.
389 @@ -507,14 +507,14 @@
391 .B \-separation body:dist
392 Place the observer at a location where the target body and the
393 -separation body are dist degrees apart. For example "-target earth
394 --separation moon:-3" means place the observer at a location where the
395 +separation body are dist degrees apart. For example "\-target earth
396 +\-separation moon:-3" means place the observer at a location where the
397 moon appears 3 degrees to the left of the earth.
400 .B \-spice_ephemeris index
401 Use SPICE kernels to compute the position of the named body. The
402 -index is the naif ID code (e.g. 599 for Jupiter). The -spice_file
403 +index is the naif ID code (e.g. 599 for Jupiter). The \-spice_file
404 option must be used to supply the names of the kernel files. This
405 option may be used more than once for different bodies.
407 @@ -544,15 +544,15 @@
408 decimal hours. For example, the entry for Sirius is
411 --16.7161 6.7525 -1.46
412 +\-16.7161 6.7525 \-1.46
415 -See the description of -searchdir to see where xplanet looks in order
416 +See the description of \-searchdir to see where xplanet looks in order
417 to find the star map.
420 .B \-target target
421 -Same as -body.
422 +Same as \-body.
425 .B \-tt
426 @@ -568,13 +568,13 @@
428 .B \-tmpdir tmpdir
429 Specify a directory that xplanet will use to place images created
430 -using -make_cloud_maps. On Microsoft Windows, xplanet will write
431 +using \-make_cloud_maps. On Microsoft Windows, xplanet will write
432 a bitmap file called xplanet.bmp to the specified directory. The
433 default is the result of the GetWindowsDirectory call (C:\WINDOWS on
434 Win95). On Mac OS X, xplanet will create an intermediate PNG file in
435 order to set the background. The default value is /tmp. On Windows
436 and Mac OS X, the intermediate file will be removed unless the
437 --save_desktop_file option is specified.
438 +\-save_desktop_file option is specified.
441 .B \-transparency
442 @@ -583,12 +583,12 @@
445 .B \-transpng filename
446 -Same as the -output option, except set the background to be
447 +Same as the \-output option, except set the background to be
448 transparent when writing a PNG file.
451 .B \-utclabel
452 -Same as -gmtlabel.
453 +Same as \-gmtlabel.
456 .B \-verbosity level
457 @@ -624,13 +624,13 @@
459 .B \-window
460 Render the image to its own X window. The size defaults to 512 by 512
461 -pixels but this may be set by the -geometry flag.
462 +pixels but this may be set by the \-geometry flag.
465 .B \-window_title title
466 -Set the window's title to title. This option implies -window.
467 +Set the window's title to title. This option implies \-window.
470 .B \-xscreensaver
471 -Same as -vroot.
472 +Same as \-vroot.