Fix some compiler warnings.

Remove shadowed variable declarations when DEBUG is defined.
This commit is contained in:
blymn 2007-05-29 11:10:55 +00:00
parent d04d1dbd4b
commit 070937be37
9 changed files with 45 additions and 43 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: background.c,v 1.11 2007/05/28 15:01:54 blymn Exp $ */ /* $NetBSD: background.c,v 1.12 2007/05/29 11:10:55 blymn Exp $ */
/*- /*-
* Copyright (c) 2000 The NetBSD Foundation, Inc. * Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: background.c,v 1.11 2007/05/28 15:01:54 blymn Exp $"); __RCSID("$NetBSD: background.c,v 1.12 2007/05/29 11:10:55 blymn Exp $");
#endif /* not lint */ #endif /* not lint */
#include <stdlib.h> #include <stdlib.h>
@ -177,7 +177,7 @@ int wbkgrnd(WINDOW *win, const cchar_t *wch)
#ifdef DEBUG #ifdef DEBUG
__CTRACE(__CTRACE_ATTR, "wbkgrnd: (%p), '%s', %x\n", __CTRACE(__CTRACE_ATTR, "wbkgrnd: (%p), '%s', %x\n",
win, (char *) wunctrl(wch), wch->attributes); win, (const char *) wunctrl(wch), wch->attributes);
#endif #endif
/* ignore multi-column characters */ /* ignore multi-column characters */
@ -205,7 +205,7 @@ void wbkgrndset(WINDOW *win, const cchar_t *wch)
#ifdef DEBUG #ifdef DEBUG
__CTRACE(__CTRACE_ATTR, "wbkgrndset: (%p), '%s', %x\n", __CTRACE(__CTRACE_ATTR, "wbkgrndset: (%p), '%s', %x\n",
win, (char *) wunctrl(wch), wch->attributes); win, (const char *) wunctrl(wch), wch->attributes);
#endif #endif
/* ignore multi-column characters */ /* ignore multi-column characters */

View File

