Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/games/dab Pass WARNS=3
details: https://anonhg.NetBSD.org/src/rev/394c7758a96d
branches: trunk
changeset: 583487:394c7758a96d
user: christos <christos%NetBSD.org@localhost>
date: Tue Aug 09 02:38:32 2005 +0000
description:
Pass WARNS=3
diffstat:
games/dab/Makefile | 4 ++--
games/dab/algor.cc | 16 ++++++++--------
games/dab/algor.h | 10 +++++-----
games/dab/board.cc | 8 ++++----
games/dab/box.cc | 10 +++++-----
games/dab/ttyscrn.cc | 9 +++++----
6 files changed, 29 insertions(+), 28 deletions(-)
diffs (207 lines):
diff -r 0dce8c316d24 -r 394c7758a96d games/dab/Makefile
--- a/games/dab/Makefile Tue Aug 09 02:38:06 2005 +0000
+++ b/games/dab/Makefile Tue Aug 09 02:38:32 2005 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.3 2004/01/05 15:35:59 christos Exp $
+# $NetBSD: Makefile,v 1.4 2005/08/09 02:38:32 christos Exp $
-WARNS=2
+WARNS=3
DPADD+=${LIBCURSES} ${LIBTERMCAP} ${LIBM}
LDADD+=-lcurses -ltermcap -lm
diff -r 0dce8c316d24 -r 394c7758a96d games/dab/algor.cc
--- a/games/dab/algor.cc Tue Aug 09 02:38:06 2005 +0000
+++ b/games/dab/algor.cc Tue Aug 09 02:38:32 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: algor.cc,v 1.1 2003/12/27 01:16:55 christos Exp $ */
+/* $NetBSD: algor.cc,v 1.2 2005/08/09 02:38:32 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
* algor.C: Computer algorithm
*/
#include "defs.h"
-RCSID("$NetBSD: algor.cc,v 1.1 2003/12/27 01:16:55 christos Exp $")
+RCSID("$NetBSD: algor.cc,v 1.2 2005/08/09 02:38:32 christos Exp $")
#include "algor.h"
#include "board.h"
@@ -132,7 +132,7 @@
* return the number of boxes closed in the maximum closure,
* and the first box of the maximum closure in (x, y, dir)
*/
-int ALGOR::find_max_closure(size_t& y, size_t& x, int& dir, const BOARD& b)
+size_t ALGOR::find_max_closure(size_t& y, size_t& x, int& dir, const BOARD& b)
{
BOARD nb(b);
int tdir, maxdir = -1;
@@ -237,8 +237,8 @@
return 0;
}
-int ALGOR::find_min_closure1(size_t& y, size_t& x, int& dir, const BOARD& b,
- int last)
+size_t ALGOR::find_min_closure1(size_t& y, size_t& x, int& dir, const BOARD& b,
+ int last)
{
BOARD nb(b);
int tdir, mindir = -1, xdir, mv;
@@ -275,11 +275,11 @@
// Search for the move that makes the opponent close the least number of
// boxes; returns 1 if a move found, 0 otherwise
-int ALGOR::find_min_closure(size_t& y, size_t& x, int& dir, const BOARD& b)
+size_t ALGOR::find_min_closure(size_t& y, size_t& x, int& dir, const BOARD& b)
{
size_t x1, y1;
int dir1;
- int count = b.ny() * b.nx() + 1, count1;
+ size_t count = b.ny() * b.nx() + 1, count1;
for (size_t i = 0; i < 3; i++)
if (count > (count1 = find_min_closure1(y1, x1, dir1, b, i))) {
@@ -289,7 +289,7 @@
dir = dir1;
}
- return (size_t) count != b.ny() * b.nx() + 1;
+ return count != b.ny() * b.nx() + 1;
}
// Return a move in (y, x, dir)
diff -r 0dce8c316d24 -r 394c7758a96d games/dab/algor.h
--- a/games/dab/algor.h Tue Aug 09 02:38:06 2005 +0000
+++ b/games/dab/algor.h Tue Aug 09 02:38:32 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: algor.h,v 1.1.1.1 2003/12/26 17:57:03 christos Exp $ */
+/* $NetBSD: algor.h,v 1.2 2005/08/09 02:38:32 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -57,10 +57,10 @@
private:
// Closure searches
int find_closure(size_t& y, size_t& x, int& dir, BOARD& b);
- int find_max_closure(size_t& y, size_t& x, int& dir, const BOARD& b);
- int find_min_closure1(size_t& y, size_t& x, int& dir, const BOARD& b,
- int last);
- int find_min_closure(size_t& y, size_t& x, int& dir, const BOARD& b);
+ size_t find_max_closure(size_t& y, size_t& x, int& dir, const BOARD& b);
+ size_t find_min_closure1(size_t& y, size_t& x, int& dir, const BOARD& b,
+ int last);
+ size_t find_min_closure(size_t& y, size_t& x, int& dir, const BOARD& b);
// Move searches
int find_good_turn(size_t& y, size_t& x, int& dir, const BOARD& b);
diff -r 0dce8c316d24 -r 394c7758a96d games/dab/board.cc
--- a/games/dab/board.cc Tue Aug 09 02:38:06 2005 +0000
+++ b/games/dab/board.cc Tue Aug 09 02:38:32 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: board.cc,v 1.1 2003/12/27 01:16:55 christos Exp $ */
+/* $NetBSD: board.cc,v 1.2 2005/08/09 02:38:32 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
* board.C: Board manipulations
*/
#include "defs.h"
-RCSID("$NetBSD: board.cc,v 1.1 2003/12/27 01:16:55 christos Exp $")
+RCSID("$NetBSD: board.cc,v 1.2 2005/08/09 02:38:32 christos Exp $")
#include <stdio.h>
#include <string.h>
@@ -154,7 +154,7 @@
{
for (size_t y = 0; y < _ny; y++)
for (size_t x = 0; x < _nx; x++) {
- BOX box(y, x, (BOARD&) *this);
+ BOX box(y, x, const_cast<BOARD&>(*this));
if (box.count() != 4)
return 0;
}
@@ -173,7 +173,7 @@
{
for (size_t y = 0; y < _ny; y++)
for (size_t x = 0; x < _nx; x++) {
- BOX box(y, x, (BOARD&) *this);
+ BOX box(y, x, const_cast<BOARD&>(*this));
box.paint();
}
}
diff -r 0dce8c316d24 -r 394c7758a96d games/dab/box.cc
--- a/games/dab/box.cc Tue Aug 09 02:38:06 2005 +0000
+++ b/games/dab/box.cc Tue Aug 09 02:38:32 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: box.cc,v 1.1 2003/12/27 01:16:55 christos Exp $ */
+/* $NetBSD: box.cc,v 1.2 2005/08/09 02:38:32 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
* box.C: Box computations
*/
#include "defs.h"
-RCSID("$NetBSD: box.cc,v 1.1 2003/12/27 01:16:55 christos Exp $")
+RCSID("$NetBSD: box.cc,v 1.2 2005/08/09 02:38:32 christos Exp $")
#include "box.h"
#include "board.h"
@@ -103,7 +103,7 @@
for (e = BOX::first; e < BOX::last; e++) {
addcorner(_centery + corners[e].y, _centerx + corners[e].x);
_b.getScrn()->moveto(_centery + edges[e].y, _centerx + edges[e].x);
- _b.getScrn()->addedge(edge((EDGE) e));
+ _b.getScrn()->addedge(edge(static_cast<EDGE>(e)));
}
_b.getScrn()->redraw();
}
@@ -144,7 +144,7 @@
int cnt = 0;
for (int e = BOX::first; e < BOX::last; e++)
- cnt += isset((EDGE) e);
+ cnt += isset(static_cast<EDGE>(e));
return cnt;
}
@@ -152,6 +152,6 @@
void BOX::reset(void)
{
for (int e = BOX::first; e < BOX::last; e++)
- clr((EDGE) e);
+ clr(static_cast<EDGE>(e));
name() = ' ';
}
diff -r 0dce8c316d24 -r 394c7758a96d games/dab/ttyscrn.cc
--- a/games/dab/ttyscrn.cc Tue Aug 09 02:38:06 2005 +0000
+++ b/games/dab/ttyscrn.cc Tue Aug 09 02:38:32 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ttyscrn.cc,v 1.2 2003/12/27 18:24:51 martin Exp $ */
+/* $NetBSD: ttyscrn.cc,v 1.3 2005/08/09 02:38:32 christos Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
*/
#include "defs.h"
-RCSID("$NetBSD: ttyscrn.cc,v 1.2 2003/12/27 18:24:51 martin Exp $")
+RCSID("$NetBSD: ttyscrn.cc,v 1.3 2005/08/09 02:38:32 christos Exp $")
#include <stdio.h>
#include <curses.h>
@@ -207,8 +207,9 @@
tx = getmaxx(stdscr);
ty = getmaxy(stdscr);
- if (tx == ERR || ty == ERR || (size_t)tx < x * 2 + TTYSCRN::offsx + 12
- || (size_t)ty < y * 2 + TTYSCRN::offsy) {
+ if (tx == ERR || ty == ERR
+ || static_cast<size_t>(tx) < x * 2 + TTYSCRN::offsx + 12
+ || static_cast<size_t>(ty) < y * 2 + TTYSCRN::offsy) {
endwin();
return NULL;
}
Home |
Main Index |
Thread Index |
Old Index