Fixed RGB parsing

This commit is contained in:
Philippe BLAGOJEVIC
2022-05-04 16:53:38 +02:00
parent a6c61ec557
commit 6000629c17
5 changed files with 12 additions and 26 deletions

View File

@@ -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;