From aa0fc403f7f81dedfa3fe22235aecceaf7b91e27 Mon Sep 17 00:00:00 2001 From: Rudy Bousset Date: Mon, 24 Feb 2020 20:54:28 +0100 Subject: sprintf is bav --- src/ft_get_colors.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/ft_get_colors.c') diff --git a/src/ft_get_colors.c b/src/ft_get_colors.c index f54fabc..96be925 100644 --- a/src/ft_get_colors.c +++ b/src/ft_get_colors.c @@ -30,8 +30,7 @@ static int8_t if (i != ft_strlen(num[j])) { ft_free_words(num); - ft_strlcpy(clist->errmsg, FT_ERR_COLOR_ALPHA, - ft_strlen(FT_ERR_COLOR_ALPHA) + 1); + ft_sprintf(clist->errmsg, "%s", FT_ERR_COLOR_ALPHA); return (-1); } i = 0; @@ -46,8 +45,7 @@ static int8_t if (ft_atoi(num[0]) > 255 || ft_atoi(num[1]) > 255 || ft_atoi(num[2]) > 255) { - ft_strlcpy(clist->errmsg, FT_ERR_COLOR_MAX, - ft_strlen(FT_ERR_COLOR_MAX) + 1); + ft_sprintf(clist->errmsg, "%s", FT_ERR_COLOR_MAX); ft_free_words(num); return (-1); } @@ -59,8 +57,7 @@ static int8_t { if (!num[0] || !num[1] || !num[2] || num[3]) { - ft_strlcpy(clist->errmsg, FT_ERR_COLOR_ARGS, - ft_strlen(FT_ERR_COLOR_ARGS) + 1); + ft_sprintf(clist->errmsg, "%s", FT_ERR_COLOR_ARGS); ft_free_words(num); return (-1); } @@ -74,13 +71,12 @@ int8_t if (!(*words) || !words[1] || words[2]) { - ft_strlcpy(clist->errmsg, FT_ERR_ARGS, ft_strlen(FT_ERR_ARGS) + 1); + ft_sprintf(clist->errmsg, "%s", FT_ERR_ARGS); return (-1); } if (!(num = ft_split(words[1], ','))) { - ft_strlcpy(clist->errmsg, FT_ERR_ALLOCATE, - ft_strlen(FT_ERR_ALLOCATE) + 1); + ft_sprintf(clist->errmsg, "%s", FT_ERR_ALLOCATE); return (-1); } if (ft_check_nums_amount(num, clist) < 0) @@ -103,13 +99,12 @@ int8_t if (!(*words) || !words[1] || words[2]) { - ft_strlcpy(clist->errmsg, FT_ERR_ARGS, ft_strlen(FT_ERR_ARGS) + 1); + ft_sprintf(clist->errmsg, "%s", FT_ERR_ARGS); return (-1); } if (!(num = ft_split(words[1], ','))) { - ft_strlcpy(clist->errmsg, FT_ERR_ALLOCATE, - ft_strlen(FT_ERR_ALLOCATE) + 1); + ft_sprintf(clist->errmsg, "%s", FT_ERR_ALLOCATE); return (-1); } if (ft_check_nums_amount(num, clist) < 0) -- cgit v1.2.3