mirror of
https://github.com/VARCem/PDCurses.git
synced 2026-09-24 15:55:14 +00:00
Similar changes for 0 as for NULL.
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <curspriv.h>
|
||||
|
||||
RCSID("$Id: addch.c,v 1.34 2006/11/05 03:57:26 wmcbrine Exp $");
|
||||
RCSID("$Id: addch.c,v 1.35 2006/11/05 07:13:40 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -172,10 +172,10 @@ int PDC_chadd(WINDOW *win, chtype ch, bool advance)
|
||||
component, use the attributes solely from the incoming
|
||||
character. */
|
||||
|
||||
if ((ch & A_ATTRIBUTES) == 0)
|
||||
if (!(ch & A_ATTRIBUTES))
|
||||
attr = win->_attrs;
|
||||
else
|
||||
if ((ch & A_COLOR) == 0)
|
||||
if (!(ch & A_COLOR))
|
||||
attr = (ch & A_ATTRIBUTES) | win->_attrs;
|
||||
else
|
||||
attr = ch & A_ATTRIBUTES;
|
||||
@@ -187,7 +187,7 @@ int PDC_chadd(WINDOW *win, chtype ch, bool advance)
|
||||
attributes are not there and that the background character
|
||||
will only print if the printing character is blank. */
|
||||
|
||||
if ((attr & A_COLOR) == 0)
|
||||
if (!(attr & A_COLOR))
|
||||
attr |= win->_bkgd & A_ATTRIBUTES;
|
||||
else
|
||||
{
|
||||
@@ -213,7 +213,7 @@ int PDC_chadd(WINDOW *win, chtype ch, bool advance)
|
||||
|
||||
/* if tab to next line, exit the loop */
|
||||
|
||||
if (win->_curx == 0)
|
||||
if (!win->_curx)
|
||||
break;
|
||||
}
|
||||
PDC_sync(win);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <curspriv.h>
|
||||
|
||||
RCSID("$Id: border.c,v 1.42 2006/11/05 04:23:36 wmcbrine Exp $");
|
||||
RCSID("$Id: border.c,v 1.43 2006/11/05 07:13:40 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -121,10 +121,10 @@ static chtype _attr_passthru(WINDOW *win, chtype ch)
|
||||
the window. If the incoming character has a color component,
|
||||
use only the attributes from the incoming character. */
|
||||
|
||||
if ((ch & A_ATTRIBUTES) == 0)
|
||||
if (!(ch & A_ATTRIBUTES))
|
||||
attr = win->_attrs;
|
||||
else
|
||||
if ((ch & A_COLOR) == 0)
|
||||
if (!(ch & A_COLOR))
|
||||
attr = (ch & A_ATTRIBUTES) | win->_attrs;
|
||||
else
|
||||
attr = ch & A_ATTRIBUTES;
|
||||
@@ -133,7 +133,7 @@ static chtype _attr_passthru(WINDOW *win, chtype ch)
|
||||
background, in that it only takes precedence if other color
|
||||
attributes are not there. */
|
||||
|
||||
if ((attr & A_COLOR) == 0)
|
||||
if (!(attr & A_COLOR))
|
||||
attr |= win->_bkgd & A_ATTRIBUTES;
|
||||
else
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#define _INBUFSIZ 512 /* size of terminal input buffer */
|
||||
#define NUNGETCH 256 /* max # chars to ungetch() */
|
||||
|
||||
RCSID("$Id: getch.c,v 1.50 2006/11/05 03:57:26 wmcbrine Exp $");
|
||||
RCSID("$Id: getch.c,v 1.51 2006/11/05 07:13:40 wmcbrine Exp $");
|
||||
|
||||
static int c_pindex = 0; /* putter index */
|
||||
static int c_gindex = 1; /* getter index */
|
||||
@@ -134,7 +134,7 @@ int wgetch(WINDOW *win)
|
||||
delay in 1/20ths of a second (50ms) */
|
||||
|
||||
waitcount = win->_delayms / 50;
|
||||
if (waitcount == 0)
|
||||
if (!waitcount)
|
||||
waitcount = 1;
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ int wgetch(WINDOW *win)
|
||||
{
|
||||
if (SP->delaytenths || win->_delayms)
|
||||
{
|
||||
if (waitcount == 0)
|
||||
if (!waitcount)
|
||||
return ERR;
|
||||
|
||||
waitcount--;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <curspriv.h>
|
||||
|
||||
RCSID("$Id: inopts.c,v 1.33 2006/11/05 03:57:26 wmcbrine Exp $");
|
||||
RCSID("$Id: inopts.c,v 1.34 2006/11/05 07:13:40 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -329,7 +329,7 @@ void wtimeout(WINDOW *win, int delay)
|
||||
win->_nodelay = FALSE;
|
||||
win->_delayms = 0;
|
||||
}
|
||||
else if (delay == 0)
|
||||
else if (!delay)
|
||||
{
|
||||
/* This causes a non-blocking read on the window
|
||||
so turn off delay mode */
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <curspriv.h>
|
||||
#include <string.h>
|
||||
|
||||
RCSID("$Id: insstr.c,v 1.35 2006/11/05 03:57:26 wmcbrine Exp $");
|
||||
RCSID("$Id: insstr.c,v 1.36 2006/11/05 07:13:40 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -170,7 +170,7 @@ int wins_nwstr(WINDOW *win, const wchar_t *wstr, int n)
|
||||
if (!win || !wstr)
|
||||
return ERR;
|
||||
|
||||
for (ic = 0, p = wstr; *p != L'\0'; p++)
|
||||
for (ic = 0, p = wstr; *p; p++)
|
||||
ic++;
|
||||
|
||||
if (n > 0)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <curspriv.h>
|
||||
#include <string.h>
|
||||
|
||||
RCSID("$Id: kernel.c,v 1.65 2006/10/23 05:03:31 wmcbrine Exp $");
|
||||
RCSID("$Id: kernel.c,v 1.66 2006/11/05 07:13:40 wmcbrine Exp $");
|
||||
|
||||
RIPPEDOFFLINE linesripped[5];
|
||||
char linesrippedoff = 0;
|
||||
@@ -246,7 +246,7 @@ int ripoffline(int line, int (*init)(WINDOW *, int))
|
||||
{
|
||||
PDC_LOG(("ripoffline() - called: line=%d\n", line));
|
||||
|
||||
if (linesrippedoff < 5 && line != 0)
|
||||
if (linesrippedoff < 5 && line)
|
||||
{
|
||||
linesripped[(int)linesrippedoff].line = line;
|
||||
linesripped[(int)linesrippedoff++].init = init;
|
||||
|
||||
@@ -27,7 +27,7 @@ static int _pdc_vsscanf(const char *, const char *, va_list);
|
||||
# define vsscanf _pdc_vsscanf
|
||||
#endif
|
||||
|
||||
RCSID("$Id: scanw.c,v 1.32 2006/11/04 12:59:03 wmcbrine Exp $");
|
||||
RCSID("$Id: scanw.c,v 1.33 2006/11/05 07:13:40 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -172,8 +172,8 @@ int vw_scanw(WINDOW *win, const char *fmt, va_list varglist)
|
||||
#define NEXT(x) \
|
||||
do { \
|
||||
x = *buf++; \
|
||||
if (x == '\0') \
|
||||
return (count == 0 ? EOF : count); \
|
||||
if (!x) \
|
||||
return (count ? count : EOF); \
|
||||
++chars; \
|
||||
} while (0)
|
||||
|
||||
@@ -214,9 +214,9 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr)
|
||||
do
|
||||
{
|
||||
c = *buf++;
|
||||
if (c == '\0')
|
||||
if (!c)
|
||||
{
|
||||
if (f == 0 || count != 0)
|
||||
if (!f || count)
|
||||
return count;
|
||||
else
|
||||
return EOF;
|
||||
@@ -247,7 +247,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr)
|
||||
width = 0;
|
||||
while (isdigit(*fmt))
|
||||
width = width * 10 + (*fmt++ - '0');
|
||||
if (width == 0)
|
||||
if (!width)
|
||||
width = INT_MAX;
|
||||
}
|
||||
size = 0;
|
||||
@@ -300,7 +300,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr)
|
||||
}
|
||||
/* no break */
|
||||
default:
|
||||
if (fmt[1] == '-' && fmt[2] != 0
|
||||
if (fmt[1] == '-' && fmt[2]
|
||||
&& f <
|
||||
(unsigned char) fmt[2])
|
||||
{
|
||||
@@ -337,7 +337,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr)
|
||||
if (assign)
|
||||
*char_ptr++ = (char) c;
|
||||
c = *buf++;
|
||||
if (c == '\0')
|
||||
if (!c)
|
||||
break;
|
||||
else
|
||||
++chars;
|
||||
@@ -347,7 +347,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr)
|
||||
*char_ptr = 0;
|
||||
++count;
|
||||
}
|
||||
if (c == '\0')
|
||||
if (!c)
|
||||
return count;
|
||||
else
|
||||
UNGETC();
|
||||
@@ -380,7 +380,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr)
|
||||
dx = dx * 10.0 + (double) (c - '0');
|
||||
ok = TRUE;
|
||||
c = *buf++;
|
||||
if (c == '\0')
|
||||
if (!c)
|
||||
break;
|
||||
else
|
||||
++chars;
|
||||
@@ -397,7 +397,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr)
|
||||
dd *= 10.0;
|
||||
ok = TRUE;
|
||||
c = *buf++;
|
||||
if (c == '\0')
|
||||
if (!c)
|
||||
break;
|
||||
else
|
||||
++chars;
|
||||
@@ -431,7 +431,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr)
|
||||
--width;
|
||||
exp = exp * 10 + (c - '0');
|
||||
c = *buf++;
|
||||
if (c == '\0')
|
||||
if (!c)
|
||||
break;
|
||||
else
|
||||
++chars;
|
||||
@@ -466,7 +466,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr)
|
||||
}
|
||||
++count;
|
||||
}
|
||||
if (c == '\0')
|
||||
if (!c)
|
||||
return count;
|
||||
else
|
||||
UNGETC();
|
||||
@@ -545,7 +545,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr)
|
||||
ok = TRUE;
|
||||
n = n * radix + d;
|
||||
c = *buf++;
|
||||
if (c == '\0')
|
||||
if (!c)
|
||||
break;
|
||||
else
|
||||
++chars;
|
||||
@@ -575,7 +575,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr)
|
||||
}
|
||||
++count;
|
||||
}
|
||||
if (c == '\0')
|
||||
if (!c)
|
||||
return count;
|
||||
else
|
||||
UNGETC();
|
||||
@@ -589,7 +589,7 @@ static int _pdc_vsscanf(const char *buf, const char *fmt, va_list arg_ptr)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (f == 0) /* % at end of string */
|
||||
if (!f) /* % at end of string */
|
||||
return count;
|
||||
NEXT(c);
|
||||
if (c != f)
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <curspriv.h>
|
||||
|
||||
RCSID("$Id: util.c,v 1.54 2006/10/23 05:55:01 wmcbrine Exp $");
|
||||
RCSID("$Id: util.c,v 1.55 2006/11/05 07:13:40 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -225,7 +225,7 @@ int getcchar(const cchar_t *wcval, wchar_t *wch, attr_t *attrs,
|
||||
*attrs = (*wcval & (A_ATTRIBUTES & ~A_COLOR));
|
||||
*color_pair = PAIR_NUMBER(*wcval & A_COLOR);
|
||||
|
||||
if (*wch != L'\0')
|
||||
if (*wch)
|
||||
*++wch = L'\0';
|
||||
|
||||
return OK;
|
||||
@@ -258,7 +258,7 @@ wchar_t *wunctrl(cchar_t *wc)
|
||||
if (ic >= 0x20 && ic != 0x7f) /* normal characters */
|
||||
{
|
||||
strbuf[0] = (wchar_t)ic;
|
||||
strbuf[1] = '\0';
|
||||
strbuf[1] = L'\0';
|
||||
return strbuf;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <curspriv.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
RCSID("$Id: window.c,v 1.44 2006/11/05 03:57:26 wmcbrine Exp $");
|
||||
RCSID("$Id: window.c,v 1.45 2006/11/05 07:13:40 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -215,9 +215,9 @@ WINDOW *newwin(int nlines, int ncols, int begy, int begx)
|
||||
PDC_LOG(("newwin() - called:lines=%d cols=%d begy=%d begx=%d\n",
|
||||
nlines, ncols, begy, begx));
|
||||
|
||||
if (nlines == 0)
|
||||
if (!nlines)
|
||||
nlines = LINES - begy;
|
||||
if (ncols == 0)
|
||||
if (!ncols)
|
||||
ncols = COLS - begx;
|
||||
|
||||
if (begy + nlines > SP->lines || begx + ncols > SP->cols)
|
||||
|
||||
Reference in New Issue
Block a user