Commit Graph

1782 Commits

Author SHA1 Message Date
joerg 202d44a492 Fix various format string mismatches. 2012-02-29 23:39:53 +00:00
wiz a19484822f Man page and usage cleanups from Bug Hunting in PR 46103. 2012-02-26 21:06:59 +00:00
matt 29f82ac3aa Fix conflicting variable definitions 2012-02-18 06:57:23 +00:00
christos 7f5fd4a5cd PR/45842: Henning Petersen: compare fgets with NULL not 0 2012-01-16 17:38:16 +00:00
dholland 8879f685e9 grumble. 2012-01-08 18:17:41 +00:00
dholland 158b740733 Oops, I forgot to actually implement the checksumming code for the new
savefile format, so any savefiles generated yesterday can be tampered
with. Oh well. While here, tidy up the crc code.
2012-01-08 18:16:00 +00:00
dholland c99eaa0a43 Redo save file handling. The old save files were unportable, had no
magic number or versioning, relied on random(3) never changing to a
different implementation, and were also saving pointers to disk and
reading them back again. It *looks* as if the pointers thus loaded
were reset before being used, but it's not particularly clear as the
main loop of this thing is goto-based FORTRAN translated lightly to C.
I've changed the logic to null these pointers instead of saving and
loading them, and things seem to still work.

The new save files have a header, support versioning, write only sized
types in network byte order, and for the toy encryption to discourage
cheating do something self-contained instead of using random(3) as a
stream cipher.

Because between the original import from 4.4 until earlier today
trying to save would result in SIGSEGV on most platforms, it's
unlikely anyone has a save file, but just in case (since the pointer
issue appears to be nonlethal) I've kept compat code for old save
files.
2012-01-07 22:23:16 +00:00
dholland f08dd5ca74 Make this not crash on machines that are (a) 64 bit, or (b) have signed
chars by default (i.e., almost all machines). Makes it possible to save
the game. This has been broken since 4.4 and probably ever since the
FORTRAN -> C translation.

Crash reported by Petri Laakso in private mail.
2012-01-07 18:08:35 +00:00
jakllsch 2ee946b266 Per [1] the speed of light in a vaccum is exactly 299792458 m/s.
Per [2] a furlong is 220 yards and a yard is exactly 0.9144 m.
Per [3] a fortnight is 14 days.

As I didn't find a good authority for what definition of a day a fortnight is
measured in, I'll assume here a day is 86400 SI seconds.

Thus, the speed of light in a vaccum is approximately
1.80*10^12 furlongs per fortnight.

1.80*10^12 = 299792458*86400*14/(220*0.9144)

[1]	Resolution 1 of the 17th meeting of the CGPM (1983)
	http://www.bipm.org/en/CGPM/db/17/1/
[2]	Weights and Measures Act 1985
	http://www.legislation.gov.uk/ukpga/1985/72
