Fixed RGB parsing
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: pblagoje <pblagoje@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/04/15 16:11:24 by pblagoje #+# #+# */
|
||||
/* Updated: 2022/05/04 12:58:13 by pblagoje ### ########.fr */
|
||||
/* Updated: 2022/05/04 16:46:11 by pblagoje ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -51,19 +51,6 @@ static void set_rgb(int *plan, char **rgb)
|
||||
*plan = 0 << 24 | r << 16 | g << 8 | b;
|
||||
}
|
||||
|
||||
/*void ft_free_2d(char **str)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (str && str[i])
|
||||
{
|
||||
free(str[i]);
|
||||
i++;
|
||||
}
|
||||
free(str);
|
||||
}*/
|
||||
|
||||
int check_rgb(t_txt *txt, char *elem, char identifier)
|
||||
{
|
||||
char **rgb;
|
||||
@@ -78,5 +65,6 @@ int check_rgb(t_txt *txt, char *elem, char identifier)
|
||||
set_rgb(&txt->rgb_floor, rgb);
|
||||
else
|
||||
set_rgb(&txt->rgb_ceiling, rgb);
|
||||
mb_free_2d((void **)rgb, ft_strlen_2d(rgb));
|
||||
return (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/* By: pblagoje <pblagoje@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/04/15 16:03:50 by pblagoje #+# #+# */
|
||||
/* Updated: 2022/05/04 13:14:21 by pblagoje ### ########.fr */
|
||||
/* Updated: 2022/05/04 15:32:54 by pblagoje ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -89,10 +89,7 @@ int fill_map(t_map *map, int fd)
|
||||
|
||||
map->content = (char **)mb_alloc((map->size_y + 1) * sizeof(char *));
|
||||
if (!map->content)
|
||||
{
|
||||
mb_free(map->tmp_str);
|
||||
return (EXIT_FAILURE);
|
||||
}
|
||||
mb_exit("Error\nCouldn't allocate memory for map.\n", EXIT_FAILURE);
|
||||
i = -1;
|
||||
while (++i < map->size_y)
|
||||
{
|
||||
@@ -103,10 +100,7 @@ int fill_map(t_map *map, int fd)
|
||||
}
|
||||
map->content[i] = (char *)mb_alloc((map->size_x + 1) * sizeof(char));
|
||||
if (!map->content[i])
|
||||
{
|
||||
mb_free(map->tmp_str);
|
||||
return (EXIT_FAILURE);
|
||||
}
|
||||
mb_exit("Error\nCouldn't allocate memory for row.\n", EXIT_FAILURE);
|
||||
fill_row(map->content[i], map->tmp_str, map->size_x);
|
||||
mb_free(map->tmp_str);
|
||||
map->tmp_str = NULL;
|
||||
|
||||
Reference in New Issue
Block a user