aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_get_map.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-15 20:29:21 +0100
committerRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-15 20:29:21 +0100
commit030fe8c3316d1e1f5f3dea81c3fffd8e00c16afa (patch)
treeaa661716c5ffdd844e41bccb9be833637eaaa3b8 /src/ft_get_map.c
parentIn progress (diff)
download42-cub3d-030fe8c3316d1e1f5f3dea81c3fffd8e00c16afa.tar.gz
42-cub3d-030fe8c3316d1e1f5f3dea81c3fffd8e00c16afa.tar.bz2
42-cub3d-030fe8c3316d1e1f5f3dea81c3fffd8e00c16afa.tar.xz
42-cub3d-030fe8c3316d1e1f5f3dea81c3fffd8e00c16afa.tar.zst
42-cub3d-030fe8c3316d1e1f5f3dea81c3fffd8e00c16afa.zip
Work in progress, res now
Diffstat (limited to 'src/ft_get_map.c')
-rw-r--r--src/ft_get_map.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ft_get_map.c b/src/ft_get_map.c
index ee23c7a..cb677da 100644
--- a/src/ft_get_map.c
+++ b/src/ft_get_map.c
@@ -53,7 +53,11 @@ static int8_t
if (!(clist->mlist->mapl = (char *)ft_nrealloc(clist->mlist->mapl,
((clist->mlist->map_w + 1) * i) * sizeof(char),
((clist->mlist->map_w + 1) * (i + 1)) * sizeof(char))))
+ {
+ ft_strlcpy(clist->errmsg, FT_ERR_ALLOCATE,
+ ft_strlen(FT_ERR_ALLOCATE) + 1);
return (-1);
+ }
ft_linecpy(line, clist->mlist->mapl, (clist->mlist->map_w + 1) * i);
return (0);
}
@@ -65,12 +69,14 @@ int
if (!line[0])
{
ft_memdel((void**)&line);
+ ft_strlcpy(clist->errmsg, FT_ERR_READ, ft_strlen(FT_ERR_READ) + 1);
return (-1);
}
clist->mlist->map_w = ft_get_line_len(line);
if (ft_check_map_line(line, 1, clist) < 0)
{
ft_memdel((void**)&line);
+ ft_strlcpy(clist->errmsg, FT_ERR_READ, ft_strlen(FT_ERR_READ) + 1);
return (-1);
}
ft_memdel((void**)&clist->mlist->mapl);