[3]	The Concise Oxford Dictionary, 5th Edition, 1964, p. 480
2011-12-06 19:41:03 +00:00
ahoka c509c6317e handle EOF in input 2011-12-01 07:05:52 +00:00
jnemeth be8bba3314 grammar fix 2011-11-19 20:44:58 +00:00
drochner 7621b801a7 remove duplicated #defines (in a usually unused part of the code) 2011-11-09 20:17:44 +00:00
roy 4060cbcd0c Use tiparm instead of vtparm. 2011-10-03 12:32:15 +00:00
plunky acae68523e reinstate NULL cast by request, where the NULL was being passed as a vararg 2011-09-01 07:18:50 +00:00
plunky 9f61b80465 NULL does not need a cast 2011-08-31 16:24:54 +00:00
jakllsch 2ed951176c No need to cast double to ubig (aka uintmax_t) through int.
This change prevents a modulo by zero in a invocation such as:
primes 18446744073709551000 18446744073709551615
on a LP64 machine.
2011-08-30 02:58:04 +00:00
joerg 4511a017c1 Use __dead 2011-08-29 20:30:36 +00:00
joerg 17834822b6 Mark error() as dead, so that validation for setclipped works correctly. 2011-08-27 23:42:33 +00:00
tron d504399e17 Avoid non-literal format strings. 2011-08-26 09:01:07 +00:00
dholland ae56ae8f3f Use __dead and __printflike instead of __attribute__. 2011-08-26 06:18:16 +00:00
christos df7b0db034 add printf attributes. 2011-08-25 16:18:28 +00:00
joerg 6e9533bc30 Uses non-literal format strings 2011-08-25 15:50:45 +00:00
plunky e2bd4b0723 -Wno-shadow is no longer needed for HAVE_PCC, here 2011-08-24 17:39:32 +00:00
christos a040843f47 use const char [] for format. 2011-08-21 08:50:08 +00:00
dholland 788ec3df53 Remove redundant set of prototypes for local functions, exposed by
previous.
2011-08-17 18:17:40 +00:00
dholland ec10c574c2 Move some things around so declarations appear in a reasonable order. 2011-08-17 18:16:51 +00:00
dholland 667d044909 Use __dead instead of __attribute__((__noreturn__)). 2011-08-16 19:53:03 +00:00
christos c3a5028162 document non-literal string formats 2011-08-16 11:28:18 +00:00
christos 459966a9ab avoid non-literal format string 2011-08-16 11:26:16 +00:00
christos 5129f378a4 eliminate/document non-literal format strings 2011-08-16 11:19:41 +00:00
christos 18f6b4214c eliminate non-literal format strings 2011-08-16 11:14:04 +00:00
christos aba0d26e70 avoid non-literal format strings. 2011-08-16 11:10:54 +00:00
christos 695bc7fff6 kill homebrew error functions 2011-08-16 11:06:34 +00:00
christos 69c818efb5 document non-literal format strings 2011-08-16 10:14:40 +00:00
christos 72db7ca912 - document non-literal format strings
- avoid strict aliasing violations, but adding an intermediate function.
2011-08-16 09:26:22 +00:00
dholland d5b021c7ed Fix up some lint. 2011-08-07 06:03:45 +00:00
dholland 2c0ecb1ab6 Fix up still more casts; use NULL instead of (char *)0. 2011-08-06 20:42:43 +00:00
dholland 8041af98f6 Remove *another* set of useless casts. sheesh 2011-08-06 20:32:25 +00:00
dholland 8e73b3ad76 Remove more silly casts. 2011-08-06 20:29:37 +00:00
dholland 5aa2a843dc drop private (and wrong) definition of NULL 2011-08-06 20:24:35 +00:00
dholland 434d266e91 Use the right type for the malloc wrapper function, and don't cast the
return value.

(XXX: Except for a pile of allocation macros that produce typed pointer
results; there the typechecking of the result assignment is more valuable
than the warning if the alloc function isn't declared properly. These
macros should go away.)
2011-08-06 20:18:26 +00:00
dholland 25ec296591 Remove silly casts. 2011-08-06 20:00:33 +00:00
dholland 842dc544ae <sys/wait.h> is standard, so just use it instead of fiddling about with
ifdefs for long-dead systems. While here, remove union wait.
2011-08-06 19:53:24 +00:00
dholland d30849d1cd abolish references to index/rindex 2011-08-06 19:47:54 +00:00
dholland 813e3e415d Remove the PYRAMID_BUG code. I don't think Pyramids are coming back, nor
do we care if their compiler vomits trying to decrement a bitfield.
2011-08-06 19:32:58 +00:00
dholland cbc660deee Don't refer to index() in comments; use strchr(). 2011-08-06 19:23:38 +00:00
dholland fcfbc606bf Include system headers before private headers. Avoids various possible
symbol conflicts.
2011-07-20 07:04:30 +00:00
mrg db6886e029 apply some -O0 with gcc 4.5 and vax. 2011-07-03 15:29:34 +00:00
mrg 3206e7e70e use DBL_MIN from <float.h> instead of a hard coded small value (that
becomes zero for vax fp.)
2011-07-03 06:44:01 +00:00
mrg 1a1e24f1e6 include sys/time.h earlier (rather than implicitly via fcntl.h) so that
the "u" variable doesn't shadow stuff, found later in time.h inlines.

kind of a hack, but i don't want to modify time.h either.

XXX: seems kind of annoying
2011-07-02 02:10:33 +00:00