diff options
author | 2000-06-19 03:53:34 +0000 | |
---|---|---|
committer | 2000-06-19 03:53:34 +0000 | |
commit | 1fe33145a0a9b1310a0413297a8deb871918b27f (patch) | |
tree | a49980b8f48836a617da8010fb9ef237771dbe5b /lib/libcurses/base/lib_color.c | |
parent | IPv6 IPsec, outbound direction. (diff) | |
download | wireguard-openbsd-1fe33145a0a9b1310a0413297a8deb871918b27f.tar.xz wireguard-openbsd-1fe33145a0a9b1310a0413297a8deb871918b27f.zip |
ncurses-5.0-20000617
Diffstat (limited to 'lib/libcurses/base/lib_color.c')
-rw-r--r-- | lib/libcurses/base/lib_color.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/libcurses/base/lib_color.c b/lib/libcurses/base/lib_color.c index 7d246bd05ee..a1a195453c4 100644 --- a/lib/libcurses/base/lib_color.c +++ b/lib/libcurses/base/lib_color.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib_color.c,v 1.7 2000/03/26 16:45:03 millert Exp $ */ +/* $OpenBSD: lib_color.c,v 1.8 2000/06/19 03:53:40 millert Exp $ */ /**************************************************************************** * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * @@ -43,7 +43,7 @@ #include <term.h> #include <tic.h> -MODULE_ID("$From: lib_color.c,v 1.49 2000/03/26 03:12:12 tom Exp $") +MODULE_ID("$From: lib_color.c,v 1.51 2000/05/20 20:09:22 tom Exp $") /* * These should be screen structure members. They need to be globals for @@ -314,7 +314,7 @@ init_pair(short pair, short f, short b) } } SP->_color_pairs[pair] = result; - if ((int)(SP->_current_attr & A_COLOR) == COLOR_PAIR(pair)) + if ((int) (SP->_current_attr & A_COLOR) == COLOR_PAIR(pair)) SP->_current_attr |= A_COLOR; /* force attribute update */ if (initialize_pair) { @@ -421,10 +421,12 @@ pair_content(short pair, short *f, short *b) void _nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int)) { - short fg = C_MASK, bg = C_MASK; - short old_fg, old_bg; + NCURSES_COLOR_T fg = C_MASK, bg = C_MASK; + NCURSES_COLOR_T old_fg, old_bg; - if (pair != 0) { + if (pair < 0 || pair >= COLOR_PAIRS) { + return; + } else if (pair != 0) { if (set_color_pair) { TPUTS_TRACE("set_color_pair"); tputs(tparm(set_color_pair, pair), 1, outc); @@ -466,7 +468,7 @@ _nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int)) #endif if (reverse) { - short xx = fg; + NCURSES_COLOR_T xx = fg; fg = bg; bg = xx; } |