diff --git a/driver-opencl.c b/driver-opencl.c index 1bbfe933..7d1cfc15 100644 --- a/driver-opencl.c +++ b/driver-opencl.c @@ -603,7 +603,7 @@ char *set_xintensity(char *arg) if (nextptr == NULL) return "Invalid parameters for shader based intensity"; val = atoi(nextptr); - if (val < 1 || val > 9999) + if (val < MIN_XINTENSITY || val > MAX_XINTENSITY) return "Invalid value passed to set shader intensity"; gpus[device].dynamic = false; // Disable dynamic intensity @@ -613,7 +613,7 @@ char *set_xintensity(char *arg) while ((nextptr = strtok(NULL, ",")) != NULL) { val = atoi(nextptr); - if (val < 1 || val > 9999) + if (val < MIN_XINTENSITY || val > MAX_XINTENSITY) return "Invalid value passed to set shader based intensity"; gpus[device].dynamic = false; // Disable dynamic intensity gpus[device].intensity = 0; // Disable regular intensity @@ -678,7 +678,7 @@ void manage_gpu(void) opt_loginput = true; immedok(logwin, true); clear_logwin(); -retry: +retry: // TODO: refactor for (gpu = 0; gpu < nDevs; gpu++) { struct cgpu_info *cgpu = &gpus[gpu]; @@ -865,14 +865,14 @@ retry: goto retry; } - intvar = curses_input("Set experimental GPU scan intensity (1 -> 999)"); // FIXME: no magic numbers + intvar = curses_input("Set experimental GPU scan intensity (" MIN_XINTENSITY_STR " -> " MAX_XINTENSITY_STR ")"); if (!intvar) { wlogprint("Invalid input\n"); goto retry; } xintensity = atoi(intvar); free(intvar); - if (xintensity < 1 || xintensity > 999) { // FIXME: no magic numbers + if (xintensity < MIN_XINTENSITY || xintensity > MAX_XINTENSITY) { wlogprint("Invalid selection\n"); goto retry; } diff --git a/miner.h b/miner.h index decc96f7..a74e3056 100644 --- a/miner.h +++ b/miner.h @@ -1050,6 +1050,10 @@ extern bool add_pool_details(struct pool *pool, bool live, char *url, char *user #define MIN_INTENSITY_STR "8" #define MAX_INTENSITY 31 #define MAX_INTENSITY_STR "31" +#define MIN_XINTENSITY 1 +#define MIN_XINTENSITY_STR "1" +#define MAX_XINTENSITY 999 +#define MAX_XINTENSITY_STR "999" extern bool hotplug_mode; extern int hotplug_time;