Browse Source

Allow parsed values to be zero which will allow 0 values in the config file to work.

nfactor-troky
ckolivas 13 years ago
parent
commit
86d6073ee0
  1. 12
      main.c

12
main.c

@ -1154,7 +1154,7 @@ static char *set_gpu_engine(char *arg)
if (nextptr == NULL) if (nextptr == NULL)
return "Invalid parameters for set gpu engine"; return "Invalid parameters for set gpu engine";
get_intrange(nextptr, &val1, &val2); get_intrange(nextptr, &val1, &val2);
if (val1 < 0 || val1 > 9999 || val2 <= 0 || val2 > 9999) if (val1 < 0 || val1 > 9999 || val2 < 0 || val2 > 9999)
return "Invalid value passed to set_gpu_engine"; return "Invalid value passed to set_gpu_engine";
gpus[device].min_engine = val1; gpus[device].min_engine = val1;
@ -1163,7 +1163,7 @@ static char *set_gpu_engine(char *arg)
while ((nextptr = strtok(NULL, ",")) != NULL) { while ((nextptr = strtok(NULL, ",")) != NULL) {
get_intrange(nextptr, &val1, &val2); get_intrange(nextptr, &val1, &val2);
if (val1 < 0 || val1 > 9999 || val2 <= 0 || val2 > 9999) if (val1 < 0 || val1 > 9999 || val2 < 0 || val2 > 9999)
return "Invalid value passed to set_gpu_engine"; return "Invalid value passed to set_gpu_engine";
gpus[device].min_engine = val1; gpus[device].min_engine = val1;
gpus[device].gpu_engine = val2; gpus[device].gpu_engine = val2;
@ -1225,14 +1225,14 @@ static char *set_gpu_memclock(char *arg)
if (nextptr == NULL) if (nextptr == NULL)
return "Invalid parameters for set gpu memclock"; return "Invalid parameters for set gpu memclock";
val = atoi(nextptr); val = atoi(nextptr);
if (val <= 0 || val >= 9999) if (val < 0 || val >= 9999)
return "Invalid value passed to set_gpu_memclock"; return "Invalid value passed to set_gpu_memclock";
gpus[device++].gpu_memclock = val; gpus[device++].gpu_memclock = val;
while ((nextptr = strtok(NULL, ",")) != NULL) { while ((nextptr = strtok(NULL, ",")) != NULL) {
val = atoi(nextptr); val = atoi(nextptr);
if (val <= 0 || val >= 9999) if (val < 0 || val >= 9999)
return "Invalid value passed to set_gpu_memclock"; return "Invalid value passed to set_gpu_memclock";
gpus[device++].gpu_memclock = val; gpus[device++].gpu_memclock = val;
@ -1313,14 +1313,14 @@ static char *set_gpu_vddc(char *arg)
if (nextptr == NULL) if (nextptr == NULL)
return "Invalid parameters for set gpu vddc"; return "Invalid parameters for set gpu vddc";
val = atof(nextptr); val = atof(nextptr);
if (val <= 0 || val >= 9999) if (val < 0 || val >= 9999)
return "Invalid value passed to set_gpu_vddc"; return "Invalid value passed to set_gpu_vddc";
gpus[device++].gpu_vddc = val; gpus[device++].gpu_vddc = val;
while ((nextptr = strtok(NULL, ",")) != NULL) { while ((nextptr = strtok(NULL, ",")) != NULL) {
val = atof(nextptr); val = atof(nextptr);
if (val <= 0 || val >= 9999) if (val < 0 || val >= 9999)
return "Invalid value passed to set_gpu_vddc"; return "Invalid value passed to set_gpu_vddc";
gpus[device++].gpu_vddc = val; gpus[device++].gpu_vddc = val;

Loading…
Cancel
Save