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.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#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 */
#include <stdlib.h>
@ -177,7 +177,7 @@ int wbkgrnd(WINDOW *win, const cchar_t *wch)
#ifdef DEBUG
__CTRACE(__CTRACE_ATTR, "wbkgrnd: (%p), '%s', %x\n",
win, (char *) wunctrl(wch), wch->attributes);
win, (const char *) wunctrl(wch), wch->attributes);
#endif
/* ignore multi-column characters */
@ -205,7 +205,7 @@ void wbkgrndset(WINDOW *win, const cchar_t *wch)
#ifdef DEBUG
__CTRACE(__CTRACE_ATTR, "wbkgrndset: (%p), '%s', %x\n",
win, (char *) wunctrl(wch), wch->attributes);
win, (const char *) wunctrl(wch), wch->attributes);
#endif
/* 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.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#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 */
#include <string.h>
@ -56,7 +56,7 @@ getcchar(const cchar_t *wcval, wchar_t *wch, attr_t *attrs,
return ERR;
#else
wchar_t *wp;
int len;
size_t len;
if ( opts )
return ERR;
@ -65,11 +65,11 @@ getcchar(const cchar_t *wcval, wchar_t *wch, attr_t *attrs,
? wp - wcval->vals : CCHARW_MAX;
if (wch == NULL)
return len;
return (int) len;
if (attrs == 0 || color_pair == 0)
return ERR;
if (len >= 0) {
*attrs = wcval -> attributes;
if (len > 0) {
*attrs = wcval->attributes;
*color_pair = COLOR_PAIR( wcval -> attributes );
wmemcpy(wch, wcval->vals, (unsigned) len);
wch[len] = L'\0';
@ -90,7 +90,7 @@ setcchar(cchar_t *wcval, const wchar_t *wch, const attr_t attrs,
return ERR;
#else
int i;
int len;
size_t len;
if (opts || (len = wcslen(wch)) > CCHARW_MAX
|| (len > 1 && wcwidth(wch[0]) < 0)) {
@ -118,4 +118,3 @@ setcchar(cchar_t *wcval, const wchar_t *wch, const attr_t attrs,
return OK;
#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
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)clrtobot.c 8.2 (Berkeley) 5/4/94";
#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 /* not lint */
@ -93,7 +93,7 @@ wclrtobot(WINDOW *win)
#endif /* HAVE_WCHAR */
maxx = sp;
if (minx == -1)
minx = sp - win->lines[y]->line;
minx = (int)(sp - win->lines[y]->line);
sp->attr = attr;
#ifdef HAVE_WCHAR
sp->ch = ( wchar_t )btowc(( int ) win->bch);
@ -107,7 +107,8 @@ wclrtobot(WINDOW *win)
}
if (minx != -1)
__touchline(win, y, minx, maxx - win->lines[y]->line);
__touchline(win, y, minx,
(int) (maxx - win->lines[y]->line));
startx = 0;
}
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
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)clrtoeol.c 8.2 (Berkeley) 5/4/94";
#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 /* not lint */
@ -96,7 +96,7 @@ wclrtoeol(WINDOW *win)
#endif /* HAVE_WCHAR */
maxx = sp;
if (minx == -1)
minx = sp - win->lines[y]->line;
minx = (int) (sp - win->lines[y]->line);
sp->attr = attr;
#ifdef HAVE_WCHAR
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.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#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 */
#include <string.h>
@ -279,7 +279,7 @@ inkey(wchar_t *wc, int to, int delay)
"urrent(%d), tail(%d)]\n",
*start, *working, *end);
#endif /* DEBUG */
ret = mbrtowc( wc, inbuf + (*working), 1,
ret = (int) mbrtowc( wc, inbuf + (*working), 1,
&_cursesi_screen->sp );
#ifdef DEBUG
__CTRACE(__CTRACE_INPUT,
@ -368,7 +368,7 @@ inkey(wchar_t *wc, int to, int delay)
"current(%d), tail(%d), mlen(%ld)]\n",
*start, *working, *end, (long) mlen);
#endif /* DEBUG */
ret = mbrtowc( wc, inbuf + (*working), mlen,
ret = (int) mbrtowc( wc, inbuf + (*working), mlen,
&_cursesi_screen->sp );
#ifdef DEBUG
__CTRACE(__CTRACE_INPUT,
@ -379,11 +379,12 @@ inkey(wchar_t *wc, int to, int delay)
*working = 0;
mlen = *end;
if ( mlen )
ret = mbrtowc( wc, inbuf, mlen,
ret = (int) mbrtowc( wc, inbuf, mlen,
&_cursesi_screen->sp );
}
if ( ret == -2 && wstate != INKEY_TIMEOUT ) {
*working = (*working + mlen) % MAX_CBUF_SIZE;
*working = (*working + (int) mlen)
% MAX_CBUF_SIZE;
wstate = INKEY_WCASSEMBLING;
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.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#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 */
#include <string.h>
@ -232,7 +232,6 @@ wins_wch(WINDOW *win, const cchar_t *wch)
}
#ifdef DEBUG
{
int x;
__CTRACE(__CTRACE_INPUT, "--after---\n");
for ( x = 0; x < win->maxx; x++ )
__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.
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#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 */
#include <string.h>
@ -181,7 +181,6 @@ wins_nwstr(WINDOW *win, const wchar_t *wstr, int n)
*lnp->firstchp = newx;
#ifdef DEBUG
{
int x;
__CTRACE(__CTRACE_INPUT, "========before=======\n");
for (x = 0; x < win->maxx; x++)
__CTRACE(__CTRACE_INPUT,
@ -227,7 +226,6 @@ wins_nwstr(WINDOW *win, const wchar_t *wstr, int n)
}
#ifdef DEBUG
{
int x;
__CTRACE(__CTRACE_INPUT, "=====after shift====\n");
for (x = 0; x < win->maxx; x++)
__CTRACE(__CTRACE_INPUT,
@ -308,7 +306,6 @@ wins_nwstr(WINDOW *win, const wchar_t *wstr, int n)
}
#ifdef DEBUG
{
int x;
__CTRACE(__CTRACE_INPUT, "========after=======\n");
for (x = 0; x < win->maxx; x++)
__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
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)refresh.c 8.7 (Berkeley) 8/13/94";
#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 /* not lint */
@ -634,7 +634,7 @@ makech(int wy)
WINDOW *win;
static __LDATA blank;
__LDATA *nsp, *csp, *cp, *cep;
int clsp, nlsp; /* Last space in lines. */
size_t clsp, nlsp; /* Last space in lines. */
int lch, wx;
char *ce;
attr_t lspc; /* Last space colour */
@ -732,9 +732,10 @@ makech(int wy)
if (cp-- <= win->lines[wy]->line)
break;
#endif /* HAVE_WCHAR */
nlsp = cp - win->lines[wy]->line;
if (nlsp < 0)
if (win->lines[wy]->line > cp)
nlsp = 0;
else
nlsp = cp - win->lines[wy]->line;
}
if (!_cursesi_screen->curwin)
ce = __tc_ce;
@ -827,7 +828,7 @@ makech(int wy)
win->begx * __LDATASIZE;
#ifdef DEBUG
__CTRACE(__CTRACE_REFRESH,
"makech: clsp = %d, nlsp = %d\n",
"makech: clsp = %ld, nlsp = %ld\n",
clsp, nlsp);
#endif
if (((clsp - nlsp >= strlen(__tc_ce) &&
@ -1787,10 +1788,14 @@ __cursesi_putnsp(nschar_t *nsp, const int wy, const int wx)
{
nschar_t *p;
/* this shuts up gcc warnings about wx and wy not being used */
if (wx > wy) {
}
p = nsp;
while (p != NULL) {
__cputwchar((int) p->ch);
#ifdef BEBUG
#ifdef DEBUG
__CTRACE(__CTRACE_REFRESH,
"_cursesi_putnsp: (%d,%d) non-spacing putwchar(0x%x)\n",
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
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)scanw.c 8.3 (Berkeley) 5/4/94";
#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 /* not lint */
@ -118,6 +118,6 @@ vwscanw(WINDOW *win, const char *fmt, _BSD_VA_LIST_ ap)
char buf[1024];
return (wgetnstr(win, buf, sizeof(buf)) == OK ?
return (wgetnstr(win, buf, (int) sizeof(buf)) == OK ?
vsscanf(buf, fmt, ap) : ERR);
}