Use common validation infra for mwfact upper and lower limits values

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-03-19 06:53:41 +01:00
parent 6b5cf37119
commit b748d114bf
2 changed files with 2 additions and 14 deletions

View File

@ -423,6 +423,8 @@ cfg_new(void)
cfg_set_validate_func(cfg, "screen|tags|tag|ncol", config_validate_supone_int);
/* Check float values */
cfg_set_validate_func(cfg, "screen|general|mwfact_lower_limit", config_validate_zero_one_float);
cfg_set_validate_func(cfg, "screen|general|mwfact_upper_limit", config_validate_zero_one_float);
cfg_set_validate_func(cfg, "screen|tags|tag|mwfact", config_validate_zero_one_float);
return cfg;

View File

@ -334,20 +334,6 @@ config_parse_screen(cfg_t *cfg, int screen)
virtscreen->mwfact_lower_limit = cfg_getfloat(cfg_general, "mwfact_lower_limit");
virtscreen->mwfact_upper_limit = cfg_getfloat(cfg_general, "mwfact_upper_limit");
if(virtscreen->mwfact_lower_limit < 0 || virtscreen->mwfact_lower_limit > 1)
{
warn("incorrect value %f for mwfact_lower_limit, must be between 0 and 1\n",
virtscreen->mwfact_lower_limit);
virtscreen->mwfact_lower_limit = 0.1;
}
if(virtscreen->mwfact_upper_limit < 0 || virtscreen->mwfact_upper_limit > 1)
{
warn("incorrect value %f for mwfact_upper_limit, must be between 0 and 1\n",
virtscreen->mwfact_lower_limit);
virtscreen->mwfact_upper_limit = 0.9;
}
if(virtscreen->mwfact_upper_limit < virtscreen->mwfact_lower_limit)
{
warn("mwfact_upper_limit must be greater than mwfact_lower_limit\n");