@ -1,4 +1,4 @@
/* $NetBSD: cchar.c,v 1.2 2007/05/28 15:01:54 blymn Exp $ */ /* $NetBSD: cchar.c,v 1.3 2007/05/29 11:10:56 blymn Exp $ */
/* /*
* Copyright (c) 2005 The NetBSD Foundation Inc. * Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: cchar.c,v 1.2 2007/05/28 15:01:54 blymn Exp $"); __RCSID("$NetBSD: cchar.c,v 1.3 2007/05/29 11:10:56 blymn Exp $");
#endif /* not lint */ #endif /* not lint */
#include <string.h> #include <string.h>
@ -56,7 +56,7 @@ getcchar(const cchar_t *wcval, wchar_t *wch, attr_t *attrs,
return ERR; return ERR;
#else #else
wchar_t *wp; wchar_t *wp;
int len; size_t len;
if ( opts ) if ( opts )
return ERR; return ERR;
@ -65,11 +65,11 @@ getcchar(const cchar_t *wcval, wchar_t *wch, attr_t *attrs,
? wp - wcval->vals : CCHARW_MAX; ? wp - wcval->vals : CCHARW_MAX;
if (wch == NULL) if (wch == NULL)
return len; return (int) len;
if (attrs == 0 || color_pair == 0) if (attrs == 0 || color_pair == 0)
return ERR; return ERR;
if (len >= 0) { if (len > 0) {
*attrs = wcval -> attributes; *attrs = wcval->attributes;
*color_pair = COLOR_PAIR( wcval -> attributes ); *color_pair = COLOR_PAIR( wcval -> attributes );
wmemcpy(wch, wcval->vals, (unsigned) len); wmemcpy(wch, wcval->vals, (unsigned) len);
wch[len] = L'\0'; wch[len] = L'\0';
@ -90,7 +90,7 @@ setcchar(cchar_t *wcval, const wchar_t *wch, const attr_t attrs,
return ERR; return ERR;
#else #else
int i; int i;
int len; size_t len;
if (opts || (len = wcslen(wch)) > CCHARW_MAX if (opts || (len = wcslen(wch)) > CCHARW_MAX
|| (len > 1 && wcwidth(wch[0]) < 0)) { || (len > 1 && wcwidth(wch[0]) < 0)) {
@ -118,4 +118,3 @@ setcchar(cchar_t *wcval, const wchar_t *wch, const attr_t attrs,
return OK; return OK;
#endif /* HAVE_WCHAR */ #endif /* HAVE_WCHAR */
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: clrtobot.c,v 1.19 2007/05/28 15:01:54 blymn Exp $ */ /* $NetBSD: clrtobot.c,v 1.20 2007/05/29 11:10:56 blymn Exp $ */
/* /*
* Copyright (c) 1981, 1993, 1994 * Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)clrtobot.c 8.2 (Berkeley) 5/4/94"; static char sccsid[] = "@(#)clrtobot.c 8.2 (Berkeley) 5/4/94";
#else #else
__RCSID("$NetBSD: clrtobot.c,v 1.19 2007/05/28 15:01:54 blymn Exp $"); __RCSID("$NetBSD: clrtobot.c,v 1.20 2007/05/29 11:10:56 blymn Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -93,7 +93,7 @@ wclrtobot(WINDOW *win)
#endif /* HAVE_WCHAR */ #endif /* HAVE_WCHAR */
maxx = sp; maxx = sp;
if (minx == -1) if (minx == -1)
minx = sp - win->lines[y]->line; minx = (int)(sp - win->lines[y]->line);
sp->attr = attr; sp->attr = attr;
#ifdef HAVE_WCHAR #ifdef HAVE_WCHAR
sp->ch = ( wchar_t )btowc(( int ) win->bch); sp->ch = ( wchar_t )btowc(( int ) win->bch);
@ -107,7 +107,8 @@ wclrtobot(WINDOW *win)
} }
if (minx != -1) if (minx != -1)
__touchline(win, y, minx, maxx - win->lines[y]->line); __touchline(win, y, minx,
(int) (maxx - win->lines[y]->line));
startx = 0; startx = 0;
} }
return (OK); return (OK);

View File

@ -1,4 +1,4 @@
/* $NetBSD: clrtoeol.c,v 1.23 2007/05/28 15:01:54 blymn Exp $ */ /* $NetBSD: clrtoeol.c,v 1.24 2007/05/29 11:10:56 blymn Exp $ */
/* /*
* Copyright (c) 1981, 1993, 1994 * Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)clrtoeol.c 8.2 (Berkeley) 5/4/94"; static char sccsid[] = "@(#)clrtoeol.c 8.2 (Berkeley) 5/4/94";
#else #else
__RCSID("$NetBSD: clrtoeol.c,v 1.23 2007/05/28 15:01:54 blymn Exp $"); __RCSID("$NetBSD: clrtoeol.c,v 1.24 2007/05/29 11:10:56 blymn Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -96,7 +96,7 @@ wclrtoeol(WINDOW *win)
#endif /* HAVE_WCHAR */ #endif /* HAVE_WCHAR */
maxx = sp; maxx = sp;
if (minx == -1) if (minx == -1)
minx = sp - win->lines[y]->line; minx = (int) (sp - win->lines[y]->line);
sp->attr = attr; sp->attr = attr;
#ifdef HAVE_WCHAR #ifdef HAVE_WCHAR
sp->ch = ( wchar_t )btowc(( int ) win->bch); sp->ch = ( wchar_t )btowc(( int ) win->bch);

View File

@ -1,4 +1,4 @@
/* $NetBSD: get_wch.c,v 1.2 2007/05/28 15:01:55 blymn Exp $ */ /* $NetBSD: get_wch.c,v 1.3 2007/05/29 11:10:56 blymn Exp $ */
/* /*
* Copyright (c) 2005 The NetBSD Foundation Inc. * Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: get_wch.c,v 1.2 2007/05/28 15:01:55 blymn Exp $"); __RCSID("$NetBSD: get_wch.c,v 1.3 2007/05/29 11:10:56 blymn Exp $");
#endif /* not lint */ #endif /* not lint */
#include <string.h> #include <string.h>
@ -279,7 +279,7 @@ inkey(wchar_t *wc, int to, int delay)
"urrent(%d), tail(%d)]\n", "urrent(%d), tail(%d)]\n",
*start, *working, *end); *start, *working, *end);
#endif /* DEBUG */ #endif /* DEBUG */
ret = mbrtowc( wc, inbuf + (*working), 1, ret = (int) mbrtowc( wc, inbuf + (*working), 1,
&_cursesi_screen->sp ); &_cursesi_screen->sp );
#ifdef DEBUG #ifdef DEBUG
__CTRACE(__CTRACE_INPUT, __CTRACE(__CTRACE_INPUT,
@ -368,7 +368,7 @@ inkey(wchar_t *wc, int to, int delay)
"current(%d), tail(%d), mlen(%ld)]\n", "current(%d), tail(%d), mlen(%ld)]\n",
*start, *working, *end, (long) mlen); *start, *working, *end, (long) mlen);
#endif /* DEBUG */ #endif /* DEBUG */
ret = mbrtowc( wc, inbuf + (*working), mlen, ret = (int) mbrtowc( wc, inbuf + (*working), mlen,
&_cursesi_screen->sp ); &_cursesi_screen->sp );
#ifdef DEBUG #ifdef DEBUG
__CTRACE(__CTRACE_INPUT, __CTRACE(__CTRACE_INPUT,
@ -379,11 +379,12 @@ inkey(wchar_t *wc, int to, int delay)
*working = 0; *working = 0;
mlen = *end; mlen = *end;
if ( mlen ) if ( mlen )
ret = mbrtowc( wc, inbuf, mlen, ret = (int) mbrtowc( wc, inbuf, mlen,
&_cursesi_screen->sp ); &_cursesi_screen->sp );
} }
if ( ret == -2 && wstate != INKEY_TIMEOUT ) { if ( ret == -2 && wstate != INKEY_TIMEOUT ) {
*working = (*working + mlen) % MAX_CBUF_SIZE; *working = (*working + (int) mlen)
% MAX_CBUF_SIZE;
wstate = INKEY_WCASSEMBLING; wstate = INKEY_WCASSEMBLING;
continue; continue;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: ins_wch.c,v 1.2 2007/05/28 15:01:56 blymn Exp $ */ /* $NetBSD: ins_wch.c,v 1.3 2007/05/29 11:10:56 blymn Exp $ */
/* /*
* Copyright (c) 2005 The NetBSD Foundation Inc. * Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: ins_wch.c,v 1.2 2007/05/28 15:01:56 blymn Exp $"); __RCSID("$NetBSD: ins_wch.c,v 1.3 2007/05/29 11:10:56 blymn Exp $");
#endif /* not lint */ #endif /* not lint */
#include <string.h> #include <string.h>
@ -232,7 +232,6 @@ wins_wch(WINDOW *win, const cchar_t *wch)
} }
#ifdef DEBUG #ifdef DEBUG
{ {
int x;
__CTRACE(__CTRACE_INPUT, "--after---\n"); __CTRACE(__CTRACE_INPUT, "--after---\n");
for ( x = 0; x < win->maxx; x++ ) for ( x = 0; x < win->maxx; x++ )
__CTRACE(__CTRACE_INPUT, __CTRACE(__CTRACE_INPUT,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ins_wstr.c,v 1.2 2007/05/28 15:01:56 blymn Exp $ */ /* $NetBSD: ins_wstr.c,v 1.3 2007/05/29 11:10:56 blymn Exp $ */
/* /*
* Copyright (c) 2005 The NetBSD Foundation Inc. * Copyright (c) 2005 The NetBSD Foundation Inc.
@ -36,7 +36,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: ins_wstr.c,v 1.2 2007/05/28 15:01:56 blymn Exp $"); __RCSID("$NetBSD: ins_wstr.c,v 1.3 2007/05/29 11:10:56 blymn Exp $");
#endif /* not lint */ #endif /* not lint */
#include <string.h> #include <string.h>
@ -181,7 +181,6 @@ wins_nwstr(WINDOW *win, const wchar_t *wstr, int n)
*lnp->firstchp = newx; *lnp->firstchp = newx;
#ifdef DEBUG #ifdef DEBUG
{ {
int x;
__CTRACE(__CTRACE_INPUT, "========before=======\n"); __CTRACE(__CTRACE_INPUT, "========before=======\n");
for (x = 0; x < win->maxx; x++) for (x = 0; x < win->maxx; x++)
__CTRACE(__CTRACE_INPUT, __CTRACE(__CTRACE_INPUT,
@ -227,7 +226,6 @@ wins_nwstr(WINDOW *win, const wchar_t *wstr, int n)
} }
#ifdef DEBUG #ifdef DEBUG
{ {
int x;
__CTRACE(__CTRACE_INPUT, "=====after shift====\n"); __CTRACE(__CTRACE_INPUT, "=====after shift====\n");
for (x = 0; x < win->maxx; x++) for (x = 0; x < win->maxx; x++)
__CTRACE(__CTRACE_INPUT, __CTRACE(__CTRACE_INPUT,
@ -308,7 +306,6 @@ wins_nwstr(WINDOW *win, const wchar_t *wstr, int n)
} }
#ifdef DEBUG #ifdef DEBUG
{ {
int x;
__CTRACE(__CTRACE_INPUT, "========after=======\n"); __CTRACE(__CTRACE_INPUT, "========after=======\n");
for (x = 0; x < win->maxx; x++) for (x = 0; x < win->maxx; x++)
__CTRACE(__CTRACE_INPUT, __CTRACE(__CTRACE_INPUT,

View File

@ -1,4 +1,4 @@
/* $NetBSD: refresh.c,v 1.65 2007/05/28 15:01:57 blymn Exp $ */ /* $NetBSD: refresh.c,v 1.66 2007/05/29 11:10:56 blymn Exp $ */
/* /*
* Copyright (c) 1981, 1993, 1994 * Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)refresh.c 8.7 (Berkeley) 8/13/94"; static char sccsid[] = "@(#)refresh.c 8.7 (Berkeley) 8/13/94";
#else #else
__RCSID("$NetBSD: refresh.c,v 1.65 2007/05/28 15:01:57 blymn Exp $"); __RCSID("$NetBSD: refresh.c,v 1.66 2007/05/29 11:10:56 blymn Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -634,7 +634,7 @@ makech(int wy)
WINDOW *win; WINDOW *win;
static __LDATA blank; static __LDATA blank;
__LDATA *nsp, *csp, *cp, *cep; __LDATA *nsp, *csp, *cp, *cep;
int clsp, nlsp; /* Last space in lines. */ size_t clsp, nlsp; /* Last space in lines. */
int lch, wx; int lch, wx;
char *ce; char *ce;
attr_t lspc; /* Last space colour */ attr_t lspc; /* Last space colour */
@ -732,9 +732,10 @@ makech(int wy)
if (cp-- <= win->lines[wy]->line) if (cp-- <= win->lines[wy]->line)
break; break;
#endif /* HAVE_WCHAR */ #endif /* HAVE_WCHAR */
nlsp = cp - win->lines[wy]->line; if (win->lines[wy]->line > cp)
if (nlsp < 0)
nlsp = 0; nlsp = 0;
else
nlsp = cp - win->lines[wy]->line;
} }
if (!_cursesi_screen->curwin) if (!_cursesi_screen->curwin)
ce = __tc_ce; ce = __tc_ce;
@ -827,7 +828,7 @@ makech(int wy)
win->begx * __LDATASIZE; win->begx * __LDATASIZE;
#ifdef DEBUG #ifdef DEBUG
__CTRACE(__CTRACE_REFRESH, __CTRACE(__CTRACE_REFRESH,
"makech: clsp = %d, nlsp = %d\n", "makech: clsp = %ld, nlsp = %ld\n",
clsp, nlsp); clsp, nlsp);
#endif #endif
if (((clsp - nlsp >= strlen(__tc_ce) && if (((clsp - nlsp >= strlen(__tc_ce) &&
@ -1787,10 +1788,14 @@ __cursesi_putnsp(nschar_t *nsp, const int wy, const int wx)
{ {
nschar_t *p; nschar_t *p;
/* this shuts up gcc warnings about wx and wy not being used */
if (wx > wy) {
}
p = nsp; p = nsp;
while (p != NULL) { while (p != NULL) {
__cputwchar((int) p->ch); __cputwchar((int) p->ch);
#ifdef BEBUG #ifdef DEBUG
__CTRACE(__CTRACE_REFRESH, __CTRACE(__CTRACE_REFRESH,
"_cursesi_putnsp: (%d,%d) non-spacing putwchar(0x%x)\n", "_cursesi_putnsp: (%d,%d) non-spacing putwchar(0x%x)\n",
wy, wx - 1, p->ch); wy, wx - 1, p->ch);

View File

@ -1,4 +1,4 @@
/* $NetBSD: scanw.c,v 1.18 2003/08/07 16:44:23 agc Exp $ */ /* $NetBSD: scanw.c,v 1.19 2007/05/29 11:10:56 blymn Exp $ */
/* /*
* Copyright (c) 1981, 1993, 1994 * Copyright (c) 1981, 1993, 1994
@ -34,7 +34,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)scanw.c 8.3 (Berkeley) 5/4/94"; static char sccsid[] = "@(#)scanw.c 8.3 (Berkeley) 5/4/94";
#else #else
__RCSID("$NetBSD: scanw.c,v 1.18 2003/08/07 16:44:23 agc Exp $"); __RCSID("$NetBSD: scanw.c,v 1.19 2007/05/29 11:10:56 blymn Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -118,6 +118,6 @@ vwscanw(WINDOW *win, const char *fmt, _BSD_VA_LIST_ ap)
char buf[1024]; char buf[1024];
return (wgetnstr(win, buf, sizeof(buf)) == OK ? return (wgetnstr(win, buf, (int) sizeof(buf)) == OK ?
vsscanf(buf, fmt, ap) : ERR); vsscanf(buf, fmt, ap) : ERR);
} }