Texture error

This commit is contained in:
Elisee ADJIGUIDI 2022-06-15 15:17:24 +02:00
commit 5a436147ee
2 changed files with 11 additions and 12 deletions

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */ /* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/06 16:10:11 by apommier #+# #+# */ /* Created: 2022/05/06 16:10:11 by apommier #+# #+# */
/* Updated: 2022/06/15 14:23:32 by apommier ### ########.fr */ /* Updated: 2022/06/15 14:36:04 by apommier ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -40,11 +40,6 @@ void put_texture_in_struct(char type, unsigned char *texture, t_data *img)
} }
} }
int verify_texture()
{
}
int is_nbr(char *str) int is_nbr(char *str)
{ {
int i; int i;

View File

@ -6,7 +6,7 @@
/* By: sadjigui <sadjigui@student.42.fr> +#+ +:+ +#+ */ /* By: sadjigui <sadjigui@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/10 17:54:25 by sadjigui #+# #+# */ /* Created: 2022/05/10 17:54:25 by sadjigui #+# #+# */
/* Updated: 2022/06/15 15:09:54 by sadjigui ### ########.fr */ /* Updated: 2022/06/15 15:15:22 by sadjigui ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -285,6 +285,7 @@ char **isafile(char **av, t_data *img)
img->err = 0; img->err = 0;
fd = open(av[1], O_RDONLY); fd = open(av[1], O_RDONLY);
img->to_be_free.fd_one = fd;
str = NULL; str = NULL;
tmp = NULL; tmp = NULL;
if (fd == - 1) if (fd == - 1)
@ -299,29 +300,32 @@ char **isafile(char **av, t_data *img)
img->err = 2; img->err = 2;
} }
tmp = ft_strjoin(str, line); tmp = ft_strjoin(str, line);
if (str != NULL)
free(str);
str = tmp;
//size_line(line, img);
free(line); free(line);
line = NULL; line = NULL;
if (str != NULL)
free(str);
if (!tmp)
quit_game(img);
str = tmp;
} }
if (img->err == 2) if (img->err == 2)
{ {
// free(line);
free(str); free(str);
ft_exit("Error\nBad texture file\n"); ft_exit("Error\nBad texture file\n");
} }
split = ft_split(str, '\n'); split = ft_split(str, '\n');
img->to_be_free.one_tab = split;
free(str); free(str);
free(line); free(line);
close(fd); close(fd);
img->to_be_free.fd_one = -1;
int pass = 0; int pass = 0;
pass = check_texture_color(split, img); pass = check_texture_color(split, img);
check_zero_one(split + pass, img); check_zero_one(split + pass, img);
//leaks here //leaks here
transform_map(split + pass, img); transform_map(split + pass, img);
free_double(split); free_double(split);
img->to_be_free.one_tab = 0;
return (0); return (0);
} }