From: Lukas Jiriste Date: Fri, 3 May 2024 10:57:34 +0000 (+0200) Subject: Fix undersample option accepting 0 X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=793897be15bdf4ec3bfb09767d8692cc8944b802;p=42%2Ffract-ol.git Fix undersample option accepting 0 When -u 0 is specified, it leads to an infinite loop. The window is then unresponsive which is clearly a bug. Now the -u 0 option emits a help message. --- diff --git a/src/parsing.c b/src/parsing.c index 69789bb..61f0782 100644 --- a/src/parsing.c +++ b/src/parsing.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/04/26 10:47:46 by ljiriste #+# #+# */ -/* Updated: 2024/04/26 11:06:32 by ljiriste ### ########.fr */ +/* Updated: 2024/05/03 12:57:05 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -73,7 +73,7 @@ static int parse_arg(char **argv, t_session *s, int *i) && ft_isint(argv[*i + 1]) && ft_atoi(argv[*i + 1]) > 0) s->img.height = ft_atoi(argv[++*i]); else if (!ft_strcmp(argv[*i], "-u") - && ft_isint(argv[*i + 1]) && ft_atoi(argv[*i + 1]) >= 0) + && ft_isint(argv[*i + 1]) && ft_atoi(argv[*i + 1]) > 0) s->img.undersample_max = ft_atoi(argv[++*i]); else if (!ft_strcmp(argv[*i], "-d") && ft_isint(argv[*i + 1])) s->set.detail = ft_atoi(argv[++*i]);