change 2 -Wextra errors

This commit is contained in:
hugogogo
2021-05-19 18:03:39 +02:00
parent d23e5add99
commit f0910e0e6b
2 changed files with 23 additions and 22 deletions

View File

@@ -2,29 +2,30 @@
# variables names #
# - - - - - - - - - #
NAME = libftprintf.a
CC = gcc
VPATH = srcs
NAME = libftprintf.a
CC = gcc
VPATH = srcs
IDIR = .
_DEPS = ft_printf.h
DEPS = $(_DEPS:%.h=$(IDIR)/%.h)
IDIR = .
_DEPS = ft_printf.h
DEPS = $(_DEPS:%.h=$(IDIR)/%.h)
LDIR = ./libft/
_LIBS = libft.a
LIBS = $(_LIBS:lib%.a=%)
LDIR = ./libft/
_LIBS = libft.a
LIBS = $(_LIBS:lib%.a=%)
SRCS = ft_printf.c \
ft_next_word.c \
ft_convert.c \
ft_flag_transform.c \
ft_flag_transform_bonus.c
SRCS = ft_printf.c \
ft_next_word.c \
ft_convert.c \
ft_flag_transform.c \
ft_flag_transform_bonus.c
ODIR = ./builds
OBJS = $(SRCS:%.c=$(ODIR)/%.o)
ODIR = ./builds
OBJS = $(SRCS:%.c=$(ODIR)/%.o)
CFLAGS = -I$(IDIR) -g
LFLAGS = -L$(LDIR) -l$(LIBS)
CFLAGS = -I$(IDIR) -g
CFLAGS += -Wall -Wextra -Werror
LFLAGS = -L$(LDIR) -l$(LIBS)
# - - - - - - - - - - - #
# rules to execute #
@@ -56,7 +57,8 @@ fclean: clean
re: fclean all
gcc:
$(CC) $(CFLAGS) main.c -L. -lftprintf
gcc:
$(CC) -I$(IDIR) -g main.c -L. -lftprintf
.PHONY: all clean fclean re gcc

View File

@@ -105,7 +105,6 @@ char *width_flags(char *print, char *s, int width, int zero)
{
char *tmp;
char *minus;
char c;
int len;
len = ft_strlen(print) + zero;
@@ -165,7 +164,7 @@ char *ft_width(char *s, char *print, int *size, char *type)
}
*size = ft_atoi(tmp);
tmp[0] = '\0';
if (*size > ft_strlen(print) + zero)
if ((unsigned int)*size > ft_strlen(print) + zero)
print = width_flags(print, s, *size, zero);
else
*size = ft_strlen(print) + zero;