From af314729a412f4936a44bcfabe14d34c3b152a82 Mon Sep 17 00:00:00 2001 From: rillig Date: Sat, 1 May 2021 20:21:25 +0000 Subject: caesar: WARNS=6, strict bool mode The rotation is validated to be nonnegative, therefore use unsigned int for it. --- caesar/caesar.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/caesar/caesar.c b/caesar/caesar.c index 1a6a8ea2..dfbc46ec 100644 --- a/caesar/caesar.c +++ b/caesar/caesar.c @@ -1,4 +1,4 @@ -/* $NetBSD: caesar.c,v 1.22 2008/07/20 01:03:21 lukem Exp $ */ +/* $NetBSD: caesar.c,v 1.23 2021/05/01 20:21:25 rillig Exp $ */ /* * Copyright (c) 1989, 1993 @@ -48,7 +48,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\ #if 0 static char sccsid[] = "@(#)caesar.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: caesar.c,v 1.22 2008/07/20 01:03:21 lukem Exp $"); +__RCSID("$NetBSD: caesar.c,v 1.23 2021/05/01 20:21:25 rillig Exp $"); #endif #endif /* not lint */ @@ -79,7 +79,7 @@ static unsigned char rottbl[NCHARS]; static void -init_rottbl(int rot) +init_rottbl(unsigned int rot) { size_t i; @@ -121,7 +121,7 @@ print_array(const unsigned char *a, size_t len) } } -static int +static unsigned int get_rotation(const char *arg) { long rot; @@ -135,7 +135,7 @@ get_rotation(const char *arg) errno = ERANGE; if (errno) err(EXIT_FAILURE, "Bad rotation value `%s'", arg); - return (int)rot; + return (unsigned int)rot; } static void @@ -145,7 +145,7 @@ guess_and_rotate(void) unsigned int obs[NCHARS]; size_t i, nread; double dot, winnerdot; - int try, winner; + unsigned int try, winner; int ch; /* adjust frequency table to weight low probs REAL low */ -- cgit v1.2.3-56-ge451