Sun Mar 15 20:11:24 2009 UTC ()
Fix sign-compare problem that crept in due to working from an old tree.
Whoops. won't happen again...


(dholland)
diff -r1.35 -r1.36 src/games/sail/pl_7.c

cvs diff -r1.35 -r1.36 src/games/sail/pl_7.c (expand / switch to unified diff)

--- src/games/sail/pl_7.c 2009/03/15 03:33:56 1.35
+++ src/games/sail/pl_7.c 2009/03/15 20:11:24 1.36
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pl_7.c,v 1.35 2009/03/15 03:33:56 dholland Exp $ */ 1/* $NetBSD: pl_7.c,v 1.36 2009/03/15 20:11:24 dholland Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1983, 1993 4 * Copyright (c) 1983, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#ifndef lint 33#ifndef lint
34#if 0 34#if 0
35static char sccsid[] = "@(#)pl_7.c 8.1 (Berkeley) 5/31/93"; 35static char sccsid[] = "@(#)pl_7.c 8.1 (Berkeley) 5/31/93";
36#else 36#else
37__RCSID("$NetBSD: pl_7.c,v 1.35 2009/03/15 03:33:56 dholland Exp $"); 37__RCSID("$NetBSD: pl_7.c,v 1.36 2009/03/15 20:11:24 dholland Exp $");
38#endif 38#endif
39#endif /* not lint */ 39#endif /* not lint */
40 40
41#include <curses.h> 41#include <curses.h>
42#include <err.h> 42#include <err.h>
43#include <errno.h> 43#include <errno.h>
44#include <signal.h> 44#include <signal.h>
45#include <stdarg.h> 45#include <stdarg.h>
46#include <stdio.h> 46#include <stdio.h>
47#include <stdlib.h> 47#include <stdlib.h>
48#include <string.h> 48#include <string.h>
49#include "array.h" 49#include "array.h"
50#include "extern.h" 50#include "extern.h"
@@ -220,27 +220,28 @@ draw_scroll(void) @@ -220,27 +220,28 @@ draw_scroll(void)
220 220
221 total_lines = stringarray_num(sc_lines); 221 total_lines = stringarray_num(sc_lines);
222 if (total_lines > visible_lines) { 222 if (total_lines > visible_lines) {
223 index_of_top = total_lines - visible_lines; 223 index_of_top = total_lines - visible_lines;
224 } else { 224 } else {
225 index_of_top = 0; 225 index_of_top = 0;
226 } 226 }
227 if (index_of_top < sc_scrollup) { 227 if (index_of_top < sc_scrollup) {
228 index_of_top = 0; 228 index_of_top = 0;
229 } else { 229 } else {
230 index_of_top -= sc_scrollup; 230 index_of_top -= sc_scrollup;
231 } 231 }
232 232
233 for (y = 0; y < SCROLL_Y - 1; y++) { 233 /* XXX: SCROLL_Y and whatnot should be unsigned too */
 234 for (y = 0; y < (unsigned) (SCROLL_Y - 1); y++) {
234 index_of_y = index_of_top + y; 235 index_of_y = index_of_top + y;
235 if (index_of_y >= total_lines) { 236 if (index_of_y >= total_lines) {
236 break; 237 break;
237 } 238 }
238 wmove(scroll_w, y, 0); 239 wmove(scroll_w, y, 0);
239 waddstr(scroll_w, stringarray_get(sc_lines, index_of_y)); 240 waddstr(scroll_w, stringarray_get(sc_lines, index_of_y));
240 } 241 }
241 if (sc_hasprompt && !sc_hideprompt) { 242 if (sc_hasprompt && !sc_hideprompt) {
242 wmove(scroll_w, SCROLL_Y-1, 0); 243 wmove(scroll_w, SCROLL_Y-1, 0);
243 waddstr(scroll_w, sc_prompt); 244 waddstr(scroll_w, sc_prompt);
244 waddstr(scroll_w, sc_buf); 245 waddstr(scroll_w, sc_buf);
245 cursorx = strlen(sc_prompt) + strlen(sc_buf); 246 cursorx = strlen(sc_prompt) + strlen(sc_buf);
246 wmove(scroll_w, SCROLL_Y-1, cursorx); 247 wmove(scroll_w, SCROLL_Y-1, cursorx);