X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=include%2Fcurses.h.in;h=e67c3f251e42565b0691515fe2db2a1dc60ccedd;hp=fc714f6777c9206d0e5f82a72806bff175e952a3;hb=5e9dacf37f4f807f4e09bd98874f32d6e4f9a37a;hpb=f79b52fddd95c7a6f1ead29ef9c39eb8cdf60795 diff --git a/include/curses.h.in b/include/curses.h.in index fc714f67..e67c3f25 100644 --- a/include/curses.h.in +++ b/include/curses.h.in @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ * and: Thomas E. Dickey 1996-on * ****************************************************************************/ -/* $Id: curses.h.in,v 1.218 2010/12/25 23:39:07 tom Exp $ */ +/* $Id: curses.h.in,v 1.224 2011/06/06 08:44:06 tom Exp $ */ #ifndef __NCURSES_H #define __NCURSES_H @@ -1145,7 +1145,7 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /* #define winsstr(w, s) winsnstr(w, s, -1) #if !NCURSES_OPAQUE -#define redrawwin(win) wredrawln(win, 0, (win)->_maxy+1) +#define redrawwin(win) wredrawln(win, 0, ((win) ? (win)->_maxy+1 : -1)) #endif /* NCURSES_OPAQUE */ #define waddstr(win,str) waddnstr(win,str,-1) @@ -1256,7 +1256,7 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /* * Some wide-character functions can be implemented without the extensions. */ #if !NCURSES_OPAQUE -#define getbkgd(win) ((win)->_bkgd) +#define getbkgd(win) ((win) ? ((win)->_bkgd) : 0) #endif /* NCURSES_OPAQUE */ #define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a)) @@ -1264,16 +1264,25 @@ extern NCURSES_EXPORT(int) NCURSES_SP_NAME(use_legacy_coding) (SCREEN*, int); /* #if !NCURSES_OPAQUE #if defined(NCURSES_WIDECHAR) && @NCURSES_EXT_COLORS@ -#define wattr_set(win,a,p,opts) ((win)->_attrs = ((a) & ~A_COLOR), \ - (win)->_color = (p), \ +#define wattr_set(win,a,p,opts) (((win) \ + ? ((win)->_attrs = ((a) & ~A_COLOR), \ + (win)->_color = (p)) \ + : OK), \ OK) -#define wattr_get(win,a,p,opts) ((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \ - (void)((p) != (void *)0 && (*(p) = (win)->_color)), \ +#define wattr_get(win,a,p,opts) (((win) \ + ? ((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \ + (void)((p) != (void *)0 && (*(p) = (short)(win)->_color)),OK) \ + : OK), \ OK) #else -#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK) -#define wattr_get(win,a,p,opts) ((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \ - (void)((p) != (void *)0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \ +#define wattr_set(win,a,p,opts) (((win) \ + ? ((win)->_attrs = (((a) & ~A_COLOR) | (attr_t)COLOR_PAIR(p))) \ + : OK), \ + OK) +#define wattr_get(win,a,p,opts) (((win) \ + ? ((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \ + (void)((p) != (void *)0 && (*(p) = (short)PAIR_NUMBER((win)->_attrs))),OK) \ + : OK), \ OK) #endif #endif /* NCURSES_OPAQUE */