[mojosetup] Fix unused variable warnings in the ncurses plugin.
Francois Gouget
fgouget at codeweavers.com
Mon Aug 10 13:17:24 EDT 2020
The getmaxyx() macro always returns a width and height so use a
subterfuge to silence the compiler warning when we only need one of
them.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
gui_ncurses.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gui_ncurses.c b/gui_ncurses.c
index ee53e56..223a254 100644
--- a/gui_ncurses.c
+++ b/gui_ncurses.c
@@ -109,6 +109,7 @@ static void drawButton(MojoBox *mojobox, int button)
const char *str = mojobox->buttontext[button];
int w, h;
getmaxyx(win, h, w);
+ (void)h; /* unused arg. */
if (!hover)
wbkgdset(win, COLOR_PAIR(MOJOCOLOR_BUTTONNORMAL));
@@ -167,6 +168,7 @@ static void drawBackground(WINDOW *win)
{
int w, h;
getmaxyx(win, h, w);
+ (void)h; /* unused arg. */
wattron(win, COLOR_PAIR(MOJOCOLOR_BACKGROUND) | A_BOLD);
mvwaddstr(win, 0, 0, title);
mvwhline(win, 1, 1, ACS_HLINE, w-2);
@@ -444,6 +446,7 @@ static int upkeepBox(MojoBox **_mojobox, int ch)
case KEY_DOWN:
getmaxyx(mojobox->textwin, h, w);
+ (void)w; /* unused arg. */
if (mojobox->textpos < (mojobox->textlinecount-h))
{
mojobox->textpos++;
@@ -973,6 +976,7 @@ static int optionBox(const char *title, MojoGuiSetupOptions *opts,
int maxw, maxh;
int y = --selected - mojobox->textpos;
getmaxyx(win, maxh, maxw);
+ (void)maxh; /* unused arg. */
if (selected < mojobox->textpos)
{
upkeepBox(&mojobox, ch); // upkeepBox does scrolling
@@ -1160,6 +1164,7 @@ static char *inputBox(const char *prompt, int *command, boolean can_back,
{
wrefresh(stdscr);
getmaxyx(stdscr, h, w);
+ (void)h; /* unused arg. */
w -= 10;
text = (char *) xrealloc(mojobox->text, w+4);
text[0] = '\n';
@@ -1393,6 +1398,7 @@ static boolean MojoGui_ncurses_progress(const char *type, const char *component,
const int buttoncount = (can_cancel) ? 1 : 0;
char *spacebuf = NULL;
getmaxyx(stdscr, h, w);
+ (void)h; /* unused arg. */
w -= 10;
text = (char *) xmalloc((w * 3) + 16);
if (snprintf(text, w, "%s", component) > (w-4))
--
2.20.1
More information about the mojosetup
mailing list