From 2c3eb84cdc2eacbe967d3992e966ea212ae04adc Mon Sep 17 00:00:00 2001 From: joey Date: Tue, 17 Jun 2003 23:53:32 +0000 Subject: [PATCH] * Fix rounding error in caesar due to too small data type. Caused it to sometimes make incorrect guesses. Thanks to Jan Vornberger for analysis and patch. Also forwarded upstream. Closes: #197816 git-svn-id: file:///srv/svn/joey/bsdgames-trunk@5210 a4a2c43b-8ac3-0310-8836-e0e880c912e2 --- caesar/caesar.c | 9 +++++---- debian/changelog | 8 ++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/caesar/caesar.c b/caesar/caesar.c index f07225b..595bd39 100644 --- a/caesar/caesar.c +++ b/caesar/caesar.c @@ -1,4 +1,4 @@ -/* $NetBSD: caesar.c,v 1.7 1998/09/13 15:27:27 hubertf Exp $ */ +/* $NetBSD: caesar.c,v 1.11 2000/05/08 07:56:02 mycroft Exp $ */ /* * Copyright (c) 1989, 1993 @@ -51,7 +51,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ #if 0 static char sccsid[] = "@(#)caesar.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: caesar.c,v 1.7 1998/09/13 15:27:27 hubertf Exp $"); +__RCSID("$NetBSD: caesar.c,v 1.11 2000/05/08 07:56:02 mycroft Exp $"); #endif #endif /* not lint */ @@ -88,7 +88,8 @@ main(argc, argv) int argc; char **argv; { - int ch, dot, i, nread, winnerdot; + int ch, i, nread; + double dot, winnerdot; char *inbuf; int obs[26], try, winner; @@ -100,7 +101,7 @@ main(argc, argv) printit(argv[1]); if (!(inbuf = malloc(LINELENGTH))) - errx(1, "out of memory"); + err(1, NULL); /* adjust frequency table to weight low probs REAL low */ for (i = 0; i < 26; ++i) diff --git a/debian/changelog b/debian/changelog index 7e4a104..db923b1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +bsdgames (2.14-5) unstable; urgency=low + + * Fix rounding error in caesar due to too small data type. Caused it to + sometimes make incorrect guesses. Thanks to Jan Vornberger for analysis + and patch. Also forwarded upstream. Closes: #197816 + + -- Joey Hess Tue, 17 Jun 2003 19:36:44 -0400 + bsdgames (2.14-4) unstable; urgency=low * Move atc and sail to Games/Strategy in menu, cf #194782