From 041b8bdf73235bfc91782b8a3188f12adbb02993 Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 10 Oct 2021 21:56:50 -0400 Subject: [PATCH] ncstyle functions ought return uint16_t #1777 #2200 --- include/notcurses/direct.h | 4 ++-- include/notcurses/notcurses.h | 4 ++-- src/lib/direct.c | 4 ++-- src/lib/notcurses.c | 2 +- src/lib/termdesc.h | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/notcurses/direct.h b/include/notcurses/direct.h index 54b2bc7cc9..2eb47163e0 100644 --- a/include/notcurses/direct.h +++ b/include/notcurses/direct.h @@ -201,7 +201,7 @@ API int ncdirect_dim_y(struct ncdirect* nc) __attribute__ ((nonnull (1))); // (NCSTYLE_UNDERLINE, NCSTYLE_BOLD, etc.) The attribute is only // indicated as supported if the terminal can support it together with color. // For more information, see the "ncv" capability in terminfo(5). -API unsigned ncdirect_supported_styles(const struct ncdirect* nc); +API uint16_t ncdirect_supported_styles(const struct ncdirect* nc); // ncplane_styles_*() analogues API int ncdirect_set_styles(struct ncdirect* n, unsigned stylebits) @@ -210,7 +210,7 @@ API int ncdirect_on_styles(struct ncdirect* n, unsigned stylebits) __attribute__ ((nonnull (1))); API int ncdirect_off_styles(struct ncdirect* n, unsigned stylebits) __attribute__ ((nonnull (1))); -API unsigned ncdirect_styles(const struct ncdirect* n) +API uint16_t ncdirect_styles(const struct ncdirect* n) __attribute__ ((nonnull (1))); // Deprecated forms of above. diff --git a/include/notcurses/notcurses.h b/include/notcurses/notcurses.h index 75d5018719..8ed000fd16 100644 --- a/include/notcurses/notcurses.h +++ b/include/notcurses/notcurses.h @@ -715,7 +715,7 @@ nccell_set_styles(nccell* c, unsigned stylebits){ } // Extract the style bits from the nccell. -static inline unsigned +static inline uint16_t nccell_styles(const nccell* c){ return c->stylemask; } @@ -1403,7 +1403,7 @@ typedef struct nccapabilities { // (NCSTYLE_UNDERLINE, NCSTYLE_BOLD, etc.) The attribute is only // indicated as supported if the terminal can support it together with color. // For more information, see the "ncv" capability in terminfo(5). -API unsigned notcurses_supported_styles(const struct notcurses* nc) +API uint16_t notcurses_supported_styles(const struct notcurses* nc) __attribute__ ((nonnull (1))) __attribute__ ((pure)); // Returns the number of simultaneous colors claimed to be supported, or 1 if diff --git a/src/lib/direct.c b/src/lib/direct.c index f303a9b32a..ce1a8a6a5e 100644 --- a/src/lib/direct.c +++ b/src/lib/direct.c @@ -1167,7 +1167,7 @@ int ncdirect_styles_off(ncdirect* n, unsigned stylebits){ return ncdirect_off_styles(n, stylebits); } -unsigned ncdirect_styles(const ncdirect* n){ +uint16_t ncdirect_styles(const ncdirect* n){ return n->stylemask; } @@ -1609,7 +1609,7 @@ int ncdirectf_geom(ncdirect* n, ncdirectf* frame, return r; } -unsigned ncdirect_supported_styles(const ncdirect* nc){ +uint16_t ncdirect_supported_styles(const ncdirect* nc){ return term_supported_styles(&nc->tcache); } diff --git a/src/lib/notcurses.c b/src/lib/notcurses.c index 79c2f99ba8..578f03b41f 100644 --- a/src/lib/notcurses.c +++ b/src/lib/notcurses.c @@ -1749,7 +1749,7 @@ int ncplane_cursor_at(const ncplane* n, nccell* c, char** gclust){ return 0; } -unsigned notcurses_supported_styles(const notcurses* nc){ +uint16_t notcurses_supported_styles(const notcurses* nc){ return term_supported_styles(&nc->tcache); } diff --git a/src/lib/termdesc.h b/src/lib/termdesc.h index 239767bfee..ac63c7df4f 100644 --- a/src/lib/termdesc.h +++ b/src/lib/termdesc.h @@ -214,7 +214,7 @@ get_escape(const tinfo* tdesc, escape_e e){ return NULL; } -static inline int +static inline uint16_t term_supported_styles(const tinfo* ti){ return ti->supported_styles; }