mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-04 19:14:26 +00:00
force type checking on curses
This commit is contained in:
parent
5fb5dd0bd6
commit
a9e10988ed
48
cgminer.c
48
cgminer.c
@ -2053,38 +2053,50 @@ static void text_print_status(int thr_id)
|
||||
}
|
||||
|
||||
#ifdef HAVE_CURSES
|
||||
#define CURBUFSIZ 256
|
||||
#define cg_mvwprintw(win, y, x, fmt, ...) do { \
|
||||
char tmp42[CURBUFSIZ]; \
|
||||
snprintf(tmp42, sizeof(tmp42), fmt, ##__VA_ARGS__); \
|
||||
mvwprintw(win, y, x, "%s", tmp42); \
|
||||
} while (0)
|
||||
#define cg_wprintw(win, fmt, ...) do { \
|
||||
char tmp42[CURBUFSIZ]; \
|
||||
snprintf(tmp42, sizeof(tmp42), fmt, ##__VA_ARGS__); \
|
||||
wprintw(win, "%s", tmp42); \
|
||||
} while (0)
|
||||
|
||||
/* Must be called with curses mutex lock held and curses_active */
|
||||
static void curses_print_status(void)
|
||||
{
|
||||
struct pool *pool = current_pool();
|
||||
|
||||
wattron(statuswin, A_BOLD);
|
||||
mvwprintw(statuswin, 0, 0, " " PACKAGE " version " VERSION " - Started: %s", datestamp);
|
||||
cg_mvwprintw(statuswin, 0, 0, " " PACKAGE " version " VERSION " - Started: %s", datestamp);
|
||||
wattroff(statuswin, A_BOLD);
|
||||
mvwhline(statuswin, 1, 0, '-', 80);
|
||||
mvwprintw(statuswin, 2, 0, " %s", statusline);
|
||||
cg_mvwprintw(statuswin, 2, 0, " %s", statusline);
|
||||
wclrtoeol(statuswin);
|
||||
mvwprintw(statuswin, 3, 0, " ST: %d SS: %d NB: %d LW: %d GF: %d RF: %d",
|
||||
cg_mvwprintw(statuswin, 3, 0, " ST: %d SS: %d NB: %d LW: %d GF: %d RF: %d",
|
||||
total_staged(), total_stale, new_blocks,
|
||||
local_work, total_go, total_ro);
|
||||
wclrtoeol(statuswin);
|
||||
if ((pool_strategy == POOL_LOADBALANCE || pool_strategy == POOL_BALANCE) && total_pools > 1) {
|
||||
mvwprintw(statuswin, 4, 0, " Connected to multiple pools with%s LP",
|
||||
cg_mvwprintw(statuswin, 4, 0, " Connected to multiple pools with%s LP",
|
||||
have_longpoll ? "": "out");
|
||||
} else if (pool->has_stratum) {
|
||||
mvwprintw(statuswin, 4, 0, " Connected to %s diff %s with stratum as user %s",
|
||||
cg_mvwprintw(statuswin, 4, 0, " Connected to %s diff %s with stratum as user %s",
|
||||
pool->sockaddr_url, pool->diff, pool->rpc_user);
|
||||
} else {
|
||||
mvwprintw(statuswin, 4, 0, " Connected to %s diff %s with%s %s as user %s",
|
||||
cg_mvwprintw(statuswin, 4, 0, " Connected to %s diff %s with%s %s as user %s",
|
||||
pool->sockaddr_url, pool->diff, have_longpoll ? "": "out",
|
||||
pool->has_gbt ? "GBT" : "LP", pool->rpc_user);
|
||||
}
|
||||
wclrtoeol(statuswin);
|
||||
mvwprintw(statuswin, 5, 0, " Block: %s... Diff:%s Started: %s Best share: %s ",
|
||||
cg_mvwprintw(statuswin, 5, 0, " Block: %s... Diff:%s Started: %s Best share: %s ",
|
||||
current_hash, block_diff, blocktime, best_share);
|
||||
mvwhline(statuswin, 6, 0, '-', 80);
|
||||
mvwhline(statuswin, statusy - 1, 0, '-', 80);
|
||||
mvwprintw(statuswin, devcursor - 1, 1, "[P]ool management %s[S]ettings [D]isplay options [Q]uit",
|
||||
cg_mvwprintw(statuswin, devcursor - 1, 1, "[P]ool management %s[S]ettings [D]isplay options [Q]uit",
|
||||
have_opencl ? "[G]PU management " : "");
|
||||
}
|
||||
|
||||
@ -2134,10 +2146,10 @@ static void curses_print_devstatus(struct cgpu_info *cgpu, int count)
|
||||
wu = cgpu->diff1 / dev_runtime * 60;
|
||||
|
||||
wmove(statuswin,devcursor + count, 0);
|
||||
wprintw(statuswin, " %s %*d: ", cgpu->drv->name, dev_width, cgpu->device_id);
|
||||
cg_wprintw(statuswin, " %s %*d: ", cgpu->drv->name, dev_width, cgpu->device_id);
|
||||
logline[0] = '\0';
|
||||
cgpu->drv->get_statline_before(logline, sizeof(logline), cgpu);
|
||||
wprintw(statuswin, "%s", logline);
|
||||
cg_wprintw(statuswin, "%s", logline);
|
||||
|
||||
dh64 = (double)cgpu->total_mhashes / dev_runtime * 1000000ull;
|
||||
dr64 = (double)cgpu->rolling * 1000000ull;
|
||||
@ -2146,25 +2158,25 @@ static void curses_print_devstatus(struct cgpu_info *cgpu, int count)
|
||||
|
||||
#ifdef USE_USBUTILS
|
||||
if (cgpu->usbinfo.nodev)
|
||||
wprintw(statuswin, "ZOMBIE");
|
||||
cg_wprintw(statuswin, "ZOMBIE");
|
||||
else
|
||||
#endif
|
||||
if (cgpu->status == LIFE_DEAD)
|
||||
wprintw(statuswin, "DEAD ");
|
||||
cg_wprintw(statuswin, "DEAD ");
|
||||
else if (cgpu->status == LIFE_SICK)
|
||||
wprintw(statuswin, "SICK ");
|
||||
cg_wprintw(statuswin, "SICK ");
|
||||
else if (cgpu->deven == DEV_DISABLED)
|
||||
wprintw(statuswin, "OFF ");
|
||||
cg_wprintw(statuswin, "OFF ");
|
||||
else if (cgpu->deven == DEV_RECOVER)
|
||||
wprintw(statuswin, "REST ");
|
||||
cg_wprintw(statuswin, "REST ");
|
||||
else
|
||||
wprintw(statuswin, "%6s", displayed_rolling);
|
||||
cg_wprintw(statuswin, "%6s", displayed_rolling);
|
||||
adj_fwidth(cgpu->diff_accepted, &dawidth);
|
||||
adj_fwidth(cgpu->diff_rejected, &drwidth);
|
||||
adj_width(cgpu->hw_errors, &hwwidth);
|
||||
adj_width(wu, &wuwidth);
|
||||
|
||||
wprintw(statuswin, "/%6sh/s | A:%*.0f R:%*.0f HW:%*d WU:%*.1f/m",
|
||||
cg_wprintw(statuswin, "/%6sh/s | A:%*.0f R:%*.0f HW:%*d WU:%*.1f/m",
|
||||
displayed_hashes,
|
||||
dawidth, cgpu->diff_accepted,
|
||||
drwidth, cgpu->diff_rejected,
|
||||
@ -2173,7 +2185,7 @@ static void curses_print_devstatus(struct cgpu_info *cgpu, int count)
|
||||
|
||||
logline[0] = '\0';
|
||||
cgpu->drv->get_statline(logline, sizeof(logline), cgpu);
|
||||
wprintw(statuswin, "%s", logline);
|
||||
cg_wprintw(statuswin, "%s", logline);
|
||||
|
||||
wclrtoeol(statuswin);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user