testing/monkey: fix unsigned zero comparison

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
pengyiqiang 2024-04-08 10:24:08 +08:00 committed by Xiang Xiao
parent da0c870b94
commit 92d922a108

View File

@ -130,8 +130,8 @@ struct monkey_param_s
int ver_res; int ver_res;
int period_min; int period_min;
int period_max; int period_max;
uint8_t btn_bit; int btn_bit;
uint8_t log_level; int log_level;
struct monkey_event_config_s event[MONKEY_EVENT_LAST]; struct monkey_event_config_s event[MONKEY_EVENT_LAST];
}; };
@ -425,12 +425,12 @@ static void parse_commandline(int argc, FAR char **argv,
break; break;
case 'b': case 'b':
OPTARG_TO_VALUE(param->btn_bit, uint8_t, 10); OPTARG_TO_VALUE(param->btn_bit, int, 10);
param->btn_bit = CONSTRAIN(param->btn_bit, 0, 31); param->btn_bit = CONSTRAIN(param->btn_bit, 0, 31);
break; break;
case 'l': case 'l':
OPTARG_TO_VALUE(param->log_level, uint8_t, 10); OPTARG_TO_VALUE(param->log_level, int, 10);
param->log_level = CONSTRAIN(param->log_level, 0, param->log_level = CONSTRAIN(param->log_level, 0,
MONKEY_LOG_LEVEL_LAST - 1); MONKEY_LOG_LEVEL_LAST - 1);
break; break;